From 637990314b6d90428e36546e1dec8914740ffcb6 Mon Sep 17 00:00:00 2001 From: water111 <48171810+water111@users.noreply.github.com> Date: Sat, 18 Apr 2026 18:14:44 -0400 Subject: [PATCH] wip: better stack var support (#4222) Closes #736 --------- Co-authored-by: Hat Kid <6624576+Hat-Kid@users.noreply.github.com> --- decompiler/IR2/AtomicOpForm.cpp | 20 +- decompiler/IR2/Env.cpp | 242 ++ decompiler/IR2/Env.h | 36 + decompiler/IR2/Form.cpp | 31 +- decompiler/IR2/Form.h | 14 +- decompiler/IR2/FormExpressionAnalysis.cpp | 266 +- decompiler/IR2/FormStack.cpp | 98 +- decompiler/IR2/GenericElementMatcher.cpp | 7 + decompiler/analysis/insert_lets.cpp | 49 +- .../config/jak2/ntsc_v1/type_casts.jsonc | 8 +- .../process_stack_size_overrides.jsonc | 3 +- .../config/jak3/ntsc_v1/type_casts.jsonc | 295 +- goal_src/jak1/build/all_objs.json | 4 +- goal_src/jak1/engine/anim/joint-exploder.gc | 19 +- goal_src/jak1/engine/anim/joint-mod-h.gc | 116 +- goal_src/jak1/engine/anim/joint.gc | 186 +- goal_src/jak1/engine/camera/cam-combiner.gc | 35 +- goal_src/jak1/engine/camera/cam-layout.gc | 248 +- goal_src/jak1/engine/camera/cam-master.gc | 55 +- goal_src/jak1/engine/camera/cam-states.gc | 173 +- goal_src/jak1/engine/camera/cam-update.gc | 25 +- goal_src/jak1/engine/camera/camera.gc | 328 +- .../jak1/engine/collide/collide-edge-grab.gc | 38 +- goal_src/jak1/engine/collide/collide-probe.gc | 6 +- .../engine/collide/collide-shape-rider.gc | 30 +- goal_src/jak1/engine/collide/surface-h.gc | 4 +- .../jak1/engine/common-obs/collectables.gc | 187 +- .../jak1/engine/common-obs/dark-eco-pool.gc | 3 +- .../jak1/engine/common-obs/generic-obs.gc | 22 +- goal_src/jak1/engine/common-obs/nav-enemy.gc | 7 +- goal_src/jak1/engine/common-obs/rigid-body.gc | 15 +- goal_src/jak1/engine/common-obs/water-anim.gc | 105 +- goal_src/jak1/engine/common-obs/water.gc | 21 +- goal_src/jak1/engine/debug/anim-tester.gc | 111 +- goal_src/jak1/engine/debug/debug-sphere.gc | 28 +- goal_src/jak1/engine/debug/debug.gc | 152 +- goal_src/jak1/engine/debug/memory-usage.gc | 16 +- goal_src/jak1/engine/debug/menu.gc | 54 +- goal_src/jak1/engine/debug/viewer.gc | 12 +- goal_src/jak1/engine/dma/dma-buffer.gc | 3 +- goal_src/jak1/engine/dma/dma-disasm.gc | 65 +- goal_src/jak1/engine/draw/drawable.gc | 375 +- goal_src/jak1/engine/entity/actor-link-h.gc | 11 +- goal_src/jak1/engine/entity/ambient.gc | 97 +- goal_src/jak1/engine/entity/entity.gc | 346 +- goal_src/jak1/engine/entity/res.gc | 52 +- goal_src/jak1/engine/game/effect-control.gc | 150 +- goal_src/jak1/engine/game/fact-h.gc | 4 +- goal_src/jak1/engine/game/game-info.gc | 5 +- goal_src/jak1/engine/game/game-save.gc | 55 +- goal_src/jak1/engine/game/projectiles.gc | 112 +- goal_src/jak1/engine/geometry/cylinder.gc | 103 +- goal_src/jak1/engine/geometry/path-h.gc | 8 +- goal_src/jak1/engine/geometry/vol.gc | 182 +- goal_src/jak1/engine/gfx/foreground/ripple.gc | 21 +- goal_src/jak1/engine/gfx/math-camera.gc | 13 +- goal_src/jak1/engine/gfx/mood/mood-tables.gc | 82 +- goal_src/jak1/engine/gfx/mood/mood.gc | 113 +- goal_src/jak1/engine/gfx/mood/time-of-day.gc | 20 +- goal_src/jak1/engine/gfx/ocean/ocean-mid.gc | 95 +- .../jak1/engine/gfx/ocean/ocean-texture.gc | 41 +- .../jak1/engine/gfx/ocean/ocean-transition.gc | 271 +- goal_src/jak1/engine/gfx/shadow/shadow.gc | 20 +- .../sprite/sparticle/sparticle-launcher.gc | 13 +- goal_src/jak1/engine/level/load-boundary.gc | 7 +- goal_src/jak1/engine/load/loader.gc | 223 +- goal_src/jak1/engine/math/math.gc | 3 + goal_src/jak1/engine/math/transformq.gc | 11 +- goal_src/jak1/engine/nav/navigate.gc | 798 ++-- goal_src/jak1/engine/physics/trajectory.gc | 6 +- .../engine/target/collide-reaction-target.gc | 441 +-- goal_src/jak1/engine/target/logic-target.gc | 134 +- goal_src/jak1/engine/target/target-handler.gc | 217 +- goal_src/jak1/engine/target/target-part.gc | 10 +- goal_src/jak1/engine/target/target2.gc | 96 +- .../jak1/engine/ui/progress/progress-draw.gc | 478 ++- goal_src/jak1/engine/ui/progress/progress.gc | 31 +- goal_src/jak1/engine/util/capture.gc | 25 +- goal_src/jak1/engine/util/sync-info.gc | 23 +- goal_src/jak1/levels/beach/beach-obs.gc | 31 +- goal_src/jak1/levels/citadel/citadel-obs.gc | 11 +- goal_src/jak1/levels/citadel/citadel-part.gc | 2 +- .../jak1/levels/citadel/citb-drop-plat.gc | 35 +- goal_src/jak1/levels/citadel/citb-plat.gc | 4 +- .../jak1/levels/common/battlecontroller.gc | 5 +- goal_src/jak1/levels/demo/static-screen.gc | 9 +- goal_src/jak1/levels/finalboss/final-door.gc | 23 +- .../jak1/levels/finalboss/robotboss-weapon.gc | 53 +- goal_src/jak1/levels/finalboss/robotboss.gc | 52 +- goal_src/jak1/levels/jungle/jungle-mirrors.gc | 34 +- goal_src/jak1/levels/jungle/jungle-obs.gc | 17 +- goal_src/jak1/levels/jungleb/plat-flip.gc | 42 +- goal_src/jak1/levels/lavatube/lavatube-obs.gc | 5 +- .../jak1/levels/maincave/driller-lurker.gc | 14 +- goal_src/jak1/levels/maincave/gnawer.gc | 64 +- goal_src/jak1/levels/maincave/maincave-obs.gc | 43 +- .../jak1/levels/maincave/mother-spider.gc | 32 +- goal_src/jak1/levels/misty/balloonlurker.gc | 34 +- goal_src/jak1/levels/misty/misty-conveyor.gc | 111 +- goal_src/jak1/levels/misty/mistycannon.gc | 15 +- goal_src/jak1/levels/ogre/ogreboss.gc | 7 +- .../racer_common/collide-reaction-racer.gc | 229 +- .../levels/rolling/rolling-lightning-mole.gc | 105 +- .../jak1/levels/rolling/rolling-robber.gc | 20 +- goal_src/jak1/levels/snow/snow-ball.gc | 4 +- goal_src/jak1/levels/snow/snow-bumper.gc | 16 +- goal_src/jak1/levels/snow/snow-bunny.gc | 15 +- .../jak1/levels/snow/snow-flutflut-obs.gc | 6 +- goal_src/jak1/levels/snow/snow-obs.gc | 5 +- goal_src/jak1/levels/snow/snow-ram.gc | 17 +- goal_src/jak1/levels/sunken/puffer.gc | 7 +- goal_src/jak1/levels/sunken/shover.gc | 6 +- .../jak1/levels/sunken/square-platform.gc | 33 +- goal_src/jak1/levels/sunken/steam-cap.gc | 5 +- goal_src/jak1/levels/sunken/sun-iris-door.gc | 6 +- goal_src/jak1/levels/sunken/sunken-fish.gc | 14 +- goal_src/jak1/levels/sunken/whirlpool.gc | 8 +- .../jak1/levels/village1/fishermans-boat.gc | 95 +- goal_src/jak1/levels/village1/yakow.gc | 41 +- goal_src/jak1/levels/village2/swamp-blimp.gc | 5 +- .../levels/village_common/villagep-obs.gc | 43 +- goal_src/jak2/engine/ai/enemy.gc | 42 +- goal_src/jak2/engine/anim/joint-exploder.gc | 113 +- goal_src/jak2/engine/anim/joint-mod.gc | 970 +++-- goal_src/jak2/engine/anim/joint.gc | 433 ++- goal_src/jak2/engine/camera/cam-combiner.gc | 39 +- goal_src/jak2/engine/camera/cam-layout.gc | 329 +- goal_src/jak2/engine/camera/cam-master.gc | 76 +- goal_src/jak2/engine/camera/cam-states-dbg.gc | 45 +- goal_src/jak2/engine/camera/cam-states.gc | 436 +-- goal_src/jak2/engine/camera/cam-update.gc | 30 +- goal_src/jak2/engine/camera/camera.gc | 432 +-- goal_src/jak2/engine/collide/collide-cache.gc | 42 +- .../jak2/engine/collide/collide-edge-grab.gc | 50 +- .../engine/collide/collide-shape-rider.gc | 41 +- goal_src/jak2/engine/collide/collide-shape.gc | 535 ++- goal_src/jak2/engine/collide/find-nearest.gc | 54 +- .../jak2/engine/common_objs/basebutton.gc | 22 +- .../jak2/engine/common_objs/blocking-plane.gc | 22 +- goal_src/jak2/engine/common_objs/conveyor.gc | 88 +- .../jak2/engine/common_objs/dark-eco-pool.gc | 3 +- goal_src/jak2/engine/common_objs/elevator.gc | 164 +- .../jak2/engine/common_objs/generic-obs.gc | 62 +- .../jak2/engine/common_objs/water-anim.gc | 59 +- .../jak2/engine/common_objs/water-flow.gc | 83 +- goal_src/jak2/engine/common_objs/water.gc | 79 +- goal_src/jak2/engine/debug/debug-sphere.gc | 57 +- goal_src/jak2/engine/debug/default-menu.gc | 169 +- goal_src/jak2/engine/debug/history.gc | 470 ++- goal_src/jak2/engine/debug/memory-usage.gc | 437 +-- goal_src/jak2/engine/debug/menu.gc | 157 +- .../jak2/engine/debug/nav/mysql-nav-graph.gc | 445 ++- .../jak2/engine/debug/nav/nav-graph-editor.gc | 288 +- goal_src/jak2/engine/debug/viewer.gc | 50 +- goal_src/jak2/engine/dma/dma-buffer.gc | 3 +- goal_src/jak2/engine/entity/actor-link-h.gc | 49 +- goal_src/jak2/engine/entity/res.gc | 288 +- goal_src/jak2/engine/game/effect-control.gc | 203 +- goal_src/jak2/engine/game/fact-h.gc | 87 +- goal_src/jak2/engine/game/game-info.gc | 292 +- goal_src/jak2/engine/game/game-save.gc | 111 +- goal_src/jak2/engine/game/task/task-arrow.gc | 28 +- goal_src/jak2/engine/geometry/cylinder.gc | 154 +- goal_src/jak2/engine/geometry/path-h.gc | 52 +- goal_src/jak2/engine/geometry/vol.gc | 235 +- .../jak2/engine/gfx/background/tie/tie.gc | 221 +- goal_src/jak2/engine/gfx/foreground/eye.gc | 26 +- .../jak2/engine/gfx/foreground/lightning.gc | 715 ++-- goal_src/jak2/engine/gfx/foreground/ripple.gc | 30 +- goal_src/jak2/engine/gfx/mood/mood-funcs2.gc | 91 +- goal_src/jak2/engine/gfx/mood/mood.gc | 26 +- goal_src/jak2/engine/gfx/ocean/ocean-mid.gc | 80 +- goal_src/jak2/engine/gfx/ocean/ocean-near.gc | 6 +- .../jak2/engine/gfx/ocean/ocean-texture.gc | 42 +- .../jak2/engine/gfx/ocean/ocean-transition.gc | 298 +- goal_src/jak2/engine/gfx/ocean/ocean.gc | 550 +-- .../jak2/engine/gfx/sprite/sprite-distort.gc | 69 +- .../jak2/engine/gfx/sprite/sprite-glow.gc | 46 +- goal_src/jak2/engine/level/region.gc | 324 +- goal_src/jak2/engine/load/decomp.gc | 12 +- goal_src/jak2/engine/load/loader.gc | 645 ++-- goal_src/jak2/engine/math/euler.gc | 28 +- goal_src/jak2/engine/math/math.gc | 47 +- goal_src/jak2/engine/math/quaternion.gc | 250 +- goal_src/jak2/engine/math/transformq.gc | 87 +- goal_src/jak2/engine/nav/nav-control.gc | 1794 ++++----- goal_src/jak2/engine/nav/nav-enemy.gc | 44 +- goal_src/jak2/engine/nav/nav-mesh-h.gc | 199 +- goal_src/jak2/engine/physics/chain-physics.gc | 423 +- goal_src/jak2/engine/physics/rigid-body.gc | 135 +- goal_src/jak2/engine/physics/trajectory.gc | 80 +- .../process-drawable/process-drawable.gc | 230 +- goal_src/jak2/engine/scene/scene.gc | 172 +- goal_src/jak2/engine/sound/gsound.gc | 184 +- goal_src/jak2/engine/sound/speech.gc | 21 +- .../jak2/engine/spatial-hash/actor-hash.gc | 77 +- .../jak2/engine/spatial-hash/spatial-hash.gc | 75 +- .../jak2/engine/target/board/board-states.gc | 47 +- .../jak2/engine/target/board/target-board.gc | 3 +- .../engine/target/collide-reaction-target.gc | 846 ++-- .../jak2/engine/target/gun/gun-dark-shot.gc | 177 +- .../jak2/engine/target/gun/gun-red-shot.gc | 24 +- .../jak2/engine/target/gun/gun-yellow-shot.gc | 2 +- goal_src/jak2/engine/target/logic-target.gc | 220 +- .../jak2/engine/target/mech/grunt-mech.gc | 69 +- .../jak2/engine/target/mech/mech-states.gc | 38 +- goal_src/jak2/engine/target/surface-h.gc | 4 +- goal_src/jak2/engine/target/target-anim.gc | 24 +- goal_src/jak2/engine/target/target-darkjak.gc | 1484 ++++--- goal_src/jak2/engine/target/target-death.gc | 453 +-- goal_src/jak2/engine/target/target-handler.gc | 667 ++-- goal_src/jak2/engine/target/target-part.gc | 584 ++- goal_src/jak2/engine/target/target-turret.gc | 75 +- goal_src/jak2/engine/target/target2.gc | 100 +- goal_src/jak2/engine/ui/bigmap.gc | 184 +- goal_src/jak2/engine/ui/hud-classes.gc | 205 +- goal_src/jak2/engine/util/profile.gc | 33 +- goal_src/jak2/engine/util/sync-info.gc | 24 +- goal_src/jak2/levels/atoll/ash1-course.gc | 14 +- goal_src/jak2/levels/atoll/atoll-obs.gc | 41 +- goal_src/jak2/levels/atoll/atoll-part.gc | 4 +- goal_src/jak2/levels/atoll/juicer.gc | 6 +- goal_src/jak2/levels/atoll/sig0-course.gc | 267 +- goal_src/jak2/levels/atoll/sniper.gc | 5 +- goal_src/jak2/levels/castle/castle-obs.gc | 122 +- goal_src/jak2/levels/city/bombbot/bombbot.gc | 421 +- .../jak2/levels/city/common/height-map.gc | 71 +- goal_src/jak2/levels/city/common/nav-graph.gc | 166 +- .../jak2/levels/city/common/pilot-states.gc | 39 +- goal_src/jak2/levels/city/common/trail.gc | 116 +- goal_src/jak2/levels/city/ctywide-obs.gc | 340 +- goal_src/jak2/levels/city/ctywide-part.gc | 2 +- goal_src/jak2/levels/city/ctywide-tasks.gc | 34 +- .../city/kiddogescort/crocesc-states.gc | 50 +- .../jak2/levels/city/kiddogescort/crocesc.gc | 47 +- .../levels/city/kiddogescort/hal4-course.gc | 422 +- .../levels/city/kiddogescort/kidesc-states.gc | 225 +- .../jak2/levels/city/kiddogescort/kidesc.gc | 80 +- .../levels/city/meet-brutter/meet-brutter.gc | 187 +- .../jak2/levels/city/onintent/onin-game.gc | 50 +- .../jak2/levels/city/package/delivery-task.gc | 98 +- .../jak2/levels/city/port/race/errol-chal.gc | 76 +- .../jak2/levels/city/sack/collection-task.gc | 24 +- goal_src/jak2/levels/city/shuttle/shuttle.gc | 122 +- .../levels/city/traffic/citizen/citizen.gc | 105 +- .../levels/city/traffic/citizen/civilian.gc | 216 +- .../jak2/levels/city/traffic/citizen/guard.gc | 189 +- .../city/traffic/citizen/metalhead-grunt.gc | 43 +- .../traffic/citizen/metalhead-predator.gc | 60 +- .../levels/city/traffic/traffic-engine.gc | 806 ++-- .../city/traffic/vehicle/vehicle-control.gc | 72 +- .../city/traffic/vehicle/vehicle-effects.gc | 153 +- .../city/traffic/vehicle/vehicle-guard.gc | 28 +- .../city/traffic/vehicle/vehicle-physics.gc | 199 +- .../city/traffic/vehicle/vehicle-states.gc | 30 +- .../city/traffic/vehicle/vehicle-util.gc | 349 +- .../levels/city/traffic/vehicle/vehicle.gc | 146 +- .../jak2/levels/city/vinroom/vinroom-part.gc | 2 +- .../jak2/levels/common/ai/ashelin/ash-shot.gc | 2 +- goal_src/jak2/levels/common/ai/ashelin/ash.gc | 46 +- goal_src/jak2/levels/common/ai/bot-h.gc | 72 +- goal_src/jak2/levels/common/ai/bot.gc | 177 +- .../jak2/levels/common/ai/sig/sig-shot.gc | 2 +- goal_src/jak2/levels/common/ai/sig/sig.gc | 24 +- goal_src/jak2/levels/common/battle.gc | 134 +- goal_src/jak2/levels/common/elec-gate.gc | 142 +- .../jak2/levels/common/enemy/centurion.gc | 61 +- .../jak2/levels/common/enemy/fodder/fodder.gc | 107 +- goal_src/jak2/levels/common/enemy/grunt.gc | 38 +- .../enemy/guards/crimson-guard-level.gc | 277 +- .../common/enemy/guards/guard-conversation.gc | 16 +- goal_src/jak2/levels/common/enemy/hopper.gc | 42 +- .../common/enemy/hover/crimson-guard-hover.gc | 183 +- .../common/enemy/hover/hover-enemy-battle.gc | 12 +- .../levels/common/enemy/hover/hover-enemy.gc | 42 +- .../common/enemy/hover/hover-formation.gc | 131 +- .../common/enemy/hover/hover-nav-control.gc | 255 +- .../common/enemy/hover/hover-nav-edit.gc | 35 +- .../jak2/levels/common/enemy/hover/wasp.gc | 183 +- .../jak2/levels/common/enemy/metalmonk.gc | 38 +- .../common/entities/fort-floor-spike.gc | 145 +- .../jak2/levels/common/entities/gun-buoy.gc | 118 +- .../jak2/levels/common/entities/spydroid.gc | 154 +- goal_src/jak2/levels/common/race/race-hud.gc | 153 +- .../jak2/levels/common/race/race-manager.gc | 157 +- .../jak2/levels/common/race/vehicle-racer.gc | 88 +- .../jak2/levels/consite/consite-scenes.gc | 47 +- goal_src/jak2/levels/demo/demo-obs.gc | 47 +- goal_src/jak2/levels/dig/dig-digger.gc | 111 +- goal_src/jak2/levels/dig/dig-obs.gc | 6 +- goal_src/jak2/levels/dig/dig3-obs.gc | 6 +- goal_src/jak2/levels/drill/drill-obs.gc | 77 +- goal_src/jak2/levels/drill/drill-obs2.gc | 6 +- goal_src/jak2/levels/drill/drill-spool.gc | 64 +- goal_src/jak2/levels/forest/fish.gc | 552 ++- goal_src/jak2/levels/forest/pegasus.gc | 57 +- goal_src/jak2/levels/forest/predator.gc | 94 +- .../jak2/levels/fortress/dump/fordumpa-obs.gc | 6 +- .../jak2/levels/fortress/dump/fordumpb-obs.gc | 28 +- .../fortress/dump/fort-robotank-turret.gc | 74 +- .../levels/fortress/dump/fort-robotank.gc | 22 +- .../jak2/levels/fortress/prison/prison-obs.gc | 164 +- .../levels/fortress/rescue/forresca-obs.gc | 15 +- .../levels/fortress/rescue/forrescb-obs.gc | 66 +- goal_src/jak2/levels/gungame/gun-dummy.gc | 2 +- goal_src/jak2/levels/gungame/gungame-obs.gc | 81 +- goal_src/jak2/levels/hiphog/whack.gc | 71 +- goal_src/jak2/levels/intro/intro-scenes.gc | 47 +- goal_src/jak2/levels/mountain/mountain-obs.gc | 476 ++- .../jak2/levels/mountain/mountain-scenes.gc | 72 +- goal_src/jak2/levels/mountain/rhino.gc | 100 +- .../jak2/levels/nest/boss/metalkor-extras.gc | 175 +- .../jak2/levels/nest/boss/metalkor-setup.gc | 125 +- .../jak2/levels/nest/boss/metalkor-states.gc | 311 +- .../jak2/levels/nest/boss/nestb-scenes.gc | 47 +- goal_src/jak2/levels/nest/flying-spider.gc | 22 +- goal_src/jak2/levels/nest/mammoth.gc | 98 +- goal_src/jak2/levels/nest/mantis.gc | 6 +- .../jak2/levels/palace/boss/squid-extras.gc | 8 +- .../jak2/levels/palace/boss/squid-setup.gc | 1043 +++-- .../jak2/levels/palace/boss/squid-states.gc | 150 +- .../jak2/levels/palace/cable/palcab-obs.gc | 25 +- goal_src/jak2/levels/ruins/pillar-collapse.gc | 48 +- goal_src/jak2/levels/ruins/rapid-gunner.gc | 13 +- goal_src/jak2/levels/ruins/ruins-obs.gc | 48 +- goal_src/jak2/levels/sewer/hosehead-fake.gc | 8 +- goal_src/jak2/levels/sewer/hosehead.gc | 146 +- goal_src/jak2/levels/sewer/sewer-obs.gc | 132 +- goal_src/jak2/levels/sewer/sewer-obs2.gc | 41 +- goal_src/jak2/levels/sewer/sewer-scenes.gc | 80 +- .../jak2/levels/stadium/skate/skatea-obs.gc | 12 +- goal_src/jak2/levels/stadium/stadium-obs.gc | 306 +- goal_src/jak2/levels/strip/chaincrate.gc | 6 +- goal_src/jak2/levels/strip/strip-obs.gc | 142 +- goal_src/jak2/levels/title/title-obs.gc | 123 +- goal_src/jak2/levels/tomb/tomb-obs.gc | 120 +- goal_src/jak2/levels/tomb/tomb-water.gc | 121 +- goal_src/jak2/levels/tomb/widow-baron.gc | 46 +- goal_src/jak2/levels/tomb/widow-extras.gc | 34 +- .../jak2/levels/tomb/widow-more-extras.gc | 7 +- goal_src/jak2/levels/under/centipede.gc | 44 +- goal_src/jak2/levels/under/jellyfish.gc | 11 +- goal_src/jak2/levels/under/sig5-course.gc | 57 +- goal_src/jak2/levels/under/under-laser.gc | 29 +- goal_src/jak2/levels/under/under-obs.gc | 16 +- .../jak2/levels/under/under-shoot-block.gc | 103 +- goal_src/jak2/levels/under/under-sig-obs.gc | 48 +- goal_src/jak2/levels/under/underb-master.gc | 6 +- goal_src/jak3/engine/ai/enemy.gc | 80 +- goal_src/jak3/engine/anim/joint-exploder.gc | 107 +- goal_src/jak3/engine/anim/joint-mod.gc | 870 ++--- goal_src/jak3/engine/anim/joint.gc | 155 +- goal_src/jak3/engine/camera/cam-combiner.gc | 37 +- goal_src/jak3/engine/camera/cam-layout.gc | 328 +- goal_src/jak3/engine/camera/cam-master.gc | 118 +- goal_src/jak3/engine/camera/cam-states.gc | 671 ++-- goal_src/jak3/engine/camera/cam-update.gc | 28 +- goal_src/jak3/engine/camera/camera.gc | 486 +-- goal_src/jak3/engine/collide/collide-cache.gc | 28 +- .../jak3/engine/collide/collide-edge-grab.gc | 34 +- .../engine/collide/collide-shape-rider.gc | 24 +- goal_src/jak3/engine/collide/collide-shape.gc | 362 +- goal_src/jak3/engine/collide/find-nearest.gc | 88 +- goal_src/jak3/engine/collide/los-control.gc | 55 +- goal_src/jak3/engine/common-obs/airlock.gc | 11 +- goal_src/jak3/engine/common-obs/basebutton.gc | 8 +- .../jak3/engine/common-obs/blocking-plane.gc | 16 +- .../jak3/engine/common-obs/collectables.gc | 335 +- goal_src/jak3/engine/common-obs/debris.gc | 71 +- goal_src/jak3/engine/common-obs/elevator.gc | 89 +- .../jak3/engine/common-obs/enemy-states.gc | 55 +- .../jak3/engine/common-obs/generic-obs.gc | 91 +- goal_src/jak3/engine/common-obs/water-anim.gc | 33 +- goal_src/jak3/engine/common-obs/water-flow.gc | 194 +- goal_src/jak3/engine/common-obs/water.gc | 48 +- .../jak3/engine/debug/collision-editor.gc | 49 +- goal_src/jak3/engine/debug/debug-sphere.gc | 54 +- goal_src/jak3/engine/debug/debug.gc | 372 +- goal_src/jak3/engine/debug/default-menu.gc | 357 +- goal_src/jak3/engine/debug/editable-player.gc | 564 ++- goal_src/jak3/engine/debug/editable.gc | 1183 +++--- goal_src/jak3/engine/debug/history.gc | 454 ++- goal_src/jak3/engine/debug/manipulator.gc | 360 +- goal_src/jak3/engine/debug/memory-usage.gc | 422 +- goal_src/jak3/engine/debug/menu.gc | 150 +- goal_src/jak3/engine/debug/nav-mesh-editor.gc | 553 ++- .../jak3/engine/debug/nav/mysql-nav-graph.gc | 352 +- .../jak3/engine/debug/nav/nav-graph-editor.gc | 416 +- goal_src/jak3/engine/debug/viewer.gc | 35 +- goal_src/jak3/engine/dma/dma-buffer.gc | 3 +- goal_src/jak3/engine/dma/dma-disasm.gc | 574 ++- goal_src/jak3/engine/entity/actor-link-h.gc | 18 +- goal_src/jak3/engine/entity/entity.gc | 885 ++--- goal_src/jak3/engine/entity/res.gc | 68 +- goal_src/jak3/engine/game/effect-control.gc | 912 +++-- goal_src/jak3/engine/game/fact-h.gc | 87 +- goal_src/jak3/engine/game/game-info.gc | 250 +- goal_src/jak3/engine/game/game-save.gc | 54 +- goal_src/jak3/engine/game/task/task-arrow.gc | 32 +- .../jak3/engine/game/task/task-control.gc | 57 +- goal_src/jak3/engine/geometry/geometry.gc | 73 +- goal_src/jak3/engine/geometry/path-h.gc | 16 +- goal_src/jak3/engine/geometry/path.gc | 135 +- goal_src/jak3/engine/geometry/vol.gc | 235 +- .../jak3/engine/gfx/background/hfrag/hfrag.gc | 364 +- goal_src/jak3/engine/gfx/foreground/ripple.gc | 30 +- .../gfx/generic/lightning/lightning-new.gc | 354 +- .../engine/gfx/generic/lightning/lightning.gc | 695 ++-- goal_src/jak3/engine/gfx/ocean/ocean-mid.gc | 82 +- goal_src/jak3/engine/gfx/ocean/ocean-near.gc | 6 +- .../jak3/engine/gfx/ocean/ocean-texture.gc | 42 +- .../jak3/engine/gfx/ocean/ocean-transition.gc | 298 +- goal_src/jak3/engine/gfx/ocean/ocean.gc | 550 +-- .../gfx/sprite/particles/light-trails.gc | 446 +-- .../jak3/engine/gfx/sprite/sprite-distort.gc | 69 +- .../jak3/engine/gfx/sprite/sprite-glow.gc | 36 +- goal_src/jak3/engine/gfx/sprite/sprite.gc | 2 +- goal_src/jak3/engine/level/region.gc | 223 +- goal_src/jak3/engine/load/decomp.gc | 9 +- goal_src/jak3/engine/load/load-state.gc | 92 +- goal_src/jak3/engine/load/loader.gc | 510 ++- goal_src/jak3/engine/math/euler.gc | 22 +- goal_src/jak3/engine/math/math.gc | 3 + goal_src/jak3/engine/math/quaternion.gc | 25 +- goal_src/jak3/engine/math/transformq.gc | 80 +- goal_src/jak3/engine/math/trigonometry.gc | 31 +- goal_src/jak3/engine/nav/nav-enemy.gc | 16 +- goal_src/jak3/engine/nav/nav-engine.gc | 53 +- goal_src/jak3/engine/nav/nav-mesh-h.gc | 164 +- goal_src/jak3/engine/physics/chain-physics.gc | 402 +- goal_src/jak3/engine/physics/cloth.gc | 491 ++- goal_src/jak3/engine/physics/ragdoll-edit.gc | 315 +- goal_src/jak3/engine/physics/ragdoll.gc | 539 ++- goal_src/jak3/engine/physics/rigid-body.gc | 19 +- goal_src/jak3/engine/physics/trajectory.gc | 19 +- .../process-drawable/process-drawable.gc | 176 +- goal_src/jak3/engine/scene/scene.gc | 133 +- goal_src/jak3/engine/sound/gsound.gc | 190 +- goal_src/jak3/engine/sound/speech.gc | 19 +- .../jak3/engine/spatial-hash/actor-hash.gc | 11 +- .../jak3/engine/spatial-hash/collide-hash.gc | 780 ++-- .../jak3/engine/spatial-hash/spatial-hash.gc | 75 +- .../jak3/engine/target/board/board-states.gc | 49 +- .../jak3/engine/target/board/target-board.gc | 15 +- .../engine/target/collide-reaction-target.gc | 858 ++-- .../jak3/engine/target/flut/flut-racer.gc | 12 +- .../jak3/engine/target/flut/target-flut.gc | 66 +- .../jak3/engine/target/gun/gun-blue-shot.gc | 1277 +++--- .../jak3/engine/target/gun/gun-dark-shot.gc | 529 ++- goal_src/jak3/engine/target/gun/gun-part.gc | 3 +- .../jak3/engine/target/gun/gun-red-shot.gc | 715 ++-- .../jak3/engine/target/gun/gun-yellow-shot.gc | 380 +- goal_src/jak3/engine/target/logic-target.gc | 455 +-- .../jak3/engine/target/mech/mech-states.gc | 32 +- .../jak3/engine/target/mech/target-mech.gc | 83 +- goal_src/jak3/engine/target/pilot-states.gc | 39 +- goal_src/jak3/engine/target/surface-h.gc | 4 +- goal_src/jak3/engine/target/target-anim.gc | 1023 ++--- goal_src/jak3/engine/target/target-darkjak.gc | 1187 +++--- goal_src/jak3/engine/target/target-death.gc | 818 ++-- goal_src/jak3/engine/target/target-handler.gc | 633 ++- goal_src/jak3/engine/target/target-part.gc | 712 ++-- goal_src/jak3/engine/target/target-turret.gc | 42 +- goal_src/jak3/engine/target/target-util.gc | 44 +- goal_src/jak3/engine/target/target2.gc | 96 +- goal_src/jak3/engine/ui/hud-classes.gc | 830 ++-- .../jak3/engine/ui/progress/progress-draw.gc | 2514 +++++------- goal_src/jak3/engine/ui/progress/progress.gc | 110 +- goal_src/jak3/engine/util/profile.gc | 17 +- goal_src/jak3/engine/util/sync-info.gc | 24 +- .../levels/city/blow-tower/blow-tower-obs.gc | 321 +- .../levels/city/blow-tower/blow-tower-obs2.gc | 195 +- .../city/blow-tower/blow-tower-shared.gc | 100 +- .../levels/city/blow-tower/cty-blow-tower.gc | 1417 ++++--- goal_src/jak3/levels/city/bombbot/bombbot.gc | 498 ++- .../levels/city/common/cty-borrow-manager.gc | 481 ++- .../levels/city/common/ff-squad-control.gc | 12 +- .../jak3/levels/city/common/guard-states.gc | 72 +- .../jak3/levels/city/common/guard-tazer.gc | 35 +- .../jak3/levels/city/common/height-map.gc | 45 +- .../levels/city/common/kg-squad-member.gc | 19 +- .../jak3/levels/city/common/krimson-wall.gc | 46 +- .../levels/city/common/mh-squad-member.gc | 33 +- goal_src/jak3/levels/city/common/nav-graph.gc | 145 +- goal_src/jak3/levels/city/common/trail.gc | 116 +- goal_src/jak3/levels/city/ctyport-obs.gc | 261 +- goal_src/jak3/levels/city/ctywide-obs.gc | 74 +- goal_src/jak3/levels/city/ctywide-part.gc | 2 +- .../city/destroy-grid/cty-destroy-grid.gc | 92 +- .../jak3/levels/city/freehq/freehq-part.gc | 2 +- goal_src/jak3/levels/city/hijack/billiards.gc | 4 +- .../levels/city/hijack/cty-hijack-missile.gc | 306 +- .../city/port/attack/ctyport-attack-bbush.gc | 10 +- .../levels/city/port/attack/ctyport-attack.gc | 55 +- .../jak3/levels/city/protect/assault-task.gc | 129 +- .../jak3/levels/city/protect/cty-protect.gc | 3 +- .../jak3/levels/city/protect/flying-turret.gc | 92 +- .../levels/city/protect/protect-gunship.gc | 296 +- .../levels/city/protect/roboguard-city.gc | 30 +- .../levels/city/sniper/cty-sniper-battery.gc | 8 +- .../levels/city/sniper/cty-sniper-turret.gc | 15 +- .../levels/city/traffic/citizen/citizen.gc | 100 +- .../levels/city/traffic/citizen/civilian.gc | 216 +- .../jak3/levels/city/traffic/citizen/guard.gc | 285 +- .../city/traffic/citizen/metalhead-grunt.gc | 28 +- .../traffic/citizen/metalhead-predator.gc | 38 +- .../levels/city/traffic/traffic-engine.gc | 51 +- .../city/traffic/vehicle/vehicle-control.gc | 7 +- .../city/traffic/vehicle/vehicle-effects.gc | 129 +- .../city/traffic/vehicle/vehicle-physics.gc | 13 +- .../city/traffic/vehicle/vehicle-states.gc | 29 +- .../city/traffic/vehicle/vehicle-util.gc | 257 +- .../levels/city/traffic/vehicle/vehicle.gc | 31 +- .../jak3/levels/city/vinroom/power-game.gc | 34 +- .../jak3/levels/city/vinroom/vinroom-part.gc | 2 +- goal_src/jak3/levels/comb/comb-field.gc | 42 +- goal_src/jak3/levels/comb/comb-sentry.gc | 12 +- goal_src/jak3/levels/comb/h-sled.gc | 2 +- .../jak3/levels/common/ai/ashelin/ash-shot.gc | 2 +- goal_src/jak3/levels/common/ai/ashelin/ash.gc | 18 +- goal_src/jak3/levels/common/ai/bot-h.gc | 72 +- goal_src/jak3/levels/common/ai/bot.gc | 53 +- goal_src/jak3/levels/common/battle.gc | 104 +- goal_src/jak3/levels/common/elec-gate.gc | 94 +- .../common/enemy/darkprec/dp-bipedal.gc | 105 +- .../levels/common/enemy/darkprec/neo-wasp.gc | 82 +- goal_src/jak3/levels/common/enemy/grunt.gc | 28 +- .../levels/common/enemy/hover/hover-enemy.gc | 83 +- .../common/enemy/hover/hover-formation.gc | 58 +- .../common/enemy/hover/hover-nav-control.gc | 401 +- .../common/enemy/hover/hover-nav-edit.gc | 77 +- .../levels/common/enemy/hover/robo-hover.gc | 207 +- goal_src/jak3/levels/common/enemy/kg-grunt.gc | 22 +- goal_src/jak3/levels/common/enemy/mantis.gc | 6 +- .../jak3/levels/common/enemy/roboguard.gc | 38 +- .../jak3/levels/common/enemy/spydroid-orig.gc | 142 +- goal_src/jak3/levels/common/enemy/spydroid.gc | 39 +- .../levels/common/hvehicle/squad-control.gc | 153 +- .../jak3/levels/common/race/pilot-recorder.gc | 36 +- goal_src/jak3/levels/common/race/race-hud.gc | 111 +- .../jak3/levels/common/race/race-manager.gc | 100 +- goal_src/jak3/levels/common/race/race-mesh.gc | 21 +- .../desert/artifact-race/artifact-race.gc | 13 +- .../jak3/levels/desert/boss/deswalk-obs.gc | 92 +- .../levels/desert/boss/terraformer-drone.gc | 28 +- .../levels/desert/boss/terraformer-head.gc | 24 +- .../levels/desert/boss/terraformer-setup.gc | 162 +- .../jak3/levels/desert/chase/desert-chase.gc | 17 +- .../jak3/levels/desert/chase/desert-jump.gc | 30 +- .../jak3/levels/desert/chase/wcar-catapult.gc | 12 +- goal_src/jak3/levels/desert/des-bush.gc | 146 +- .../jak3/levels/desert/desert-dust-storm.gc | 76 +- goal_src/jak3/levels/desert/desert-scenes.gc | 13 +- .../jak3/levels/desert/hover/des-beast-2.gc | 135 +- .../jak3/levels/desert/hover/des-beast.gc | 65 +- .../jak3/levels/desert/hover/desert-hover.gc | 6 +- goal_src/jak3/levels/desert/hover/mh-flyer.gc | 25 +- .../jak3/levels/desert/hover/scorpion-gun.gc | 197 +- .../desert/lizard/desert-lizard-task.gc | 8 +- .../levels/desert/lizard/desert-lizard.gc | 22 +- .../levels/desert/oasis/ash-oasis-course.gc | 4 +- .../jak3/levels/desert/oasis/oasis-defense.gc | 120 +- .../levels/desert/race/turtle-training.gc | 6 +- .../desert/rescue/desert-rescue-bbush.gc | 6 +- .../levels/desert/rescue/desert-rescue.gc | 8 +- .../levels/desert/rescue/neo-satellite.gc | 52 +- .../levels/desert/rescue/rope-prim-system.gc | 111 +- .../jak3/levels/desert/rescue/rope-system.gc | 248 +- .../levels/desert/wvehicle/w-parking-spot.gc | 20 +- .../desert/wvehicle/was-squad-control.gc | 49 +- .../levels/desert/wvehicle/wcar-marauder.gc | 8 +- .../jak3/levels/desert/wvehicle/wcar-toad.gc | 6 +- goal_src/jak3/levels/desert/wvehicle/wcar.gc | 12 +- .../levels/desert/wvehicle/wvehicle-ai.gc | 26 +- .../desert/wvehicle/wvehicle-physics.gc | 578 ++- .../levels/desert/wvehicle/wvehicle-race.gc | 72 +- .../levels/desert/wvehicle/wvehicle-util.gc | 65 +- .../jak3/levels/desert/wvehicle/wvehicle.gc | 111 +- .../levels/factory/car/hvehicle-physics.gc | 160 +- .../jak3/levels/factory/car/hvehicle-util.gc | 50 +- goal_src/jak3/levels/factory/car/hvehicle.gc | 188 +- goal_src/jak3/levels/factory/conveyor.gc | 88 +- .../levels/factory/fac-robotank-turret.gc | 9 +- .../jak3/levels/factory/factory-boss-setup.gc | 93 +- .../levels/factory/factory-boss-states.gc | 112 +- .../jak3/levels/factory/factory-manager.gc | 132 +- goal_src/jak3/levels/factory/factoryc-obs.gc | 7 +- goal_src/jak3/levels/factory/factoryc-obs2.gc | 21 +- goal_src/jak3/levels/factory/h-warf.gc | 51 +- goal_src/jak3/levels/factory/lfaccity-mood.gc | 6 +- goal_src/jak3/levels/factory/missile-bot.gc | 105 +- .../jak3/levels/factory/warf-projectile.gc | 14 +- goal_src/jak3/levels/forest/for-turret.gc | 318 +- .../jak3/levels/forest/forest-kill-plants.gc | 30 +- goal_src/jak3/levels/forest/forest-part.gc | 8 +- .../jak3/levels/forest/forest-ring-chase.gc | 13 +- goal_src/jak3/levels/forest/forest-tasks.gc | 16 +- goal_src/jak3/levels/forest/neo-spawner.gc | 16 +- goal_src/jak3/levels/glider/glider-manager.gc | 36 +- goal_src/jak3/levels/glider/glider-ring.gc | 25 +- goal_src/jak3/levels/glider/h-glider.gc | 27 +- goal_src/jak3/levels/gungame/gun-dummy.gc | 2 +- .../jak3/levels/gungame/gungame-manager.gc | 16 +- goal_src/jak3/levels/hiphog/hiphog-part.gc | 2 +- .../jak3/levels/mhcity/destroy-dark-eco.gc | 140 +- goal_src/jak3/levels/mhcity/mhcity-obs2.gc | 6 +- goal_src/jak3/levels/mine/gekko.gc | 453 +-- goal_src/jak3/levels/mine/manta.gc | 34 +- goal_src/jak3/levels/mine/mine-obs.gc | 22 +- goal_src/jak3/levels/mine/mine-platforms.gc | 8 +- goal_src/jak3/levels/mine/mine-train.gc | 10 +- goal_src/jak3/levels/mine/prebot-extras.gc | 16 +- goal_src/jak3/levels/mine/prebot-states.gc | 189 +- goal_src/jak3/levels/mine/rat.gc | 8 +- goal_src/jak3/levels/nest/egg-spider.gc | 44 +- goal_src/jak3/levels/nest/mh-centipede.gc | 307 +- goal_src/jak3/levels/nest/nst-obs.gc | 71 +- goal_src/jak3/levels/precursor/precura-obs.gc | 43 +- .../jak3/levels/precursor/precura-obs2.gc | 432 ++- goal_src/jak3/levels/precursor/precurd-obs.gc | 8 +- goal_src/jak3/levels/sewer/flyingsaw.gc | 32 +- goal_src/jak3/levels/sewer/kg-hopper.gc | 42 +- goal_src/jak3/levels/sewer/mh-wasp.gc | 183 +- goal_src/jak3/levels/sewer/neo-juicer.gc | 6 +- .../jak3/levels/sewer/saberfish-spawner.gc | 297 +- goal_src/jak3/levels/sewer/saberfish.gc | 446 +-- goal_src/jak3/levels/sewer/sewer-obs.gc | 48 +- goal_src/jak3/levels/sewer/sewer-obs2.gc | 16 +- .../jak3/levels/stadium/dm-mine-spider.gc | 73 +- goal_src/jak3/levels/stadium/king-rider.gc | 15 +- goal_src/jak3/levels/stadium/rubble-attack.gc | 60 +- goal_src/jak3/levels/stadium/rubble-obs.gc | 8 +- goal_src/jak3/levels/temple/hover-training.gc | 36 +- goal_src/jak3/levels/temple/temple-obs.gc | 36 +- goal_src/jak3/levels/temple/temple-obs2.gc | 63 +- goal_src/jak3/levels/temple/templed-obs.gc | 46 +- goal_src/jak3/levels/title/title-obs.gc | 29 +- goal_src/jak3/levels/tower/tower-obs.gc | 46 +- goal_src/jak3/levels/volcano/volcano-obs.gc | 17 +- goal_src/jak3/levels/volcano/volcano-part.gc | 4 +- goal_src/jak3/levels/volcano/volcanox-obs.gc | 16 +- .../wascity/bbush/des-bush-time-chase.gc | 132 +- .../jak3/levels/wascity/chase/kanga-lizard.gc | 14 +- goal_src/jak3/levels/wascity/cty-faction.gc | 61 +- .../levels/wascity/defend/was-pre-game.gc | 40 +- goal_src/jak3/levels/wascity/dm-flyer.gc | 89 +- goal_src/jak3/levels/wascity/flee-info.gc | 16 +- .../jak3/levels/wascity/formation-object.gc | 2 +- .../levels/wascity/leaper/was-leaper-race.gc | 8 +- .../jak3/levels/wascity/maker-projectile.gc | 64 +- .../jak3/levels/wascity/squad-control-city.gc | 65 +- goal_src/jak3/levels/wascity/tizard.gc | 153 +- goal_src/jak3/levels/wascity/traffic-util.gc | 547 ++- .../jak3/levels/wascity/wascity-turret.gc | 156 +- .../jak3/levels/wascity/wasdef-manager.gc | 8 +- .../jak3/levels/wascity/wasgun-manager.gc | 79 +- .../jak3/levels/wascity/wasstadium/nst-gas.gc | 2 +- .../levels/wascity/wasstadium/nst-tasks.gc | 8 +- .../levels/wascity/wasstadium/sig-rider.gc | 15 +- .../levels/wascity/wasstadium/wasstadb-obs.gc | 8 +- .../levels/wascity/wasstadium/wasstadc-obs.gc | 53 +- scripts/gsrc/update-from-decomp.py | 2 + .../reference/jak1/decompiler-macros.gc | 4 + .../jak1/engine/anim/joint-exploder_REF.gc | 22 +- .../jak1/engine/anim/joint-mod-h_REF.gc | 221 +- .../reference/jak1/engine/anim/joint_REF.gc | 80 +- .../jak1/engine/camera/cam-combiner_REF.gc | 5 +- .../jak1/engine/camera/cam-layout_REF.gc | 329 +- .../jak1/engine/camera/cam-master_REF.gc | 147 +- .../jak1/engine/camera/cam-states_REF.gc | 227 +- .../jak1/engine/camera/cam-update_REF.gc | 28 +- .../jak1/engine/camera/camera_REF.gc | 357 +- .../engine/collide/collide-edge-grab_REF.gc | 13 +- .../jak1/engine/collide/collide-probe_REF.gc | 7 +- .../engine/collide/collide-shape-rider_REF.gc | 11 +- .../jak1/engine/collide/surface-h_REF.gc | 4 +- .../engine/common-obs/collectables_REF.gc | 204 +- .../engine/common-obs/dark-eco-pool_REF.gc | 3 +- .../jak1/engine/common-obs/generic-obs_REF.gc | 10 +- .../jak1/engine/common-obs/nav-enemy_REF.gc | 3 +- .../process-drawable_REF.gc | 231 +- .../jak1/engine/common-obs/rigid-body_REF.gc | 21 +- .../jak1/engine/common-obs/water-anim_REF.gc | 6 +- .../jak1/engine/common-obs/water_REF.gc | 27 +- .../jak1/engine/debug/anim-tester_REF.gc | 163 +- .../jak1/engine/debug/debug-sphere_REF.gc | 28 +- .../reference/jak1/engine/debug/debug_REF.gc | 195 +- .../jak1/engine/debug/memory-usage_REF.gc | 38 +- .../reference/jak1/engine/debug/menu_REF.gc | 109 +- .../reference/jak1/engine/debug/viewer_REF.gc | 12 +- .../jak1/engine/dma/dma-disasm_REF.gc | 536 ++- .../jak1/engine/draw/drawable_REF.gc | 569 ++- .../jak1/engine/entity/actor-link-h_REF.gc | 18 +- .../jak1/engine/entity/ambient_REF.gc | 93 +- .../jak1/engine/entity/entity_REF.gc | 503 ++- .../reference/jak1/engine/entity/res_REF.gc | 62 +- .../jak1/engine/game/effect-control_REF.gc | 178 +- .../reference/jak1/engine/game/fact-h_REF.gc | 6 +- .../jak1/engine/game/game-info_REF.gc | 44 +- .../jak1/engine/game/game-save_REF.gc | 23 +- .../jak1/engine/game/projectiles_REF.gc | 150 +- .../jak1/engine/geometry/cylinder_REF.gc | 115 +- .../jak1/engine/geometry/geometry_REF.gc | 65 +- .../jak1/engine/geometry/path-h_REF.gc | 6 +- .../reference/jak1/engine/geometry/vol_REF.gc | 235 +- .../engine/gfx/{ => foreground}/eye_REF.gc | 3 +- .../jak1/engine/gfx/foreground/ripple_REF.gc | 25 +- .../jak1/engine/gfx/math-camera_REF.gc | 22 +- .../jak1/engine/gfx/mood/mood-tables_REF.gc | 7 +- .../jak1/engine/gfx/mood/mood_REF.gc | 64 +- .../jak1/engine/gfx/mood/time-of-day_REF.gc | 7 +- .../jak1/engine/gfx/ocean/ocean-mid_REF.gc | 59 +- .../engine/gfx/ocean/ocean-texture_REF.gc | 30 +- .../engine/gfx/ocean/ocean-transition_REF.gc | 290 +- .../jak1/engine/gfx/shadow/shadow_REF.gc | 23 +- .../sparticle/sparticle-launcher_REF.gc | 8 +- .../gfx/sprite/sparticle/sparticle_REF.gc | 86 +- .../engine/gfx/sprite/sprite-distort_REF.gc | 69 +- .../jak1/engine/gfx/sprite/sprite_REF.gc | 2 +- .../jak1/engine/gfx/texture/texture_REF.gc | 322 +- .../engine/gfx/tfrag/tfrag-methods_REF.gc | 309 +- .../jak1/engine/gfx/tie/tie-methods_REF.gc | 20 +- .../reference/jak1/engine/gfx/tie/tie_REF.gc | 33 +- .../reference/jak1/engine/level/level_REF.gc | 26 +- .../jak1/engine/level/load-boundary_REF.gc | 4 +- .../reference/jak1/engine/load/loader_REF.gc | 270 +- .../reference/jak1/engine/math/euler_REF.gc | 22 +- .../jak1/engine/math/quaternion_REF.gc | 19 +- .../jak1/engine/math/transformq_REF.gc | 15 +- .../jak1/engine/math/trigonometry_REF.gc | 29 +- .../reference/jak1/engine/math/vector_REF.gc | 6 +- .../jak1/engine/nav/navigate-h_REF.gc | 15 +- .../reference/jak1/engine/nav/navigate_REF.gc | 910 ++--- .../jak1/engine/physics/trajectory_REF.gc | 7 +- .../reference/jak1/engine/ps2/pad_REF.gc | 2 +- .../reference/jak1/engine/sound/gsound_REF.gc | 190 +- .../target/collide-reaction-target_REF.gc | 716 ++-- .../jak1/engine/target/logic-target_REF.gc | 137 +- .../jak1/engine/target/target-handler_REF.gc | 259 +- .../jak1/engine/target/target-part_REF.gc | 7 +- .../jak1/engine/target/target2_REF.gc | 156 +- .../engine/ui/progress/progress-draw_REF.gc | 1046 +++-- .../jak1/engine/ui/progress/progress_REF.gc | 70 +- .../reference/jak1/engine/ui/text_REF.gc | 481 ++- .../reference/jak1/engine/util/capture_REF.gc | 28 +- .../jak1/engine/util/sync-info_REF.gc | 24 +- .../reference/jak1/kernel/gstate_REF.gc | 2 +- .../jak1/levels/beach/beach-obs_REF.gc | 42 +- .../jak1/levels/citadel/citadel-obs_REF.gc | 74 +- .../jak1/levels/citadel/citadel-part_REF.gc | 2 +- .../jak1/levels/citadel/citb-drop-plat_REF.gc | 58 +- .../jak1/levels/citadel/citb-plat_REF.gc | 4 +- .../levels/common/battlecontroller_REF.gc | 6 +- .../jak1/levels/demo/static-screen_REF.gc | 21 +- .../jak1/levels/finalboss/final-door_REF.gc | 47 +- .../levels/finalboss/robotboss-weapon_REF.gc | 60 +- .../jak1/levels/finalboss/robotboss_REF.gc | 61 +- .../jak1/levels/jungle/jungle-mirrors_REF.gc | 50 +- .../jak1/levels/jungle/jungle-obs_REF.gc | 26 +- .../jak1/levels/jungleb/plat-flip_REF.gc | 70 +- .../jak1/levels/lavatube/lavatube-obs_REF.gc | 6 +- .../levels/maincave/driller-lurker_REF.gc | 24 +- .../jak1/levels/maincave/gnawer_REF.gc | 72 +- .../jak1/levels/maincave/maincave-obs_REF.gc | 78 +- .../jak1/levels/maincave/mother-spider_REF.gc | 39 +- .../jak1/levels/misty/balloonlurker_REF.gc | 53 +- .../jak1/levels/misty/misty-conveyor_REF.gc | 155 +- .../jak1/levels/misty/mistycannon_REF.gc | 18 +- .../jak1/levels/ogre/ogreboss_REF.gc | 9 +- .../collide-reaction-racer_REF.gc | 339 +- .../rolling/rolling-lightning-mole_REF.gc | 172 +- .../jak1/levels/rolling/rolling-robber_REF.gc | 20 +- .../jak1/levels/snow/snow-ball_REF.gc | 4 +- .../jak1/levels/snow/snow-bumper_REF.gc | 18 +- .../jak1/levels/snow/snow-bunny_REF.gc | 23 +- .../jak1/levels/snow/snow-flutflut-obs_REF.gc | 10 +- .../jak1/levels/snow/snow-obs_REF.gc | 6 +- .../jak1/levels/snow/snow-ram_REF.gc | 18 +- .../jak1/levels/sunken/puffer_REF.gc | 6 +- .../jak1/levels/sunken/shover_REF.gc | 6 +- .../jak1/levels/sunken/square-platform_REF.gc | 45 +- .../jak1/levels/sunken/steam-cap_REF.gc | 6 +- .../jak1/levels/sunken/sun-iris-door_REF.gc | 6 +- .../jak1/levels/sunken/sunken-fish_REF.gc | 16 +- .../jak1/levels/sunken/whirlpool_REF.gc | 9 +- .../levels/village1/fishermans-boat_REF.gc | 95 +- .../jak1/levels/village1/yakow_REF.gc | 43 +- .../jak1/levels/village2/swamp-blimp_REF.gc | 6 +- .../levels/village_common/villagep-obs_REF.gc | 34 +- .../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 +- .../reference/jak3/decompiler-macros.gc | 4 + .../reference/jak3/engine/ai/enemy_REF.gc | 80 +- .../jak3/engine/anim/joint-exploder_REF.gc | 107 +- .../jak3/engine/anim/joint-mod_REF.gc | 870 ++--- .../reference/jak3/engine/anim/joint_REF.gc | 136 +- .../jak3/engine/camera/cam-combiner_REF.gc | 5 +- .../jak3/engine/camera/cam-layout_REF.gc | 328 +- .../jak3/engine/camera/cam-master_REF.gc | 118 +- .../jak3/engine/camera/cam-states_REF.gc | 405 +- .../jak3/engine/camera/cam-update_REF.gc | 28 +- .../jak3/engine/camera/camera_REF.gc | 456 +-- .../jak3/engine/collide/collide-cache_REF.gc | 28 +- .../engine/collide/collide-edge-grab_REF.gc | 34 +- .../engine/collide/collide-shape-rider_REF.gc | 24 +- .../jak3/engine/collide/collide-shape_REF.gc | 360 +- .../jak3/engine/collide/find-nearest_REF.gc | 83 +- .../jak3/engine/collide/los-control_REF.gc | 55 +- .../jak3/engine/common-obs/airlock_REF.gc | 11 +- .../jak3/engine/common-obs/basebutton_REF.gc | 12 +- .../engine/common-obs/blocking-plane_REF.gc | 16 +- .../engine/common-obs/collectables_REF.gc | 884 ++--- .../jak3/engine/common-obs/debris_REF.gc | 71 +- .../jak3/engine/common-obs/elevator_REF.gc | 89 +- .../engine/common-obs/enemy-states_REF.gc | 55 +- .../jak3/engine/common-obs/generic-obs_REF.gc | 91 +- .../jak3/engine/common-obs/water-anim_REF.gc | 33 +- .../jak3/engine/common-obs/water-flow_REF.gc | 194 +- .../jak3/engine/common-obs/water_REF.gc | 48 +- .../jak3/engine/debug/collision-editor_REF.gc | 53 +- .../jak3/engine/debug/debug-sphere_REF.gc | 54 +- .../reference/jak3/engine/debug/debug_REF.gc | 372 +- .../jak3/engine/debug/default-menu_REF.gc | 340 +- .../jak3/engine/debug/editable-player_REF.gc | 568 ++- .../jak3/engine/debug/editable_REF.gc | 1187 +++--- .../jak3/engine/debug/history_REF.gc | 454 ++- .../jak3/engine/debug/manipulator_REF.gc | 364 +- .../jak3/engine/debug/memory-usage_REF.gc | 426 +- .../reference/jak3/engine/debug/menu_REF.gc | 147 +- .../jak3/engine/debug/nav-mesh-editor_REF.gc | 552 ++- .../engine/debug/nav/mysql-nav-graph_REF.gc | 356 +- .../engine/debug/nav/nav-graph-editor_REF.gc | 380 +- .../reference/jak3/engine/debug/viewer_REF.gc | 35 +- .../jak3/engine/dma/dma-disasm_REF.gc | 578 ++- .../jak3/engine/draw/drawable_REF.gc | 519 ++- .../jak3/engine/entity/actor-link-h_REF.gc | 22 +- .../jak3/engine/entity/entity_REF.gc | 836 ++-- .../reference/jak3/engine/entity/res_REF.gc | 62 +- .../jak3/engine/game/effect-control_REF.gc | 912 +++-- .../reference/jak3/engine/game/fact-h_REF.gc | 87 +- .../jak3/engine/game/game-info_REF.gc | 250 +- .../jak3/engine/game/game-save_REF.gc | 53 +- .../jak3/engine/game/task/task-arrow_REF.gc | 32 +- .../jak3/engine/game/task/task-control_REF.gc | 57 +- .../jak3/engine/geometry/geometry_REF.gc | 73 +- .../jak3/engine/geometry/path-h_REF.gc | 16 +- .../jak3/engine/geometry/path_REF.gc | 133 +- .../reference/jak3/engine/geometry/vol_REF.gc | 235 +- .../engine/gfx/background/hfrag/hfrag_REF.gc | 364 +- .../gfx/background/tfrag/tfrag-methods_REF.gc | 140 +- .../gfx/background/tie/tie-methods_REF.gc | 10 +- .../jak3/engine/gfx/background/tie/tie_REF.gc | 38 +- .../jak3/engine/gfx/blit-displays_REF.gc | 30 +- .../jak3/engine/gfx/foreground/eye_REF.gc | 10 +- .../foreground/merc/merc-blend-shape_REF.gc | 86 +- .../engine/gfx/foreground/merc/merc_REF.gc | 21 +- .../jak3/engine/gfx/foreground/ripple_REF.gc | 30 +- .../generic/lightning/lightning-new_REF.gc | 354 +- .../gfx/generic/lightning/lightning_REF.gc | 695 ++-- .../jak3/engine/gfx/math-camera_REF.gc | 27 +- .../jak3/engine/gfx/mood/mood_REF.gc | 26 +- .../jak3/engine/gfx/ocean/ocean-mid_REF.gc | 81 +- .../jak3/engine/gfx/ocean/ocean-near_REF.gc | 6 +- .../engine/gfx/ocean/ocean-texture_REF.gc | 42 +- .../engine/gfx/ocean/ocean-transition_REF.gc | 296 +- .../jak3/engine/gfx/ocean/ocean_REF.gc | 550 +-- .../jak3/engine/gfx/shrub/shrubbery_REF.gc | 123 +- .../jak3/engine/gfx/sky/sky-tng_REF.gc | 47 +- .../gfx/sprite/particles/light-trails_REF.gc | 444 +-- .../particles/sparticle-launcher_REF.gc | 371 +- .../gfx/sprite/particles/sparticle_REF.gc | 69 +- .../engine/gfx/sprite/sprite-distort_REF.gc | 69 +- .../jak3/engine/gfx/sprite/sprite-glow_REF.gc | 36 +- .../jak3/engine/gfx/sprite/sprite_REF.gc | 2 +- .../jak3/engine/gfx/texture/texture_REF.gc | 408 +- .../reference/jak3/engine/level/level_REF.gc | 1379 ++++--- .../reference/jak3/engine/level/region_REF.gc | 208 +- .../reference/jak3/engine/load/decomp_REF.gc | 13 +- .../jak3/engine/load/load-state_REF.gc | 96 +- .../reference/jak3/engine/load/loader_REF.gc | 488 ++- .../reference/jak3/engine/math/euler_REF.gc | 22 +- .../reference/jak3/engine/math/math_REF.gc | 10 +- .../jak3/engine/math/quaternion_REF.gc | 25 +- .../jak3/engine/math/transformq_REF.gc | 78 +- .../jak3/engine/math/trigonometry_REF.gc | 15 +- .../jak3/engine/math/vector-h_REF.gc | 9 +- .../reference/jak3/engine/math/vector_REF.gc | 6 +- .../jak3/engine/nav/nav-control_REF.gc | 1731 ++++----- .../jak3/engine/nav/nav-enemy_REF.gc | 16 +- .../jak3/engine/nav/nav-engine_REF.gc | 53 +- .../jak3/engine/nav/nav-mesh-h_REF.gc | 164 +- .../reference/jak3/engine/nav/nav-mesh_REF.gc | 818 ++-- .../jak3/engine/physics/chain-physics_REF.gc | 402 +- .../jak3/engine/physics/cloth_REF.gc | 405 +- .../jak3/engine/physics/ragdoll-edit_REF.gc | 315 +- .../jak3/engine/physics/ragdoll_REF.gc | 539 ++- .../jak3/engine/physics/rigid-body_REF.gc | 19 +- .../jak3/engine/physics/trajectory_REF.gc | 19 +- .../process-drawable/process-drawable_REF.gc | 176 +- .../reference/jak3/engine/ps2/pad_REF.gc | 2 +- .../reference/jak3/engine/scene/scene_REF.gc | 133 +- .../reference/jak3/engine/sound/gsound_REF.gc | 190 +- .../reference/jak3/engine/sound/speech_REF.gc | 19 +- .../engine/spatial-hash/actor-hash_REF.gc | 11 +- .../engine/spatial-hash/collide-hash_REF.gc | 768 ++-- .../engine/spatial-hash/spatial-hash_REF.gc | 73 +- .../engine/target/board/board-states_REF.gc | 49 +- .../engine/target/board/target-board_REF.gc | 15 +- .../target/collide-reaction-target_REF.gc | 858 ++-- .../jak3/engine/target/flut/flut-racer_REF.gc | 12 +- .../engine/target/flut/target-flut_REF.gc | 66 +- .../engine/target/gun/gun-blue-shot_REF.gc | 1363 ++++--- .../engine/target/gun/gun-dark-shot_REF.gc | 529 ++- .../jak3/engine/target/gun/gun-part_REF.gc | 3 +- .../engine/target/gun/gun-red-shot_REF.gc | 817 ++-- .../engine/target/gun/gun-yellow-shot_REF.gc | 449 ++- .../jak3/engine/target/logic-target_REF.gc | 459 +-- .../engine/target/mech/mech-states_REF.gc | 32 +- .../engine/target/mech/target-mech_REF.gc | 83 +- .../jak3/engine/target/pilot-states_REF.gc | 43 +- .../jak3/engine/target/surface-h_REF.gc | 4 +- .../jak3/engine/target/target-anim_REF.gc | 1023 ++--- .../jak3/engine/target/target-darkjak_REF.gc | 1187 +++--- .../jak3/engine/target/target-death_REF.gc | 818 ++-- .../jak3/engine/target/target-handler_REF.gc | 630 ++- .../jak3/engine/target/target-part_REF.gc | 712 ++-- .../jak3/engine/target/target-turret_REF.gc | 42 +- .../jak3/engine/target/target-util_REF.gc | 44 +- .../jak3/engine/target/target2_REF.gc | 96 +- .../reference/jak3/engine/ui/bigmap_REF.gc | 406 +- .../jak3/engine/ui/hud-classes_REF.gc | 830 ++-- .../reference/jak3/engine/ui/hud_REF.gc | 274 +- .../reference/jak3/engine/ui/minimap_REF.gc | 1092 +++--- .../engine/ui/progress/progress-draw_REF.gc | 2516 +++++------- .../jak3/engine/ui/progress/progress_REF.gc | 97 +- .../reference/jak3/engine/ui/text_REF.gc | 441 ++- .../reference/jak3/engine/util/profile_REF.gc | 15 +- .../jak3/engine/util/sync-info_REF.gc | 24 +- .../city/blow-tower/blow-tower-obs2_REF.gc | 195 +- .../city/blow-tower/blow-tower-obs_REF.gc | 319 +- .../city/blow-tower/blow-tower-shared_REF.gc | 100 +- .../city/blow-tower/cty-blow-tower_REF.gc | 1411 ++++--- .../jak3/levels/city/bombbot/bombbot_REF.gc | 496 ++- .../city/common/cty-borrow-manager_REF.gc | 481 ++- .../city/common/ff-squad-control_REF.gc | 12 +- .../levels/city/common/guard-states_REF.gc | 72 +- .../levels/city/common/guard-tazer_REF.gc | 35 +- .../jak3/levels/city/common/height-map_REF.gc | 45 +- .../levels/city/common/kg-squad-member_REF.gc | 19 +- .../levels/city/common/krimson-wall_REF.gc | 46 +- .../levels/city/common/mh-squad-member_REF.gc | 33 +- .../jak3/levels/city/common/nav-graph_REF.gc | 145 +- .../jak3/levels/city/common/trail_REF.gc | 106 +- .../jak3/levels/city/ctyport-obs_REF.gc | 125 +- .../jak3/levels/city/ctywide-obs_REF.gc | 74 +- .../jak3/levels/city/ctywide-part_REF.gc | 2 +- .../city/destroy-grid/cty-destroy-grid_REF.gc | 96 +- .../levels/city/freehq/freehq-part_REF.gc | 6 +- .../jak3/levels/city/hijack/billiards_REF.gc | 4 +- .../city/hijack/cty-hijack-missile_REF.gc | 306 +- .../port/attack/ctyport-attack-bbush_REF.gc | 14 +- .../city/port/attack/ctyport-attack_REF.gc | 55 +- .../levels/city/protect/assault-task_REF.gc | 129 +- .../levels/city/protect/cty-protect_REF.gc | 3 +- .../levels/city/protect/flying-turret_REF.gc | 92 +- .../city/protect/protect-gunship_REF.gc | 294 +- .../levels/city/protect/roboguard-city_REF.gc | 30 +- .../city/sniper/cty-sniper-battery_REF.gc | 12 +- .../city/sniper/cty-sniper-turret_REF.gc | 19 +- .../city/traffic/citizen/citizen_REF.gc | 100 +- .../city/traffic/citizen/civilian_REF.gc | 216 +- .../levels/city/traffic/citizen/guard_REF.gc | 281 +- .../traffic/citizen/metalhead-grunt_REF.gc | 28 +- .../traffic/citizen/metalhead-predator_REF.gc | 38 +- .../levels/city/traffic/traffic-engine_REF.gc | 51 +- .../traffic/vehicle/vehicle-control_REF.gc | 7 +- .../traffic/vehicle/vehicle-effects_REF.gc | 129 +- .../traffic/vehicle/vehicle-physics_REF.gc | 13 +- .../traffic/vehicle/vehicle-states_REF.gc | 29 +- .../city/traffic/vehicle/vehicle-util_REF.gc | 257 +- .../city/traffic/vehicle/vehicle_REF.gc | 31 +- .../levels/city/vinroom/power-game_REF.gc | 34 +- .../levels/city/vinroom/vinroom-part_REF.gc | 6 +- .../jak3/levels/comb/comb-field_REF.gc | 42 +- .../jak3/levels/comb/comb-sentry_REF.gc | 12 +- .../reference/jak3/levels/comb/h-sled_REF.gc | 2 +- .../levels/common/ai/ashelin/ash-shot_REF.gc | 2 +- .../jak3/levels/common/ai/ashelin/ash_REF.gc | 18 +- .../jak3/levels/common/ai/bot-h_REF.gc | 72 +- .../jak3/levels/common/ai/bot_REF.gc | 53 +- .../jak3/levels/common/battle_REF.gc | 104 +- .../jak3/levels/common/elec-gate_REF.gc | 94 +- .../common/enemy/darkprec/dp-bipedal_REF.gc | 105 +- .../common/enemy/darkprec/neo-wasp_REF.gc | 82 +- .../jak3/levels/common/enemy/grunt_REF.gc | 28 +- .../common/enemy/hover/hover-enemy_REF.gc | 83 +- .../common/enemy/hover/hover-formation_REF.gc | 58 +- .../enemy/hover/hover-nav-control_REF.gc | 399 +- .../common/enemy/hover/hover-nav-edit_REF.gc | 81 +- .../common/enemy/hover/robo-hover_REF.gc | 207 +- .../jak3/levels/common/enemy/kg-grunt_REF.gc | 22 +- .../jak3/levels/common/enemy/mantis_REF.gc | 6 +- .../jak3/levels/common/enemy/roboguard_REF.gc | 38 +- .../levels/common/enemy/spydroid-orig_REF.gc | 142 +- .../jak3/levels/common/enemy/spydroid_REF.gc | 37 +- .../common/hvehicle/squad-control_REF.gc | 153 +- .../levels/common/race/pilot-recorder_REF.gc | 36 +- .../jak3/levels/common/race/race-hud_REF.gc | 111 +- .../levels/common/race/race-manager_REF.gc | 100 +- .../jak3/levels/common/race/race-mesh_REF.gc | 21 +- .../desert/artifact-race/artifact-race_REF.gc | 13 +- .../levels/desert/boss/deswalk-obs_REF.gc | 92 +- .../desert/boss/terraformer-drone_REF.gc | 28 +- .../desert/boss/terraformer-head_REF.gc | 28 +- .../desert/boss/terraformer-setup_REF.gc | 162 +- .../levels/desert/chase/desert-chase_REF.gc | 17 +- .../levels/desert/chase/desert-jump_REF.gc | 30 +- .../levels/desert/chase/wcar-catapult_REF.gc | 12 +- .../jak3/levels/desert/des-bush_REF.gc | 150 +- .../levels/desert/desert-dust-storm_REF.gc | 73 +- .../jak3/levels/desert/desert-scenes_REF.gc | 13 +- .../levels/desert/hover/des-beast-2_REF.gc | 135 +- .../jak3/levels/desert/hover/des-beast_REF.gc | 65 +- .../levels/desert/hover/desert-hover_REF.gc | 6 +- .../jak3/levels/desert/hover/mh-flyer_REF.gc | 25 +- .../levels/desert/hover/scorpion-gun_REF.gc | 194 +- .../desert/lizard/desert-lizard-task_REF.gc | 12 +- .../levels/desert/lizard/desert-lizard_REF.gc | 22 +- .../desert/oasis/ash-oasis-course_REF.gc | 4 +- .../levels/desert/oasis/oasis-defense_REF.gc | 120 +- .../levels/desert/race/turtle-training_REF.gc | 6 +- .../desert/rescue/desert-rescue-bbush_REF.gc | 6 +- .../levels/desert/rescue/desert-rescue_REF.gc | 8 +- .../levels/desert/rescue/neo-satellite_REF.gc | 52 +- .../desert/rescue/rope-prim-system_REF.gc | 108 +- .../levels/desert/rescue/rope-system_REF.gc | 248 +- .../desert/wvehicle/w-parking-spot_REF.gc | 20 +- .../desert/wvehicle/was-squad-control_REF.gc | 49 +- .../desert/wvehicle/wcar-marauder_REF.gc | 8 +- .../levels/desert/wvehicle/wcar-toad_REF.gc | 6 +- .../jak3/levels/desert/wvehicle/wcar_REF.gc | 12 +- .../levels/desert/wvehicle/wvehicle-ai_REF.gc | 26 +- .../desert/wvehicle/wvehicle-physics_REF.gc | 578 ++- .../desert/wvehicle/wvehicle-race_REF.gc | 72 +- .../desert/wvehicle/wvehicle-util_REF.gc | 65 +- .../levels/desert/wvehicle/wvehicle_REF.gc | 111 +- .../factory/car/hvehicle-physics_REF.gc | 160 +- .../levels/factory/car/hvehicle-util_REF.gc | 50 +- .../jak3/levels/factory/car/hvehicle_REF.gc | 188 +- .../jak3/levels/factory/conveyor_REF.gc | 88 +- .../levels/factory/fac-robotank-turret_REF.gc | 9 +- .../levels/factory/factory-boss-setup_REF.gc | 93 +- .../levels/factory/factory-boss-states_REF.gc | 112 +- .../levels/factory/factory-manager_REF.gc | 132 +- .../jak3/levels/factory/factoryc-obs2_REF.gc | 25 +- .../jak3/levels/factory/factoryc-obs_REF.gc | 6 +- .../jak3/levels/factory/h-warf_REF.gc | 51 +- .../jak3/levels/factory/lfaccity-mood_REF.gc | 6 +- .../jak3/levels/factory/missile-bot_REF.gc | 105 +- .../levels/factory/warf-projectile_REF.gc | 14 +- .../jak3/levels/forest/for-turret_REF.gc | 318 +- .../levels/forest/forest-kill-plants_REF.gc | 6 +- .../jak3/levels/forest/forest-part_REF.gc | 8 +- .../levels/forest/forest-ring-chase_REF.gc | 17 +- .../jak3/levels/forest/forest-tasks_REF.gc | 20 +- .../jak3/levels/forest/neo-spawner_REF.gc | 20 +- .../jak3/levels/glider/glider-manager_REF.gc | 40 +- .../jak3/levels/glider/glider-ring_REF.gc | 25 +- .../jak3/levels/glider/h-glider_REF.gc | 27 +- .../jak3/levels/gungame/gun-dummy_REF.gc | 2 +- .../levels/gungame/gungame-manager_REF.gc | 20 +- .../jak3/levels/hiphog/hiphog-part_REF.gc | 2 +- .../levels/mhcity/destroy-dark-eco_REF.gc | 228 +- .../jak3/levels/mhcity/mhcity-obs2_REF.gc | 6 +- .../reference/jak3/levels/mine/gekko_REF.gc | 453 +-- .../reference/jak3/levels/mine/manta_REF.gc | 38 +- .../jak3/levels/mine/mine-obs_REF.gc | 26 +- .../jak3/levels/mine/mine-platforms_REF.gc | 12 +- .../jak3/levels/mine/mine-train_REF.gc | 14 +- .../jak3/levels/mine/prebot-extras_REF.gc | 16 +- .../jak3/levels/mine/prebot-states_REF.gc | 189 +- .../reference/jak3/levels/mine/rat_REF.gc | 12 +- .../jak3/levels/nest/egg-spider_REF.gc | 48 +- .../jak3/levels/nest/mh-centipede_REF.gc | 311 +- .../reference/jak3/levels/nest/nst-obs_REF.gc | 71 +- .../jak3/levels/precursor/precura-obs2_REF.gc | 432 ++- .../jak3/levels/precursor/precura-obs_REF.gc | 47 +- .../jak3/levels/precursor/precurd-obs_REF.gc | 12 +- .../jak3/levels/sewer/flyingsaw_REF.gc | 32 +- .../jak3/levels/sewer/kg-hopper_REF.gc | 40 +- .../jak3/levels/sewer/mh-wasp_REF.gc | 183 +- .../jak3/levels/sewer/neo-juicer_REF.gc | 6 +- .../levels/sewer/saberfish-spawner_REF.gc | 301 +- .../jak3/levels/sewer/saberfish_REF.gc | 444 +-- .../jak3/levels/sewer/sewer-obs2_REF.gc | 20 +- .../jak3/levels/sewer/sewer-obs_REF.gc | 48 +- .../jak3/levels/stadium/dm-mine-spider_REF.gc | 73 +- .../jak3/levels/stadium/king-rider_REF.gc | 15 +- .../jak3/levels/stadium/rubble-attack_REF.gc | 60 +- .../jak3/levels/stadium/rubble-obs_REF.gc | 12 +- .../jak3/levels/temple/hover-training_REF.gc | 40 +- .../jak3/levels/temple/temple-obs2_REF.gc | 66 +- .../jak3/levels/temple/temple-obs_REF.gc | 41 +- .../jak3/levels/temple/templed-obs_REF.gc | 46 +- .../jak3/levels/title/title-obs_REF.gc | 29 +- .../jak3/levels/tower/tower-obs_REF.gc | 50 +- .../jak3/levels/volcano/volcano-obs_REF.gc | 17 +- .../jak3/levels/volcano/volcano-part_REF.gc | 4 +- .../jak3/levels/volcano/volcanox-obs_REF.gc | 20 +- .../wascity/bbush/des-bush-time-chase_REF.gc | 136 +- .../levels/wascity/chase/kanga-lizard_REF.gc | 18 +- .../jak3/levels/wascity/cty-faction_REF.gc | 61 +- .../levels/wascity/defend/was-pre-game_REF.gc | 40 +- .../jak3/levels/wascity/dm-flyer_REF.gc | 89 +- .../jak3/levels/wascity/flee-info_REF.gc | 16 +- .../levels/wascity/formation-object_REF.gc | 2 +- .../wascity/leaper/was-leaper-race_REF.gc | 12 +- .../levels/wascity/maker-projectile_REF.gc | 64 +- .../levels/wascity/squad-control-city_REF.gc | 65 +- .../jak3/levels/wascity/tizard_REF.gc | 153 +- .../jak3/levels/wascity/traffic-util_REF.gc | 547 ++- .../jak3/levels/wascity/wascity-turret_REF.gc | 156 +- .../jak3/levels/wascity/wasdef-manager_REF.gc | 10 +- .../jak3/levels/wascity/wasgun-manager_REF.gc | 83 +- .../levels/wascity/wasstadium/nst-gas_REF.gc | 2 +- .../wascity/wasstadium/nst-tasks_REF.gc | 12 +- .../wascity/wasstadium/sig-rider_REF.gc | 15 +- .../wascity/wasstadium/wasstadb-obs_REF.gc | 12 +- .../wascity/wasstadium/wasstadc-obs_REF.gc | 51 +- test/decompiler/test_DisasmVifDecompile.cpp | 303 +- test/decompiler/test_FormExpressionBuild.cpp | 2 +- 1385 files changed, 94985 insertions(+), 111624 deletions(-) rename test/decompiler/reference/jak1/engine/{draw => common-obs}/process-drawable_REF.gc (87%) rename test/decompiler/reference/jak1/engine/gfx/{ => foreground}/eye_REF.gc (99%) diff --git a/decompiler/IR2/AtomicOpForm.cpp b/decompiler/IR2/AtomicOpForm.cpp index e4c860d639..62d5351fab 100644 --- a/decompiler/IR2/AtomicOpForm.cpp +++ b/decompiler/IR2/AtomicOpForm.cpp @@ -62,7 +62,8 @@ FormElement* SetVarOp::get_as_form(FormPool& pool, const Env& env) const { m_dst, pool.alloc_single_element_form( nullptr, GenericOperator::make_fixed(FixedOperatorKind::ADDRESS_OF), - pool.alloc_single_element_form(nullptr, -1, offset, false)), + pool.alloc_single_element_form( + nullptr, -1, offset, make_stack_slot_access(offset), false)), true, env.stack_slot_entries.at(offset).typespec); } } else { @@ -843,10 +844,16 @@ FormElement* StackSpillLoadOp::get_as_form(FormPool& pool, const Env& env) const if (kv != env.stack_slot_entries.end()) { type = kv->second.typespec; } - return pool.alloc_element(m_dst, - pool.alloc_single_element_form( - nullptr, m_size, m_offset, m_is_signed), - true, type); + std::optional read_type; + if (env.has_type_analysis()) { + read_type = env.get_types_before_op(m_my_idx).get_slot(m_offset).typespec(); + } + return pool.alloc_element( + m_dst, + pool.alloc_single_element_form( + nullptr, m_size, m_offset, env.get_stack_slot_access_for_op(m_my_idx, m_offset), + m_is_signed, read_type), + true, type); } FormElement* StackSpillStoreOp::get_as_form(FormPool& pool, const Env& env) const { @@ -866,6 +873,7 @@ FormElement* StackSpillStoreOp::get_as_form(FormPool& pool, const Env& env) cons } } - return pool.alloc_element(m_value, m_size, m_offset, cast_type); + return pool.alloc_element( + m_value, m_size, m_offset, env.get_stack_slot_access_for_op(m_my_idx, m_offset), cast_type); } } // namespace decompiler diff --git a/decompiler/IR2/Env.cpp b/decompiler/IR2/Env.cpp index 75fe361c05..ce60f6fe35 100644 --- a/decompiler/IR2/Env.cpp +++ b/decompiler/IR2/Env.cpp @@ -4,6 +4,7 @@ #include #include +#include "AtomicOp.h" #include "Form.h" #include "common/goos/PrettyPrinter.h" @@ -162,6 +163,10 @@ std::string Env::get_variable_name(const RegisterAccess& access) const { } std::string Env::get_variable_name_name_only(const RegisterAccess& access) const { + if (is_stack_slot_access(access)) { + return get_spill_slot_var_name(get_stack_slot_offset_from_access(access)); + } + if (access.reg().get_kind() == Reg::FPR || access.reg().get_kind() == Reg::GPR) { auto& var_info = m_var_names.lookup(access.reg(), access.idx(), access.mode()); return var_info.name(); @@ -172,6 +177,14 @@ std::string Env::get_variable_name_name_only(const RegisterAccess& access) const } VariableWithCast Env::get_variable_and_cast(const RegisterAccess& access) const { + if (is_stack_slot_access(access)) { + VariableWithCast result; + auto original_name = get_spill_slot_var_name(get_stack_slot_offset_from_access(access)); + auto remapped = m_var_remap.find(original_name); + result.name = remapped != m_var_remap.end() ? remapped->second : original_name; + return result; + } + if (access.reg().get_kind() == Reg::FPR || access.reg().get_kind() == Reg::GPR) { auto& var_info = m_var_names.lookup(access.reg(), access.idx(), access.mode()); // this is a bit of a confusing process. The first step is to grab the auto-generated name: @@ -272,6 +285,10 @@ goos::Object Env::get_variable_name_with_cast(Register reg, int atomic_idx, Acce } std::optional Env::get_user_cast_for_access(const RegisterAccess& access) const { + if (is_stack_slot_access(access)) { + return {}; + } + if (access.reg().get_kind() == Reg::FPR || access.reg().get_kind() == Reg::GPR) { auto& var_info = m_var_names.lookup(access.reg(), access.idx(), access.mode()); std::string original_name = var_info.name(); @@ -310,6 +327,22 @@ std::optional Env::get_user_cast_for_access(const RegisterAccess& acce * of the variable. */ TypeSpec Env::get_variable_type(const RegisterAccess& access, bool using_user_var_types) const { + if (is_stack_slot_access(access)) { + auto offset = get_stack_slot_offset_from_access(access); + auto it = stack_slot_entries.find(offset); + if (it != stack_slot_entries.end()) { + auto type_of_var = it->second.typespec; + if (using_user_var_types) { + auto retype_kv = m_var_retype.find(it->second.name()); + if (retype_kv != m_var_retype.end()) { + type_of_var = retype_kv->second; + } + } + return type_of_var; + } + return TypeSpec("object"); + } + if (access.reg().get_kind() == Reg::FPR || access.reg().get_kind() == Reg::GPR) { auto& var_info = m_var_names.lookup(access.reg(), access.idx(), access.mode()); std::string original_name = var_info.name(); @@ -328,6 +361,37 @@ TypeSpec Env::get_variable_type(const RegisterAccess& access, bool using_user_va } } +TP_Type Env::get_variable_tp_type(const RegisterAccess& access, bool using_user_var_types) const { + if (is_stack_slot_access(access)) { + auto offset = get_stack_slot_offset_from_access(access); + auto it = stack_slot_entries.find(offset); + if (it != stack_slot_entries.end()) { + auto type_of_var = it->second.tp_type; + if (using_user_var_types) { + auto retype_kv = m_var_retype.find(it->second.name()); + if (retype_kv != m_var_retype.end()) { + type_of_var = TP_Type::make_from_ts(retype_kv->second); + } + } + return type_of_var; + } + return TP_Type::make_from_ts(TypeSpec("object")); + } + + if (access.reg().get_kind() == Reg::FPR || access.reg().get_kind() == Reg::GPR) { + auto& var_info = m_var_names.lookup(access.reg(), access.idx(), access.mode()); + if (using_user_var_types) { + auto retype_kv = m_var_retype.find(var_info.name()); + if (retype_kv != m_var_retype.end()) { + return TP_Type::make_from_ts(retype_kv->second); + } + } + return var_info.type; + } + + throw std::runtime_error("TP types are not supported for this kind of register"); +} + /*! * Update the Env with the result of the type analysis pass. */ @@ -420,6 +484,9 @@ std::vector Env::extract_visible_variables( std::vector> vars; for (auto& x : var_set) { + if (is_stack_slot_access(x)) { + continue; + } if (x.reg().get_kind() == Reg::FPR || x.reg().get_kind() == Reg::GPR) { vars.push_back(std::make_pair(get_program_var_id(x), x)); } @@ -480,6 +547,16 @@ FunctionVariableDefinitions Env::local_var_type_list(const Form* top_level_form, int nargs_to_ignore) const { ASSERT(nargs_to_ignore <= 8); auto vars = extract_visible_variables(top_level_form); + std::unordered_set visible_stack_slots; + if (top_level_form) { + RegAccessSet var_set; + top_level_form->collect_vars(var_set, true); + for (const auto& var : var_set) { + if (is_stack_slot_access(var)) { + visible_stack_slots.insert(get_stack_slot_offset_from_access(var)); + } + } + } FunctionVariableDefinitions result; std::vector elts; @@ -514,11 +591,17 @@ FunctionVariableDefinitions Env::local_var_type_list(const Form* top_level_form, // it looks like this is the order the GOAL compiler itself used. std::vector spills; for (auto& x : stack_slot_entries) { + if (top_level_form && !visible_stack_slots.count(x.first)) { + continue; + } spills.push_back(x.second); } std::sort(spills.begin(), spills.end(), [](const StackSpillEntry& a, const StackSpillEntry& b) { return a.offset < b.offset; }); for (auto& x : spills) { + if (m_vars_defined_in_let.find(x.name()) != m_vars_defined_in_let.end()) { + continue; + } elts.push_back(pretty_print::build_list(x.name(), x.typespec.print())); count++; } @@ -539,27 +622,186 @@ std::unordered_set Env::get_ssa_var(const RegAccessSet& vars } RegId Env::get_program_var_id(const RegisterAccess& var) const { + if (is_stack_slot_access(var)) { + return RegId(Register(Reg::GPR, Reg::SP), get_stack_slot_var_id_from_access(var)); + } return m_var_names.lookup(var.reg(), var.idx(), var.mode()).reg_id; } const UseDefInfo& Env::get_use_def_info(const RegisterAccess& ra) const { ASSERT(has_local_vars()); + if (is_stack_slot_access(ra)) { + return m_stack_slot_use_def_info.at(get_program_var_id(ra)); + } auto var_id = get_program_var_id(ra); return m_var_names.use_def_info.at(var_id); } +RegisterAccess Env::get_stack_slot_access_for_op(int op_id, int offset) const { + auto it = m_stack_slot_var_by_op.find(op_id); + if (it == m_stack_slot_var_by_op.end()) { + return make_stack_slot_access(offset); + } + return make_stack_slot_access(offset, it->second); +} + void Env::disable_def(const RegisterAccess& access, DecompWarnings& warnings) { + if (is_stack_slot_access(access)) { + // Stack-slot use/def info is intentionally immutable during expression building. + // Unlike registers, the stack-slot analysis models value lifetimes through merged control flow + // with synthetic phi-like vars, and mutating counts here would desynchronize later accesses + // from that analysis. + return; + } if (has_local_vars()) { m_var_names.disable_def(access, warnings); } } void Env::disable_use(const RegisterAccess& access) { + if (is_stack_slot_access(access)) { + // See disable_def above. + return; + } if (has_local_vars()) { m_var_names.disable_use(access); } } +void Env::rebuild_stack_slot_use_def_info() { + m_stack_slot_use_def_info.clear(); + m_stack_slot_var_by_op.clear(); + + if (!func || !func->ir2.atomic_ops) { + return; + } + + const auto& ops = *func->ir2.atomic_ops; + const int block_count = (int)ops.block_id_to_first_atomic_op.size(); + std::vector op_to_block(ops.ops.size(), -1); + for (int block_id = 0; block_id < block_count; block_id++) { + for (int op_id = ops.block_id_to_first_atomic_op.at(block_id); + op_id < ops.block_id_to_end_atomic_op.at(block_id); op_id++) { + op_to_block.at(op_id) = block_id; + } + } + + std::unordered_set offsets; + for (int op_id = 0; op_id < (int)ops.ops.size(); op_id++) { + if (auto* store = dynamic_cast(ops.ops.at(op_id).get())) { + offsets.insert(store->offset()); + } else if (auto* load = dynamic_cast(ops.ops.at(op_id).get())) { + offsets.insert(load->offset()); + } + } + + int next_var_id = 1; + for (int offset : offsets) { + std::vector reads_before_write(block_count, false); + std::vector writes(block_count, false); + + for (int block_id = 0; block_id < block_count; block_id++) { + bool seen_write = false; + for (int op_id = ops.block_id_to_first_atomic_op.at(block_id); + op_id < ops.block_id_to_end_atomic_op.at(block_id); op_id++) { + const auto* op = ops.ops.at(op_id).get(); + if (auto* load = dynamic_cast(op)) { + if (load->offset() == offset && !seen_write) { + reads_before_write.at(block_id) = true; + } + } else if (auto* store = dynamic_cast(op)) { + if (store->offset() == offset) { + writes.at(block_id) = true; + seen_write = true; + } + } + } + } + + std::vector live_in(block_count, false); + std::vector live_out(block_count, false); + bool changed = true; + while (changed) { + changed = false; + for (int block_id = block_count - 1; block_id >= 0; block_id--) { + bool new_live_out = false; + for (int succ : {func->basic_blocks.at(block_id).succ_branch, + func->basic_blocks.at(block_id).succ_ft}) { + if (succ != -1 && live_in.at(succ)) { + new_live_out = true; + } + } + + bool new_live_in = + reads_before_write.at(block_id) || (new_live_out && !writes.at(block_id)); + if (new_live_in != live_in.at(block_id) || new_live_out != live_out.at(block_id)) { + live_in.at(block_id) = new_live_in; + live_out.at(block_id) = new_live_out; + changed = true; + } + } + } + + std::vector phi_var(block_count, -1); + std::vector> phi_sources(block_count); + for (int block_id = 0; block_id < block_count; block_id++) { + if (live_in.at(block_id)) { + phi_var.at(block_id) = next_var_id++; + } + } + + for (int block_id = 0; block_id < block_count; block_id++) { + int current_var = live_in.at(block_id) ? phi_var.at(block_id) : -1; + for (int op_id = ops.block_id_to_first_atomic_op.at(block_id); + op_id < ops.block_id_to_end_atomic_op.at(block_id); op_id++) { + const auto* op = ops.ops.at(op_id).get(); + if (auto* load = dynamic_cast(op)) { + if (load->offset() != offset) { + continue; + } + ASSERT(current_var != -1); + m_stack_slot_var_by_op[op_id] = current_var; + auto& info = m_stack_slot_use_def_info[RegId(Register(Reg::GPR, Reg::SP), current_var)]; + info.uses.push_back({op_id, block_id, AccessMode::READ, false}); + info.ssa_vars.insert(current_var); + } else if (auto* store = dynamic_cast(op)) { + if (store->offset() != offset) { + continue; + } + current_var = next_var_id++; + m_stack_slot_var_by_op[op_id] = current_var; + auto& info = m_stack_slot_use_def_info[RegId(Register(Reg::GPR, Reg::SP), current_var)]; + info.defs.push_back({op_id, block_id, AccessMode::WRITE, false}); + info.ssa_vars.insert(current_var); + } + } + + if (!live_out.at(block_id)) { + continue; + } + + ASSERT(current_var != -1); + for (int succ : + {func->basic_blocks.at(block_id).succ_branch, func->basic_blocks.at(block_id).succ_ft}) { + if (succ != -1 && live_in.at(succ)) { + phi_sources.at(succ).push_back(current_var); + } + } + } + + for (int block_id = 0; block_id < block_count; block_id++) { + if (phi_var.at(block_id) == -1) { + continue; + } + int first_op = ops.block_id_to_first_atomic_op.at(block_id); + for (int src_var : phi_sources.at(block_id)) { + auto& info = m_stack_slot_use_def_info[RegId(Register(Reg::GPR, Reg::SP), src_var)]; + info.uses.push_back({first_op, block_id, AccessMode::READ, false}); + } + } + } +} + /*! * Set the stack hints. This must be done before type analysis. * This actually parses the types, so it should be done after the dts is set up. diff --git a/decompiler/IR2/Env.h b/decompiler/IR2/Env.h index 889c67b0a5..d8a6230fab 100644 --- a/decompiler/IR2/Env.h +++ b/decompiler/IR2/Env.h @@ -44,6 +44,36 @@ struct StackSpillEntry { } }; +constexpr int STACK_SLOT_VAR_STRIDE = 1 << 16; + +inline bool is_stack_slot_access(const RegisterAccess& access) { + return access.reg() == Register(Reg::GPR, Reg::SP) && access.idx() < 0; +} + +inline int get_stack_slot_offset_from_access(const RegisterAccess& access) { + ASSERT(is_stack_slot_access(access)); + return (-access.idx() - 1) / STACK_SLOT_VAR_STRIDE; +} + +inline int get_stack_slot_var_id_from_access(const RegisterAccess& access) { + ASSERT(is_stack_slot_access(access)); + return (-access.idx() - 1) % STACK_SLOT_VAR_STRIDE; +} + +inline RegisterAccess make_stack_slot_access(int offset, int var_id = 0) { + ASSERT(var_id >= 0); + ASSERT(var_id < STACK_SLOT_VAR_STRIDE); + return RegisterAccess(AccessMode::READ, Register(Reg::GPR, Reg::SP), + -1 - (offset * STACK_SLOT_VAR_STRIDE + var_id), true); +} + +inline bool same_expression_var(const RegisterAccess& a, const RegisterAccess& b) { + if (is_stack_slot_access(a) || is_stack_slot_access(b)) { + return a == b; + } + return a.reg() == b.reg(); +} + struct FunctionVariableDefinitions { std::optional local_vars; bool had_pp = false; @@ -126,6 +156,7 @@ class Env { void set_local_vars(const VariableNames& names) { m_var_names = names; m_has_local_vars = true; + rebuild_stack_slot_use_def_info(); } void set_end_var(RegisterAccess var) { m_end_var = var; } @@ -193,6 +224,7 @@ class Env { } const UseDefInfo& get_use_def_info(const RegisterAccess& ra) const; + RegisterAccess get_stack_slot_access_for_op(int op_id, int offset) const; void disable_use(const RegisterAccess& access); void disable_def(const RegisterAccess& access, DecompWarnings& warnings); @@ -228,6 +260,8 @@ class Env { bool pp_mapped_by_behavior() const { return m_pp_mapped_by_behavior; } private: + void rebuild_stack_slot_use_def_info(); + RegisterAccess m_end_var; bool m_has_reg_use = false; @@ -235,6 +269,8 @@ class Env { bool m_has_local_vars = false; VariableNames m_var_names; + std::unordered_map m_stack_slot_use_def_info; + std::unordered_map m_stack_slot_var_by_op; bool m_has_types = false; bool m_pp_mapped_by_behavior = false; diff --git a/decompiler/IR2/Form.cpp b/decompiler/IR2/Form.cpp index a7e9847a36..d14d23a130 100644 --- a/decompiler/IR2/Form.cpp +++ b/decompiler/IR2/Form.cpp @@ -7,6 +7,7 @@ #include "common/type_system/TypeSystem.h" #include "common/util/print_float.h" +#include "decompiler/IR2/Env.h" #include "decompiler/ObjectFile/LinkedObjectFile.h" #include "decompiler/util/DecompilerTypeSystem.h" #include "decompiler/util/data_decompile.h" @@ -2775,8 +2776,13 @@ void VectorFloatLoadStoreElement::collect_vf_regs(RegSet& regs) const { StackSpillStoreElement::StackSpillStoreElement(SimpleAtom value, int size, int stack_offset, + RegisterAccess access, const std::optional& cast_type) - : m_value(value), m_size(size), m_stack_offset(stack_offset), m_cast_type(cast_type) {} + : m_value(value), + m_size(size), + m_stack_offset(stack_offset), + m_access(access), + m_cast_type(cast_type) {} goos::Object StackSpillStoreElement::to_form_internal(const Env& env) const { return pretty_print::build_list( @@ -2801,11 +2807,24 @@ void StackSpillStoreElement::get_modified_regs(RegSet&) const {} // StackSpillValueElement //////////////////////////////// -StackSpillValueElement::StackSpillValueElement(int size, int stack_offset, bool is_signed) - : m_size(size), m_stack_offset(stack_offset), m_is_signed(is_signed) {} +StackSpillValueElement::StackSpillValueElement(int size, + int stack_offset, + RegisterAccess access, + bool is_signed, + std::optional read_type) + : m_size(size), + m_stack_offset(stack_offset), + m_access(access), + m_is_signed(is_signed), + m_read_type(std::move(read_type)) {} goos::Object StackSpillValueElement::to_form_internal(const Env& env) const { - return pretty_print::to_symbol(env.get_spill_slot_var_name(m_stack_offset)); + auto var = m_access; + auto base = pretty_print::to_symbol(env.get_spill_slot_var_name(m_stack_offset)); + if (m_read_type && env.get_variable_type(var, true) != *m_read_type) { + return pretty_print::build_list("the-as", m_read_type->print(), base); + } + return base; } void StackSpillValueElement::apply(const std::function& f) { @@ -2813,7 +2832,9 @@ void StackSpillValueElement::apply(const std::function& f) { } void StackSpillValueElement::apply_form(const std::function&) {} -void StackSpillValueElement::collect_vars(RegAccessSet&, bool) const {} +void StackSpillValueElement::collect_vars(RegAccessSet& vars, bool) const { + vars.insert(m_access); +} void StackSpillValueElement::get_modified_regs(RegSet&) const {} //////////////////////////////// diff --git a/decompiler/IR2/Form.h b/decompiler/IR2/Form.h index f627939fe4..b7d004a1d5 100644 --- a/decompiler/IR2/Form.h +++ b/decompiler/IR2/Form.h @@ -1545,6 +1545,7 @@ class StackSpillStoreElement : public FormElement { StackSpillStoreElement(SimpleAtom value, int size, int stack_offset, + RegisterAccess access, const std::optional& cast_type); goos::Object to_form_internal(const Env& env) const override; void apply(const std::function& f) override; @@ -1553,18 +1554,27 @@ class StackSpillStoreElement : public FormElement { void get_modified_regs(RegSet& regs) const override; void push_to_stack(const Env& env, FormPool& pool, FormStack& stack) override; const std::optional& cast_type() const { return m_cast_type; } + const RegisterAccess& access() const { return m_access; } + int stack_offset() const { return m_stack_offset; } private: SimpleAtom m_value; int m_size = -1; int m_stack_offset = -1; + RegisterAccess m_access; std::optional m_cast_type; }; // the value from a stack load. class StackSpillValueElement : public FormElement { public: - StackSpillValueElement(int size, int stack_offset, bool is_signed); + StackSpillValueElement(int size, + int stack_offset, + RegisterAccess access, + bool is_signed, + std::optional read_type = std::nullopt); + int stack_offset() const { return m_stack_offset; } + const RegisterAccess& access() const { return m_access; } goos::Object to_form_internal(const Env& env) const override; void apply(const std::function& f) override; void apply_form(const std::function& f) override; @@ -1579,7 +1589,9 @@ class StackSpillValueElement : public FormElement { private: int m_size = -1; int m_stack_offset = -1; + RegisterAccess m_access; bool m_is_signed = false; + std::optional m_read_type; }; class MethodOfTypeElement : public FormElement { diff --git a/decompiler/IR2/FormExpressionAnalysis.cpp b/decompiler/IR2/FormExpressionAnalysis.cpp index 153e560505..e36b7135ec 100644 --- a/decompiler/IR2/FormExpressionAnalysis.cpp +++ b/decompiler/IR2/FormExpressionAnalysis.cpp @@ -12,6 +12,7 @@ #include "common/util/BitUtils.h" #include "common/util/print_float.h" +#include "decompiler/IR2/Env.h" #include "decompiler/IR2/ExpressionHelpers.h" #include "decompiler/IR2/bitfields.h" #include "decompiler/ObjectFile/LinkedObjectFile.h" @@ -65,6 +66,56 @@ namespace decompiler { namespace { +Form* cast_form(Form* in, const TypeSpec& new_type, FormPool& pool, const Env& env, bool tc_pass); + +TypeSpec get_input_type_for_access(const Env& env, const RegisterAccess& access) { + if (is_stack_slot_access(access)) { + return env.get_variable_type(access, true); + } + return env.get_types_before_op(access.idx()).get(access.reg()).typespec(); +} + +Form* cast_stack_slot_var_if_needed(Form* in, + const TypeSpec& desired_type, + FormPool& pool, + const Env& env) { + auto atom = form_as_atom(in); + if (atom && atom->is_var() && is_stack_slot_access(atom->var()) && + env.get_variable_type(atom->var(), true) != desired_type) { + return cast_form(in, desired_type, pool, env, false); + } + return in; +} + +Form* cast_inlined_function_symbol_if_needed(Form* in, + const TypeSpec& desired_type, + FormPool& pool, + const Env& env) { + if (!env.has_type_analysis() || desired_type.base_type() != "function") { + return in; + } + + auto existing_cast = in->try_as_element(); + if (existing_cast && existing_cast->type() == desired_type) { + return in; + } + + auto obj = in->to_form(env); + if (!obj.is_symbol()) { + return in; + } + + try { + auto symbol_type = env.dts->lookup_symbol_type(obj.as_symbol().name_ptr); + if (symbol_type.base_type() == "function" && symbol_type != desired_type) { + return pool.form(desired_type, in); + } + } catch (const std::runtime_error&) { + } + + return in; +} + Form* strip_pcypld_64(Form* in) { auto m = match(Matcher::op(GenericOpMatcher::fixed(FixedOperatorKind::PCPYLD), {Matcher::integer(0), Matcher::any(0)}), @@ -347,6 +398,9 @@ Form* repop_passthrough_arg(Form* in, auto as_atom = form_as_atom(in); if (as_atom && as_atom->is_var()) { + if (is_stack_slot_access(as_atom->var())) { + return in; + } return stack.pop_reg(as_atom->var().reg(), {}, env, true, -1, orig_out, found_orig_out); } return in; @@ -377,18 +431,37 @@ void pop_helper(const std::vector& vars, const std::optional& consumes = std::nullopt, const std::vector& times_used = {}) { // to submit to stack to attempt popping - std::vector submit_regs; - // submit_reg[i] is for var submit_reg_to_var[i] - std::vector submit_reg_to_var; + std::vector submit_vars; + // submit_vars[i] is for var submit_var_to_var[i] + std::vector submit_var_to_var; // build submission for stack std::unordered_map reg_counts; + std::unordered_map stack_var_counts; for (auto& v : vars) { - reg_counts[v.reg()]++; + if (is_stack_slot_access(v)) { + stack_var_counts[env.get_variable_name_name_only(v)]++; + } else { + reg_counts[v.reg()]++; + } } for (size_t var_idx = 0; var_idx < vars.size(); var_idx++) { const auto& var = vars.at(var_idx); + if (is_stack_slot_access(var)) { + int times = 1; + if (!times_used.empty()) { + times = times_used.at(var_idx); + } + + auto& use_def = env.get_use_def_info(var); + if (stack_var_counts.at(env.get_variable_name_name_only(var)) == 1 && + use_def.use_count() == times && use_def.def_count() == 1) { + submit_var_to_var.push_back(var_idx); + submit_vars.push_back(var); + } + continue; + } auto& ri = env.reg_use().op.at(var.idx()); RegSet consumes_to_use = consumes.value_or(ri.consumes); if (consumes_to_use.find(var.reg()) != consumes_to_use.end()) { @@ -402,8 +475,8 @@ void pop_helper(const std::vector& vars, auto& use_def = env.get_use_def_info(var); if (use_def.use_count() == times && use_def.def_count() == 1) { - submit_reg_to_var.push_back(var_idx); - submit_regs.push_back(var.reg()); + submit_var_to_var.push_back(var_idx); + submit_vars.push_back(var); } else { // auto var_id = env.get_program_var_id(var); // lg::print( @@ -429,9 +502,9 @@ void pop_helper(const std::vector& vars, // submit and get a result! If the stack has nothing to pop, the result here may be nullptr. std::vector pop_result; // loop in reverse (later vals first) - for (size_t i = submit_regs.size(); i-- > 0;) { + for (size_t i = submit_vars.size(); i-- > 0;) { // figure out what var we are: - auto var_idx = submit_reg_to_var.at(i); + auto var_idx = submit_var_to_var.at(i); // anything _less_ than this should be unmodified by the pop // it's fine to modify yourself in your pop. @@ -442,7 +515,7 @@ void pop_helper(const std::vector& vars, // do the pop, with the barrier to prevent out-of-sequence popping. pop_result.push_back( - stack.pop_reg(submit_regs.at(i), pop_barrier_regs, env, allow_side_effects)); + stack.pop_reg(submit_vars.at(i), pop_barrier_regs, env, allow_side_effects)); } // now flip back to the source order for making the final result std::reverse(pop_result.begin(), pop_result.end()); @@ -452,9 +525,9 @@ void pop_helper(const std::vector& vars, forms.resize(vars.size(), nullptr); if (!pop_result.empty()) { // success! - for (size_t i = 0; i < submit_regs.size(); i++) { + for (size_t i = 0; i < submit_vars.size(); i++) { // fill out vars from our submission - forms.at(submit_reg_to_var.at(i)) = pop_result.at(i); + forms.at(submit_var_to_var.at(i)) = pop_result.at(i); } } @@ -555,6 +628,14 @@ std::vector pop_to_forms(const std::vector& vars, for (size_t i = 0; i < vars.size(); i++) { auto atom = form_as_atom(forms[i]); bool is_var = atom && atom->is_var(); + if (is_var && is_stack_slot_access(atom->var())) { + auto access_type = get_input_type_for_access(env, vars[i]); + if (env.get_variable_type(atom->var(), true) != access_type) { + forms[i] = cast_form(forms[i], access_type, pool, env); + atom = form_as_atom(forms[i]); + is_var = atom && atom->is_var(); + } + } auto cast = env.get_user_cast_for_access(vars[i]); // only cast if we didn't get a var (compacting expressions). // there is a separate system for casting variables that will do a better job. @@ -1008,6 +1089,26 @@ void SimpleExpressionElement::update_from_stack_float_2_nestable(const Env& env, bool allow_side_effects) { if (is_float_type(env, m_my_idx, m_expr.get_arg(0).var()) && is_float_type(env, m_my_idx, m_expr.get_arg(1).var())) { + if (m_expr.get_arg(0).var() == m_expr.get_arg(1).var()) { + auto arg = + pop_to_forms({m_expr.get_arg(0).var()}, env, pool, stack, allow_side_effects, {}, {2}) + .at(0); + if (kind == FixedOperatorKind::MULTIPLICATION) { + result->push_back(pool.alloc_element( + GenericOperator::make_function(pool.form("square")), arg)); + return; + } + + auto atom = form_as_atom(arg); + if (atom) { + auto arg_copy = pool.form(*atom); + auto new_form = + make_and_compact_math_op(arg, arg_copy, {}, {}, pool, env, kind, true, false); + result->push_back(new_form); + return; + } + } + auto args = pop_to_forms({m_expr.get_arg(0).var(), m_expr.get_arg(1).var()}, env, pool, stack, allow_side_effects); auto new_form = @@ -1146,7 +1247,9 @@ void SimpleExpressionElement::update_from_stack_add_i(const Env& env, } } ASSERT(used_index); - result->push_back(pool.alloc_element(args.at(1), out.addr_of, tokens)); + result->push_back(pool.alloc_element( + cast_stack_slot_var_if_needed(args.at(1), arg1_type.typespec(), pool, env), + out.addr_of, tokens)); return; } else { throw std::runtime_error( @@ -1186,7 +1289,9 @@ void SimpleExpressionElement::update_from_stack_add_i(const Env& env, } } ASSERT(used_index); - result->push_back(pool.alloc_element(args.at(1), out.addr_of, tokens)); + result->push_back(pool.alloc_element( + cast_stack_slot_var_if_needed(args.at(1), arg1_type.typespec(), pool, env), + out.addr_of, tokens)); return; } else { throw std::runtime_error( @@ -1215,7 +1320,9 @@ void SimpleExpressionElement::update_from_stack_add_i(const Env& env, } } ASSERT(used_index); - result->push_back(pool.alloc_element(args.at(1), out.addr_of, tokens)); + result->push_back(pool.alloc_element( + cast_stack_slot_var_if_needed(args.at(1), arg1_type.typespec(), pool, env), + out.addr_of, tokens)); return; } else { throw std::runtime_error( @@ -1267,7 +1374,9 @@ void SimpleExpressionElement::update_from_stack_add_i(const Env& env, } } ASSERT(used_index); - result->push_back(pool.alloc_element(args.at(0), rd_ok.addr_of, tokens)); + result->push_back(pool.alloc_element( + cast_stack_slot_var_if_needed(args.at(0), arg0_type.typespec(), pool, env), + rd_ok.addr_of, tokens)); return; } else { throw std::runtime_error(fmt::format( @@ -1318,7 +1427,9 @@ void SimpleExpressionElement::update_from_stack_add_i(const Env& env, } } ASSERT(used_index); - result->push_back(pool.alloc_element(args.at(1), rd_ok.addr_of, tokens)); + result->push_back(pool.alloc_element( + cast_stack_slot_var_if_needed(args.at(1), arg1_type.typespec(), pool, env), + rd_ok.addr_of, tokens)); return; } else { // TODO - output error to IR @@ -1341,7 +1452,9 @@ void SimpleExpressionElement::update_from_stack_add_i(const Env& env, tokens.push_back(to_token(tok)); } - result->push_back(pool.alloc_element(args.at(1), out.addr_of, tokens)); + result->push_back(pool.alloc_element( + cast_stack_slot_var_if_needed(args.at(1), arg1_type.typespec(), pool, env), out.addr_of, + tokens)); return; } } @@ -2357,7 +2470,7 @@ void SimpleExpressionElement::update_from_stack_int_to_float(const Env& env, // the gpr->fpr operation beacuse it doesn't matter. auto fpr_convert_matcher = Matcher::op(GenericOpMatcher::fixed(FixedOperatorKind::GPR_TO_FPR), {Matcher::any(0)}); - auto type = env.get_types_before_op(var.idx()).get(var.reg()).typespec(); + auto type = get_input_type_for_access(env, var); // want to allow any child of integer so integer enums can also be converted to floats. if (env.dts->ts.tc(TypeSpec("integer"), type) || type == TypeSpec("seconds")) { auto mr = match(fpr_convert_matcher, arg); @@ -2379,7 +2492,7 @@ void SimpleExpressionElement::update_from_stack_float_to_int(const Env& env, bool allow_side_effects) { auto var = m_expr.get_arg(0).var(); auto arg = pop_to_forms({var}, env, pool, stack, allow_side_effects).at(0); - auto type = env.get_types_before_op(var.idx()).get(var.reg()).typespec(); + auto type = get_input_type_for_access(env, var); auto fpr_convert_matcher = Matcher::op(GenericOpMatcher::fixed(FixedOperatorKind::GPR_TO_FPR), {Matcher::any(0)}); auto mr = match(fpr_convert_matcher, arg); @@ -2412,7 +2525,7 @@ void SimpleExpressionElement::update_from_stack_subu_l32_s7(const Env& env, bool allow_side_effects) { auto var = m_expr.get_arg(0).var(); auto arg = pop_to_forms({var}, env, pool, stack, allow_side_effects).at(0); - auto type = env.get_types_before_op(var.idx()).get(var.reg()).typespec(); + auto type = get_input_type_for_access(env, var); if (type != TypeSpec("handle")) { env.func->warnings.warning( ".subu (32-bit) used on a {} at idx {}. This probably should be a handle.", type.print(), @@ -2623,6 +2736,12 @@ void SetVarElement::push_to_stack(const Env& env, FormPool& pool, FormStack& sta // if we are a reg-reg move that consumes the original, push it without popping from stack. // it is the Stack's responsibility to untangle these later on. if (m_src->is_single_element()) { + auto spill_value = dynamic_cast(m_src->back()); + if (spill_value) { + stack.push_non_seq_reg_to_reg(m_dst, spill_value->access(), m_src, m_src_type, m_var_info); + return; + } + auto src_as_se = dynamic_cast(m_src->back()); if (src_as_se) { if (src_as_se->expr().kind() == SimpleExpression::Kind::IDENTITY && @@ -2634,9 +2753,15 @@ void SetVarElement::push_to_stack(const Env& env, FormPool& pool, FormStack& sta } auto var = src_as_se->expr().get_arg(0).var(); - auto& info = env.reg_use().op.at(var.idx()); - if (var.reg() == Register(Reg::GPR, Reg::S6) || - info.consumes.find(var.reg()) != info.consumes.end()) { + bool is_consumed_reg_move = false; + if (is_stack_slot_access(var)) { + auto& use_def = env.get_use_def_info(var); + is_consumed_reg_move = use_def.use_count() == 1 && use_def.def_count() == 1; + } else { + auto& info = env.reg_use().op.at(var.idx()); + is_consumed_reg_move = info.consumes.find(var.reg()) != info.consumes.end(); + } + if (var.reg() == Register(Reg::GPR, Reg::S6) || is_consumed_reg_move) { stack.push_non_seq_reg_to_reg(m_dst, src_as_se->expr().get_arg(0).var(), m_src, m_src_type, m_var_info); return; @@ -3495,8 +3620,14 @@ void FunctionCallElement::update_from_stack(const Env& env, } TypeSpec function_type; - auto& in_type_state = env.get_types_before_op(all_pop_vars.at(0).idx()); - auto& tp_type = in_type_state.get(all_pop_vars.at(0).reg()); + const TypeState* in_type_state = nullptr; + TP_Type tp_type; + if (!is_stack_slot_access(all_pop_vars.at(0))) { + in_type_state = &env.get_types_before_op(all_pop_vars.at(0).idx()); + tp_type = in_type_state->get(all_pop_vars.at(0).reg()); + } else { + tp_type = env.get_variable_tp_type(all_pop_vars.at(0), true); + } if (env.has_type_analysis()) { function_type = tp_type.typespec(); } @@ -3504,7 +3635,8 @@ void FunctionCallElement::update_from_stack(const Env& env, // if we're actually a go: Form* go_next_state = nullptr; if (tp_type.kind == TP_Type::Kind::ENTER_STATE_FUNCTION) { - auto& next_state_type = in_type_state.next_state_type; + ASSERT(in_type_state); + auto& next_state_type = in_type_state->next_state_type; if (next_state_type.typespec().base_type() != "state") { throw std::runtime_error("Bad state type in expressions (not state): " + next_state_type.print()); @@ -3591,7 +3723,7 @@ void FunctionCallElement::update_from_stack(const Env& env, auto val = unstacked.at(arg_id + 1); // first is the function itself. auto& var = all_pop_vars.at(arg_id + 1); if (has_good_types) { - auto actual_arg_type = env.get_types_before_op(var.idx()).get(var.reg()).typespec(); + auto actual_arg_type = get_input_type_for_access(env, var); if (arg_id == 0) { first_arg_type = actual_arg_type; @@ -3965,7 +4097,9 @@ void FunctionCallElement::update_from_stack(const Env& env, } } - new_form = pool.alloc_element(GenericOperator::make_function(unstacked.at(0)), + auto called_function = + cast_inlined_function_symbol_if_needed(unstacked.at(0), function_type, pool, env); + new_form = pool.alloc_element(GenericOperator::make_function(called_function), arg_forms); { @@ -3997,7 +4131,7 @@ void FunctionCallElement::update_from_stack(const Env& env, ASSERT(new_args.size() >= 3); for (size_t i = 0; i < 3; i++) { auto& var = all_pop_vars.at(i + 1); // 0 is the function itself. - auto arg_type = env.get_types_before_op(var.idx()).get(var.reg()).typespec(); + auto arg_type = get_input_type_for_access(env, var); if (!env.dts->ts.tc(expected_arg_types.at(i), arg_type)) { new_args.at(i) = pool.form(expected_arg_types.at(i), new_args.at(i)); } @@ -4027,7 +4161,7 @@ void FunctionCallElement::update_from_stack(const Env& env, if (match_result.matched) { auto& alloc = match_result.maps.strings.at(allocation); if (alloc != "global" && alloc != "debug" && alloc != "process" && - alloc != "loading-level") { + alloc != "loading-level" && alloc != "process-level-heap") { throw std::runtime_error("Unrecognized heap symbol for new: " + alloc); } auto type_2 = match_result.maps.strings.at(type_for_arg); @@ -5031,9 +5165,11 @@ void CondWithElseElement::push_to_stack(const Env& env, FormPool& pool, FormStac // determine if set destination is used bool set_unused = false; if (rewrite_as_set) { - auto& info = env.reg_use().op.at(last_var->idx()); - if (info.written_and_unused.find(last_var->reg()) != info.written_and_unused.end()) { - set_unused = true; + if (!is_stack_slot_access(*last_var)) { + auto& info = env.reg_use().op.at(last_var->idx()); + if (info.written_and_unused.find(last_var->reg()) != info.written_and_unused.end()) { + set_unused = true; + } } } @@ -6019,7 +6155,7 @@ void ConditionElement::push_to_stack(const Env& env, FormPool& pool, FormStack& if (m_src[i]->is_var()) { auto& var = m_src[i]->var(); vars.push_back(var); - source_types.push_back(env.get_types_before_op(var.idx()).get(var.reg()).typespec()); + source_types.push_back(get_input_type_for_access(env, var)); } else if (m_src[i]->is_int()) { if (m_src[i]->get_int() == 0 && condition_uses_float(m_kind)) { // if we're doing a floating point comparison, and one of our arguments is a constant @@ -6072,7 +6208,7 @@ void ConditionElement::update_from_stack(const Env& env, if (m_src[i]->is_var()) { auto& var = m_src[i]->var(); vars.push_back(var); - source_types.push_back(env.get_types_before_op(var.idx()).get(var.reg()).typespec()); + source_types.push_back(get_input_type_for_access(env, var)); } else if (m_src[i]->is_int()) { if (m_src[i]->get_int() == 0 && condition_uses_float(m_kind)) { // if we're doing a floating point comparison, and one of our arguments is a constant @@ -6915,11 +7051,53 @@ void StackSpillStoreElement::push_to_stack(const Env& env, FormPool& pool, FormS src = pool.form(m_value); } - auto dst = pool.form(env.get_spill_slot_var_name(m_stack_offset)); if (m_cast_type) { src = cast_form(src, *m_cast_type, pool, env); } - stack.push_form_element(pool.alloc_element(dst, src), true); + + TypeSpec stack_type("object"); + auto it = env.stack_slot_entries.find(m_stack_offset); + if (it != env.stack_slot_entries.end()) { + stack_type = it->second.typespec; + } else if (m_cast_type) { + stack_type = *m_cast_type; + } + + auto src_as_generic = src->try_as_element(); + if (src_as_generic && !src_as_generic->op().is_func()) { + using InplaceOpInfo = std::pair; + const static std::array in_place_ops = { + InplaceOpInfo{FixedOperatorKind::ADDITION, FixedOperatorKind::ADDITION_IN_PLACE}, + InplaceOpInfo{FixedOperatorKind::ADDITION_PTR, FixedOperatorKind::ADDITION_PTR_IN_PLACE}, + InplaceOpInfo{FixedOperatorKind::LOGAND, FixedOperatorKind::LOGAND_IN_PLACE}, + InplaceOpInfo{FixedOperatorKind::LOGIOR, FixedOperatorKind::LOGIOR_IN_PLACE}, + InplaceOpInfo{FixedOperatorKind::LOGCLEAR, FixedOperatorKind::LOGCLEAR_IN_PLACE}, + InplaceOpInfo{FixedOperatorKind::LOGXOR, FixedOperatorKind::LOGXOR_IN_PLACE}, + }; + + auto dst_var = m_access; + auto dst_form = pool.form(SimpleAtom::make_var(dst_var))->to_form(env); + for (const auto& [kind, inplace_kind] : in_place_ops) { + if (!src_as_generic->op().is_fixed(kind)) { + continue; + } + + for (int inplace_arg : {0, 1}) { + if (src_as_generic->elts().at(inplace_arg)->to_form(env) != dst_form) { + continue; + } + + if (inplace_arg != 0) { + std::swap(src_as_generic->elts().at(0), src_as_generic->elts().at(1)); + } + src_as_generic->op() = GenericOperator::make_fixed(inplace_kind); + stack.push_form_element(src_as_generic, true); + return; + } + } + } + + stack.push_value_to_reg(m_access, src, true, stack_type); } namespace { @@ -7173,13 +7351,21 @@ void StackStructureDefElement::update_from_stack(const Env&, result->push_back(this); } -void StackSpillValueElement::update_from_stack(const Env&, - FormPool&, +void StackSpillValueElement::update_from_stack(const Env& env, + FormPool& pool, FormStack&, std::vector* result, bool) { mark_popped(); - result->push_back(this); + auto var = m_access; + Form* form = + pool.alloc_single_element_form(nullptr, SimpleAtom::make_var(var)); + if (m_read_type && env.get_variable_type(var, true) != *m_read_type) { + form = cast_form(form, *m_read_type, pool, env); + } + for (auto elt : form->elts()) { + result->push_back(elt); + } } void GetSymbolStringPointer::update_from_stack(const Env&, diff --git a/decompiler/IR2/FormStack.cpp b/decompiler/IR2/FormStack.cpp index 672e315c9e..4c714cab43 100644 --- a/decompiler/IR2/FormStack.cpp +++ b/decompiler/IR2/FormStack.cpp @@ -9,6 +9,26 @@ #include "decompiler/util/DecompilerTypeSystem.h" namespace decompiler { +namespace { +bool nonempty_intersection(const RegSet& a, const RegSet& b) { + for (auto x : a) { + if (b.find(x) != b.end()) { + return true; + } + } + return false; +} + +bool can_inline_non_seq_source(const RegisterAccess& src, const Env& env) { + if (!is_stack_slot_access(src)) { + return true; + } + + const auto& use_def = env.get_use_def_info(src); + return use_def.use_count() == 1 && use_def.def_count() == 1; +} +} // namespace + std::string FormStack::StackEntry::print(const Env& env) const { if (destination.has_value()) { ASSERT(source && !elt); @@ -116,19 +136,61 @@ Form* FormStack::pop_reg(const RegisterAccess& var, const Env& env, bool allow_side_effects, int begin_idx) { - return pop_reg(var.reg(), barrier, env, allow_side_effects, begin_idx); -} + RegSet modified; + size_t begin = m_stack.size(); + if (begin_idx >= 0) { + begin = begin_idx; + } + for (size_t i = begin; i-- > 0;) { + auto& entry = m_stack.at(i); + if (entry.active) { + if (entry.destination.has_value() && same_expression_var(*entry.destination, var)) { + entry.source->get_modified_regs(modified); + if (!allow_side_effects && entry.source->has_side_effects()) { + return nullptr; + } + if (nonempty_intersection(modified, barrier)) { + return nullptr; + } + entry.active = false; + ASSERT(entry.source); + if (entry.non_seq_source.has_value()) { + ASSERT(entry.sequence_point == false); + if (can_inline_non_seq_source(*entry.non_seq_source, env)) { + auto result = pop_reg(*entry.non_seq_source, barrier, env, allow_side_effects, i); + if (result) { + return result; + } + } + } -namespace { -bool nonempty_intersection(const RegSet& a, const RegSet& b) { - for (auto x : a) { - if (b.find(x) != b.end()) { - return true; + return entry.source; + } else { + if (entry.sequence_point) { + return nullptr; + } + if (entry.source) { + ASSERT(!entry.elt); + entry.source->get_modified_regs(modified); + if (!allow_side_effects) { + return nullptr; + } + } else { + ASSERT(entry.elt); + entry.elt->get_modified_regs(modified); + if (!allow_side_effects && entry.elt->has_side_effects()) { + return nullptr; + } + } + } + } else { + if (entry.destination.has_value() && same_expression_var(*entry.destination, var)) { + return nullptr; + } } } - return false; + return nullptr; } -} // namespace Form* FormStack::pop_reg(Register reg, const RegSet& barrier, @@ -164,13 +226,15 @@ Form* FormStack::pop_reg(Register reg, ASSERT(entry.source); if (entry.non_seq_source.has_value()) { ASSERT(entry.sequence_point == false); - auto result = pop_reg(entry.non_seq_source->reg(), barrier, env, allow_side_effects, i); - if (result) { - if (found_orig_out) { - *found_orig_out = true; - *orig_out = *entry.destination; + if (can_inline_non_seq_source(*entry.non_seq_source, env)) { + auto result = pop_reg(entry.non_seq_source->reg(), barrier, env, allow_side_effects, i); + if (result) { + if (found_orig_out) { + *found_orig_out = true; + *orig_out = *entry.destination; + } + return result; } - return result; } } @@ -325,7 +389,7 @@ std::vector FormStack::rewrite(FormPool& pool, const Env& env) con while (keep_going && !result.empty()) { keep_going = false; auto last_op_as_set = dynamic_cast(result.back()); - if (last_op_as_set && last_op_as_set->dst().reg() == var_to_get.reg()) { + if (last_op_as_set && same_expression_var(last_op_as_set->dst(), var_to_get)) { result.pop_back(); auto as_one = dynamic_cast( last_op_as_set->src()->try_as_single_element()); @@ -384,7 +448,7 @@ std::optional rewrite_to_get_var(std::vector& defa while (keep_going && !default_result.empty()) { keep_going = false; auto last_op_as_set = dynamic_cast(default_result.back()); - if (last_op_as_set && last_op_as_set->dst().reg() == var_to_get.reg() && + if (last_op_as_set && same_expression_var(last_op_as_set->dst(), var_to_get) && (first || last_op_as_set->info().is_compactable)) { default_result.pop_back(); auto as_one = diff --git a/decompiler/IR2/GenericElementMatcher.cpp b/decompiler/IR2/GenericElementMatcher.cpp index 9d254d5f1b..b40031da54 100644 --- a/decompiler/IR2/GenericElementMatcher.cpp +++ b/decompiler/IR2/GenericElementMatcher.cpp @@ -305,6 +305,13 @@ bool Matcher::do_match(Form* input, MatchResult::Maps* maps_out, const Env* cons } } + auto as_stack_spill = + dynamic_cast(input->try_as_single_active_element()); + if (as_stack_spill) { + got = true; + result = as_stack_spill->access(); + } + if (got) { if (m_kind == Kind::REG) { return result.reg() == *m_reg; diff --git a/decompiler/analysis/insert_lets.cpp b/decompiler/analysis/insert_lets.cpp index 12d93bedc5..97e0813360 100644 --- a/decompiler/analysis/insert_lets.cpp +++ b/decompiler/analysis/insert_lets.cpp @@ -45,6 +45,8 @@ If the previous let variables appear in the definition of new one, make the let namespace { FormElement* rewrite_let(LetElement* in, const Env& env, FormPool& pool, LetRewriteStats& stats); +FormElement* rewrite_multi_let_as_vector_dot(LetElement* in, const Env& env, FormPool& pool); +bool let_uses_stack_slot_access(const LetElement* in); std::vector path_up_tree(Form* in, const Env&) { std::vector path; @@ -2409,6 +2411,18 @@ FormElement* rewrite_set_font_single(LetElement* in, FormElement* rewrite_let(LetElement* in, const Env& env, FormPool& pool, LetRewriteStats& stats) { // ordered based on frequency. for best performance, you check the most likely rewrites first! + if (in->entries().size() >= 6) { + auto as_vector_dot = rewrite_multi_let_as_vector_dot(in, env, pool); + if (as_vector_dot) { + stats.vector_dot++; + return as_vector_dot; + } + } + + if (let_uses_stack_slot_access(in)) { + return nullptr; + } + auto as_unused = rewrite_empty_let(in, env, pool); if (as_unused) { stats.unused++; @@ -3073,6 +3087,18 @@ FormElement* rewrite_multi_let(LetElement* in, const Env& env, FormPool& pool, LetRewriteStats& stats) { + if (in->entries().size() >= 6) { + auto as_vector_dot = rewrite_multi_let_as_vector_dot(in, env, pool); + if (as_vector_dot) { + stats.vector_dot++; + return as_vector_dot; + } + } + + if (let_uses_stack_slot_access(in)) { + return in; + } + if (in->entries().size() >= 2) { auto as_with_dma_buf_add_bucket = rewrite_with_dma_buf_add_bucket(in, env, pool); if (as_with_dma_buf_add_bucket) { @@ -3101,14 +3127,6 @@ FormElement* rewrite_multi_let(LetElement* in, } } - if (in->entries().size() >= 6) { - auto as_vector_dot = rewrite_multi_let_as_vector_dot(in, env, pool); - if (as_vector_dot) { - stats.vector_dot++; - return as_vector_dot; - } - } - auto as_font_set_origin = rewrite_set_font_origin(in, env, pool); if (as_font_set_origin) { stats.font_method++; @@ -3569,6 +3587,12 @@ FormElement* rewrite_let_sequence(const std::vector& in, const Env& env, FormPool& pool, LetRewriteStats& stats) { + for (const auto* let : in) { + if (let_uses_stack_slot_access(let)) { + return nullptr; + } + } + if (in.size() == 3) { auto as_dma_buffer_add_gs_set = rewrite_dma_buffer_add_gs_set(in, env, pool); if (as_dma_buffer_add_gs_set) { @@ -3609,6 +3633,15 @@ Form* insert_cast_for_let(RegisterAccess dst, return src; } +bool let_uses_stack_slot_access(const LetElement* in) { + for (const auto& entry : in->entries()) { + if (is_stack_slot_access(entry.dest)) { + return true; + } + } + return false; +} + bool register_can_hold_var(const Register& reg) { return reg.get_kind() == Reg::FPR || reg.get_kind() == Reg::GPR; } diff --git a/decompiler/config/jak2/ntsc_v1/type_casts.jsonc b/decompiler/config/jak2/ntsc_v1/type_casts.jsonc index b1bde5edc2..3f5e709f32 100644 --- a/decompiler/config/jak2/ntsc_v1/type_casts.jsonc +++ b/decompiler/config/jak2/ntsc_v1/type_casts.jsonc @@ -2778,7 +2778,7 @@ [[1, 7], "v1", "drawable-region-prim"] ], "(method 18 drawable-region-face)": [ - [[33, 84], "v1", "(inline-array vector)"] + ["_stack_", 56, "(inline-array vector)"] ], "(method 18 drawable-tree-region-prim)": [ [[22, 49], "s2", "drawable-region-prim"] @@ -4051,7 +4051,9 @@ [64, "a0", "process-drawable"] ], "process-drawable2-shock-effect": [[59, "v0", "lightning-tracker"]], - "process-drawable-shock-effect": [[156, "v0", "lightning-tracker"]], + "process-drawable-shock-effect": [ + ["_stack_", 624, "(pointer lightning-tracker)"] + ], "(method 12 top-anim-joint-control)": [ [8, "a1", "art-joint-anim"], [40, "a1", "art-joint-anim"] @@ -5967,7 +5969,7 @@ "(post idle drill-plat)": [[4, "t9", "(function none)"]], "(post idle grenade-point)": [[122, "v1", "lightning-tracker"]], "(anon-function 12 strip-obs)": [ - [103, "a0", "(pointer entity-actor)"], + ["_stack_", 16, "(pointer entity-actor)"], [287, "v1", "int"] ], "(method 11 strip-hazard)": [ diff --git a/decompiler/config/jak3/ntsc_v1/process_stack_size_overrides.jsonc b/decompiler/config/jak3/ntsc_v1/process_stack_size_overrides.jsonc index 1609739ad1..bea7a22335 100644 --- a/decompiler/config/jak3/ntsc_v1/process_stack_size_overrides.jsonc +++ b/decompiler/config/jak3/ntsc_v1/process_stack_size_overrides.jsonc @@ -7,5 +7,6 @@ "task-manager-init-by-other": 2048, "race-manager-init-by-other": 1024, "neo-sat-shield-init-by-other": 64, - "bt-gun-manager-init-by-other": 256 + "bt-gun-manager-init-by-other": 256, + "(method 11 tpl-holo-eye)": 384 } diff --git a/decompiler/config/jak3/ntsc_v1/type_casts.jsonc b/decompiler/config/jak3/ntsc_v1/type_casts.jsonc index 27b838535f..e30e0472a8 100644 --- a/decompiler/config/jak3/ntsc_v1/type_casts.jsonc +++ b/decompiler/config/jak3/ntsc_v1/type_casts.jsonc @@ -230,7 +230,11 @@ [324, "v1", "(pointer uint64)"], [334, "v1", "(pointer uint64)"], [141, "v1", "int"], - [25, "v1", "dma-tag"] + [25, "v1", "dma-tag"], + ["_stack_", 16, "uint"], + ["_stack_", 32, "dma-packet"], + ["_stack_", 64, "dma-packet"], + ["_stack_", 80, "dma-packet"] ], "(method 3 connection-minimap)": [[97, "f0", "float"]], "dma-buffer-add-ref-texture": [ @@ -1307,7 +1311,8 @@ "target-compute-edge": [[48, "a0", "process-drawable"]], "history-draw": [ [16, "a1", "int"], - [151, "a0", "uint"] + [151, "a0", "uint"], + ["_stack_", 24, "float"] ], "history-print": [[20, "a1", "int"]], "target-collision-reaction": [ @@ -2119,7 +2124,11 @@ ["_stack_", 16, "dma-packet"], [91, "v1", "dma-packet"] ], - "target-history-print": [["_stack_", 32, "collide-status"]], + "target-history-print": [ + ["_stack_", 32, "collide-status"], + ["_stack_", 68, "float"], + ["_stack_", 40, "float"] + ], "(method 13 sync-linear)": [ ["_stack_", 16, "res-tag"], [27, "v0", "(pointer float)"] @@ -5316,8 +5325,14 @@ "(code extend min-bridge)": [[49, "v1", "art-joint-anim"]], "(code extended min-folding-plat)": [[15, "v1", "art-joint-anim"]], "(code extend min-folding-plat)": [[44, "v1", "art-joint-anim"]], - "(method 11 min-falling-step)": [["_stack_", 16, "res-tag"]], - "(method 11 rat-spawner)": [["_stack_", 16, "res-tag"]], + "(method 11 min-falling-step)": [ + ["_stack_", 16, "res-tag"], + [19, "v0", "(pointer actor-group)"] + ], + "(method 11 rat-spawner)": [ + ["_stack_", 16, "res-tag"], + [31, "v0", "(pointer actor-group)"] + ], "(method 0 flow-control)": [["_stack_", 16, "res-tag"]], "(code lowered min-falling-step)": [[18, "v1", "art-joint-anim"]], "(code lowering min-falling-step)": [[65, "v1", "art-joint-anim"]], @@ -5354,7 +5369,10 @@ [62, "v1", "collide-shape-prim-group"], [[65, 71], "v1", "collide-shape-prim-group"] ], - "(method 11 min-rat-engine)": [["_stack_", 16, "res-tag"]], + "(method 11 min-rat-engine)": [ + ["_stack_", 16, "res-tag"], + [61, "v0", "(pointer actor-group)"] + ], "(method 21 min-target-sign)": [[[21, 25], "gp", "collide-shape-prim-group"]], "min-bomb-elevator-callback": [[[3, 31], "v1", "min-bomb-elevator"]], "(enter running min-rat-engine)": [[68, "v1", "collide-shape-prim-group"]], @@ -5373,7 +5391,10 @@ "(method 34 min-crane-switch)": [[35, "v1", "art-joint-anim"]], "joint-mod-rat-engine-callback": [[6, "v1", "min-rat-engine"]], "(method 27 min-rat-engine)": [[14, "a2", "process-focusable"]], - "(method 11 rat-light-manager)": [["_stack_", 16, "res-tag"]], + "(method 11 rat-light-manager)": [ + ["_stack_", 16, "res-tag"], + [12, "v0", "(pointer actor-group)"] + ], "(code idle manta)": [ [100, "v1", "art-joint-anim"], [46, "v1", "art-joint-anim"] @@ -5426,7 +5447,10 @@ [15, "a0", "process-focusable"], [18, "a0", "process-focusable"] ], - "(method 121 manta)": [["_stack_", 16, "res-tag"]], + "(method 121 manta)": [ + ["_stack_", 16, "res-tag"], + [87, "v0", "(pointer actor-group)"] + ], "(code wheel-die rat)": [[14, "v1", "art-joint-anim"]], "rat-joint-mod-roll": [[9, "gp", "rat"]], "(code running-in-wheel rat)": [ @@ -5544,7 +5568,10 @@ [17, "a0", "task-manager"], [20, "a0", "task-manager"] ], - "(method 11 min-bomb-train)": [["_stack_", 16, "res-tag"]], + "(method 11 min-bomb-train)": [ + ["_stack_", 16, "res-tag"], + [129, "v0", "(pointer actor-group)"] + ], "(code hostile-wall gekko)": [ [20, "v1", "art-joint-anim"], [70, "v1", "art-joint-anim"] @@ -5633,7 +5660,10 @@ [47, "v1", "art-joint-anim"] ], "(method 108 gekko)": [[19, "v1", "process-focusable"]], - "(method 11 basebutton)": [["_stack_", 16, "res-tag"]], + "(method 11 basebutton)": [ + ["_stack_", 16, "res-tag"], + [67, "v0", "(pointer actor-group)"] + ], "clmf-cam-string": [["_stack_", 16, "res-tag"]], "(code knocked-recover grunt)": [ [15, "v1", "ragdoll-proc"], @@ -5981,7 +6011,10 @@ "sew-fan-joint-fan": [[[3, 20], "v1", "sew-fan"]], "(method 82 sew-fan)": [[[46, 63], "v1", "attack-info"]], "(method 11 sew-wall-switch)": [["_stack_", 16, "res-tag"]], - "(method 11 sew-pipe)": [["_stack_", 16, "res-tag"]], + "(method 11 sew-pipe)": [ + ["_stack_", 16, "res-tag"], + [87, "v0", "(pointer actor-group)"] + ], "(enter down sew-pipe)": [[13, "v1", "art-joint-anim"]], "(code lower sew-pipe)": [[83, "v1", "art-joint-anim"]], "(enter raised sew-m-gate)": [[13, "v1", "art-joint-anim"]], @@ -6110,7 +6143,10 @@ [194, "v0", "vector"], ["_stack_", 16, "res-tag"] ], - "(method 11 saberfish-spawn-manager-base)": [["_stack_", 16, "res-tag"]], + "(method 11 saberfish-spawn-manager-base)": [ + ["_stack_", 16, "res-tag"], + [22, "v0", "(pointer actor-group)"] + ], "(method 26 saberfish-spawner)": [ [[9, 49], "gp", "saberfish-spawner-query-msg"], [[77, 85], "v1", "saberfish-spawner-command"], @@ -6704,7 +6740,12 @@ [13, "v1", "int"], [86, "a0", "part-tracker"] ], - "(method 32 task-manager-nest-cocoons)": [["_stack_", 16, "res-tag"]], + "(method 32 task-manager-nest-cocoons)": [ + ["_stack_", 16, "res-tag"], + [18, "v0", "(pointer actor-group)"], + [17, "v0", "(pointer actor-group)"], + [31, "v0", "(pointer actor-group)"] + ], "(code active task-manager-nest-cocoons)": [ [155, "v1", "(pointer process)"], [168, "gp", "handle"] @@ -6789,13 +6830,17 @@ ], "(method 11 spider-manager)": [ ["_stack_", 16, "res-tag"], - ["_stack_", 32, "res-tag"] + ["_stack_", 32, "res-tag"], + [62, "v0", "(pointer actor-group)"] ], "ripple-find-height": [[[31, 82], "s4", "mei-ripple"]], "(method 21 task-manager-desert-hover)": [["_stack_", 16, "res-tag"]], "(method 11 nst-metalhead-eggs)": [["_stack_", 16, "res-tag"]], "(method 11 nst-falling-stone-bridge)": [["_stack_", 16, "res-tag"]], - "(method 11 sew-m-gate)": [["_stack_", 16, "res-tag"]], + "(method 11 sew-m-gate)": [ + ["_stack_", 16, "res-tag"], + [87, "v0", "(pointer actor-group)"] + ], "(method 9 turret-control)": [[344, "a0", "collide-shape-prim"]], "(method 62 v-marauder)": [[[4, 53], "s5", "collide-shape-prim-group"]], "(method 62 v-marauder-b)": [[[4, 53], "s5", "collide-shape-prim-group"]], @@ -6966,9 +7011,18 @@ ], "(event closed tpl-break-door-a)": [[[9, 22], "v1", "attack-info"]], "(event closed tpl-break-alcove)": [[[4, 17], "v1", "attack-info"]], - "(method 11 tpl-fan-three)": [[99, "v0", "(pointer float)"]], - "(method 11 tpl-spindle)": [[131, "v0", "(pointer float)"]], - "(method 11 tpl-fan-two)": [[99, "v0", "(pointer float)"]], + "(method 11 tpl-fan-three)": [ + [99, "v0", "(pointer float)"], + ["_stack_", 16, "res-tag"] + ], + "(method 11 tpl-spindle)": [ + [131, "v0", "(pointer float)"], + ["_stack_", 16, "res-tag"] + ], + "(method 11 tpl-fan-two)": [ + [99, "v0", "(pointer float)"], + ["_stack_", 16, "res-tag"] + ], "(event idle-up tpl-spike-trap)": [ [42, "gp", "process-drawable"], [83, "gp", "process-focusable"] @@ -7004,10 +7058,22 @@ [99, "v0", "(pointer actor-group)"], ["_stack_", 96, "res-tag"] ], - "(method 11 tpl-watcher-manager)": [["_stack_", 16, "res-tag"]], - "(method 11 hover-training-manager)": [["_stack_", 16, "res-tag"]], - "(method 11 tpl-token)": [["_stack_", 16, "res-tag"]], - "(method 11 tpl-holo-eye)": [["_stack_", 16, "res-tag"]], + "(method 11 tpl-watcher-manager)": [ + ["_stack_", 16, "res-tag"], + [24, "v0", "(pointer actor-group)"] + ], + "(method 11 hover-training-manager)": [ + ["_stack_", 16, "res-tag"], + [23, "v0", "(pointer actor-group)"] + ], + "(method 11 tpl-token)": [ + ["_stack_", 16, "res-tag"], + [110, "v0", "(pointer actor-group)"] + ], + "(method 11 tpl-holo-eye)": [ + ["_stack_", 16, "res-tag"], + [56, "v0", "(pointer actor-group)"] + ], "(code firing tpl-watcher)": [[143, "a1", "process-drawable"]], "(event firing tpl-watcher)": [[[4, 13], "v1", "attack-info"]], "(event idle tpl-watcher)": [[[12, 21], "v1", "attack-info"]], @@ -7306,8 +7372,14 @@ [209, "v1", "art-joint-anim"] ], "(code active tow-spawner)": [[14, "v1", "art-joint-anim"]], - "(method 11 actor-group-watcher)": [["_stack_", 16, "res-tag"]], - "(method 11 tow-large-plat)": [["_stack_", 16, "res-tag"]], + "(method 11 actor-group-watcher)": [ + ["_stack_", 16, "res-tag"], + [13, "v0", "(pointer actor-group)"] + ], + "(method 11 tow-large-plat)": [ + ["_stack_", 16, "res-tag"], + [121, "v0", "(pointer actor-group)"] + ], "update-mood-forest": [[[23, 71], "gp", "forest-states"]], "set-forest-gun-flash!": [[13, "v1", "forest-states"]], "set-forest-fog-interp!": [ @@ -7345,11 +7417,17 @@ [763, "s5", "handle"], [761, "v1", "handle"] ], - "(method 32 task-manager-forest-machine)": [["_stack_", 16, "res-tag"]], + "(method 32 task-manager-forest-machine)": [ + ["_stack_", 16, "res-tag"], + [18, "v0", "(pointer actor-group)"], + [31, "v0", "(pointer actor-group)"], + [17, "v0", "(pointer actor-group)"] + ], "(method 32 task-manager-forest-plants)": [["_stack_", 16, "res-tag"]], "(code active task-manager-forest-machine-resolution)": [ [78, "v1", "int"], - ["_stack_", 16, "res-tag"] + ["_stack_", 16, "res-tag"], + [99, "v0", "(pointer actor-group)"] ], "set-railx-light-brightness-fora!": [ [[30, 35], "v1", "railx-states-fora"], @@ -7400,7 +7478,10 @@ [15, "v0", "path-control"], [111, "v0", "entity-actor"] ], - "(method 32 task-manager-forest-ring-chase)": [["_stack_", 16, "res-tag"]], + "(method 32 task-manager-forest-ring-chase)": [ + ["_stack_", 16, "res-tag"], + [17, "v0", "(pointer actor-group)"] + ], "(enter impact dp-bipedal-grenade-shot)": [ [13, "v1", "collide-shape-prim-group"] ], @@ -7505,7 +7586,10 @@ [71, "s5", "process-focusable"] ], "(method 41 dp-bipedal-shield)": [[9, "v1", "attack-info"]], - "(method 121 dp-bipedal)": [["_stack_", 16, "res-tag"]], + "(method 121 dp-bipedal)": [ + ["_stack_", 16, "res-tag"], + [116, "v0", "(pointer actor-group)"] + ], "(method 121 neo-wasp)": [ [211, "v0", "(pointer float)"], ["_stack_", 16, "res-tag"], @@ -7543,8 +7627,14 @@ "neo-spawner-handler": [[[71, 119], "gp", "attack-info"]], "(code vulnerable neo-spawner)": [[14, "v1", "art-joint-anim"]], "(enter dead neo-spawner)": [[27, "v1", "art-joint-anim"]], - "(method 11 neo-spawner-manager)": [["_stack_", 16, "res-tag"]], - "(method 11 neo-spawner)": [["_stack_", 16, "res-tag"]], + "(method 11 neo-spawner-manager)": [ + ["_stack_", 16, "res-tag"], + [15, "v0", "(pointer actor-group)"] + ], + "(method 11 neo-spawner)": [ + ["_stack_", 16, "res-tag"], + [134, "v0", "(pointer actor-group)"] + ], "(method 28 for-turret-shot)": [ [29, "s5", "process-drawable"], [32, "s5", "process-drawable"], @@ -7580,7 +7670,10 @@ "(anon-function 2 for-turret)": [[[6, 13], "v1", "for-turret"]], "(anon-function 3 for-turret)": [[[3, 13], "s4", "for-turret"]], "(anon-function 4 for-turret)": [[6, "v1", "for-turret"]], - "(method 37 for-turret)": [["_stack_", 16, "res-tag"]], + "(method 37 for-turret)": [ + ["_stack_", 16, "res-tag"], + [18, "v0", "(pointer actor-group)"] + ], "(code idle vol-holo-eye)": [ [14, "v1", "art-joint-anim"], [80, "v1", "art-joint-anim"] @@ -7979,8 +8072,14 @@ ], "(code die-eaten kanga-lizard)": [[22, "v1", "art-joint-anim"]], "(method 11 dm-mine-spider-spawner)": [["_stack_", 16, "res-tag"]], - "(method 11 vol-holo-eye)": [["_stack_", 16, "res-tag"]], - "(method 32 task-manager-kanga-lizard)": [["_stack_", 16, "res-tag"]], + "(method 11 vol-holo-eye)": [ + ["_stack_", 16, "res-tag"], + [41, "v0", "(pointer actor-group)"] + ], + "(method 32 task-manager-kanga-lizard)": [ + ["_stack_", 16, "res-tag"], + [19, "v0", "(pointer actor-group)"] + ], "(code explode rub-dark-jak-door)": [[129, "v1", "art-joint-anim"]], "(event idle rub-dark-jak-door)": [[4, "v1", "attack-info"]], "(code drop rub-falling-step)": [[14, "v1", "art-joint-anim"]], @@ -8163,12 +8262,17 @@ ], "(method 21 task-manager-arena-fight-2)": [ [[378, 383], "a0", "crate"], - ["_stack_", 16, "res-tag"] + ["_stack_", 16, "res-tag"], + [57, "v0", "(pointer actor-group)"] + ], + "(method 21 task-manager-arena-fight)": [ + ["_stack_", 16, "res-tag"], + [21, "v0", "(pointer actor-group)"] ], - "(method 21 task-manager-arena-fight)": [["_stack_", 16, "res-tag"]], "(method 21 task-manager-arena-fight-3)": [ ["_stack_", 16, "res-tag"], - [106, "t0", "float"] + [106, "t0", "float"], + [54, "v0", "(pointer actor-group)"] ], "wstd-fight-plat-large-init-by-other": [ [[169, 193], "s3", "wstd-fight-plat-smlplat"] @@ -8195,7 +8299,12 @@ ], "(event active wstd-fight-plat)": [[4, "v1", "float"]], "(event active wstd-fight-plat-smlplat)": [[12, "v1", "float"]], - "(method 21 task-manager-arena-training)": [["_stack_", 16, "res-tag"]], + "(method 21 task-manager-arena-training)": [ + ["_stack_", 16, "res-tag"], + [63, "v0", "(pointer actor-group)"], + [49, "v0", "(pointer actor-group)"], + [50, "v0", "(pointer actor-group)"] + ], "(anon-function 3 arena-scenes)": [[6, "v1", "process-drawable"]], "(anon-function 6 arena-scenes)": [ [13, "t9", "(function mood-context none)"] @@ -8293,7 +8402,10 @@ [10, "v0", "(array collide-shape)"], [309, "a1", "skeet"] ], - "(method 33 task-manager-wascity-gungame)": [["_stack_", 16, "res-tag"]], + "(method 33 task-manager-wascity-gungame)": [ + ["_stack_", 16, "res-tag"], + [22, "v0", "(pointer actor-group)"] + ], "city-sound-expand-want-list": [[63, "s4", "int"]], "(method 10 xz-height-map)": [[121, "s0", "pointer"]], "(method 9 xz-height-map)": [ @@ -8395,7 +8507,8 @@ [67, "a0", "entity-actor"], [45, "a0", "entity-actor"], [49, "a0", "entity-actor"], - ["_stack_", 16, "res-tag"] + ["_stack_", 16, "res-tag"], + [17, "v0", "(pointer actor-group)"] ], "(method 26 task-manager-wascity-leaper-race)": [ [75, "v1", "process-drawable"] @@ -8405,7 +8518,10 @@ [21, "v0", "int"] ], "(post jump flut-racer)": [[6, "t9", "(function none)"]], - "(method 33 task-manager-desert-glide)": [["_stack_", 16, "res-tag"]], + "(method 33 task-manager-desert-glide)": [ + ["_stack_", 16, "res-tag"], + [17, "v0", "(pointer actor-group)"] + ], "(code idle kleever-catch-lizards)": [[10, "v1", "art-joint-anim"]], "(code active task-manager-desert-catch-lizards)": [ [858, "gp", "handle"], @@ -8420,7 +8536,8 @@ ], "(method 26 task-manager-desert-catch-lizards)": [ [275, "v0", "(array collide-shape)"], - ["_stack_", 192, "res-tag"] + ["_stack_", 192, "res-tag"], + [165, "v0", "(pointer actor-group)"] ], "(method 82 desert-lizard)": [[96, "v0", "vector"]], "(code notice desert-lizard)": [[31, "v1", "art-joint-anim"]], @@ -8492,7 +8609,10 @@ ], "(event idle terraformer-target)": [[53, "a0", "process"]], "terraformer-mine-explode": [[50, "a0", "process-drawable"]], - "(method 11 terraformer-head)": [["_stack_", 16, "res-tag"]], + "(method 11 terraformer-head)": [ + ["_stack_", 16, "res-tag"], + [1314, "v0", "(pointer actor-group)"] + ], "joint-mod-disc-look-at-callback": [ [[3, 46], "s4", "joint-mod-disc-look-at"] ], @@ -8716,7 +8836,10 @@ "(trans active task-manager-bbush-egg-spider)": [[18, "v1", "int"]], "(code resolution task-manager-bbush-spirit-chase)": [[40, "gp", "handle"]], "(method 36 task-manager-bbush-spirit-drop)": [[23, "s4", "spirit"]], - "(method 21 task-manager-bbush-spirit-drop)": [["_stack_", 16, "res-tag"]], + "(method 21 task-manager-bbush-spirit-drop)": [ + ["_stack_", 16, "res-tag"], + [136, "v0", "(pointer actor-group)"] + ], "(trans idle des-burning-bush)": [ [179, "v1", "vehicle"], [151, "a1", "int"] @@ -8752,10 +8875,22 @@ [37, "v1", "process-focusable"], [[83, 134], "v1", "vehicle"] ], - "(method 21 task-manager-bbush-timer-chase)": [["_stack_", 96, "res-tag"]], - "(method 21 task-manager-bbush-egg-spider)": [["_stack_", 16, "res-tag"]], - "(method 21 task-manager-bbush-spirit-chase)": [["_stack_", 16, "res-tag"]], - "(method 21 task-manager-desert-bbush-ring)": [["_stack_", 16, "res-tag"]], + "(method 21 task-manager-bbush-timer-chase)": [ + ["_stack_", 96, "res-tag"], + [231, "v0", "(pointer actor-group)"] + ], + "(method 21 task-manager-bbush-egg-spider)": [ + ["_stack_", 16, "res-tag"], + [124, "v0", "(pointer actor-group)"] + ], + "(method 21 task-manager-bbush-spirit-chase)": [ + ["_stack_", 16, "res-tag"], + [144, "v0", "(pointer actor-group)"] + ], + "(method 21 task-manager-desert-bbush-ring)": [ + ["_stack_", 16, "res-tag"], + [51, "v0", "(pointer actor-group)"] + ], "(code attack needle-fish)": [ [14, "v1", "art-joint-anim"], [66, "v1", "art-joint-anim"] @@ -8816,7 +8951,10 @@ [[13, 21], "a1", "vector"], [[27, 35], "a0", "vector"] ], - "(method 32 task-manager-mh-centipede)": [["_stack_", 16, "res-tag"]], + "(method 32 task-manager-mh-centipede)": [ + ["_stack_", 16, "res-tag"], + [18, "v0", "(pointer actor-group)"] + ], "(method 59 mh-bat)": [[[26, 43], "s5", "process-focusable"]], "(method 126 mh-bat)": [[[20, 24], "v1", "ragdoll-proc"]], "(method 50 mh-bat)": [ @@ -8862,7 +9000,8 @@ "(method 24 factory-conveyor)": [ [40, "v0", "float"], [39, "t0", "float"], - ["_stack_", 16, "res-tag"] + ["_stack_", 16, "res-tag"], + [20, "v0", "(pointer float)"] ], "(enter perish-immediately)": [ [13, "v1", "art-joint-anim"], @@ -10205,7 +10344,9 @@ ], "(method 30 boat-base)": [ [280, "v1", "boat-manager"], - [330, "v1", "boat-manager"] + [330, "v1", "boat-manager"], + [274, "v1", "boat-manager"], + [324, "v1", "boat-manager"] ], "(method 35 htorpedo)": [[[96, 107], "s3", "particle-local-space-info"]], "(method 17 light-trail-tracker-torpedo)": [[1, "v1", "htorpedo"]], @@ -10436,14 +10577,18 @@ "(enter fail cty-hijack-manager)": [ [7, "v0", "(state resetter-params cty-hijack-manager)"] ], - "(method 20 ctyport-attack-manager-bbush)": [["_stack_", 96, "res-tag"]], + "(method 20 ctyport-attack-manager-bbush)": [ + ["_stack_", 96, "res-tag"], + [179, "v0", "(pointer actor-group)"] + ], "(code idle farm-sprinkler-barrels)": [[10, "v1", "art-joint-anim"]], "(code explode com-power-box)": [ [77, "v1", "collide-shape-prim-group"], [116, "a0", "process"] ], "(enter active task-manager-city-destroy-grid)": [ - ["_stack_", 272, "res-tag"] + ["_stack_", 272, "res-tag"], + [177, "v0", "(pointer actor-group)"] ], "(code wait task-manager-city-destroy-grid)": [[40, "t9", "(function none)"]], "(code die jinx)": [[37, "v1", "art-joint-anim"]], @@ -10505,7 +10650,8 @@ "check-onintent-bugs": [[[31, 49], "s3", "sprite-vec-data-2d"]], "(method 11 cty-sniper-battery)": [ [185, "v1", "art-joint-anim"], - ["_stack_", 16, "res-tag"] + ["_stack_", 16, "res-tag"], + [149, "v0", "(pointer actor-group)"] ], "cty-sniper-battery-handler": [ [11, "v1", "vector"], @@ -10558,7 +10704,10 @@ [[439, 448], "s5", "cspace"], [17, "v1", "float"] ], - "(method 26 task-manager-city-sniper-fight)": [["_stack_", 16, "res-tag"]], + "(method 26 task-manager-city-sniper-fight)": [ + ["_stack_", 16, "res-tag"], + [18, "v0", "(pointer actor-group)"] + ], "(code active task-manager-city-sniper-fight)": [ [80, "a1", "process-drawable"] ], @@ -10604,7 +10753,10 @@ "(code fallen rub-tower)": [[18, "v1", "art-joint-anim"]], "(code fall rub-tower)": [[33, "v1", "art-joint-anim"]], "(code unstable rub-tower)": [[20, "v1", "art-joint-anim"]], - "(method 11 rub-elec-gate)": [["_stack_", 16, "res-tag"]], + "(method 11 rub-elec-gate)": [ + ["_stack_", 16, "res-tag"], + [110, "v0", "(pointer actor-group)"] + ], "birth-func-power-score": [ [2, "v1", "(pointer int32)"], [4, "v1", "(pointer int32)"], @@ -10658,8 +10810,14 @@ "update-mood-hiphog": [[[26, 74], "s5", "hiphog-states"]], "update-mood-vinroom": [[[24, 141], "gp", "vinroom-states"]], "update-mood-oracle": [[[19, 135], "s5", "oracle-states"]], - "(method 21 gungame-manager)": [["_stack_", 16, "res-tag"]], - "(method 35 gungame-task-manager)": [["_stack_", 16, "res-tag"]], + "(method 21 gungame-manager)": [ + ["_stack_", 16, "res-tag"], + [12, "v0", "(pointer actor-group)"] + ], + "(method 35 gungame-task-manager)": [ + ["_stack_", 16, "res-tag"], + [12, "v0", "(pointer actor-group)"] + ], "(method 23 gungame-manager)": [[[16, 396], "gp", "hud"]], "(method 24 gungame-manager)": [[[23, 35], "a1", "training-path"]], "(method 25 gungame-manager)": [[12, "a0", "training-path"]], @@ -11077,9 +11235,18 @@ [61, "gp", "collide-shape-prim-group"] ], "(code dormant precur-laser-beam)": [["_stack_", 16, "res-tag"]], - "(method 11 precur-generator-c)": [["_stack_", 16, "res-tag"]], - "(method 11 precur-generator-d)": [["_stack_", 16, "res-tag"]], - "(method 11 precur-bridge-path-break)": [["_stack_", 16, "res-tag"]], + "(method 11 precur-generator-c)": [ + ["_stack_", 16, "res-tag"], + [119, "v0", "(pointer actor-group)"] + ], + "(method 11 precur-generator-d)": [ + ["_stack_", 16, "res-tag"], + [116, "v0", "(pointer actor-group)"] + ], + "(method 11 precur-bridge-path-break)": [ + ["_stack_", 16, "res-tag"], + [55, "v0", "(pointer actor-group)"] + ], "(method 11 precura-door-a)": [ [141, "v0", "pair"], [129, "v0", "pair"] @@ -11314,7 +11481,10 @@ [[174, 177], "v1", "dma-gif-packet"], [[186, 202], "a0", "(inline-array vector4w)"] ], - "draw-raw-image": [[[104, 154], "v1", "(inline-array vector4w)"]], + "draw-raw-image": [ + [[104, 154], "v1", "(inline-array vector4w)"], + [[195, 198], "v1", "dma-packet"] + ], "draw-color-bars": [ [[11, 16], "v1", "dma-gif-packet"], [[28, 54], "v1", "(inline-array vector4w)"] @@ -11744,5 +11914,6 @@ [6, "a0", "timer-bank"], [24, "a0", "timer-bank"], [1, "v1", "timer-bank"] - ] + ], + "(method 11 blow-tower-path-cursor)": [["_stack_", 52, "float"]] } diff --git a/goal_src/jak1/build/all_objs.json b/goal_src/jak1/build/all_objs.json index d9aff08b79..83b86d6ca1 100644 --- a/goal_src/jak1/build/all_objs.json +++ b/goal_src/jak1/build/all_objs.json @@ -232,7 +232,7 @@ ["cam-layout", "cam-layout", 3, ["GAME", "ENGINE"], "engine/camera"], ["cam-debug", "cam-debug", 3, ["GAME", "ENGINE"], "engine/camera"], ["cam-start", "cam-start", 3, ["GAME", "ENGINE"], "engine/camera"], -["process-drawable", "process-drawable", 3, ["GAME", "ENGINE"], "engine/draw"], +["process-drawable", "process-drawable", 3, ["GAME", "ENGINE"], "engine/common-obs"], ["hint-control", "hint-control", 3, ["GAME", "ENGINE"], "engine/game/task"], ["ambient", "ambient", 3, ["GAME", "ENGINE"], "engine/entity"], ["assert", "assert", 3, ["GAME", "ENGINE"], "engine/debug"], @@ -288,7 +288,7 @@ ["ocean-transition", "ocean-transition", 3, ["GAME", "ENGINE"], "engine/gfx/ocean"], ["ocean-near", "ocean-near", 3, ["GAME", "ENGINE"], "engine/gfx/ocean"], ["shadow", "shadow", 3, ["GAME", "ENGINE"], "engine/gfx/shadow"], -["eye", "eye", 3, ["GAME", "ENGINE"], "engine/gfx"], +["eye", "eye", 3, ["GAME", "ENGINE"], "engine/gfx/foreground"], ["glist-h", "glist-h", 3, ["GAME", "ENGINE"], "engine/util"], ["glist", "glist", 3, ["GAME", "ENGINE"], "engine/util"], ["anim-tester", "anim-tester", 3, ["GAME", "ENGINE"], "engine/debug"], diff --git a/goal_src/jak1/engine/anim/joint-exploder.gc b/goal_src/jak1/engine/anim/joint-exploder.gc index eb3c24d011..fd3583e995 100644 --- a/goal_src/jak1/engine/anim/joint-exploder.gc +++ b/goal_src/jak1/engine/anim/joint-exploder.gc @@ -151,7 +151,6 @@ (none)) (defmethod joint-exploder-method-27 ((this joint-exploder) (arg0 joint-exploder-list) (arg1 int)) - (local-vars (sv-16 int) (sv-32 int) (sv-48 int)) (let ((s4-0 (the-as joint-exploder-list #f))) (let ((v1-0 1)) (until (= v1-0 5) @@ -174,9 +173,9 @@ (let ((s0-0 (-> s2-0 joint s1-0))) (cond ((>= (-> s0-0 mat vector 3 x) f30-0) - (set! sv-16 (joint-exploder-method-26 this arg0 s1-0)) - (joint-exploder-method-20 this (the-as joint-exploder-list s3-0) s1-0) - (set! s1-0 sv-16) + (let ((sv-16 (joint-exploder-method-26 this arg0 s1-0))) + (joint-exploder-method-20 this (the-as joint-exploder-list s3-0) s1-0) + (set! s1-0 sv-16)) (joint-exploder-method-21 this (the-as joint-exploder-list s3-0) s0-0)) (else (joint-exploder-method-21 this arg0 s0-0) (set! s1-0 (-> s0-0 next)))))))) ((= arg1 1) @@ -185,9 +184,9 @@ (let ((s0-1 (-> s2-0 joint s1-0))) (cond ((>= (-> s0-1 mat vector 3 y) f30-1) - (set! sv-32 (joint-exploder-method-26 this arg0 s1-0)) - (joint-exploder-method-20 this (the-as joint-exploder-list s3-0) s1-0) - (set! s1-0 sv-32) + (let ((sv-32 (joint-exploder-method-26 this arg0 s1-0))) + (joint-exploder-method-20 this (the-as joint-exploder-list s3-0) s1-0) + (set! s1-0 sv-32)) (joint-exploder-method-21 this (the-as joint-exploder-list s3-0) s0-1)) (else (joint-exploder-method-21 this arg0 s0-1) (set! s1-0 (-> s0-1 next)))))))) ((= arg1 2) @@ -196,9 +195,9 @@ (let ((s0-2 (-> s2-0 joint s1-0))) (cond ((>= (-> s0-2 mat vector 3 z) f30-2) - (set! sv-48 (joint-exploder-method-26 this arg0 s1-0)) - (joint-exploder-method-20 this (the-as joint-exploder-list s3-0) s1-0) - (set! s1-0 sv-48) + (let ((sv-48 (joint-exploder-method-26 this arg0 s1-0))) + (joint-exploder-method-20 this (the-as joint-exploder-list s3-0) s1-0) + (set! s1-0 sv-48)) (joint-exploder-method-21 this (the-as joint-exploder-list s3-0) s0-2)) (else (joint-exploder-method-21 this arg0 s0-2) (set! s1-0 (-> s0-2 next))))))))))) s4-0)) diff --git a/goal_src/jak1/engine/anim/joint-mod-h.gc b/goal_src/jak1/engine/anim/joint-mod-h.gc index 59e6237e64..2bf17a9e6a 100644 --- a/goal_src/jak1/engine/anim/joint-mod-h.gc +++ b/goal_src/jak1/engine/anim/joint-mod-h.gc @@ -11,8 +11,6 @@ (require "engine/anim/mspace-h.gc") (require "engine/game/game-h.gc") -;; DECOMP BEGINS - ;; The joint-mod system allows an animated character to change in a way that's not described in ;; an animation. For example, this is used to point Jak's head toward an attacking enemy. @@ -40,6 +38,8 @@ (reset 7) ;; 128 ) +;; DECOMP BEGINS + ;; The joint-mod itself represents a modification to a single joint. ;; Although the mode is a bitfield, it appears that multiple kinds of mods cannot be ;; activated at the same time. @@ -230,37 +230,34 @@ (defun joint-mod-look-at-handler ((csp cspace) (xform transformq)) "Update bone transforms for look-at" - (local-vars (sv-48 vector) (sv-52 vector) (sv-56 vector)) (let ((gp-0 (the-as joint-mod (-> csp param1)))) (cspace<-parented-transformq-joint! csp xform) - (set! sv-48 - (vector-normalize-copy! (new 'stack-no-clear 'vector) (-> gp-0 process node-list data 0 bone transform vector 1) 1.0)) - (set! sv-52 (vector-normalize! (-> csp bone transform vector (-> gp-0 nose)) 1.0)) - (set! sv-56 - (vector-normalize! (vector-! (new 'stack-no-clear 'vector) (-> gp-0 target) (-> csp bone transform vector 3)) 1.0)) - (let* ((f30-0 (vector-y-angle sv-52)) - (a0-9 (vector-flatten! (new-stack-vector0) sv-56 sv-48)) - (f0-0 (vector-y-angle a0-9)) - (f0-1 (deg-diff f30-0 f0-0))) - (if (< (-> gp-0 ignore-angle) (fabs f0-1)) (set! f0-1 0.0)) - (let ((f30-1 (fmax (fmin (* f0-1 (-> gp-0 blend) (-> gp-0 flex-blend)) (-> gp-0 twist-max y)) (- (-> gp-0 twist-max y))))) - (if (and (-> gp-0 shutting-down?) (= (-> gp-0 twist y) f30-1)) (set-mode! gp-0 (joint-mod-handler-mode reset))) - (set! (-> gp-0 twist y) (deg-seek (-> gp-0 twist y) f30-1 (* 0.1 (fabs (deg-diff f30-1 (-> gp-0 twist y)))))))) - (let ((v1-15 (-> gp-0 up))) - (cond - ((zero? v1-15) (quaternion-rotate-x! (-> xform quat) (-> xform quat) (-> gp-0 twist y))) - ((= v1-15 1) (quaternion-rotate-local-y! (-> xform quat) (-> xform quat) (-> gp-0 twist y))) - (else (quaternion-rotate-z! (-> xform quat) (-> xform quat) (-> gp-0 twist y))))) - (let* ((s3-1 (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)) - (s3-2 (vector-flatten! (new-stack-vector0) sv-56 s3-1)) - (f0-15 (vector-x-angle s3-2)) - (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 s3-2 sv-52) 0.1) (set! f0-21 0.0)) - (set! (-> gp-0 twist x) (deg-seek (-> gp-0 twist x) f0-21 (* 0.1 (fabs (deg-diff f0-21 (-> gp-0 twist x))))))) + (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! (-> csp bone transform vector (-> gp-0 nose)) 1.0)) + (sv-56 (vector-normalize! (vector-! (new 'stack-no-clear 'vector) (-> gp-0 target) (-> csp bone transform vector 3)) 1.0))) + (let* ((f30-0 (vector-y-angle sv-52)) + (a0-9 (vector-flatten! (new-stack-vector0) sv-56 sv-48)) + (f0-0 (vector-y-angle a0-9)) + (f0-1 (deg-diff f30-0 f0-0))) + (if (< (-> gp-0 ignore-angle) (fabs f0-1)) (set! f0-1 0.0)) + (let ((f30-1 (fmax (fmin (* f0-1 (-> gp-0 blend) (-> gp-0 flex-blend)) (-> gp-0 twist-max y)) (- (-> gp-0 twist-max y))))) + (if (and (-> gp-0 shutting-down?) (= (-> gp-0 twist y) f30-1)) (set-mode! gp-0 (joint-mod-handler-mode reset))) + (set! (-> gp-0 twist y) (deg-seek (-> gp-0 twist y) f30-1 (* 0.1 (fabs (deg-diff f30-1 (-> gp-0 twist y)))))))) + (let ((v1-15 (-> gp-0 up))) + (cond + ((zero? v1-15) (quaternion-rotate-x! (-> xform quat) (-> xform quat) (-> gp-0 twist y))) + ((= v1-15 1) (quaternion-rotate-local-y! (-> xform quat) (-> xform quat) (-> gp-0 twist y))) + (else (quaternion-rotate-z! (-> xform quat) (-> xform quat) (-> gp-0 twist y))))) + (let* ((s3-1 (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)) + (s3-2 (vector-flatten! (new-stack-vector0) sv-56 s3-1)) + (f0-15 (vector-x-angle s3-2)) + (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 s3-2 sv-52) 0.1) (set! f0-21 0.0)) + (set! (-> gp-0 twist x) (deg-seek (-> gp-0 twist x) f0-21 (* 0.1 (fabs (deg-diff f0-21 (-> gp-0 twist x)))))))) (let ((v1-27 (-> gp-0 ear))) (cond ((zero? v1-27) (quaternion-rotate-x! (-> xform quat) (-> xform quat) (-> gp-0 twist x))) @@ -278,36 +275,34 @@ (none)) (defun joint-mod-world-look-at-handler ((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)) - (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 vector 3)) 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))))) - (set! (-> gp-0 twist y) (deg-seek (-> gp-0 twist y) f0-5 (fmax 1.0 (* 0.1 (fabs (deg-diff f0-5 (-> gp-0 twist y))))))))) - (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 vector 3 quad))) - (matrix*! s5-0 s5-0 a2-3) - (set! (-> s5-0 vector 3 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-14 (vector-x-angle s4-4)) - (f0-20 (fmax (fmin (* (- (deg-diff f30-2 f0-14)) (-> 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-20 0.0)) - (set! (-> gp-0 twist x) (deg-seek (-> gp-0 twist x) f0-20 (fmax 1.0 (* 0.1 (fabs (deg-diff f0-20 (-> gp-0 twist x)))))))) + (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 vector 3)) 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))))) + (set! (-> gp-0 twist y) (deg-seek (-> gp-0 twist y) f0-5 (fmax 1.0 (* 0.1 (fabs (deg-diff f0-5 (-> gp-0 twist y))))))))) + (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 vector 3 quad))) + (matrix*! s5-0 s5-0 a2-3) + (set! (-> s5-0 vector 3 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-14 (vector-x-angle s4-4)) + (f0-20 (fmax (fmin (* (- (deg-diff f30-2 f0-14)) (-> 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-20 0.0)) + (set! (-> gp-0 twist x) (deg-seek (-> gp-0 twist x) f0-20 (fmax 1.0 (* 0.1 (fabs (deg-diff f0-20 (-> gp-0 twist x))))))))) (when (!= (-> gp-0 twist x) 0.0) (let* ((v1-20 (-> gp-0 ear)) (a1-17 ((cond @@ -506,10 +501,7 @@ (let ((gp-0 (the-as joint-mod-blend-local (-> arg0 param1)))) (cond ((-> gp-0 enable) - (vector-lerp! (the-as vector (-> gp-0 blend-transform)) - (-> arg1 trans) - (the-as vector (-> gp-0 transform)) - (-> gp-0 blend)) + (vector-lerp! (-> gp-0 blend-transform trans) (-> arg1 trans) (-> gp-0 transform trans) (-> gp-0 blend)) (vector-lerp! (-> gp-0 blend-transform scale) (-> arg1 scale) (-> gp-0 transform scale) (-> gp-0 blend)) (quaternion-slerp! (-> gp-0 blend-transform quat) (-> arg1 quat) (-> gp-0 transform quat) (-> gp-0 blend)) (cspace<-parented-transformq-joint! arg0 (-> gp-0 blend-transform))) diff --git a/goal_src/jak1/engine/anim/joint.gc b/goal_src/jak1/engine/anim/joint.gc index 232cdf71dc..5b063be2b4 100644 --- a/goal_src/jak1/engine/anim/joint.gc +++ b/goal_src/jak1/engine/anim/joint.gc @@ -396,11 +396,11 @@ (format #t "#<~A ~S ~D @ #x~X>" (-> this type) (-> this name) (-> this number) this) this) -(defmethod mem-usage ((this joint) (arg0 memory-usage-block) (arg1 int)) - (set! (-> arg0 length) (max 66 (-> arg0 length))) - (set! (-> arg0 data 65 name) "joint") - (+! (-> arg0 data 65 count) 1) - (let ((v1-6 (asize-of this))) (+! (-> arg0 data 65 used) v1-6) (+! (-> arg0 data 65 total) (logand -16 (+ v1-6 15)))) +(defmethod mem-usage ((this joint) (usage memory-usage-block) (flags int)) + (set! (-> usage length) (max 66 (-> usage length))) + (set! (-> usage data 65 name) "joint") + (+! (-> usage data 65 count) 1) + (let ((v1-6 (asize-of this))) (+! (-> usage data 65 used) v1-6) (+! (-> usage data 65 total) (logand -16 (+ v1-6 15)))) this) (defmethod print ((this joint-anim)) @@ -448,13 +448,13 @@ ((joint-anim-transformq) (format #t "~`transform`P~%" (-> (the-as joint-anim-transformq arg0) data (the int arg1))))) arg0) -(defmethod mem-usage ((this joint-anim-drawable) (arg0 memory-usage-block) (arg1 int)) - (set! (-> arg0 length) (max 77 (-> arg0 length))) - (set! (-> arg0 data 76 name) "joint-anim-drawable") - (+! (-> arg0 data 76 count) 1) - (let ((v1-6 (asize-of this))) (+! (-> arg0 data 76 used) v1-6) (+! (-> arg0 data 76 total) (logand -16 (+ v1-6 15)))) +(defmethod mem-usage ((this joint-anim-drawable) (usage memory-usage-block) (flags int)) + (set! (-> usage length) (max 77 (-> usage length))) + (set! (-> usage data 76 name) "joint-anim-drawable") + (+! (-> usage data 76 count) 1) + (let ((v1-6 (asize-of this))) (+! (-> usage data 76 used) v1-6) (+! (-> usage data 76 total) (logand -16 (+ v1-6 15)))) (dotimes (s3-0 (-> this length)) - (mem-usage (-> this data s3-0) arg0 arg1)) + (mem-usage (-> this data s3-0) usage flags)) this) (defun jacc-mem-usage ((arg0 joint-anim-compressed-control) (arg1 memory-usage-block) (arg2 int)) @@ -570,37 +570,37 @@ (set! (-> this extra tag) (&+ (the-as (pointer res-tag) (-> this extra)) 28))) this) -(defmethod mem-usage ((this art-mesh-anim) (arg0 memory-usage-block) (arg1 int)) - (set! (-> arg0 length) (max 72 (-> arg0 length))) - (set! (-> arg0 data 71 name) "art-mesh-anim") - (+! (-> arg0 data 71 count) 1) - (let ((v1-6 (asize-of this))) (+! (-> arg0 data 71 used) v1-6) (+! (-> arg0 data 71 total) (logand -16 (+ v1-6 15)))) - (if (-> this extra) (mem-usage (-> this extra) arg0 (logior arg1 512))) +(defmethod mem-usage ((this art-mesh-anim) (usage memory-usage-block) (flags int)) + (set! (-> usage length) (max 72 (-> usage length))) + (set! (-> usage data 71 name) "art-mesh-anim") + (+! (-> usage data 71 count) 1) + (let ((v1-6 (asize-of this))) (+! (-> usage data 71 used) v1-6) (+! (-> usage data 71 total) (logand -16 (+ v1-6 15)))) + (if (-> this extra) (mem-usage (-> this extra) usage (logior flags 512))) (dotimes (s3-0 (-> this length)) - (mem-usage (-> this data s3-0) arg0 arg1)) + (mem-usage (-> this data s3-0) usage flags)) this) -(defmethod mem-usage ((this art-joint-anim) (arg0 memory-usage-block) (arg1 int)) - (set! (-> arg0 length) (max 75 (-> arg0 length))) - (set! (-> arg0 data 74 name) "art-joint-anim") - (+! (-> arg0 data 74 count) 1) - (let ((v1-6 (asize-of this))) (+! (-> arg0 data 74 used) v1-6) (+! (-> arg0 data 74 total) (logand -16 (+ v1-6 15)))) - (if (-> this extra) (mem-usage (-> this extra) arg0 (logior arg1 512))) - (jacc-mem-usage (-> this frames) arg0 arg1) +(defmethod mem-usage ((this art-joint-anim) (usage memory-usage-block) (flags int)) + (set! (-> usage length) (max 75 (-> usage length))) + (set! (-> usage data 74 name) "art-joint-anim") + (+! (-> usage data 74 count) 1) + (let ((v1-6 (asize-of this))) (+! (-> usage data 74 used) v1-6) (+! (-> usage data 74 total) (logand -16 (+ v1-6 15)))) + (if (-> this extra) (mem-usage (-> this extra) usage (logior flags 512))) + (jacc-mem-usage (-> this frames) usage flags) (dotimes (s4-1 (-> this length)) - (set! (-> arg0 length) (max 67 (-> arg0 length))) - (set! (-> arg0 data 66 name) "joint-anim-compressed") - (+! (-> arg0 data 66 count) 1) + (set! (-> usage length) (max 67 (-> usage length))) + (set! (-> usage data 66 name) "joint-anim-compressed") + (+! (-> usage data 66 count) 1) (let ((v1-22 (asize-of (-> this data s4-1)))) - (+! (-> arg0 data 66 used) v1-22) - (+! (-> arg0 data 66 total) (logand -16 (+ v1-22 15))))) + (+! (-> usage data 66 used) v1-22) + (+! (-> usage data 66 total) (logand -16 (+ v1-22 15))))) (when (and (nonzero? (-> this eye-anim-data)) (-> this eye-anim-data)) - (set! (-> arg0 length) (max 109 (-> arg0 length))) - (set! (-> arg0 data 108 name) "eye-anim") - (+! (-> arg0 data 108 count) 1) + (set! (-> usage length) (max 109 (-> usage length))) + (set! (-> usage data 108 name) "eye-anim") + (+! (-> usage data 108 count) 1) (let ((v1-41 (* (* (+ (-> this eye-anim-data max-frame) 1) 2) 8))) - (+! (-> arg0 data 108 used) v1-41) - (+! (-> arg0 data 108 total) (logand -16 (+ v1-41 15))))) + (+! (-> usage data 108 used) v1-41) + (+! (-> usage data 108 total) (logand -16 (+ v1-41 15))))) this) (defmethod asize-of ((this art-joint-anim)) @@ -670,20 +670,20 @@ (if (-> this data s5-0) (set! (-> this data s5-0) (login (-> this data s5-0))))) this) -(defmethod mem-usage ((this art-group) (arg0 memory-usage-block) (arg1 int)) - (set! (-> arg0 length) (max 71 (-> arg0 length))) - (set! (-> arg0 data 70 name) "art-group") - (+! (-> arg0 data 70 count) 1) - (let ((v1-6 (asize-of this))) (+! (-> arg0 data 70 used) v1-6) (+! (-> arg0 data 70 total) (logand -16 (+ v1-6 15)))) - (if (-> this extra) (mem-usage (-> this extra) arg0 (logior arg1 512))) +(defmethod mem-usage ((this art-group) (usage memory-usage-block) (flags int)) + (set! (-> usage length) (max 71 (-> usage length))) + (set! (-> usage data 70 name) "art-group") + (+! (-> usage data 70 count) 1) + (let ((v1-6 (asize-of this))) (+! (-> usage data 70 used) v1-6) (+! (-> usage data 70 total) (logand -16 (+ v1-6 15)))) + (if (-> this extra) (mem-usage (-> this extra) usage (logior flags 512))) (dotimes (s3-0 (-> this length)) - (if (-> this data s3-0) (mem-usage (-> this data s3-0) arg0 arg1))) + (if (-> this data s3-0) (mem-usage (-> this data s3-0) usage flags))) this) -(defmethod relocate ((this art-group) (arg0 kheap) (arg1 (pointer uint8))) +(defmethod relocate ((this art-group) (heap kheap) (name (pointer uint8))) "Handle a loaded art-group." (let ((s4-0 (clear *temp-string*))) - (string<-charp s4-0 arg1) + (string<-charp s4-0 name) (set! this (cond ((not this) (format 0 "ERROR: art-group ~A is not a valid file.~%" s4-0) (the-as art-group #f)) @@ -693,26 +693,22 @@ ((not (file-info-correct-version? (-> this info) (file-kind art-group) 0)) (the-as art-group #f)) (else (let ((s5-1 (-> *level* loading-level))) - (if (or (not s5-1) (= (-> s5-1 name) 'default)) - (login this) ;; not part of level load, just normal login. - ) - (if s5-1 - (set-loaded-art (-> s5-1 art-group) this) ;; part of level load, add to level's ag, but don't log in yet. - )) + (if (or (not s5-1) (= (-> s5-1 name) 'default)) (login this)) ;; not part of level load, just normal login. + (if s5-1 (set-loaded-art (-> s5-1 art-group) this))) ;; part of level load, add to level's ag, but don't log in yet. this)))) (none)) (defmethod asize-of ((this art-mesh-geo)) (the-as int (+ (-> art size) (* (-> this length) 4)))) -(defmethod mem-usage ((this art-mesh-geo) (arg0 memory-usage-block) (arg1 int)) - (set! (-> arg0 length) (max 73 (-> arg0 length))) - (set! (-> arg0 data 72 name) "art-mesh-geo") - (+! (-> arg0 data 72 count) 1) - (let ((v1-6 (asize-of this))) (+! (-> arg0 data 72 used) v1-6) (+! (-> arg0 data 72 total) (logand -16 (+ v1-6 15)))) - (if (-> this extra) (mem-usage (-> this extra) arg0 (logior arg1 512))) +(defmethod mem-usage ((this art-mesh-geo) (usage memory-usage-block) (flags int)) + (set! (-> usage length) (max 73 (-> usage length))) + (set! (-> usage data 72 name) "art-mesh-geo") + (+! (-> usage data 72 count) 1) + (let ((v1-6 (asize-of this))) (+! (-> usage data 72 used) v1-6) (+! (-> usage data 72 total) (logand -16 (+ v1-6 15)))) + (if (-> this extra) (mem-usage (-> this extra) usage (logior flags 512))) (dotimes (s3-0 (-> this length)) - (mem-usage (-> this data s3-0) arg0 arg1)) + (mem-usage (-> this data s3-0) usage flags)) this) (defmethod login ((this art-joint-anim)) @@ -742,14 +738,14 @@ (the-as int #f)) (else (dotimes (s4-1 (-> this length)) (if (name= arg0 (-> this data s4-1 name)) (return s4-1))) (the-as int #f)))) -(defmethod mem-usage ((this art-joint-geo) (arg0 memory-usage-block) (arg1 int)) - (set! (-> arg0 length) (max 74 (-> arg0 length))) - (set! (-> arg0 data 73 name) "art-joint-geo") - (+! (-> arg0 data 73 count) 1) - (let ((v1-6 (asize-of this))) (+! (-> arg0 data 73 used) v1-6) (+! (-> arg0 data 73 total) (logand -16 (+ v1-6 15)))) - (if (-> this extra) (mem-usage (-> this extra) arg0 (logior arg1 512))) +(defmethod mem-usage ((this art-joint-geo) (usage memory-usage-block) (flags int)) + (set! (-> usage length) (max 74 (-> usage length))) + (set! (-> usage data 73 name) "art-joint-geo") + (+! (-> usage data 73 count) 1) + (let ((v1-6 (asize-of this))) (+! (-> usage data 73 used) v1-6) (+! (-> usage data 73 total) (logand -16 (+ v1-6 15)))) + (if (-> this extra) (mem-usage (-> this extra) usage (logior flags 512))) (dotimes (s3-0 (-> this length)) - (mem-usage (-> this data s3-0) arg0 arg1)) + (mem-usage (-> this data s3-0) usage flags)) this) ;;;;;;;;;;;;;;;;;;;;;;;;;;; @@ -806,44 +802,30 @@ ;; ERROR: Failed load: (set! v1-29 (l.wu (+ a0-9 -4))) at op 75 (defun joint-control-remap! ((arg0 joint-control) (arg1 art-group) (arg2 art-group) (arg3 pair) (arg4 int) (arg5 string)) - (local-vars - (sv-16 int) - (sv-24 symbol) - (sv-32 int) - (sv-40 int) - (sv-48 joint-control-channel) - (sv-52 object) - (sv-56 int) - (sv-64 joint) - (sv-80 string)) - (set! sv-16 (+ (length (-> arg2 name)) 1)) - (set! sv-24 #t) - (set! sv-32 arg4) - (set! sv-40 2) - (while (and (< sv-40 (-> arg1 length)) (!= (-> arg1 data sv-40 type) art-joint-anim)) - (set! sv-40 (+ sv-40 1))) - (dotimes (s2-1 (-> arg0 active-channels)) - (set! sv-48 (-> arg0 channel s2-1)) - (when (-> sv-48 frame-group) - (format (clear *temp-string*) "~S~G" arg5 (&+ (-> sv-48 frame-group name data) sv-16)) - (when (not (null? arg3)) - (set! sv-52 (nassoc *temp-string* arg3)) - (when sv-52 - (let ((s1-1 sv-32) - (a0-9 sv-52)) - (set! sv-56 (mod s1-1 (+ ((method-of-type (rtype-of a0-9) length) a0-9) -1)))) - (let ((s1-2 format) - (s0-0 (clear *temp-string*))) - (set! sv-80 "~S") - (let ((a2-2 (ref sv-52 (+ sv-56 1)))) (s1-2 s0-0 sv-80 a2-2))))) - (set! sv-64 (lookup-art arg1 *temp-string* art-joint-anim)) - (cond - (sv-64 (set! (-> sv-48 frame-group) (the-as art-joint-anim sv-64))) - (else - (set! (-> sv-48 frame-group) (the-as art-joint-anim (-> arg1 data sv-40))) - (set! (-> sv-48 frame-num) 0.0) - (set! sv-24 (the-as symbol #f)))))) - sv-24) + (let ((sv-16 (+ (length (-> arg2 name)) 1)) + (sv-24 #t)) + (let ((sv-32 arg4) + (sv-40 2)) + (while (and (< sv-40 (-> arg1 length)) (!= (-> arg1 data sv-40 type) art-joint-anim)) + (+! sv-40 1)) + (dotimes (s2-1 (-> arg0 active-channels)) + (let ((sv-48 (-> arg0 channel s2-1))) + (when (-> sv-48 frame-group) + (format (clear *temp-string*) "~S~G" arg5 (&+ (-> sv-48 frame-group name data) sv-16)) + (when (not (null? arg3)) + (let ((sv-52 (nassoc *temp-string* arg3))) + (when sv-52 + (let* ((a0-9 sv-52) + (sv-56 (mod sv-32 (+ ((method-of-type (rtype-of a0-9) length) a0-9) -1)))) + (format (clear *temp-string*) "~S" (ref sv-52 (+ sv-56 1))))))) + (let ((sv-64 (lookup-art arg1 *temp-string* art-joint-anim))) + (cond + (sv-64 (set! (-> sv-48 frame-group) (the-as art-joint-anim sv-64))) + (else + (set! (-> sv-48 frame-group) (the-as art-joint-anim (-> arg1 data sv-40))) + (set! (-> sv-48 frame-num) 0.0) + (set! sv-24 (the-as symbol #f))))))))) + sv-24)) (defun flatten-joint-control-to-spr ((arg0 joint-control)) "Take the current state of the given joint-control and upload it to the scratchpad diff --git a/goal_src/jak1/engine/camera/cam-combiner.gc b/goal_src/jak1/engine/camera/cam-combiner.gc index 8a9971c8a2..b5f7755643 100644 --- a/goal_src/jak1/engine/camera/cam-combiner.gc +++ b/goal_src/jak1/engine/camera/cam-combiner.gc @@ -96,7 +96,6 @@ (copy-cam-float-seeker (-> self tracking point-of-interest-blend) (-> gp-3 tracking point-of-interest-blend)))))))) :code (behavior () - (local-vars (sv-160 cam-rotation-tracker)) (loop (when (and (not (logtest? (-> *camera* master-options) 2)) (!= (-> self tracking-status) 0)) (set! (-> self tracking-status) (the-as uint 0)) @@ -129,8 +128,8 @@ (set! (-> a2-4 vector 2 quad) a1-6) (set! (-> a2-4 vector 3 quad) a3-3))) (else - (set! sv-160 (-> s5-0 0 tracking)) - (let ((s2-0 (-> s5-0 0 trans)) + (let ((sv-160 (-> s5-0 0 tracking)) + (s2-0 (-> s5-0 0 trans)) (s5-1 (-> s4-0 0 tracking)) (s0-0 (-> s4-0 0 trans))) (cond @@ -153,46 +152,46 @@ (let ((s4-1 (new-stack-vector0))) 0.0 (let ((s3-0 (new-stack-matrix0))) - (vector-! (the-as vector (-> s1-0 vector)) (the-as vector (-> sv-160 inv-mat)) (the-as vector (-> s5-1 inv-mat))) + (vector-! (-> s1-0 vector 0) (the-as vector (-> sv-160 inv-mat)) (the-as vector (-> s5-1 inv-mat))) (vector-! (-> s1-0 vector 1) (-> sv-160 inv-mat vector 1) (-> s5-1 inv-mat vector 1)) (vector-! (-> s1-0 vector 2) (-> sv-160 inv-mat vector 2) (-> s5-1 inv-mat vector 2)) - (let ((f26-0 (vector-length (the-as vector (-> s1-0 vector)))) + (let ((f26-0 (vector-length (-> s1-0 vector 0))) (f28-0 (vector-length (-> s1-0 vector 1))) (f0-13 (vector-length (-> s1-0 vector 2)))) (cond ((and (< f26-0 f28-0) (< f26-0 f0-13)) (vector-cross! s4-1 (-> s1-0 vector 1) (-> s1-0 vector 2))) - ((and (< f28-0 f26-0) (< f28-0 f0-13)) (vector-cross! s4-1 (the-as vector (-> s1-0 vector)) (-> s1-0 vector 2))) - (else (vector-cross! s4-1 (the-as vector (-> s1-0 vector)) (-> s1-0 vector 1))))) + ((and (< f28-0 f26-0) (< f28-0 f0-13)) (vector-cross! s4-1 (-> s1-0 vector 0) (-> s1-0 vector 2))) + (else (vector-cross! s4-1 (-> s1-0 vector 0) (-> s1-0 vector 1))))) (vector-normalize! s4-1 1.0) (let ((f0-16 (fabs (vector-dot (the-as vector (-> sv-160 inv-mat)) s4-1))) (f1-2 (fabs (vector-dot (-> sv-160 inv-mat vector 1) s4-1))) (f2-2 (fabs (vector-dot (-> sv-160 inv-mat vector 2) s4-1)))) (cond ((and (< f0-16 f1-2) (< f0-16 f2-2)) - (vector-flatten! (the-as vector (-> s1-0 vector)) (the-as vector (-> sv-160 inv-mat)) s4-1) + (vector-flatten! (-> s1-0 vector 0) (the-as vector (-> sv-160 inv-mat)) s4-1) (vector-flatten! (-> s1-0 vector 1) (the-as vector (-> s5-1 inv-mat)) s4-1)) ((< f1-2 f2-2) - (vector-flatten! (the-as vector (-> s1-0 vector)) (-> sv-160 inv-mat vector 1) s4-1) + (vector-flatten! (-> s1-0 vector 0) (-> sv-160 inv-mat vector 1) s4-1) (vector-flatten! (-> s1-0 vector 1) (-> s5-1 inv-mat vector 1) s4-1)) (else - (vector-flatten! (the-as vector (-> s1-0 vector)) (-> sv-160 inv-mat vector 2) s4-1) + (vector-flatten! (-> s1-0 vector 0) (-> sv-160 inv-mat vector 2) s4-1) (vector-flatten! (-> s1-0 vector 1) (-> s5-1 inv-mat vector 2) s4-1)))) - (vector-normalize! (the-as vector (-> s1-0 vector)) 1.0) + (vector-normalize! (-> s1-0 vector 0) 1.0) (vector-normalize! (-> s1-0 vector 1) 1.0) - (vector-cross! (-> s1-0 vector 2) (the-as vector (-> s1-0 vector)) (-> s1-0 vector 1)) + (vector-cross! (-> s1-0 vector 2) (-> s1-0 vector 0) (-> s1-0 vector 1)) (if (< (vector-dot (-> s1-0 vector 2) s4-1) 0.0) (vector-negate! s4-1 s4-1)) - (let ((f28-1 (acos (vector-dot (the-as vector (-> s1-0 vector)) (-> s1-0 vector 1))))) + (let ((f28-1 (acos (vector-dot (-> s1-0 vector 0) (-> s1-0 vector 1))))) (cond ((logtest? (-> *camera* master-options) 8) (logand! (-> *camera* master-options) -25) (when (and (< 8192.0 f28-1) (logtest? (-> *camera* master-options) 2)) - (vector-! (the-as vector (-> s1-0 vector)) (-> *camera* tpos-curr) s2-0) + (vector-! (-> s1-0 vector 0) (-> *camera* tpos-curr) s2-0) (vector-! (-> s1-0 vector 1) s0-0 s2-0) - (vector-flatten! (the-as vector (-> s1-0 vector)) (the-as vector (-> s1-0 vector)) (-> *camera* local-down)) + (vector-flatten! (-> s1-0 vector 0) (-> s1-0 vector 0) (-> *camera* local-down)) (vector-flatten! (-> s1-0 vector 1) (-> s1-0 vector 1) (-> *camera* local-down)) - (when (and (< 4096.0 (vector-normalize-ret-len! (the-as vector (-> s1-0 vector)) 1.0)) + (when (and (< 4096.0 (vector-normalize-ret-len! (-> s1-0 vector 0) 1.0)) (< 4096.0 (vector-normalize-ret-len! (-> s1-0 vector 1) 1.0))) - (vector-cross! (-> s1-0 vector 2) (-> s1-0 vector 1) (the-as vector (-> s1-0 vector))) + (vector-cross! (-> s1-0 vector 2) (-> s1-0 vector 1) (-> s1-0 vector 0)) (when (< (vector-dot (-> s1-0 vector 2) s4-1) -0.01))))) ((and (< 16384.0 f28-1) (< (vector-dot (-> self flip-control-axis) s4-1) 0.0)) (logxor! (-> *camera* master-options) 16))) @@ -201,7 +200,7 @@ (set! f28-1 (- 65536.0 f28-1)) (vector-negate! s4-1 s4-1)) (let ((f30-1 (* f28-1 (- 1.0 f30-0)))) (matrix-axis-sin-cos! s3-0 s4-1 (sin f30-1) (cos f30-1)))) - (matrix*! (-> self inv-camera-rot) (the-as matrix s5-1) s3-0))))))) + (matrix*! (-> self inv-camera-rot) (-> s5-1 inv-mat) s3-0))))))) (cond ((and (< 0.0 (-> *camera* outro-t-step)) (< (-> *camera* outro-t) (-> *camera* outro-exit-value)))) ((and (< (-> *camera* outro-t-step) 0.0) (< (-> *camera* outro-exit-value) (-> *camera* outro-t)))) diff --git a/goal_src/jak1/engine/camera/cam-layout.gc b/goal_src/jak1/engine/camera/cam-layout.gc index 5864c3476e..437754a08b 100644 --- a/goal_src/jak1/engine/camera/cam-layout.gc +++ b/goal_src/jak1/engine/camera/cam-layout.gc @@ -127,31 +127,18 @@ (the-as float (if (< 0.00001 (fabs f1-1)) (/ (- (-> arg0 w) f0-1) f1-1) 409600000.0)))) (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 float) - (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)) (loop - (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) @@ -166,88 +153,88 @@ (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 (the-as float 1.0)) - (vector-cross! sv-224 sv-208 (-> s3-0 sv-272)) - (vector-normalize! sv-224 (the-as float 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 ((f30-0 (cam-layout-intersect-dist (-> s3-0 sv-288) sv-160 sv-208))) - (cond - ((= f30-0 409600000.0)) - ((zero? sv-168) - (vector+float*! sv-160 sv-160 sv-208 f30-0) - (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 f30-0) (>= (vector-dot sv-240 sv-176) 0.0))) - ((>= (vector-dot sv-240 (-> s3-0 sv-288)) 0.0) - (when (< (fabs f30-0) (fabs sv-164)) - (set! sv-164 f30-0) - (set! sv-168 (+ sv-168 1)))) - (else - (vector+float*! sv-160 sv-160 sv-208 f30-0) - (set! (-> sv-176 quad) (-> s3-0 sv-288 quad)) - (set! sv-168 (+ sv-168 1)) - (if (< (fabs f30-0) (fabs sv-164)) (set! sv-164 (- sv-164 f30-0)) (set! sv-164 0.0)))))) - (set! sv-288 (+ sv-288 1))) - (cond - ((zero? sv-168)) - ((= sv-164 0.0)) - (else - (dotimes (v1-87 (the-as int (-> sv-16 elt-count))) - (when (and (!= v1-87 s1-0) (!= v1-87 sv-272)) - (if (< 4096.0 (- (vector-dot sv-160 (-> s3-0 v1-87)) (-> s3-0 v1-87 w))) (goto cfg-47)))) - (vector+float*! sv-240 sv-160 sv-208 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))))))))) + (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 (the-as float 1.0)) + (vector-cross! sv-224 sv-208 (-> s3-0 sv-272)) + (vector-normalize! sv-224 (the-as float 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 ((f30-0 (cam-layout-intersect-dist (-> s3-0 sv-288) sv-160 sv-208))) + (cond + ((= f30-0 409600000.0)) + ((zero? sv-168) + (vector+float*! sv-160 sv-160 sv-208 f30-0) + (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 f30-0) (>= (vector-dot sv-240 sv-176) 0.0))) + ((>= (vector-dot sv-240 (-> s3-0 sv-288)) 0.0) (when (< (fabs f30-0) (fabs sv-164)) (set! sv-164 f30-0) (+! sv-168 1))) + (else + (vector+float*! sv-160 sv-160 sv-208 f30-0) + (set! (-> sv-176 quad) (-> s3-0 sv-288 quad)) + (+! sv-168 1) + (set! sv-164 + (cond + ((< (fabs f30-0) (fabs sv-164)) (set! sv-164 (- sv-164 f30-0)) sv-164) + (else 0.0))))))) + (+! sv-288 1)))) + (cond + ((zero? sv-168)) + ((= sv-164 0.0)) + (else + (dotimes (v1-87 (the-as int (-> sv-16 elt-count))) + (when (and (!= v1-87 s1-0) (!= v1-87 sv-272)) + (if (< 4096.0 (- (vector-dot sv-160 (-> s3-0 v1-87)) (-> s3-0 v1-87 w))) (goto cfg-47)))) + (vector+float*! sv-240 sv-160 sv-208 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))) + (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))))))))))))) (else (return #f)))) (+! s4-0 1))) (the-as symbol #f)) @@ -597,7 +584,7 @@ arg1) (defbehavior clmf-pos-rot cam-layout ((arg0 symbol) (arg1 symbol)) - (local-vars (s2-0 structure) (s3-1 structure) (sv-192 matrix)) + (local-vars (s2-0 structure) (s3-1 structure)) (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* 8)) (when (and arg1 (nonzero? arg1)) @@ -635,28 +622,28 @@ (format *temp-string* "ERROR : can't add ~A" 'quaternion) (cam-layout-print 120 100 *temp-string*)) s2-0))) - (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*! (the-as vector s3-1) (the-as vector s3-1) s4-0 (the-as float 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*! (the-as vector s3-1) (the-as vector s3-1) s4-0 (the-as float 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)))))) (set! *camera-read-analog* #f) #t) @@ -1624,10 +1611,9 @@ #t) (defbehavior clmf-cam-string cam-layout ((arg0 string) (arg1 symbol)) - (local-vars (sv-16 res-tag)) (format arg0 ":") - (set! sv-16 (new 'static 'res-tag)) - (let ((s5-1 (res-lump-data (-> self cam-entity) arg1 pointer :tag-ptr (& sv-16) :time (the-as float -1000000000.0)))) + (let* ((sv-16 (new 'static 'res-tag)) + (s5-1 (res-lump-data (-> self cam-entity) arg1 pointer :tag-ptr (& sv-16) :time (the-as float -1000000000.0)))) (when s5-1 (dotimes (s4-0 (the-as int (-> sv-16 elt-count))) (format arg0 " ~S" (-> (the-as (pointer uint32) (&+ s5-1 (* s4-0 4)))))))) diff --git a/goal_src/jak1/engine/camera/cam-master.gc b/goal_src/jak1/engine/camera/cam-master.gc index 8870c9d3fa..d2459b7084 100644 --- a/goal_src/jak1/engine/camera/cam-master.gc +++ b/goal_src/jak1/engine/camera/cam-master.gc @@ -340,19 +340,18 @@ v0-1))))) (defun in-cam-entity-volume? ((arg0 vector) (arg1 entity) (arg2 float) (arg3 symbol)) - (local-vars (sv-16 res-tag)) (let ((s2-0 0)) (loop - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-1 (the-as object - ((method-of-type res-lump get-property-data) - arg1 - arg3 - 'exact - (the float s2-0) - (the-as pointer #f) - (& sv-16) - *res-static-buf*)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-1 (the-as object + ((method-of-type res-lump get-property-data) + arg1 + arg3 + 'exact + (the float s2-0) + (the-as pointer #f) + (& sv-16) + *res-static-buf*)))) (cond ((not (the-as pointer v1-1)) (return #f)) (else @@ -411,7 +410,7 @@ (vector-dot (-> arg1 tracking inv-mat vector 2) (-> *camera-combiner* inv-camera-rot vector 2))))) (defbehavior master-switch-to-entity camera-master ((arg0 entity)) - (local-vars (v0-21 object) (gp-0 (pointer process)) (sv-16 res-tag) (sv-112 process) (sv-128 string) (sv-144 string)) + (local-vars (v0-21 object) (gp-0 (pointer process))) (set! (-> self cam-entity) arg0) 10 (let ((s4-0 (cam-state-from-entity arg0))) @@ -432,8 +431,8 @@ (else (format 0 "ERROR : camera region '~S' didn't produce a state~%" (res-lump-struct arg0 'name structure)) (return #f)))) - (set! sv-16 (new 'static 'res-tag)) - (let ((s4-2 (res-lump-data arg0 'alternates (pointer string) :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (s4-2 (res-lump-data arg0 'alternates (pointer string) :tag-ptr (& sv-16)))) (when s4-2 (dotimes (s3-2 (the-as int (-> sv-16 elt-count))) (let ((s2-0 (entity-by-name (-> s4-2 s3-2)))) @@ -444,12 +443,11 @@ (cond ((= s0-0 *camera-base-mode*) (deactivate (-> gp-0 0)) (master-base-region s2-0) (return #t) v0-21) (s0-0 - (set! sv-112 (get-process *camera-dead-pool* camera-slave #x4000)) - (let ((s1-0 (when sv-112 - (let ((t9-15 (method-of-type camera-slave activate))) - (t9-15 (the-as camera-slave sv-112) self 'camera-slave (the-as pointer #x70004000))) - (run-now-in-process sv-112 cam-slave-init s0-0 s2-0) - (-> sv-112 ppointer)))) + (let* ((sv-112 (get-process *camera-dead-pool* camera-slave #x4000)) + (s1-0 (when sv-112 + ((method-of-type camera-slave activate) (the-as camera-slave sv-112) self 'camera-slave (the-as pointer #x70004000)) + (run-now-in-process sv-112 cam-slave-init s0-0 s2-0) + (-> sv-112 ppointer)))) (cond (s1-0 (setup-slave-for-hopefull (the-as camera-slave (ppointer->process s1-0))) @@ -462,16 +460,9 @@ (else (deactivate (-> s1-0 0))))) (else (format 0 "ERROR : alternate region activate failed~%"))))) (else - (let ((s1-1 format) - (s0-1 0)) - (set! sv-128 "ERROR : alternate camera region '~S' didn't produce a state~%") - (let ((a2-10 (res-lump-struct s2-0 'name structure))) (s1-1 s0-1 sv-128 a2-10))))))) + (format 0 "ERROR : alternate camera region '~S' didn't produce a state~%" (res-lump-struct s2-0 'name structure)))))) (else - (let ((s2-1 format) - (s1-2 0) - (s0-2 "ERROR : alternate '~S' not found for '~S'~%")) - (set! sv-144 (-> s4-2 s3-2)) - (let ((a3-8 (res-lump-struct arg0 'name structure))) (s2-1 s1-2 s0-2 sv-144 a3-8)))))))))) + (format 0 "ERROR : alternate '~S' not found for '~S'~%" (-> s4-2 s3-2) (res-lump-struct arg0 'name structure))))))))) (let ((v1-48 (the int (* 300.0 (cam-slave-get-interp-time (-> (the-as camera-slave (-> gp-0 0)) cam-entity)))))) (if (nonzero? (-> self force-blend)) (set! v1-48 (min v1-48 (the-as int (-> self force-blend-time))))) (send-event *camera* 'change-state (ppointer->process gp-0) v1-48)) @@ -556,7 +547,7 @@ (send-event self 'change-state cam-free-floating 0) (dotimes (s5-1 (-> self num-slaves)) (set! (-> self slave s5-1 0 trans quad) (-> (the-as matrix gp-1) vector 0 quad)) - (quaternion->matrix (the-as matrix (-> self slave s5-1 0 tracking)) (the-as quaternion (+ (the-as uint gp-1) 16))))) + (quaternion->matrix (-> self slave s5-1 0 tracking inv-mat) (the-as quaternion (+ (the-as uint gp-1) 16))))) (send-event self 'teleport)))) ((= v1-0 'teleport-to-other-start-string) (let ((gp-2 (new 'stack-no-clear 'vector))) @@ -614,9 +605,9 @@ ((= v1-0 'reset-root) (dotimes (gp-4 (-> self num-slaves)) (set! (-> self slave gp-4 0 trans quad) (the-as uint128 0)) - (matrix-identity! (the-as matrix (-> self slave gp-4 0 tracking)))) + (matrix-identity! (-> self slave gp-4 0 tracking inv-mat))) (vector-reset! (-> *camera-combiner* trans)) - (set! v0-0 (matrix-identity! (the-as matrix (-> *camera-combiner* tracking))))) + (set! v0-0 (matrix-identity! (-> *camera-combiner* tracking inv-mat)))) ((= v1-0 'set-fov) (set! (-> *camera-combiner* fov) (the-as float (-> block param 0))) (dotimes (v1-86 (-> self num-slaves)) diff --git a/goal_src/jak1/engine/camera/cam-states.gc b/goal_src/jak1/engine/camera/cam-states.gc index 7efa1ffa80..99d6fd4da8 100644 --- a/goal_src/jak1/engine/camera/cam-states.gc +++ b/goal_src/jak1/engine/camera/cam-states.gc @@ -35,7 +35,7 @@ (cam-curve-pos (-> self trans) gp-0 (the-as curve #f) #f) (when (!= (-> gp-0 w) 0.0) (vector-normalize! gp-0 (the-as float 1.0)) - (forward-down->inv-matrix (the-as matrix (-> self tracking)) gp-0 (-> *camera* local-down))))) + (forward-down->inv-matrix (-> self tracking inv-mat) gp-0 (-> *camera* local-down))))) (suspend)))) (defstate cam-fixed-read-entity (camera-slave) @@ -50,7 +50,7 @@ ((-> self enter-has-run)) ((-> self cam-entity) (cam-slave-get-vector-with-offset (the-as entity-actor (-> self cam-entity)) (-> self trans) 'trans) - (cam-slave-get-rot (the-as entity-actor (-> self cam-entity)) (the-as matrix (-> self tracking))) + (cam-slave-get-rot (the-as entity-actor (-> self cam-entity)) (-> self tracking inv-mat)) (set! (-> self fov) (cam-slave-get-fov (-> self cam-entity))) (cam-curve-setup (-> self trans)) ((-> cam-fixed enter))) @@ -136,7 +136,7 @@ (cond ((and (< (vector-vector-distance s2-0 gp-0) 40960.0) (< (cos (the-as float 3640.889)) (vector-dot s5-0 s3-0))) (set! (-> self trans quad) (-> s2-0 quad)) - (vector-negate! (the-as vector (-> self tracking)) (the-as vector (-> s0-0 vector))) + (vector-negate! (the-as vector (-> self tracking)) (-> s0-0 vector 0)) (set! (-> self tracking inv-mat vector 1 quad) (-> s0-0 vector 1 quad)) (vector-negate! (-> self tracking inv-mat vector 2) (-> s0-0 vector 2)) (set! (-> self fov) (* 2.0 (atan (/ 12.700255 (* 20.3 (-> s1-0 x))) (the-as float 1.0)))) @@ -224,7 +224,7 @@ (set! (-> self fov) (cam-slave-get-fov (-> self cam-entity))) (logior! (-> self options) (cam-slave-get-flags (-> self cam-entity) 'flags)) (if (logtest? (-> self options) #x8000) - (cam-slave-get-rot (the-as entity-actor (-> self cam-entity)) (the-as matrix (-> self tracking))) + (cam-slave-get-rot (the-as entity-actor (-> self cam-entity)) (-> self tracking inv-mat)) (set! (-> self tracking tilt-adjust target) (cam-slave-get-float (-> self cam-entity) 'tiltAdjust (-> *CAMERA-bank* default-tilt-adjust)))) ((-> cam-standoff enter))) @@ -316,17 +316,15 @@ ((and (= (-> s4-0 x) 0.0) (= (-> s4-0 y) 0.0)) (set! gp-0 (current-time))) (else (let ((v1-44 (min 10 (max 1 (- (current-time) gp-0))))) (vector-float*! s4-0 s4-0 (* 0.1 (the float v1-44)))))) (matrix-axis-angle! s5-0 (-> *camera* local-down) (-> s4-0 y)) - (matrix*! (the-as matrix (-> self tracking)) (the-as matrix (-> self tracking)) s5-0) + (matrix*! (-> self tracking inv-mat) (-> self tracking inv-mat) s5-0) (when (not (logtest? (-> self options) 8)) (if (< (vector-dot (-> self tracking inv-mat vector 1) (-> *camera* local-down)) 0.0) - (forward-down->inv-matrix (the-as matrix (-> self tracking)) - (-> self tracking inv-mat vector 2) - (-> *camera* local-down)) - (forward-down->inv-matrix (the-as matrix (-> self tracking)) + (forward-down->inv-matrix (-> self tracking inv-mat) (-> self tracking inv-mat vector 2) (-> *camera* local-down)) + (forward-down->inv-matrix (-> self tracking inv-mat) (-> self tracking inv-mat vector 2) (vector-negate! (new-stack-vector0) (-> *camera* local-down))))) (matrix-axis-angle! s5-0 (the-as vector (-> self tracking)) (- (-> s4-0 x))) - (matrix*! (the-as matrix (-> self tracking)) (the-as matrix (-> self tracking)) s5-0)) + (matrix*! (-> self tracking inv-mat) (-> self tracking inv-mat) s5-0)) (when (not (logtest? (-> self options) 8)) (let ((f30-1 (vector-dot (-> *camera* local-down) (-> self tracking inv-mat vector 2)))) (set! (-> (new 'stack-no-clear 'vector) quad) (the-as uint128 0)) @@ -372,7 +370,7 @@ (set! (-> self blend-to-type) (the-as uint 0)) 0) (set! (-> self fov) 9830.4) - (matrix-rotate-y! (the-as matrix (-> self tracking)) (the-as float -32768.0))) + (matrix-rotate-y! (-> self tracking inv-mat) (the-as float -32768.0))) :exit (behavior () '()) @@ -441,7 +439,7 @@ (set! (-> self fov) (cam-slave-get-fov (-> self cam-entity))) (logior! (-> self options) (cam-slave-get-flags (-> self cam-entity) 'flags)) (if (logtest? (-> self options) #x8000) - (cam-slave-get-rot (the-as entity-actor (-> self cam-entity)) (the-as matrix (-> self tracking))) + (cam-slave-get-rot (the-as entity-actor (-> self cam-entity)) (-> self tracking inv-mat)) (set! (-> self tracking tilt-adjust target) (cam-slave-get-float (-> self cam-entity) 'tiltAdjust (-> *CAMERA-bank* default-tilt-adjust)))) (cam-slave-get-vector-with-offset (the-as entity-actor (-> self cam-entity)) gp-0 'trans) @@ -906,59 +904,58 @@ (arg4 clip-travel-vector-to-mesh-return-info) (arg5 vector) (arg6 float)) - (local-vars (sv-128 float) (sv-144 vector) (sv-160 vector) (sv-176 vector) (sv-192 vector) (sv-208 int)) (with-pp - (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 (the-as vector (&-> pp stack 368))) (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) (the-as vector (&-> pp stack 368))))) - (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 (the-as vector (&-> pp stack 368))) (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))) + (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 (the-as vector (&-> pp stack 368))) (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) (the-as vector (&-> pp stack 368))))) + (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 - ((and s0-0 (!= s4-0 -100000000.0)) - (dotimes (s4-1 4) - (dist-info-append (the-as collide-los-dist-info (-> gp-0 vert-0)) (the-as vector (+ (the-as uint s5-0) (* s4-1 16))))) - #f) - ((< (-> s5-0 vector 3 y) 0.0) - (dotimes (s4-2 4) - (when (>= (-> s5-0 vector 3 y) (-> s5-0 vector s4-2 y)) - (set! (-> s5-0 vector s4-2 y) (- (-> s5-0 vector s4-2 y))) - (dist-info-append (the-as collide-los-dist-info (-> gp-0 next-normal)) - (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 vector 3 y)) - (dist-info-append (the-as collide-los-dist-info (-> gp-0 intersection)) - (the-as vector (+ (the-as uint s5-0) (* s4-3 16)))))) - #f)))))))) + ((< (* 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 (the-as vector (&-> pp stack 368))) (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 (!= s4-0 -100000000.0)) + (dotimes (s4-1 4) + (dist-info-append (the-as collide-los-dist-info (-> gp-0 vert-0)) (the-as vector (+ (the-as uint s5-0) (* s4-1 16))))) + #f) + ((< (-> s5-0 vector 3 y) 0.0) + (dotimes (s4-2 4) + (when (>= (-> s5-0 vector 3 y) (-> s5-0 vector s4-2 y)) + (set! (-> s5-0 vector s4-2 y) (- (-> s5-0 vector s4-2 y))) + (dist-info-append (the-as collide-los-dist-info (-> gp-0 next-normal)) + (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 vector 3 y)) + (dist-info-append (the-as collide-los-dist-info (-> gp-0 intersection)) + (the-as vector (+ (the-as uint s5-0) (* s4-3 16)))))) + #f))))) (defun cam-los-spline-collide ((arg0 vector) (arg1 vector) (arg2 pat-surface)) (let ((s5-0 (new 'stack-no-clear 'vector)) @@ -1078,7 +1075,7 @@ ;; 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 clip-travel-vector-to-mesh-return-info) (arg3 pat-surface)) - (local-vars (s1-3 int) (s2-2 int) (f2-1 float) (sv-224 vector) (sv-240 vector)) + (local-vars (s1-3 int) (s2-2 int) (f2-1 float)) (dist-info-init (the-as collide-los-dist-info (-> arg2 intersection))) (dist-info-init (the-as collide-los-dist-info (-> arg2 next-normal))) (dist-info-init (the-as collide-los-dist-info (-> arg2 vert-0))) @@ -1102,41 +1099,23 @@ (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-240 (new 'stack-no-clear 'vector)) - (set! sv-224 (new 'stack-no-clear 'vector)) - (let ((f0-7 (moving-sphere-triangle-intersect arg0 arg1 (-> *CAM_STRING-bank* los-coll-rad) (-> s1-1 0) sv-240 sv-224))) + (let* ((sv-240 (new 'stack-no-clear 'vector)) + (sv-224 (new 'stack-no-clear 'vector)) + (f0-7 (moving-sphere-triangle-intersect arg0 arg1 (-> *CAM_STRING-bank* los-coll-rad) (-> s1-1 0) sv-240 sv-224))) (cond ((or (< f0-7 0.0) (< 1.0 f0-7))) - ((let ((f1-2 0.0)) - (let* ((v1-21 arg1) - (f2-0 (-> v1-21 x)) - (f3-0 (-> v1-21 y)) - (f4-0 (-> v1-21 z)) - (f5-0 (-> sv-224 x)) - (f6-0 (-> sv-224 y)) - (f7-0 (-> sv-224 z))) - ;; og:preserve-this inlined vector-dot - ; (.mula.s f2-0 f5-0) - ; (.madda.s f3-0 f6-0) - ; (.madd.s f2-1 f4-0 f7-0) - (set! f2-1 (+ (* f2-0 f5-0) (* f3-0 f6-0) (* f4-0 f7-0)))) - (< f1-2 f2-1)) + ((let ((f1-2 0.0)) (let* ((v1-21 arg1)) (set! f2-1 (vector-dot v1-21 sv-224))) (< f1-2 f2-1)) (when (< f28-0 f0-7) (let* ((t1-2 (new 'stack-no-clear 'vector)) (t0-2 (new 'stack-no-clear 'vector)) (f24-0 (moving-sphere-triangle-intersect arg0 arg1 (-> *CAM_STRING-bank* los-coll-rad2) (-> s1-1 0) t0-2 t1-2))) (los-cw-ccw s1-1 s2-0 s4-0 f30-0 arg2 sv-240 f24-0) (when *debug-segment* - (cond - ((= f24-0 -100000000.0) - (let ((t9-11 cam-debug-add-los-tri) - (a0-13 s1-1) - (a2-7 (new 'static 'vector :x (the-as float #x80) :w (the-as float #x80)))) - (t9-11 a0-13 sv-240 a2-7))) - (else - (cam-debug-add-los-tri s1-1 - sv-240 - (new 'static 'vector :x (the-as float #x80) :y (the-as float #x80) :w (the-as float #x80))))))))) + (if (= f24-0 -100000000.0) + (cam-debug-add-los-tri s1-1 sv-240 (new 'static 'vector :x (the-as float #x80) :w (the-as float #x80))) + (cam-debug-add-los-tri s1-1 + sv-240 + (new 'static 'vector :x (the-as float #x80) :y (the-as float #x80) :w (the-as float #x80)))))))) ((< f0-7 f26-1) (let* ((t1-4 (new 'stack-no-clear 'vector)) (t0-4 (new 'stack-no-clear 'vector)) @@ -1478,7 +1457,6 @@ ;; WARN: Stack slot load at 240 mismatch: defined as size 4, got size 16 ;; WARN: Stack slot load at 256 mismatch: defined as size 4, got size 16 (defbehavior cam-string-move camera-slave () - (local-vars (sv-240 float) (sv-256 float)) (vector-! (-> self velocity) (-> self desired-pos) (-> self string-trans)) (if *display-cam-los-debug* (format *stdcon* "vel ~M~%" (vector-length (-> self velocity)))) (let ((s5-1 (new 'stack-no-clear 'vector)) @@ -1525,15 +1503,8 @@ s4-2 (new 'static 'pat-surface :nocamera #x1)) -100000000.0))) - (when *display-cam-los-debug* - (let ((s2-0 format) - (s1-0 *stdcon*) - (s0-0 "vp ~f vr ~f r ~f ta ~f~%")) - (set! sv-240 (vector-length s5-2)) - (set! sv-256 f30-2) - (let ((t0-3 (/ (vector-length s5-2) f30-2)) - (t1-1 f28-1)) - (s2-0 s1-0 s0-0 sv-240 sv-256 t0-3 t1-1)))) + (if *display-cam-los-debug* + (format *stdcon* "vp ~f vr ~f r ~f ta ~f~%" (vector-length s5-2) f30-2 (/ (vector-length s5-2) f30-2) f28-1)) (cond ((>= f28-1 0.0) (let* ((f1-7 (fmax 0.01 (/ 40.96 (vector-length s5-2)))) diff --git a/goal_src/jak1/engine/camera/cam-update.gc b/goal_src/jak1/engine/camera/cam-update.gc index 3518fdbb14..b8e8071884 100644 --- a/goal_src/jak1/engine/camera/cam-update.gc +++ b/goal_src/jak1/engine/camera/cam-update.gc @@ -38,7 +38,6 @@ (defun update-view-planes ((arg0 math-camera) (arg1 (inline-array plane)) (arg2 float)) "Compute the frustum planes from the given camera." - (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))) @@ -66,19 +65,17 @@ (s1-0 (new-stack-vector0)) (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-5 (-> arg0 inv-camera-rot vector 3 quad))) (set! (-> sv-240 quad) v1-5)) - (vector-! s2-0 (-> 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-0 s1-0 sv-240 0) - (plane-from-points arg1 s0-0 s3-1 sv-240 1) - (plane-from-points arg1 s3-1 s2-0 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) (-> arg0 inv-camera-rot vector 3 quad)) + (vector-! s2-0 (-> 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-0 s1-0 sv-240 0) + (plane-from-points arg1 s0-0 s3-1 sv-240 1) + (plane-from-points arg1 s3-1 s2-0 sv-240 2) + (plane-from-points arg1 s1-0 s0-0 sv-240 3))))) (none)) ;; if we should still attempt vis updates when outside of the bsp's boxes. diff --git a/goal_src/jak1/engine/camera/camera.gc b/goal_src/jak1/engine/camera/camera.gc index 35df79575b..3f87e5cfca 100644 --- a/goal_src/jak1/engine/camera/camera.gc +++ b/goal_src/jak1/engine/camera/camera.gc @@ -134,7 +134,7 @@ (else (* 0.5 (+ 1.0 (sqrtf (+ -1.0 (* 2.0 arg0)))))))) (defun fourth-power ((arg0 float)) - (let ((f0-2 (* arg0 arg0))) (* f0-2 f0-2))) + (square (square arg0))) (defun third-power ((arg0 float)) (* arg0 arg0 arg0)) @@ -143,15 +143,8 @@ (cond ((>= arg0 1.0) 1.0) ((>= 0.0 arg0) 0.0) - ((>= 0.5 arg0) - (let ((f0-3 0.5) - (f1-4 (* 2.0 arg0))) - (* f0-3 (* f1-4 f1-4)))) - (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))))))) + ((>= 0.5 arg0) (* 0.5 (square (* 2.0 arg0)))) + (else (- 1.0 (* 0.5 (square (* 2.0 (- 1.0 arg0)))))))) (defun parameter-ease-sin-clamp ((arg0 float)) (cond @@ -160,22 +153,17 @@ (else (+ 0.5 (* 0.5 (sin (* 182.04445 (+ -90.0 (* 180.0 arg0))))))))) (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 *res-key-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*) 'interp -1000000000.0 #f (the-as (pointer res-tag) #f) *res-static-buf*))) (cond (s3-2 (cond (v0-8 - (vector+! (the-as vector (-> this vec)) (the-as vector (&+ s3-2 0)) (the-as vector v0-8)) + (vector+! (-> this vec 0) (the-as vector (&+ s3-2 0)) (the-as vector v0-8)) (vector+! (-> this vec 1) (the-as vector (&+ s3-2 16)) (the-as vector v0-8))) (else (set! (-> this vec 0 quad) (-> (the-as (pointer uint128) (&+ s3-2 0)))) @@ -190,26 +178,26 @@ ((logtest? (-> this flags) (cam-index-options SPHERICAL)) (vector-! s4-1 (-> this vec 1) arg2) (set! (-> this vec 1 w) (vector-length s4-1)) - (vector-! s4-1 (the-as vector (-> this vec)) arg2) + (vector-! s4-1 (-> this vec 0) arg2) (set! (-> this vec 1 x) (vector-length s4-1)) (set! (-> this vec 1 w) (- (-> this vec 1 w) (-> this vec 1 x))) (set! (-> this vec 0 quad) (-> arg2 quad))) ((logtest? (-> this flags) (cam-index-options RADIAL)) (vector-! s4-1 (-> this vec 1) arg2) (set! (-> this vec 1 w) (vector-length s4-1)) - (vector-! s4-1 (the-as vector (-> this vec)) arg2) + (vector-! s4-1 (-> this vec 0) arg2) (set! (-> this vec 1 x) (vector-length s4-1)) (set! (-> this vec 1 w) (- (-> this vec 1 w) (-> this vec 1 x))) (set! (-> this vec 0 quad) (-> arg2 quad))) (else - (vector-! (-> this vec 1) (-> this vec 1) (the-as vector (-> this vec))) + (vector-! (-> this vec 1) (-> this vec 1) (-> this vec 0)) (set! (-> this vec 1 w) (vector-normalize-ret-len! (-> this vec 1) 1.0))))) #t) (defmethod cam-index-method-10 ((this cam-index) (arg0 vector)) (let ((s5-0 (new-stack-vector0))) 0.0 - (vector-! s5-0 arg0 (the-as vector (-> this vec))) + (vector-! s5-0 arg0 (-> this vec 0)) (cond ((logtest? (-> this flags) (cam-index-options SPHERICAL)) (vector-flatten! s5-0 s5-0 (-> *camera* local-down)) @@ -252,8 +240,8 @@ (let ((v1-11 (-> this point arg0 next))) (set! (-> this summed-len) (- (-> this summed-len) (-> this point arg0 tp-length))) (vector-! (the-as vector (+ (the-as uint (-> this point 0 direction)) (* 48 arg0))) - (the-as vector (-> this point v1-11)) - (the-as vector (-> this point arg0)))) + (-> this point v1-11 position) + (-> this point arg0 position))) (set! (-> this point arg0 tp-length) (vector-normalize-ret-len! (the-as vector (+ (the-as uint (-> this point 0 direction)) (* 48 arg0))) 1.0)) (+! (-> this summed-len) (-> this point arg0 tp-length)) @@ -291,7 +279,7 @@ (let ((a2-0 (new 'stack-no-clear 'tracking-point))) (set! (-> s5-0 cur-pt) (-> this used-point)) (set! (-> s5-0 partial-pt) (-> this partial-point)) - (tracking-spline-method-19 this (-> this sample-len) (the-as vector a2-0) s5-0)) + (tracking-spline-method-19 this (-> this sample-len) (-> a2-0 position) s5-0)) (if (or (= (-> s5-0 cur-pt) (-> this end-point)) (= (-> s5-0 cur-pt) (-> this next-to-last-point)) (= (-> this point (-> s5-0 cur-pt) next) (-> this next-to-last-point))) @@ -341,9 +329,7 @@ (defmethod tracking-spline-method-17 ((this tracking-spline) (arg0 vector) (arg1 float) (arg2 float) (arg3 symbol)) (let ((s3-0 (-> this free-point)) (s2-0 (-> this end-point))) - (vector-! (the-as vector (+ (the-as uint (-> this point 0 direction)) (* 48 s2-0))) - arg0 - (the-as vector (-> this point s2-0))) + (vector-! (the-as vector (+ (the-as uint (-> this point 0 direction)) (* 48 s2-0))) arg0 (-> this point s2-0 position)) (set! (-> this point s2-0 tp-length) (vector-normalize-ret-len! (the-as vector (+ (the-as uint (-> this point 0 direction)) (* 48 s2-0))) 1.0)) (if (< (-> this point s2-0 tp-length) arg1) (return 0)) @@ -375,7 +361,7 @@ (cond ((= (-> arg2 cur-pt) (-> this end-point)) (set! (-> arg2 partial-pt) 0.0) - (vector+! arg1 arg1 (the-as vector (-> this point (-> arg2 cur-pt)))) + (vector+! arg1 arg1 (-> this point (-> arg2 cur-pt) position)) (return arg1)) ((begin (set! f0-4 (+ (-> arg2 partial-pt) (/ arg0 (-> this point (-> arg2 cur-pt) tp-length)))) @@ -383,10 +369,7 @@ (set! (-> arg2 partial-pt) f0-4) (let ((s5-0 (new 'stack-no-clear 'tracking-spline-sampler))) (let ((a2-5 (-> this point (-> arg2 cur-pt) next))) - (vector-lerp! (the-as vector s5-0) - (the-as vector (-> this point (-> arg2 cur-pt))) - (the-as vector (-> this point a2-5)) - f0-4)) + (vector-lerp! (the-as vector s5-0) (-> this point (-> arg2 cur-pt) position) (-> this point a2-5 position) f0-4)) (vector+! arg1 arg1 (the-as vector s5-0))) (return arg1)) (else @@ -402,7 +385,7 @@ (defmethod tracking-spline-method-20 ((this tracking-spline) (arg0 vector) (arg1 int)) (let ((s3-0 (new 'stack-no-clear 'vector))) - (vector-! s3-0 (the-as vector (-> this point (-> this used-point))) (the-as vector (-> this point (-> this end-point)))) + (vector-! s3-0 (-> this point (-> this used-point) position) (-> this point (-> this end-point) position)) (let* ((f0-0 (vector-length s3-0)) (f1-1 (* 0.33333334 (- 1.5 (/ f0-0 METER_LENGTH))))) 0.0 @@ -433,18 +416,20 @@ (cond ((< f26-0 0.0) (if (and *debug-segment* *display-camera-marks*) - (camera-line-rel-len (the-as vector (-> this point s1-0)) + (camera-line-rel-len (-> this point s1-0 position) s2-0 (* -40.96 f26-0) - (the-as vector4w - (new 'static 'inline-array qword 1 (new 'static 'qword :data (new 'static 'array uint32 4 #xff #xff #x0 #x80)))))) + (-> (new 'static 'inline-array qword 1 (new 'static 'qword :data (new 'static 'array uint32 4 #xff #xff #x0 #x80))) + 0 + vector4w))) (vector--float*! arg0 arg0 s2-0 f26-0)) ((and *debug-segment* *display-camera-marks*) - (camera-line-rel-len (the-as vector (-> this point s1-0)) + (camera-line-rel-len (-> this point s1-0 position) s2-0 (* 40.96 f26-0) - (the-as vector4w - (new 'static 'inline-array qword 1 (new 'static 'qword :data (new 'static 'array uint32 4 #x80 #x80 #x0 #x80)))))))) + (-> (new 'static 'inline-array qword 1 (new 'static 'qword :data (new 'static 'array uint32 4 #x80 #x80 #x0 #x80))) + 0 + vector4w))))) (set! v1-8 s1-0)))))) 0 (none)) @@ -558,7 +543,7 @@ (set! (-> self velocity quad) (-> *camera-combiner* velocity quad))) (else (vector-reset! (-> self trans)) - (matrix-identity! (the-as matrix (-> self tracking))) + (matrix-identity! (-> self tracking inv-mat)) (set! (-> self fov) 11650.845) (vector-reset! (-> self velocity)))) (set! (-> self time-dist-too-far) (the-as uint 0)) @@ -732,9 +717,7 @@ (cond ((< (-> *camera* ease-t) 1.0)) ((< (-> arg0 follow-blend) 1.0) - (let* ((f0-18 (-> arg0 follow-blend)) - (f0-19 (* f0-18 f0-18)) - (f0-20 (* f0-19 f0-19))) + (let ((f0-20 (square (square (-> arg0 follow-blend))))) (vector-! s5-1 s5-1 (-> arg0 follow-off)) (vector-float*! s5-1 s5-1 f0-20)) (+! (-> arg0 follow-blend) (/ (-> *display* time-adjust-ratio) 60)) @@ -758,9 +741,9 @@ (f30-2 (cond ((< f0-28 0.0) 1.0) (else - (let* ((f0-29 (* f0-28 f0-28)) + (let* ((f0-29 (square f0-28)) (f0-30 (- 1.0 f0-29))) - (* f0-30 (* f0-30 f0-30))))))) + (* f0-30 (square f0-30))))))) (vector-! s3-2 arg1 (-> *camera* tpos-curr-adj)) (vector-flatten! s3-2 s3-2 (-> *camera* local-down)) (let* ((f0-33 (* 0.000022194603 (+ -20480.0 (vector-length s3-2)))) @@ -822,7 +805,6 @@ (quaternion->matrix arg0 s4-0))) (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)) @@ -837,33 +819,37 @@ (vector-! s3-0 (-> *camera* tpos-curr) arg1) (vector-flatten! s3-0 s3-0 (-> arg0 vector 1)) (vector-normalize! s3-0 1.0) - (let ((f28-0 (vector-dot s3-0 (the-as vector (-> arg0 vector))))) - (set! sv-128 s2-0) - (set! sv-112 (-> arg0 vector)) - (let ((f0-6 (* 0.8 (tan (/ arg2 2))))) (.lvf vf1 (&-> sv-112 0 quad)) (let ((v1-6 f0-6)) (.mov vf2 v1-6))) - (.add.x.vf.w vf1 vf0 vf0) - (.mul.x.vf.xyz vf1 vf1 vf2) - (.svf (&-> sv-128 quad) vf1) + (let ((f28-0 (vector-dot s3-0 (-> arg0 vector 0)))) + (let ((sv-128 s2-0)) + (let ((sv-112 (-> arg0 vector)) + (f0-6 (* 0.8 (tan (/ arg2 2))))) + (.lvf vf1 (&-> sv-112 0 quad)) + (let ((v1-6 f0-6)) (.mov vf2 v1-6))) + (.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 1.0) - (let ((f0-8 (vector-dot s2-0 (the-as vector (-> arg0 vector))))) + (let ((f0-8 (vector-dot s2-0 (-> arg0 vector 0)))) (when (< f0-8 (fabs f28-0)) - (if (< f28-0 0.0) (vector--float*! s2-0 s2-0 (the-as vector (-> arg0 vector)) (* 2.0 f0-8))) + (if (< f28-0 0.0) (vector--float*! s2-0 s2-0 (-> arg0 vector 0) (* 2.0 f0-8))) (matrix-from-two-vectors! s5-0 s2-0 s3-0) (vector-matrix*! (-> arg0 vector 2) (-> arg0 vector 2) s5-0) - (vector-cross! (the-as vector (-> arg0 vector)) (-> arg0 vector 1) (-> arg0 vector 2))))) + (vector-cross! (-> arg0 vector 0) (-> arg0 vector 1) (-> arg0 vector 2))))) (vector-! s3-0 (-> *camera* tpos-curr) (-> *camera* pitch-off)) (vector-! s3-0 s3-0 arg1) (vector--float*! s3-0 s3-0 (-> *camera* local-down) (-> *camera* foot-offset)) - (vector-flatten! s3-0 s3-0 (the-as vector (-> arg0 vector))) + (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-15 (* 0.525 (tan (/ arg2 2))))) (.lvf vf1 (&-> sv-144 quad)) (let ((v1-23 f0-15)) (.mov vf2 v1-23))) - (.add.x.vf.w vf1 vf0 vf0) - (.mul.x.vf.xyz vf1 vf1 vf2) - (.svf (&-> sv-160 quad) vf1) + (let ((sv-160 s2-0)) + (let ((sv-144 (-> arg0 vector 1)) + (f0-15 (* 0.525 (tan (/ arg2 2))))) + (.lvf vf1 (&-> sv-144 quad)) + (let ((v1-23 f0-15)) (.mov vf2 v1-23))) + (.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-17 (vector-dot s2-0 (-> arg0 vector 1)))) @@ -873,33 +859,25 @@ (vector-! s3-0 (-> *camera* tpos-curr) (-> *camera* pitch-off)) (vector-! s3-0 s3-0 arg1) (vector--float*! s3-0 s3-0 (-> *camera* local-down) (-> *camera* head-offset)) - (vector-flatten! s3-0 s3-0 (the-as vector (-> arg0 vector))) + (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-25 (* 0.525 (tan (/ arg2 2))))) (vector-float*! s0-1 sv-176 f0-25))) + (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-27 (vector-dot s2-0 (-> arg0 vector 1)))) (cond ((and (< 0.0 f28-2) (< f0-27 f28-2)) (set! f30-0 (vector-dot s2-0 s3-0)) (set! s4-0 #f)) ((< f30-0 0.0) (let ((f0-32 (- (vector-dot s2-0 s3-0)))) (if (< f0-32 f30-0) (set! f30-0 f0-32))))))) - (let ((f0-34 (if s4-0 (- (acos f30-0)) (acos f30-0)))) (matrix-axis-angle! s5-0 (the-as vector (-> arg0 vector)) f0-34)))) + (let ((f0-34 (if s4-0 (- (acos f30-0)) (acos f30-0)))) (matrix-axis-angle! s5-0 (-> arg0 vector 0) f0-34)))) (vector-matrix*! (-> arg0 vector 2) (-> arg0 vector 2) s5-0)) - (vector-cross! (-> arg0 vector 1) (-> arg0 vector 2) (the-as vector (-> arg0 vector))))) + (vector-cross! (-> arg0 vector 1) (-> arg0 vector 2) (-> arg0 vector 0)))) ;; ERROR: Unsupported inline assembly instruction kind - [mula.s f0, f3] ;; 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 float) (arg3 float) (arg4 symbol)) - (local-vars - (f0-8 float) - (sv-192 vector) - (sv-208 vector) - (sv-224 matrix) - (sv-240 (function matrix vector float vector)) - (sv-256 matrix)) + (local-vars (f0-8 float)) (rlet ((vf0 :class vf) (vf4 :class vf) (vf5 :class vf) @@ -910,60 +888,44 @@ (let ((f30-0 (-> arg0 tilt-adjust value))) (cond ((< 0.0001 (-> arg0 point-of-interest-blend value)) - (set! sv-192 (new 'stack-no-clear 'vector)) - 0.0 - (vector-! s1-0 (-> arg0 follow-pt) arg1) - (let ((f28-0 (vector-length s1-0))) - (vector-! sv-192 (-> arg0 point-of-interest) arg1) - (vector-normalize! sv-192 (* f28-0 (-> arg0 point-of-interest-blend value))) - (let ((v1-3 s1-0)) - (let ((a0-5 s1-0)) (.mov.vf.w vf6 vf0) (.lvf vf4 (&-> a0-5 quad))) - (.lvf vf5 (&-> sv-192 quad)) - (.add.vf.xyz vf6 vf4 vf5) - (.svf (&-> v1-3 quad) vf6)) - (vector-normalize! s1-0 f28-0))) + (let ((sv-192 (new 'stack-no-clear 'vector))) + 0.0 + (vector-! s1-0 (-> arg0 follow-pt) arg1) + (let ((f28-0 (vector-length s1-0))) + (vector-! sv-192 (-> arg0 point-of-interest) arg1) + (vector-normalize! sv-192 (* f28-0 (-> arg0 point-of-interest-blend value))) + (let ((v1-3 s1-0)) + (let ((a0-5 s1-0)) (.mov.vf.w vf6 vf0) (.lvf vf4 (&-> a0-5 quad))) + (.lvf vf5 (&-> sv-192 quad)) + (.add.vf.xyz vf6 vf4 vf5) + (.svf (&-> v1-3 quad) vf6)) + (vector-normalize! s1-0 f28-0)))) (else (vector-! s1-0 (-> arg0 follow-pt) arg1))) (forward-down->inv-matrix s5-0 s1-0 (-> *camera* local-down)) (when (!= f30-0 0.0) 0.0 0.0 - (set! sv-224 (new 'stack-no-clear 'matrix)) - (set! sv-208 (new 'stack-no-clear 'vector)) - (vector-normalize-copy! sv-208 s1-0 1.0) - (let* ((v1-11 (-> *camera* local-down)) - (f0-7 (-> sv-208 x)) - (f1-1 (-> sv-208 y)) - (f2-0 (-> sv-208 z)) - (f3-0 (-> v1-11 x)) - (f4-0 (-> v1-11 y)) - (f5-0 (-> v1-11 z))) - ;; og:preserve-this inlined vector-dot - ; (.mula.s f0-7 f3-0) - ; (.madda.s f1-1 f4-0) - ; (.madd.s f0-8 f2-0 f5-0) - (set! f0-8 (+ (* f0-7 f3-0) (* f1-1 f4-0) (* f2-0 f5-0)))) - (let* ((f28-1 f0-8) - (f0-10 (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-10))) (fmin f30-0 (fmax 0.0 (- 32768.0 (+ 2730.6667 f0-10))))))) - ((< f30-0 0.0) - (set! f30-0 - (if (< 0.0 f28-1) - (fmax f30-0 (- (fmax 0.0 (- 32768.0 (+ 2730.6667 f0-10))))) - (fmax f30-0 (- (fmax 0.0 (+ -2730.6667 f0-10))))))))) - (matrix-rotate-x! sv-224 f30-0) - (let ((t9-7 matrix*!) - (a0-16 s5-0) - (a2-3 s5-0)) - (t9-7 a0-16 sv-224 a2-3)))) + (let ((sv-224 (new 'stack-no-clear 'matrix))) + (let ((sv-208 (new 'stack-no-clear 'vector))) + (vector-normalize-copy! sv-208 s1-0 1.0) + (let* ((v1-11 (-> *camera* local-down))) (set! f0-8 (vector-dot sv-208 v1-11)))) + (let* ((f28-1 f0-8) + (f0-10 (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-10))) (fmin f30-0 (fmax 0.0 (- 32768.0 (+ 2730.6667 f0-10))))))) + ((< f30-0 0.0) + (set! f30-0 + (if (< 0.0 f28-1) + (fmax f30-0 (- (fmax 0.0 (- 32768.0 (+ 2730.6667 f0-10))))) + (fmax f30-0 (- (fmax 0.0 (+ -2730.6667 f0-10))))))))) + (matrix-rotate-x! sv-224 f30-0) + (matrix*! s5-0 sv-224 s5-0)))) (if (and (= (-> *camera* under-water) 2) *target* (!= (-> *target* next-state name) 'target-swim-up)) (set! (-> arg0 underwater-blend target) 1.0) (set! (-> arg0 underwater-blend target) 0.0)) - (set! sv-240 vector-into-frustum-nosmooth!) - (set! sv-256 s5-0) - (let ((a2-5 (lerp-clamp arg3 (/ arg3 4) (-> arg0 underwater-blend value)))) (sv-240 sv-256 arg1 a2-5)) + (vector-into-frustum-nosmooth! s5-0 arg1 (lerp-clamp arg3 (/ arg3 4) (-> arg0 underwater-blend value))) (cond (arg4 (slave-matrix-blend-2 (-> arg0 inv-mat) arg2 s1-0 s5-0)) (else @@ -985,67 +947,50 @@ ;; 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 vector 0 quad) (the-as uint128 0)) - (set! (-> sv-176 vector 1 quad) (the-as uint128 0)) - (set! (-> sv-176 vector 2 quad) (the-as uint128 0)) - (set! (-> sv-176 vector 3 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))) - (let ((t9-10 acos)) - (let* ((v1-18 s0-0) - (f0-9 (-> v1-18 x)) - (f1-2 (-> v1-18 y)) - (f2-0 (-> v1-18 z)) - (f3-0 (-> sv-160 x)) - (f4-0 (-> sv-160 y)) - (f5-0 (-> sv-160 z))) - ;; og:preserve-this inlined vector-dot - ; (.mula.s f0-9 f3-0) - ; (.madda.s f1-2 f4-0) - ; (.madd.s f0-10 f2-0 f5-0) - (set! f0-10 (+ (* f2-0 f5-0) (* f1-2 f4-0) (* f0-9 f3-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* ((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)) - (t9-12 a0-20 a1-13 (sqrtf (- f1-5 (* f2-3 f2-3))) f0-13)))) - (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))) + (let ((sv-176 (new 'stack-no-clear 'matrix))) + (set! (-> sv-176 vector 0 quad) (the-as uint128 0)) + (set! (-> sv-176 vector 1 quad) (the-as uint128 0)) + (set! (-> sv-176 vector 2 quad) (the-as uint128 0)) + (set! (-> sv-176 vector 3 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))) + (let ((t9-10 acos)) + (let* ((v1-18 s0-0)) (set! f0-10 (vector-dot v1-18 sv-160))) + (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 ((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-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)))))) @@ -1055,10 +1000,10 @@ ;; 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 @@ -1083,29 +1028,12 @@ (set! f26-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-9 s1-0) - (f0-6 (-> v1-9 x)) - (f1-0 (-> v1-9 y)) - (f2-0 (-> v1-9 z)) - (f3-0 (-> sv-160 x)) - (f4-0 (-> sv-160 y)) - (f5-0 (-> sv-160 z))) - ;; og:preserve-this inlined vector-dot - ; (.mula.s f0-6 f3-0) - ; (.madda.s f1-0 f4-0) - ; (.madd.s f0-7 f2-0 f5-0) - (set! f0-7 (+ (* f0-6 f3-0) (* f1-0 f4-0) (* f2-0 f5-0)))) + (let* ((v1-9 s1-0)) (set! f0-7 (vector-dot v1-9 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)))) (vector-matrix*! arg0 s1-0 s0-0)) (vector-normalize! arg0 (lerp f28-0 f26-0 f30-0)) (when arg3 diff --git a/goal_src/jak1/engine/collide/collide-edge-grab.gc b/goal_src/jak1/engine/collide/collide-edge-grab.gc index 97ab3b1005..69988527ac 100644 --- a/goal_src/jak1/engine/collide/collide-edge-grab.gc +++ b/goal_src/jak1/engine/collide/collide-edge-grab.gc @@ -61,7 +61,6 @@ ;; Find edges that we might be able to grab (find-grabbable-edges! gp-0) (when (nonzero? (-> gp-0 num-edges)) - ;; (set! (-> gp-0 search-pt quad) (-> *target* control unknown-vector90 quad)) ;; for the search, we either use the direction of the stick, or the heading of target. (when (!= (-> *cpad-list* cpads (-> *target* control unknown-cpad-info00 number) stick0-speed) 0.0) @@ -114,7 +113,6 @@ (defmethod-mips2c "(method 18 collide-edge-work)" 18 collide-edge-work) (defmethod check-grab-for-collisions ((this collide-edge-work) (arg0 collide-edge-hold-item) (arg1 edge-grab-info)) - (local-vars (sv-144 (function vector vector vector float vector)) (sv-160 vector) (sv-176 vector)) (let* ((s3-0 (-> arg0 edge)) (s1-0 (-> s3-0 etri ctri)) (s4-0 (-> s1-0 prim-index))) @@ -122,12 +120,7 @@ (vector+*! s0-0 (-> arg0 center-pt) (-> s3-0 edge-vec-norm) 1105.92) (let ((f0-0 (collide-edge-work-method-14 this (-> arg1 right-hand-hold) s0-0 (the-as int s4-0)))) (if (< 491.52 f0-0) (return #f))) - (set! sv-144 vector+*!) - (set! sv-160 s0-0) - (set! sv-176 (-> arg0 center-pt)) - (let ((a2-3 (vector-negate! (new 'stack-no-clear 'vector) (-> s3-0 edge-vec-norm))) - (a3-2 1105.92)) - (sv-144 sv-160 sv-176 a2-3 a3-2)) + (vector+*! s0-0 (-> arg0 center-pt) (vector-negate! (new 'stack-no-clear 'vector) (-> s3-0 edge-vec-norm)) 1105.92) (let ((f0-1 (collide-edge-work-method-14 this (-> arg1 left-hand-hold) s0-0 (the-as int s4-0)))) (if (< 491.52 f0-1) (return #f)))) (set! (-> arg1 tri-vertex 0 quad) (-> s1-0 vertex 0 quad)) @@ -138,8 +131,7 @@ (set! (-> arg1 world-vertex 0 quad) (-> s3-0 vertex-ptr 0 0 quad)) (set! (-> arg1 world-vertex 1 quad) (-> s3-0 vertex-ptr 1 0 quad)) (set! (-> arg1 hanging-matrix vector 1 quad) (-> *target* control dynam gravity-normal quad)) - (vector-normalize! (vector-! (-> arg1 hanging-matrix vector 2) (-> arg1 world-vertex 1) (the-as vector (-> arg1 world-vertex))) - 1.0) + (vector-normalize! (vector-! (-> arg1 hanging-matrix vector 2) (-> arg1 world-vertex 1) (-> arg1 world-vertex 0)) 1.0) (vector-normalize! (vector-cross! (the-as vector (-> arg1 hanging-matrix)) (-> arg1 hanging-matrix vector 2) (-> arg1 hanging-matrix vector 1)) @@ -161,7 +153,7 @@ (a0-35 (-> (the-as collide-shape-prim v1-36) cshape))) (cond (a0-35 - (set! (-> arg1 actor-cshape-prim-offset) (- (the-as int v1-36) (the-as int (-> a0-35 process)))) + (set! (-> arg1 actor-cshape-prim-offset) (- (the-as int v1-36) (the-as uint (the-as int (-> a0-35 process))))) (set! (-> arg1 actor-handle) (process->handle (-> a0-35 process))) (let ((a1-19 (-> a0-35 process node-list data (-> (the-as collide-shape-prim v1-36) transform-index) bone transform)) (s5-1 (new 'stack-no-clear 'matrix))) @@ -217,8 +209,7 @@ (b! #t cfg-27 :delay (nop!)) (label cfg-17) (set! (-> this hanging-matrix vector 1 quad) (-> *target* control dynam gravity-normal quad)) - (vector-normalize! (vector-! (-> this hanging-matrix vector 2) (-> this world-vertex 1) (the-as vector (-> this world-vertex))) - 1.0) + (vector-normalize! (vector-! (-> this hanging-matrix vector 2) (-> this world-vertex 1) (-> this world-vertex 0)) 1.0) (vector-normalize! (vector-cross! (the-as vector (-> this hanging-matrix)) (-> this hanging-matrix vector 2) (-> this hanging-matrix vector 1)) @@ -247,12 +238,12 @@ (set! (-> a1-14 ignore-pat) (new 'static 'pat-surface :noentity #x1)) (set! (-> a1-14 solid-only) #t) (label cfg-21) - (b! (not (fill-and-probe-using-spheres *collide-cache* a1-14)) cfg-24)) + (b! (not (fill-and-probe-using-spheres *collide-cache* a1-14)) cfg-24 :delay (empty-form))) (set! v0-0 #f) (b! #t cfg-27 :delay (nop!)) (the-as none 0) (label cfg-24) - (b! (not (the-as int s5-0)) cfg-26) + (b! (not (the-as int s5-0)) cfg-26 :delay (empty-form)) (let ((v1-40 (-> (the-as collide-shape-prim s5-0) cshape))) (send-event (-> v1-40 process) 'edge-grabbed this))) (label cfg-26) (set! v0-0 #t) @@ -319,7 +310,7 @@ (.lvf vf5 (&-> v1-0 trans quad))))) (.por v1-1 t1-1 a3-1) (let ((f0-0 (-> this max-dist-sqrd-to-outward-pt))) - (.ppach v1-2 r0-0 v1-1) + (.ppach v1-2 (the-as uint128 0) v1-1) (let ((f1-0 (-> this max-dir-cosa-delta))) (b! (nonzero? (shl (the-as int v1-2) 16)) cfg-4 :delay (.lvf vf6 (&-> this search-dir-vec quad))) (.mul.x.vf vf10 vf3 vf4) @@ -419,7 +410,7 @@ (defmethod debug-draw ((this edge-grab-info)) (add-debug-line #t (bucket-id debug-no-zbuf) - (the-as vector (-> this world-vertex)) + (-> this world-vertex 0) (-> this world-vertex 1) (new 'static 'rgba :r #xff :a #x60) #f @@ -433,7 +424,7 @@ (new 'static 'rgba :r #xff :g #xff :a #x60)) (add-debug-outline-triangle #t (bucket-id debug-no-zbuf) - (the-as vector (-> this tri-vertex)) + (-> this tri-vertex 0) (-> this world-vertex 4) (-> this world-vertex 5) (new 'static 'rgba :r #xff :a #x30)) @@ -502,19 +493,14 @@ (set! s4-0 (-> s4-0 next)))) (format *stdcon* "hold list has ~D item(s)~%" s5-0)) (dotimes (s5-1 (the-as int (-> this num-attempts))) - (add-debug-sphere #t (bucket-id debug-no-zbuf) (the-as vector (-> this attempts s5-1)) 409.6 (new 'static 'rgba :a #x40))) + (add-debug-sphere #t (bucket-id debug-no-zbuf) (-> this attempts s5-1 vector) 409.6 (new 'static 'rgba :a #x40))) (format *stdcon* "hold list has ~D attempt(s)~%" (-> this num-attempts))) (defmethod debug-draw-tris ((this collide-edge-work)) (dotimes (s5-0 (the-as int (-> this num-tris))) (let* ((v1-3 (-> this tris s5-0 ctri)) (t1-0 (copy-and-set-field (-> *pat-mode-info* (-> v1-3 pat mode) color) a 64))) - (add-debug-outline-triangle #t - (bucket-id debug-no-zbuf) - (the-as vector (-> v1-3 vertex)) - (-> v1-3 vertex 1) - (-> v1-3 vertex 2) - t1-0))) + (add-debug-outline-triangle #t (bucket-id debug-no-zbuf) (-> v1-3 vertex 0) (-> v1-3 vertex 1) (-> v1-3 vertex 2) t1-0))) (none)) (let ((v1-1 (new 'static @@ -541,6 +527,7 @@ :slope-up-traction 1.0 :align-speed 1.0 :flags (surface-flags moving-ground)))) + ;; og:preserve-this added (define *rotate-surface* v1-1) (set! *rotate-surface* v1-1) (set! (-> v1-1 mult-hook) @@ -570,6 +557,7 @@ :slope-up-traction 0.9 :align-speed 1.0 :flags (surface-flags no-turn-around always-rotate-toward-transv)))) + ;; og:preserve-this added (define *no-walk-surface* v1-2) (set! *no-walk-surface* v1-2) (set! (-> v1-2 mult-hook) (the-as (function surface surface surface int none) nothing)) diff --git a/goal_src/jak1/engine/collide/collide-probe.gc b/goal_src/jak1/engine/collide/collide-probe.gc index 5e4e016e67..5b75fc920f 100644 --- a/goal_src/jak1/engine/collide/collide-probe.gc +++ b/goal_src/jak1/engine/collide/collide-probe.gc @@ -165,6 +165,7 @@ (defun collide-upload-vu0 () "Upload the probe program to VU0." + ;; og:preserve-this (#unless PC_PORT (let ((gp-0 *vu0-dma-list*)) ;; reset the buffer @@ -236,10 +237,7 @@ ;; I guess collision with the ground during the misty ambush was too slow, so they wrote this hack. (defun distc ((arg0 vector) (arg1 vector)) - (let* ((f0-1 (- (-> arg0 x) (-> arg1 x))) - (f0-3 (* f0-1 f0-1)) - (f1-2 (- (-> arg0 z) (-> arg1 z)))) - (sqrtf (+ f0-3 (* f1-2 f1-2))))) + (sqrtf (+ (square (- (-> arg0 x) (-> arg1 x))) (square (- (-> arg0 z) (-> arg1 z)))))) (defun interpolate ((arg0 float) (arg1 float) (arg2 float) (arg3 float) (arg4 float)) (let ((f0-1 (- arg3 arg1)) diff --git a/goal_src/jak1/engine/collide/collide-shape-rider.gc b/goal_src/jak1/engine/collide/collide-shape-rider.gc index 8d819c0925..3c191c696c 100644 --- a/goal_src/jak1/engine/collide/collide-shape-rider.gc +++ b/goal_src/jak1/engine/collide/collide-shape-rider.gc @@ -14,7 +14,7 @@ (when (and (logtest? (-> s5-0 collide-with) (-> s4-0 prim-core collide-as)) (logtest? (-> s5-0 prim-core action) (collide-action rider-plat-sticky)) (logtest? (-> s4-0 prim-core action) (collide-action rider-target))) - (let ((f0-4 (- (- (vector-vector-distance (the-as vector (-> s5-0 prim-core)) (the-as vector (-> s4-0 prim-core))) + (let ((f0-4 (- (- (vector-vector-distance (-> s5-0 prim-core world-sphere) (-> s4-0 prim-core world-sphere)) (-> s5-0 prim-core world-sphere w)) (-> s4-0 prim-core world-sphere w)))) (if (< f0-4 122.88) (on-platform-test s5-0 s4-0 arg1 f0-4))))) @@ -32,7 +32,7 @@ ;; check collide kind (when (and (logtest? (-> s1-0 collide-with) s3-0) (logtest? (-> s1-0 prim-core action) (collide-action rider-plat-sticky))) ;; check dist - (let ((f0-2 (- (- (vector-vector-distance (the-as vector (-> s1-0 prim-core)) (the-as vector (-> arg0 prim-core))) + (let ((f0-2 (- (- (vector-vector-distance (-> s1-0 prim-core world-sphere) (-> arg0 prim-core world-sphere)) (-> s1-0 prim-core world-sphere w)) (-> arg0 prim-core world-sphere w)))) ;; dist close enough, check! @@ -48,7 +48,7 @@ (dotimes (s2-0 (-> (the-as collide-shape-prim-group arg0) num-prims)) (let ((s1-0 (-> (the-as collide-shape-prim-group arg0) prims s2-0))) (when (and (logtest? s3-0 (-> s1-0 prim-core collide-as)) (logtest? (-> s1-0 prim-core action) (collide-action rider-target))) - (let ((f0-2 (- (- (vector-vector-distance (the-as vector (-> this prim-core)) (the-as vector (-> s1-0 prim-core))) + (let ((f0-2 (- (- (vector-vector-distance (-> this prim-core world-sphere) (-> s1-0 prim-core world-sphere)) (-> this prim-core world-sphere w)) (-> s1-0 prim-core world-sphere w)))) (if (< f0-2 122.88) (on-platform-test this s1-0 arg1 f0-2)))))))) @@ -64,15 +64,11 @@ (set! (-> this mesh-cache-tris) (the-as (inline-array collide-mesh-cache-tri) v1-17)) (set! (-> this mesh-cache-id) (-> s2-1 id)) (populate-cache! s3-1 - (the-as collide-mesh-cache-tri (-> this mesh-cache-tris)) + (-> this mesh-cache-tris 0) (-> this cshape process node-list data (-> this transform-index) bone transform))) (else (return #f)))))) (let* ((s2-2 (new 'stack-no-clear 'collide-tri-result)) - (f0-4 (sphere-on-platform-test s3-1 - (the-as collide-mesh-cache-tri (-> this mesh-cache-tris)) - s2-2 - (the-as vector (-> arg0 prim-core)) - (-> arg1 best-dist)))) + (f0-4 (sphere-on-platform-test s3-1 (-> this mesh-cache-tris 0) s2-2 (-> arg0 prim-core world-sphere) (-> arg1 best-dist)))) (when (< f0-4 (-> arg1 best-dist)) (set! (-> arg1 best-dist) f0-4) (set! (-> arg1 best-from-prim) this) @@ -115,7 +111,7 @@ *collide-player-list* (let ((s3-0 (-> v1-7 next0))) (while (!= v1-7 (-> *collide-player-list* alive-list-end)) - (let* ((s2-0 (-> (the-as connection v1-7) param1)) + (let* ((s2-0 (the-as object (-> (the-as connection v1-7) param1))) (v1-8 (-> (the-as collide-shape s2-0) root-prim))) (when (logtest? s4-0 (-> v1-8 prim-core collide-as)) (when (and (logtest? (-> v1-8 prim-core action) (collide-action rider-target)) @@ -142,7 +138,7 @@ *collide-hit-by-player-list* (let ((s3-1 (-> v1-37 next0))) (while (!= v1-37 (-> *collide-hit-by-player-list* alive-list-end)) - (let* ((s2-1 (-> (the-as connection v1-37) param1)) + (let* ((s2-1 (the-as object (-> (the-as connection v1-37) param1))) (v1-38 (-> (the-as collide-shape s2-1) root-prim))) (when (logtest? s4-0 (-> v1-38 prim-core collide-as)) (when (and (logtest? (-> v1-38 prim-core action) (collide-action rider-target)) @@ -168,7 +164,7 @@ *collide-usually-hit-by-player-list* (let ((s3-2 (-> v1-66 next0))) (while (!= v1-66 (-> *collide-usually-hit-by-player-list* alive-list-end)) - (let* ((s2-2 (-> (the-as connection v1-66) param1)) + (let* ((s2-2 (the-as object (-> (the-as connection v1-66) param1))) (v1-67 (-> (the-as collide-shape s2-2) root-prim))) (when (logtest? s4-0 (-> v1-67 prim-core collide-as)) (when (and (logtest? (-> v1-67 prim-core action) (collide-action rider-target)) @@ -194,7 +190,7 @@ *collide-hit-by-others-list* (let ((s3-3 (-> v1-94 next0))) (while (!= v1-94 (-> *collide-hit-by-others-list* alive-list-end)) - (let* ((s2-3 (-> (the-as connection v1-94) param1)) + (let* ((s2-3 (the-as object (-> (the-as connection v1-94) param1))) (v1-95 (-> (the-as collide-shape s2-3) root-prim))) (when (logtest? s4-0 (-> v1-95 prim-core collide-as)) (when (and (logtest? (-> v1-95 prim-core action) (collide-action rider-target)) @@ -240,7 +236,7 @@ (defmethod pull-rider! ((this collide-shape) (arg0 pull-rider-info)) "Move a rider." - (local-vars (at-0 int) (sv-160 (function collide-shape-moving float collide-kind none))) + (local-vars (at-0 int)) (rlet ((vf0 :class vf) (vf1 :class vf) (vf2 :class vf)) @@ -254,11 +250,7 @@ ((logtest? (-> this root-prim prim-core action) (collide-action rider-plat)) (let ((s1-0 (-> this root-prim prim-core collide-as))) (set! (-> this root-prim prim-core collide-as) (collide-kind)) - (let ((s0-0 gp-0)) - (set! sv-160 (method-of-object s0-0 fill-cache-for-shape!)) - (let ((a1-3 (+ 8192.0 (vector-length s3-0))) - (a2-0 (-> gp-0 root-prim collide-with))) - (sv-160 s0-0 a1-3 a2-0))) + (fill-cache-for-shape! gp-0 (+ 8192.0 (vector-length s3-0)) (-> gp-0 root-prim collide-with)) (set! (-> this root-prim prim-core collide-as) s1-0)) (let ((s2-1 (new 'stack-no-clear 'vector))) (set! (-> s2-1 quad) (-> s3-0 quad)) diff --git a/goal_src/jak1/engine/collide/surface-h.gc b/goal_src/jak1/engine/collide/surface-h.gc index 3f7876b88b..49951261e9 100644 --- a/goal_src/jak1/engine/collide/surface-h.gc +++ b/goal_src/jak1/engine/collide/surface-h.gc @@ -83,10 +83,10 @@ (- (* (/ (- (/ arg0 60) arg1) arg2) (- 1.0 arg2)) arg1)) (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)))))) + (let ((f0-4 (sqrtf (/ (- (/ arg0 60) arg1) arg2)))) (- f0-4 (+ arg1 (* arg2 (square f0-4)))))) (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)))))) + (let ((f0-5 (sqrtf (sqrtf (/ (- (/ arg0 60) arg1) arg2))))) (- f0-5 (+ arg1 (* arg2 (* (square f0-5) f0-5 f0-5)))))) (defmethod print ((this surface)) ;; seems this format string is wrong. diff --git a/goal_src/jak1/engine/common-obs/collectables.gc b/goal_src/jak1/engine/common-obs/collectables.gc index efa07e57ce..5040e61902 100644 --- a/goal_src/jak1/engine/common-obs/collectables.gc +++ b/goal_src/jak1/engine/common-obs/collectables.gc @@ -47,7 +47,6 @@ (initialize (_type_) _type_) (initialize-params (_type_ time-frame float) none))) - (defmethod initialize-params ((this collectable) (arg0 time-frame) (arg1 float)) (logclear! (-> this mask) (process-mask crate enemy platform ambient)) (logior! (-> this mask) (process-mask collectable)) @@ -102,7 +101,6 @@ (animate (_type_) none) (blocked () _type_ :state))) - (defmethod initialize ((this eco-collectable)) (stack-size-set! (-> this main-thread) 192) ;; og:preserve-this hack increased from 128 (logior! (-> this mask) (process-mask actor-pause)) @@ -537,7 +535,6 @@ (deftype eco (eco-collectable) ()) - (defmethod animate ((this eco)) (let ((a0-1 (-> this part)) (a1-0 (-> this root root-prim prim-core))) @@ -576,28 +573,24 @@ (deftype eco-yellow (eco) ()) - (defmethod init-from-entity! ((this eco-yellow) (arg0 entity-actor)) (initialize-eco this arg0 (pickup-type eco-yellow) (-> *FACT-bank* eco-single-inc)) (none)) (deftype eco-red (eco) ()) - (defmethod init-from-entity! ((this eco-red) (arg0 entity-actor)) (initialize-eco this arg0 (pickup-type eco-red) (-> *FACT-bank* eco-single-inc)) (none)) (deftype eco-blue (eco) ()) - (defmethod init-from-entity! ((this eco-blue) (arg0 entity-actor)) (initialize-eco this arg0 (pickup-type eco-blue) (-> *FACT-bank* eco-single-inc)) (none)) (deftype health (eco-collectable) ()) - (defmethod animate ((this health)) (let ((a0-1 (-> this part)) (a1-0 (-> this root root-prim prim-core))) @@ -612,7 +605,6 @@ (deftype eco-pill (eco-collectable) ()) - (defmethod animate ((this eco-pill)) (let ((a0-1 (-> this part)) (a1-0 (-> this root root-prim prim-core))) @@ -669,7 +661,6 @@ (deftype money (eco-collectable) ()) - (defmethod run-logic? ((this money)) (or (not (logtest? (-> this mask) (process-mask actor-pause))) (or (and (nonzero? (-> this draw)) @@ -764,7 +755,7 @@ (set-vector! (-> this draw color-mult) 0.8 0.8 0.8 1.0) (set-vector! (-> this draw color-emissive) 0.2 0.2 0.2 1.0) ;; og:preserve-this added money starburst - (set! (-> this part) (create-launch-control (-> *part-group-id-table* 64) this)) + (set! (-> this part) (create-launch-control group-money-starburst this)) this) (defmethod init-from-entity! ((this money) (arg0 entity-actor)) @@ -823,7 +814,6 @@ (:states (fuel-cell-clone-anim handle) (fuel-cell-spline-slider handle float float))) - (defun fuel-cell-pick-anim ((arg0 process-drawable)) (let* ((gp-0 (-> arg0 entity extra trans)) (a0-2 (res-lump-value (-> arg0 entity) 'movie-mask uint128 :time (the-as float -1000000000.0))) @@ -966,7 +956,6 @@ (send-event *camera* 'teleport-to-other-start-string))))) :code (behavior ((arg0 object) (arg1 handle)) - (local-vars (sv-96 res-tag)) (sound-play "pu-powercell") (clear-collide-with-as (-> self root)) (logclear! (-> self mask) (process-mask actor-pause)) @@ -985,8 +974,8 @@ (spool-push *art-control* (-> self victory-anim name) 0 self (the-as float -99.0)) (format #t "WARNING: fuel-cell stall on not cloning.~%") (suspend)) - (set! sv-96 (new 'static 'res-tag)) - (let* ((v1-34 (res-lump-data (-> self entity) 'movie-pos (inline-array vector) :tag-ptr (& sv-96) :time (the-as float -1000000000.0))) + (let* ((sv-96 (new 'static 'res-tag)) + (v1-34 (res-lump-data (-> self entity) 'movie-pos (inline-array vector) :tag-ptr (& sv-96) :time (the-as float -1000000000.0))) (gp-1 (if (and v1-34 (< (-> self movie-pos-index) (the-as int (-> sv-96 elt-count)))) (-> v1-34 (-> self movie-pos-index)) (the-as vector #f)))) @@ -1230,7 +1219,6 @@ (deftype buzzer (eco-collectable) ((victory-anim spool-anim))) - (defmethod animate ((this buzzer)) (quaternion-rotate-y! (-> this root quat) (-> this root quat) (* 40049.777 (seconds-per-frame))) (let ((a0-2 (-> this skel root-channel 0))) @@ -1397,20 +1385,9 @@ (v1-52 symbol) (v1-58 symbol) (v1-64 symbol) - (v1-71 symbol) - (sv-32 fact-info) - (sv-48 int) - (sv-64 process) - (sv-80 process) - (sv-96 process) - (sv-112 process) - (sv-128 process) - (sv-144 process) - (sv-160 process) - (sv-176 process) - (sv-192 (pointer process))) - (set! sv-32 arg5) - (let ((s1-0 (new-stack-vector0)) + (v1-71 symbol)) + (let ((sv-32 arg5) + (s1-0 (new-stack-vector0)) (t9-0 (method-of-type res-lump get-property-value-float))) (let ((v1-1 sv-32)) (b! (not v1-1) cfg-3 :likely-delay (set! v1-2 sv-32))) (set! v1-2 (nonzero? (-> sv-32 process))) @@ -1425,111 +1402,107 @@ ((= arg2 1.0) 409.6) (else 8192.0))) (the-as (pointer res-tag) #f) - *res-static-buf*))) - (set! sv-192 (the-as (pointer process) #f)) - (set! sv-48 (the int arg2)) - (let ((s0-0 (new 'static 'fact-info))) + *res-static-buf*)) + (sv-192 (the-as (pointer process) #f))) + (let ((sv-48 (the int arg2)) + (s0-0 (new 'static 'fact-info))) (set! (-> s0-0 options) (fact-options)) (if sv-32 (mem-copy! (&-> s0-0 type) (&-> sv-32 type) 40)) (set! (-> s0-0 pickup-type) arg1) (set! (-> s0-0 pickup-spawn-amount) 1.0) (while (> sv-48 0) - (set! sv-48 (+ sv-48 -1)) + (+! sv-48 -1) (when arg3 (set-vector! s1-0 0.0 57001.605 f30-0 1.0) (vector-rotate-around-y! s1-0 s1-0 (/ (* 65536.0 (the float sv-48)) arg2))) (let ((v1-25 arg1)) (cond ((= v1-25 (pickup-type eco-yellow)) - (set! sv-64 (get-process *pickup-dead-pool* eco-yellow #x4000)) - (set! v1-28 - (when sv-64 - (set! sv-192 (the-as (pointer process) v1-28)) - (let ((t9-4 (method-of-type eco-yellow activate))) - (t9-4 (the-as eco-yellow sv-64) arg4 'eco-yellow (the-as pointer #x70004000))) - (run-now-in-process sv-64 initialize-eco-by-other arg0 s1-0 s0-0) - (set! sv-192 (-> sv-64 ppointer)) - v1-28)) + (let ((sv-64 (get-process *pickup-dead-pool* eco-yellow #x4000))) + (set! v1-28 + (when sv-64 + (set! sv-192 (the-as (pointer process) v1-28)) + ((method-of-type eco-yellow activate) (the-as eco-yellow sv-64) arg4 'eco-yellow (the-as pointer #x70004000)) + (run-now-in-process sv-64 initialize-eco-by-other arg0 s1-0 s0-0) + (set! sv-192 (-> sv-64 ppointer)) + v1-28))) sv-192) ((= v1-25 (pickup-type eco-red)) - (set! sv-80 (get-process *pickup-dead-pool* eco-red #x4000)) - (set! v1-34 - (when sv-80 - (set! sv-192 (the-as (pointer process) v1-34)) - (let ((t9-7 (method-of-type eco-red activate))) (t9-7 (the-as eco-red sv-80) arg4 'eco-red (the-as pointer #x70004000))) - (run-now-in-process sv-80 initialize-eco-by-other arg0 s1-0 s0-0) - (set! sv-192 (-> sv-80 ppointer)) - v1-34)) + (let ((sv-80 (get-process *pickup-dead-pool* eco-red #x4000))) + (set! v1-34 + (when sv-80 + (set! sv-192 (the-as (pointer process) v1-34)) + ((method-of-type eco-red activate) (the-as eco-red sv-80) arg4 'eco-red (the-as pointer #x70004000)) + (run-now-in-process sv-80 initialize-eco-by-other arg0 s1-0 s0-0) + (set! sv-192 (-> sv-80 ppointer)) + v1-34))) (level-hint-spawn (text-id misty-eco-red-hint) "sksp0071" (the-as entity #f) *entity-pool* (game-task none))) ((= v1-25 (pickup-type eco-blue)) - (set! sv-96 (get-process *pickup-dead-pool* eco-blue #x4000)) - (set! v1-40 - (when sv-96 - (set! sv-192 (the-as (pointer process) v1-40)) - (let ((t9-11 (method-of-type eco-blue activate))) - (t9-11 (the-as eco-blue sv-96) arg4 'eco-blue (the-as pointer #x70004000))) - (run-now-in-process sv-96 initialize-eco-by-other arg0 s1-0 s0-0) - (set! sv-192 (-> sv-96 ppointer)) - v1-40)) + (let ((sv-96 (get-process *pickup-dead-pool* eco-blue #x4000))) + (set! v1-40 + (when sv-96 + (set! sv-192 (the-as (pointer process) v1-40)) + ((method-of-type eco-blue activate) (the-as eco-blue sv-96) arg4 'eco-blue (the-as pointer #x70004000)) + (run-now-in-process sv-96 initialize-eco-by-other arg0 s1-0 s0-0) + (set! sv-192 (-> sv-96 ppointer)) + v1-40))) sv-192) ((= v1-25 (pickup-type eco-green)) - (set! sv-112 (get-process *pickup-dead-pool* health #x4000)) - (set! v1-46 - (when sv-112 - (set! sv-192 (the-as (pointer process) v1-46)) - (let ((t9-14 (method-of-type health activate))) (t9-14 (the-as health sv-112) arg4 'health (the-as pointer #x70004000))) - (run-now-in-process sv-112 initialize-eco-by-other arg0 s1-0 s0-0) - (set! sv-192 (-> sv-112 ppointer)) - v1-46)) + (let ((sv-112 (get-process *pickup-dead-pool* health #x4000))) + (set! v1-46 + (when sv-112 + (set! sv-192 (the-as (pointer process) v1-46)) + ((method-of-type health activate) (the-as health sv-112) arg4 'health (the-as pointer #x70004000)) + (run-now-in-process sv-112 initialize-eco-by-other arg0 s1-0 s0-0) + (set! sv-192 (-> sv-112 ppointer)) + v1-46))) sv-192) ((= v1-25 (pickup-type eco-pill)) - (set! sv-128 (get-process *pickup-dead-pool* eco-pill #x4000)) - (set! v1-52 - (when sv-128 - (set! sv-192 (the-as (pointer process) v1-52)) - (let ((t9-17 (method-of-type eco-pill activate))) - (t9-17 (the-as eco-pill sv-128) arg4 'eco-pill (the-as pointer #x70004000))) - (run-now-in-process sv-128 initialize-eco-by-other arg0 s1-0 s0-0) - (set! sv-192 (-> sv-128 ppointer)) - v1-52)) + (let ((sv-128 (get-process *pickup-dead-pool* eco-pill #x4000))) + (set! v1-52 + (when sv-128 + (set! sv-192 (the-as (pointer process) v1-52)) + ((method-of-type eco-pill activate) (the-as eco-pill sv-128) arg4 'eco-pill (the-as pointer #x70004000)) + (run-now-in-process sv-128 initialize-eco-by-other arg0 s1-0 s0-0) + (set! sv-192 (-> sv-128 ppointer)) + v1-52))) sv-192) ((= v1-25 (pickup-type money)) - (set! sv-144 (get-process *pickup-dead-pool* money #x4000)) - (set! v1-58 - (when sv-144 - (set! sv-192 (the-as (pointer process) v1-58)) - (let ((t9-20 (method-of-type money activate))) (t9-20 (the-as money sv-144) arg4 'money (the-as pointer #x70004000))) - (run-now-in-process sv-144 money-init-by-other arg0 s1-0 s0-0 (-> self entity)) - (set! sv-192 (-> sv-144 ppointer)) - v1-58)) + (let ((sv-144 (get-process *pickup-dead-pool* money #x4000))) + (set! v1-58 + (when sv-144 + (set! sv-192 (the-as (pointer process) v1-58)) + ((method-of-type money activate) (the-as money sv-144) arg4 'money (the-as pointer #x70004000)) + (run-now-in-process sv-144 money-init-by-other arg0 s1-0 s0-0 (-> self entity)) + (set! sv-192 (-> sv-144 ppointer)) + v1-58))) sv-192) ((= v1-25 (pickup-type fuel-cell)) (set! (-> s0-0 pickup-spawn-amount) arg2) - (set! sv-160 (get-process *pickup-dead-pool* fuel-cell #x4000)) - (set! v1-64 - (when sv-160 - (set! sv-192 (the-as (pointer process) v1-64)) - (let ((t9-23 (method-of-type fuel-cell activate))) - (t9-23 (the-as fuel-cell sv-160) arg4 'fuel-cell (the-as pointer #x70004000))) - (run-now-in-process sv-160 fuel-cell-init-by-other arg0 s1-0 s0-0 (-> self entity)) - (set! sv-192 (-> sv-160 ppointer)) - v1-64)) + (let ((sv-160 (get-process *pickup-dead-pool* fuel-cell #x4000))) + (set! v1-64 + (when sv-160 + (set! sv-192 (the-as (pointer process) v1-64)) + ((method-of-type fuel-cell activate) (the-as fuel-cell sv-160) arg4 'fuel-cell (the-as pointer #x70004000)) + (run-now-in-process sv-160 fuel-cell-init-by-other arg0 s1-0 s0-0 (-> self entity)) + (set! sv-192 (-> sv-160 ppointer)) + v1-64))) (set! sv-48 0) sv-48) ((= v1-25 (pickup-type buzzer)) (set! (-> s0-0 pickup-spawn-amount) arg2) - (set! sv-176 (get-process *pickup-dead-pool* buzzer #x4000)) - (set! v1-71 - (when sv-176 - (set! sv-192 (the-as (pointer process) v1-71)) - (let ((t9-26 (method-of-type buzzer activate))) (t9-26 (the-as buzzer sv-176) arg4 'buzzer (the-as pointer #x70004000))) - (run-now-in-process sv-176 buzzer-init-by-other arg0 s1-0 s0-0 (-> self entity)) - (set! sv-192 (-> sv-176 ppointer)) - v1-71)) + (let ((sv-176 (get-process *pickup-dead-pool* buzzer #x4000))) + (set! v1-71 + (when sv-176 + (set! sv-192 (the-as (pointer process) v1-71)) + ((method-of-type buzzer activate) (the-as buzzer sv-176) arg4 'buzzer (the-as pointer #x70004000)) + (run-now-in-process sv-176 buzzer-init-by-other arg0 s1-0 s0-0 (-> self entity)) + (set! sv-192 (-> sv-176 ppointer)) + v1-71))) (set! sv-48 0) sv-48) - (else (format 0 "ERROR: unknown type of eco ~d~%" arg1) #f))))))) - sv-192) + (else (format 0 "ERROR: unknown type of eco ~d~%" arg1) #f))))) + sv-192))) (defmethod drop-pickup ((this fact-info) (arg0 symbol) (arg1 process-tree) (arg2 fact-info) (arg3 int)) (let ((s3-0 (-> this pickup-type)) @@ -1576,7 +1549,6 @@ (:states ecovalve-idle)) - (defskelgroup *ecovalve-sg* ecovalve ecovalve-geo-jg @@ -1648,7 +1620,6 @@ (vent-pickup handle) vent-wait-for-touch)) - (defmethod initialize ((this vent) (arg0 entity-actor) (arg1 pickup-type)) (stack-size-set! (-> this main-thread) 128) (logior! (-> this mask) (process-mask actor-pause)) @@ -1790,28 +1761,24 @@ (deftype ventyellow (vent) ()) - (defmethod init-from-entity! ((this ventyellow) (arg0 entity-actor)) (initialize this arg0 (pickup-type eco-yellow)) (none)) (deftype ventred (vent) ()) - (defmethod init-from-entity! ((this ventred) (arg0 entity-actor)) (initialize this arg0 (pickup-type eco-red)) (none)) (deftype ventblue (vent) ()) - (defmethod init-from-entity! ((this ventblue) (arg0 entity-actor)) (initialize this arg0 (pickup-type eco-blue)) (none)) (deftype ecovent (vent) ()) - (defmethod init-from-entity! ((this ecovent) (arg0 entity-actor)) (initialize this arg0 (pickup-type eco-blue)) (none)) diff --git a/goal_src/jak1/engine/common-obs/dark-eco-pool.gc b/goal_src/jak1/engine/common-obs/dark-eco-pool.gc index 35c5b4c600..d956004cd1 100644 --- a/goal_src/jak1/engine/common-obs/dark-eco-pool.gc +++ b/goal_src/jak1/engine/common-obs/dark-eco-pool.gc @@ -314,8 +314,7 @@ (let ((t9-0 (-> (method-of-type water-anim water-vol-idle) trans))) (if t9-0 (t9-0))) (let* ((gp-0 (-> self draw ripple)) (f0-1 (the float (logand (current-time) #xffff))) - (f0-3 (cos (* 5.0 f0-1))) - (f30-0 (* f0-3 f0-3))) + (f30-0 (square (cos (* 5.0 f0-1))))) (let ((s5-0 (-> self draw ripple query))) (set! (-> self draw ripple send-query) #t) (set! (-> s5-0 start-vertex) (rand-vu-int-range 0 255)) diff --git a/goal_src/jak1/engine/common-obs/generic-obs.gc b/goal_src/jak1/engine/common-obs/generic-obs.gc index 36b84bb0d4..517f09cf0a 100644 --- a/goal_src/jak1/engine/common-obs/generic-obs.gc +++ b/goal_src/jak1/engine/common-obs/generic-obs.gc @@ -406,7 +406,7 @@ (defbehavior command-get-process camera-tracker ((arg0 object) (arg1 process)) (the-as process (cond - ((null? arg0) arg1) + ((null? arg0) (empty) arg1) ((type-type? (rtype-of arg0) process) (the-as process arg0)) ((= arg0 'target) *target*) ((= arg0 'sidekick) (when *target* (let ((v1-6 (-> *target* sidekick))) (if v1-6 (the-as process (-> v1-6 0 self)))))) @@ -421,8 +421,8 @@ ((= arg0 'look-at) (handle->process (-> v1-13 look-at-target))) ((= arg0 'pov) (handle->process (-> v1-13 pov-target))) ((= arg0 'anim) (handle->process (-> v1-13 anim-process))) - (else arg1)))) - (else arg1)))) + (else (empty) arg1)))) + (else (empty) arg1)))) (defun command-get-camera ((arg0 object) (arg1 state)) (cond @@ -437,7 +437,7 @@ (defun command-get-trans ((arg0 object) (arg1 vector)) (cond - ((null? arg0) arg1) + ((null? arg0) (empty) arg1) ((= arg0 'null) *null-vector*) ((= arg0 'target) (target-pos 0)) ((pair? arg0) @@ -445,8 +445,8 @@ (v1-4 (command-get-int (car (cdr arg0)) 0))) (cond (s4-0 (-> (the-as target s4-0) node-list data v1-4 bone transform vector 3)) - (else arg1)))) - (else arg1))) + (else (empty) arg1)))) + (else (empty) arg1))) (defbehavior process-grab? camera-tracker ((arg0 process)) (let ((gp-0 (command-get-process arg0 *target*))) @@ -724,12 +724,11 @@ (define *lev-string* (new 'global 'string 64 (the-as string #f))) (defmethod init-from-entity! ((this med-res-level) (arg0 entity-actor)) - (local-vars (sv-16 res-tag)) (stack-size-set! (-> this main-thread) 128) "#f" (let ((s4-0 (the-as (pointer sparticle-launch-group) #f))) - (set! sv-16 (new 'static 'res-tag)) - (let* ((s3-0 (res-lump-data arg0 'art-name (pointer symbol) :tag-ptr (& sv-16))) + (let* ((sv-16 (new 'static 'res-tag)) + (s3-0 (res-lump-data arg0 'art-name (pointer symbol) :tag-ptr (& sv-16))) (s2-0 (-> s3-0 0))) (cond ((not s3-0)) @@ -781,7 +780,6 @@ (suspend)))) (defmethod init-from-entity! ((this part-spawner) (arg0 entity-actor)) - (local-vars (sv-16 res-tag)) (stack-size-set! (-> this main-thread) 128) (logior! (-> this mask) (process-mask ambient)) (set! (-> this root) (new 'process 'trsqv)) @@ -793,8 +791,8 @@ (set! (-> this sound) (new 'process 'ambient-sound (-> this entity) (-> this root trans))) (let ((s4-0 (the-as object "#f"))) (let ((s3-0 (the-as (pointer sparticle-launch-group) #f))) - (set! sv-16 (new 'static 'res-tag)) - (let* ((s5-1 (res-lump-data arg0 'art-name (pointer (pointer sparticle-launch-group)) :tag-ptr (& sv-16))) + (let* ((sv-16 (new 'static 'res-tag)) + (s5-1 (res-lump-data arg0 'art-name (pointer (pointer sparticle-launch-group)) :tag-ptr (& sv-16))) (s2-0 (-> s5-1 0))) (cond ((part-group-pointer? s2-0) (set! s3-0 (-> s5-1 0))) diff --git a/goal_src/jak1/engine/common-obs/nav-enemy.gc b/goal_src/jak1/engine/common-obs/nav-enemy.gc index 3f5385ca69..dfa1c75b05 100644 --- a/goal_src/jak1/engine/common-obs/nav-enemy.gc +++ b/goal_src/jak1/engine/common-obs/nav-enemy.gc @@ -66,7 +66,7 @@ (when *target* (if *target* (look-at-enemy! (-> *target* neck) - (the-as vector (-> this collide-info root-prim prim-core)) + (-> this collide-info root-prim prim-core world-sphere) (if (logtest? (-> this nav-enemy-flags) (nav-enemy-flags navenmf2)) 'attacking) this)) (if (and (nonzero? (-> this neck)) (logtest? (-> this nav-enemy-flags) (nav-enemy-flags navenmf14))) @@ -1198,7 +1198,6 @@ nav-enemy-default-event-handler (countdown (v1-9 (-> gp-0 num-spheres)) (let* ((a0-10 (-> gp-0 sphere v1-9)) (f2-2 (- (-> a0-10 x) f0-1)) - (f3-1 (- (-> a0-10 z) f1-2)) - (f4-0 (-> a0-10 w))) - (if (>= (* f4-0 f4-0) (+ (* f2-2 f2-2) (* f3-1 f3-1))) (return #t))))))) + (f3-1 (- (-> a0-10 z) f1-2))) + (if (>= (square (-> a0-10 w)) (+ (square f2-2) (square f3-1))) (return #t))))))) #f) diff --git a/goal_src/jak1/engine/common-obs/rigid-body.gc b/goal_src/jak1/engine/common-obs/rigid-body.gc index bda78a666c..936a4ed483 100644 --- a/goal_src/jak1/engine/common-obs/rigid-body.gc +++ b/goal_src/jak1/engine/common-obs/rigid-body.gc @@ -55,18 +55,9 @@ (let* ((f0-4 arg0) (f1-1 12.0) (f0-5 (* f0-4 (/ 1.0 f1-1)))) - (let* ((f1-4 arg2) - (f1-6 (* f1-4 f1-4)) - (f2-1 arg3)) - (set! (-> this inertial-tensor vector 0 x) (* f0-5 (+ f1-6 (* f2-1 f2-1))))) - (let* ((f1-9 arg1) - (f1-11 (* f1-9 f1-9)) - (f2-4 arg3)) - (set! (-> this inertial-tensor vector 1 y) (* f0-5 (+ f1-11 (* f2-4 f2-4))))) - (let* ((f1-14 arg1) - (f1-16 (* f1-14 f1-14)) - (f2-7 arg2)) - (set! (-> this inertial-tensor vector 2 z) (* f0-5 (+ f1-16 (* f2-7 f2-7)))))) + (set! (-> this inertial-tensor vector 0 x) (* f0-5 (+ (square arg2) (square arg3)))) + (set! (-> this inertial-tensor vector 1 y) (* f0-5 (+ (square arg1) (square arg3)))) + (set! (-> this inertial-tensor vector 2 z) (* f0-5 (+ (square arg1) (square arg2))))) (let ((f0-7 (-> this inertial-tensor vector 0 x))) (set! (-> this inv-inertial-tensor vector 0 x) (/ 1.0 f0-7))) (let ((f0-10 (-> this inertial-tensor vector 1 y))) (set! (-> this inv-inertial-tensor vector 1 y) (/ 1.0 f0-10))) (let ((f0-13 (-> this inertial-tensor vector 2 z))) (set! (-> this inv-inertial-tensor vector 2 z) (/ 1.0 f0-13))) diff --git a/goal_src/jak1/engine/common-obs/water-anim.gc b/goal_src/jak1/engine/common-obs/water-anim.gc index 5397ebfc38..1ab8c9aa74 100644 --- a/goal_src/jak1/engine/common-obs/water-anim.gc +++ b/goal_src/jak1/engine/common-obs/water-anim.gc @@ -4,6 +4,55 @@ (require "engine/common-obs/process-drawable.gc") (require "engine/gfx/foreground/ripple.gc") (require "engine/common-obs/water-h.gc") +(defenum water-look + (water-anim-sunken-big-room 0) + (water-anim-sunken-first-room-from-entrance 1) + (water-anim-sunken-qbert-room 2) + (water-anim-sunken-first-right-branch 3) + (water-anim-sunken-circular-with-bullys 4) + (water-anim-sunken-hall-with-one-whirlpool 5) + (water-anim-sunken-hall-with-three-whirlpools 6) + (water-anim-sunken-start-of-helix-slide 7) + (water-anim-sunken-room-above-exit-chamber 8) + (water-anim-sunken-hall-before-big-room 9) + (water-anim-sunken-dark-eco-qbert 10) + (water-anim-sunken-short-piece 11) + (water-anim-sunken-big-room-upper-water 12) + (water-anim-sunken-dark-eco-platform-room 13) + (water-anim-maincave-water-with-crystal 14) + (water-anim-maincave-center-pool 15) + (water-anim-maincave-lower-right-pool 16) + (water-anim-maincave-mid-right-pool 17) + (water-anim-maincave-lower-left-pool 18) + (water-anim-maincave-mid-left-pool 19) + (water-anim-robocave-main-pool 20) + (water-anim-misty-mud-by-arena 21) + (water-anim-misty-mud-above-skeleton 22) + (water-anim-misty-mud-behind-skeleton 23) + (water-anim-misty-mud-above-skull-back 24) + (water-anim-misty-mud-above-skull-front 25) + (water-anim-misty-mud-other-near-skull 26) + (water-anim-misty-mud-near-skull 27) + (water-anim-misty-mud-under-spine 28) + (water-anim-misty-mud-by-dock 29) + (water-anim-misty-mud-island-near-dock 30) + (water-anim-misty-mud-lonely-island 31) + (water-anim-misty-dark-eco-pool 32) + (water-anim-ogre-lava 33) + (water-anim-jungle-river 34) + (water-anim-village3-lava 35) + (water-anim-training-lake 36) + (water-anim-darkcave-water-with-crystal 37) + (water-anim-rolling-water-back 38) + (water-anim-rolling-water-front 39) + (water-anim-sunken-dark-eco-helix-room 40) + (water-anim-finalboss-dark-eco-pool 41) + (water-anim-lavatube-energy-lava 42) + (water-anim-village1-rice-paddy 43) + (water-anim-village1-fountain 44) + (water-anim-village1-rice-paddy-mid 45) + (water-anim-village1-rice-paddy-top 46) + (water-anim-village2-bucket 47)) ;; DECOMP BEGINS @@ -353,57 +402,6 @@ (anim int32) (ambient-sound-spec sound-spec))) -;; og:preserve-this added -(defenum water-look - (water-anim-sunken-big-room 0) - (water-anim-sunken-first-room-from-entrance 1) - (water-anim-sunken-qbert-room 2) - (water-anim-sunken-first-right-branch 3) - (water-anim-sunken-circular-with-bullys 4) - (water-anim-sunken-hall-with-one-whirlpool 5) - (water-anim-sunken-hall-with-three-whirlpools 6) - (water-anim-sunken-start-of-helix-slide 7) - (water-anim-sunken-room-above-exit-chamber 8) - (water-anim-sunken-hall-before-big-room 9) - (water-anim-sunken-dark-eco-qbert 10) - (water-anim-sunken-short-piece 11) - (water-anim-sunken-big-room-upper-water 12) - (water-anim-sunken-dark-eco-platform-room 13) - (water-anim-maincave-water-with-crystal 14) - (water-anim-maincave-center-pool 15) - (water-anim-maincave-lower-right-pool 16) - (water-anim-maincave-mid-right-pool 17) - (water-anim-maincave-lower-left-pool 18) - (water-anim-maincave-mid-left-pool 19) - (water-anim-robocave-main-pool 20) - (water-anim-misty-mud-by-arena 21) - (water-anim-misty-mud-above-skeleton 22) - (water-anim-misty-mud-behind-skeleton 23) - (water-anim-misty-mud-above-skull-back 24) - (water-anim-misty-mud-above-skull-front 25) - (water-anim-misty-mud-other-near-skull 26) - (water-anim-misty-mud-near-skull 27) - (water-anim-misty-mud-under-spine 28) - (water-anim-misty-mud-by-dock 29) - (water-anim-misty-mud-island-near-dock 30) - (water-anim-misty-mud-lonely-island 31) - (water-anim-misty-dark-eco-pool 32) - (water-anim-ogre-lava 33) - (water-anim-jungle-river 34) - (water-anim-village3-lava 35) - (water-anim-training-lake 36) - (water-anim-darkcave-water-with-crystal 37) - (water-anim-rolling-water-back 38) - (water-anim-rolling-water-front 39) - (water-anim-sunken-dark-eco-helix-room 40) - (water-anim-finalboss-dark-eco-pool 41) - (water-anim-lavatube-energy-lava 42) - (water-anim-village1-rice-paddy 43) - (water-anim-village1-fountain 44) - (water-anim-village1-rice-paddy-mid 45) - (water-anim-village1-rice-paddy-top 46) - (water-anim-village2-bucket 47)) - (define *water-anim-look* (new 'static 'boxed-array @@ -604,11 +602,10 @@ (none)) (defmethod water-vol-method-25 ((this water-anim)) - (local-vars (sv-16 res-tag)) (set! (-> this play-ambient-sound?) #t) (set! (-> this look) (res-lump-value (-> this entity) 'look int :default (the-as uint128 -1))) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-3 (res-lump-data (-> this entity) 'trans-offset (pointer float) :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-3 (res-lump-data (-> this entity) 'trans-offset (pointer float) :tag-ptr (& sv-16)))) (when v1-3 (+! (-> this root trans x) (-> v1-3 0)) (+! (-> this root trans y) (-> v1-3 1)) diff --git a/goal_src/jak1/engine/common-obs/water.gc b/goal_src/jak1/engine/common-obs/water.gc index 788baac62d..95184de2e9 100644 --- a/goal_src/jak1/engine/common-obs/water.gc +++ b/goal_src/jak1/engine/common-obs/water.gc @@ -996,7 +996,6 @@ (none)) (defmethod init! ((this water-vol)) - (local-vars (sv-16 res-tag)) (set! (-> this attack-event) (the-as symbol ((method-of-type res-lump get-property-struct) @@ -1013,16 +1012,16 @@ (logior! (-> this vol flags) 3) (set! (-> this bottom-height) 32768.0) (set! (-> this target) (the-as handle #f)) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-8 (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-8 (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-8 (set! (-> this water-height) (-> v1-8 0)) (set! (-> this wade-height) (-> v1-8 1)) diff --git a/goal_src/jak1/engine/debug/anim-tester.gc b/goal_src/jak1/engine/debug/anim-tester.gc index 035d73ba2e..7d881bb620 100644 --- a/goal_src/jak1/engine/debug/anim-tester.gc +++ b/goal_src/jak1/engine/debug/anim-tester.gc @@ -548,12 +548,7 @@ (let ((s2-2 draw-string-adv)) (format (clear *temp-string*) "~Smax" arg0) (s2-2 *temp-string* s3-0 arg3))) (else (let ((s0-0 draw-string-adv)) - (set! sv-16 format) - (let ((a0-11 (clear *temp-string*)) - (a1-5 "~S~3,,0f") - (a2-5 arg0) - (a3-1 (+ arg1 arg2))) - (sv-16 a0-11 a1-5 a2-5 a3-1)) + (format (clear *temp-string*) "~S~3,,0f" arg0 (+ arg1 arg2)) (s0-0 *temp-string* s3-0 arg3)))) (let ((a3-2 (-> s3-0 base))) (let ((v1-6 (the-as object (-> s3-0 base)))) @@ -928,9 +923,6 @@ (none)) (defun anim-test-edit-sequence-list-handler ((arg0 int) (arg1 list-control)) - (local-vars - (sv-192 (function string dma-buffer int int font-color font-flags float)) - (sv-208 (function _varargs_ object))) (let ((gp-0 (-> arg1 the-node)) (s4-0 (the-as object (-> arg1 list-owner))) (s2-0 (and (logtest? (-> *anim-tester* 0 flags) (anim-tester-flags fanimt3)) (zero? (-> *anim-tester* 0 item-field))))) @@ -968,21 +960,19 @@ (the-as (pointer dma-tag) a3-4)))))) (let* ((s0-1 (-> *display* frames (-> *display* on-screen) frame debug-buf)) (s1-1 (-> s0-1 base))) - (set! sv-192 draw-string-xy) - (set! sv-208 format) - (let ((a0-18 (clear *temp-string*)) - (a1-7 "~S~S~-27S") - (a2-11 (if (= (-> arg1 the-index) (-> arg1 highlight-index)) ">" " ")) - (a3-6 (if (= (-> arg1 the-index) (-> (the-as anim-test-sequence s4-0) playing-item)) "*" " ")) - (t0-2 (-> (the-as anim-test-seq-item gp-0) privname))) - (sv-208 a0-18 a1-7 a2-11 a3-6 t0-2)) - (let ((a0-19 *temp-string*) - (a1-8 s0-1) - (a2-12 (-> arg1 xpos)) - (a3-7 (-> arg1 ypos)) - (t0-4 (if (= (-> arg1 the-index) (-> arg1 current-index)) 15 12)) - (t1-2 3)) - (sv-192 a0-19 a1-8 a2-12 a3-7 (the-as font-color t0-4) (the-as font-flags t1-2))) + (let ((sv-192 draw-string-xy)) + (let ((sv-208 format)) + (sv-208 (clear *temp-string*) + "~S~S~-27S" + (if (= (-> arg1 the-index) (-> arg1 highlight-index)) ">" " ") + (if (= (-> arg1 the-index) (-> (the-as anim-test-sequence s4-0) playing-item)) "*" " ") + (-> (the-as anim-test-seq-item gp-0) privname))) + (sv-192 *temp-string* + s0-1 + (-> arg1 xpos) + (-> arg1 ypos) + (if (= (-> arg1 the-index) (-> arg1 current-index)) (font-color menu-flag-on) (font-color menu)) + (font-flags shadow kerning))) (let ((a3-8 (-> s0-1 base))) (let ((v1-44 (the-as object (-> s0-1 base)))) (set! (-> (the-as dma-packet v1-44) dma) (new 'static 'dma-tag :id (dma-tag-id next))) @@ -997,11 +987,9 @@ (let* ((s2-2 (-> *display* frames (-> *display* on-screen) frame debug-buf)) (s4-1 (the-as anim-test-sequence (-> s2-2 base)))) (when (not (logtest? (-> (the-as anim-test-seq-item gp-0) flags) 1)) - (let ((v1-57 s3-0) - (a1-13 (+ (-> arg1 xpos) (* (-> *ANIM_TESTER-bank* EDIT_STATS_X) (-> *DISP_LIST-bank* CHAR_WIDTH)))) - (a0-29 (-> arg1 ypos))) - (set! (-> v1-57 origin x) (the float a1-13)) - (set! (-> v1-57 origin y) (the float a0-29))) + (set-origin! s3-0 + (+ (-> arg1 xpos) (* (-> *ANIM_TESTER-bank* EDIT_STATS_X) (-> *DISP_LIST-bank* CHAR_WIDTH))) + (-> arg1 ypos)) (cond ((and (< (-> (the-as anim-test-seq-item gp-0) speed) 0) (< -100 (-> (the-as anim-test-seq-item gp-0) speed))) (let ((s1-2 draw-string-adv)) @@ -1573,7 +1561,6 @@ #f) (defun anim-tester-add-newobj ((arg0 anim-tester) (arg1 string) (arg2 art-group)) - (local-vars (sv-96 art-element) (sv-112 art-element) (sv-128 anim-test-obj)) (let ((s2-0 (the-as anim-test-obj #f)) (s5-0 (the-as anim-test-obj #f))) (let ((s1-0 (the-as art-element #f)) @@ -1581,18 +1568,18 @@ (dotimes (s3-0 (-> arg2 length)) (cond ((and (= (-> arg2 data s3-0 type) merc-ctrl) (not s2-0)) - (set! sv-96 (-> arg2 data s3-0)) - (set! s0-0 (and s2-0 s0-0)) - (if s0-0 (anim-test-obj-remove-invalid s2-0)) - (anim-tester-load-object-seqs arg0 (-> sv-96 name)) - (set! s2-0 (the-as anim-test-obj (glst-find-node-by-name (-> arg0 obj-list) (-> sv-96 name)))) - (set! s0-0 (if s2-0 #t #f)) - (cond - ((the-as symbol s0-0)) - (else (set! s2-0 (new 'global 'anim-test-obj 1 (-> sv-96 name) arg2)) (glst-add-tail (-> arg0 obj-list) s2-0))) - (anim-test-obj-init s2-0 (the-as list-control arg0)) - (set! (-> s2-0 obj-art-group) arg2) - (set! (-> s2-0 mesh-geo) (the-as merc-ctrl sv-96)) + (let ((sv-96 (-> arg2 data s3-0))) + (set! s0-0 (and s2-0 s0-0)) + (if s0-0 (anim-test-obj-remove-invalid s2-0)) + (anim-tester-load-object-seqs arg0 (-> sv-96 name)) + (set! s2-0 (the-as anim-test-obj (glst-find-node-by-name (-> arg0 obj-list) (-> sv-96 name)))) + (set! s0-0 (if s2-0 #t #f)) + (cond + ((the-as symbol s0-0)) + (else (set! s2-0 (new 'global 'anim-test-obj 1 (-> sv-96 name) arg2)) (glst-add-tail (-> arg0 obj-list) s2-0))) + (anim-test-obj-init s2-0 (the-as list-control arg0)) + (set! (-> s2-0 obj-art-group) arg2) + (set! (-> s2-0 mesh-geo) (the-as merc-ctrl sv-96))) (set! (-> s2-0 joint-geo) (the-as art-joint-geo s1-0)) (if (not s5-0) (set! s5-0 s2-0))) ((= (-> arg2 data s3-0 type) art-joint-geo) @@ -1600,26 +1587,26 @@ (if (not s1-0) (set! s1-0 (-> arg2 data s3-0)))) ((= (-> arg2 data s3-0 type) art-joint-anim) (when s2-0 - (set! sv-112 (-> arg2 data s3-0)) - (set! sv-128 (the-as anim-test-obj (glst-find-node-by-name (-> s2-0 seq-list) (-> sv-112 name)))) - (when (not sv-128) - (set! sv-128 (the-as anim-test-obj (new 'debug 'anim-test-sequence 1 (-> sv-112 name)))) - (glst-add-tail (-> s2-0 seq-list) sv-128) - (anim-test-sequence-init (the-as anim-test-sequence sv-128) s2-0) - (let ((a1-11 (new 'debug 'anim-test-seq-item 1 (-> sv-112 name)))) - (glst-add-tail (the-as glst-list (&-> sv-128 obj-art-group)) a1-11))) - (set! (-> sv-128 list-con user-info) (the-as int s2-0)) - (set! (-> sv-128 flags) (logior (-> (the-as anim-test-sequence sv-128) flags) 2)) - (let ((v1-48 (-> (the-as anim-test-sequence sv-128) item-list))) - "is the list empty, #t = empty" - (when (not (= (-> v1-48 tailpred) v1-48)) - (let ((v1-51 (-> (the-as anim-test-sequence sv-128) item-list))) - "return the start of the list" - (let ((v1-52 (-> v1-51 head))) - (set! (-> (the-as anim-test-seq-item v1-52) num-frames) (the float (-> (the-as art-joint-anim sv-112) data 0 length))) - (set! (-> (the-as anim-test-seq-item v1-52) artist-base) (-> (the-as art-joint-anim sv-112) artist-base)) - (set! (-> (the-as anim-test-seq-item v1-52) parent) (the-as anim-test-sequence sv-128)))) - sv-128)))) + (let* ((sv-112 (-> arg2 data s3-0)) + (sv-128 (the-as anim-test-obj (glst-find-node-by-name (-> s2-0 seq-list) (-> sv-112 name))))) + (when (not sv-128) + (set! sv-128 (the-as anim-test-obj (new 'debug 'anim-test-sequence 1 (-> sv-112 name)))) + (glst-add-tail (-> s2-0 seq-list) sv-128) + (anim-test-sequence-init (the-as anim-test-sequence sv-128) s2-0) + (let ((a1-11 (new 'debug 'anim-test-seq-item 1 (-> sv-112 name)))) + (glst-add-tail (the-as glst-list (&-> sv-128 obj-art-group)) a1-11))) + (set! (-> sv-128 list-con user-info) (the-as int s2-0)) + (set! (-> sv-128 flags) (logior (-> (the-as anim-test-sequence sv-128) flags) 2)) + (let ((v1-48 (-> (the-as anim-test-sequence sv-128) item-list))) + "is the list empty, #t = empty" + (when (not (= (-> v1-48 tailpred) v1-48)) + (let ((v1-51 (-> (the-as anim-test-sequence sv-128) item-list))) + "return the start of the list" + (let ((v1-52 (-> v1-51 head))) + (set! (-> (the-as anim-test-seq-item v1-52) num-frames) (the float (-> (the-as art-joint-anim sv-112) data 0 length))) + (set! (-> (the-as anim-test-seq-item v1-52) artist-base) (-> (the-as art-joint-anim sv-112) artist-base)) + (set! (-> (the-as anim-test-seq-item v1-52) parent) (the-as anim-test-sequence sv-128)))) + sv-128))))) (else)))) (if s2-0 (anim-test-obj-remove-invalid s2-0)) (when s5-0 diff --git a/goal_src/jak1/engine/debug/debug-sphere.gc b/goal_src/jak1/engine/debug/debug-sphere.gc index 25d6af3daf..5524f40a1d 100644 --- a/goal_src/jak1/engine/debug/debug-sphere.gc +++ b/goal_src/jak1/engine/debug/debug-sphere.gc @@ -16,7 +16,6 @@ ((point vector 300 :inline))) (defun make-debug-sphere-table ((arg0 debug-sphere-table)) - (local-vars (sv-80 int)) (let ((s5-0 (new-stack-vector0)) (f30-0 1.0) (s4-0 0)) @@ -30,19 +29,20 @@ (set! (-> s2-0 y) (+ (-> s5-0 y) (* (cos (* (degrees (/ 180 DEBUG_SPHERE_SEC_H)) (the float s3-0))) f30-0))) (set! (-> s1-0 y) (-> s2-0 y)) (set! (-> s0-0 y) (+ (-> s5-0 y) (* (cos (* (degrees (/ 180 DEBUG_SPHERE_SEC_H)) (the float (+ s3-0 1)))) f30-0))) - (set! sv-80 0) - (while (< sv-80 DEBUG_SPHERE_SEC_W) - (set! (-> s2-0 x) (+ (-> s5-0 x) (* (cos (* (degrees (/ 360 DEBUG_SPHERE_SEC_W)) (the float sv-80))) f28-0))) - (set! (-> s2-0 z) (+ (-> s5-0 z) (* (sin (* (degrees (/ 360 DEBUG_SPHERE_SEC_W)) (the float sv-80))) f28-0))) - (set! (-> s1-0 x) (+ (-> s5-0 x) (* (cos (* (degrees (/ 360 DEBUG_SPHERE_SEC_W)) (the float (+ sv-80 1)))) f28-0))) - (set! (-> s1-0 z) (+ (-> s5-0 z) (* (sin (* (degrees (/ 360 DEBUG_SPHERE_SEC_W)) (the float (+ sv-80 1)))) f28-0))) - (set! (-> s0-0 x) (+ (-> s5-0 x) (* (cos (* (degrees (/ 360 DEBUG_SPHERE_SEC_W)) (the float sv-80))) f26-0))) - (set! (-> s0-0 z) (+ (-> s5-0 z) (* (sin (* (degrees (/ 360 DEBUG_SPHERE_SEC_W)) (the float sv-80))) f26-0))) - (set! (-> arg0 point s4-0 quad) (-> s2-0 quad)) - (set! (-> arg0 point (+ s4-0 1) quad) (-> s1-0 quad)) - (set! (-> arg0 point (+ s4-0 2) quad) (-> s0-0 quad)) - (+! s4-0 3) - (set! sv-80 (+ sv-80 1)))))) + (let ((sv-80 0)) + (while (< sv-80 DEBUG_SPHERE_SEC_W) + (set! (-> s2-0 x) (+ (-> s5-0 x) (* (cos (* (degrees (/ 360 DEBUG_SPHERE_SEC_W)) (the float sv-80))) f28-0))) + (set! (-> s2-0 z) (+ (-> s5-0 z) (* (sin (* (degrees (/ 360 DEBUG_SPHERE_SEC_W)) (the float sv-80))) f28-0))) + (set! (-> s1-0 x) (+ (-> s5-0 x) (* (cos (* (degrees (/ 360 DEBUG_SPHERE_SEC_W)) (the float (+ sv-80 1)))) f28-0))) + (set! (-> s1-0 z) (+ (-> s5-0 z) (* (sin (* (degrees (/ 360 DEBUG_SPHERE_SEC_W)) (the float (+ sv-80 1)))) f28-0))) + (set! (-> s0-0 x) (+ (-> s5-0 x) (* (cos (* (degrees (/ 360 DEBUG_SPHERE_SEC_W)) (the float sv-80))) f26-0))) + (set! (-> s0-0 z) (+ (-> s5-0 z) (* (sin (* (degrees (/ 360 DEBUG_SPHERE_SEC_W)) (the float sv-80))) f26-0))) + (set! (-> arg0 point s4-0 quad) (-> s2-0 quad)) + (set! (-> arg0 point (+ s4-0 1) quad) (-> s1-0 quad)) + (set! (-> arg0 point (+ s4-0 2) quad) (-> s0-0 quad)) + (+! s4-0 3) + (1+! sv-80)))))) + 0 (none)) (define *debug-sphere-table* (new 'static 'debug-sphere-table)) diff --git a/goal_src/jak1/engine/debug/debug.gc b/goal_src/jak1/engine/debug/debug.gc index b90632ef5b..808ee65e73 100644 --- a/goal_src/jak1/engine/debug/debug.gc +++ b/goal_src/jak1/engine/debug/debug.gc @@ -463,17 +463,27 @@ (if (not arg0) (return #f)) (let ((f30-0 0.0) (s1-0 (new-stack-vector0)) - (s0-0 (new-stack-vector0))) - (dotimes (sv-48 12) - (set-vector! s1-0 (* arg3 (cos f30-0)) 0.0 (* arg3 (sin f30-0)) 1.0) + (s0-0 (new-stack-vector0)) + (sv-48 0)) + (while (< sv-48 12) + (let ((sv-64 s1-0)) + (set! (-> sv-64 x) (* arg3 (cos f30-0))) + (set! (-> sv-64 y) 0.0) + (set! (-> sv-64 z) (* arg3 (sin f30-0))) + (set! (-> sv-64 w) 1.0)) (set! f30-0 (+ 5461.3335 f30-0)) - (set-vector! s0-0 (* arg3 (cos f30-0)) 0.0 (* arg3 (sin f30-0)) 1.0) + (let ((sv-80 s0-0)) + (set! (-> sv-80 x) (* arg3 (cos f30-0))) + (set! (-> sv-80 y) 0.0) + (set! (-> sv-80 z) (* arg3 (sin f30-0))) + (set! (-> sv-80 w) 1.0)) (when arg5 (vector-matrix*! s1-0 s1-0 arg5) (vector-matrix*! s0-0 s0-0 arg5)) (vector+! s1-0 s1-0 arg2) (vector+! s0-0 s0-0 arg2) - (add-debug-line #t arg1 s1-0 s0-0 arg4 #f (the-as rgba -1)))) + (add-debug-line #t arg1 s1-0 s0-0 arg4 #f (the-as rgba -1)) + (+! sv-48 1))) #f) (defun-debug add-debug-vector ((arg0 symbol) (arg1 bucket-id) (arg2 vector) (arg3 vector) (arg4 meters) (arg5 rgba)) @@ -497,6 +507,7 @@ (add-debug-vector arg0 arg1 arg3 (-> arg2 vector 2) (meters 2) (new 'static 'rgba :b #xff :a #x80)) arg2) +;; WARN: Stack slot load at 32 mismatch: defined as size 4, got size 16 (defun-debug add-debug-yrot-vector ((arg0 symbol) (arg1 bucket-id) (arg2 vector) (arg3 float) (arg4 float) (arg5 rgba)) (let ((sv-32 arg3) (s0-0 arg4) @@ -512,35 +523,48 @@ "note: you may pass #f for orientation" (if (not arg0) (return #f)) (let ((f30-0 arg3) - (sv-48 (new-stack-vector0)) - (sv-64 (new-stack-vector0))) - (dotimes (sv-80 12) - (set-vector! sv-48 (* arg5 (sin f30-0)) 0.0 (* arg5 (cos f30-0)) 1.0) - (+! f30-0 (the float (/ (the int (- arg4 arg3)) 12))) - (set-vector! sv-64 (* arg5 (sin f30-0)) 0.0 (* arg5 (cos f30-0)) 1.0) - (when arg7 - (vector-matrix*! sv-48 sv-48 arg7) - (vector-matrix*! sv-64 sv-64 arg7)) - (vector+! sv-48 sv-48 arg2) - (vector+! sv-64 sv-64 arg2) - (add-debug-line #t arg1 sv-48 sv-64 arg6 #f (the-as rgba -1)) - (cond - ((zero? sv-80) (add-debug-line #t arg1 sv-48 arg2 arg6 #f (the-as rgba -1))) - ((= sv-80 11) (add-debug-line #t arg1 sv-64 arg2 arg6 #f (the-as rgba -1)))))) + (sv-48 (new 'stack-no-clear 'vector))) + (set! (-> sv-48 quad) (the-as uint128 0)) + (let ((sv-64 (new 'stack-no-clear 'vector))) + (set! (-> sv-64 quad) (the-as uint128 0)) + (let ((sv-80 0)) + (while (< sv-80 12) + (let ((sv-96 sv-48)) + (set! (-> sv-96 x) (* arg5 (sin f30-0))) + (set! (-> sv-96 y) 0.0) + (set! (-> sv-96 z) (* arg5 (cos f30-0))) + (set! (-> sv-96 w) 1.0)) + (+! f30-0 (the float (/ (the int (- arg4 arg3)) 12))) + (let ((sv-112 sv-64)) + (set! (-> sv-112 x) (* arg5 (sin f30-0))) + (set! (-> sv-112 y) 0.0) + (set! (-> sv-112 z) (* arg5 (cos f30-0))) + (set! (-> sv-112 w) 1.0)) + (when arg7 + (vector-matrix*! sv-48 sv-48 arg7) + (vector-matrix*! sv-64 sv-64 arg7)) + (vector+! sv-48 sv-48 arg2) + (vector+! sv-64 sv-64 arg2) + (add-debug-line #t arg1 sv-48 sv-64 arg6 #f (the-as rgba -1)) + (cond + ((zero? sv-80) (add-debug-line #t arg1 sv-48 arg2 arg6 #f (the-as rgba -1))) + ((= sv-80 11) (add-debug-line #t arg1 sv-64 arg2 arg6 #f (the-as rgba -1)))) + (+! sv-80 1))))) #f) (defun-debug add-debug-curve ((arg0 symbol) (arg1 bucket-id) (arg2 (inline-array vector)) (arg3 int) (arg4 (pointer float)) (arg5 int) (arg6 rgba)) (if (not arg0) (return #f)) (let ((s0-0 (new-stack-vector0)) - (sv-48 (new-stack-vector0)) - (sv-64 (* arg3 4))) - (curve-evaluate! sv-48 (-> arg4 0) arg2 arg3 arg4 arg5) - (let ((sv-80 0)) - (while (< sv-80 sv-64) - (set! (-> s0-0 quad) (-> sv-48 quad)) - (curve-evaluate! sv-48 (/ (the float (+ sv-80 1)) (the float sv-64)) arg2 arg3 arg4 arg5) - (add-debug-line #t arg1 s0-0 sv-48 arg6 #f (the-as rgba -1)) - (set! sv-80 (+ sv-80 1))))) + (sv-48 (new 'stack-no-clear 'vector))) + (set! (-> sv-48 quad) (the-as uint128 0)) + (let ((sv-64 (* arg3 4))) + (curve-evaluate! sv-48 (-> arg4 0) arg2 arg3 arg4 arg5) + (let ((sv-80 0)) + (while (< sv-80 sv-64) + (set! (-> s0-0 quad) (-> sv-48 quad)) + (curve-evaluate! sv-48 (/ (the float (+ sv-80 1)) (the float sv-64)) arg2 arg3 arg4 arg5) + (add-debug-line #t arg1 s0-0 sv-48 arg6 #f (the-as rgba -1)) + (+! sv-80 1))))) #f) (defun-debug add-debug-curve2 ((arg0 symbol) (arg1 bucket-id) (arg2 curve) (arg3 rgba) (arg4 symbol)) @@ -554,19 +578,32 @@ (set! (-> sv-96 quad) (the-as uint128 0)) (set! (-> sv-96 quad) (-> arg2 s0-0 quad)) (if (!= arg5 0.0) (set! (-> sv-96 y) arg5)) - (add-debug-text-3d #t arg1 (string-format "~d" s0-0) sv-96 (font-color white) (the vector2h #f)) - (add-debug-x #t arg1 sv-96 (if (= s0-0 arg6) (static-rgba #xff #xff #xff #x80) arg4))))) + (let ((sv-32 add-debug-text-3d) + (sv-48 #t) + (sv-64 arg1)) + (format (clear *temp-string*) "~d" s0-0) + (sv-32 sv-48 sv-64 *temp-string* sv-96 (font-color white) (the-as vector2h #f))) + (add-debug-x #t arg1 sv-96 (if (= s0-0 arg6) (new 'static 'rgba :r #xff :g #xff :b #xff :a #x80) arg4))))) #f) (defun-debug debug-percent-bar ((arg0 symbol) (arg1 bucket-id) (arg2 int) (arg3 int) (arg4 float) (arg5 rgba)) (if (not arg0) (return #f)) - (with-dma-buffer-add-bucket ((s0-0 (-> (current-frame) debug-buf)) arg1) + (let* ((s0-0 (-> *display* frames (-> *display* on-screen) frame debug-buf)) + (s5-0 (-> s0-0 base))) (draw-sprite2d-xy s0-0 arg2 arg3 255 14 (new 'static 'rgba :a #x40)) - (draw-sprite2d-xy s0-0 arg2 (+ arg3 2) (the int (* 255.0 arg4)) 10 arg5)) + (draw-sprite2d-xy s0-0 arg2 (+ arg3 2) (the int (* 255.0 arg4)) 10 arg5) + (let ((a3-3 (-> s0-0 base))) + (let ((v1-5 (the-as dma-packet (-> s0-0 base)))) + (set! (-> v1-5 dma) (new 'static 'dma-tag :id (dma-tag-id next))) + (set! (-> v1-5 vif0) (new 'static 'vif-tag)) + (set! (-> v1-5 vif1) (new 'static 'vif-tag)) + (set! (-> s0-0 base) (&+ (the-as pointer v1-5) 16))) + (dma-bucket-insert-tag (-> *display* frames (-> *display* on-screen) frame bucket-group) + arg1 + s5-0 + (the-as (pointer dma-tag) a3-3)))) #f) -;; this function is broken and unused -;; TODO fix it (expand array) (defun-debug debug-pad-display ((arg0 cpad-info)) (let ((gp-0 ;; og:preserve-this @@ -623,24 +660,14 @@ (defun-debug add-debug-light ((arg0 symbol) (arg1 bucket-id) (arg2 light) (arg3 vector) (arg4 string)) (if (not arg0) (return #f)) (when (!= (-> arg2 levels x) 0.0) - (add-debug-vector arg0 arg1 arg3 (-> arg2 direction) (meters 3) (static-rgba #xff #xff #xff #x80)) - (let ((light-vec-end (vector+*! (new-stack-vector0) arg3 (-> arg2 direction) (* (meters 3) (-> arg2 levels x)))) - ;; the original code here uses w for alpha but that looks terrible - (light-rgba (new 'static - 'rgba - :r - (the int (* 128.0 (-> arg2 color x))) - :g - (the int (* 128.0 (-> arg2 color y))) - :b - (the int (* 128.0 (-> arg2 color z))) - :a 128))) - (add-debug-text-sphere arg0 - arg1 - light-vec-end - (* (meters 0.5) (-> arg2 levels x)) - (string-format "~S ~,,2f" arg4 (-> arg2 levels x)) - light-rgba))) + (add-debug-vector arg0 arg1 arg3 (-> arg2 direction) (meters 3) (new 'static 'rgba :r #xff :g #xff :b #xff :a #x80)) + (let ((s2-1 (vector+*! (new-stack-vector0) arg3 (-> arg2 direction) (* 12288.0 (-> arg2 levels x)))) + (s1-0 (logior (logior (logior (shr (shl (the int (* 128.0 (-> arg2 color w))) 56) 32) (shr (shl (the int (* 128.0 (-> arg2 color z))) 56) 40)) + (shr (shl (the int (* 128.0 (-> arg2 color y))) 56) 48)) + (shr (shl (the int (* 128.0 (-> arg2 color x))) 56) 56)))) + (format (clear *temp-string*) "~S ~,,2f" arg4 (-> arg2 levels x)) + (let ((t0-2 *temp-string*)) + (add-debug-text-sphere arg0 arg1 s2-1 (* 2048.0 (-> arg2 levels x)) t0-2 (the-as rgba s1-0))))) #f) (defun-debug add-debug-lights ((arg0 symbol) (arg1 bucket-id) (arg2 (inline-array light)) (arg3 vector)) @@ -651,15 +678,13 @@ (add-debug-light arg0 arg1 (-> arg2 3) arg3 "ambi") #f) -(defun-extern drawable-frag-count drawable int) - -(defun-debug drawable-frag-count ((arg0 drawable)) +(defun-debug-recursive drawable-frag-count int ((arg0 drawable)) (let ((gp-0 0)) (cond ((not arg0)) ((type-type? (-> arg0 type) drawable-group) - (dotimes (s4-0 (-> (the drawable-group arg0) length)) - (+! gp-0 (drawable-frag-count (-> (the drawable-group arg0) data s4-0))))) + (dotimes (s4-0 (-> (the-as drawable-group arg0) length)) + (+! gp-0 (drawable-frag-count (-> (the-as drawable-group arg0) data s4-0))))) (else (+! gp-0 1))) gp-0)) @@ -677,17 +702,18 @@ (defun-debug history-init ((arg0 pos-history) (arg1 int)) (set! (-> arg0 num-points) arg1) - (set! (-> arg0 points) (the (inline-array vector) #f)) + (set! (-> arg0 points) (the-as (inline-array vector) #f)) arg0) (defun-debug history-draw-and-update ((arg0 pos-history) (arg1 int) (arg2 vector)) (if (and arg1 (not (-> arg0 points))) - (set! (-> arg0 points) (the (inline-array vector) (malloc 'debug (* (-> arg0 num-points) 16))))) + (set! (-> arg0 points) (the-as (inline-array vector) (malloc 'debug (* (-> arg0 num-points) 16))))) (when (-> arg0 points) - (set! (-> (-> arg0 points) (-> arg0 h-first) quad) (-> arg2 quad)) - (set! (-> arg0 h-first) (+ (-> arg0 h-first) 1)) + (set! (-> arg0 points (-> arg0 h-first) quad) (-> arg2 quad)) + (+! (-> arg0 h-first) 1) (when (>= (-> arg0 h-first) (-> arg0 num-points)) - (set! (-> arg0 h-first) 0))) + (set! (-> arg0 h-first) 0) + 0)) (when arg1 (dotimes (s5-1 (1- (-> arg0 num-points))) (if (!= (+ s5-1 1) (-> arg0 h-first)) diff --git a/goal_src/jak1/engine/debug/memory-usage.gc b/goal_src/jak1/engine/debug/memory-usage.gc index 2bbd6c56af..32a2c1d705 100644 --- a/goal_src/jak1/engine/debug/memory-usage.gc +++ b/goal_src/jak1/engine/debug/memory-usage.gc @@ -24,7 +24,7 @@ (format #t "-------------------------------------------------------------~%") this) -(defmethod mem-usage ((this object) (arg0 memory-usage-block) (arg1 int)) +(defmethod mem-usage ((this object) (usage memory-usage-block) (flags int)) "Most general mem-usage message. Just prints a warning, in case you expect this to do something." (if this (format #t "WARNING: mem-usage called on object, probably not what was wanted for ~A~%" this)) this) @@ -55,20 +55,20 @@ (set! (-> this mem-usage) (calculate-total (-> this mem-usage-block)))) (-> this mem-usage-block)) -(defmethod mem-usage ((this process-tree) (arg0 memory-usage-block) (arg1 int)) +(defmethod mem-usage ((this process-tree) (usage memory-usage-block) (flags int)) "Compute the memory usage of a process tree." (let ((v1-0 87)) (let* ((a0-1 *dead-pool-list*) (a3-0 (car a0-1))) (while (not (null? a0-1)) - (set! (-> arg0 data v1-0 name) (symbol->string (the-as symbol a3-0))) + (set! (-> usage data v1-0 name) (symbol->string (the-as symbol a3-0))) (+! v1-0 1) (set! a0-1 (cdr a0-1)) (set! a3-0 (car a0-1)))) - (set! (-> arg0 length) (max (-> arg0 length) v1-0))) - (set! (-> arg0 data 93 name) "*debug-dead-pool*") - (set! *temp-mem-usage* arg0) - (when (logtest? arg1 32) + (set! (-> usage length) (max (-> usage length) v1-0))) + (set! (-> usage data 93 name) "*debug-dead-pool*") + (set! *temp-mem-usage* usage) + (when (logtest? flags 32) (let* ((s5-0 87) (s4-0 *dead-pool-list*) (v1-4 (car s4-0))) @@ -106,7 +106,7 @@ (set! (-> gp-0 length) (max 96 (-> gp-0 length))) (set! (-> gp-0 data 95 name) "heap-total") (+! (-> gp-0 data 95 count) 1) - (let ((v1-34 (+ (- -4 (the-as int arg0)) (the-as int (-> arg0 heap-cur))))) + (let ((v1-34 (+ (the-as uint (- -4 (the-as int arg0))) (the-as uint (-> arg0 heap-cur))))) (+! (-> gp-0 data 95 used) v1-34) (+! (-> gp-0 data 95 total) (logand -16 (+ v1-34 15)))) (set! (-> gp-0 length) (max 97 (-> gp-0 length))) diff --git a/goal_src/jak1/engine/debug/menu.gc b/goal_src/jak1/engine/debug/menu.gc index ea1f137223..f098b8226b 100644 --- a/goal_src/jak1/engine/debug/menu.gc +++ b/goal_src/jak1/engine/debug/menu.gc @@ -48,6 +48,7 @@ (set! (-> gp-0 root-menu) #f) (set! (-> gp-0 joypad-func) #f) (set! (-> gp-0 joypad-item) #f) + ;; og:preserve-this added pc-hack flag (set! (-> gp-0 font) (new 'debug 'font-context *font-default-matrix* 0 0 0.0 (font-color default) (font-flags shadow kerning pc-hack))) gp-0)) @@ -372,7 +373,8 @@ (was-active (-> context is-active))) (if was-active (debug-menu-context-send-msg context (debug-menu-msg deactivate) (debug-menu-dest activation))) (set! (-> item parent) menu) - (set! (-> menu items) (the-as pair (append! (-> menu items) (dcons item '())))) ;; was normal cons + ;; og:preserve-this was normal cons + (set! (-> menu items) (the-as pair (append! (-> menu items) (dcons item '())))) (debug-menu-rebuild menu) (if was-active (debug-menu-context-send-msg context (debug-menu-msg activate) (debug-menu-dest activation)))) item) @@ -404,7 +406,7 @@ - flag - flag entry - function - function entry - var, int-var, int-var-gat1, hex-var, float-var, flat-fixed-var" - (local-vars (s5-0 basic) (sv-16 object) (sv-32 int) (sv-48 float) (sv-64 float) (sv-80 float) (sv-96 float)) + (local-vars (s5-0 basic)) (when (or (not arg1) (null? arg1)) (set! s5-0 #f) (goto cfg-41)) @@ -449,41 +451,35 @@ (new 'debug 'debug-menu-item-var s5-1 (the-as int (car (cdr (cdr arg1)))) (the-as int (car (cdr (cdr (cdr arg1))))))) ((or (= s4-0 'int-var) (= s4-0 'int-var-gat1) (= s4-0 'hex-var)) (set! s5-0 (new 'debug 'debug-menu-item-var s5-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 s5-0)) - (s1-3 (debug-menu-func-decode (car (cdr (cdr (cdr arg1)))))) - (s0-1 (/ (the-as int (ref arg1 5)) 8))) - (set! sv-16 (ref arg1 6)) - (set! sv-32 (/ (the-as int (ref arg1 7)) 8)) - (let ((t1-0 (/ (the-as int (ref arg1 8)) 8)) - (t2-0 (= s4-0 'hex-var))) - (s3-4 s2-3 (the-as (function int debug-menu-msg int int int) s1-3) s0-1 (the-as symbol sv-16) sv-32 t1-0 t2-0))) + (debug-menu-item-var-make-int (the-as debug-menu-item-var s5-0) + (the-as (function int debug-menu-msg int int int) (debug-menu-func-decode (car (cdr (cdr (cdr arg1)))))) + (/ (the-as int (ref arg1 5)) 8) + (the-as symbol (ref arg1 6)) + (/ (the-as int (ref arg1 7)) 8) + (/ (the-as int (ref arg1 8)) 8) + (= s4-0 'hex-var)) ;; changed... i have no idea what they were trying to do here (set! (-> (the-as debug-menu-item-var s5-0) ifloat-p) (= s4-0 'int-var-gat1)) ;;#t) s5-0) ((= s4-0 'float-var) (set! s5-0 (new 'debug 'debug-menu-item-var s5-1 (the-as int (car (cdr (cdr arg1)))) (the-as int (ref arg1 4)))) - (let ((s4-5 debug-menu-item-var-make-float) - (s3-6 (the-as debug-menu-item-var s5-0)) - (s2-5 (debug-menu-func-decode (car (cdr (cdr (cdr arg1)))))) - (s1-5 (the float (/ (the-as int (ref arg1 5)) 8))) - (s0-2 (ref arg1 6))) - (set! sv-48 (the float (/ (the-as int (ref arg1 7)) 8))) - (set! sv-64 (the float (/ (the-as int (ref arg1 8)) 8))) - (let ((t2-1 (/ (the-as int (ref arg1 9)) 8))) - (s4-5 s3-6 (the-as (function int debug-menu-msg float float float) s2-5) s1-5 (the-as symbol s0-2) sv-48 sv-64 t2-1))) + (debug-menu-item-var-make-float (the-as debug-menu-item-var s5-0) + (the-as (function int debug-menu-msg float float float) (debug-menu-func-decode (car (cdr (cdr (cdr arg1)))))) + (the float (/ (the-as int (ref arg1 5)) 8)) + (the-as symbol (ref arg1 6)) + (the float (/ (the-as int (ref arg1 7)) 8)) + (the float (/ (the-as int (ref arg1 8)) 8)) + (/ (the-as int (ref arg1 9)) 8)) s5-0) ((= s4-0 'float-fixed-var) (set! s5-0 (new 'debug 'debug-menu-item-var s5-1 (the-as int (car (cdr (cdr arg1)))) (the-as int (ref arg1 4)))) - (let ((s4-7 debug-menu-item-var-make-float) - (s3-8 (the-as debug-menu-item-var s5-0)) - (s2-7 (debug-menu-func-decode (car (cdr (cdr (cdr arg1)))))) - (s1-7 (* 0.001 (the float (/ (the-as int (ref arg1 5)) 8)))) - (s0-3 (ref arg1 6))) - (set! sv-80 (* 0.001 (the float (/ (the-as int (ref arg1 7)) 8)))) - (set! sv-96 (* 0.001 (the float (/ (the-as int (ref arg1 8)) 8)))) - (let ((t2-2 (/ (the-as int (ref arg1 9)) 8))) - (s4-7 s3-8 (the-as (function int debug-menu-msg float float float) s2-7) s1-7 (the-as symbol s0-3) sv-80 sv-96 t2-2))) + (debug-menu-item-var-make-float (the-as debug-menu-item-var s5-0) + (the-as (function int debug-menu-msg float float float) (debug-menu-func-decode (car (cdr (cdr (cdr arg1)))))) + (* 0.001 (the float (/ (the-as int (ref arg1 5)) 8))) + (the-as symbol (ref arg1 6)) + (* 0.001 (the float (/ (the-as int (ref arg1 7)) 8))) + (* 0.001 (the float (/ (the-as int (ref arg1 8)) 8))) + (/ (the-as int (ref arg1 9)) 8)) s5-0) (else #f)))))) (label cfg-41) diff --git a/goal_src/jak1/engine/debug/viewer.gc b/goal_src/jak1/engine/debug/viewer.gc index 454818dc67..dbb952e5ab 100644 --- a/goal_src/jak1/engine/debug/viewer.gc +++ b/goal_src/jak1/engine/debug/viewer.gc @@ -134,19 +134,17 @@ (none)) (defun add-a-bunch ((arg0 string) (arg1 int) (arg2 int) (arg3 float)) - (local-vars (sv-32 process)) (dotimes (s2-0 arg1) (dotimes (s1-0 arg2) (let ((s0-0 (new-stack-vector0))) (position-in-front-of-camera! s0-0 40960.0 4096.0) (+! (-> s0-0 x) (the float (* (- s2-0 (/ arg1 2)) (the int arg3)))) (+! (-> s0-0 z) (the float (* (- s1-0 (/ arg2 2)) (the int arg3)))) - (set! sv-32 (get-process *default-dead-pool* viewer #x4000)) - (when sv-32 - (let ((t9-2 (method-of-type viewer activate))) - (t9-2 (the-as viewer sv-32) *entity-pool* 'viewer (the-as pointer #x70004000))) - (run-now-in-process sv-32 init-viewer-for-other arg0 s0-0) - (-> sv-32 ppointer))))) + (let ((sv-32 (get-process *default-dead-pool* viewer #x4000))) + (when sv-32 + ((method-of-type viewer activate) (the-as viewer sv-32) *entity-pool* 'viewer (the-as pointer #x70004000)) + (run-now-in-process sv-32 init-viewer-for-other arg0 s0-0) + (-> sv-32 ppointer)))))) #f) (defun birth-viewer ((arg0 process) (arg1 entity-actor)) diff --git a/goal_src/jak1/engine/dma/dma-buffer.gc b/goal_src/jak1/engine/dma/dma-buffer.gc index 0b3af410fe..5cc0dcb926 100644 --- a/goal_src/jak1/engine/dma/dma-buffer.gc +++ b/goal_src/jak1/engine/dma/dma-buffer.gc @@ -161,7 +161,8 @@ but creates a reference to the existing VU function." ;; The first 4 bytes of a vu-function object's data are discarded because they aren't aligned. (let ((func-ptr (the-as pointer (&-> vu-func data 4))) - (qlen (-> vu-func qlength)) ;; number of quadwords + ;; og:preserve-this we rely on the vu functions being empty on pc + (qlen (#if PC_PORT 0 (-> vu-func qlength))) ;; number of quadwords (origin (-> vu-func origin)) ;; destination address in VU instruction memory. ) ;; loop until whole program is transferred. diff --git a/goal_src/jak1/engine/dma/dma-disasm.gc b/goal_src/jak1/engine/dma/dma-disasm.gc index db36cb2e70..608b329830 100644 --- a/goal_src/jak1/engine/dma/dma-disasm.gc +++ b/goal_src/jak1/engine/dma/dma-disasm.gc @@ -18,6 +18,7 @@ (string1 string) (string2 string))) + (define *vif-disasm-table* (new 'static 'boxed-array @@ -25,38 +26,38 @@ vif-disasm-element :length 34 (new 'static 'vif-disasm-element :mask #x7f :string1 "nop") - (new 'static 'vif-disasm-element :mask #x7f :tag #x1 :print #x2 :string1 "stcycl") - (new 'static 'vif-disasm-element :mask #x7f :tag #x2 :print #x1 :string1 "offset" :string2 "offset") - (new 'static 'vif-disasm-element :mask #x7f :tag #x3 :print #x1 :string1 "base" :string2 "base") - (new 'static 'vif-disasm-element :mask #x7f :tag #x4 :print #x1 :string1 "itop" :string2 "addr") - (new 'static 'vif-disasm-element :mask #x7f :tag #x5 :print #x1 :string1 "stmod" :string2 "mode") - (new 'static 'vif-disasm-element :mask #x7f :tag #x6 :print #x1 :string1 "mskpath3" :string2 "mask") - (new 'static 'vif-disasm-element :mask #x7f :tag #x7 :print #x1 :string1 "mark" :string2 "mark") - (new 'static 'vif-disasm-element :mask #x7f :tag #x10 :string1 "flushe") - (new 'static 'vif-disasm-element :mask #x7f :tag #x11 :string1 "flush") - (new 'static 'vif-disasm-element :mask #x7f :tag #x13 :string1 "flusha") - (new 'static 'vif-disasm-element :mask #x7f :tag #x14 :print #x1 :string1 "mscal" :string2 "addr") - (new 'static 'vif-disasm-element :mask #x7f :tag #x17 :string1 "mscnt") - (new 'static 'vif-disasm-element :mask #x7f :tag #x15 :print #x1 :string1 "mscalf" :string2 "addr") - (new 'static 'vif-disasm-element :mask #x7f :tag #x20 :print #x3 :string1 "stmask" :string2 "mask") - (new 'static 'vif-disasm-element :mask #x7f :tag #x30 :print #x4 :string1 "strow" :string2 "row") - (new 'static 'vif-disasm-element :mask #x7f :tag #x31 :print #x4 :string1 "stcol" :string2 "col") - (new 'static 'vif-disasm-element :mask #x7f :tag #x4a :print #x5 :string1 "mpg") - (new 'static 'vif-disasm-element :mask #x7f :tag #x50 :print #x6 :string1 "direct") - (new 'static 'vif-disasm-element :mask #x7f :tag #x51 :print #x6 :string1 "directhl") - (new 'static 'vif-disasm-element :mask #x6f :tag #x60 :val #x10 :print #x7 :string1 "unpack-s-32") - (new 'static 'vif-disasm-element :mask #x6f :tag #x61 :val #x8 :print #x7 :string1 "unpack-s-16") - (new 'static 'vif-disasm-element :mask #x6f :tag #x62 :val #x4 :print #x7 :string1 "unpack-s-8") - (new 'static 'vif-disasm-element :mask #x6f :tag #x64 :val #x8 :print #x7 :string1 "unpack-v2-32") - (new 'static 'vif-disasm-element :mask #x6f :tag #x65 :val #x4 :print #x7 :string1 "unpack-v2-16") - (new 'static 'vif-disasm-element :mask #x6f :tag #x66 :val #x2 :print #x7 :string1 "unpack-v2-8") - (new 'static 'vif-disasm-element :mask #x6f :tag #x68 :val #xc :print #x7 :string1 "unpack-v3-32") - (new 'static 'vif-disasm-element :mask #x6f :tag #x69 :val #x6 :print #x7 :string1 "unpack-v3-16") - (new 'static 'vif-disasm-element :mask #x6f :tag #x6a :val #x3 :print #x7 :string1 "unpack-v3-8") - (new 'static 'vif-disasm-element :mask #x6f :tag #x6c :val #x10 :print #x7 :string1 "unpack-v4-32") - (new 'static 'vif-disasm-element :mask #x6f :tag #x6d :val #x8 :print #x7 :string1 "unpack-v4-16") - (new 'static 'vif-disasm-element :mask #x6f :tag #x6e :val #x4 :print #x7 :string1 "unpack-v4-8") - (new 'static 'vif-disasm-element :mask #x6f :tag #x6f :val #x2 :print #x7 :string1 "unpack-v4-5") + (new 'static 'vif-disasm-element :mask #x7f :tag (vif-cmd-32 stcycl) :print #x2 :string1 "stcycl") + (new 'static 'vif-disasm-element :mask #x7f :tag (vif-cmd-32 offset) :print #x1 :string1 "offset" :string2 "offset") + (new 'static 'vif-disasm-element :mask #x7f :tag (vif-cmd-32 base) :print #x1 :string1 "base" :string2 "base") + (new 'static 'vif-disasm-element :mask #x7f :tag (vif-cmd-32 itop) :print #x1 :string1 "itop" :string2 "addr") + (new 'static 'vif-disasm-element :mask #x7f :tag (vif-cmd-32 stmod) :print #x1 :string1 "stmod" :string2 "mode") + (new 'static 'vif-disasm-element :mask #x7f :tag (vif-cmd-32 mskpath3) :print #x1 :string1 "mskpath3" :string2 "mask") + (new 'static 'vif-disasm-element :mask #x7f :tag (vif-cmd-32 mark) :print #x1 :string1 "mark" :string2 "mark") + (new 'static 'vif-disasm-element :mask #x7f :tag (vif-cmd-32 flushe) :string1 "flushe") + (new 'static 'vif-disasm-element :mask #x7f :tag (vif-cmd-32 flush) :string1 "flush") + (new 'static 'vif-disasm-element :mask #x7f :tag (vif-cmd-32 flusha) :string1 "flusha") + (new 'static 'vif-disasm-element :mask #x7f :tag (vif-cmd-32 mscal) :print #x1 :string1 "mscal" :string2 "addr") + (new 'static 'vif-disasm-element :mask #x7f :tag (vif-cmd-32 mscnt) :string1 "mscnt") + (new 'static 'vif-disasm-element :mask #x7f :tag (vif-cmd-32 mscalf) :print #x1 :string1 "mscalf" :string2 "addr") + (new 'static 'vif-disasm-element :mask #x7f :tag (vif-cmd-32 stmask) :print #x3 :string1 "stmask" :string2 "mask") + (new 'static 'vif-disasm-element :mask #x7f :tag (vif-cmd-32 strow) :print #x4 :string1 "strow" :string2 "row") + (new 'static 'vif-disasm-element :mask #x7f :tag (vif-cmd-32 stcol) :print #x4 :string1 "stcol" :string2 "col") + (new 'static 'vif-disasm-element :mask #x7f :tag (vif-cmd-32 mpg) :print #x5 :string1 "mpg") + (new 'static 'vif-disasm-element :mask #x7f :tag (vif-cmd-32 direct) :print #x6 :string1 "direct") + (new 'static 'vif-disasm-element :mask #x7f :tag (vif-cmd-32 directhl) :print #x6 :string1 "directhl") + (new 'static 'vif-disasm-element :mask #x6f :tag (vif-cmd-32 unpack-s-32) :val #x10 :print #x7 :string1 "unpack-s-32") + (new 'static 'vif-disasm-element :mask #x6f :tag (vif-cmd-32 unpack-s-16) :val #x8 :print #x7 :string1 "unpack-s-16") + (new 'static 'vif-disasm-element :mask #x6f :tag (vif-cmd-32 unpack-s-8) :val #x4 :print #x7 :string1 "unpack-s-8") + (new 'static 'vif-disasm-element :mask #x6f :tag (vif-cmd-32 unpack-v2-32) :val #x8 :print #x7 :string1 "unpack-v2-32") + (new 'static 'vif-disasm-element :mask #x6f :tag (vif-cmd-32 unpack-v2-16) :val #x4 :print #x7 :string1 "unpack-v2-16") + (new 'static 'vif-disasm-element :mask #x6f :tag (vif-cmd-32 unpack-v2-8) :val #x2 :print #x7 :string1 "unpack-v2-8") + (new 'static 'vif-disasm-element :mask #x6f :tag (vif-cmd-32 unpack-v3-32) :val #xc :print #x7 :string1 "unpack-v3-32") + (new 'static 'vif-disasm-element :mask #x6f :tag (vif-cmd-32 unpack-v3-16) :val #x6 :print #x7 :string1 "unpack-v3-16") + (new 'static 'vif-disasm-element :mask #x6f :tag (vif-cmd-32 unpack-v3-8) :val #x3 :print #x7 :string1 "unpack-v3-8") + (new 'static 'vif-disasm-element :mask #x6f :tag (vif-cmd-32 unpack-v4-32) :val #x10 :print #x7 :string1 "unpack-v4-32") + (new 'static 'vif-disasm-element :mask #x6f :tag (vif-cmd-32 unpack-v4-16) :val #x8 :print #x7 :string1 "unpack-v4-16") + (new 'static 'vif-disasm-element :mask #x6f :tag (vif-cmd-32 unpack-v4-8) :val #x4 :print #x7 :string1 "unpack-v4-8") + (new 'static 'vif-disasm-element :mask #x6f :tag (vif-cmd-32 unpack-v4-5) :val #x2 :print #x7 :string1 "unpack-v4-5") (new 'static 'vif-disasm-element :print #x8))) (defun disasm-vif-details ((stream symbol) (data (pointer uint8)) (kind vif-cmd) (count int)) diff --git a/goal_src/jak1/engine/draw/drawable.gc b/goal_src/jak1/engine/draw/drawable.gc index 381192d523..d4433b270e 100644 --- a/goal_src/jak1/engine/draw/drawable.gc +++ b/goal_src/jak1/engine/draw/drawable.gc @@ -105,7 +105,7 @@ (.mov a0-1 vf10) (.pcgtw a0-2 0 a0-1) (.ppach a0-3 (the-as uint128 0) a0-2) - (zero? (logand (the-as int v1-3) (the-as int a0-3))))) + (not (logtest? (the-as int v1-3) (the-as int a0-3))))) (defun vis-cull ((id int)) "Is this thing visible? By draw-node id." @@ -185,11 +185,11 @@ ((drawable-tree-instance-shrub) (let ((s2-0 (-> (the-as drawable-tree-instance-shrub v1-7) info prototype-inline-array-shrub))) (dotimes (s1-0 (-> s2-0 length)) - (if (string= arg0 (the-as string (-> s2-0 data s1-0 name))) (return (-> s2-0 data s1-0)))))) + (if (string= arg0 (-> s2-0 data s1-0 name)) (return (-> s2-0 data s1-0)))))) ((drawable-tree-instance-tie) (let ((s2-1 (-> (the-as drawable-tree-instance-tie v1-7) prototypes prototype-array-tie))) (dotimes (s1-1 (-> s2-1 length)) - (if (string= arg0 (the-as string (-> s2-1 array-data s1-1 name))) (return (-> s2-1 array-data s1-1))))))))))))) + (if (string= arg0 (-> s2-1 array-data s1-1 name)) (return (-> s2-1 array-data s1-1))))))))))))) (the-as prototype-bucket #f)) (defun-debug find-instance-by-index ((arg0 type) (arg1 int) (arg2 bsp-header)) @@ -224,7 +224,7 @@ (set! (-> arg0 dists z) (+ (-> arg0 dists x) (* 0.33333334 (- (-> arg0 dists w) (-> arg0 dists x))))) (set! (-> arg0 rdists x) (/ 1.0 (- (-> arg0 dists z) (-> arg0 dists x)))))) (set! (-> arg0 rdists z) (/ 1.0 (- (-> arg0 dists w) (-> arg0 dists z)))) - (set! (-> arg0 dists y) (* 0.5 (-> arg0 dists x))) + (set! (-> arg0 dists y) (/ (-> arg0 dists x) 2)) (set! (-> arg0 rdists y) (/ 1.0 (-> arg0 dists y))) arg0) @@ -419,7 +419,7 @@ |# (defun dma-add-process-drawable ((arg0 process-drawable) (arg1 draw-control) (arg2 symbol) (arg3 dma-buffer)) - (local-vars (v1-37 float) (sv-16 process-drawable)) + (local-vars (v1-37 float)) (rlet ((acc :class vf) (Q :class vf) (vf0 :class vf) @@ -443,176 +443,178 @@ (vf4 :class vf) (vf5 :class vf)) (init-vf0-vector) - (set! sv-16 arg0) - (logclear! (-> arg1 status) (draw-status was-drawn)) - (when (zero? (logand (-> arg1 status) (draw-status hidden no-anim no-skeleton-update))) - (let ((s4-0 (the-as vector (+ 48 (the-as int (scratchpad-object int))))) - (vu-lgt (the-as vu-lights (+ 64 (the-as int (scratchpad-object int))))) - (tod *time-of-day-context*)) - (.lvf vf16 (&-> arg1 origin quad)) - (.lvf vf17 (&-> arg1 bounds quad)) - (.mul.x.vf.w vf16 vf16 vf0) - (.add.vf vf16 vf16 vf17) - (.svf (&-> s4-0 quad) vf16) - (.lvf vf28 (&-> arg1 color-mult quad)) - (.lvf vf29 (&-> arg1 color-emissive quad)) - (when (sphere-in-view-frustum? (the-as sphere s4-0)) - (case (-> arg1 global-effect) - (((draw-effect title)) - (when (not (-> tod title-updated)) - (set! (-> tod title-updated) #t) - (let ((s0-0 (-> *math-camera* inv-camera-rot)) - (a1-1 (new 'stack-no-clear 'vector)) - (s1-0 (new 'stack-no-clear 'vector))) - (set-vector! a1-1 0.612 0.5 -0.612 0.0) - (set-vector! s1-0 -0.696 0.174 0.696 0.0) - (vector-matrix*! (the-as vector (-> tod title-light-group)) a1-1 s0-0) - (vector-matrix*! (the-as vector (-> tod title-light-group dir1)) s1-0 s0-0)) - (set-vector! (-> *time-of-day-context* current-shadow) 0.612 -0.5 -0.612 1.0)) - (vu-lights<-light-group! vu-lgt (-> tod title-light-group))) - (else - (let ((interp (-> arg1 secondary-interp)) - (cur-interp (-> arg1 current-secondary-interp)) - (shadow-msk (-> arg1 shadow-mask)) - (lev-idx (-> arg1 level-index)) - (lgt (-> tod light-group (-> *target* draw light-index))) - (cur-lgt (new 'stack-no-clear 'light-group))) - (cond - ((= (-> arg1 light-index) 255)) - ((= lev-idx 2) (set! lgt (-> tod light-group (-> arg1 light-index)))) - (else (set! lgt (-> tod moods lev-idx light-group (-> arg1 light-index))))) - (when (not (or (= lev-idx 2) (zero? shadow-msk))) - (let* ((lgt-msk-0 (-> tod light-masks-0 lev-idx)) - (lgt-msk-1 (-> tod light-masks-1 lev-idx)) - (lgt-interp (-> tod light-interp lev-idx)) - (a0-13 (logand lgt-msk-0 shadow-msk)) - (v1-18 (logand lgt-msk-1 shadow-msk))) - (cond - ((and (zero? a0-13) (zero? v1-18))) - (else - (set! interp - (cond - ((and (nonzero? a0-13) (nonzero? v1-18)) 1.0) - ((zero? a0-13) - (quad-copy! (the-as pointer cur-lgt) (the-as pointer lgt) 12) - (set! lgt cur-lgt) - (set! (-> lgt dir1 levels x) 0.0) - lgt-interp) - (else - (quad-copy! (the-as pointer cur-lgt) (the-as pointer lgt) 12) - (set! lgt cur-lgt) - (set! (-> lgt dir0 levels x) 0.0) - (- 1.0 lgt-interp)))))))) - (if *teleport* (set! cur-interp interp)) - (when (not (or (paused?) (= interp cur-interp))) - (let ((f0-15 (- cur-interp interp))) - (set! cur-interp - (cond - ((< (fabs f0-15) 0.2) interp) - ((< f0-15 0.0) (+ 0.2 cur-interp)) - (else (+ -0.2 cur-interp))))) - (set! (-> arg1 current-secondary-interp) cur-interp)) - (cond - ((= cur-interp 0.0) (vu-lights<-light-group! vu-lgt lgt)) - (else - (if (!= lgt cur-lgt) (quad-copy! (the-as pointer cur-lgt) (the-as pointer lgt) 12)) - (let ((f0-20 (- 1.0 cur-interp))) - (set! (-> cur-lgt dir0 levels x) (* (-> cur-lgt dir0 levels x) f0-20)) - (set! (-> cur-lgt dir0 levels y) (* (-> cur-lgt dir0 levels y) f0-20)) - (set! (-> cur-lgt dir1 levels x) (* (-> cur-lgt dir1 levels x) f0-20)) - (set! (-> cur-lgt dir1 levels y) (* (-> cur-lgt dir1 levels y) f0-20)) - (set! (-> cur-lgt dir2 levels x) (* (-> cur-lgt dir2 levels x) f0-20)) - (set! (-> cur-lgt dir2 levels y) (* (-> cur-lgt dir2 levels y) f0-20))) - (vu-lights<-light-group! vu-lgt cur-lgt)))) - (.lvf vf2 (&-> vu-lgt color 0 quad)) - (.lvf vf3 (&-> vu-lgt color 1 quad)) - (.lvf vf4 (&-> vu-lgt color 2 quad)) - (.lvf vf5 (&-> vu-lgt 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 (&-> vu-lgt color 0 quad) vf2) - (.svf (&-> vu-lgt color 1 quad) vf3) - (.svf (&-> vu-lgt color 2 quad) vf4) - (.svf (&-> vu-lgt ambient quad) vf5) - (.mov v1-37 vf5))) - (if *display-lights* - (add-debug-lights #t (bucket-id debug) (the-as (inline-array light) (-> tod light-group)) (-> arg1 origin))) - (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 vector 0 quad)) - (.lvf vf25 (&-> at-0 camera-rot vector 1 quad)) - (.lvf vf26 (&-> at-0 camera-rot vector 2 quad)) - (.lvf vf27 (&-> at-0 camera-rot vector 3 quad))) - (let ((v1-42 (the-as vector (+ 176 (the-as int (scratchpad-object int)))))) - (.lvf vf15 (&-> s4-0 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 (&-> v1-42 quad) vf15) - (when (< 0.0 (+ (-> v1-42 z) (-> arg1 bounds w))) - (let ((lod-to-use 0)) - (let ((cam-dist (-> v1-42 w))) - (when (nonzero? (-> arg1 lod-set max-lod)) - (cond - ((>= (-> arg1 force-lod) 0) - (set! lod-to-use (-> arg1 force-lod)) - (if (#if (not PC_PORT) - (< (-> arg1 lod-set lod (-> arg1 lod-set max-lod) dist) cam-dist) - (and (-> *pc-settings* ps2-lod-dist?) (< (-> arg1 lod-set lod (-> arg1 lod-set max-lod) dist) cam-dist))) - (return #f))) - (else - (while (and (< lod-to-use (-> arg1 lod-set max-lod)) (< (-> arg1 lod-set lod lod-to-use dist) cam-dist)) - (+! lod-to-use 1))))) - ;; og:preserve-this lod hacks! - (with-pc - (if (not (-> *pc-settings* ps2-lod-dist?)) - (set! lod-to-use (minmax (-> *pc-settings* lod-force-actor) 0 (-> arg1 lod-set max-lod))))) - (if (#if (not PC_PORT) - (and (< (-> arg1 lod-set lod lod-to-use dist) cam-dist) (< (-> arg1 force-lod) 0)) - (and (-> *pc-settings* ps2-lod-dist?) (< (-> arg1 lod-set lod lod-to-use dist) cam-dist) (< (-> arg1 force-lod) 0))) - (return #f)) - (let ((v1-64 (-> arg1 sink-group level)) - (a0-26 (+ (-> arg1 sink-group merc-sink foreground-texture-page) 6))) - (when (#if (not PC_PORT) - (not (logtest? (-> arg1 status) (draw-status do-not-check-distance))) - (and (-> *pc-settings* ps2-lod-dist?) (not (logtest? (-> arg1 status) (draw-status do-not-check-distance))))) - (if (< cam-dist (-> v1-64 closest-object a0-26)) (set! (-> v1-64 closest-object a0-26) cam-dist)) - (when (and (!= a0-26 6) (!= (-> arg1 level-index) 2)) - (let ((a1-45 (cond - ((< 102400.0 cam-dist) (-> arg1 mgeo header masks 0)) - ((< 81920.0 cam-dist) (-> arg1 mgeo header masks 1)) - (else (-> arg1 mgeo header masks 2))))) - (logior! (-> v1-64 texture-mask a0-26) a1-45))))) - (if (or (guard-band-cull s4-0) (< cam-dist (* 1.2 (-> *math-camera* d)))) - (logior! (-> arg1 status) (draw-status needs-clip)) - (logclear! (-> arg1 status) (draw-status needs-clip))) - (logior! (-> arg1 status) (draw-status was-drawn)) - (if (logtest? (-> arg1 status) (draw-status skip-bones)) (return #f)) - (draw-bones arg1 arg3 cam-dist)) - (when (and (< lod-to-use (-> arg1 cur-lod)) (logtest? (-> arg1 status) (draw-status has-joint-channels))) - ;; og:preserve-this added this check for PC port to prevent memory corruption - (if (< (-> *matrix-engine* length) MATRIX_ENGINE_AMOUNT) - (let ((v1-82 *matrix-engine*)) (set! (-> v1-82 (-> v1-82 length)) (process->handle sv-16)) (+! (-> v1-82 length) 1)))) - (lod-set! arg1 lod-to-use))))))) + (let ((sv-16 arg0)) + (logclear! (-> arg1 status) (draw-status was-drawn)) + (when (not (logtest? (-> arg1 status) (draw-status hidden no-anim no-skeleton-update))) + ;; og:preserve-this scratchpad + (let ((s4-0 (-> (scratchpad-object terrain-context) work foreground joint-work temp-mtx vector 2)) + (vu-lgt (the-as vu-lights (-> (scratchpad-object terrain-context) work foreground joint-work temp-mtx vector 3))) + (tod *time-of-day-context*)) + (.lvf vf16 (&-> arg1 origin quad)) + (.lvf vf17 (&-> arg1 bounds quad)) + (.mul.x.vf.w vf16 vf16 vf0) + (.add.vf vf16 vf16 vf17) + (.svf (&-> s4-0 quad) vf16) + (.lvf vf28 (&-> arg1 color-mult quad)) + (.lvf vf29 (&-> arg1 color-emissive quad)) + (when (sphere-in-view-frustum? (the-as sphere s4-0)) + (case (-> arg1 global-effect) + (((draw-effect title)) + (when (not (-> tod title-updated)) + (set! (-> tod title-updated) #t) + (let ((s0-0 (-> *math-camera* inv-camera-rot)) + (a1-1 (new 'stack-no-clear 'vector)) + (s1-0 (new 'stack-no-clear 'vector))) + (set-vector! a1-1 0.612 0.5 -0.612 0.0) + (set-vector! s1-0 -0.696 0.174 0.696 0.0) + (vector-matrix*! (the-as vector (-> tod title-light-group)) a1-1 s0-0) + (vector-matrix*! (-> tod title-light-group dir1 direction) s1-0 s0-0)) + (set-vector! (-> *time-of-day-context* current-shadow) 0.612 -0.5 -0.612 1.0)) + (vu-lights<-light-group! vu-lgt (-> tod title-light-group))) + (else + (let ((interp (-> arg1 secondary-interp)) + (cur-interp (-> arg1 current-secondary-interp)) + (shadow-msk (-> arg1 shadow-mask)) + (lev-idx (-> arg1 level-index)) + (lgt (-> tod light-group (-> *target* draw light-index))) + (cur-lgt (new 'stack-no-clear 'light-group))) + (cond + ((= (-> arg1 light-index) 255)) + ((= lev-idx 2) (set! lgt (-> tod light-group (-> arg1 light-index)))) + (else (set! lgt (-> tod moods lev-idx light-group (-> arg1 light-index))))) + (when (not (or (= lev-idx 2) (zero? shadow-msk))) + (let* ((lgt-msk-0 (-> tod light-masks-0 lev-idx)) + (lgt-msk-1 (-> tod light-masks-1 lev-idx)) + (lgt-interp (-> tod light-interp lev-idx)) + (a0-13 (logand lgt-msk-0 shadow-msk)) + (v1-18 (logand lgt-msk-1 shadow-msk))) + (cond + ((and (zero? a0-13) (zero? v1-18))) + (else + (set! interp + (cond + ((and (nonzero? a0-13) (nonzero? v1-18)) 1.0) + ((zero? a0-13) + (quad-copy! (the-as pointer cur-lgt) (the-as pointer lgt) 12) + (set! lgt cur-lgt) + (set! (-> lgt dir1 levels x) 0.0) + lgt-interp) + (else + (quad-copy! (the-as pointer cur-lgt) (the-as pointer lgt) 12) + (set! lgt cur-lgt) + (set! (-> lgt dir0 levels x) 0.0) + (- 1.0 lgt-interp)))))))) + (if *teleport* (set! cur-interp interp)) + (when (not (or (paused?) (= interp cur-interp))) + (let ((f0-15 (- cur-interp interp))) + (set! cur-interp + (cond + ((< (fabs f0-15) 0.2) interp) + ((< f0-15 0.0) (+ 0.2 cur-interp)) + (else (+ -0.2 cur-interp))))) + (set! (-> arg1 current-secondary-interp) cur-interp)) + (cond + ((= cur-interp 0.0) (vu-lights<-light-group! vu-lgt lgt)) + (else + (if (!= lgt cur-lgt) (quad-copy! (the-as pointer cur-lgt) (the-as pointer lgt) 12)) + (let ((f0-20 (- 1.0 cur-interp))) + (set! (-> cur-lgt dir0 levels x) (* (-> cur-lgt dir0 levels x) f0-20)) + (set! (-> cur-lgt dir0 levels y) (* (-> cur-lgt dir0 levels y) f0-20)) + (set! (-> cur-lgt dir1 levels x) (* (-> cur-lgt dir1 levels x) f0-20)) + (set! (-> cur-lgt dir1 levels y) (* (-> cur-lgt dir1 levels y) f0-20)) + (set! (-> cur-lgt dir2 levels x) (* (-> cur-lgt dir2 levels x) f0-20)) + (set! (-> cur-lgt dir2 levels y) (* (-> cur-lgt dir2 levels y) f0-20))) + (vu-lights<-light-group! vu-lgt cur-lgt)))) + (.lvf vf2 (&-> vu-lgt color 0 quad)) + (.lvf vf3 (&-> vu-lgt color 1 quad)) + (.lvf vf4 (&-> vu-lgt color 2 quad)) + (.lvf vf5 (&-> vu-lgt 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 (&-> vu-lgt color 0 quad) vf2) + (.svf (&-> vu-lgt color 1 quad) vf3) + (.svf (&-> vu-lgt color 2 quad) vf4) + (.svf (&-> vu-lgt ambient quad) vf5) + (.mov v1-37 vf5))) + (if *display-lights* (add-debug-lights #t (bucket-id debug) (-> tod light-group 0 lights) (-> arg1 origin))) + (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 vector 0 quad)) + (.lvf vf25 (&-> at-0 camera-rot vector 1 quad)) + (.lvf vf26 (&-> at-0 camera-rot vector 2 quad)) + (.lvf vf27 (&-> at-0 camera-rot vector 3 quad))) + (let ((v1-42 (-> (scratchpad-object terrain-context) work foreground joint-work joint-stack data 1 vector 1))) + (.lvf vf15 (&-> s4-0 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 (&-> v1-42 quad) vf15) + (when (< 0.0 (+ (-> v1-42 z) (-> arg1 bounds w))) + (let ((lod-to-use 0)) + (let ((cam-dist (-> v1-42 w))) + (when (nonzero? (-> arg1 lod-set max-lod)) + (cond + ((>= (-> arg1 force-lod) 0) + (set! lod-to-use (-> arg1 force-lod)) + ;; og:preserve-this lod hacks + (if (#if (not PC_PORT) + (< (-> arg1 lod-set lod (-> arg1 lod-set max-lod) dist) cam-dist) + (and (-> *pc-settings* ps2-lod-dist?) (< (-> arg1 lod-set lod (-> arg1 lod-set max-lod) dist) cam-dist))) + (return #f))) + (else + (while (and (< lod-to-use (-> arg1 lod-set max-lod)) (< (-> arg1 lod-set lod lod-to-use dist) cam-dist)) + (+! lod-to-use 1))))) + ;; og:preserve-this lod hacks! + (with-pc + (if (not (-> *pc-settings* ps2-lod-dist?)) + (set! lod-to-use (minmax (-> *pc-settings* lod-force-actor) 0 (-> arg1 lod-set max-lod))))) + ;; og:preserve-this lod hacks + (if (#if (not PC_PORT) + (and (< (-> arg1 lod-set lod lod-to-use dist) cam-dist) (< (-> arg1 force-lod) 0)) + (and (-> *pc-settings* ps2-lod-dist?) (< (-> arg1 lod-set lod lod-to-use dist) cam-dist) (< (-> arg1 force-lod) 0))) + (return #f)) + (let ((v1-64 (-> arg1 sink-group level)) + (a0-26 (+ (-> arg1 sink-group merc-sink foreground-texture-page) 6))) + (when (#if (not PC_PORT) + (not (logtest? (-> arg1 status) (draw-status do-not-check-distance))) + (and (-> *pc-settings* ps2-lod-dist?) (not (logtest? (-> arg1 status) (draw-status do-not-check-distance))))) + (if (< cam-dist (-> v1-64 closest-object a0-26)) (set! (-> v1-64 closest-object a0-26) cam-dist)) + (when (and (!= a0-26 6) (!= (-> arg1 level-index) 2)) + (let ((a1-45 (cond + ((< 102400.0 cam-dist) (-> arg1 mgeo header masks 0)) + ((< 81920.0 cam-dist) (-> arg1 mgeo header masks 1)) + (else (-> arg1 mgeo header masks 2))))) + (logior! (-> v1-64 texture-mask a0-26) a1-45))))) + (if (or (guard-band-cull s4-0) (< cam-dist (* 1.2 (-> *math-camera* d)))) + (logior! (-> arg1 status) (draw-status needs-clip)) + (logclear! (-> arg1 status) (draw-status needs-clip))) + (logior! (-> arg1 status) (draw-status was-drawn)) + (if (logtest? (-> arg1 status) (draw-status skip-bones)) (return #f)) + (draw-bones arg1 arg3 cam-dist)) + (when (and (< lod-to-use (-> arg1 cur-lod)) (logtest? (-> arg1 status) (draw-status has-joint-channels))) + ;; og:preserve-this added this check for PC port to prevent memory corruption + (if (< (-> *matrix-engine* length) MATRIX_ENGINE_AMOUNT) + (let ((v1-82 *matrix-engine*)) (set! (-> v1-82 (-> v1-82 length)) (process->handle sv-16)) (+! (-> v1-82 length) 1)))) + (lod-set! arg1 lod-to-use)))))))) 0 (none))) @@ -634,7 +636,7 @@ (defun dma-add-process-drawable-hud ((arg0 process-drawable) (arg1 draw-control) (arg2 symbol) (arg3 dma-buffer)) (logclear! (-> arg1 status) (draw-status was-drawn)) - (when (zero? (logand (-> arg1 status) (draw-status hidden no-anim no-skeleton-update))) + (when (not (logtest? (-> arg1 status) (draw-status hidden no-anim no-skeleton-update))) (let ((v1-6 (the-as vu-lights (+ 64 (scratchpad-object int)))) (a0-3 *hud-lights*)) (set! (-> v1-6 direction 0 quad) (-> a0-3 direction 0 quad)) @@ -758,6 +760,7 @@ (if (= (-> s5-0 status) 'active) (print-mem-usage (compute-memory-usage s5-0 #f) s5-0 *stdcon*))))) (reset! *dma-mem-usage*)) ;; todo shrub matrix + ; (shrub-make-perspective-matrix (-> *math-camera* shrub-mat)) ;; initialize dma buckets that are generic sinks. ;; other renderers may output to these, so do them first. (generic-init-buffers) @@ -940,25 +943,7 @@ (let* ((a3-4 t0-0) (t1-2 (the-as object (-> a3-4 base)))) (set! (-> (the-as gs-gif-tag t1-2) tag) (new 'static 'gif-tag64 :nloop #x1 :eop #x1 :nreg #x2)) - (set! (-> (the-as gs-gif-tag t1-2) regs) - (new 'static - 'gif-tag-regs - :regs0 (gif-reg-id a+d) - :regs1 (gif-reg-id a+d) - :regs2 (gif-reg-id a+d) - :regs3 (gif-reg-id a+d) - :regs4 (gif-reg-id a+d) - :regs5 (gif-reg-id a+d) - :regs6 (gif-reg-id a+d) - :regs7 (gif-reg-id a+d) - :regs8 (gif-reg-id a+d) - :regs9 (gif-reg-id a+d) - :regs10 (gif-reg-id a+d) - :regs11 (gif-reg-id a+d) - :regs12 (gif-reg-id a+d) - :regs13 (gif-reg-id a+d) - :regs14 (gif-reg-id a+d) - :regs15 (gif-reg-id a+d))) + (set! (-> (the-as gs-gif-tag t1-2) regs) GIF_REGS_ALL_AD) (set! (-> a3-4 base) (&+ (the-as pointer t1-2) 16))) (let* ((a3-5 t0-0) (t1-4 (-> a3-5 base))) diff --git a/goal_src/jak1/engine/entity/actor-link-h.gc b/goal_src/jak1/engine/entity/actor-link-h.gc index 5f4eb8365e..8ea79ffc3a 100644 --- a/goal_src/jak1/engine/entity/actor-link-h.gc +++ b/goal_src/jak1/engine/entity/actor-link-h.gc @@ -26,10 +26,8 @@ (defun entity-actor-lookup ((lump res-lump) (name symbol) (idx 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)) - ;; look up the reference - (let ((v1-1 (res-lump-data lump name (pointer uint32) :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-1 (res-lump-data lump name (pointer uint32) :tag-ptr (& sv-16)))) (the-as entity-actor ;; check in range, and lookup succesful (when (and v1-1 (< idx (the-as int (-> sv-16 elt-count)))) @@ -41,9 +39,8 @@ (defun entity-actor-count ((res res-lump) (name symbol)) "Get the number of entities that this res references under the name. This works on more than just next/prev." - (local-vars (tag res-tag)) - (set! tag (new 'static 'res-tag)) - (if (res-lump-data res name pointer :tag-ptr (& tag)) (the-as int (-> tag elt-count)) 0)) + (let ((tag (new 'static 'res-tag))) + (if (res-lump-data res name pointer :tag-ptr (& tag)) (the-as int (-> tag elt-count)) 0))) ;; entity-actors are part of a linked list of entities. ;; these prevent you from looking up next-actor, prev-actor again and again to iterate. diff --git a/goal_src/jak1/engine/entity/ambient.gc b/goal_src/jak1/engine/entity/ambient.gc index e374dc8bda..717fadd939 100644 --- a/goal_src/jak1/engine/entity/ambient.gc +++ b/goal_src/jak1/engine/entity/ambient.gc @@ -77,20 +77,19 @@ gp-0)) (defun level-hint-task-process ((arg0 entity) (arg1 uint128) (arg2 string)) - (local-vars (sv-16 res-tag)) (let ((gp-0 (res-lump-value arg0 'text-id int :default arg1)) (s5-0 0)) (cond ((can-hint-be-played? (the-as text-id gp-0) arg0 arg2) - (set! sv-16 (new 'static 'res-tag)) - (let ((s4-1 ((method-of-type res-lump get-property-data) - arg0 - 'cmds - 'exact - -1000000000.0 - (the-as pointer #f) - (& sv-16) - *res-static-buf*))) + (let* ((sv-16 (new 'static 'res-tag)) + (s4-1 ((method-of-type res-lump get-property-data) + arg0 + 'cmds + 'exact + -1000000000.0 + (the-as pointer #f) + (& sv-16) + *res-static-buf*))) (when s4-1 (while (and (>= s5-0 0) (< s5-0 (the-as int (-> sv-16 elt-count)))) (set! s5-0 (level-hint-process-cmd (the-as (pointer int32) s4-1) s5-0 (the-as int (-> sv-16 elt-count)))) @@ -206,8 +205,8 @@ (defmethod print-text ((this level-hint)) (when (!= *common-text* #f) (let ((s5-0 (new 'stack 'font-context *font-default-matrix* 56 160 0.0 (font-color default) (font-flags shadow kerning)))) - (let ((v1-3 s5-0)) (set! (-> v1-3 width) (the float 400))) - (let ((v1-4 s5-0)) (set! (-> v1-4 height) (the float 96))) + (set-width! s5-0 400) + (set-height! s5-0 96) (set! (-> s5-0 flags) (font-flags shadow kerning middle large)) (print-game-text (lookup-text! *common-text* (-> this text-id-to-display) #f) s5-0 #f 128 22))) 0 @@ -369,12 +368,12 @@ (behavior ((arg0 string) (arg1 string)) (remove-setting! 'hint) (suspend-for (seconds 1) - (when (and *debug-segment* (not (paused?)) (not (str-is-playing?)) (bottom-hud-hidden?)) - (let ((s3-0 (new 'stack 'font-context *font-default-matrix* 56 160 0.0 (font-color default) (font-flags shadow kerning)))) - (let ((v1-7 s3-0)) (set! (-> v1-7 width) (the float 400))) - (let ((v1-8 s3-0)) (set! (-> v1-8 height) (the float 96))) - (set! (-> s3-0 flags) (font-flags shadow kerning middle)) - (let ((s2-0 print-game-text)) (format (clear *temp-string*) "~S~S" arg0 arg1) (s2-0 *temp-string* s3-0 #f 128 22))))) + (when (and *debug-segment* (not (paused?)) (not (str-is-playing?)) (bottom-hud-hidden?)) + (let ((s3-0 (new 'stack 'font-context *font-default-matrix* 56 160 0.0 (font-color default) (font-flags shadow kerning)))) + (set-width! s3-0 400) + (set-height! s3-0 96) + (set! (-> s3-0 flags) (font-flags shadow kerning middle)) + (let ((s2-0 print-game-text)) (format (clear *temp-string*) "~S~S" arg0 arg1) (s2-0 *temp-string* s3-0 #f 128 22))))) (go level-hint-exit))) (defstate level-hint-exit (level-hint) @@ -406,8 +405,8 @@ ((zero? s5-0) (when (and *debug-segment* (not (paused?)) (not (str-is-playing?)) (bottom-hud-hidden?)) (let ((a1-3 (new 'stack 'font-context *font-default-matrix* 56 160 0.0 (font-color default) (font-flags shadow kerning)))) - (let ((v1-5 a1-3)) (set! (-> v1-5 width) (the float 400))) - (let ((v1-6 a1-3)) (set! (-> v1-6 height) (the float 96))) + (set-width! a1-3 400) + (set-height! a1-3 96) (set! (-> a1-3 flags) (font-flags shadow kerning middle large)) (print-game-text "AS: UNKNOWN ID" a1-3 #f 128 22)))) ((!= s5-0 -1) (kill-current-level-hint '() '() 'exit) (process-spawn level-hint s5-0 #f (-> arg0 ambient) :to pp)))) @@ -415,7 +414,6 @@ (none))) (defun ambient-type-sound ((arg0 drawable-ambient) (arg1 vector)) - (local-vars (sv-16 string) (sv-112 res-tag)) (let* ((s5-0 (-> arg0 ambient)) (s4-0 (-> s5-0 ambient-data user-uint64 0))) (when (>= (current-time) (the-as time-frame s4-0)) @@ -426,31 +424,31 @@ (the int (* 300.0 (-> (the-as (pointer float) v1-5) 0))) (rand-vu-int-count (the int (* 300.0 (-> (the-as (pointer float) v1-5) 1)))))))) (when (< (the-as uint (- (current-time) (the-as int s4-0))) (the-as uint 300)) - (let ((f30-0 (the float (rand-vu-int-count (the-as int (-> s5-0 ambient-data user-float 2)))))) - (set! sv-16 (symbol->string (res-lump-struct s5-0 'effect-name symbol :time f30-0))) - (let ((s4-2 (new 'stack 'sound-spec))) - (set! (-> s4-2 sound-name) (string->sound-name sv-16)) - (logior! (-> s4-2 mask) (sound-mask volume)) - (set! (-> s4-2 volume) 1024) - (logior! (-> s4-2 mask) (sound-mask bend)) - (set! (-> s4-2 bend) (the int (* 327.66998 (rand-vu-float-range -100.0 100.0)))) - (set! sv-112 (new 'static 'res-tag)) - (let ((a1-7 ((method-of-type res-lump get-property-data) - s5-0 - 'effect-param - 'exact - f30-0 - (the-as pointer #f) - (& sv-112) - *res-static-buf*))) - (if a1-7 (effect-param->sound-spec s4-2 (the-as (pointer float) a1-7) (the-as int (-> sv-112 elt-count))))) - (when *debug-effect-control* - (format #t "(~5D) effect sound ~A ~S " (current-time) (res-lump-struct s5-0 'name structure) sv-16) - (format #t - "volume: ~f pitch-mod: ~f~%" - (* 0.09765625 (the float (-> s4-2 volume))) - (* 0.000656168 (the float (-> s4-2 pitch-mod))))) - (sound-play-by-spec s4-2 (new-sound-id) (-> arg0 bsphere))))))) + (let* ((f30-0 (the float (rand-vu-int-count (the-as int (-> s5-0 ambient-data user-float 2))))) + (sv-16 (symbol->string (res-lump-struct s5-0 'effect-name symbol :time f30-0))) + (s4-2 (new 'stack 'sound-spec))) + (set! (-> s4-2 sound-name) (string->sound-name sv-16)) + (logior! (-> s4-2 mask) (sound-mask volume)) + (set! (-> s4-2 volume) 1024) + (logior! (-> s4-2 mask) (sound-mask bend)) + (set! (-> s4-2 bend) (the int (* 327.66998 (rand-vu-float-range -100.0 100.0)))) + (let* ((sv-112 (new 'static 'res-tag)) + (a1-7 ((method-of-type res-lump get-property-data) + s5-0 + 'effect-param + 'exact + f30-0 + (the-as pointer #f) + (& sv-112) + *res-static-buf*))) + (if a1-7 (effect-param->sound-spec s4-2 (the-as (pointer float) a1-7) (the-as int (-> sv-112 elt-count))))) + (when *debug-effect-control* + (format #t "(~5D) effect sound ~A ~S " (current-time) (res-lump-struct s5-0 'name structure) sv-16) + (format #t + "volume: ~f pitch-mod: ~f~%" + (* 0.09765625 (the float (-> s4-2 volume))) + (* 0.000656168 (the float (-> s4-2 pitch-mod))))) + (sound-play-by-spec s4-2 (new-sound-id) (-> arg0 bsphere)))))) 0 (none)) @@ -620,7 +618,7 @@ (set! (-> this ambient-data user-float 0) (the-as float (new-sound-id))) (let ((v1-28 ((method-of-type res-lump lookup-tag-idx) this 'effect-param 'exact 0.0))) (set! (-> this ambient-data user-float 1) - (the-as float (if (< (the-as int v1-28) 0) (the-as (pointer res-tag) #f) (&-> (-> this tag) (-> v1-28 lo)))))) + (the-as float (if (< (the-as int v1-28) 0) (the-as (pointer res-tag) #f) (&-> this tag (-> v1-28 lo)))))) (set! (-> this ambient-data user-float 2) (the-as float s5-0)) (set! (-> this ambient-data function) ambient-type-sound-loop)))))) (('poi) @@ -665,7 +663,6 @@ ;; ERROR: function was not converted to expressions. Cannot decompile. (defmethod draw-debug ((this entity-ambient)) - (local-vars (sv-16 uint128)) (let ((gp-0 (-> this trans)) (s5-0 (res-lump-struct this 'type symbol)) (s3-0 #f)) @@ -681,8 +678,8 @@ (set! s3-0 #t))) ((= s5-0 'hint) (when *display-ambient-hint-marks* - (set! sv-16 (res-lump-value this 'text-id uint128)) - (let ((s3-2 add-debug-text-3d) + (let ((sv-16 (res-lump-value this 'text-id uint128)) + (s3-2 add-debug-text-3d) (s2-1 #t) (s1-1 68)) (format (clear *temp-string*) "TEXT ID #x~X" sv-16) diff --git a/goal_src/jak1/engine/entity/entity.gc b/goal_src/jak1/engine/entity/entity.gc index d79d0865e0..b49787e643 100644 --- a/goal_src/jak1/engine/entity/entity.gc +++ b/goal_src/jak1/engine/entity/entity.gc @@ -24,24 +24,24 @@ ;; entity basic methods ;;;;;;;;;;;;;;;;;;;;;;;;;;;; -(defmethod mem-usage ((this drawable-actor) (arg0 memory-usage-block) (arg1 int)) +(defmethod mem-usage ((this drawable-actor) (usage memory-usage-block) (flags int)) "Update memory use for a drawable-actor" - (set! (-> arg0 length) (max 44 (-> arg0 length))) - (set! (-> arg0 data 43 name) "entity") - (+! (-> arg0 data 43 count) 1) - (let ((v1-6 (asize-of this))) (+! (-> arg0 data 43 used) v1-6) (+! (-> arg0 data 43 total) (logand -16 (+ v1-6 15)))) + (set! (-> usage length) (max 44 (-> usage length))) + (set! (-> usage data 43 name) "entity") + (+! (-> usage data 43 count) 1) + (let ((v1-6 (asize-of this))) (+! (-> usage data 43 used) v1-6) (+! (-> usage data 43 total) (logand -16 (+ v1-6 15)))) ;; note: does something with flags here. - (mem-usage (-> this actor) arg0 (logior arg1 64)) + (mem-usage (-> this actor) usage (logior flags 64)) (the-as drawable-actor 0)) -(defmethod mem-usage ((this drawable-inline-array-actor) (arg0 memory-usage-block) (arg1 int)) +(defmethod mem-usage ((this drawable-inline-array-actor) (usage memory-usage-block) (flags int)) "update memory use for a group of drawable actors." - (set! (-> arg0 length) (max 1 (-> arg0 length))) - (set! (-> arg0 data 0 name) (symbol->string 'drawable-group)) - (+! (-> arg0 data 0 count) 1) - (let ((v1-7 32)) (+! (-> arg0 data 0 used) v1-7) (+! (-> arg0 data 0 total) (logand -16 (+ v1-7 15)))) + (set! (-> usage length) (max 1 (-> usage length))) + (set! (-> usage data 0 name) (symbol->string 'drawable-group)) + (+! (-> usage data 0 count) 1) + (let ((v1-7 32)) (+! (-> usage data 0 used) v1-7) (+! (-> usage data 0 total) (logand -16 (+ v1-7 15)))) (dotimes (s3-0 (-> this length)) - (mem-usage (-> this data s3-0) arg0 arg1)) + (mem-usage (-> this data s3-0) usage flags)) (the-as drawable-inline-array-actor 0)) (defmethod print ((this entity-links)) @@ -415,7 +415,7 @@ (none)) (defmethod update-vis-volumes ((this level-group)) - (local-vars (v1-10 symbol) (sv-16 process) (sv-32 (function process-drawable vector vector none)) (sv-48 process-tree)) + (local-vars (v1-10 symbol) (sv-16 process)) (format 0 "call to update-vis-volumes, which may have a compiler bug.~%") (dotimes (s5-0 (-> this length)) (let ((v1-3 (-> this level s5-0))) @@ -442,12 +442,11 @@ (update-actor-vis-box (the-as process-drawable sv-16) s2-0 s1-0) (let ((s0-2 (-> sv-16 child))) (while s0-2 - (set! sv-32 update-actor-vis-box) - (set! sv-48 (-> s0-2 0)) - (let ((a0-7 (if (and (nonzero? sv-48) (type-type? (-> sv-48 type) process-drawable)) sv-48)) - (a1-5 s2-0) - (a2-2 s1-0)) - (sv-32 (the-as process-drawable a0-7) a1-5 a2-2)) + (let ((sv-32 update-actor-vis-box) + (sv-48 (-> s0-2 0))) + (sv-32 (the-as process-drawable (if (and (nonzero? sv-48) (type-type? (-> sv-48 type) process-drawable)) sv-48)) + s2-0 + s1-0)) (set! s0-2 (-> s0-2 0 brother))))))))))) 0 (none)) @@ -455,7 +454,6 @@ (defmethod update-vis-volumes-from-nav-mesh ((this level-group)) "Update the visvol to fit the entire nav-mesh. Does this for all actors in bsps. Probably only used for debugging." - (local-vars (sv-16 entity) (sv-32 entity)) ;; loop over levels (dotimes (s5-0 (-> this length)) (let ((v1-3 (-> this level s5-0))) @@ -463,16 +461,19 @@ ;; loop over entities (let ((s4-0 (-> v1-3 bsp level entity))) (dotimes (s3-0 (-> s4-0 length)) - (set! sv-32 (-> s4-0 data s3-0 entity)) ;; look up the bounding box. - (let* ((v0-0 (res-lump-data sv-32 'visvol (inline-array vector))) + (let* ((sv-32 (-> s4-0 data s3-0 entity)) + (v0-0 (res-lump-data sv-32 'visvol (inline-array vector))) (s1-0 (-> v0-0 0)) (s2-0 (-> v0-0 1))) - (let ((s0-0 (-> sv-32 extra trans))) + (let ((s0-0 (-> sv-32 extra trans)) + (sv-16 sv-32)) ;; sometimes the nav-mesh may be in a different actor, I guess. ;; so try to look that up. - (set! sv-16 sv-32) - (let* ((v0-1 (entity-actor-lookup sv-32 'nav-mesh-actor 0))) (when v0-1 (set! sv-16 v0-1))) + (let ((v0-1 (entity-actor-lookup sv-32 'nav-mesh-actor 0))) + (when v0-1 + (set! sv-16 v0-1) + (the-as entity-actor (the-as entity-actor sv-16)))) (cond ((and (type-type? (-> sv-16 type) entity-actor) (nonzero? (-> (the-as entity-actor sv-16) nav-mesh))) ;; we got a nav-mesh! compute the bounding box @@ -504,24 +505,23 @@ (defmethod print-volume-sizes ((this level-group)) "Loop through all entities and print their visibility. Excludes crate, fuel-cell and springbox." - (local-vars (sv-16 type) (sv-32 (function _varargs_ object)) (sv-48 symbol) (sv-64 string) (sv-80 entity)) + (local-vars (sv-16 type)) (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)) - (set! sv-80 (-> s4-0 data s3-0 entity)) ;; lookup volume and dist. - (let ((s1-0 (res-lump-data sv-80 'visvol (inline-array vector))) - (f30-0 (res-lump-float sv-80 'vis-dist :default 409600.0)) - (s2-0 (-> sv-80 extra trans))) - (if (type-type? (-> sv-80 type) entity-actor) - (set! sv-16 (-> (the-as entity-actor sv-80) etype)) - (set! sv-16 (the-as type #f))) - (let ((s0-0 (-> s1-0 0)) - (s1-1 (-> s1-0 1))) - ;; This technically will work on type objects because it just checks for value equality. - ;; the code here is super weird. I have no idea what was going on, or why there are two or's. + (let* ((sv-80 (-> s4-0 data s3-0 entity)) + (s1-0 (the-as object (res-lump-data sv-80 'visvol pointer))) + (f30-0 (res-lump-float sv-80 'vis-dist :default 409600.0)) + (s2-0 (-> sv-80 extra trans))) + (set! sv-16 + (cond + ((type-type? (-> sv-80 type) entity-actor) (set! sv-16 (-> (the-as entity-actor sv-80) etype)) sv-16) + (else (the-as type #f)))) + (let ((s0-0 (-> (the-as (inline-array vector) s1-0) 0)) + (s1-1 (-> (the-as (inline-array vector) s1-0) 1))) (when (not (or (name= sv-16 money) (or (name= sv-16 crate) (name= sv-16 fuel-cell) (name= sv-16 springbox)))) (format #t "actor-vis ~S ~6,,1M " (res-lump-struct sv-80 'name basic) f30-0) (format #t @@ -555,24 +555,6 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;; (defmethod debug-draw-actors ((this level-group) (arg0 symbol)) - (local-vars - (sv-48 (function symbol bucket-id string vector font-color vector2h symbol)) - (sv-64 symbol) - (sv-80 int) - (sv-96 (function symbol bucket-id string vector font-color vector2h symbol)) - (sv-112 symbol) - (sv-128 int) - (sv-144 (function _varargs_ object)) - (sv-160 string) - (sv-176 string) - (sv-192 (function symbol bucket-id string vector font-color vector2h symbol)) - (sv-208 symbol) - (sv-224 int) - (sv-240 (function symbol bucket-id vector vector rgba symbol)) - (sv-256 symbol) - (sv-272 int) - (sv-288 pointer) - (sv-304 pointer)) (when (and arg0 (not (or (= *master-mode* 'menu) (= *master-mode* 'progress)))) (dotimes (s4-0 (-> this length)) (let ((v1-8 (-> this level s4-0))) @@ -585,14 +567,12 @@ ((and (= arg0 'process) (-> s0-0 extra process) (type-type? (-> s0-0 extra process type) process-drawable)) (let ((s1-1 (the-as process-drawable (-> s0-0 extra process)))) (add-debug-x #t (bucket-id debug-no-zbuf) (-> s1-1 root trans) (new 'static 'rgba :r #x80 :g #xff :b #x80 :a #x80)) - (set! sv-48 add-debug-text-3d) - (set! sv-64 #t) - (set! sv-80 68) - (let ((a2-2 (res-lump-struct s0-0 'name structure)) - (a3-2 (-> s1-1 root trans)) - (t0-1 1) - (t1-1 (new 'static 'vector2h :y 8))) - (sv-48 sv-64 (the-as bucket-id sv-80) (the-as string a2-2) a3-2 (the-as font-color t0-1) t1-1)) + (add-debug-text-3d #t + (bucket-id debug-no-zbuf) + (res-lump-struct s0-0 'name string) + (-> s1-1 root trans) + (font-color white) + (new 'static 'vector2h :y 8)) (add-debug-text-3d #t (bucket-id debug-no-zbuf) (symbol->string (-> s1-1 state name)) @@ -601,20 +581,16 @@ (new 'static 'vector2h :y 16)) (let ((s0-1 (res-lump-data (-> s1-1 entity) 'eco-info (pointer int32) :time 0.0))) (when s0-1 - (set! sv-96 add-debug-text-3d) - (set! sv-112 #t) - (set! sv-128 68) - (set! sv-144 format) - (set! sv-160 (clear *temp-string*)) - (set! sv-176 "~S ~D~%") - (let ((a2-7 (pickup-type->string (the-as pickup-type (-> s0-1 0)))) - (a3-5 (-> s0-1 1))) - (sv-144 sv-160 sv-176 a2-7 a3-5)) - (let ((a2-8 *temp-string*) - (a3-6 (-> s1-1 root trans)) - (t0-4 1) - (t1-4 (new 'static 'vector2h :y 24))) - (sv-96 sv-112 (the-as bucket-id sv-128) a2-8 a3-6 (the-as font-color t0-4) t1-4)))) + (let ((sv-96 add-debug-text-3d) + (sv-112 #t) + (sv-128 68)) + (format (clear *temp-string*) "~S ~D~%" (pickup-type->string (the-as pickup-type (-> s0-1 0))) (-> s0-1 1)) + (sv-96 sv-112 + (the-as bucket-id sv-128) + *temp-string* + (-> s1-1 root trans) + (font-color white) + (new 'static 'vector2h :y 24))))) (let ((v0-10 (res-lump-struct (-> s1-1 entity) 'art-name symbol))) (if (and (the-as structure v0-10) (= (-> v0-10 type) symbol)) (add-debug-text-3d #t @@ -628,13 +604,15 @@ (bucket-id debug-no-zbuf) s1-0 (if (-> s0-0 extra process) (new 'static 'rgba :r #x80 :g #xff :b #x80 :a #x80) (new 'static 'rgba :r #xff :a #x80))) - (set! sv-192 add-debug-text-3d) - (set! sv-208 #t) - (set! sv-224 68) - (let ((a2-13 (res-lump-struct s0-0 'name structure)) - (t0-8 (if (logtest? (-> s0-0 extra perm status) (entity-perm-status bit-0 bit-1)) 1 5)) - (t1-8 (new 'static 'vector2h :y 8))) - (sv-192 sv-208 (the-as bucket-id sv-224) (the-as string a2-13) s1-0 (the-as font-color t0-8) t1-8))))))))))) + (let ((sv-192 add-debug-text-3d) + (sv-208 #t) + (sv-224 68)) + (sv-192 sv-208 + (the-as bucket-id sv-224) + (res-lump-struct s0-0 'name string) + s1-0 + (if (logtest? (-> s0-0 extra perm status) (entity-perm-status bit-0 bit-1)) (font-color white) (font-color yellow)) + (new 'static 'vector2h :y 8)))))))))))) (when (and *display-actor-vis* (not (or *display-actor-anim* *display-process-anim*))) (let ((s5-1 *display-actor-vis*)) (dotimes (s4-1 (-> this length)) @@ -646,13 +624,16 @@ (let ((v0-15 (res-lump-data s0-2 'visvol pointer)) (a1-16 (-> s0-2 extra vis-id))) (when (and v0-15 (or (= s5-1 #t) (= s5-1 'box))) - (set! sv-240 add-debug-box) - (set! sv-256 #t) - (set! sv-272 68) - (set! sv-288 (&+ v0-15 0)) - (set! sv-304 (&+ v0-15 16)) - (let ((t0-10 (if (is-object-visible? s3-1 a1-16) (the-as uint #x80808000) (the-as uint #x80800080)))) - (sv-240 sv-256 (the-as bucket-id sv-272) (the-as vector sv-288) (the-as vector sv-304) (the-as rgba t0-10))))) + (let ((sv-240 add-debug-box) + (sv-256 #t) + (sv-272 68) + (sv-288 (&+ v0-15 0)) + (sv-304 (&+ v0-15 16))) + (sv-240 sv-256 + (the-as bucket-id sv-272) + (the-as vector sv-288) + (the-as vector sv-304) + (if (is-object-visible? s3-1 a1-16) (new 'static 'rgba :g #x80 :b #x80 :a #x80) (new 'static 'rgba :r #x80 :b #x80 :a #x80)))))) (when (or (= s5-1 #t) (= s5-1 'sphere)) (let ((s0-3 (-> s0-2 extra process))) (when s0-3 @@ -757,7 +738,7 @@ (countdown (s2-4 (-> s3-4 length)) (add-debug-box #t (bucket-id debug) - (the-as vector (-> s3-4 data s2-4)) + (-> s3-4 data s2-4 min) (the-as vector (+ (the-as uint (-> s3-4 data 0 max)) (* s2-4 32))) (if (zero? (-> s4-4 index)) (new 'static 'rgba :g #x80 :b #x80 :a #x80) (new 'static 'rgba :r #xff :g #x80 :b #x80 :a #x80)))))))))) (when (or *display-ambient-hint-marks* @@ -1033,7 +1014,6 @@ (< (vector-vector-distance (-> this trans) arg0) (-> *ACTOR-bank* birth-dist)))) (defmethod actors-update ((this level-group)) - (local-vars (sv-16 vector) (sv-24 int) (sv-32 entity-links) (sv-48 int) (sv-64 string) (sv-80 int)) (when *compact-actors* (if (and (= *compact-actors* 'debug) (= (-> *nk-dead-pool* alive-list prev) (-> *nk-dead-pool* first-gap))) (churn *nk-dead-pool* 1)) @@ -1042,99 +1022,99 @@ (the int (lerp-scale 8.0 1.0 (the float (-> *display* frames (-> *display* last-screen) frame run-time)) 2000.0 8000.0)))) (when (not (paused?)) (let ((s5-1 (-> *display* frames (-> *display* last-screen) frame run-time))) - (let ((f0-5 (fmax (meters 80) (fmin (+ (meters 80) (* (meters 0.05) (the float (- 7000 s5-1)))) (-> *ACTOR-bank* birth-dist))))) - (seek! (-> *ACTOR-bank* pause-dist) f0-5 (* 81920.0 (-> *display* seconds-per-frame)))) + (let ((f0-5 (fmax 327680.0 (fmin (+ 327680.0 (* 204.8 (the float (- 7000 s5-1)))) (-> *ACTOR-bank* birth-dist))))) + (seek! (-> *ACTOR-bank* pause-dist) f0-5 (* 81920.0 (seconds-per-frame)))) (seekl! (-> *ACTOR-bank* birth-max) (the int (lerp-scale 25.0 1.0 (the float s5-1) 2000.0 7000.0)) 10)) (if (movie?) (set! (-> *ACTOR-bank* birth-max) 1000))) (when *spawn-actors* - (set! sv-16 (camera-pos)) - (set! sv-24 0) - (dotimes (s5-2 (-> this length)) - (let ((s4-2 (-> this level s5-2))) - (when (= (-> s4-2 status) 'active) - (cond - ((= (-> s4-2 display?) 'special) - (let* ((s4-3 (-> s4-2 entity)) - (s3-1 (-> s4-3 length))) - (dotimes (s2-0 s3-1) - (let ((v1-44 (-> s4-3 data s2-0))) - (cond - ((logtest? (-> v1-44 perm status) (entity-perm-status bit-7)) - (when (not (or (-> v1-44 process) (logtest? (-> v1-44 perm status) (entity-perm-status bit-0 dead)))) - (birth! (-> v1-44 entity)) - (set! sv-24 (+ sv-24 1)) - (if (>= sv-24 (-> *ACTOR-bank* birth-max)) (return (the-as object #f))))) - (else - (if (and (-> v1-44 process) (not (logtest? (-> v1-44 perm status) (entity-perm-status bit-3)))) (kill! (-> v1-44 entity))))))))) - ((= (-> s4-2 display?) 'special-vis) - (let* ((s3-2 (-> s4-2 entity)) - (s2-1 (-> s3-2 length))) - (dotimes (s1-0 s2-1) - (let ((s0-0 (-> s3-2 data s1-0))) - (cond - ((and (logtest? (-> s0-0 perm status) (entity-perm-status bit-7)) (is-object-visible? s4-2 (-> s0-0 vis-id))) - (when (not (or (-> s0-0 process) (logtest? (-> s0-0 perm status) (entity-perm-status bit-0 dead)))) - (birth! (-> s0-0 entity)) - (set! sv-24 (+ sv-24 1)))) - (else - (when (and (-> s0-0 process) (not (logtest? (-> s0-0 perm status) (entity-perm-status bit-3)))) - (kill! (-> s0-0 entity)) - (set! sv-24 (+ sv-24 1)))))) - (if (>= sv-24 (-> *ACTOR-bank* birth-max)) (return (the-as object #f)))))) - ((= (-> s4-2 display?) 'actor) - (let* ((s4-4 (-> s4-2 entity)) - (s3-3 (-> s4-4 length))) - (dotimes (s2-2 s3-3) - (let ((v1-84 (-> s4-4 data s2-2))) - (cond - (#t - (when (not (or (-> v1-84 process) (logtest? (-> v1-84 perm status) (entity-perm-status bit-0 dead)))) - (birth! (-> v1-84 entity)) - (set! sv-24 (+ sv-24 1)) - (if (>= sv-24 (-> *ACTOR-bank* birth-max)) (return (the-as object #f))))) - (else - (if (and (-> v1-84 process) (not (logtest? (-> v1-84 perm status) (entity-perm-status bit-3)))) (kill! (-> v1-84 entity))))))))) - ((not *vis-actors*) - (let* ((s4-5 (-> s4-2 entity)) - (s3-4 (-> s4-5 length))) - (dotimes (s2-3 s3-4) - (let ((s1-1 (-> s4-5 data s2-3))) - (cond - ((and (< (vector-vector-distance (-> s1-1 trans) sv-16) (-> *ACTOR-bank* birth-dist)) - (not (logtest? (-> s1-1 perm status) (entity-perm-status bit-9 bit-10)))) - (when (not (or (-> s1-1 process) (logtest? (-> s1-1 perm status) (entity-perm-status bit-0 dead)))) - (birth! (-> s1-1 entity)) - (set! sv-24 (+ sv-24 1)) - (if (>= sv-24 (-> *ACTOR-bank* birth-max)) (return (the-as object #f))))) - (else - (if (and (-> s1-1 process) (not (logtest? (-> s1-1 perm status) (entity-perm-status bit-3)))) (kill! (-> s1-1 entity))))))))) - (*vis-actors* - (when (not (and (-> s4-2 vis-info 0) (-> s4-2 all-visible?))) - (let* ((s3-5 (-> s4-2 entity)) - (s2-4 (-> s3-5 length)) - (s0-1 #f)) - (dotimes (s1-2 s2-4) - (set! sv-32 (-> s3-5 data s1-2)) - (cond - ((and (#if PC_PORT - (or (with-pc (not (-> *pc-settings* ps2-actor-vis?))) (is-object-visible? s4-2 (-> sv-32 vis-id))) - (is-object-visible? s4-2 (-> sv-32 vis-id))) - (zero? (logand (-> sv-32 perm status) (entity-perm-status bit-9 bit-10)))) - (when (not (or (-> sv-32 process) (logtest? (-> sv-32 perm status) (entity-perm-status bit-0 dead)) s0-1)) - (birth! (-> sv-32 entity)) - (set! sv-24 (+ sv-24 1)) - (when (< (/ (the float (memory-free *nk-dead-pool*)) (the float (memory-total *nk-dead-pool*))) 0.1) - (let ((s0-2 format)) - (set! sv-48 0) - (set! sv-64 "WARNING: low actor memory, no birth triggered!!! ~D/~D~%") - (set! sv-80 (memory-free *nk-dead-pool*)) - (let ((a3-2 (memory-total *nk-dead-pool*))) (s0-2 sv-48 sv-64 sv-80 a3-2))) - (set! s0-1 #t)))) - (else - (when (and (-> sv-32 process) (not (logtest? (-> sv-32 perm status) (entity-perm-status bit-3)))) - (kill! (-> sv-32 entity)) - (set! sv-24 (+ sv-24 1))))) - (if (>= sv-24 (-> *ACTOR-bank* birth-max)) (return (the-as object #f)))))))))))) + (let ((sv-16 (camera-pos)) + (sv-24 0)) + (dotimes (s5-2 (-> this length)) + (let ((s4-2 (-> this level s5-2))) + (when (= (-> s4-2 status) 'active) + (cond + ((= (-> s4-2 display?) 'special) + (let* ((s4-3 (-> s4-2 entity)) + (s3-1 (-> s4-3 length))) + (dotimes (s2-0 s3-1) + (let ((v1-44 (-> s4-3 data s2-0))) + (cond + ((logtest? (-> v1-44 perm status) (entity-perm-status bit-7)) + (when (not (or (-> v1-44 process) (logtest? (-> v1-44 perm status) (entity-perm-status bit-0 dead)))) + (birth! (-> v1-44 entity)) + (+! sv-24 1) + (if (>= sv-24 (-> *ACTOR-bank* birth-max)) (return (the-as object #f))))) + (else + (if (and (-> v1-44 process) (not (logtest? (-> v1-44 perm status) (entity-perm-status bit-3)))) (kill! (-> v1-44 entity))))))))) + ((= (-> s4-2 display?) 'special-vis) + (let* ((s3-2 (-> s4-2 entity)) + (s2-1 (-> s3-2 length))) + (dotimes (s1-0 s2-1) + (let ((s0-0 (-> s3-2 data s1-0))) + (cond + ((and (logtest? (-> s0-0 perm status) (entity-perm-status bit-7)) (is-object-visible? s4-2 (-> s0-0 vis-id))) + (when (not (or (-> s0-0 process) (logtest? (-> s0-0 perm status) (entity-perm-status bit-0 dead)))) + (birth! (-> s0-0 entity)) + (+! sv-24 1))) + (else + (when (and (-> s0-0 process) (not (logtest? (-> s0-0 perm status) (entity-perm-status bit-3)))) + (kill! (-> s0-0 entity)) + (+! sv-24 1))))) + (if (>= sv-24 (-> *ACTOR-bank* birth-max)) (return (the-as object #f)))))) + ((= (-> s4-2 display?) 'actor) + (let* ((s4-4 (-> s4-2 entity)) + (s3-3 (-> s4-4 length))) + (dotimes (s2-2 s3-3) + (let ((v1-84 (-> s4-4 data s2-2))) + (cond + (#t + (when (not (or (-> v1-84 process) (logtest? (-> v1-84 perm status) (entity-perm-status bit-0 dead)))) + (birth! (-> v1-84 entity)) + (+! sv-24 1) + (if (>= sv-24 (-> *ACTOR-bank* birth-max)) (return (the-as object #f))))) + (else + (if (and (-> v1-84 process) (not (logtest? (-> v1-84 perm status) (entity-perm-status bit-3)))) (kill! (-> v1-84 entity))))))))) + ((not *vis-actors*) + (let* ((s4-5 (-> s4-2 entity)) + (s3-4 (-> s4-5 length))) + (dotimes (s2-3 s3-4) + (let ((s1-1 (-> s4-5 data s2-3))) + (cond + ((and (< (vector-vector-distance (-> s1-1 trans) sv-16) (-> *ACTOR-bank* birth-dist)) + (not (logtest? (-> s1-1 perm status) (entity-perm-status bit-9 bit-10)))) + (when (not (or (-> s1-1 process) (logtest? (-> s1-1 perm status) (entity-perm-status bit-0 dead)))) + (birth! (-> s1-1 entity)) + (+! sv-24 1) + (if (>= sv-24 (-> *ACTOR-bank* birth-max)) (return (the-as object #f))))) + (else + (if (and (-> s1-1 process) (not (logtest? (-> s1-1 perm status) (entity-perm-status bit-3)))) (kill! (-> s1-1 entity))))))))) + (*vis-actors* + (when (not (and (-> s4-2 vis-info 0) (-> s4-2 all-visible?))) + (let* ((s3-5 (-> s4-2 entity)) + (s2-4 (-> s3-5 length)) + (s0-1 #f)) + (dotimes (s1-2 s2-4) + (let ((sv-32 (-> s3-5 data s1-2))) + (cond + ;; og:preserve-this check for actor culling setting + ((and (#if PC_PORT + (or (with-pc (not (-> *pc-settings* ps2-actor-vis?))) (is-object-visible? s4-2 (-> sv-32 vis-id))) + (is-object-visible? s4-2 (-> sv-32 vis-id))) + (not (logtest? (-> sv-32 perm status) (entity-perm-status bit-9 bit-10)))) + (when (not (or (-> sv-32 process) (logtest? (-> sv-32 perm status) (entity-perm-status bit-0 dead)) s0-1)) + (birth! (-> sv-32 entity)) + (+! sv-24 1) + (when (< (/ (the float (memory-free *nk-dead-pool*)) (the float (memory-total *nk-dead-pool*))) 0.1) + (format 0 + "WARNING: low actor memory, no birth triggered!!! ~D/~D~%" + (memory-free *nk-dead-pool*) + (memory-total *nk-dead-pool*)) + (set! s0-1 #t)))) + (else + (when (and (-> sv-32 process) (not (logtest? (-> sv-32 perm status) (entity-perm-status bit-3)))) + (kill! (-> sv-32 entity)) + (+! sv-24 1))))) + (if (>= sv-24 (-> *ACTOR-bank* birth-max)) (return (the-as object #f))))))))))))) 0) (defun entity-birth-no-kill ((arg0 entity)) diff --git a/goal_src/jak1/engine/entity/res.gc b/goal_src/jak1/engine/entity/res.gc index 0210eddccd..193b48e0db 100644 --- a/goal_src/jak1/engine/entity/res.gc +++ b/goal_src/jak1/engine/entity/res.gc @@ -78,8 +78,8 @@ This is updated from the entity system used in Crash 2, which had most of these (set! (-> this allocated-length) data-count) (set! (-> this data-size) data-size) (set! (-> this length) 0) - (set! (-> this data-base) (&-> (-> this tag) data-count)) - (set! (-> this data-top) (&-> (-> this tag) data-count)) + (set! (-> this data-base) (&-> this tag data-count)) + (set! (-> this data-top) (&-> this tag data-count)) this)) (defmethod length ((this res-lump)) @@ -516,24 +516,23 @@ This is updated from the entity system used in Crash 2, which had most of these (defmethod mem-usage ((this res-lump) (block memory-usage-block) (flags int)) "Get the memory usage of this lump and its data" - (local-vars (sv-16 int)) ;; get the name and ID (let ((mem-use-id (mem-usage-id res)) (mem-use-name "res")) (cond - ((nonzero? (logand flags 256)) (set! mem-use-id (mem-usage-id camera)) (set! mem-use-name "camera")) - ((nonzero? (logand flags 64)) (set! mem-use-id (mem-usage-id entity)) (set! mem-use-name "entity")) - ((nonzero? (logand flags 128)) (set! mem-use-id (mem-usage-id ambient)) (set! mem-use-name "ambient")) - ((nonzero? (logand flags 512)) (set! mem-use-id (mem-usage-id art-joint-geo)) (set! mem-use-name "art-joint-geo"))) + ((logtest? flags 256) (set! mem-use-id (mem-usage-id camera)) (set! mem-use-name "camera")) + ((logtest? flags 64) (set! mem-use-id (mem-usage-id entity)) (set! mem-use-name "entity")) + ((logtest? flags 128) (set! mem-use-id (mem-usage-id ambient)) (set! mem-use-name "ambient")) + ((logtest? flags 512) (set! mem-use-id (mem-usage-id art-joint-geo)) (set! mem-use-name "art-joint-geo"))) ;; set up the block (set! (-> block length) (max (-> block length) (+ mem-use-id 1))) (set! (-> block data mem-use-id name) mem-use-name) ;; the lump counts as 1 in the count field - (set! (-> block data mem-use-id count) (+ (-> block data mem-use-id count) 1)) + (+! (-> block data mem-use-id count) 1) ;; add the size of the lump itself. (let ((obj-size (asize-of this))) - (set! (-> block data mem-use-id used) (+ (-> block data mem-use-id used) obj-size)) - (set! (-> block data mem-use-id total) (+ (-> block data mem-use-id total) (logand -16 (+ obj-size 15))))) + (+! (-> block data mem-use-id used) obj-size) + (+! (-> block data mem-use-id total) (logand -16 (+ obj-size 15)))) ;; add the tags (dotimes (tag-idx (-> this length)) (when (zero? (-> this tag tag-idx inlined?)) @@ -549,35 +548,34 @@ This is updated from the entity system used in Crash 2, which had most of these ;; this seems identical to the else case. (set! (-> block length) (max (-> block length) (+ mem-use-id 1))) (set! (-> block data mem-use-id name) mem-use-name) - (set! (-> block data mem-use-id count) (+ (-> block data mem-use-id count) 1)) + (+! (-> block data mem-use-id count) 1) (let ((v1-47 (asize-of tag-data))) - (set! (-> block data mem-use-id used) (+ (-> block data mem-use-id used) v1-47)) - (set! (-> block data mem-use-id total) (+ (-> block data mem-use-id total) (logand -16 (+ v1-47 15)))))) - ((nav-mesh collide-mesh) - ;; these have their own implementation. - (mem-usage tag-data block flags)) + (+! (-> block data mem-use-id used) v1-47) + (+! (-> block data mem-use-id total) (logand -16 (+ v1-47 15))))) + ;; these have their own implementation. + ((nav-mesh collide-mesh) (mem-usage (the-as collide-mesh tag-data) block flags)) ((array) (set! (-> block length) (max (-> block length) (+ mem-use-id 1))) (set! (-> block data mem-use-id name) mem-use-name) - (set! (-> block data mem-use-id count) (+ (-> block data mem-use-id count) 1)) + (+! (-> block data mem-use-id count) 1) (let ((v1-63 (asize-of (the-as (array object) tag-data)))) - (set! (-> block data mem-use-id used) (+ (-> block data mem-use-id used) v1-63)) - (set! (-> block data mem-use-id total) (+ (-> block data mem-use-id total) (logand -16 (+ v1-63 15))))) + (+! (-> block data mem-use-id used) v1-63) + (+! (-> block data mem-use-id total) (logand -16 (+ v1-63 15)))) ;; call mem usage on all of our children. - (set! sv-16 0) - (while (< sv-16 (-> (the-as array tag-data) length)) - (let ((a0-58 (-> (the-as (array object) tag-data) sv-16))) - ((method-of-type (rtype-of a0-58) mem-usage) a0-58 block flags)) - (set! sv-16 (+ sv-16 1)))) + (let ((sv-16 0)) + (while (< sv-16 (-> (the-as array tag-data) length)) + (let ((a0-58 (-> (the-as (array object) tag-data) sv-16))) + ((method-of-type (rtype-of a0-58) mem-usage) a0-58 block flags)) + (+! sv-16 1)))) (else ;; unknown type. ;; we assume its nothing fancy and use the asize of. (set! (-> block length) (max (-> block length) (+ mem-use-id 1))) (set! (-> block data mem-use-id name) mem-use-name) - (set! (-> block data mem-use-id count) (+ (-> block data mem-use-id count) 1)) + (+! (-> block data mem-use-id count) 1) (let ((v1-88 (asize-of tag-data))) - (set! (-> block data mem-use-id used) (+ (-> block data mem-use-id used) v1-88)) - (set! (-> block data mem-use-id total) (+ (-> block data mem-use-id total) (logand -16 (+ v1-88 15)))))))))))) + (+! (-> block data mem-use-id used) v1-88) + (+! (-> block data mem-use-id total) (logand -16 (+ v1-88 15))))))))))) (the-as res-lump 0)) (define *res-static-buf* (malloc 'global 128)) diff --git a/goal_src/jak1/engine/game/effect-control.gc b/goal_src/jak1/engine/game/effect-control.gc index 06ea81e867..2ab3ab874b 100644 --- a/goal_src/jak1/engine/game/effect-control.gc +++ b/goal_src/jak1/engine/game/effect-control.gc @@ -47,8 +47,8 @@ ((!= s5-0 (-> this last-frame-group)) (set! (-> this res) (-> s5-0 extra)) (let ((v1-6 (-> (lookup-tag-idx (-> s5-0 extra) 'effect-name 'base -1000000000.0) lo))) - (set! (-> this name) (if (>= (the-as int v1-6) 0) (&-> (-> s5-0 extra tag) v1-6) (the-as (pointer res-tag) #f)))) - (if (and (-> this name) (= (-> this name 0 key-frame) -1000000000.0)) (set! (-> this name) (&-> (-> this name) 1))) + (set! (-> this name) (if (>= (the-as int v1-6) 0) (&-> s5-0 extra tag v1-6) (the-as (pointer res-tag) #f)))) + (if (and (-> this name) (= (-> this name 0 key-frame) -1000000000.0)) (set! (-> this name) (&-> this name 1))) (effect-control-method-14 this f30-0 f30-0 f30-0)) ((or (not (-> this name)) (= f30-0 (-> this last-frame-num)))) (else @@ -102,16 +102,6 @@ (none)) (defmethod effect-control-method-10 ((this effect-control) (arg0 symbol) (arg1 float) (arg2 int)) - (local-vars - (sv-160 int) - (sv-176 symbol) - (sv-192 symbol) - (sv-208 symbol) - (sv-224 int) - (sv-240 symbol) - (sv-256 symbol) - (sv-272 symbol) - (sv-288 res-lump)) (let ((s3-0 (-> arg0 value)) (s5-0 (cond ((< arg2 0) @@ -158,28 +148,16 @@ (when (and (nonzero? s3-0) (= (-> (the-as sparticle-launch-group s3-0) type) sparticle-launch-group)) (if *debug-effect-control* (format #t "(~5D) effect group ~A ~A frame ~F joint ~D~%" (current-time) (-> this process name) arg0 arg1 s5-0)) - (let ((s4-1 (get-process *default-dead-pool* part-tracker #x4000))) - (when s4-1 - (let ((t9-7 (method-of-type part-tracker activate))) - (t9-7 (the-as part-tracker s4-1) (-> this process) 'part-tracker (the-as pointer #x70004000))) - (let ((s2-1 run-function-in-process) - (s1-0 s4-1) - (s0-0 part-tracker-init)) - (set! sv-160 -1) - (set! sv-176 (the-as symbol #f)) - (set! sv-192 (the-as symbol #f)) - (set! sv-208 (the-as symbol #f)) - (let ((t3-0 (vector<-cspace! (new 'stack-no-clear 'vector) (-> this process node-list data s5-0)))) - ((the-as (function object object object object object object object object none) s2-1) - s1-0 - s0-0 - (the-as sparticle-launch-group s3-0) - sv-160 - sv-176 - sv-192 - sv-208 - t3-0))) - (-> s4-1 ppointer))))) + (process-spawn part-tracker + :init + part-tracker-init + (the-as sparticle-launch-group s3-0) + -1 + (the-as symbol #f) + (the-as symbol #f) + (the-as symbol #f) + (vector<-cspace! (new 'stack-no-clear 'vector) (-> this process node-list data s5-0)) + :to (-> this process)))) ((= arg0 'camera-shake) (activate! *camera-smush-control* 819.2 37 600 1.0 0.995)) ((zero? s3-0) (effect-control-method-12 this arg0 arg1 s5-0 (-> this res) (string->sound-name (symbol->string arg0)))) ((= (-> (the-as basic s3-0) type) sparticle-launcher) @@ -191,28 +169,16 @@ ((= (-> (the-as basic s3-0) type) sparticle-launch-group) (if *debug-effect-control* (format #t "(~5D) effect group ~A ~A frame ~F joint ~D~%" (current-time) (-> this process name) arg0 arg1 s5-0)) - (let ((s4-3 (get-process *default-dead-pool* part-tracker #x4000))) - (when s4-3 - (let ((t9-19 (method-of-type part-tracker activate))) - (t9-19 (the-as part-tracker s4-3) (-> this process) 'part-tracker (the-as pointer #x70004000))) - (let ((s2-3 run-function-in-process) - (s1-2 s4-3) - (s0-2 part-tracker-init)) - (set! sv-224 -1) - (set! sv-240 (the-as symbol #f)) - (set! sv-256 (the-as symbol #f)) - (set! sv-272 (the-as symbol #f)) - (let ((t3-1 (vector<-cspace! (new 'stack-no-clear 'vector) (-> this process node-list data s5-0)))) - ((the-as (function object object object object object object object object none) s2-3) - s1-2 - s0-2 - s3-0 - sv-224 - sv-240 - sv-256 - sv-272 - t3-1))) - (-> s4-3 ppointer)))) + (process-spawn part-tracker + :init + part-tracker-init + s3-0 + -1 + (the-as symbol #f) + (the-as symbol #f) + (the-as symbol #f) + (vector<-cspace! (new 'stack-no-clear 'vector) (-> this process node-list data s5-0)) + :to (-> this process))) ((= (-> (the-as basic s3-0) type) sound-spec) (sound-play-by-spec (the-as sound-spec s3-0) (new-sound-id) @@ -232,23 +198,18 @@ (set! (-> v1-67 death-timer) (+ a0-55 1))) (set! (-> v1-67 death-timer-org) (-> v1-67 death-timer)) (set! (-> v1-67 death-draw-overlap) (-> (the-as death-info s3-0) overlap))) - (when (-> (the-as death-info s3-0) sound) - (let* ((s2-5 this) - (s1-3 (method-of-object s2-5 effect-control-method-12)) - (s0-3 (-> (the-as death-info s3-0) sound))) - (set! sv-288 (-> this res)) - (let ((t1-11 (string->sound-name (symbol->string (-> (the-as death-info s3-0) sound))))) - (s1-3 s2-5 s0-3 arg1 s5-0 sv-288 t1-11)))) + (if (-> (the-as death-info s3-0) sound) + (effect-control-method-12 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))) (else (effect-control-method-12 this arg0 arg1 s5-0 (-> this res) (string->sound-name (symbol->string arg0))))))) 0) (defmethod effect-control-method-11 ((this effect-control) (arg0 symbol) (arg1 float) (arg2 int) (arg3 basic) (arg4 pat-surface)) - (local-vars - (sv-48 (function sparticle-system sparticle-launcher vector sparticle-launch-state sparticle-launch-control float none)) - (sv-64 sparticle-system) - (sv-80 (function sparticle-system sparticle-launcher vector sparticle-launch-state sparticle-launch-control float none)) - (sv-96 sparticle-system)) (let ((s1-0 (the-as sound-name #f))) (let ((a0-4 (-> *display* frames (-> *display* last-screen) frame run-time))) (case arg0 @@ -408,14 +369,8 @@ ((= v1-36 (pat-material swamp)) (-> *part-id-table* 2257)) ((= v1-36 (pat-material neutral)) (-> *part-id-table* 2773)) (else (-> *part-id-table* 96))))) - (when (nonzero? s0-0) - (set! sv-48 sp-launch-particles-var) - (set! sv-64 *sp-particle-system-2d*) - (let ((a2-36 (vector<-cspace! (new 'stack-no-clear 'vector) (-> this process node-list data arg2))) - (a3-6 #f) - (t0-1 #f) - (t1-1 1.0)) - (sv-48 sv-64 s0-0 a2-36 (the-as sparticle-launch-state a3-6) (the-as sparticle-launch-control t0-1) t1-1))))) + (if (nonzero? s0-0) + (launch-particles s0-0 (vector<-cspace! (new 'stack-no-clear 'vector) (-> this process node-list data arg2)))))) (('effect-jump-droppings) (let* ((v1-61 (-> arg4 material)) (s0-1 (cond @@ -436,22 +391,15 @@ ((= v1-61 (pat-material swamp)) (-> *part-id-table* 2270)) ((= v1-61 (pat-material neutral)) (-> *part-id-table* 2774)) (else (-> *part-id-table* 107))))) - (when (nonzero? s0-1) - (set! sv-80 sp-launch-particles-var) - (set! sv-96 *sp-particle-system-2d*) - (let ((a2-37 (vector<-cspace! (new 'stack-no-clear 'vector) (-> this process node-list data arg2))) - (a3-7 #f) - (t0-2 #f) - (t1-2 1.0)) - (sv-80 sv-96 s0-1 a2-37 (the-as sparticle-launch-state a3-7) (the-as sparticle-launch-control t0-2) t1-2))))))) + (if (nonzero? s0-1) + (launch-particles s0-1 (vector<-cspace! (new 'stack-no-clear 'vector) (-> this process node-list data arg2)))))))) (if s1-0 (effect-control-method-12 this arg0 arg1 arg2 arg3 s1-0))) 0 (none)) (defmethod effect-control-method-12 ((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 (new 'stack 'sound-spec)) (s5-0 (if (< arg2 0) (the-as vector #f) (vector<-cspace! (new 'stack-no-clear 'vector) (-> this process node-list data arg2))))) (set! (-> gp-0 sound-name) s0-0) @@ -459,26 +407,20 @@ (set! (-> gp-0 volume) 1024) (logior! (-> gp-0 mask) (sound-mask bend)) (set! (-> gp-0 bend) (the int (* 327.66998 (rand-vu-float-range -100.0 100.0)))) - (set! sv-112 (new 'static 'res-tag)) - (let* ((t9-3 (method-of-type res-lump get-property-data)) - (a1-6 '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-7 (t9-3 (the-as res-lump sv-144) a1-6 a2-1 a3-1 (the-as pointer t0-1) t1-1 t2-0))) + (let* ((sv-112 (new 'static 'res-tag)) + (a1-7 ((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*))) (if a1-7 (effect-param->sound-spec gp-0 (the-as (pointer float) a1-7) (the-as int (-> sv-112 elt-count))))) - (if (and (nonzero? (-> gp-0 fo-max)) - (let ((f30-1 (* 4096.0 (the float (-> gp-0 fo-max))))) - (set! sv-160 vector-vector-distance) - (let ((a0-6 (ear-trans)) - (a1-8 s5-0)) - (< f30-1 (sv-160 a0-6 a1-8))))) + (if (and (nonzero? (-> gp-0 fo-max)) (< (* 4096.0 (the float (-> gp-0 fo-max))) (vector-vector-distance (ear-trans) s5-0))) (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 " (current-time) diff --git a/goal_src/jak1/engine/game/fact-h.gc b/goal_src/jak1/engine/game/fact-h.gc index 6ecc4cb9aa..7111cb8927 100644 --- a/goal_src/jak1/engine/game/fact-h.gc +++ b/goal_src/jak1/engine/game/fact-h.gc @@ -154,9 +154,9 @@ (goto cfg-10)) ;; remember who we belong to (set! (-> this process) proc) - (set! tag (new 'static 'res-tag)) ;; eco may override the pickup type and amount, so try to get this. - (let ((v1-6 (res-lump-data ent 'eco-info (pointer int32) :tag-ptr (& tag) :time 0.0))) + (let* ((tag (new 'static 'res-tag)) + (v1-6 (res-lump-data ent 'eco-info (pointer int32) :tag-ptr (& tag) :time 0.0))) (cond (v1-6 ;; eco-info lookup succeeded, diff --git a/goal_src/jak1/engine/game/game-info.gc b/goal_src/jak1/engine/game/game-info.gc index e116378288..b5a0a966c9 100644 --- a/goal_src/jak1/engine/game/game-info.gc +++ b/goal_src/jak1/engine/game/game-info.gc @@ -143,7 +143,7 @@ The cause can be 'dead if you die, or 'game to reset everything. If save-to-load is not #f will load data from that. If continue-point-override is not #f, will use that." - (local-vars (v0-0 int) (sv-96 symbol)) + (local-vars (v0-0 int)) (case cause (('dead) ;; reload game-info because we died. Increase death counts @@ -534,7 +534,8 @@ (none)))) (process-spawn-function process (lambda ((arg0 process-drawable)) - (let ((s5-0 (current-time))) (until (time-elapsed? s5-0 (seconds 0.6)) (send-event arg0 'effect 'eco-blue) (suspend))) + (suspend-for (seconds 0.6) + (send-event arg0 'effect 'eco-blue)) (none)) s5-1 :from diff --git a/goal_src/jak1/engine/game/game-save.gc b/goal_src/jak1/engine/game/game-save.gc index 30fa51e2dd..d3de7c5de3 100644 --- a/goal_src/jak1/engine/game/game-save.gc +++ b/goal_src/jak1/engine/game/game-save.gc @@ -17,7 +17,6 @@ ;; Having two state machines, one in C++ and one in GOAL is kind of a questionable and confusing design. (define-extern mark-speedrun-started (function none)) -;; DECOMP BEGINS ;; version identifier (defconstant SAVE_VERSION 1) @@ -187,19 +186,14 @@ (let ((tag (the-as game-save-tag (-> this tag))) (tag-idx 0)) (while (< (the-as int tag) (the-as int (&-> this tag 0 user-int8 (-> this length)))) - (let ((a3-2 (game-save-elt->string (-> tag elt-type))) - (t0-1 (-> tag elt-count)) - (t1-1 (-> tag elt-size)) - (t2-1 (-> tag user-uint64)) - (t3-0 (-> tag user-float0))) - (format #t - "~T [~3D] ~-32S [~3D/~3D] ~12D ~8f " - tag-idx - (game-save-elt->string (-> tag elt-type)) - (-> tag elt-count) - (-> tag elt-size) - (-> tag user-uint64) - (-> tag user-float0))) + (format #t + "~T [~3D] ~-32S [~3D/~3D] ~12D ~8f " + tag-idx + (game-save-elt->string (-> tag elt-type)) + (-> tag elt-count) + (-> tag elt-size) + (-> tag user-uint64) + (-> tag user-float0)) (let ((v1-0 (-> tag elt-type))) (if (or (= v1-0 (game-save-elt name)) (= v1-0 (game-save-elt continue))) (format #t "= \"~G\"~%" (&+ (the-as pointer tag) 16)) @@ -327,7 +321,7 @@ (set! (-> s2-0 elt-type) (game-save-elt name)) (set! (-> s2-0 elt-count) (+ (length arg1) 1)) (set! (-> s2-0 elt-size) (the-as uint 1))) - (copy-charp<-charp (the-as (pointer uint8) (-> (the-as (inline-array game-save-tag) s3-2) 1)) (-> arg1 data)) + (copy-charp<-charp (-> (the-as (inline-array game-save-tag) s3-2) 1 user-uint8) (-> arg1 data)) (let ((v1-37 (&+ (the-as pointer s3-2) (+ (logand -16 (+ (-> (the-as (inline-array game-save-tag) s3-2) 0 elt-count) 15)) 16)))) (let ((a0-15 (the-as game-save-tag (&+ v1-37 0)))) (set! (-> a0-15 elt-type) (game-save-elt base-time)) @@ -354,7 +348,7 @@ (set! (-> s2-1 elt-type) (game-save-elt continue)) (set! (-> s2-1 elt-count) (+ ((method-of-type string length) s3-3) 1)) (set! (-> s2-1 elt-size) (the-as uint 1))) - (copy-charp<-charp (the-as (pointer uint8) (the-as game-save-tag (&+ (the-as game-save-tag s4-1) 16))) (-> s3-3 data))) + (copy-charp<-charp (-> (the-as game-save-tag (&+ (the-as game-save-tag s4-1) 16)) user-uint8) (-> s3-3 data))) (let ((v1-50 (&+ (the-as pointer s4-1) (+ (logand -16 (+ (-> (the-as game-save-tag s4-1) elt-count) 15)) 16)))) (let ((a0-24 (the-as game-save-tag (&+ v1-50 0)))) (set! (-> a0-24 elt-type) (game-save-elt life)) @@ -836,36 +830,35 @@ ((method-of-type process deactivate) this) (none)) -(defmethod relocate ((this auto-save) (arg0 int)) +(defmethod relocate ((this auto-save) (offset int)) "Relocate an auto-save process by arg0 bytes." ;; update our reference particle launch control, which is allocated on our process heap - (if (nonzero? (-> this part)) (&+! (-> this part) arg0)) + (if (nonzero? (-> this part)) (&+! (-> this part) offset)) ;; then relocate the process. This will relocate the heap (memory, and basics on it). - (the-as auto-save ((method-of-type process relocate) this arg0))) + (the-as auto-save ((method-of-type process relocate) this offset))) (defbehavior auto-save-post auto-save () - ;; debug text - (when (and (= *cheat-mode* 'debug) (logtest? (-> *cpad-list* cpads 0 button0-abs 0) (pad-buttons l3))) + (when (and (= *cheat-mode* 'debug) (cpad-hold? 0 l3)) (let ((gp-0 (new 'stack 'font-context *font-default-matrix* 32 160 0.0 (font-color default) (font-flags shadow kerning)))) - (let ((v1-5 gp-0)) (set! (-> v1-5 width) (the float 440))) - (let ((v1-6 gp-0)) (set! (-> v1-6 height) (the float 80))) + (set-width! gp-0 440) + (set-height! gp-0 80) (set! (-> gp-0 flags) (font-flags shadow kerning)) (format (clear *temp-string*) "~S / ~S ~D~%" (-> self mode) (-> self state name) (-> self which)) (print-game-text *temp-string* gp-0 #f 128 22))) ;; auto-save drawing (when (and (= (-> self mode) 'auto-save) (!= (-> self next-state name) 'done)) (let ((gp-1 (new 'stack 'font-context *font-default-matrix* 20 40 0.0 (font-color default) (font-flags shadow kerning)))) - (let ((v1-15 gp-1)) (set! (-> v1-15 scale) 0.8)) - (let ((v1-16 gp-1)) (set! (-> v1-16 width) (the float 472))) - (let ((v1-17 gp-1)) (set! (-> v1-17 height) (the float 20))) + (set-scale! gp-1 0.8) + (set-width! gp-1 472) + (set-height! gp-1 20) (set! (-> gp-1 flags) (font-flags shadow kerning middle middle-vert large)) ;; if this is the first time saving, display a warning. (when (zero? (-> *game-info* auto-save-count)) (print-game-text (lookup-text! *common-text* (text-id saving-data) #f) gp-1 #f 128 22) (set! (-> gp-1 origin x) 20.0) (set! (-> gp-1 origin y) 130.0) - (let ((v1-23 gp-1)) (set! (-> v1-23 scale) 0.7)) - (let ((v1-24 gp-1)) (set! (-> v1-24 height) (the float 40))) + (set-scale! gp-1 0.7) + (set-height! gp-1 40) (let ((s5-2 print-game-text)) ((the-as (function object string object none) format) (clear *temp-string*) @@ -908,7 +901,7 @@ (set! (-> self result) (mc-status-code ok)) (set! (-> self save) #f) (set! (-> self notify) (process->handle notify-proc)) - (set! (-> self part) (create-launch-control (-> *part-group-id-table* 656) self)) + (set! (-> self part) (create-launch-control group-part-save-icon self)) (set! (-> self part matrix) (sprite-allocate-user-hvdf)) (cond ((= desired-mode 'auto-save) @@ -1068,7 +1061,7 @@ (debug-print (-> self save) (user? dass))) (label cfg-7) (set! (-> self result) - (mc-save (-> self card) (-> self which) (&-> (-> self save) type) (the-as int (-> self save info-int32)))) + (mc-save (-> self card) (-> self which) (&-> self save type) (the-as int (-> self save info-int32)))) (when (!= (-> self result) (mc-status-code ok)) (suspend) (goto cfg-7)) @@ -1184,7 +1177,7 @@ (activate-progress *dproc* (progress-screen auto-save)))))))) (defun auto-save-command ((arg0 symbol) (arg1 int) (arg2 int) (arg3 process-tree)) - (process-spawn auto-save arg0 arg3 arg1 arg2) + (process-spawn auto-save arg0 arg3 arg1 arg2 :stack *kernel-dram-stack*) (none)) (defun auto-save-check () diff --git a/goal_src/jak1/engine/game/projectiles.gc b/goal_src/jak1/engine/game/projectiles.gc index c1a7c8868b..7421c74f30 100644 --- a/goal_src/jak1/engine/game/projectiles.gc +++ b/goal_src/jak1/engine/game/projectiles.gc @@ -67,52 +67,48 @@ (-> gp-0 match))) (defun projectile-collision-reaction ((arg0 collide-shape-moving) (arg1 collide-shape-intersect) (arg2 vector) (arg3 vector)) - (local-vars (sv-64 vector) (sv-68 vector) (sv-72 matrix) (sv-80 int) (sv-224 symbol)) - (set! sv-64 (new-stack-vector0)) - (set! sv-68 (new-stack-vector0)) - (set! sv-72 (new 'stack-no-clear 'matrix)) - (set! sv-80 0) - (set! (-> sv-72 vector 0 quad) (-> arg3 quad)) - (let ((a1-1 (new 'stack-no-clear 'vector))) - (vector-float*! a1-1 (-> arg1 move-vec) (-> arg1 best-u)) - (move-by-vector! arg0 a1-1)) - (set-and-handle-pat! arg0 (-> arg1 best-tri pat)) - (case (-> arg1 best-tri pat material) - (((pat-material stopproj)) (send-event (-> arg0 process) 'die))) - (vector-! sv-64 (-> arg1 best-from-prim prim-core world-sphere) (-> arg1 best-tri intersect)) - (set! (-> sv-64 w) 1.0) - (vector-normalize! sv-64 1.0) - (set! (-> arg0 coverage) (vector-dot sv-64 (-> arg1 best-tri normal))) - (let ((v1-22 (-> sv-64 quad))) (set! (-> sv-68 quad) v1-22)) - (when (= (-> arg1 best-u) 0.0) - (let ((a1-7 (vector-float*! (new 'stack-no-clear 'vector) sv-68 32.0))) (move-by-vector! arg0 a1-7))) - (set! (-> arg0 surface-normal quad) (-> sv-68 quad)) - (set! (-> arg0 poly-normal quad) (-> arg1 best-tri normal quad)) - (set! (-> arg0 surface-angle) (vector-dot sv-68 (-> arg0 dynam gravity-normal))) - (set! (-> arg0 poly-angle) (vector-dot (-> arg0 poly-normal) (-> arg0 dynam gravity-normal))) - (set! (-> arg0 touch-angle) - (vector-dot sv-68 (vector-normalize! (vector-negate! (new-stack-vector0) (the-as vector sv-72)) 1.0))) - (if (< (-> arg0 poly-angle) -0.2) (set! sv-80 (logior sv-80 16))) - (set! sv-224 (< (fabs (-> arg0 surface-angle)) (-> *pat-mode-info* (-> arg0 cur-pat mode) wall-angle))) - (if (not (logtest? (-> arg0 prev-status) (cshape-moving-flags onsurf))) - (set! (-> arg0 ground-impact-vel) (- (vector-dot (-> arg0 transv) (-> arg0 dynam gravity-normal))))) - (set! sv-80 (logior sv-80 4)) - (if (-> arg1 best-to-prim) (set! sv-80 (logior sv-80 32))) - (cond - (sv-224 - (set! sv-80 (logior sv-80 8)) - (set! (-> arg0 cur-pat mode) 1) - (set! (-> arg0 local-normal quad) (-> sv-68 quad))) - (else (set! sv-80 (logior sv-80 1)) (set! (-> arg0 local-normal quad) (-> sv-68 quad)))) - (vector-reflect-flat-above! arg2 (the-as vector sv-72) sv-68) - (when (and (not sv-224) (>= (-> arg0 coverage) 0.9)) - (set! sv-80 (logior sv-80 2)) - (set! (-> arg0 ground-poly-normal quad) (-> arg0 poly-normal quad)) - (when (!= (-> arg0 poly-pat mode) (pat-mode wall)) - (set! (-> arg0 ground-pat) (-> arg0 poly-pat)) - (set! (-> arg0 ground-touch-point quad) (-> arg1 best-tri intersect quad)))) - (logior! (-> arg0 status) sv-80) - (the-as cshape-moving-flags sv-80)) + (let ((sv-64 (new-stack-vector0)) + (sv-68 (new-stack-vector0)) + (sv-72 (new 'stack-no-clear 'matrix)) + (sv-80 0)) + (set! (-> sv-72 vector 0 quad) (-> arg3 quad)) + (let ((a1-1 (new 'stack-no-clear 'vector))) + (vector-float*! a1-1 (-> arg1 move-vec) (-> arg1 best-u)) + (move-by-vector! arg0 a1-1)) + (set-and-handle-pat! arg0 (-> arg1 best-tri pat)) + (case (-> arg1 best-tri pat material) + (((pat-material stopproj)) (send-event (-> arg0 process) 'die))) + (vector-! sv-64 (-> arg1 best-from-prim prim-core world-sphere) (-> arg1 best-tri intersect)) + (set! (-> sv-64 w) 1.0) + (vector-normalize! sv-64 1.0) + (set! (-> arg0 coverage) (vector-dot sv-64 (-> arg1 best-tri normal))) + (set! (-> sv-68 quad) (-> sv-64 quad)) + (when (= (-> arg1 best-u) 0.0) + (let ((a1-7 (vector-float*! (new 'stack-no-clear 'vector) sv-68 32.0))) (move-by-vector! arg0 a1-7))) + (set! (-> arg0 surface-normal quad) (-> sv-68 quad)) + (set! (-> arg0 poly-normal quad) (-> arg1 best-tri normal quad)) + (set! (-> arg0 surface-angle) (vector-dot sv-68 (-> arg0 dynam gravity-normal))) + (set! (-> arg0 poly-angle) (vector-dot (-> arg0 poly-normal) (-> arg0 dynam gravity-normal))) + (set! (-> arg0 touch-angle) + (vector-dot sv-68 (vector-normalize! (vector-negate! (new-stack-vector0) (the-as vector sv-72)) 1.0))) + (if (< (-> arg0 poly-angle) -0.2) (logior! sv-80 16)) + (let ((sv-224 (< (fabs (-> arg0 surface-angle)) (-> *pat-mode-info* (-> arg0 cur-pat mode) wall-angle)))) + (if (not (logtest? (-> arg0 prev-status) (cshape-moving-flags onsurf))) + (set! (-> arg0 ground-impact-vel) (- (vector-dot (-> arg0 transv) (-> arg0 dynam gravity-normal))))) + (logior! sv-80 4) + (if (-> arg1 best-to-prim) (logior! sv-80 32)) + (cond + (sv-224 (logior! sv-80 8) (set! (-> arg0 cur-pat mode) 1) (set! (-> arg0 local-normal quad) (-> sv-68 quad))) + (else (logior! sv-80 1) (set! (-> arg0 local-normal quad) (-> sv-68 quad)))) + (vector-reflect-flat-above! arg2 (the-as vector sv-72) sv-68) + (when (and (not sv-224) (>= (-> arg0 coverage) 0.9)) + (logior! sv-80 2) + (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 ground-touch-point quad) (-> arg1 best-tri intersect quad))))) + (logior! (-> arg0 status) sv-80) + (the-as cshape-moving-flags sv-80))) (defpartgroup group-yellow-eco-fireball :id 102 @@ -882,7 +878,6 @@ (none)) (defun spawn-projectile-blue ((arg0 target)) - (local-vars (sv-48 entity-actor)) (with-pp (when arg0 (let ((s3-0 (rand-vu-int-range 3 (+ (-> arg0 node-list length) -1))) @@ -898,19 +893,16 @@ (t9-5 (the-as projectile-blue s4-1) pp 'projectile-blue (the-as pointer #x70004000))) (let ((s2-0 run-function-in-process) (s1-0 s4-1) - (s0-0 projectile-init-by-other)) - (set! sv-48 (-> pp entity)) - (let ((a3-1 (vector<-cspace! (new 'stack-no-clear 'vector) (-> arg0 node-list data s3-0))) - (t1-0 8) - (t2-0 (process->handle pp))) - ((the-as (function process function object object object object object object) s2-0) - s1-0 - s0-0 - sv-48 - a3-1 - gp-0 - t1-0 - t2-0))) + (s0-0 projectile-init-by-other) + (sv-48 (-> pp entity))) + ((the-as (function process function object object object object object object) s2-0) + s1-0 + s0-0 + sv-48 + (vector<-cspace! (new 'stack-no-clear 'vector) (-> arg0 node-list data s3-0)) + gp-0 + 8 + (process->handle pp))) (-> s4-1 ppointer))))) 0 (none))) diff --git a/goal_src/jak1/engine/geometry/cylinder.gc b/goal_src/jak1/engine/geometry/cylinder.gc index a464be45ef..f07ff7158b 100644 --- a/goal_src/jak1/engine/geometry/cylinder.gc +++ b/goal_src/jak1/engine/geometry/cylinder.gc @@ -34,25 +34,6 @@ (defmethod debug-draw ((this cylinder) (arg0 vector4w)) "Debug draw a cylinder. This is slow and ugly" - (local-vars - (sv-896 matrix) - (sv-912 int) - (sv-928 (function vector vector vector float vector)) - (sv-944 vector) - (sv-960 vector) - (sv-976 vector) - (sv-992 (function vector vector vector float vector)) - (sv-1008 vector) - (sv-1024 vector) - (sv-1040 vector) - (sv-1056 (function vector vector vector float vector)) - (sv-1072 vector) - (sv-1088 vector) - (sv-1104 vector) - (sv-1120 (function vector vector vector float vector)) - (sv-1136 vector) - (sv-1152 vector) - (sv-1168 vector)) (rlet ((vf0 :class vf) (vf4 :class vf) (vf5 :class vf) @@ -69,41 +50,30 @@ (s4-0 (new 'stack-no-clear 'cylinder-verts)) (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-5 (-> s3-0 vector 3))) - (.lvf vf4 (&-> (-> this origin) quad)) - (.lvf vf5 (&-> sv-896 vector 0 quad)) - (.mov.vf.w vf6 vf0) - (.sub.vf.xyz vf6 vf4 vf5) - (.svf (&-> v1-5 quad) vf6)) - (set! sv-912 0) - (while (< sv-912 8) - (vector+! (-> s5-0 vert (+ sv-912 8)) (-> this origin) s1-0) - (vector+float*! (-> s5-0 vert (+ sv-912 8)) (-> s5-0 vert (+ sv-912 8)) s0-0 (the float sv-912)) - (set! sv-912 (+ sv-912 1))) + (let ((sv-896 (new 'stack-no-clear 'matrix))) + (vector-matrix*! (the-as vector sv-896) (-> this origin) s3-0) + (let ((v1-5 (-> s3-0 vector 3))) + (.lvf vf4 (&-> (-> this origin) quad)) + (.lvf vf5 (&-> sv-896 vector 0 quad)) + (.mov.vf.w vf6 vf0) + (.sub.vf.xyz vf6 vf4 vf5) + (.svf (&-> v1-5 quad) vf6))) + (let ((sv-912 0)) + (while (< sv-912 8) + (vector+! (-> s5-0 vert (+ sv-912 8)) (-> this origin) s1-0) + (vector+float*! (-> s5-0 vert (+ sv-912 8)) (-> s5-0 vert (+ sv-912 8)) s0-0 (the float sv-912)) + (+! sv-912 1))) (dotimes (s0-1 8) - (set! sv-928 vector+float*!) - (set! sv-944 (-> s5-0 vert s0-1)) - (set! sv-960 (-> this origin)) - (set! sv-976 s1-0) - (let ((a3-1 (cos (* 2048.0 (the float (- 7 s0-1)))))) (sv-928 sv-944 sv-960 sv-976 a3-1)) - (set! sv-992 vector+float*!) - (set! sv-1008 (-> s5-0 vert s0-1)) - (set! sv-1024 (-> s5-0 vert s0-1)) - (set! sv-1040 (-> this axis)) - (let ((a3-2 (* (- (-> this radius)) (sin (* 2048.0 (the float (- 7 s0-1))))))) (sv-992 sv-1008 sv-1024 sv-1040 a3-2)) - (set! sv-1056 vector+float*!) - (set! sv-1072 (-> s5-0 vert (+ s0-1 16))) - (set! sv-1088 (-> this origin)) - (set! sv-1104 s1-0) - (let ((a3-3 (cos (* 2048.0 (the float s0-1))))) (sv-1056 sv-1072 sv-1088 sv-1104 a3-3)) - (set! sv-1120 vector+float*!) - (set! sv-1136 (-> s5-0 vert (+ s0-1 16))) - (set! sv-1152 (-> s5-0 vert (+ s0-1 16))) - (set! sv-1168 (-> this axis)) - (let ((a3-4 (+ (-> this length) (* (-> this radius) (sin (* 2048.0 (the float s0-1))))))) - (sv-1120 sv-1136 sv-1152 sv-1168 a3-4))) + (vector+float*! (-> s5-0 vert s0-1) (-> this origin) s1-0 (cos (* 2048.0 (the float (- 7 s0-1))))) + (vector+float*! (-> s5-0 vert s0-1) + (-> s5-0 vert s0-1) + (-> this axis) + (* (- (-> this radius)) (sin (* 2048.0 (the float (- 7 s0-1)))))) + (vector+float*! (-> s5-0 vert (+ s0-1 16)) (-> this origin) s1-0 (cos (* 2048.0 (the float s0-1)))) + (vector+float*! (-> s5-0 vert (+ s0-1 16)) + (-> s5-0 vert (+ s0-1 16)) + (-> this axis) + (+ (-> this length) (* (-> this radius) (sin (* 2048.0 (the float s0-1))))))) (dotimes (s2-1 16) (dotimes (s1-1 24) (vector-matrix*! (-> s4-0 vert s1-1) (-> s5-0 vert s1-1) s3-0) @@ -153,7 +123,6 @@ (defmethod debug-draw ((this cylinder-flat) (arg0 vector4w)) - (local-vars (sv-448 vector) (sv-464 int)) (rlet ((vf0 :class vf) (vf4 :class vf) (vf5 :class vf) @@ -170,19 +139,19 @@ (s4-0 (new 'stack-no-clear 'cylinder-flat-verts)) (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-5 (-> s3-0 vector 3))) - (.lvf vf4 (&-> (-> this origin) quad)) - (.lvf vf5 (&-> sv-448 quad)) - (.mov.vf.w vf6 vf0) - (.sub.vf.xyz vf6 vf4 vf5) - (.svf (&-> v1-5 quad) vf6)) - (set! sv-464 0) - (while (< sv-464 8) - (vector+! (-> s5-0 vert (+ sv-464 1)) (-> this origin) s1-0) - (vector+float*! (-> s5-0 vert (+ sv-464 1)) (-> s5-0 vert (+ sv-464 1)) s0-0 (the float sv-464)) - (set! sv-464 (+ sv-464 1))) + (let ((sv-448 (new 'stack-no-clear 'vector))) + (vector-matrix*! sv-448 (-> this origin) s3-0) + (let ((v1-5 (-> s3-0 vector 3))) + (.lvf vf4 (&-> (-> this origin) quad)) + (.lvf vf5 (&-> sv-448 quad)) + (.mov.vf.w vf6 vf0) + (.sub.vf.xyz vf6 vf4 vf5) + (.svf (&-> v1-5 quad) vf6))) + (let ((sv-464 0)) + (while (< sv-464 8) + (vector+! (-> s5-0 vert (+ sv-464 1)) (-> this origin) s1-0) + (vector+float*! (-> s5-0 vert (+ sv-464 1)) (-> s5-0 vert (+ sv-464 1)) s0-0 (the float sv-464)) + (+! sv-464 1))) (set! (-> s5-0 vert 0 quad) (-> this origin quad)) (vector+float*! (-> s5-0 vert 9) (-> this origin) (-> this axis) (-> this length)) (dotimes (s2-1 16) diff --git a/goal_src/jak1/engine/geometry/path-h.gc b/goal_src/jak1/engine/geometry/path-h.gc index 510fb6b90f..40f3ea480b 100644 --- a/goal_src/jak1/engine/geometry/path-h.gc +++ b/goal_src/jak1/engine/geometry/path-h.gc @@ -44,7 +44,6 @@ (new (symbol type process symbol float) _type_))) (defmethod new path-control ((allocation symbol) (type-to-make type) (proc process) (name symbol) (time float)) - (local-vars (tag res-tag)) (let ((this (object-new allocation type-to-make (the-as int (-> type-to-make size))))) (when (zero? this) ;; allocation failed. @@ -56,11 +55,10 @@ (let ((ent (-> proc entity))) (when (= name 'path) ;; if we are a path, try to look up the path-actor. - (let ((lookup-entity (entity-actor-lookup (the-as res-lump ent) 'path-actor 0))) - (if lookup-entity (set! ent lookup-entity)))) + (let ((lookup-entity (entity-actor-lookup ent 'path-actor 0))) (if lookup-entity (set! ent lookup-entity)))) ;; look up the curve data - (set! tag (new 'static 'res-tag)) - (let ((data (res-lump-data ent name pointer :tag-ptr (& tag) :time time))) + (let* ((tag (new 'static 'res-tag)) + (data (res-lump-data ent name pointer :tag-ptr (& tag) :time time))) (cond (data ;; success, we got some data diff --git a/goal_src/jak1/engine/geometry/vol.gc b/goal_src/jak1/engine/geometry/vol.gc index 6dc262415e..433952d1eb 100644 --- a/goal_src/jak1/engine/geometry/vol.gc +++ b/goal_src/jak1/engine/geometry/vol.gc @@ -13,107 +13,99 @@ (if (< 0.00001 (fabs f1-1)) (/ (- (-> arg0 w) f0-1) f1-1) 409600000.0))) (defmethod init-vol! ((this plane-volume) (arg0 symbol) (arg1 vector-array) (arg2 vector-array)) - (local-vars - (sv-144 vector) - (sv-148 float) - (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 ((f30-0 (plane-volume-intersect-dist (-> s2-0 sv-256) sv-144 sv-192))) - (cond - ((= f30-0 409600000.0)) - ((zero? sv-152) - (vector+float*! sv-144 sv-144 sv-192 f30-0) - (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 f30-0) (>= (vector-dot sv-224 sv-160) 0.0))) - ((>= (vector-dot sv-224 (the-as vector (-> s2-0 sv-256))) 0.0) - (when (< (fabs f30-0) (fabs sv-148)) - (set! sv-148 f30-0) - (set! sv-152 (+ sv-152 1)))) - (else - (vector+float*! sv-144 sv-144 sv-192 f30-0) - (set! (-> sv-160 quad) (-> s2-0 sv-256 quad)) - (set! sv-152 (+ sv-152 1)) - (if (< (fabs f30-0) (fabs sv-148)) (set! sv-148 (- sv-148 f30-0)) (set! sv-148 0.0)))))) - (set! sv-256 (+ sv-256 1))) - (cond - ((zero? sv-152)) - ((= sv-148 0.0)) - (else - (dotimes (v1-70 (-> this num-planes)) - (when (and (!= v1-70 s3-0) (!= v1-70 sv-240)) - (if (< 4096.0 (- (vector-dot sv-144 (the-as vector (-> s2-0 v1-70))) (the-as float (-> s2-0 v1-70 w)))) (goto cfg-42)))) - (vector+float*! sv-224 sv-144 sv-192 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))))))) + (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 ((f30-0 (plane-volume-intersect-dist (-> s2-0 sv-256) sv-144 sv-192))) + (cond + ((= f30-0 409600000.0)) + ((zero? sv-152) + (vector+float*! sv-144 sv-144 sv-192 f30-0) + (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 f30-0) (>= (vector-dot sv-224 sv-160) 0.0))) + ((>= (vector-dot sv-224 (the-as vector (-> s2-0 sv-256))) 0.0) + (when (< (fabs f30-0) (fabs sv-148)) + (set! sv-148 f30-0) + (+! sv-152 1))) + (else + (vector+float*! sv-144 sv-144 sv-192 f30-0) + (set! (-> sv-160 quad) (-> s2-0 sv-256 quad)) + (+! sv-152 1) + (set! sv-148 + (cond + ((< (fabs f30-0) (fabs sv-148)) (set! sv-148 (- sv-148 f30-0)) sv-148) + (else 0.0))))))) + (+! sv-256 1)))) + (cond + ((zero? sv-152)) + ((= sv-148 0.0)) + (else + (dotimes (v1-70 (-> this num-planes)) + (when (and (!= v1-70 s3-0) (!= v1-70 sv-240)) + (if (< 4096.0 (- (vector-dot sv-144 (the-as vector (-> s2-0 v1-70))) (the-as float (-> s2-0 v1-70 w)))) (goto cfg-42)))) + (vector+float*! sv-224 sv-144 sv-192 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))) + (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))))))))))) #f) (defmethod debug-draw ((this plane-volume)) diff --git a/goal_src/jak1/engine/gfx/foreground/ripple.gc b/goal_src/jak1/engine/gfx/foreground/ripple.gc index 70e1795ebc..ef03d0920c 100644 --- a/goal_src/jak1/engine/gfx/foreground/ripple.gc +++ b/goal_src/jak1/engine/gfx/foreground/ripple.gc @@ -105,7 +105,6 @@ (fmax -127.0 (fmin 127.0 f30-0)))) (defun ripple-find-height ((arg0 process-drawable) (arg1 int) (arg2 vector)) - (local-vars (sv-16 float) (sv-32 float)) (let* ((f30-0 (-> arg0 root trans y)) (v1-1 (-> arg0 draw)) (a1-5 (-> v1-1 lod-set lod (-> v1-1 cur-lod) geo effect))) @@ -129,13 +128,13 @@ (ripple-update-waveform-offs s5-0) (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))) - (set! sv-16 (ripple-slow-add-sine-waves s5-0 (+ 1.0 f22-1) f24-1)) - (set! sv-32 (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-16 f20-0)))) - (f1-9 (+ sv-32 (* (- f28-1 f22-1) (- f1-6 sv-32)))) - (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)))))))) + (f20-0 (ripple-slow-add-sine-waves s5-0 f22-1 f24-1)) + (sv-16 (ripple-slow-add-sine-waves s5-0 (+ 1.0 f22-1) f24-1)) + (sv-32 (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-16 f20-0)))) + (f1-9 (+ sv-32 (* (- f28-1 f22-1) (- f1-6 sv-32)))) + (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))))))) diff --git a/goal_src/jak1/engine/gfx/math-camera.gc b/goal_src/jak1/engine/gfx/math-camera.gc index 1821922e62..d36141f71f 100644 --- a/goal_src/jak1/engine/gfx/math-camera.gc +++ b/goal_src/jak1/engine/gfx/math-camera.gc @@ -40,6 +40,7 @@ ((fog-end float) (fog-start float))) + (defun fog-corrector-setup ((corrector fog-corrector) (math-cam math-camera)) "Set the fog corrector based on the supplied math-camera" (set! (-> corrector fog-end) (* (-> math-cam fog-end) (-> math-cam fov-correction-factor))) @@ -81,8 +82,8 @@ (let ((x-rat (-> math-cam x-ratio)) (y-rat (-> math-cam y-ratio)) (cull-info (-> math-cam cull-info))) - (let ((x-thing (/ (+ 1.0 (* 4.0 x-rat x-rat)) (+ 1.0 (* x-rat x-rat)))) - (y-thing (/ (+ 1.0 (* 4.0 y-rat y-rat)) (+ 1.0 (* y-rat y-rat))))) + (/ (+ 1.0 (* 4.0 x-rat x-rat)) (+ 1.0 (square x-rat))) + (let ((y-thing (/ (+ 1.0 (* 4.0 y-rat y-rat)) (+ 1.0 (square y-rat))))) (set! (-> cull-info x-fact) (/ (+ 1.0 (* 4.0 x-rat x-rat)) (* x-rat (sqrtf (+ 1.0 (* 16.0 x-rat x-rat)))))) (set! (-> cull-info y-fact) (/ (+ 1.0 (* 4.0 y-rat y-rat)) (* y-rat (sqrtf (+ 1.0 (* 16.0 y-rat y-rat)))))) (set! (-> cull-info z-fact) @@ -98,8 +99,8 @@ (d-temp-2 (-> math-cam d)) (dx-rat-times-4 (* 4.0 dx-rat-2)) (d-temp-3 (-> math-cam d))) - (let ((inverse-x-len (/ 1.0 (sqrtf (+ (* dx-rat-2 dx-rat-2) (* d-temp-2 d-temp-2))))) - (inverse-x-len-2 (/ 1.0 (sqrtf (+ (* dx-rat-times-4 dx-rat-times-4) (* d-temp-3 d-temp-3)))))) + (let ((inverse-x-len (/ 1.0 (sqrtf (+ (square dx-rat-2) (square d-temp-2))))) + (inverse-x-len-2 (/ 1.0 (sqrtf (+ (square dx-rat-times-4) (square d-temp-3)))))) (set! (-> cull-info xz-dir-ax) (* dx-rat-2 inverse-x-len)) (set! (-> cull-info xz-dir-az) (* d-temp-2 inverse-x-len)) (set! (-> cull-info xz-dir-bx) (* dx-rat-times-4 inverse-x-len-2)) @@ -109,8 +110,8 @@ (d-temp-4 (-> math-cam d)) (dy-rat-times-4 (* 4.0 dy-rat)) (d-temp-5 (-> math-cam d))) - (let ((inverse-y-len (/ 1.0 (sqrtf (+ (* dy-rat dy-rat) (* d-temp-4 d-temp-4))))) - (inverse-y-len-2 (/ 1.0 (sqrtf (+ (* dy-rat-times-4 dy-rat-times-4) (* d-temp-5 d-temp-5)))))) + (let ((inverse-y-len (/ 1.0 (sqrtf (+ (square dy-rat) (square d-temp-4))))) + (inverse-y-len-2 (/ 1.0 (sqrtf (+ (square dy-rat-times-4) (square d-temp-5)))))) (set! (-> cull-info yz-dir-ay) (* dy-rat inverse-y-len)) (set! (-> cull-info yz-dir-az) (* d-temp-4 inverse-y-len)) (set! (-> cull-info yz-dir-by) (* dy-rat-times-4 inverse-y-len-2)) diff --git a/goal_src/jak1/engine/gfx/mood/mood-tables.gc b/goal_src/jak1/engine/gfx/mood/mood-tables.gc index 65e9ff1636..ae208a34e7 100644 --- a/goal_src/jak1/engine/gfx/mood/mood-tables.gc +++ b/goal_src/jak1/engine/gfx/mood/mood-tables.gc @@ -27,8 +27,8 @@ (set! (-> v1-2 direction w) 0.0)) (set-vector! (-> arg0 dir1 color) 0.8 0.775 0.7 1.0) (set! (-> arg0 dir1 levels x) arg3) - (vector-matrix*! (the-as vector (-> arg0 dir0)) (the-as vector (-> arg0 dir0)) s4-0) - (vector-matrix*! (the-as vector (-> arg0 dir1)) (the-as vector (-> arg0 dir1)) s4-0)) + (vector-matrix*! (-> arg0 dir0 direction) (-> arg0 dir0 direction) s4-0) + (vector-matrix*! (-> arg0 dir1 direction) (-> arg0 dir1 direction) s4-0)) (let ((v1-4 (-> arg0 dir2))) (set! (-> v1-4 direction x) 0.0) (set! (-> v1-4 direction y) -1.0) @@ -210,11 +210,7 @@ (set! (-> v1-0 y) (- (-> arg0 direction y))) (set! (-> v1-0 z) (- (-> arg0 direction z))) (when (< (-> arg0 direction y) 0.9063) - (let* ((f0-7 0.4226) - (f1-1 (-> v1-0 x)) - (f1-3 (* f1-1 f1-1)) - (f2-0 (-> v1-0 z)) - (f0-8 (/ f0-7 (sqrtf (+ f1-3 (* f2-0 f2-0)))))) + (let ((f0-8 (/ 0.4226 (sqrtf (+ (square (-> v1-0 x)) (square (-> v1-0 z))))))) (set! (-> v1-0 x) (* (-> v1-0 x) f0-8)) (set! (-> v1-0 y) -0.9063) (set! (-> v1-0 z) (* (-> v1-0 z) f0-8))))) @@ -241,12 +237,12 @@ (set! (-> s5-0 x) (* 2.0 (-> s5-0 x))) (set! (-> s5-0 y) (* 2.0 (-> s5-0 y))) (set! (-> s5-0 z) (* 2.0 (-> s5-0 z))) - (vector+float*! (the-as vector s4-0) (-> arg2 amb-color) (-> arg2 lgt-color) (-> arg2 direction y)) - (vector*! (the-as vector s4-0) (the-as vector s4-0) (-> *ocean-map-village2* far-color)) + (vector+float*! (-> s4-0 fog-color) (-> arg2 amb-color) (-> arg2 lgt-color) (-> arg2 direction y)) + (vector*! (-> s4-0 fog-color) (-> s4-0 fog-color) (-> *ocean-map-village2* far-color)) (set! (-> s4-0 fog-color x) (* 2.0 (-> s4-0 fog-color x))) (set! (-> s4-0 fog-color y) (* 2.0 (-> s4-0 fog-color y))) (set! (-> s4-0 fog-color z) (* 2.0 (-> s4-0 fog-color z))) - (vector4-lerp! s5-0 s5-0 (the-as vector s4-0) 0.5)) + (vector4-lerp! s5-0 s5-0 (-> s4-0 fog-color) 0.5)) (let ((f0-15 (* 0.003921569 (- 255.0 (-> arg0 fog-dists w))))) (vector4-lerp! s5-0 s5-0 (-> arg0 fog-color) f0-15))) 0 (none)) @@ -660,7 +656,7 @@ :shadow (new 'static 'vector :x 0.5393 :y 0.7652 :z -0.3514))))) -(update-mood-shadow-direction (the-as mood-lights (-> *village1-mood-lights-table* data))) +(update-mood-shadow-direction (-> *village1-mood-lights-table* data 0)) (update-mood-shadow-direction (-> *village1-mood-lights-table* data 1)) @@ -940,7 +936,7 @@ (new 'static 'mood-lights) (new 'static 'mood-lights)))) -(update-mood-shadow-direction (the-as mood-lights (-> *snow-mood-lights-table* data))) +(update-mood-shadow-direction (-> *snow-mood-lights-table* data 0)) (update-mood-shadow-direction (-> *snow-mood-lights-table* data 1)) @@ -948,8 +944,7 @@ (update-mood-shadow-direction (-> *snow-mood-lights-table* data 3)) -(update-mood-erase-color (the-as mood-fog (-> *snow-mood-fog-table* data)) - (the-as mood-lights (-> *snow-mood-lights-table* data))) +(update-mood-erase-color (-> *snow-mood-fog-table* data 0) (-> *snow-mood-lights-table* data 0)) (update-mood-erase-color (-> *snow-mood-fog-table* data 2) (-> *snow-mood-lights-table* data 1)) @@ -958,7 +953,7 @@ (update-mood-erase-color (-> *snow-mood-fog-table* data 6) (-> *snow-mood-lights-table* data 3)) (update-mood-erase-color2 (-> *snow-mood-fog-table* data 1) - (the-as mood-lights (-> *snow-mood-lights-table* data)) + (-> *snow-mood-lights-table* data 0) (-> *snow-mood-lights-table* data 1)) (update-mood-erase-color2 (-> *snow-mood-fog-table* data 3) @@ -971,46 +966,46 @@ (update-mood-erase-color2 (-> *snow-mood-fog-table* data 7) (-> *snow-mood-lights-table* data 3) - (the-as mood-lights (-> *snow-mood-lights-table* data))) + (-> *snow-mood-lights-table* data 0)) (vector4-lerp! (-> *snow-mood-fog-table* data 0 erase-color) (-> *snow-mood-fog-table* data 0 erase-color) - (the-as vector (-> *snow-mood-fog-table* data)) + (-> *snow-mood-fog-table* data 0 fog-color) 0.41) (vector4-lerp! (-> *snow-mood-fog-table* data 1 erase-color) (-> *snow-mood-fog-table* data 1 erase-color) - (the-as vector (-> *snow-mood-fog-table* data 1)) + (-> *snow-mood-fog-table* data 1 fog-color) 0.41) (vector4-lerp! (-> *snow-mood-fog-table* data 2 erase-color) (-> *snow-mood-fog-table* data 2 erase-color) - (the-as vector (-> *snow-mood-fog-table* data 2)) + (-> *snow-mood-fog-table* data 2 fog-color) 0.41) (vector4-lerp! (-> *snow-mood-fog-table* data 3 erase-color) (-> *snow-mood-fog-table* data 3 erase-color) - (the-as vector (-> *snow-mood-fog-table* data 3)) + (-> *snow-mood-fog-table* data 3 fog-color) 0.41) (vector4-lerp! (-> *snow-mood-fog-table* data 4 erase-color) (-> *snow-mood-fog-table* data 4 erase-color) - (the-as vector (-> *snow-mood-fog-table* data 4)) + (-> *snow-mood-fog-table* data 4 fog-color) 0.41) (vector4-lerp! (-> *snow-mood-fog-table* data 5 erase-color) (-> *snow-mood-fog-table* data 5 erase-color) - (the-as vector (-> *snow-mood-fog-table* data 5)) + (-> *snow-mood-fog-table* data 5 fog-color) 0.41) (vector4-lerp! (-> *snow-mood-fog-table* data 6 erase-color) (-> *snow-mood-fog-table* data 6 erase-color) - (the-as vector (-> *snow-mood-fog-table* data 6)) + (-> *snow-mood-fog-table* data 6 fog-color) 0.41) (vector4-lerp! (-> *snow-mood-fog-table* data 7 erase-color) (-> *snow-mood-fog-table* data 7 erase-color) - (the-as vector (-> *snow-mood-fog-table* data 7)) + (-> *snow-mood-fog-table* data 7 fog-color) 0.41) (define *snow-mood-sun-table* @@ -1428,7 +1423,7 @@ (new 'static 'mood-lights) (new 'static 'mood-lights)))) -(update-mood-shadow-direction (the-as mood-lights (-> *misty-mood-lights-table* data))) +(update-mood-shadow-direction (-> *misty-mood-lights-table* data 0)) (update-mood-shadow-direction (-> *misty-mood-lights-table* data 1)) @@ -1623,7 +1618,7 @@ (new 'static 'mood-lights) (new 'static 'mood-lights)))) -(update-mood-shadow-direction (the-as mood-lights (-> *village2-mood-lights-table* data))) +(update-mood-shadow-direction (-> *village2-mood-lights-table* data 0)) (update-mood-shadow-direction (-> *village2-mood-lights-table* data 1)) @@ -1812,7 +1807,7 @@ (new 'static 'mood-lights) (new 'static 'mood-lights)))) -(update-mood-shadow-direction (the-as mood-lights (-> *swamp-mood-lights-table* data))) +(update-mood-shadow-direction (-> *swamp-mood-lights-table* data 0)) (update-mood-shadow-direction (-> *swamp-mood-lights-table* data 1)) @@ -1937,7 +1932,7 @@ (new 'static 'mood-lights) (new 'static 'mood-lights)))) -(update-mood-shadow-direction (the-as mood-lights (-> *sunken-mood-lights-table* data))) +(update-mood-shadow-direction (-> *sunken-mood-lights-table* data 0)) (update-mood-shadow-direction (-> *sunken-mood-lights-table* data 1)) @@ -2102,7 +2097,7 @@ (new 'static 'mood-lights) (new 'static 'mood-lights)))) -(update-mood-shadow-direction (the-as mood-lights (-> *rolling-mood-lights-table* data))) +(update-mood-shadow-direction (-> *rolling-mood-lights-table* data 0)) (update-mood-shadow-direction (-> *rolling-mood-lights-table* data 1)) @@ -2300,7 +2295,7 @@ (new 'static 'mood-lights) (new 'static 'mood-lights)))) -(update-mood-shadow-direction (the-as mood-lights (-> *firecanyon-mood-lights-table* data))) +(update-mood-shadow-direction (-> *firecanyon-mood-lights-table* data 0)) (update-mood-shadow-direction (-> *firecanyon-mood-lights-table* data 1)) @@ -2521,7 +2516,7 @@ (new 'static 'mood-lights) (new 'static 'mood-lights)))) -(update-mood-shadow-direction (the-as mood-lights (-> *ogre-mood-lights-table* data))) +(update-mood-shadow-direction (-> *ogre-mood-lights-table* data 0)) (update-mood-shadow-direction (-> *ogre-mood-lights-table* data 1)) @@ -2616,7 +2611,7 @@ (new 'static 'mood-lights) (new 'static 'mood-lights)))) -(update-mood-shadow-direction (the-as mood-lights (-> *ogre2-mood-lights-table* data))) +(update-mood-shadow-direction (-> *ogre2-mood-lights-table* data 0)) (update-mood-shadow-direction (-> *ogre2-mood-lights-table* data 1)) @@ -2680,7 +2675,7 @@ (new 'static 'mood-lights) (new 'static 'mood-lights)))) -(update-mood-shadow-direction (the-as mood-lights (-> *ogre3-mood-lights-table* data))) +(update-mood-shadow-direction (-> *ogre3-mood-lights-table* data 0)) (define *village3-mood-fog-table* (new 'static @@ -2931,7 +2926,7 @@ :shadow (new 'static 'vector :y -1.0))))) -(update-mood-shadow-direction (the-as mood-lights (-> *lavatube-mood-lights-table* data))) +(update-mood-shadow-direction (-> *lavatube-mood-lights-table* data 0)) (define *lavatube-mood-sun-table* (new 'static @@ -3085,8 +3080,7 @@ :erase-color (new 'static 'vector :w 128.0))))) -(update-mood-erase-color (the-as mood-fog (-> *finalboss-mood-fog-table* data)) - (the-as mood-lights (-> *village1-mood-lights-table* data))) +(update-mood-erase-color (-> *finalboss-mood-fog-table* data 0) (-> *village1-mood-lights-table* data 0)) (update-mood-erase-color (-> *finalboss-mood-fog-table* data 1) (-> *village1-mood-lights-table* data 1)) @@ -3107,42 +3101,42 @@ (vector4-lerp! (-> *finalboss-mood-fog-table* data 0 erase-color) (-> *finalboss-mood-fog-table* data 0 erase-color) - (the-as vector (-> *finalboss-mood-fog-table* data)) + (-> *finalboss-mood-fog-table* data 0 fog-color) 0.41) (vector4-lerp! (-> *finalboss-mood-fog-table* data 1 erase-color) (-> *finalboss-mood-fog-table* data 1 erase-color) - (the-as vector (-> *finalboss-mood-fog-table* data 1)) + (-> *finalboss-mood-fog-table* data 1 fog-color) 0.41) (vector4-lerp! (-> *finalboss-mood-fog-table* data 2 erase-color) (-> *finalboss-mood-fog-table* data 2 erase-color) - (the-as vector (-> *finalboss-mood-fog-table* data 2)) + (-> *finalboss-mood-fog-table* data 2 fog-color) 0.41) (vector4-lerp! (-> *finalboss-mood-fog-table* data 3 erase-color) (-> *finalboss-mood-fog-table* data 3 erase-color) - (the-as vector (-> *finalboss-mood-fog-table* data 3)) + (-> *finalboss-mood-fog-table* data 3 fog-color) 1.0) (vector4-lerp! (-> *finalboss-mood-fog-table* data 4 erase-color) (-> *finalboss-mood-fog-table* data 4 erase-color) - (the-as vector (-> *finalboss-mood-fog-table* data 4)) + (-> *finalboss-mood-fog-table* data 4 fog-color) 0.41) (vector4-lerp! (-> *finalboss-mood-fog-table* data 5 erase-color) (-> *finalboss-mood-fog-table* data 5 erase-color) - (the-as vector (-> *finalboss-mood-fog-table* data 5)) + (-> *finalboss-mood-fog-table* data 5 fog-color) 0.41) (vector4-lerp! (-> *finalboss-mood-fog-table* data 6 erase-color) (-> *finalboss-mood-fog-table* data 6 erase-color) - (the-as vector (-> *finalboss-mood-fog-table* data 6)) + (-> *finalboss-mood-fog-table* data 6 fog-color) 0.41) (vector4-lerp! (-> *finalboss-mood-fog-table* data 7 erase-color) (-> *finalboss-mood-fog-table* data 7 erase-color) - (the-as vector (-> *finalboss-mood-fog-table* data 7)) + (-> *finalboss-mood-fog-table* data 7 fog-color) 0.41) (define *citadel-mood-fog-table* diff --git a/goal_src/jak1/engine/gfx/mood/mood.gc b/goal_src/jak1/engine/gfx/mood/mood.gc index d6acd44ee4..1071fe9a4b 100644 --- a/goal_src/jak1/engine/gfx/mood/mood.gc +++ b/goal_src/jak1/engine/gfx/mood/mood.gc @@ -228,9 +228,9 @@ (else (set! (-> arg0 sky-times s5-0) (- 1.0 f30-0)) (set! (-> arg0 sky-times s4-0) f30-0) - (vector4-lerp! (the-as vector (-> arg0 current-sun)) - (the-as vector (-> arg0 mood-sun-table data s5-0)) - (the-as vector (-> arg0 mood-sun-table data s4-0)) + (vector4-lerp! (-> arg0 current-sun sun-color) + (-> arg0 mood-sun-table data s5-0 sun-color) + (-> arg0 mood-sun-table data s4-0 sun-color) f30-0) (vector4-lerp! (-> arg0 current-sun env-color) (the-as vector (+ (the-as uint (-> arg0 mood-sun-table data 0 env-color)) (* s5-0 32))) @@ -287,7 +287,6 @@ (update-mood-prt-color arg0))) (defun update-mood-interp ((arg0 mood-context) (arg1 mood-context) (arg2 mood-context) (arg3 float)) - (local-vars (sv-16 light)) (cond ((= arg3 0.0) (set! (-> arg0 current-fog fog-color quad) (-> arg1 current-fog fog-color quad)) @@ -310,27 +309,21 @@ (set! (-> arg0 current-shadow-color quad) (-> arg2 current-shadow-color quad)) (quad-copy! (the-as pointer (-> arg0 light-group)) (the-as pointer (-> arg2 light-group)) 12)) (else - (vector4-lerp! (the-as vector (-> arg0 current-fog)) - (the-as vector (-> arg1 current-fog)) - (the-as vector (-> arg2 current-fog)) - arg3) + (vector4-lerp! (-> arg0 current-fog fog-color) (-> arg1 current-fog fog-color) (-> arg2 current-fog fog-color) arg3) (vector4-lerp! (-> arg0 current-fog fog-dists) (-> arg1 current-fog fog-dists) (-> arg2 current-fog fog-dists) arg3) (vector4-lerp! (-> arg0 current-fog erase-color) (-> arg1 current-fog erase-color) (-> arg2 current-fog erase-color) arg3) (vector4-lerp! (-> arg0 current-prt-color) (-> arg1 current-prt-color) (-> arg2 current-prt-color) arg3) - (vector4-lerp! (the-as vector (-> arg0 current-sun)) - (the-as vector (-> arg1 current-sun)) - (the-as vector (-> arg2 current-sun)) - arg3) + (vector4-lerp! (-> arg0 current-sun sun-color) (-> arg1 current-sun sun-color) (-> arg2 current-sun sun-color) arg3) (vector4-lerp! (-> arg0 current-sun env-color) (-> arg1 current-sun env-color) (-> arg2 current-sun env-color) arg3) (vector4-lerp! (-> arg0 current-shadow) (-> arg1 current-shadow) (-> arg2 current-shadow) arg3) (vector4-lerp! (-> arg0 current-shadow-color) (-> arg1 current-shadow-color) (-> arg2 current-shadow-color) arg3) (dotimes (s2-0 3) (let ((s1-0 (-> arg0 light-group 0 lights s2-0))) - (let ((s0-0 (-> arg1 light-group 0 lights s2-0))) - (set! sv-16 (-> arg2 light-group 0 lights s2-0)) + (let ((s0-0 (-> arg1 light-group 0 lights s2-0)) + (sv-16 (-> arg2 light-group 0 lights s2-0))) (vector4-lerp! (-> s1-0 direction) (-> s0-0 direction) (-> sv-16 direction) arg3) (vector4-lerp! (-> s1-0 color) (-> s0-0 color) (-> sv-16 color) arg3) (vector4-lerp! (-> s1-0 levels) (-> s0-0 levels) (-> sv-16 levels) arg3)) @@ -753,7 +746,7 @@ (let ((f30-0 (fmax 0.0 (-> *math-camera* camera-rot vector 1 z)))) (let ((a2-4 (new 'stack-no-clear 'vector))) (set-vector! a2-4 0.0 32.0 48.0 128.0) - (vector4-lerp! (the-as vector (-> arg0 current-fog)) (the-as vector (-> arg0 current-fog)) a2-4 (/ f30-0 2))) + (vector4-lerp! (-> arg0 current-fog fog-color) (-> arg0 current-fog fog-color) a2-4 (/ f30-0 2))) (let ((f0-7 (-> arg0 current-fog fog-dists w)) (f1-1 255.0)) (set! (-> arg0 current-fog fog-dists w) (+ f0-7 (* 0.666 f30-0 (- f1-1 f0-7)))))) @@ -1007,7 +1000,6 @@ (set! (-> *sunken-mood* state 0) (the-as uint 255)) (defun update-mood-sunken ((arg0 mood-context) (arg1 float) (arg2 int)) - (local-vars (sv-80 vector)) (when (not (paused?)) (update-mood-fog arg0 arg1) (update-mood-sky-texture arg0 arg1) @@ -1046,28 +1038,23 @@ (vector4-lerp! (-> s5-1 0 ambi color) s2-0 s1-0 f30-0)) (let ((s2-1 (new 'static 'vector :x 0.193 :y 0.432 :z 0.721)) (s1-1 (new 'static 'vector :x 0.193 :y 0.338 :z 0.603)) - (s0-0 (new 'static 'vector :x 0.193 :y 0.336 :z 0.721))) - (set! sv-80 (new 'static 'vector :x 0.215 :y 0.309 :z 0.674)) - (let ((s3-2 (new 'stack-no-clear 'vector)) - (s4-3 (new 'stack-no-clear 'vector)) - (f26-3 (+ 0.75 - (* 0.0625 (cos (the float (* 4000 (/ (-> *display* time-factor) 5) (-> *display* integral-frame-counter))))) ;; changed for high fps - (* 0.0625 - (cos (the float (shl (the int (* (/ (-> *display* time-factor) 5) (-> *display* integral-frame-counter))) 11)))) ;; changed for high fps - (* 0.125 (cos (the float (* 1500 (/ (-> *display* time-factor) 5) (-> *display* integral-frame-counter))))) ;; changed for high fps - ))) - (vector4-lerp! s3-2 s2-1 s1-1 f28-0) - (let ((t9-16 vector4-lerp!) - (a0-19 s4-3) - (a3-7 f28-0)) - (t9-16 a0-19 s0-0 sv-80 a3-7)) - (let ((v1-18 (-> s5-1 0 dir2))) - (set! (-> v1-18 direction x) 0.0) - (set! (-> v1-18 direction y) 0.999) - (set! (-> v1-18 direction z) 0.011) - (set! (-> v1-18 direction w) 1.0)) - (vector4-lerp! (-> s5-1 0 dir2 color) s4-3 s3-2 f30-0) - (set! (-> s5-1 0 dir2 levels x) f26-3))))) + (s0-0 (new 'static 'vector :x 0.193 :y 0.336 :z 0.721)) + (sv-80 (new 'static 'vector :x 0.215 :y 0.309 :z 0.674)) + (s3-2 (new 'stack-no-clear 'vector)) + (s4-3 (new 'stack-no-clear 'vector)) + (f26-3 (+ 0.75 + (* 0.0625 (cos (the float (* 4000 (-> *display* integral-frame-counter))))) + (* 0.0625 (cos (the float (shl (-> *display* integral-frame-counter) 11)))) + (* 0.125 (cos (the float (* 1500 (-> *display* integral-frame-counter)))))))) + (vector4-lerp! s3-2 s2-1 s1-1 f28-0) + (vector4-lerp! s4-3 s0-0 sv-80 f28-0) + (let ((v1-18 (-> s5-1 0 dir2))) + (set! (-> v1-18 direction x) 0.0) + (set! (-> v1-18 direction y) 0.999) + (set! (-> v1-18 direction z) 0.011) + (set! (-> v1-18 direction w) 1.0)) + (vector4-lerp! (-> s5-1 0 dir2 color) s4-3 s3-2 f30-0) + (set! (-> s5-1 0 dir2 levels x) f26-3)))) (update-mood-itimes arg0)) 0 (none)) @@ -1273,7 +1260,7 @@ (while (>= s1-0 s2-0) (let ((f28-0 (-> *palette-fade-controls* control s2-0 fade))) (set! (-> arg0 times s2-0 w) f28-0) - (vector-! s3-0 (the-as vector (-> *palette-fade-controls* control s2-0)) (-> *target* control trans)) + (vector-! s3-0 (-> *palette-fade-controls* control s2-0 trans) (-> *target* control trans)) (let* ((f3-0 (vector-length s3-0)) (f28-1 (* f28-0 (fmax 0.0 (fmin 1.0 (- 1.0 (/ f3-0 (meters 20)))))))) (vector-normalize! s3-0 f28-1) @@ -1291,11 +1278,7 @@ (set! (-> v1-21 y) (- (-> s4-0 y))) (set! (-> v1-21 z) (- (-> s4-0 z))) (when (< (-> s4-0 y) 0.9063) - (let* ((f0-22 0.4226) - (f1-3 (-> v1-21 x)) - (f1-5 (* f1-3 f1-3)) - (f2-2 (-> v1-21 z)) - (f0-23 (/ f0-22 (sqrtf (+ f1-5 (* f2-2 f2-2)))))) + (let ((f0-23 (/ 0.4226 (sqrtf (+ (square (-> v1-21 x)) (square (-> v1-21 z))))))) (set! (-> v1-21 x) (* (-> v1-21 x) f0-23)) (set! (-> v1-21 y) -0.9063) (set! (-> v1-21 z) (* (-> v1-21 z) f0-23))))))) @@ -1468,22 +1451,10 @@ (vector-lerp! (-> arg0 mood-lights-table data 1 amb-color) s4-0 (-> arg0 mood-lights-table data 1 amb-color) f30-3) (vector-lerp! (-> arg0 mood-lights-table data 2 amb-color) s4-0 (-> arg0 mood-lights-table data 2 amb-color) f30-3) (vector-lerp! (-> arg0 mood-lights-table data 3 amb-color) s4-0 (-> arg0 mood-lights-table data 3 amb-color) f30-3) - (vector-lerp! (the-as vector (-> arg0 mood-lights-table data)) - s5-1 - (the-as vector (-> arg0 mood-lights-table data)) - f30-3) - (vector-lerp! (the-as vector (-> arg0 mood-lights-table data 1)) - s5-1 - (the-as vector (-> arg0 mood-lights-table data 1)) - f30-3) - (vector-lerp! (the-as vector (-> arg0 mood-lights-table data 2)) - s5-1 - (the-as vector (-> arg0 mood-lights-table data 2)) - f30-3) - (vector-lerp! (the-as vector (-> arg0 mood-lights-table data 3)) - s5-1 - (the-as vector (-> arg0 mood-lights-table data 3)) - f30-3)))) + (vector-lerp! (-> arg0 mood-lights-table data 0 direction) s5-1 (-> arg0 mood-lights-table data 0 direction) f30-3) + (vector-lerp! (-> arg0 mood-lights-table data 1 direction) s5-1 (-> arg0 mood-lights-table data 1 direction) f30-3) + (vector-lerp! (-> arg0 mood-lights-table data 2 direction) s5-1 (-> arg0 mood-lights-table data 2 direction) f30-3) + (vector-lerp! (-> arg0 mood-lights-table data 3 direction) s5-1 (-> arg0 mood-lights-table data 3 direction) f30-3)))) (update-mood-itimes arg0) 0 (none)) @@ -1565,10 +1536,10 @@ (vector4-lerp! (the-as vector (-> s5-2 0)) (the-as vector (-> s4-2 0)) (the-as vector (-> s5-2 0)) f30-1) (vector4-lerp! (-> s5-2 0 dir0 color) (-> s4-2 0 dir0 color) (-> s5-2 0 dir0 color) f30-1) (vector4-lerp! (-> s5-2 0 dir0 levels) (-> s4-2 0 dir0 levels) (-> s5-2 0 dir0 levels) f30-1) - (vector4-lerp! (the-as vector (-> s5-2 0 dir1)) (the-as vector (-> s4-2 0 dir1)) (the-as vector (-> s5-2 0 dir1)) f30-1) + (vector4-lerp! (-> s5-2 0 dir1 direction) (-> s4-2 0 dir1 direction) (-> s5-2 0 dir1 direction) f30-1) (vector4-lerp! (-> s5-2 0 dir1 color) (-> s4-2 0 dir1 color) (-> s5-2 0 dir1 color) f30-1) (vector4-lerp! (-> s5-2 0 dir1 levels) (-> s4-2 0 dir1 levels) (-> s5-2 0 dir1 levels) f30-1) - (vector4-lerp! (the-as vector (-> s5-2 0 ambi)) (the-as vector (-> s4-2 0 ambi)) (the-as vector (-> s5-2 0 ambi)) f30-1) + (vector4-lerp! (-> s5-2 0 ambi direction) (-> s4-2 0 ambi direction) (-> s5-2 0 ambi direction) f30-1) (vector4-lerp! (-> s5-2 0 ambi color) (-> s4-2 0 ambi color) (-> s5-2 0 ambi color) f30-1) (vector4-lerp! (-> s5-2 0 ambi levels) (-> s4-2 0 ambi levels) (-> s5-2 0 ambi levels) f30-1) (vector4-lerp! (-> arg0 current-shadow) (-> *ogre2-mood* current-shadow) (-> arg0 current-shadow) f30-1)))))) @@ -1603,19 +1574,19 @@ (vector4-lerp! (the-as vector (-> s5-3 0)) (the-as vector (-> s4-3 0)) (the-as vector (-> s5-3 0)) f30-3) (vector4-lerp! (-> s5-3 0 dir0 color) (-> s4-3 0 dir0 color) (-> s5-3 0 dir0 color) f30-3) (vector4-lerp! (-> s5-3 0 dir0 levels) (-> s4-3 0 dir0 levels) (-> s5-3 0 dir0 levels) f30-3) - (vector4-lerp! (the-as vector (-> s5-3 0 dir1)) (the-as vector (-> s4-3 0 dir1)) (the-as vector (-> s5-3 0 dir1)) f30-3) + (vector4-lerp! (-> s5-3 0 dir1 direction) (-> s4-3 0 dir1 direction) (-> s5-3 0 dir1 direction) f30-3) (vector4-lerp! (-> s5-3 0 dir1 color) (-> s4-3 0 dir1 color) (-> s5-3 0 dir1 color) f30-3) (vector4-lerp! (-> s5-3 0 dir1 levels) (-> s4-3 0 dir1 levels) (-> s5-3 0 dir1 levels) f30-3) - (vector4-lerp! (the-as vector (-> s5-3 0 dir2)) (the-as vector (-> s4-3 0 dir2)) (the-as vector (-> s5-3 0 dir1)) f30-3) + (vector4-lerp! (-> s5-3 0 dir2 direction) (-> s4-3 0 dir2 direction) (-> s5-3 0 dir1 direction) f30-3) (vector4-lerp! (-> s5-3 0 dir2 color) (-> s4-3 0 dir2 color) (-> s5-3 0 dir1 color) f30-3) (vector4-lerp! (-> s5-3 0 dir2 levels) (-> s4-3 0 dir2 levels) (-> s5-3 0 dir1 levels) f30-3) - (vector4-lerp! (the-as vector (-> s5-3 0 ambi)) (the-as vector (-> s4-3 0 ambi)) (the-as vector (-> s5-3 0 ambi)) f30-3) + (vector4-lerp! (-> s5-3 0 ambi direction) (-> s4-3 0 ambi direction) (-> s5-3 0 ambi direction) f30-3) (vector4-lerp! (-> s5-3 0 ambi color) (-> s4-3 0 ambi color) (-> s5-3 0 ambi color) f30-3) (vector4-lerp! (-> s5-3 0 ambi levels) (-> s4-3 0 ambi levels) (-> s5-3 0 ambi levels) f30-3) (vector4-lerp! (-> arg0 current-shadow) (-> *ogre3-mood* current-shadow) (-> arg0 current-shadow) f30-3) - (vector4-lerp! (the-as vector (-> arg0 current-fog)) - (the-as vector (-> *ogre3-mood* current-fog)) - (the-as vector (-> arg0 current-fog)) + (vector4-lerp! (-> arg0 current-fog fog-color) + (-> *ogre3-mood* current-fog fog-color) + (-> arg0 current-fog fog-color) f30-3) (vector4-lerp! (-> arg0 current-fog fog-dists) (-> *ogre3-mood* current-fog fog-dists) @@ -1692,11 +1663,7 @@ (set! (-> v1-45 y) (- (-> a0-22 direction y))) (set! (-> v1-45 z) (- (-> a0-22 direction z))) (when (< (-> a0-22 direction y) 0.9063) - (let* ((f0-23 0.4226) - (f1-25 (-> v1-45 x)) - (f1-27 (* f1-25 f1-25)) - (f2-4 (-> v1-45 z)) - (f0-24 (/ f0-23 (sqrtf (+ f1-27 (* f2-4 f2-4)))))) + (let ((f0-24 (/ 0.4226 (sqrtf (+ (square (-> v1-45 x)) (square (-> v1-45 z))))))) (set! (-> v1-45 x) (* (-> v1-45 x) f0-24)) (set! (-> v1-45 y) -0.9063) (set! (-> v1-45 z) (* (-> v1-45 z) f0-24))))) diff --git a/goal_src/jak1/engine/gfx/mood/time-of-day.gc b/goal_src/jak1/engine/gfx/mood/time-of-day.gc index e8a1e0810b..5c095ac5b7 100644 --- a/goal_src/jak1/engine/gfx/mood/time-of-day.gc +++ b/goal_src/jak1/engine/gfx/mood/time-of-day.gc @@ -104,9 +104,9 @@ (+! (-> self year) 1))))))))) ;; set the time of day float. This is in hours (0-24) (let* ((f0-4 (the float (-> self frame))) - (f0-6 (+ (* 0.0033333334 f0-4) (the float (-> self second)))) - (f0-8 (+ (* 0.016666668 f0-6) (the float (-> self minute)))) - (f0-10 (+ (* 0.016666668 f0-8) (the float (-> self hour))))) + (f0-6 (+ (/ f0-4 300) (the float (-> self second)))) + (f0-8 (+ (/ f0-6 60) (the float (-> self minute)))) + (f0-10 (+ (/ f0-8 60) (the float (-> self hour))))) (set! (-> self time-of-day) f0-10) (set! (-> *time-of-day-context* time) f0-10)) (suspend))) @@ -201,7 +201,7 @@ (when (= (-> a0-4 status) 'active) (if (-> a0-4 info sky) (set! (-> arg0 sky) #t))))) ;; level distances - (let ((s4-0 (new 'stack-no-clear 'array 'float 2))) ;; was a boxed array, but the GOAL implementation seems buggy. + (let ((s4-0 (the-as (array float) (new 'stack 'boxed-array float 2)))) (set! (-> s4-0 0) 0.0) (set! (-> s4-0 1) 0.0) 0.0 @@ -331,9 +331,9 @@ (-> arg0 moods 0 current-prt-color) (-> arg0 moods 1 current-prt-color) f30-0) - (vector4-lerp! (the-as vector (-> arg0 current-sun)) - (the-as vector (-> arg0 moods 0 current-sun)) - (the-as vector (-> arg0 moods 1 current-sun)) + (vector4-lerp! (-> arg0 current-sun sun-color) + (-> arg0 moods 0 current-sun sun-color) + (-> arg0 moods 1 current-sun sun-color) f30-0) (vector4-lerp! (-> arg0 current-sun env-color) (-> arg0 moods 0 current-sun env-color) @@ -429,11 +429,7 @@ (set! (-> a2-30 y) (- (-> s5-2 dir0 direction y))) (set! (-> a2-30 z) (- (-> s5-2 dir0 direction z))) (when (< (-> s5-2 dir0 direction y) 0.9063) - (let* ((f0-56 0.4226) - (f1-17 (-> a2-30 x)) - (f1-19 (* f1-17 f1-17)) - (f2-7 (-> a2-30 z)) - (f0-57 (/ f0-56 (sqrtf (+ f1-19 (* f2-7 f2-7)))))) + (let ((f0-57 (/ 0.4226 (sqrtf (+ (square (-> a2-30 x)) (square (-> a2-30 z))))))) (set! (-> a2-30 x) (* (-> a2-30 x) f0-57)) (set! (-> a2-30 y) -0.9063) (set! (-> a2-30 z) (* (-> a2-30 z) f0-57)))) diff --git a/goal_src/jak1/engine/gfx/ocean/ocean-mid.gc b/goal_src/jak1/engine/gfx/ocean/ocean-mid.gc index 2b37bd2119..713dfa3a13 100644 --- a/goal_src/jak1/engine/gfx/ocean/ocean-mid.gc +++ b/goal_src/jak1/engine/gfx/ocean/ocean-mid.gc @@ -242,7 +242,6 @@ (&+! (-> arg0 base) 576) (none)) -;; definition for function ocean-matrix*! (defun ocean-matrix*! ((arg0 matrix) (arg1 matrix) (arg2 matrix)) (rlet ((acc :class vf) (vf1 :class vf) @@ -287,7 +286,6 @@ (.svf (&-> arg0 vector 3 quad) vf12) arg0)) -;; definition for function ocean-vector-matrix*! (defun ocean-vector-matrix*! ((arg0 vector) (arg1 vector) (arg2 matrix)) (rlet ((acc :class vf) (vf0 :class vf) @@ -309,9 +307,6 @@ (.svf (&-> arg0 quad) vf5) arg0)) -;; definition for function ocean-mid-add-matrices -;; INFO: Return type mismatch pointer vs none. -;; Used lq/sq (defun ocean-mid-add-matrices ((arg0 dma-buffer) (arg1 vector)) (let ((s5-0 (new-stack-vector0))) (-> *math-camera* camera-rot) @@ -343,8 +338,6 @@ (&+! (-> arg0 base) 128) (none)) -;; definition for function ocean-mid-check -;; Used lq/sq (defun ocean-mid-check ((arg0 pointer) (arg1 int) (arg2 int) (arg3 vector)) (local-vars (v0-0 symbol) (v1-10 float) (a3-2 float) (a3-6 float) (a3-10 float)) (rlet ((vf1 :class vf) @@ -368,7 +361,7 @@ (when (< a3-2 309237600000.0) (logior! (-> (the-as (pointer uint8) (+ arg2 (the-as int arg0)))) (ash 1 arg1)) (return #f)) - (set! (-> v1-0 x) (+ 393216.0 (-> v1-0 x))) + (+! (-> v1-0 x) 393216.0) (let ((a3-5 v1-0) (t1-1 t0-1)) (.lvf vf2 (&-> a3-5 quad)) @@ -381,7 +374,7 @@ (when (< a3-6 309237600000.0) (logior! (-> (the-as (pointer uint8) (+ arg2 (the-as int arg0)))) (ash 1 arg1)) (return #f)) - (set! (-> v1-0 z) (+ 393216.0 (-> v1-0 z))) + (+! (-> v1-0 z) 393216.0) (let ((a3-9 v1-0) (t1-2 t0-1)) (.lvf vf2 (&-> a3-9 quad)) @@ -394,7 +387,7 @@ (when (< a3-10 309237600000.0) (logior! (-> (the-as (pointer uint8) (+ arg2 (the-as int arg0)))) (ash 1 arg1)) (return #f)) - (set! (-> v1-0 x) (+ -393216.0 (-> v1-0 x))) + (+! (-> v1-0 x) -393216.0) (.lvf vf2 (&-> v1-0 quad)) (.lvf vf3 (&-> t0-1 quad))) (.sub.vf vf1 vf3 vf2) @@ -407,8 +400,6 @@ (return #f) v0-0))) -;; definition for function ocean-mid-add-call -;; INFO: Return type mismatch pointer vs none. (defun ocean-mid-add-call ((arg0 dma-buffer) (arg1 int)) (let* ((v1-0 arg0) (a0-1 (the-as object (-> v1-0 base)))) @@ -418,8 +409,6 @@ (set! (-> v1-0 base) (&+ (the-as pointer a0-1) 16))) (none)) -;; definition for function ocean-mid-add-call-flush -;; INFO: Return type mismatch pointer vs none. (defun ocean-mid-add-call-flush ((arg0 dma-buffer) (arg1 uint)) (let* ((v1-0 arg0) (a0-1 (the-as object (-> v1-0 base)))) @@ -430,8 +419,6 @@ (none)) (defun ocean-mid-add-upload ((arg0 dma-buffer) (arg1 int) (arg2 int) (arg3 int) (arg4 int) (arg5 float)) - "Add DMA data to upload data needed to draw an ocean tile." - ;; calculate the location of the tile. (let ((gp-0 (new-stack-vector0))) (let ((v1-1 (-> *ocean-map* start-corner))) (set! (-> gp-0 x) (+ (-> v1-1 x) (* 3145728.0 (the float arg2)))) @@ -484,7 +471,6 @@ (if (and (>= a1-12 0) (>= a2-7 0) (< a1-12 8) (< a2-7 8)) (ocean-mid-check s5-1 a1-12 a2-7 gp-0)))))) #f))) -;; definition for function ocean-mid-camera-masks-bit? (defun ocean-mid-camera-masks-bit? ((arg0 uint) (arg1 uint)) (cond ((or (< (the-as int arg0) 0) (>= (the-as int arg0) 48) (< (the-as int arg1) 0) (>= (the-as int arg1) 48)) #t) @@ -496,7 +482,6 @@ (a1-3 (+ (* 6 a3-0) a2-3))) (logtest? (-> (the-as (pointer uint8) (+ (+ a0-1 (* a1-3 8)) (the-as uint *ocean-work*))) 2300) (ash 1 v1-1)))))) -;; definition for function ocean-mid-mask-ptrs-bit? (defun ocean-mid-mask-ptrs-bit? ((arg0 uint) (arg1 uint)) (cond ((or (< (the-as int arg0) 0) (>= (the-as int arg0) 48) (< (the-as int arg1) 0) (>= (the-as int arg1) 48)) #t) @@ -510,7 +495,6 @@ (logtest? (-> (the-as (pointer uint8) (+ a0-1 (the-as uint (-> *ocean-work* mid-mask-ptrs a1-3)))) 0) (ash 1 v1-1)) #t))))) -;; definition for function ocean-mid-camera-masks-set! (defun ocean-mid-camera-masks-set! ((arg0 uint) (arg1 uint)) (cond ((or (< (the-as int arg0) 0) (>= (the-as int arg0) 48) (< (the-as int arg1) 0) (>= (the-as int arg1) 48)) #f) @@ -528,16 +512,8 @@ (else (logior! (-> (the-as (pointer uint8) (+ v1-1 (the-as uint a1-5))) 0) (ash 1 a0-1)) #t))) (else #f)))))) -;; definition for function ocean-mid-add-upload-table -;; WARN: Function may read a register that is not set: f31 -;; Used lq/sq (defun ocean-mid-add-upload-table ((arg0 dma-buffer) (arg1 uint) (arg2 uint) (arg3 (pointer float)) (arg4 int) (arg5 symbol)) (local-vars - (r0-0 int) - (r0-1 int) - (r0-2 int) - (r0-3 int) - (r0-4 int) (v1-8 float) (a0-19 uint128) (a0-20 uint128) @@ -546,8 +522,7 @@ (a1-15 uint128) (a1-16 uint128) (a2-15 uint128) - (a3-11 uint128) - (f31-0 none)) + (a3-11 uint128)) (rlet ((vf1 :class vf) (vf2 :class vf) (vf3 :class vf) @@ -580,15 +555,15 @@ (a2-14 (the-as uint128 (-> *ocean-map* ocean-colors colors (+ (* 52 (the-as int (+ arg1 1))) arg2)))) (a3-10 (the-as uint128 (-> *ocean-map* ocean-colors colors (+ arg2 1 (* 52 (the-as int (+ arg1 1)))))))) (.pextlb a0-19 0 a0-18) - (.mov r0-0 f31-0) + (nop!) (.pextlb a1-14 0 a1-13) - (.mov r0-1 f31-0) + (nop!) (.pextlb a2-15 0 a2-14) - (.mov r0-2 f31-0) + (nop!) (.pextlb a3-11 0 a3-10)) - (.mov r0-3 f31-0) + (nop!) (.pextlh a0-20 0 a0-19) - (.mov r0-4 f31-0) + (nop!) (.pextlh a1-15 0 a1-14) (.mov vf1 a0-20) (.pextlh a0-21 0 a2-15) @@ -624,7 +599,6 @@ (if arg5 (ocean-mid-add-call arg0 275) (ocean-mid-add-call arg0 107))) (none))) -;; definition for function ocean-mid-add-upload-top (defun ocean-mid-add-upload-top ((arg0 dma-buffer) (arg1 uint) (arg2 uint)) (let ((s2-0 (-> *ocean-work* mid-minx)) (s1-0 (-> *ocean-work* mid-maxx)) @@ -660,7 +634,6 @@ (s3-0 (ocean-mid-add-upload-table arg0 (+ arg1 -1) arg2 *ocean-down-table* 7 #t)))) (none)) -;; definition for function ocean-mid-add-upload-middle (defun ocean-mid-add-upload-middle ((arg0 dma-buffer) (arg1 uint) (arg2 uint)) (let ((s3-0 (-> *ocean-work* mid-minx)) (s2-0 (-> *ocean-work* mid-maxx)) @@ -679,7 +652,6 @@ (else (ocean-mid-add-upload-table arg0 arg1 arg2 *ocean-left-table* 7 #t)))))) (none)) -;; definition for function ocean-mid-add-upload-bottom (defun ocean-mid-add-upload-bottom ((arg0 dma-buffer) (arg1 uint) (arg2 uint)) (let ((s2-0 (-> *ocean-work* mid-minx)) (s1-0 (-> *ocean-work* mid-maxx)) @@ -715,8 +687,6 @@ (s3-0 (ocean-mid-add-upload-table arg0 (+ arg1 1) arg2 *ocean-up-table* 7 #t)))) (none)) -;; definition for function ocean-seams-add-constants -;; INFO: Return type mismatch pointer vs none. (defun ocean-seams-add-constants ((arg0 dma-buffer)) (let* ((a2-0 4) (v1-0 arg0) @@ -765,30 +735,30 @@ ;; definition for function draw-ocean-mid-seams ;; INFO: Return type mismatch symbol vs none. (defun draw-ocean-mid-seams ((arg0 dma-buffer)) - (local-vars (sv-32 uint) (sv-33 uint) (sv-34 uint) (sv-35 uint) (sv-36 sphere)) (ocean-seams-add-constants arg0) - (set! sv-32 (-> *ocean-work* mid-minx)) - (set! sv-33 (-> *ocean-work* mid-maxx)) - (set! sv-34 (-> *ocean-work* mid-minz)) - (set! sv-35 (-> *ocean-work* mid-maxz)) - (set! sv-36 (new 'stack 'sphere)) - (set! (-> sv-36 y) (-> *ocean-map* start-corner y)) - (set! (-> sv-36 w) 278045.7) - (let ((s5-0 sv-34) - (s4-0 sv-35)) - (while (>= s4-0 s5-0) - (let ((s3-0 sv-32) - (s2-0 sv-33)) - (while (>= s2-0 s3-0) - (set! (-> sv-36 x) (+ 196608.0 (* 393216.0 (the float s3-0)) (-> *ocean-map* start-corner x))) - (set! (-> sv-36 z) (+ 196608.0 (* 393216.0 (the float s5-0)) (-> *ocean-map* start-corner z))) - (when (sphere-cull-for-ocean sv-36) - (cond - ((= s5-0 sv-34) (ocean-mid-add-upload-top arg0 s5-0 s3-0)) - ((= s5-0 sv-35) (ocean-mid-add-upload-bottom arg0 s5-0 s3-0)) - (else (ocean-mid-add-upload-middle arg0 s5-0 s3-0)))) - (+! s3-0 1))) - (+! s5-0 1))) + (let ((sv-32 (-> *ocean-work* mid-minx)) + (sv-33 (-> *ocean-work* mid-maxx)) + (sv-34 (-> *ocean-work* mid-minz)) + (sv-35 (-> *ocean-work* mid-maxz)) + (sv-36 (new 'stack 'sphere))) + (set! (-> sv-36 y) (-> *ocean-map* start-corner y)) + (set! (-> sv-36 w) 278045.7) + (let ((s5-0 sv-34) + (s4-0 sv-35)) + (while (>= s4-0 s5-0) + (let ((s3-0 sv-32) + (s2-0 sv-33)) + (while (>= s2-0 s3-0) + (set! (-> sv-36 x) (+ 196608.0 (* 393216.0 (the float s3-0)) (-> *ocean-map* start-corner x))) + (set! (-> sv-36 z) (+ 196608.0 (* 393216.0 (the float s5-0)) (-> *ocean-map* start-corner z))) + ;; og:preserve-this + (when (sphere-cull-for-ocean sv-36) + (cond + ((= s5-0 sv-34) (ocean-mid-add-upload-top arg0 s5-0 s3-0)) + ((= s5-0 sv-35) (ocean-mid-add-upload-bottom arg0 s5-0 s3-0)) + (else (ocean-mid-add-upload-middle arg0 s5-0 s3-0)))) + (+! s3-0 1))) + (+! s5-0 1)))) (dotimes (v1-26 36) (if (and (-> *ocean-work* mid-mask-ptrs v1-26) (nonzero? (-> *ocean-work* mid-camera-masks v1-26))) (logior! (-> *ocean-work* mid-mask-ptrs v1-26 0) (-> *ocean-work* mid-camera-masks v1-26)))) @@ -875,6 +845,7 @@ (s0-0 (-> (the-as (pointer int16) (+ (* s2-0 2) (the-as int (-> *ocean-map* ocean-mid-indices))))))) ;; (format 0 "draw ocean tile: ~d x ~d = ~d index ~d~%" s4-0 s3-0 s2-0 s0-0) ;; (debug-draw-ocean-tile s4-0 s3-0 (new 'static 'rgba :r #x80 :a #x80) (new 'static 'rgba :g #x80 :a #x80) s0-0) + ;; og:preserve-this (when (sphere-cull-for-ocean s1-0) ;;(format 0 " vis!~%") (cond diff --git a/goal_src/jak1/engine/gfx/ocean/ocean-texture.gc b/goal_src/jak1/engine/gfx/ocean/ocean-texture.gc index cdd4c59bf6..22f8989a84 100644 --- a/goal_src/jak1/engine/gfx/ocean/ocean-texture.gc +++ b/goal_src/jak1/engine/gfx/ocean/ocean-texture.gc @@ -177,16 +177,15 @@ (none)) (defun draw-ocean-texture ((arg0 dma-buffer) (arg1 (inline-array vector)) (arg2 symbol)) - (local-vars (sv-16 (inline-array vector)) (sv-32 int) (sv-48 vector) (sv-64 (inline-array vector))) - (set! sv-64 arg1) - (let* ((s0-0 arg2) - (ocean-tex-page-0 *ocean-base-page*) - (ocean-tex-block-0 *ocean-base-block*) - (ocean-tex-page-1 (+ ocean-tex-page-0 8)) - (ocean-tex-block-1 (* ocean-tex-page-1 32)) - (ocean-tex-page-2 (+ ocean-tex-page-0 10)) - (ocean-tex-block-2 (* ocean-tex-page-2 32))) - (set-display-gs-state arg0 ocean-tex-page-0 128 128 0 0) + (let* ((sv-64 arg1) + (s0-0 arg2) + (a1-1 *ocean-base-page*) + (s2-0 *ocean-base-block*) + (s1-0 (+ a1-1 8)) + (s4-0 (* s1-0 32)) + (s3-0 (+ a1-1 10)) + (s5-0 (* s3-0 32))) + (set-display-gs-state arg0 a1-1 128 128 0 0) (dma-buffer-add-vu-function arg0 ocean-texture-vu1-block 1) (let* ((v1-0 arg0) (a0-3 (the-as object (-> v1-0 base)))) @@ -196,17 +195,17 @@ (set! (-> v1-0 base) (&+ (the-as pointer a0-3) 16))) (ocean-texture-add-constants arg0) (ocean-texture-add-envmap arg0) - (set! sv-16 sv-64) - (ocean-texture-add-verts arg0 sv-16) - (set! sv-48 (-> sv-16 192)) - (ocean-texture-add-call-start arg0) - (set! sv-32 0) - (while (< sv-32 9) - (ocean-texture-add-verts arg0 (the-as (inline-array vector) sv-48)) - (set! sv-48 (-> (the-as (inline-array vector) sv-48) 192)) - (ocean-texture-add-call-rest arg0) - (set! sv-32 (+ sv-32 1))) - (ocean-texture-add-verts-last arg0 (the-as (inline-array vector) sv-48) sv-64) + (let ((sv-16 sv-64)) + (ocean-texture-add-verts arg0 sv-16) + (let ((sv-48 (-> sv-16 192))) + (ocean-texture-add-call-start arg0) + (let ((sv-32 0)) + (while (< sv-32 9) + (ocean-texture-add-verts arg0 (the-as (inline-array vector) sv-48)) + (set! sv-48 (-> (the-as (inline-array vector) sv-48) 192)) + (ocean-texture-add-call-rest arg0) + (+! sv-32 1))) + (ocean-texture-add-verts-last arg0 (the-as (inline-array vector) sv-48) sv-64))) (ocean-texture-add-call-rest arg0) (ocean-texture-add-call-done arg0) ; (when s0-0 diff --git a/goal_src/jak1/engine/gfx/ocean/ocean-transition.gc b/goal_src/jak1/engine/gfx/ocean/ocean-transition.gc index 9f3dbf7212..14382eaa04 100644 --- a/goal_src/jak1/engine/gfx/ocean/ocean-transition.gc +++ b/goal_src/jak1/engine/gfx/ocean/ocean-transition.gc @@ -4,7 +4,8 @@ (require "engine/gfx/ocean/ocean-mid.gc") (require "engine/collide/collide-frag-h.gc") -;; definition for function ocean-trans-camera-masks-bit? +;; DECOMP BEGINS + (defun ocean-trans-camera-masks-bit? ((arg0 uint) (arg1 uint)) (let ((v1-3 (- arg0 (* (-> *ocean-work* mid-minz) 4))) (a0-4 (- arg1 (* (-> *ocean-work* mid-minx) 4)))) @@ -18,7 +19,6 @@ (a0-6 (+ (* a3-0 4) a2-3))) (logtest? (-> *ocean-work* trans-camera-masks 0 mask (+ a1-2 (* a0-6 8))) (ash 1 v1-4))))))) -;; definition for function ocean-trans-mask-ptrs-bit? (defun ocean-trans-mask-ptrs-bit? ((arg0 int) (arg1 int)) (let ((v1-3 (- arg0 (the-as int (* (-> *ocean-work* mid-minz) 4)))) (a0-4 (- arg1 (the-as int (* (-> *ocean-work* mid-minx) 4))))) @@ -36,7 +36,6 @@ (a0-11 (-> *ocean-work* trans-mask-ptrs (+ (* (+ (* a3-0 4) a2-3) 4) a1-2)))) (if a0-11 (logtest? (-> a0-11 1) (ash 1 v1-4)) #f)))))) -;; definition for function ocean-trans-mask-ptrs-set! (defun ocean-trans-mask-ptrs-set! ((arg0 int) (arg1 int)) (let ((v1-3 (- arg0 (the-as int (* (-> *ocean-work* mid-minz) 4)))) (a0-4 (- arg1 (the-as int (* (-> *ocean-work* mid-minx) 4))))) @@ -61,16 +60,8 @@ #t))) (else #f))))))) -;; definition for function ocean-trans-add-upload-table -;; WARN: Function may read a register that is not set: f31 -;; Used lq/sq (defun ocean-trans-add-upload-table ((arg0 dma-buffer) (arg1 int) (arg2 int) (arg3 (pointer float)) (arg4 int) (arg5 symbol)) (local-vars - (r0-0 int) - (r0-1 int) - (r0-2 int) - (r0-3 int) - (r0-4 int) (v1-12 (inline-array vector)) (v1-14 float) (a0-23 uint128) @@ -80,8 +71,7 @@ (a1-17 uint128) (a2-15 uint128) (a2-16 uint128) - (a3-10 uint128) - (f31-0 none)) + (a3-10 uint128)) (rlet ((acc :class vf) (vf1 :class vf) (vf10 :class vf) @@ -166,15 +156,15 @@ (t0-10 (the-as uint128 (-> *ocean-map* ocean-colors colors (+ (* 52 (+ a0-16 1)) a1-11)))) (a0-22 (the-as uint128 (-> *ocean-map* ocean-colors colors (+ a1-11 1 (* 52 (+ a0-16 1))))))) (.pextlb a1-15 0 a2-14) - (.mov r0-0 f31-0) + (nop!) (.pextlb a2-15 0 a3-9) - (.mov r0-1 f31-0) + (nop!) (.pextlb a3-10 0 t0-10) - (.mov r0-2 f31-0) + (nop!) (.pextlb a0-23 0 a0-22))) - (.mov r0-3 f31-0) + (nop!) (.pextlh a1-16 0 a1-15) - (.mov r0-4 f31-0) + (nop!) (.pextlh a2-16 0 a2-15) (.mov vf1 a1-16) (.pextlh a1-17 0 a3-10) @@ -236,16 +226,8 @@ (if arg5 (ocean-mid-add-call arg0 275) (ocean-mid-add-call arg0 107))) (none))) -;; definition for function ocean-trans-add-upload-strip -;; WARN: Function may read a register that is not set: f31 -;; Used lq/sq (defun ocean-trans-add-upload-strip ((arg0 dma-buffer) (arg1 uint) (arg2 uint) (arg3 uint) (arg4 uint) (arg5 uint)) (local-vars - (r0-0 int) - (r0-1 int) - (r0-2 int) - (r0-3 int) - (r0-4 int) (v1-8 float) (a0-23 uint128) (a0-24 uint128) @@ -254,8 +236,7 @@ (a1-15 uint128) (a1-16 uint128) (a2-15 uint128) - (a3-11 uint128) - (f31-0 none)) + (a3-11 uint128)) (rlet ((vf1 :class vf) (vf2 :class vf) (vf3 :class vf) @@ -291,15 +272,15 @@ (a2-14 (the-as uint128 (-> *ocean-map* ocean-colors colors (+ (* 52 (the-as int (+ arg1 1))) arg2)))) (a3-10 (the-as uint128 (-> *ocean-map* ocean-colors colors (+ arg2 1 (* 52 (the-as int (+ arg1 1)))))))) (.pextlb a0-23 0 a0-22) - (.mov r0-0 f31-0) + (nop!) (.pextlb a1-14 0 a1-13) - (.mov r0-1 f31-0) + (nop!) (.pextlb a2-15 0 a2-14) - (.mov r0-2 f31-0) + (nop!) (.pextlb a3-11 0 a3-10)) - (.mov r0-3 f31-0) + (nop!) (.pextlh a0-24 0 a0-23) - (.mov r0-4 f31-0) + (nop!) (.pextlh a1-15 0 a1-14) (.mov vf1 a0-24) (.pextlh a0-25 0 a2-15) @@ -343,8 +324,6 @@ (ocean-mid-add-call arg0 107) (none))) -;; definition for function ocean-transition-check -;; Used lq/sq (defun ocean-transition-check ((arg0 ocean-trans-mask) (arg1 int) (arg2 int) (arg3 vector)) (local-vars (v0-0 symbol) (v1-10 float) (a3-2 float) (a3-6 float) (a3-10 float)) (rlet ((vf1 :class vf) @@ -368,7 +347,7 @@ (when (< a3-2 19327350000.0) (logior! (-> arg0 mask arg2) (ash 1 arg1)) (return #f)) - (set! (-> v1-0 x) (+ 98304.0 (-> v1-0 x))) + (+! (-> v1-0 x) 98304.0) (let ((a3-5 v1-0) (t1-1 t0-1)) (.lvf vf2 (&-> a3-5 quad)) @@ -381,7 +360,7 @@ (when (< a3-6 19327350000.0) (logior! (-> arg0 mask arg2) (ash 1 arg1)) (return #f)) - (set! (-> v1-0 z) (+ 98304.0 (-> v1-0 z))) + (+! (-> v1-0 z) 98304.0) (let ((a3-9 v1-0) (t1-2 t0-1)) (.lvf vf2 (&-> a3-9 quad)) @@ -394,7 +373,7 @@ (when (< a3-10 19327350000.0) (logior! (-> arg0 mask arg2) (ash 1 arg1)) (return #f)) - (set! (-> v1-0 x) (+ -98304.0 (-> v1-0 x))) + (+! (-> v1-0 x) -98304.0) (.lvf vf2 (&-> v1-0 quad)) (.lvf vf3 (&-> t0-1 quad))) (.sub.vf vf1 vf3 vf2) @@ -407,27 +386,23 @@ (return #f) v0-0))) -;; definition for function ocean-make-trans-camera-masks -;; Used lq/sq (defun ocean-make-trans-camera-masks ((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 (-> *ocean-work* 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) (+ (-> *ocean-map* start-corner x) (* 393216.0 (the float arg1)))) - (set! (-> sv-56 y) (-> *ocean-map* start-corner y)) - (set! (-> sv-56 z) (+ (-> *ocean-map* start-corner z) (* 393216.0 (the float arg0)))) - (set! (-> sv-56 w) 1.0) - (dotimes (gp-0 4) - (dotimes (s5-0 4) - (set! (-> sv-60 x) (- (+ (-> sv-56 x) (* 98304.0 (the float s5-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 gp-0))) (-> sv-52 z))) - (ocean-transition-check sv-48 s5-0 gp-0 sv-56))) + (let ((sv-48 (-> *ocean-work* 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) (+ (-> *ocean-map* start-corner x) (* 393216.0 (the float arg1)))) + (set! (-> sv-56 y) (-> *ocean-map* start-corner y)) + (set! (-> sv-56 z) (+ (-> *ocean-map* start-corner z) (* 393216.0 (the float arg0)))) + (set! (-> sv-56 w) 1.0) + (dotimes (gp-0 4) + (dotimes (s5-0 4) + (set! (-> sv-60 x) (- (+ (-> sv-56 x) (* 98304.0 (the float s5-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 gp-0))) (-> sv-52 z))) + (ocean-transition-check sv-48 s5-0 gp-0 sv-56)))) #f) -;; definition for function ocean-trans-add-upload (defun ocean-trans-add-upload ((arg0 dma-buffer) (arg1 int) (arg2 int)) (when (not (ocean-trans-mask-ptrs-bit? arg1 arg2)) (let ((s1-0 (ocean-trans-camera-masks-bit? (the-as uint (+ arg1 -1)) (the-as uint arg2))) @@ -486,29 +461,27 @@ (else (ocean-trans-add-upload-table arg0 arg1 arg2 *ocean-trans-down-right-table* 18 #f)))))))) (none)) -;; definition for function draw-ocean-transition-seams (defun draw-ocean-transition-seams ((arg0 dma-buffer)) - (local-vars (sv-32 uint) (sv-33 uint) (sv-34 uint) (sv-35 uint) (sv-36 sphere)) - (set! sv-32 (-> *ocean-work* near-minx)) - (set! sv-33 (-> *ocean-work* near-maxx)) - (set! sv-34 (-> *ocean-work* near-minz)) - (set! sv-35 (-> *ocean-work* near-maxz)) - (set! sv-36 (new 'stack 'sphere)) - (set! (-> sv-36 y) (-> *ocean-map* start-corner y)) - (set! (-> sv-36 w) 69511.42) - (when (and (< sv-32 sv-33) (< sv-34 sv-35)) - (let ((s5-0 sv-34) - (s4-0 sv-35)) - (while (>= s4-0 s5-0) - (let ((s3-0 sv-32) - (s2-0 sv-33)) - (while (>= s2-0 s3-0) - (set! (-> sv-36 x) (+ 49152.0 (* 98304.0 (the float s3-0)) (-> *ocean-map* start-corner x))) - (set! (-> sv-36 z) (+ 49152.0 (* 98304.0 (the float s5-0)) (-> *ocean-map* start-corner z))) - (when (sphere-cull sv-36) - (if (not (ocean-trans-camera-masks-bit? s5-0 s3-0)) (ocean-trans-add-upload arg0 (the-as int s5-0) (the-as int s3-0)))) - (+! s3-0 1))) - (+! s5-0 1)))) + (let ((sv-32 (-> *ocean-work* near-minx)) + (sv-33 (-> *ocean-work* near-maxx)) + (sv-34 (-> *ocean-work* near-minz)) + (sv-35 (-> *ocean-work* near-maxz)) + (sv-36 (new 'stack 'sphere))) + (set! (-> sv-36 y) (-> *ocean-map* start-corner y)) + (set! (-> sv-36 w) 69511.42) + (when (and (< sv-32 sv-33) (< sv-34 sv-35)) + (let ((s5-0 sv-34) + (s4-0 sv-35)) + (while (>= s4-0 s5-0) + (let ((s3-0 sv-32) + (s2-0 sv-33)) + (while (>= s2-0 s3-0) + (set! (-> sv-36 x) (+ 49152.0 (* 98304.0 (the float s3-0)) (-> *ocean-map* start-corner x))) + (set! (-> sv-36 z) (+ 49152.0 (* 98304.0 (the float s5-0)) (-> *ocean-map* start-corner z))) + (when (sphere-cull sv-36) + (if (not (ocean-trans-camera-masks-bit? s5-0 s3-0)) (ocean-trans-add-upload arg0 (the-as int s5-0) (the-as int s3-0)))) + (+! s3-0 1))) + (+! s5-0 1))))) (dotimes (v1-27 16) (when (nonzero? (-> *ocean-work* trans-camera-masks v1-27 word)) (dotimes (a0-12 4) @@ -516,7 +489,6 @@ (if a1-8 (logior! (-> a1-8 1) (-> *ocean-work* trans-temp-masks 0 mask (+ a0-12 (* v1-27 8))))))))) #f) -;; definition for function ocean-trans-add-constants (defun ocean-trans-add-constants ((arg0 dma-buffer)) (let* ((a2-0 4) (v1-0 arg0) @@ -532,84 +504,81 @@ (set-vector! (-> v1-1 vector 3) 98304.0 0.0 98304.0 1.0)) (let ((v0-0 (&+ (-> arg0 base) 64))) (set! (-> arg0 base) v0-0) v0-0)) -;; definition for function draw-ocean-transition -;; INFO: Return type mismatch int vs none. (defun draw-ocean-transition ((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)) (dotimes (v1-0 16) (set! (-> *ocean-work* trans-camera-masks v1-0 word) (the-as uint 0)) (set! (-> *ocean-work* near-mask-indices v1-0) (the-as uint -1))) (dotimes (v1-3 64) (set! (-> *ocean-work* trans-mask-ptrs v1-3) (the-as (pointer int32) #f))) - (set! sv-32 (-> *ocean-work* mid-minx)) - (set! sv-33 (-> *ocean-work* mid-maxx)) - (set! sv-34 (-> *ocean-work* mid-minz)) - (set! sv-35 (-> *ocean-work* mid-maxz)) - (set! sv-36 (new 'stack 'sphere)) - (set! (-> sv-36 y) (-> *ocean-map* start-corner y)) - (set! (-> sv-36 w) 278045.7) - (let ((s5-0 sv-34) - (s4-0 sv-35)) - (while (>= s4-0 s5-0) - (let ((s3-0 sv-32) - (s2-0 sv-33)) - (while (>= s2-0 s3-0) - (when (not (ocean-mid-mask-ptrs-bit? s5-0 s3-0)) - (when (ocean-mid-camera-masks-bit? s5-0 s3-0) - (set! (-> sv-36 x) (+ 196608.0 (* 393216.0 (the float s3-0)) (-> *ocean-map* start-corner x))) - (set! (-> sv-36 z) (+ 196608.0 (* 393216.0 (the float s5-0)) (-> *ocean-map* start-corner z))) - (if (sphere-cull sv-36) (ocean-make-trans-camera-masks s5-0 s3-0 (- s5-0 sv-34) (- s3-0 sv-32))))) - (+! s3-0 1))) - (+! s5-0 1))) - (let ((a2-2 192) - (a1-8 0) - (a0-11 192) - (v1-32 0)) - (let ((a3-1 sv-34) - (t0-0 sv-35)) - (while (>= t0-0 a3-1) - (let ((t1-0 sv-32) - (t2-0 sv-33)) - (while (>= t2-0 t1-0) - (set! sv-40 (-> *ocean-work* trans-camera-masks (+ (* (- a3-1 sv-34) 4) (- t1-0 sv-32)))) - (when (nonzero? (-> sv-40 word)) - (dotimes (t3-10 4) - (let ((t4-5 (-> sv-40 mask t3-10))) - (when (nonzero? t4-5) - (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-32) t5-2) (set! v1-32 (the-as int t5-2)))) - (dotimes (t5-3 4) - (when (logtest? t4-5 (ash 1 t5-3)) - (let ((t6-9 (+ (* t1-0 4) t5-3))) - (if (< t6-9 (the-as uint a2-2)) (set! a2-2 (the-as int t6-9))) - (if (< (the-as uint a1-8) t6-9) (set! a1-8 (the-as int t6-9)))))))))) - (+! t1-0 1))) - (+! a3-1 1))) - (set! (-> *ocean-work* near-minx) (the-as uint (+ a2-2 -1))) - (set! (-> *ocean-work* near-maxx) (the-as uint (+ a1-8 1))) - (set! (-> *ocean-work* near-minz) (the-as uint (+ a0-11 -1))) - (set! (-> *ocean-work* near-maxz) (the-as uint (+ v1-32 1)))) - (dotimes (v1-34 16) - (set! (-> *ocean-work* trans-temp-masks v1-34 word) (-> *ocean-work* trans-camera-masks v1-34 word))) - (let ((s5-1 sv-34) - (s4-1 sv-35)) - (while (>= s4-1 s5-1) - (let ((s3-1 sv-32) - (s2-1 sv-33)) - (while (>= s2-1 s3-1) - (when (not (ocean-mid-mask-ptrs-bit? s5-1 s3-1)) - (when (ocean-mid-camera-masks-bit? s5-1 s3-1) - (let ((v1-43 (-> *ocean-map* ocean-trans-indices data (+ (* (the-as uint 48) s5-1) s3-1)))) - (when (>= (-> v1-43 parent) 0) - (set! sv-44 (+ (* (- s5-1 sv-34) 4) (- s3-1 sv-32))) - (set! (-> *ocean-work* near-mask-indices sv-44) (the-as uint (-> v1-43 child))) - (let ((s1-0 (-> *ocean-map* ocean-mid-masks data (-> v1-43 parent)))) - (dotimes (s0-0 4) - (let ((a3-5 (-> (the-as ocean-mid-mask (+ s0-0 (the-as int s1-0))) mask 0))) - (if (!= a3-5 255) (ocean-trans-add-upload-strip arg0 s5-1 s3-1 a3-5 sv-44 (the-as uint s0-0)))))))))) - (+! s3-1 1))) - (+! s5-1 1))) + (let ((sv-32 (-> *ocean-work* mid-minx)) + (sv-33 (-> *ocean-work* mid-maxx)) + (sv-34 (-> *ocean-work* mid-minz)) + (sv-35 (-> *ocean-work* mid-maxz))) + (let ((sv-36 (new 'stack 'sphere))) + (set! (-> sv-36 y) (-> *ocean-map* start-corner y)) + (set! (-> sv-36 w) 278045.7) + (let ((s5-0 sv-34) + (s4-0 sv-35)) + (while (>= s4-0 s5-0) + (let ((s3-0 sv-32) + (s2-0 sv-33)) + (while (>= s2-0 s3-0) + (when (not (ocean-mid-mask-ptrs-bit? s5-0 s3-0)) + (when (ocean-mid-camera-masks-bit? s5-0 s3-0) + (set! (-> sv-36 x) (+ 196608.0 (* 393216.0 (the float s3-0)) (-> *ocean-map* start-corner x))) + (set! (-> sv-36 z) (+ 196608.0 (* 393216.0 (the float s5-0)) (-> *ocean-map* start-corner z))) + (if (sphere-cull sv-36) (ocean-make-trans-camera-masks s5-0 s3-0 (- s5-0 sv-34) (- s3-0 sv-32))))) + (+! s3-0 1))) + (+! s5-0 1)))) + (let ((a2-2 192) + (a1-8 0) + (a0-11 192) + (v1-32 0)) + (let ((a3-1 sv-34) + (t0-0 sv-35)) + (while (>= t0-0 a3-1) + (let ((t1-0 sv-32) + (t2-0 sv-33)) + (while (>= t2-0 t1-0) + (let ((sv-40 (-> *ocean-work* trans-camera-masks (+ (* (- a3-1 sv-34) 4) (- t1-0 sv-32))))) + (when (nonzero? (-> sv-40 word)) + (dotimes (t3-10 4) + (let ((t4-5 (-> sv-40 mask t3-10))) + (when (nonzero? t4-5) + (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-32) t5-2) (set! v1-32 (the-as int t5-2)))) + (dotimes (t5-3 4) + (when (logtest? t4-5 (ash 1 t5-3)) + (let ((t6-9 (+ (* t1-0 4) t5-3))) + (if (< t6-9 (the-as uint a2-2)) (set! a2-2 (the-as int t6-9))) + (if (< (the-as uint a1-8) t6-9) (set! a1-8 (the-as int t6-9))))))))))) + (+! t1-0 1))) + (+! a3-1 1))) + (set! (-> *ocean-work* near-minx) (the-as uint (+ a2-2 -1))) + (set! (-> *ocean-work* near-maxx) (the-as uint (+ a1-8 1))) + (set! (-> *ocean-work* near-minz) (the-as uint (+ a0-11 -1))) + (set! (-> *ocean-work* near-maxz) (the-as uint (+ v1-32 1)))) + (dotimes (v1-34 16) + (set! (-> *ocean-work* trans-temp-masks v1-34 word) (-> *ocean-work* trans-camera-masks v1-34 word))) + (let ((s5-1 sv-34) + (s4-1 sv-35)) + (while (>= s4-1 s5-1) + (let ((s3-1 sv-32) + (s2-1 sv-33)) + (while (>= s2-1 s3-1) + (when (not (ocean-mid-mask-ptrs-bit? s5-1 s3-1)) + (when (ocean-mid-camera-masks-bit? s5-1 s3-1) + (let ((v1-43 (-> *ocean-map* ocean-trans-indices data (+ (* (the-as uint 48) s5-1) s3-1)))) + (when (>= (-> v1-43 parent) 0) + (let ((sv-44 (+ (* (- s5-1 sv-34) 4) (- s3-1 sv-32)))) + (set! (-> *ocean-work* near-mask-indices sv-44) (the-as uint (-> v1-43 child))) + (let ((s1-0 (-> *ocean-map* ocean-mid-masks data (-> v1-43 parent)))) + (dotimes (s0-0 4) + (let ((a3-5 (-> (the-as ocean-mid-mask (+ s0-0 (the-as int s1-0))) mask 0))) + (if (!= a3-5 255) (ocean-trans-add-upload-strip arg0 s5-1 s3-1 a3-5 sv-44 (the-as uint s0-0))))))))))) + (+! s3-1 1))) + (+! s5-1 1)))) (ocean-mid-add-call-flush arg0 (the-as uint 41)) (ocean-trans-add-constants arg0) (draw-ocean-transition-seams arg0) diff --git a/goal_src/jak1/engine/gfx/shadow/shadow.gc b/goal_src/jak1/engine/gfx/shadow/shadow.gc index 522b5dc3e8..1d27ca5c3a 100644 --- a/goal_src/jak1/engine/gfx/shadow/shadow.gc +++ b/goal_src/jak1/engine/gfx/shadow/shadow.gc @@ -39,33 +39,25 @@ (none)) (defun compute-and-draw-shadow ((arg0 vector) (arg1 vector) (arg2 vector) (arg3 vector) (arg4 float) (arg5 float)) - (local-vars - (v1-10 float) - (v1-11 float) - (sv-96 vector) - (sv-112 (function quaternion vector float quaternion)) - (sv-128 vector) - (sv-144 vector)) + (local-vars (v1-10 float) (v1-11 float)) (rlet ((vf0 :class vf) (vf1 :class vf) (vf2 :class vf)) (init-vf0-vector) - (set! sv-96 arg2) - (let ((s4-0 arg3) + (let ((sv-96 arg2) + (s4-0 arg3) (s3-0 arg4) (s2-0 arg5)) (when (< (- (-> arg0 y) (-> arg1 y)) s3-0) - (set! sv-144 (new 'stack-no-clear 'vector)) - (let ((s0-0 (new 'stack-no-clear 'vector)) + (let ((sv-144 (new 'stack-no-clear 'vector)) + (s0-0 (new 'stack-no-clear 'vector)) (s1-0 (new 'stack-no-clear 'sparticle-cpuinfo))) (+! (-> arg1 y) 40.96) (set! (-> sv-144 x) (-> sv-96 z)) (set! (-> sv-144 y) 0.0) (set! (-> sv-144 z) (- (-> sv-96 x))) (vector-normalize! sv-144 1.0) - (set! sv-112 quaternion-vector-angle!) - (set! sv-128 s0-0) - (let ((a2-1 (acos (-> sv-96 y)))) (sv-112 (the-as quaternion sv-128) sv-144 a2-1)) + (quaternion-vector-angle! (the-as quaternion s0-0) sv-144 (acos (-> sv-96 y))) (let ((v1-9 s1-0)) (cond ((< (-> s0-0 w) 0.0) diff --git a/goal_src/jak1/engine/gfx/sprite/sparticle/sparticle-launcher.gc b/goal_src/jak1/engine/gfx/sprite/sparticle/sparticle-launcher.gc index ae7da6ae7a..2262e162a3 100644 --- a/goal_src/jak1/engine/gfx/sprite/sparticle/sparticle-launcher.gc +++ b/goal_src/jak1/engine/gfx/sprite/sparticle/sparticle-launcher.gc @@ -215,6 +215,7 @@ (tidhash uint16 80) (spadgif adgif-shader 80 :inline))) + (define *particle-adgif-cache* (new 'global 'particle-adgif-cache)) (set! (-> *particle-adgif-cache* used) 0) @@ -333,7 +334,7 @@ (set! (-> v1-0 x) f0-0) (set! (-> v1-0 y) f1-0) (set! (-> v1-0 z) f3-0) - (set! (-> v1-0 w) (sqrtf (- (- (- 1.0 (* f3-0 f3-0)) (* f1-0 f1-0)) (* f0-0 f0-0))))) + (set! (-> v1-0 w) (sqrtf (- (- (- 1.0 (square f3-0)) (square f1-0)) (square f0-0))))) (quaternion->matrix s5-0 a1-1)) ;; rotate, preserving z as usual (vector3s-rotate*! (the-as vector3s (-> arg0 launchrot)) (the-as vector3s (-> arg0 launchrot)) s5-0) @@ -473,7 +474,7 @@ (set! (-> arg2 fade x) 99999.0) (set! (-> arg2 fade y) 99999.0) (set! (-> arg2 fade z) 99999.0) - (let ((a1-2 (sp-init-fields! (the-as (pointer float) (-> arg3 x-y-z-sx)) + (let ((a1-2 (sp-init-fields! (&-> arg3 x-y-z-sx x) (the-as (inline-array sp-field-init-spec) a1-1) (sp-field-id sprite-fields-start) (sp-field-id sprite-fields-end) @@ -496,7 +497,7 @@ (if (= (-> arg2 fade y) 99999.0) (set! (-> arg2 fade y) f28-0) (set! (-> arg2 fade y) (* (-> arg2 fade y) (-> v1-16 y)))) (if (= (-> arg2 fade z) 99999.0) (set! (-> arg2 fade z) f30-0) (set! (-> arg2 fade z) (* (-> arg2 fade z) (-> v1-16 z))))))) (else - (let ((a1-3 (sp-init-fields! (the-as (pointer float) (-> arg3 x-y-z-sx)) + (let ((a1-3 (sp-init-fields! (&-> arg3 x-y-z-sx x) (the-as (inline-array sp-field-init-spec) a1-1) (sp-field-id sprite-fields-start) (sp-field-id sprite-fields-end) @@ -533,7 +534,7 @@ (set! (-> v1-0 x) f0-0) (set! (-> v1-0 y) f1-0) (set! (-> v1-0 z) f3-0) - (set! (-> v1-0 w) (sqrtf (- (- (- 1.0 (* f3-0 f3-0)) (* f1-0 f1-0)) (* f0-0 f0-0))))) + (set! (-> v1-0 w) (sqrtf (- (- (- 1.0 (square f3-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) (set! (-> arg3 qx-qy-qz-sy z) 0.0) @@ -832,7 +833,7 @@ (set! (-> s4-0 x) f0-0) (set! (-> s4-0 y) f1-0) (set! (-> s4-0 z) f3-0) - (set! (-> s4-0 w) (sqrtf (- (- (- 1.0 (* f3-0 f3-0)) (* f1-0 f1-0)) (* f0-0 f0-0))))) + (set! (-> s4-0 w) (sqrtf (- (- (- 1.0 (square f3-0)) (square f1-0)) (square f0-0))))) (quaternion-rotate-y! (the-as quaternion s4-0) (the-as quaternion s4-0) (-> s5-0 sprite rot)) (let ((v1-3 arg2)) (cond @@ -875,7 +876,7 @@ (set! (-> s4-0 x) f0-0) (set! (-> s4-0 y) f1-0) (set! (-> s4-0 z) f3-0) - (set! (-> s4-0 w) (sqrtf (- (- (- 1.0 (* f3-0 f3-0)) (* f1-0 f1-0)) (* f0-0 f0-0))))) + (set! (-> s4-0 w) (sqrtf (- (- (- 1.0 (square f3-0)) (square f1-0)) (square f0-0))))) (let ((a1-1 (new-stack-vector0))) (set! (-> a1-1 y) (-> s5-0 sprite rot)) (set! (-> a1-1 z) diff --git a/goal_src/jak1/engine/level/load-boundary.gc b/goal_src/jak1/engine/level/load-boundary.gc index 40de275c4c..47f9e5f7a1 100644 --- a/goal_src/jak1/engine/level/load-boundary.gc +++ b/goal_src/jak1/engine/level/load-boundary.gc @@ -16,6 +16,7 @@ (x-origin float) (z-origin float))) + (define *lb-editor-parms* (new 'global 'lb-editor-parms)) (set! (-> *lb-editor-parms* boundary) #f) @@ -776,7 +777,7 @@ (f2-2 (* 0.5 (+ f0-0 f2-0))) (f1-1 (- f3-2 f1-0)) (f0-1 (- f2-2 f0-0)) - (f0-4 (sqrtf (+ (* f1-1 f1-1) (* f0-1 f0-1))))) + (f0-4 (sqrtf (+ (square f1-1) (square f0-1))))) (set-vector! (-> arg0 rejector) f3-2 0.0 f2-2 f0-4))) 0 (none)) @@ -898,7 +899,7 @@ (a2-0 (-> arg0 data (-> arg0 data s5-0 v1))) (a3-0 (-> arg0 data (-> arg0 data s5-0 v2))) (s4-0 (new 'stack-no-clear 'vector))) - (normal-of-plane s4-0 (the-as vector a1-0) (the-as vector a2-0) (the-as vector a3-0)) + (normal-of-plane s4-0 (-> a1-0 v) (-> a2-0 v) (-> a3-0 v)) (if (or (!= (-> s4-0 x) 0.0) (!= (-> s4-0 z) 0.0)) (format 0 "ERROR in the load-boundary code : tell Eddie!!!~%")) (when (< (-> s4-0 y) 0.0) (let ((v1-22 (-> arg0 data s5-0 v0))) @@ -1355,7 +1356,7 @@ (let ((f0-1 (- (-> a1-0 x) (-> arg0 rejector x))) (f1-2 (- (-> a1-0 z) (-> arg0 rejector z)))) (cond - ((< (+ (* f0-1 f0-1) (* f1-2 f1-2)) (* (-> arg0 rejector w) (-> arg0 rejector w))) + ((< (+ (square f0-1) (square f1-2)) (* (-> arg0 rejector w) (-> arg0 rejector w))) (if (logtest? (-> arg0 flags) (load-boundary-flags closed)) (set! s5-0 (check-closed-boundary arg0 a1-0 a2-0)) (set! s5-0 (check-open-boundary arg0 a1-0 a2-0)))) diff --git a/goal_src/jak1/engine/load/loader.gc b/goal_src/jak1/engine/load/loader.gc index 2bd723e3e7..17b70912dc 100644 --- a/goal_src/jak1/engine/load/loader.gc +++ b/goal_src/jak1/engine/load/loader.gc @@ -28,28 +28,25 @@ (mem-size (-> this data-array i) #f 0))) this) -(defmethod mem-usage ((this load-dir) (arg0 memory-usage-block) (arg1 int)) - "Get the memory usage data of a load-dir" - (set! (-> arg0 length) (max 82 (-> arg0 length))) - (set! (-> arg0 data 81 name) "array") - (set! (-> arg0 data 81 count) (+ (-> arg0 data 81 count) 1)) - (let ((v1-6 (asize-of this))) - (set! (-> arg0 data 81 used) (+ (-> arg0 data 81 used) v1-6)) - (set! (-> arg0 data 81 total) (+ (-> arg0 data 81 total) (logand -16 (+ v1-6 15))))) - (set! (-> arg0 length) (max 82 (-> arg0 length))) - (set! (-> arg0 data 81 name) "array") - (set! (-> arg0 data 81 count) (-> arg0 data 81 count)) +(defmethod mem-usage ((this load-dir) (usage memory-usage-block) (flags int)) + (set! (-> usage length) (max 82 (-> usage length))) + (set! (-> usage data 81 name) "array") + (+! (-> usage data 81 count) 1) + (let ((v1-6 (asize-of this))) (+! (-> usage data 81 used) v1-6) (+! (-> usage data 81 total) (logand -16 (+ v1-6 15)))) + (set! (-> usage length) (max 82 (-> usage length))) + (set! (-> usage data 81 name) "array") + (set! (-> usage data 81 count) (-> usage data 81 count)) (let ((v1-15 (asize-of (-> this string-array)))) - (set! (-> arg0 data 81 used) (+ (-> arg0 data 81 used) v1-15)) - (set! (-> arg0 data 81 total) (+ (-> arg0 data 81 total) (logand -16 (+ v1-15 15))))) - (set! (-> arg0 length) (max 82 (-> arg0 length))) - (set! (-> arg0 data 81 name) "array") - (set! (-> arg0 data 81 count) (-> arg0 data 81 count)) + (+! (-> usage data 81 used) v1-15) + (+! (-> usage data 81 total) (logand -16 (+ v1-15 15)))) + (set! (-> usage length) (max 82 (-> usage length))) + (set! (-> usage data 81 name) "array") + (set! (-> usage data 81 count) (-> usage data 81 count)) (let ((v1-24 (asize-of (-> this data-array)))) - (set! (-> arg0 data 81 used) (+ (-> arg0 data 81 used) v1-24)) - (set! (-> arg0 data 81 total) (+ (-> arg0 data 81 total) (logand -16 (+ v1-24 15))))) + (+! (-> usage data 81 used) v1-24) + (+! (-> usage data 81 total) (logand -16 (+ v1-24 15)))) (dotimes (s3-0 (-> this data-array length)) - (mem-usage (-> this data-array s3-0) arg0 arg1)) + (mem-usage (-> this data-array s3-0) usage flags)) (the-as load-dir #f)) (defmethod load-to-heap-by-name ((this load-dir-art-group) (art-name string) (do-reload symbol) (heap kheap) (version int)) @@ -475,7 +472,7 @@ (if (and (-> this preload-stream name) (or (not s4-4) (< (-> this preload-stream priority) (-> s4-4 priority)))) (set! s4-4 (-> this preload-stream))) (cond - (s4-4 (mem-copy! (&-> (-> this last-preload-stream) type) (&-> s4-4 type) 44) (str-play-queue (-> s4-4 name))) + (s4-4 (mem-copy! (&-> this last-preload-stream type) (&-> s4-4 type) 44) (str-play-queue (-> s4-4 name))) (else (set! (-> this last-preload-stream name) #f) (set! (-> this last-preload-stream owner) (the-as handle #f))))) (when (and debug-print *display-art-control*) (dotimes (s5-1 3) @@ -633,103 +630,93 @@ (define-extern ja-abort-spooled-anim (function spool-anim art-joint-anim int int :behavior process-drawable)) (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-39 int) - (spool-part int) - (sv-24 float) - (old-skel-status janim-status) - (sv-32 int) - (sv-40 int) - (sv-48 int) - (sv-56 int) - (spool-sound sound-id) - (sv-72 int)) - (set! spool-part 0) - (set! sv-24 -17.0) - (set! old-skel-status (-> self skel status)) - (set! sv-32 -2) - (set! sv-40 0) - (set! sv-48 0) - (set! sv-56 0) - (set! spool-sound (new-sound-id)) - (backup-load-state-and-set-cmds *load-state* (-> arg0 command-list)) - (set-setting! 'spooling (process->ppointer self) 0.0 0) - (logior! (-> self skel status) (janim-status inited drawn done)) - (kill-current-level-hint '() '() 'die) - (level-hint-surpress!) - (apply-settings *setting-control*) - (when (or (handle->process (-> *art-control* spool-lock)) (!= *master-mode* 'game)) - (cond - (arg1 (when (!= (ja-group) arg1) (ja-channel-push! 1 (seconds 0.05)) (ja :group! arg1 :num! min))) - (else (ja-channel-set! 0))) - (while (or (handle->process (-> *art-control* spool-lock)) (!= *master-mode* 'game)) - (format #t "WARNING: ---------------------> loader stall on lock~%") - (if (arg3 self) (goto cfg-88)) - (spool-push *art-control* (-> arg0 name) spool-part self -9.0) - (suspend) - (if arg1 (ja :num! (loop!))))) - (let ((v1-46 (process->ppointer self))) - (set! (-> *art-control* spool-lock) (new 'static 'handle :process v1-46 :pid (-> (the-as process (-> v1-46 0)) pid)))) - (set! sv-48 (the-as int (-> *display* base-frame-counter))) - (while (< spool-part (-> arg0 parts)) - (spool-push *art-control* (-> arg0 name) spool-part self -20.0) - (update *art-control* #f) - (spool-push *art-control* (-> arg0 name) spool-part self -20.0) - (when (!= (file-status *art-control* (-> arg0 name) spool-part) 'active) - (cond - (arg1 (when (!= (ja-group) arg1) (ja-channel-set! 1) (ja :group! arg1 :num! min))) - (else (ja-channel-set! 0))) - (while (!= (file-status *art-control* (-> arg0 name) spool-part) 'active) - (if (arg3 self) (goto cfg-88)) - (spool-push *art-control* (-> arg0 name) spool-part self -20.0) - (format #t "WARNING: ---------------------> loader stall on art ~S ~D~%" (-> arg0 name) spool-part) - (suspend) - (if arg1 (ja :num! (loop!))))) - (spool-push *art-control* (-> arg0 name) spool-part self -20.0) - (let ((s2-4 (the-as art-joint-anim (lookup-art (-> self draw art-group) (-> arg0 name) art-joint-anim)))) - (cond - (s2-4 - (ja-channel-set! 1) - (ja-no-eval :group! s2-4 :num! (seek!) :frame-num 0.0) - (when (zero? spool-part) - (str-play-async (-> arg0 name) spool-sound) - (set! (-> *art-control* active-stream) (-> arg0 name))) - (let* ((f30-0 (* 0.05859375 (-> s2-4 speed))) - (f28-0 (+ sv-24 (/ (the float (+ (-> s2-4 data 0 length) -1)) f30-0)))) - (set! sv-72 (current-str-pos spool-sound)) - (set! sv-40 (the-as int (-> *display* base-frame-counter))) - (until (>= (the float v0-39) f28-0) - (if (= (-> self skel root-channel 0) (-> self skel channel)) (logior! (-> self skel status) (janim-status spool))) - (if (or (arg3 self) - (and (<= sv-72 0) (>= (- (-> *display* base-frame-counter) sv-40) (seconds 4))) - (and (< 300 sv-56) (<= sv-72 0))) - (goto cfg-88)) - (spool-push *art-control* (-> arg0 name) spool-part self -20.0) - (if (< (+ spool-part 1) (-> arg0 parts)) - (spool-push *art-control* (-> arg0 name) (+ spool-part 1) self -10.0) - (logclear! (-> self skel status) (janim-status done))) - (execute-commands-up-to *load-state* (ja-aframe-num 0)) - (cond - ((and (< sv-32 sv-72) (= (current-str-id) spool-sound)) - (set! sv-56 (+ sv-56 (- (-> *display* base-frame-counter) (-> *display* old-base-frame-counter)))) - (set! sv-40 (the-as int (-> *display* base-frame-counter)))) - (else 0)) - (set! sv-32 sv-72) - (set! sv-48 (the-as int (-> *display* base-frame-counter))) - (suspend) - (let ((f0-14 (* (- (the float (current-str-pos spool-sound)) sv-24) f30-0))) - (ja-no-eval :num! (seek!) :frame-num f0-14)) - (set! v0-39 (current-str-pos spool-sound)) - (set! sv-72 v0-39)) - (set! sv-24 f28-0)) - (logclear! (-> self skel status) (janim-status spool))) - (else - (format 0 "ERROR: ~A in spool anim loop for ~A ~D, but not loaded.~%" self (-> arg0 name) spool-part) - (goto cfg-88)))) - (set! spool-part (+ spool-part 1))) - (set! spool-part (+ spool-part -1)) - (label cfg-88) - (ja-abort-spooled-anim arg0 arg2 spool-part) + (local-vars (v0-39 int)) + (let ((spool-part 0)) + (let ((sv-24 -17.0)) + (let ((old-skel-status (-> self skel status)))) + (let ((sv-32 -2) + (sv-40 0) + (sv-48 0) + (sv-56 0) + (spool-sound (new-sound-id))) + (backup-load-state-and-set-cmds *load-state* (-> arg0 command-list)) + (set-setting! 'spooling (process->ppointer self) 0.0 0) + (logior! (-> self skel status) (janim-status inited drawn done)) + (kill-current-level-hint '() '() 'die) + (level-hint-surpress!) + (apply-settings *setting-control*) + (when (or (handle->process (-> *art-control* spool-lock)) (!= *master-mode* 'game)) + (cond + (arg1 (when (!= (ja-group) arg1) (ja-channel-push! 1 (seconds 0.05)) (ja :group! arg1 :num! min))) + (else (ja-channel-set! 0))) + (while (or (handle->process (-> *art-control* spool-lock)) (!= *master-mode* 'game)) + (format #t "WARNING: ---------------------> loader stall on lock~%") + (if (arg3 self) (goto cfg-88)) + (spool-push *art-control* (-> arg0 name) spool-part self -9.0) + (suspend) + (if arg1 (ja :num! (loop!))))) + (set! (-> *art-control* spool-lock) (process->handle self)) + (set! sv-48 (the-as int (current-time))) + (while (< spool-part (-> arg0 parts)) + (spool-push *art-control* (-> arg0 name) spool-part self -20.0) + (update *art-control* #f) + (spool-push *art-control* (-> arg0 name) spool-part self -20.0) + (when (!= (file-status *art-control* (-> arg0 name) spool-part) 'active) + (cond + (arg1 (when (!= (ja-group) arg1) (ja-channel-set! 1) (ja :group! arg1 :num! min))) + (else (ja-channel-set! 0))) + (while (!= (file-status *art-control* (-> arg0 name) spool-part) 'active) + (if (arg3 self) (goto cfg-88)) + (spool-push *art-control* (-> arg0 name) spool-part self -20.0) + (format #t "WARNING: ---------------------> loader stall on art ~S ~D~%" (-> arg0 name) spool-part) + (suspend) + (if arg1 (ja :num! (loop!))))) + (spool-push *art-control* (-> arg0 name) spool-part self -20.0) + (let ((s2-4 (the-as art-joint-anim (lookup-art (-> self draw art-group) (-> arg0 name) art-joint-anim)))) + (cond + (s2-4 + (ja-channel-set! 1) + (ja-no-eval :group! s2-4 :num! (seek!) :frame-num 0.0) + (when (zero? spool-part) + (str-play-async (-> arg0 name) spool-sound) + (set! (-> *art-control* active-stream) (-> arg0 name))) + (let* ((f30-0 (* 0.05859375 (-> s2-4 speed))) + (f28-0 (+ sv-24 (/ (the float (+ (-> s2-4 data 0 length) -1)) f30-0)))) + (let ((sv-72 (current-str-pos spool-sound))) + (set! sv-40 (the-as int (current-time))) + (until (>= (the float v0-39) f28-0) + (if (= (-> self skel root-channel 0) (-> self skel channel)) (logior! (-> self skel status) (janim-status spool))) + (if (or (arg3 self) + (and (<= sv-72 0) (time-elapsed? (the-as time-frame sv-40) (seconds 4))) + (and (< 300 sv-56) (<= sv-72 0))) + (goto cfg-88)) + (spool-push *art-control* (-> arg0 name) spool-part self -20.0) + (if (< (+ spool-part 1) (-> arg0 parts)) + (spool-push *art-control* (-> arg0 name) (+ spool-part 1) self -10.0) + (logclear! (-> self skel status) (janim-status done))) + (execute-commands-up-to *load-state* (ja-aframe-num 0)) + (cond + ((and (< sv-32 sv-72) (= (current-str-id) spool-sound)) + (+! sv-56 (- (current-time) (-> *display* old-base-frame-counter))) + (set! sv-40 (the-as int (current-time)))) + (else 0)) + (set! sv-32 sv-72) + (set! sv-48 (the-as int (current-time))) + (suspend) + (let ((f0-14 (* (- (the float (current-str-pos spool-sound)) sv-24) f30-0))) + (ja-no-eval :num! (seek!) :frame-num f0-14)) + (set! v0-39 (current-str-pos spool-sound)) + (set! sv-72 v0-39))) + (set! sv-24 f28-0)) + (logclear! (-> self skel status) (janim-status spool))) + (else + ;; og:preserve-this fixed broken format string + (format 0 "ERROR: ~A in spool anim loop for ~A ~D, but not loaded.~%" self (-> arg0 name) spool-part) + (goto cfg-88)))) + (+! spool-part 1)))) + (+! spool-part -1) + (label cfg-88) + (ja-abort-spooled-anim arg0 arg2 spool-part)) 0) (defbehavior ja-abort-spooled-anim process-drawable ((arg0 spool-anim) (arg1 art-joint-anim) (arg2 int)) @@ -738,7 +725,7 @@ (str-play-stop (-> arg0 name)) (set! (-> *art-control* active-stream) #f) (logclear! (-> self skel status) (janim-status drawn done)) - (if (zero? (logand (-> self skel status) (janim-status inited))) (logclear! (-> self skel status) (janim-status inited))) + (if (not (logtest? (-> self skel status) (janim-status inited))) (logclear! (-> self skel status) (janim-status inited))) (remove-setting! 'spooling) (cond ((and arg1 (>= arg2 0)) diff --git a/goal_src/jak1/engine/math/math.gc b/goal_src/jak1/engine/math/math.gc index 72c259fd1a..af0c03e252 100644 --- a/goal_src/jak1/engine/math/math.gc +++ b/goal_src/jak1/engine/math/math.gc @@ -5,6 +5,9 @@ ;; various math helpers +(defmacro square (x) + `(* ,x ,x)) + ;; DECOMP BEGINS ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; diff --git a/goal_src/jak1/engine/math/transformq.gc b/goal_src/jak1/engine/math/transformq.gc index b3470df5c2..8ac236febf 100644 --- a/goal_src/jak1/engine/math/transformq.gc +++ b/goal_src/jak1/engine/math/transformq.gc @@ -133,16 +133,13 @@ ;; the basic idea is that we apply two rotations: ;; the first moves our y axis toward the desired's y axis, and the second moves ;; out z axis. These are both rate limited. - (local-vars (sv-96 vector)) (let ((quat (get-quaternion this))) (let ((temp-quat (new 'stack-no-clear 'quaternion))) (when (< 0.0 z-rate) - (let ((s1-0 quaternion-from-two-vectors-max-angle!) - (s0-0 temp-quat)) - (set! sv-96 (vector-y-quaternion! (new 'stack-no-clear 'vector) quat)) - (let ((a2-1 (vector-y-quaternion! (new 'stack-no-clear 'vector) target)) - (a3-1 (* z-rate (seconds-per-frame)))) - (s1-0 s0-0 sv-96 a2-1 a3-1))) + (quaternion-from-two-vectors-max-angle! temp-quat + (vector-y-quaternion! (new 'stack-no-clear 'vector) quat) + (vector-y-quaternion! (new 'stack-no-clear 'vector) target) + (* z-rate (seconds-per-frame))) (quaternion-normalize! (quaternion*! quat temp-quat quat))) (when (< 0.0 y-rate) (quaternion-from-two-vectors-max-angle! temp-quat diff --git a/goal_src/jak1/engine/nav/navigate.gc b/goal_src/jak1/engine/nav/navigate.gc index 5e906ebb3b..2a26b2f917 100644 --- a/goal_src/jak1/engine/nav/navigate.gc +++ b/goal_src/jak1/engine/nav/navigate.gc @@ -100,7 +100,6 @@ (define *color-orange* (new 'static 'rgba :r #xff :g #x80 :a #x80)) (defun entity-nav-login ((arg0 entity-actor)) - (local-vars (sv-16 res-tag)) (let ((gp-0 (if (nonzero? (-> arg0 nav-mesh)) (-> arg0 nav-mesh)))) (when gp-0 (when (zero? (-> gp-0 user-list)) @@ -109,8 +108,8 @@ (initialize-mesh! gp-0) (update-route-table gp-0)) (when (zero? (-> gp-0 static-sphere)) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-11 (res-lump-data arg0 'nav-mesh-sphere pointer :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-11 (res-lump-data arg0 'nav-mesh-sphere pointer :tag-ptr (& sv-16)))) (when v1-11 (set! (-> gp-0 static-sphere-count) (-> sv-16 elt-count)) (set! (-> gp-0 static-sphere) (the-as (inline-array nav-sphere) v1-11))))))) @@ -397,9 +396,8 @@ (local-vars (a0-6 symbol) (a2-3 uint128) (a2-4 uint128)) -1 (let ((s2-0 -1) - (s3-0 (current-time)) - (f0-0 (-> this bounds w))) - (when (>= (* f0-0 f0-0) (vector-length-squared arg0)) + (s3-0 (current-time))) + (when (>= (square (-> this bounds w)) (vector-length-squared arg0)) (dotimes (v1-3 4) (set! a0-6 (and (= (-> this cache v1-3 time) s3-0) @@ -440,10 +438,7 @@ (f1-2 (- (-> t1-4 x) (-> t0-4 x))) (f2-2 (- (-> arg0 x) (-> t0-4 x))) (f3-2 (- (-> arg0 z) (-> t0-4 z))) - (f4-1 f0-1) - (f4-3 (* f4-1 f4-1)) - (f5-0 f1-2) - (f4-5 (sqrtf (+ f4-3 (* f5-0 f5-0)))) + (f4-5 (sqrtf (+ (square f0-1) (square f1-2)))) (f4-7 (/ 1.0 f4-5)) (f0-2 (* f0-1 f4-7)) (f1-3 (* f1-2 f4-7)) @@ -474,12 +469,8 @@ (else (return #t))))) (when t0-15 (let* ((v1-28 (-> arg2 a3-5)) - (f0-11 (- (-> v1-28 x) (-> arg0 x))) - (f0-13 (* f0-11 f0-11)) - (f1-14 (- (-> v1-28 z) (-> arg0 z))) - (f0-14 (+ f0-13 (* f1-14 f1-14))) - (f1-17 arg1)) - (if (>= (* f1-17 f1-17) f0-14) #t)))))) + (f0-14 (+ (square (- (-> v1-28 x) (-> arg0 x))) (square (- (-> v1-28 z) (-> arg0 z)))))) + (if (>= (square arg1) f0-14) #t)))))) (defun circle-triangle-intersection? ((arg0 vector) (arg1 float) (arg2 (inline-array nav-vertex))) (let ((v1-0 arg0) @@ -493,10 +484,7 @@ (f2-2 (- (-> t0-4 x) (-> a3-4 x))) (f3-2 (- (-> v1-0 x) (-> a3-4 x))) (f4-2 (- (-> v1-0 z) (-> a3-4 z))) - (f5-1 f1-1) - (f5-3 (* f5-1 f5-1)) - (f6-0 f2-2) - (f5-5 (sqrtf (+ f5-3 (* f6-0 f6-0)))) + (f5-5 (sqrtf (+ (square f1-1) (square f2-2)))) (f5-7 (/ 1.0 f5-5)) (f1-2 (* f1-1 f5-7)) (f2-3 (* f2-2 f5-7)) @@ -527,14 +515,12 @@ (else (return #t))))) (when a3-15 (let* ((a0-2 (-> a0-1 a2-6)) - (f1-11 (- (-> a0-2 x) (-> v1-0 x))) - (f1-13 (* f1-11 f1-11)) - (f2-13 (- (-> a0-2 z) (-> v1-0 z))) - (f1-14 (+ f1-13 (* f2-13 f2-13)))) - (if (>= (* f0-0 f0-0) f1-14) #t)))))) + (f1-14 (+ (square (- (-> a0-2 x) (-> v1-0 x))) (square (- (-> a0-2 z) (-> v1-0 z)))))) + (if (>= (square f0-0) f1-14) #t)))))) ;; ERROR: Failed load: (set! vf3 (l.vf a0-4)) at op 42 (defmethod is-in-mesh? ((this nav-mesh) (arg0 vector) (arg1 float) (arg2 meters)) + ;; og:preserve-this float -> int (local-vars (v1-10 int)) (rlet ((vf1 :class vf) (vf2 :class vf) @@ -543,53 +529,52 @@ (vf5 :class vf) (vf6 :class vf) (vf7 :class vf)) - (let ((f0-1 (+ arg1 (-> this bounds w)))) - (when (>= (* f0-1 f0-1) (vector-length-squared arg0)) - (let ((s2-0 (new 'stack-no-clear 'inline-array 'nav-vertex 6)) - (f30-1 0.33333334)) - (countdown (s1-0 (-> this poly-count)) - (set! *debug-traverse* (+ *debug-traverse* 1)) - (let ((a0-3 (-> this poly s1-0))) - (when (not (logtest? (-> a0-3 pat) 1)) + (when (>= (square (+ arg1 (-> this bounds w))) (vector-length-squared arg0)) + (let ((s2-0 (new 'stack-no-clear 'inline-array 'nav-vertex 6)) + (f30-1 0.33333334)) + (countdown (s1-0 (-> this poly-count)) + (set! *debug-traverse* (+ *debug-traverse* 1)) + (let ((a0-3 (-> this poly s1-0))) + (when (not (logtest? (-> a0-3 pat) 1)) + (nop!) + (let ((v1-8 (the-as object (-> this vertex)))) (nop!) - (let ((v1-8 (the-as object (-> this vertex)))) + (let ((a2-1 (-> a0-3 vertex 0))) (nop!) - (let ((a2-1 (-> a0-3 vertex 0))) - (nop!) - (let* ((a1-1 (-> a0-3 vertex 1)) - (a2-2 (* a2-1 16)) - (a3-1 (-> a0-3 vertex 2)) - (a1-2 (* a1-1 16)) - (a0-4 (+ a2-2 (the-as int v1-8))) - (a2-3 (* a3-1 16)) - (a1-3 (+ a1-2 (the-as int v1-8))) - (v1-9 (+ a2-3 (the-as int v1-8)))) - (.lvf vf3 a0-4) - (let ((a0-5 f30-1)) (.mov vf7 a0-5)) - (.lvf vf4 a1-3) - (.lvf vf5 v1-9)))) - (.min.vf.xyz vf1 vf3 vf4) - (.lvf vf6 (&-> arg0 quad)) - (.add.y.vf.y vf7 vf3 vf4) - (.svf (&-> s2-0 0 quad) vf3) - (.max.vf.xyz vf2 vf3 vf4) - (.svf (&-> s2-0 1 quad) vf4) - (.min.vf.xyz vf1 vf1 vf5) - (.svf (&-> s2-0 2 quad) vf5) - (.max.vf.xyz vf2 vf2 vf5) - (.mul.x.vf.y vf7 vf7 vf7) - (.svf (&-> s2-0 3 quad) vf1) - (.svf (&-> s2-0 4 quad) vf2) - (.sub.y.vf.y vf7 vf6 vf7) - (.mov v1-10 vf7) - (let ((v1-11 (the-as number (sar (the-as int v1-10) 32)))) - (when (and (>= arg2 (fabs (the-as float v1-11))) - (>= (+ (-> arg0 x) arg1) (-> s2-0 3 x)) - (>= (-> s2-0 4 x) (- (-> arg0 x) arg1)) - (>= (+ (-> arg0 z) arg1) (-> s2-0 3 z)) - (>= (-> s2-0 4 z) (- (-> arg0 z) arg1))) - (set! *debug-tests* (+ *debug-tests* 1)) - (if (circle-triangle-intersection? arg0 arg1 s2-0) (return #t)))))))))) + (let* ((a1-1 (-> a0-3 vertex 1)) + (a2-2 (* a2-1 16)) + (a3-1 (-> a0-3 vertex 2)) + (a1-2 (* a1-1 16)) + (a0-4 (+ a2-2 (the-as int v1-8))) + (a2-3 (* a3-1 16)) + (a1-3 (+ a1-2 (the-as int v1-8))) + (v1-9 (+ a2-3 (the-as int v1-8)))) + (.lvf vf3 a0-4) + (let ((a0-5 f30-1)) (.mov vf7 a0-5)) + (.lvf vf4 a1-3) + (.lvf vf5 v1-9)))) + (.min.vf.xyz vf1 vf3 vf4) + (.lvf vf6 (&-> arg0 quad)) + (.add.y.vf.y vf7 vf3 vf4) + (.svf (&-> s2-0 0 quad) vf3) + (.max.vf.xyz vf2 vf3 vf4) + (.svf (&-> s2-0 1 quad) vf4) + (.min.vf.xyz vf1 vf1 vf5) + (.svf (&-> s2-0 2 quad) vf5) + (.max.vf.xyz vf2 vf2 vf5) + (.mul.x.vf.y vf7 vf7 vf7) + (.svf (&-> s2-0 3 quad) vf1) + (.svf (&-> s2-0 4 quad) vf2) + (.sub.y.vf.y vf7 vf6 vf7) + (.mov v1-10 vf7) + (let ((v1-11 (the-as number (sar (the-as int v1-10) 32)))) + (when (and (>= arg2 (fabs (the-as float v1-11))) + (>= (+ (-> arg0 x) arg1) (-> s2-0 3 x)) + (>= (-> s2-0 4 x) (- (-> arg0 x) arg1)) + (>= (+ (-> arg0 z) arg1) (-> s2-0 3 z)) + (>= (-> s2-0 4 z) (- (-> arg0 z) arg1))) + (set! *debug-tests* (+ *debug-tests* 1)) + (if (circle-triangle-intersection? arg0 arg1 s2-0) (return #t))))))))) #f)) (defmethod move-along-nav-ray! ((this nav-mesh) (arg0 nav-ray)) @@ -704,34 +689,26 @@ (define *nav-update-route-table-route-count* 0) (defmethod nav-mesh-method-18 ((this nav-mesh) (arg0 int) (arg1 vector) (arg2 int) (arg3 (pointer int8)) (arg4 int)) - (local-vars (sv-32 int) (sv-48 uint)) (set! (-> arg3 arg2) 1) (nav-mesh-update-route-table this arg0 arg2 (the-as uint 3)) (nav-mesh-update-route-table this arg2 arg0 (the-as uint 3)) (set! *nav-update-route-table-route-count* (+ *nav-update-route-table-route-count* 1)) (when (> arg4 0) (let ((s1-1 (-> this poly arg2)) - (s0-0 (new 'stack-no-clear 'vector))) - (set! sv-32 0) + (s0-0 (new 'stack-no-clear 'vector)) + (sv-32 0)) (while (< sv-32 3) - (set! sv-48 (-> (the-as nav-poly (+ sv-32 (the-as int s1-1))) adj-poly 0)) - (when (and (!= sv-48 255) (!= 1 (-> (the-as (pointer uint8) (&+ arg3 sv-48))))) - (set! (-> arg3 sv-48) 1) - (when (not (logtest? (-> this poly sv-48 pat) 1)) - (let ((v0-3 (= (nav-mesh-lookup-route this arg0 (the-as int sv-48)) 3))) - (when (not v0-3) - (tri-centroid-local this s1-1 s0-0) - (set! *nav-update-route-table-ray-count* (+ *nav-update-route-table-ray-count* 1)) - (set! v0-3 (nav-ray-test-local? this (-> this poly arg0) arg1 s0-0))) - (when v0-3 - (let* ((a0-16 this) - (t9-5 (method-of-object a0-16 nav-mesh-method-18)) - (a1-7 arg0) - (a2-6 arg1) - (t0-1 arg3) - (t1-1 (+ arg4 -1))) - (t9-5 a0-16 a1-7 a2-6 (the-as int sv-48) t0-1 t1-1)))))) - (set! sv-32 (+ sv-32 1))))) + (let ((sv-48 (-> (the-as nav-poly (+ sv-32 (the-as int s1-1))) adj-poly 0))) + (when (and (!= sv-48 255) (!= 1 (-> (the-as (pointer uint8) (&+ arg3 sv-48))))) + (set! (-> arg3 sv-48) 1) + (when (not (logtest? (-> this poly sv-48 pat) 1)) + (let ((v0-3 (= (nav-mesh-lookup-route this arg0 (the-as int sv-48)) 3))) + (when (not v0-3) + (tri-centroid-local this s1-1 s0-0) + (set! *nav-update-route-table-ray-count* (+ *nav-update-route-table-ray-count* 1)) + (set! v0-3 (nav-ray-test-local? this (-> this poly arg0) arg1 s0-0))) + (if v0-3 (nav-mesh-method-18 this arg0 arg1 (the-as int sv-48) arg3 (+ arg4 -1))))))) + (+! sv-32 1)))) 0 (none)) @@ -768,10 +745,7 @@ (f2-2 (- (-> t1-4 x) (-> t0-4 x))) (f3-2 (- (-> arg0 x) (-> t0-4 x))) (f4-2 (- (-> arg0 z) (-> t0-4 z))) - (f5-1 f1-1) - (f5-3 (* f5-1 f5-1)) - (f6-0 f2-2) - (f5-5 (sqrtf (+ f5-3 (* f6-0 f6-0)))) + (f5-5 (sqrtf (+ (square f1-1) (square f2-2)))) (f5-7 (/ 1.0 f5-5)) (f1-2 (* f1-1 f5-7)) (f2-3 (* f2-2 f5-7)) @@ -802,11 +776,8 @@ ((< 0.0 f1-9) (set! t0-14 #t) (set! a3-5 (-> *edge-vert1-table* a3-5))) (else (return f0-0))))) (when t0-14 - (let* ((v1-27 (-> arg2 a3-5)) - (f0-2 (- (-> v1-27 x) (-> arg0 x))) - (f0-4 (* f0-2 f0-2)) - (f1-12 (- (-> v1-27 z) (-> arg0 z)))) - (set! f0-0 (fmin (sqrtf (+ f0-4 (* f1-12 f1-12))) arg1))))) + (let ((v1-27 (-> arg2 a3-5))) + (set! f0-0 (fmin (sqrtf (+ (square (- (-> v1-27 x) (-> arg0 x))) (square (- (-> v1-27 z) (-> arg0 z))))) arg1))))) f0-0)) (defmethod find-poly ((this nav-mesh) (arg0 vector) (arg1 meters) (arg2 (pointer nav-control-flags))) @@ -892,27 +863,26 @@ (none)) (defmethod initialize-mesh! ((this nav-mesh)) - (local-vars (sv-32 vector) (sv-48 int)) (with-pp - (set! sv-32 (new 'stack-no-clear 'vector)) - (let ((s5-0 (-> this poly-count)) + (let ((sv-32 (new 'stack-no-clear 'vector)) + (s5-0 (-> this poly-count)) (s3-0 (-> this vertex-count)) (s1-0 0) (s2-0 0) (s4-0 0) (gp-0 #f)) - (set! sv-48 s5-0) - (while (nonzero? sv-48) - (set! sv-48 (+ sv-48 -1)) - (let ((v1-4 (-> this poly sv-48))) - (if (logtest? (-> v1-4 pat) 1) (+! s4-0 1)) - (let ((a1-2 (-> this vertex (-> v1-4 vertex 0))) - (a2-2 (-> this vertex (-> v1-4 vertex 1))) - (a3-0 (-> this vertex (-> v1-4 vertex 2)))) - (vector-3pt-cross! sv-32 a1-2 a2-2 a3-0))) - (cond - ((= (vector-length sv-32) 0.0) (+! s1-0 1)) - (else (vector-normalize! sv-32 1.0) (if (>= 0.0 (-> sv-32 y)) (+! s2-0 1))))) + (let ((sv-48 s5-0)) + (while (nonzero? sv-48) + (+! sv-48 -1) + (let ((v1-4 (-> this poly sv-48))) + (if (logtest? (-> v1-4 pat) 1) (+! s4-0 1)) + (let ((a1-2 (-> this vertex (-> v1-4 vertex 0))) + (a2-2 (-> this vertex (-> v1-4 vertex 1))) + (a3-0 (-> this vertex (-> v1-4 vertex 2)))) + (vector-3pt-cross! sv-32 a1-2 a2-2 a3-0))) + (cond + ((= (vector-length sv-32) 0.0) (+! s1-0 1)) + (else (vector-normalize! sv-32 1.0) (if (>= 0.0 (-> sv-32 y)) (+! s2-0 1)))))) (when (zero? s5-0) (format #t "WARNING: nav-mesh has no triangles. ") (set! gp-0 #t)) @@ -1027,19 +997,18 @@ (set! (-> s4-0 vector 0 quad) (-> this vertex (-> arg0 vertex 0) quad)) (set! (-> s4-0 vector 1 quad) (-> this vertex (-> arg0 vertex 1) quad)) (set! (-> s4-0 vector 2 quad) (-> this vertex (-> arg0 vertex 2) quad)) - (normal-of-plane s3-0 (the-as vector (-> s4-0 vector)) (-> s4-0 vector 1) (-> s4-0 vector 2)) + (normal-of-plane s3-0 (-> s4-0 vector 0) (-> s4-0 vector 1) (-> s4-0 vector 2)) (closest-pt-in-triangle arg1 arg2 s4-0 s3-0)) (none)) (defmethod project-onto-nav-mesh ((this nav-control) (arg0 vector) (arg1 vector)) - (local-vars (sv-32 int)) - (let ((s5-0 (-> this mesh)) - (s3-1 (vector-! (new 'stack-no-clear 'vector) arg1 (-> this mesh origin)))) - (set! sv-32 0) - (let ((a1-5 (find-poly s5-0 s3-1 (-> this nearest-y-threshold) (the-as (pointer nav-control-flags) (& sv-32))))) - (cond - ((logtest? #x100000 sv-32) (set! (-> arg0 quad) (-> arg1 quad))) - (else (closest-point-on-boundary s5-0 a1-5 arg0 s3-1) (vector+! arg0 arg0 (-> s5-0 origin)))))) + (let* ((s5-0 (-> this mesh)) + (s3-1 (vector-! (new 'stack-no-clear 'vector) arg1 (-> this mesh origin))) + (sv-32 0) + (a1-5 (find-poly s5-0 s3-1 (-> this nearest-y-threshold) (the-as (pointer nav-control-flags) (& sv-32))))) + (cond + ((logtest? #x100000 sv-32) (set! (-> arg0 quad) (-> arg1 quad))) + (else (closest-point-on-boundary s5-0 a1-5 arg0 s3-1) (vector+! arg0 arg0 (-> s5-0 origin))))) arg0) (defmethod find-poly ((this nav-control) (arg0 vector)) @@ -1059,14 +1028,6 @@ (is-in-mesh? a1-1 v1-1 arg1 (-> this nearest-y-threshold)))) (defmethod debug-draw ((this nav-control)) - (local-vars - (sv-192 vector) - (sv-208 uint) - (sv-224 int) - (sv-240 (function _varargs_ object)) - (sv-256 string) - (sv-272 int) - (sv-288 (function _varargs_ object))) (let ((a0-1 this)) (when (and *display-nav-marks* (logtest? (-> a0-1 flags) (nav-control-flags display-marks))) (let ((s5-0 (-> this mesh)) @@ -1091,39 +1052,34 @@ (dotimes (s3-1 (-> s5-0 node-count)) (let ((a1-4 (-> s5-0 nodes s3-1)) (a0-15 (new 'stack-no-clear 'vector)) - (v1-20 (new 'stack-no-clear 'vector))) - (set! sv-192 (new 'stack-no-clear 'vector)) - (let ((s2-0 (new 'stack-no-clear 'vector)) - (s1-0 (new 'stack-no-clear 'vector)) - (s0-0 (new 'stack-no-clear 'vector))) - (set! sv-208 (the-as uint #x80808080)) - (set! (-> a0-15 quad) (-> a1-4 center quad)) - (set! (-> v1-20 quad) (-> a1-4 radius quad)) - (set! (-> sv-192 w) 1.0) - (set! (-> s2-0 w) 1.0) - (set! (-> s1-0 w) 1.0) - (set! (-> s0-0 w) 1.0) - (set! (-> sv-192 x) (+ (-> a0-15 x) (-> v1-20 x))) - (set! (-> sv-192 y) (+ (-> a0-15 y) (-> v1-20 y))) - (set! (-> sv-192 z) (+ (-> a0-15 z) (-> v1-20 z))) - (set! (-> s2-0 x) (+ (-> a0-15 x) (-> v1-20 x))) - (set! (-> s2-0 y) (+ (-> a0-15 y) (-> v1-20 y))) - (set! (-> s2-0 z) (- (-> a0-15 z) (-> v1-20 z))) - (set! (-> s1-0 x) (- (-> a0-15 x) (-> v1-20 x))) - (set! (-> s1-0 y) (+ (-> a0-15 y) (-> v1-20 y))) - (set! (-> s1-0 z) (- (-> a0-15 z) (-> v1-20 z))) - (set! (-> s0-0 x) (- (-> a0-15 x) (-> v1-20 x))) - (set! (-> s0-0 y) (+ (-> a0-15 y) (-> v1-20 y))) - (set! (-> s0-0 z) (+ (-> a0-15 z) (-> v1-20 z))) - (add-debug-line #t (bucket-id debug-no-zbuf) sv-192 s2-0 (the-as rgba sv-208) #f (the-as rgba -1)) - (add-debug-line #t (bucket-id debug-no-zbuf) s2-0 s1-0 (the-as rgba sv-208) #f (the-as rgba -1)) - (add-debug-line #t (bucket-id debug-no-zbuf) s1-0 s0-0 (the-as rgba sv-208) #f (the-as rgba -1)) - (let ((t9-7 add-debug-line) - (a0-19 #t) - (a1-13 68) - (t1-5 #f) - (t2-3 -1)) - (t9-7 a0-19 (the-as bucket-id a1-13) s0-0 sv-192 (the-as rgba sv-208) t1-5 (the-as rgba t2-3))))))) + (v1-20 (new 'stack-no-clear 'vector)) + (sv-192 (new 'stack-no-clear 'vector)) + (s2-0 (new 'stack-no-clear 'vector)) + (s1-0 (new 'stack-no-clear 'vector)) + (s0-0 (new 'stack-no-clear 'vector)) + (sv-208 (the-as uint #x80808080))) + (set! (-> a0-15 quad) (-> a1-4 center quad)) + (set! (-> v1-20 quad) (-> a1-4 radius quad)) + (set! (-> sv-192 w) 1.0) + (set! (-> s2-0 w) 1.0) + (set! (-> s1-0 w) 1.0) + (set! (-> s0-0 w) 1.0) + (set! (-> sv-192 x) (+ (-> a0-15 x) (-> v1-20 x))) + (set! (-> sv-192 y) (+ (-> a0-15 y) (-> v1-20 y))) + (set! (-> sv-192 z) (+ (-> a0-15 z) (-> v1-20 z))) + (set! (-> s2-0 x) (+ (-> a0-15 x) (-> v1-20 x))) + (set! (-> s2-0 y) (+ (-> a0-15 y) (-> v1-20 y))) + (set! (-> s2-0 z) (- (-> a0-15 z) (-> v1-20 z))) + (set! (-> s1-0 x) (- (-> a0-15 x) (-> v1-20 x))) + (set! (-> s1-0 y) (+ (-> a0-15 y) (-> v1-20 y))) + (set! (-> s1-0 z) (- (-> a0-15 z) (-> v1-20 z))) + (set! (-> s0-0 x) (- (-> a0-15 x) (-> v1-20 x))) + (set! (-> s0-0 y) (+ (-> a0-15 y) (-> v1-20 y))) + (set! (-> s0-0 z) (+ (-> a0-15 z) (-> v1-20 z))) + (add-debug-line #t (bucket-id debug-no-zbuf) sv-192 s2-0 (the-as rgba sv-208) #f (the-as rgba -1)) + (add-debug-line #t (bucket-id debug-no-zbuf) s2-0 s1-0 (the-as rgba sv-208) #f (the-as rgba -1)) + (add-debug-line #t (bucket-id debug-no-zbuf) s1-0 s0-0 (the-as rgba sv-208) #f (the-as rgba -1)) + (add-debug-line #t (bucket-id debug-no-zbuf) s0-0 sv-192 (the-as rgba sv-208) #f (the-as rgba -1))))) (when (logtest? (-> this flags) (nav-control-flags navcf3)) (dotimes (s3-2 (-> s5-0 poly-count)) (let ((s2-1 (-> s5-0 poly s3-2))) @@ -1138,18 +1094,15 @@ (else (new 'static 'rgba :g #x80 :b #xff :a #x80)))) (when (logtest? (-> this flags) (nav-control-flags navcf4)) (let ((s1-1 add-debug-text-3d) - (s0-1 #t)) - (set! sv-224 68) - (set! sv-240 format) - (let ((a0-23 (clear *temp-string*)) - (a1-15 "~D") - (a2-13 (-> s2-1 id))) - (sv-240 a0-23 a1-15 a2-13)) - (set! sv-256 *temp-string*) - (let ((a3-10 (tri-centroid-world s5-0 s2-1 s4-0)) - (t0-8 8) - (t1-6 #f)) - (s1-1 s0-1 (the-as bucket-id sv-224) sv-256 a3-10 (the-as font-color t0-8) (the-as vector2h t1-6)))))))) + (s0-1 #t) + (sv-224 68)) + (format (clear *temp-string*) "~D" (-> s2-1 id)) + (s1-1 s0-1 + (the-as bucket-id sv-224) + *temp-string* + (tri-centroid-world s5-0 s2-1 s4-0) + (font-color cyan) + (the-as vector2h #f))))))) (when (logtest? (-> this flags) (nav-control-flags navcf5)) (if (-> this next-poly) (debug-draw-poly s5-0 (-> this next-poly) *color-cyan*)) (if (-> this target-poly) (debug-draw-poly s5-0 (-> this target-poly) *color-yellow*)) @@ -1159,17 +1112,10 @@ (let ((s2-2 (-> s5-0 static-sphere s3-3))) (add-debug-sphere #t (bucket-id debug) (the-as vector s2-2) (-> s2-2 trans w) *color-blue*) (let ((s1-2 add-debug-text-3d) - (s0-2 #t)) - (set! sv-272 68) - (set! sv-288 format) - (let ((a0-32 (clear *temp-string*)) - (a1-22 "~D") - (a2-20 s3-3)) - (sv-288 a0-32 a1-22 a2-20)) - (let ((a2-21 *temp-string*) - (t0-10 8) - (t1-7 #f)) - (s1-2 s0-2 (the-as bucket-id sv-272) a2-21 (the-as vector s2-2) (the-as font-color t0-10) (the-as vector2h t1-7)))))))) + (s0-2 #t) + (sv-272 68)) + (format (clear *temp-string*) "~D" s3-3) + (s1-2 s0-2 (the-as bucket-id sv-272) *temp-string* (the-as vector s2-2) (font-color cyan) (the-as vector2h #f))))))) (when (logtest? (-> this flags) (nav-control-flags navcf6)) (when (and (-> this portal 0) (-> this portal 1)) (let ((v1-80 (-> s5-0 origin)) @@ -1201,7 +1147,7 @@ (when (logtest? (-> this flags) (nav-control-flags navcf7)) (add-debug-sphere #t (bucket-id debug-no-zbuf) - (the-as vector (-> this shape root-prim prim-core)) + (-> this shape root-prim prim-core world-sphere) (-> this shape nav-radius) (new 'static 'rgba :g #xff :b #xff :a #x20)) (dotimes (s3-4 (-> this num-spheres)) @@ -1215,29 +1161,29 @@ 0)) (none)) -(defmethod mem-usage ((this nav-mesh) (arg0 memory-usage-block) (arg1 int)) - (set! (-> arg0 length) (max 46 (-> arg0 length))) - (set! (-> arg0 data 45 name) "nav-mesh") - (+! (-> arg0 data 45 count) 1) - (let ((v1-6 (asize-of this))) (+! (-> arg0 data 45 used) v1-6) (+! (-> arg0 data 45 total) (logand -16 (+ v1-6 15)))) - (set! (-> arg0 length) (max 46 (-> arg0 length))) - (set! (-> arg0 data 45 name) "nav-mesh") - (+! (-> arg0 data 45 count) 1) +(defmethod mem-usage ((this nav-mesh) (usage memory-usage-block) (flags int)) + (set! (-> usage length) (max 46 (-> usage length))) + (set! (-> usage data 45 name) "nav-mesh") + (+! (-> usage data 45 count) 1) + (let ((v1-6 (asize-of this))) (+! (-> usage data 45 used) v1-6) (+! (-> usage data 45 total) (logand -16 (+ v1-6 15)))) + (set! (-> usage length) (max 46 (-> usage length))) + (set! (-> usage data 45 name) "nav-mesh") + (+! (-> usage data 45 count) 1) (let ((v1-16 (* (-> this vertex-count) 16))) - (+! (-> arg0 data 45 used) v1-16) - (+! (-> arg0 data 45 total) (logand -16 (+ v1-16 15)))) - (set! (-> arg0 length) (max 46 (-> arg0 length))) - (set! (-> arg0 data 45 name) "nav-mesh") - (+! (-> arg0 data 45 count) 1) + (+! (-> usage data 45 used) v1-16) + (+! (-> usage data 45 total) (logand -16 (+ v1-16 15)))) + (set! (-> usage length) (max 46 (-> usage length))) + (set! (-> usage data 45 name) "nav-mesh") + (+! (-> usage data 45 count) 1) (let ((v1-26 (* (-> this poly-count) 8))) - (+! (-> arg0 data 45 used) v1-26) - (+! (-> arg0 data 45 total) (logand -16 (+ v1-26 15)))) - (set! (-> arg0 length) (max 46 (-> arg0 length))) - (set! (-> arg0 data 45 name) "nav-mesh") - (+! (-> arg0 data 45 count) 1) + (+! (-> usage data 45 used) v1-26) + (+! (-> usage data 45 total) (logand -16 (+ v1-26 15)))) + (set! (-> usage length) (max 46 (-> usage length))) + (set! (-> usage data 45 name) "nav-mesh") + (+! (-> usage data 45 count) 1) (let ((v1-38 (/ (* (* (-> this poly-count) (-> this poly-count)) 2) 8))) - (+! (-> arg0 data 45 used) v1-38) - (+! (-> arg0 data 45 total) (logand -16 (+ v1-38 15)))) + (+! (-> usage data 45 used) v1-38) + (+! (-> usage data 45 total) (logand -16 (+ v1-38 15)))) (the-as nav-mesh 0)) (defmethod set-current-poly! ((this nav-control) (arg0 nav-poly)) @@ -1263,11 +1209,10 @@ (defun add-nav-sphere ((arg0 nav-control) (arg1 vector)) (when (< (-> arg0 num-spheres) (-> arg0 max-spheres)) - (let* ((s4-0 (-> arg0 sphere (-> arg0 num-spheres))) - (f1-0 (vector-vector-xz-distance-squared arg1 (-> arg0 shape trans))) - (f0-1 (+ (-> arg1 w) (-> arg0 shape nav-radius))) - (f2-2 (+ 40960.0 f0-1))) - (when (< f1-0 (* f2-2 f2-2)) + (let ((s4-0 (-> arg0 sphere (-> arg0 num-spheres))) + (f1-0 (vector-vector-xz-distance-squared arg1 (-> arg0 shape trans))) + (f0-1 (+ (-> arg1 w) (-> arg0 shape nav-radius)))) + (when (< f1-0 (square (+ 40960.0 f0-1))) (vector-! (the-as vector s4-0) arg1 (-> arg0 mesh origin)) (set! (-> s4-0 w) f0-1) (+! (-> arg0 num-spheres) 1)))) @@ -1281,11 +1226,10 @@ (let ((s4-0 arg0) (s3-0 arg2)) (when (< (-> s4-0 num-spheres) (-> s4-0 max-spheres)) - (let* ((s2-0 (-> s4-0 sphere (-> s4-0 num-spheres))) - (f1-0 (vector-vector-xz-distance-squared s3-0 (-> s4-0 shape trans))) - (f0-2 (+ (-> s3-0 w) (-> s4-0 shape nav-radius))) - (f2-2 (+ 40960.0 f0-2))) - (when (< f1-0 (* f2-2 f2-2)) + (let ((s2-0 (-> s4-0 sphere (-> s4-0 num-spheres))) + (f1-0 (vector-vector-xz-distance-squared s3-0 (-> s4-0 shape trans))) + (f0-2 (+ (-> s3-0 w) (-> s4-0 shape nav-radius)))) + (when (< f1-0 (square (+ 40960.0 f0-2))) (vector-! (the-as vector s2-0) s3-0 (-> s4-0 mesh origin)) (set! (-> s2-0 w) f0-2) (+! (-> s4-0 num-spheres) 1))))) @@ -1293,11 +1237,10 @@ (when (logtest? (-> arg1 nav-flags) (nav-flags navf1)) (let ((s5-1 (-> arg1 process nav extra-nav-sphere))) (when (< (-> arg0 num-spheres) (-> arg0 max-spheres)) - (let* ((s4-1 (-> arg0 sphere (-> arg0 num-spheres))) - (f1-1 (vector-vector-xz-distance-squared s5-1 (-> arg0 shape trans))) - (f0-4 (+ (-> s5-1 w) (-> arg0 shape nav-radius))) - (f2-7 (+ 40960.0 f0-4))) - (when (< f1-1 (* f2-7 f2-7)) + (let ((s4-1 (-> arg0 sphere (-> arg0 num-spheres))) + (f1-1 (vector-vector-xz-distance-squared s5-1 (-> arg0 shape trans))) + (f0-4 (+ (-> s5-1 w) (-> arg0 shape nav-radius)))) + (when (< f1-1 (square (+ 40960.0 f0-4))) (vector-! (the-as vector s4-1) s5-1 (-> arg0 mesh origin)) (set! (-> s4-1 w) f0-4) (+! (-> arg0 num-spheres) 1))))) @@ -1305,14 +1248,6 @@ (none)) (defmethod nav-control-method-28 ((this nav-control) (arg0 collide-kind)) - (local-vars - (sv-32 nav-control) - (sv-48 sphere) - (sv-64 sphere) - (sv-80 nav-control) - (sv-96 sphere) - (sv-112 vector) - (sv-128 sphere)) (set! (-> this num-spheres) 0) (let ((s4-0 (-> this mesh user-list)) (s3-0 (new 'stack-no-clear 'vector))) @@ -1326,25 +1261,23 @@ (when (logtest? (-> s1-0 nav-flags) (nav-flags navf0)) (set! (-> s0-0 quad) (-> s1-0 root-prim prim-core world-sphere quad)) (set! (-> s0-0 w) (-> s1-0 nav-radius)) - (set! sv-32 s2-0) - (when (< (-> sv-32 num-spheres) (-> sv-32 max-spheres)) - (set! sv-48 (-> sv-32 sphere (-> sv-32 num-spheres))) - (let* ((f1-0 (vector-vector-xz-distance-squared s0-0 (-> sv-32 shape trans))) - (f0-2 (+ (-> s0-0 w) (-> sv-32 shape nav-radius))) - (f2-2 (+ 40960.0 f0-2))) - (when (< f1-0 (* f2-2 f2-2)) - (vector-! (the-as vector sv-48) s0-0 (-> sv-32 mesh origin)) - (set! (-> sv-48 w) f0-2) - (+! (-> sv-32 num-spheres) 1)))) + (let ((sv-32 s2-0)) + (when (< (-> sv-32 num-spheres) (-> sv-32 max-spheres)) + (let ((sv-48 (-> sv-32 sphere (-> sv-32 num-spheres))) + (f1-0 (vector-vector-xz-distance-squared s0-0 (-> sv-32 shape trans))) + (f0-2 (+ (-> s0-0 w) (-> sv-32 shape nav-radius)))) + (when (< f1-0 (square (+ 40960.0 f0-2))) + (vector-! (the-as vector sv-48) s0-0 (-> sv-32 mesh origin)) + (set! (-> sv-48 w) f0-2) + (+! (-> sv-32 num-spheres) 1))))) 0)) (when (logtest? (-> s1-0 nav-flags) (nav-flags navf1)) (let ((s1-1 (-> s1-0 process nav extra-nav-sphere))) (when (< (-> s2-0 num-spheres) (-> s2-0 max-spheres)) - (let* ((s0-1 (-> s2-0 sphere (-> s2-0 num-spheres))) - (f1-1 (vector-vector-xz-distance-squared s1-1 (-> s2-0 shape trans))) - (f0-4 (+ (-> s1-1 w) (-> s2-0 shape nav-radius))) - (f2-7 (+ 40960.0 f0-4))) - (when (< f1-1 (* f2-7 f2-7)) + (let ((s0-1 (-> s2-0 sphere (-> s2-0 num-spheres))) + (f1-1 (vector-vector-xz-distance-squared s1-1 (-> s2-0 shape trans))) + (f0-4 (+ (-> s1-1 w) (-> s2-0 shape nav-radius)))) + (when (< f1-1 (square (+ 40960.0 f0-4))) (vector-! (the-as vector s0-1) s1-1 (-> s2-0 mesh origin)) (set! (-> s0-1 w) f0-4) (+! (-> s2-0 num-spheres) 1))))) @@ -1354,11 +1287,10 @@ (let ((s1-2 this) (s0-2 (-> this mesh static-sphere s2-1))) (when (< (-> s1-2 num-spheres) (-> s1-2 max-spheres)) - (set! sv-64 (-> s1-2 sphere (-> s1-2 num-spheres))) - (let* ((f1-2 (vector-vector-xz-distance-squared (the-as vector s0-2) (-> s1-2 shape trans))) - (f0-6 (+ (-> s0-2 trans w) (-> s1-2 shape nav-radius))) - (f2-12 (+ 40960.0 f0-6))) - (when (< f1-2 (* f2-12 f2-12)) + (let ((sv-64 (-> s1-2 sphere (-> s1-2 num-spheres))) + (f1-2 (vector-vector-xz-distance-squared (the-as vector s0-2) (-> s1-2 shape trans))) + (f0-6 (+ (-> s0-2 trans w) (-> s1-2 shape nav-radius)))) + (when (< f1-2 (square (+ 40960.0 f0-6))) (vector-! (the-as vector sv-64) (the-as vector s0-2) (-> s1-2 mesh origin)) (set! (-> sv-64 w) f0-6) (+! (-> s1-2 num-spheres) 1))))) @@ -1369,33 +1301,27 @@ (let ((s0-3 (the-as collide-shape (-> (the-as connection v1-71) param3)))) (when (not (or (= s0-3 (-> this shape)) (not (logtest? arg0 (-> s0-3 root-prim prim-core collide-as))))) (let ((s1-3 this)) - (set! sv-112 s3-0) - (when (logtest? (-> s0-3 nav-flags) (nav-flags navf0)) - (set! (-> sv-112 quad) (-> s0-3 root-prim prim-core world-sphere quad)) - (set! (-> sv-112 w) (-> s0-3 nav-radius)) - (set! sv-80 s1-3) - (when (< (-> sv-80 num-spheres) (-> sv-80 max-spheres)) - (set! sv-96 (-> sv-80 sphere (-> sv-80 num-spheres))) - (let* ((f1-3 (vector-vector-xz-distance-squared sv-112 (-> sv-80 shape trans))) - (f0-9 (+ (-> sv-112 w) (-> sv-80 shape nav-radius))) - (f2-17 (+ 40960.0 f0-9))) - ;; HACK: added a NaN check here. it seems like some enemies have bogus positions (maybe on their first frame?) - ;; and in these cases we shouldn't bother including them in the mesh. - (when (and (< f1-3 (* f2-17 f2-17)) (not (is-nan? (-> sv-112 x)))) - (let ((v1-94 sv-96) - (a0-47 (-> sv-80 mesh origin))) - (vector-! (the-as vector v1-94) sv-112 a0-47)) - (set! (-> sv-96 w) f0-9) - (+! (-> sv-80 num-spheres) 1)))) - 0) + (let ((sv-112 s3-0)) + (when (logtest? (-> s0-3 nav-flags) (nav-flags navf0)) + (set! (-> sv-112 quad) (-> s0-3 root-prim prim-core world-sphere quad)) + (set! (-> sv-112 w) (-> s0-3 nav-radius)) + (let ((sv-80 s1-3)) + (when (< (-> sv-80 num-spheres) (-> sv-80 max-spheres)) + (let ((sv-96 (-> sv-80 sphere (-> sv-80 num-spheres))) + (f1-3 (vector-vector-xz-distance-squared sv-112 (-> sv-80 shape trans))) + (f0-9 (+ (-> sv-112 w) (-> sv-80 shape nav-radius)))) + (when (< f1-3 (square (+ 40960.0 f0-9))) + (vector-! (the-as vector sv-96) sv-112 (-> sv-80 mesh origin)) + (set! (-> sv-96 w) f0-9) + (+! (-> sv-80 num-spheres) 1))))) + 0)) (when (logtest? (-> s0-3 nav-flags) (nav-flags navf1)) (let ((s0-4 (-> s0-3 process nav extra-nav-sphere))) (when (< (-> s1-3 num-spheres) (-> s1-3 max-spheres)) - (set! sv-128 (-> s1-3 sphere (-> s1-3 num-spheres))) - (let* ((f1-4 (vector-vector-xz-distance-squared s0-4 (-> s1-3 shape trans))) - (f0-11 (+ (-> s0-4 w) (-> s1-3 shape nav-radius))) - (f2-22 (+ 40960.0 f0-11))) - (when (< f1-4 (* f2-22 f2-22)) + (let ((sv-128 (-> s1-3 sphere (-> s1-3 num-spheres))) + (f1-4 (vector-vector-xz-distance-squared s0-4 (-> s1-3 shape trans))) + (f0-11 (+ (-> s0-4 w) (-> s1-3 shape nav-radius)))) + (when (< f1-4 (square (+ 40960.0 f0-11))) (vector-! (the-as vector sv-128) s0-4 (-> s1-3 mesh origin)) (set! (-> sv-128 w) f0-11) (+! (-> s1-3 num-spheres) 1))))) @@ -1464,10 +1390,7 @@ (let ((f0-4 (-> arg1 w)) (f1-1 (vector-dot s3-0 s2-0))) (if (< f1-1 f0-4) (set! f0-4 f1-1)) - (let* ((f2-0 f1-1) - (f2-2 (* f2-0 f2-0)) - (f3-0 f0-4) - (f2-4 (sqrtf (- f2-2 (* f3-0 f3-0)))) + (let* ((f2-4 (sqrtf (- (square f1-1) (square f0-4)))) (f3-4 (/ 1.0 f1-1)) (f1-3 (* f2-4 f3-4)) (f30-0 (* f0-4 f3-4)) @@ -1502,7 +1425,7 @@ (* (-> v1-0 data (logand a2-3 1)) (- 1.0 (vector-dot arg0 arg1))))) (defmethod nav-control-method-32 ((this nav-control) (arg0 vector) (arg1 vector) (arg2 vector) (arg3 vector) (arg4 float)) - (local-vars (v0-3 symbol) (v1-38 int) (a0-29 int) (a3-7 int) (sv-208 sphere)) + (local-vars (v0-3 symbol) (v1-38 int) (a0-29 int) (a3-7 int)) (let ((gp-0 (new 'stack-no-clear 'nav-control-cfs-work))) (set! (-> gp-0 in-dir quad) (-> arg2 quad)) (set! (-> gp-0 in-dir y) 0.0) @@ -1519,15 +1442,12 @@ (set! (-> gp-0 i-inside-sphere) -1) (set! (-> gp-0 inside-sphere-dist) 0.0) (dotimes (s0-0 (-> this num-spheres)) - (set! sv-208 (-> this sphere s0-0)) - (set! (-> gp-0 dist2) (vector-vector-xz-distance-squared arg1 sv-208)) - (let ((f0-10 (-> gp-0 dist2)) - (f1-0 (-> sv-208 w))) - (when (< f0-10 (* f1-0 f1-0)) - (vector-! (the-as vector (-> gp-0 temp-dir)) arg1 (the-as vector sv-208)) + (let ((sv-208 (-> this sphere s0-0))) + (set! (-> gp-0 dist2) (vector-vector-xz-distance-squared arg1 sv-208)) + (when (< (-> gp-0 dist2) (square (-> sv-208 w))) + (vector-! (-> gp-0 temp-dir 0) arg1 (the-as vector sv-208)) (set! (-> gp-0 temp-dir 0 y) 0.0) - (if (< 0.0 (vector-dot (the-as vector (-> gp-0 temp-dir)) (-> gp-0 in-dir))) - (+! (-> gp-0 initial-ignore-mask) (ash 1 s0-0))) + (if (< 0.0 (vector-dot (-> gp-0 temp-dir 0) (-> gp-0 in-dir))) (+! (-> gp-0 initial-ignore-mask) (ash 1 s0-0))) (set! (-> gp-0 inside-dist) (- (-> sv-208 w) (sqrtf (-> gp-0 dist2)))) (when (< (-> gp-0 inside-sphere-dist) (-> gp-0 inside-dist)) (set! (-> gp-0 i-inside-sphere) s0-0) @@ -1546,7 +1466,7 @@ (the-as none 0)) (+! (-> gp-0 initial-ignore-mask) (ash 1 (-> gp-0 i-first-sphere))) (let ((a1-9 (-> this sphere (-> gp-0 i-first-sphere)))) - (circle-tangent-directions arg1 a1-9 (the-as vector (-> gp-0 temp-dir)) (-> gp-0 temp-dir 1))) + (circle-tangent-directions arg1 a1-9 (-> gp-0 temp-dir 0) (-> gp-0 temp-dir 1))) (dotimes (v1-31 2) (let ((a0-28 (vector-dot (-> gp-0 right-dir) (-> gp-0 temp-dir v1-31)))) (shift-arith-right-32 a0-29 a0-28 31)) (let ((a0-30 (logand a0-29 1)) @@ -1562,7 +1482,7 @@ (b! #t cfg-31 :delay (nop!)) (label cfg-22) (+! (-> gp-0 ignore-mask) (ash 1 v1-38)) - (circle-tangent-directions arg1 (-> this sphere v1-38) (the-as vector (-> gp-0 temp-dir)) (-> gp-0 temp-dir 1)) + (circle-tangent-directions arg1 (-> this sphere v1-38) (-> gp-0 temp-dir 0) (-> gp-0 temp-dir 1)) (set! (-> gp-0 dir-update) #f) (dotimes (v1-40 2) (let ((f0-23 (-> gp-0 sign)) @@ -1597,14 +1517,14 @@ (set! (-> gp-0 away-dir z) (sin (-> gp-0 rand-angle)))) (vector-normalize! (-> gp-0 away-dir) 1.0) (let ((f30-2 (/ (-> gp-0 inside-sphere-dist) (-> s2-1 w)))) - (vector-lerp! (the-as vector (-> gp-0 best-dir)) (the-as vector (-> gp-0 best-dir)) (-> gp-0 away-dir) f30-2) + (vector-lerp! (-> gp-0 best-dir 0) (-> gp-0 best-dir 0) (-> gp-0 away-dir) f30-2) (vector-lerp! (-> gp-0 best-dir 1) (-> gp-0 best-dir 1) (-> gp-0 away-dir) f30-2))) - (vector-normalize! (the-as vector (-> gp-0 best-dir)) 1.0) + (vector-normalize! (-> gp-0 best-dir 0) 1.0) (vector-normalize! (-> gp-0 best-dir 1) 1.0)) - (let ((f30-3 (vector-dot (-> gp-0 in-dir) (the-as vector (-> gp-0 best-dir)))) + (let ((f30-3 (vector-dot (-> gp-0 in-dir) (-> gp-0 best-dir 0))) (f28-0 (vector-dot (-> gp-0 in-dir) (-> gp-0 best-dir 1)))) (when (< (fmax f30-3 f28-0) (cos 1820.4445)) - (set! f30-3 (vector-dot arg3 (the-as vector (-> gp-0 best-dir)))) + (set! f30-3 (vector-dot arg3 (-> gp-0 best-dir 0))) (set! f28-0 (vector-dot arg3 (-> gp-0 best-dir 1)))) (vector-float*! arg0 (-> gp-0 best-dir (if (< f28-0 f30-3) 0 1)) (-> gp-0 travel-len)))) 0 @@ -1663,30 +1583,26 @@ (define *test-ray-dest-pos* (new 'static 'vector :x -722887.7 :y 9532.475 :z -958862.25 :w 1.0)) (defmethod nav-control-method-19 ((this nav-control) (arg0 vector) (arg1 collide-shape-moving) (arg2 vector) (arg3 float)) - (local-vars (sv-48 float)) - (let ((f30-0 (* arg3 (seconds-per-frame))) - (s0-0 arg1) - (s1-0 arg2) - (s2-0 deg-diff)) - (set! sv-48 (y-angle s0-0)) - (let* ((a1-1 (vector-y-angle (vector-! (new 'stack-no-clear 'vector) s1-0 (-> s0-0 trans)))) - (f28-0 (s2-0 sv-48 a1-1))) - (cond - ((or (vector= arg2 (-> this target-pos)) (< (fabs f28-0) 364.0889)) + (let* ((f30-0 (* arg3 (seconds-per-frame))) + (s0-0 arg1) + (s1-0 arg2) + (f28-0 (deg-diff (y-angle s0-0) (vector-y-angle (vector-! (new 'stack-no-clear 'vector) s1-0 (-> s0-0 trans)))))) + (cond + ((or (vector= arg2 (-> this target-pos)) (< (fabs f28-0) 364.0889)) + (logior! (-> this flags) (nav-control-flags navcf21)) + (set! (-> arg0 quad) (-> arg2 quad))) + (else + (let ((s2-1 (vector-z-quaternion! (new 'stack-no-clear 'vector) (-> arg1 quat)))) + (vector-rotate-y! s2-1 s2-1 (fmax (fmin f28-0 f30-0) (- f30-0))) + (vector-normalize! s2-1 819.2) + (logclear! (-> this flags) (nav-control-flags navcf21)) + (vector+! arg0 (-> arg1 trans) s2-1)) + (when (or (not (nav-control-method-16 this arg0)) + (logtest? (nav-control-flags navcf17) (-> this flags)) + (not (logtest? (-> this flags) (nav-control-flags navcf10)))) (logior! (-> this flags) (nav-control-flags navcf21)) - (set! (-> arg0 quad) (-> arg2 quad))) - (else - (let ((s2-1 (vector-z-quaternion! (new 'stack-no-clear 'vector) (-> arg1 quat)))) - (vector-rotate-y! s2-1 s2-1 (fmax (fmin f28-0 f30-0) (- f30-0))) - (vector-normalize! s2-1 819.2) - (logclear! (-> this flags) (nav-control-flags navcf21)) - (vector+! arg0 (-> arg1 trans) s2-1)) - (when (or (not (nav-control-method-16 this arg0)) - (logtest? (nav-control-flags navcf17) (-> this flags)) - (not (logtest? (-> this flags) (nav-control-flags navcf10)))) - (logior! (-> this flags) (nav-control-flags navcf21)) - (vector-! (-> this travel) arg2 (-> arg1 trans)) - (set! (-> arg0 quad) (-> arg2 quad))))))) + (vector-! (-> this travel) arg2 (-> arg1 trans)) + (set! (-> arg0 quad) (-> arg2 quad)))))) (none)) (defmethod nav-control-method-16 ((this nav-control) (arg0 vector)) @@ -1749,60 +1665,57 @@ (none)) (defmethod nav-mesh-method-16 ((this nav-mesh) (arg0 vector) (arg1 nav-poly) (arg2 vector) (arg3 symbol) (arg4 float) (arg5 clip-travel-vector-to-mesh-return-info)) - (local-vars (v1-10 symbol) (sv-96 symbol) (sv-112 int) (sv-128 int)) + (local-vars (v1-10 symbol)) (when arg5 (set! (-> arg5 found-boundary) #f) (set! (-> arg5 gap-poly) #f)) (let ((s0-0 (new 'stack-no-clear 'nav-ray))) - (set! sv-96 (the-as symbol #f)) - (set! sv-112 0) - (set! (-> s0-0 current-poly) arg1) - (set! (-> s0-0 current-pos quad) (-> arg0 quad)) - (vector+! (-> s0-0 dest-pos) arg0 arg2) - (until sv-96 - (set! sv-128 0) - (init-ray s0-0) - (until v1-10 - (set! sv-128 (+ sv-128 1)) - (move-along-nav-ray! this s0-0) - (set! v1-10 (or (>= sv-128 15) (or (>= (-> s0-0 len) (fmax 20480.0 arg4)) (-> s0-0 terminated))))) - (cond - ((and (-> s0-0 hit-boundary) (and (< (-> s0-0 len) arg4) (!= (-> s0-0 last-edge) -1) (< sv-112 1))) - (set! sv-112 (+ sv-112 1)) - (let* ((v1-22 (-> this vertex (-> s0-0 current-poly vertex (-> *edge-vert0-table* (-> s0-0 last-edge))))) - (a0-15 (-> this vertex (-> s0-0 current-poly vertex (-> *edge-vert1-table* (-> s0-0 last-edge))))) - (f2-1 (- (-> v1-22 z) (-> a0-15 z))) - (f3-0 (- (-> a0-15 x) (-> v1-22 x))) - (f1-5 (-> arg2 x)) - (f0-4 (-> arg2 z)) - (f4-0 f2-1) - (f4-2 (* f4-0 f4-0)) - (f5-0 f3-0) - (f4-4 (sqrtf (+ f4-2 (* f5-0 f5-0)))) - (f4-6 (/ 1.0 f4-4)) - (f2-2 (* f2-1 f4-6)) - (f3-1 (* f3-0 f4-6))) - (when arg5 - (set! (-> arg5 found-boundary) #t) - (vector+! (-> arg5 intersection) (-> s0-0 current-pos) (-> this origin)) - (set! (-> arg5 boundary-normal x) f2-2) - (set! (-> arg5 boundary-normal y) 0.0) - (set! (-> arg5 boundary-normal z) f3-1) - (set! (-> arg5 poly) (-> s0-0 current-poly)) - (set! (-> arg5 edge) (-> s0-0 last-edge)) - (vector+! (-> arg5 vert-0) (the-as vector v1-22) (-> this origin)) - (vector+! (-> arg5 vert-1) (the-as vector a0-15) (-> this origin))) - (set! (-> s0-0 dest-pos quad) (-> s0-0 current-pos quad)) - (cond - (arg3 - (let* ((f4-9 (* 1.01 (+ (* f2-2 f1-5) (* f3-1 f0-4)))) - (f1-6 (- f1-5 (* f2-2 f4-9))) - (f0-5 (- f0-4 (* f3-1 f4-9)))) - (+! (-> s0-0 dest-pos x) f1-6) - (+! (-> s0-0 dest-pos z) f0-5))) - (else (set! sv-96 #t) sv-96)))) - ((-> s0-0 hit-gap) (if arg5 (set! (-> arg5 gap-poly) (-> s0-0 next-poly))) (set! sv-96 #t) sv-96) - (else (set! sv-96 #t) sv-96))) + (let ((sv-96 (the-as symbol #f)) + (sv-112 0)) + (set! (-> s0-0 current-poly) arg1) + (set! (-> s0-0 current-pos quad) (-> arg0 quad)) + (vector+! (-> s0-0 dest-pos) arg0 arg2) + (until sv-96 + (let ((sv-128 0)) + (init-ray s0-0) + (until v1-10 + (+! sv-128 1) + (move-along-nav-ray! this s0-0) + (set! v1-10 (or (>= sv-128 15) (or (>= (-> s0-0 len) (fmax 20480.0 arg4)) (-> s0-0 terminated)))))) + (cond + ((and (-> s0-0 hit-boundary) (and (< (-> s0-0 len) arg4) (!= (-> s0-0 last-edge) -1) (< sv-112 1))) + (+! sv-112 1) + (let* ((v1-22 (-> this vertex (-> s0-0 current-poly vertex (-> *edge-vert0-table* (-> s0-0 last-edge))))) + (a0-15 (-> this vertex (-> s0-0 current-poly vertex (-> *edge-vert1-table* (-> s0-0 last-edge))))) + (f2-1 (- (-> v1-22 z) (-> a0-15 z))) + (f3-0 (- (-> a0-15 x) (-> v1-22 x))) + (f1-5 (-> arg2 x)) + (f0-4 (-> arg2 z)) + (f4-4 (sqrtf (+ (square f2-1) (square f3-0)))) + (f4-6 (/ 1.0 f4-4)) + (f2-2 (* f2-1 f4-6)) + (f3-1 (* f3-0 f4-6))) + (when arg5 + (set! (-> arg5 found-boundary) #t) + (vector+! (-> arg5 intersection) (-> s0-0 current-pos) (-> this origin)) + (set! (-> arg5 boundary-normal x) f2-2) + (set! (-> arg5 boundary-normal y) 0.0) + (set! (-> arg5 boundary-normal z) f3-1) + (set! (-> arg5 poly) (-> s0-0 current-poly)) + (set! (-> arg5 edge) (-> s0-0 last-edge)) + (vector+! (-> arg5 vert-0) (the-as vector v1-22) (-> this origin)) + (vector+! (-> arg5 vert-1) (the-as vector a0-15) (-> this origin))) + (set! (-> s0-0 dest-pos quad) (-> s0-0 current-pos quad)) + (cond + (arg3 + (let* ((f4-9 (* 1.01 (+ (* f2-2 f1-5) (* f3-1 f0-4)))) + (f1-6 (- f1-5 (* f2-2 f4-9))) + (f0-5 (- f0-4 (* f3-1 f4-9)))) + (+! (-> s0-0 dest-pos x) f1-6) + (+! (-> s0-0 dest-pos z) f0-5))) + (else (set! sv-96 #t) sv-96)))) + ((-> s0-0 hit-gap) (if arg5 (set! (-> arg5 gap-poly) (-> s0-0 next-poly))) (set! sv-96 #t) sv-96) + (else (set! sv-96 #t) sv-96)))) (vector-! arg2 (-> s0-0 current-pos) arg0)) 0 0 @@ -1828,10 +1741,7 @@ (when (not v0-2) (let* ((f0-3 (- (-> arg2 x) (-> arg1 x))) (f1-2 (- (-> arg2 z) (-> arg1 z))) - (f2-1 f0-3) - (f2-3 (* f2-1 f2-1)) - (f3-0 f1-2) - (f2-5 (sqrtf (+ f2-3 (* f3-0 f3-0)))) + (f2-5 (sqrtf (+ (square f0-3) (square f1-2)))) (f3-3 f2-5) (f3-5 (/ 1.0 f3-3)) (f4-2 (* f3-5 (- f1-2))) @@ -1839,7 +1749,7 @@ (f3-7 (- (-> arg0 x) (-> arg1 x))) (f6-2 (- (-> arg0 z) (-> arg1 z)))) (when (>= arg3 (fabs (+ (* f3-7 f4-2) (* f6-2 f5-0)))) - (let ((f0-5 (+ (* f3-7 f0-3) (* f6-2 f1-2)))) (set! v0-2 (and (>= f0-5 0.0) (>= (* f2-5 f2-5) f0-5))))))) + (let ((f0-5 (+ (* f3-7 f0-3) (* f6-2 f1-2)))) (set! v0-2 (and (>= f0-5 0.0) (>= (square f2-5) f0-5))))))) v0-2)) (defun choose-travel-portal-vertex ((arg0 nav-mesh) (arg1 nav-route-portal) (arg2 nav-poly) (arg3 vector)) @@ -1849,10 +1759,7 @@ (let ((s2-0 (new 'stack-no-clear 'nav-route-portal)) (s1-0 0)) (let* ((s0-0 #f) - (f2-2 f0-1) - (f2-4 (* f2-2 f2-2)) - (f3-0 f1-2) - (f2-6 (sqrtf (+ f2-4 (* f3-0 f3-0)))) + (f2-6 (sqrtf (+ (square f0-1) (square f1-2)))) (f2-8 (/ 1.0 f2-6)) (f30-0 (* f0-1 f2-8)) (f28-0 (* f1-2 f2-8)) @@ -1885,75 +1792,74 @@ s1-0))) (defmethod nav-control-method-13 ((this nav-control) (arg0 vector) (arg1 vector)) - (local-vars (sv-80 vector) (sv-84 vector) (sv-88 nav-poly) (sv-92 vector) (sv-96 nav-route-portal) (sv-100 symbol)) - (set! sv-80 (new 'stack-no-clear 'vector)) - (set! sv-84 (new 'stack-no-clear 'vector)) - (set! sv-88 (-> this current-poly)) - (set! sv-92 (new 'stack-no-clear 'vector)) - (set! sv-96 (new 'stack-no-clear 'nav-route-portal)) - (set! sv-100 (the-as symbol #f)) - (vector-! sv-80 (-> this shape trans) (-> this mesh origin)) - (set! (-> sv-84 quad) (-> sv-80 quad)) - (let ((s4-0 (new 'stack-no-clear 'vector))) - (vector-! s4-0 arg0 (-> this mesh origin)) - (set! (-> this target-poly) (find-poly (-> this mesh) s4-0 (-> this nearest-y-threshold) (&-> this flags))) - (if (not (-> this target-poly)) (set! (-> this target-poly) (-> this current-poly))) - (project-point-into-tri-2d (-> this mesh) (-> this target-poly) sv-92 s4-0)) - (vector-! (-> this travel) sv-92 sv-80) - (setup-portal (-> this mesh) (-> this current-poly) (-> this target-poly) sv-96) - (cond - ((not (-> sv-96 next-poly)) (set! (-> this next-poly) #f) (set! (-> this portal 0) #f) (set! (-> this portal 1) #f)) - (else - (set! (-> this next-poly) (-> sv-96 next-poly)) - (set! (-> this portal 0) (the-as nav-route-portal (-> sv-96 vertex 0))) - (set! (-> this portal 1) (the-as nav-route-portal (-> sv-96 vertex 1))) - (set! sv-100 #t) - (while (and sv-100 - (-> sv-96 next-poly) - (test-xz-point-on-line-segment? sv-80 (-> sv-96 vertex 0) (-> sv-96 vertex 1) 409.59998)) - (when #t - #t - (vector-segment-distance-point! sv-80 (-> sv-96 vertex 0) (-> sv-96 vertex 1) sv-84) - (vector-! (-> this travel) sv-92 sv-84) - 0) - (cond - ((logtest? (-> sv-96 next-poly pat) 1) - (vector-segment-distance-point! sv-80 (-> sv-96 vertex 0) (-> sv-96 vertex 1) sv-92) - (vector-! (-> this travel) sv-92 sv-84) - (set! (-> this next-poly) (-> sv-96 next-poly)) - (set! sv-100 (the-as symbol #f))) - ((begin - (set! sv-88 (-> sv-96 next-poly)) - (setup-portal (-> this mesh) (-> sv-96 next-poly) (-> this target-poly) sv-96)) - (set! (-> this next-poly) (-> sv-96 next-poly)) - (set! (-> this portal 0) (the-as nav-route-portal (-> sv-96 vertex 0))) - (set! (-> this portal 1) (the-as nav-route-portal (-> sv-96 vertex 1))) - 0) - (else - (set! (-> this next-poly) #f) - (set! (-> this portal 0) #f) - (set! (-> this portal 1) #f) - (set! sv-100 (the-as symbol #f))))))) - (when sv-100 - (when (not (ray-ccw-line-segment-intersection? sv-84 - (-> this travel) - (the-as vector (-> this portal 0)) - (the-as vector (-> this portal 1)))) - (let ((a0-18 (choose-travel-portal-vertex (-> this mesh) sv-96 (-> this target-poly) sv-92))) - (vector-! (-> this travel) (the-as vector (-> sv-96 vertex a0-18)) sv-84)))) - (nav-control-method-33 this (-> this travel) sv-84 (-> this travel) arg1 40960.0) - (let ((s5-1 (new 'stack-no-clear 'clip-travel-vector-to-mesh-return-info))) - (nav-mesh-method-16 (-> this mesh) - sv-84 - sv-88 - (-> this travel) - (not (logtest? (-> this flags) (nav-control-flags navcf12))) - 204.8 - s5-1) - (if (-> s5-1 gap-poly) (set! (-> this next-poly) (-> s5-1 gap-poly)))) - (let ((v1-82 (new 'stack-no-clear 'vector))) - (vector-! v1-82 sv-84 sv-80) - (vector+! (-> this travel) (-> this travel) v1-82)) + (let ((sv-80 (new 'stack-no-clear 'vector)) + (sv-84 (new 'stack-no-clear 'vector))) + (let ((sv-88 (-> this current-poly))) + (let ((sv-92 (new 'stack-no-clear 'vector)) + (sv-96 (new 'stack-no-clear 'nav-route-portal)) + (sv-100 (the-as symbol #f))) + (vector-! sv-80 (-> this shape trans) (-> this mesh origin)) + (set! (-> sv-84 quad) (-> sv-80 quad)) + (let ((s4-0 (new 'stack-no-clear 'vector))) + (vector-! s4-0 arg0 (-> this mesh origin)) + (set! (-> this target-poly) (find-poly (-> this mesh) s4-0 (-> this nearest-y-threshold) (&-> this flags))) + (if (not (-> this target-poly)) (set! (-> this target-poly) (-> this current-poly))) + (project-point-into-tri-2d (-> this mesh) (-> this target-poly) sv-92 s4-0)) + (vector-! (-> this travel) sv-92 sv-80) + (setup-portal (-> this mesh) (-> this current-poly) (-> this target-poly) sv-96) + (cond + ((not (-> sv-96 next-poly)) (set! (-> this next-poly) #f) (set! (-> this portal 0) #f) (set! (-> this portal 1) #f)) + (else + (set! (-> this next-poly) (-> sv-96 next-poly)) + (set! (-> this portal 0) (the-as nav-route-portal (-> sv-96 vertex 0))) + (set! (-> this portal 1) (the-as nav-route-portal (-> sv-96 vertex 1))) + (set! sv-100 #t) + (while (and sv-100 + (-> sv-96 next-poly) + (test-xz-point-on-line-segment? sv-80 (-> sv-96 vertex 0) (-> sv-96 vertex 1) 409.59998)) + (when #t + #t + (vector-segment-distance-point! sv-80 (-> sv-96 vertex 0) (-> sv-96 vertex 1) sv-84) + (vector-! (-> this travel) sv-92 sv-84) + 0) + (cond + ((logtest? (-> sv-96 next-poly pat) 1) + (vector-segment-distance-point! sv-80 (-> sv-96 vertex 0) (-> sv-96 vertex 1) sv-92) + (vector-! (-> this travel) sv-92 sv-84) + (set! (-> this next-poly) (-> sv-96 next-poly)) + (set! sv-100 (the-as symbol #f))) + ((begin + (set! sv-88 (-> sv-96 next-poly)) + (setup-portal (-> this mesh) (-> sv-96 next-poly) (-> this target-poly) sv-96)) + (set! (-> this next-poly) (-> sv-96 next-poly)) + (set! (-> this portal 0) (the-as nav-route-portal (-> sv-96 vertex 0))) + (set! (-> this portal 1) (the-as nav-route-portal (-> sv-96 vertex 1))) + 0) + (else + (set! (-> this next-poly) #f) + (set! (-> this portal 0) #f) + (set! (-> this portal 1) #f) + (set! sv-100 (the-as symbol #f))))))) + (when sv-100 + (when (not (ray-ccw-line-segment-intersection? sv-84 + (-> this travel) + (the-as vector (-> this portal 0)) + (the-as vector (-> this portal 1)))) + (let ((a0-18 (choose-travel-portal-vertex (-> this mesh) sv-96 (-> this target-poly) sv-92))) + (vector-! (-> this travel) (the-as vector (-> sv-96 vertex a0-18)) sv-84))))) + (nav-control-method-33 this (-> this travel) sv-84 (-> this travel) arg1 40960.0) + (let ((s5-1 (new 'stack-no-clear 'clip-travel-vector-to-mesh-return-info))) + (nav-mesh-method-16 (-> this mesh) + sv-84 + sv-88 + (-> this travel) + (not (logtest? (-> this flags) (nav-control-flags navcf12))) + 204.8 + s5-1) + (if (-> s5-1 gap-poly) (set! (-> this next-poly) (-> s5-1 gap-poly))))) + (let ((v1-82 (new 'stack-no-clear 'vector))) + (vector-! v1-82 sv-84 sv-80) + (vector+! (-> this travel) (-> this travel) v1-82))) (set! (-> this travel y) 0.0) (-> this travel)) diff --git a/goal_src/jak1/engine/physics/trajectory.gc b/goal_src/jak1/engine/physics/trajectory.gc index 6633ea608a..e067951b67 100644 --- a/goal_src/jak1/engine/physics/trajectory.gc +++ b/goal_src/jak1/engine/physics/trajectory.gc @@ -46,10 +46,8 @@ (none)) (defmethod setup-from-to-y-vel! ((this trajectory) (from vector) (to vector) (y-vel float) (grav float)) - "Set up a trajectory with the given initial y velocity." - (let* ((f0-0 y-vel) - (f1-3 (- (* f0-0 f0-0) (* 2.0 (- (-> from y) (-> to y)) grav))) - (f0-3 900.0)) + (let ((f1-3 (- (square y-vel) (* 2.0 (- (-> from y) (-> to y)) grav))) + (f0-3 900.0)) (when (>= f1-3 0.0) (let ((f0-4 (sqrtf f1-3))) (set! f0-3 (fmax (/ (- (- y-vel) f0-4) grav) (/ (+ (- y-vel) f0-4) grav))))) (setup-from-to-duration! this from to f0-3 grav)) diff --git a/goal_src/jak1/engine/target/collide-reaction-target.gc b/goal_src/jak1/engine/target/collide-reaction-target.gc index f2f4957b0b..a070c760c4 100644 --- a/goal_src/jak1/engine/target/collide-reaction-target.gc +++ b/goal_src/jak1/engine/target/collide-reaction-target.gc @@ -20,242 +20,221 @@ (arg3 (pointer uint32)) (arg4 (pointer uint64)) (arg5 (pointer symbol))) - (local-vars - (sv-16 vector) - (sv-20 (pointer uint32)) - (sv-24 (pointer uint64)) - (sv-28 (pointer symbol)) - (sv-32 uint) - (sv-40 uint) - (sv-48 symbol) - (sv-52 vector) - (sv-56 vector) - (sv-160 vector) - (sv-164 collide-tri-result) - (sv-208 vector) - (sv-212 vector) - (sv-272 vector) - (sv-276 vector)) - (set! sv-16 arg2) - (set! sv-20 arg3) - (set! sv-24 arg4) - (set! sv-28 arg5) - (set! sv-32 (-> arg3 0)) - (set! sv-40 (-> arg4 0)) - (set! sv-48 (-> arg5 0)) - (set! sv-52 (-> arg0 unknown-vector60)) - (set! sv-56 (vector-cross! (-> arg0 unknown-vector-coverage-2) (-> arg0 poly-normal) sv-16)) - (vector-normalize! sv-56 1.0) - (if (>= (fabs (vector-dot (-> arg0 dynam gravity-normal) sv-56)) 0.866) (set! sv-32 (logior sv-32 512))) - (vector-cross! sv-52 sv-16 sv-56) - (if (< 0.0 (vector-dot (-> arg0 dynam gravity-normal) sv-52)) (vector-negate! sv-52 sv-52)) - (vector-normalize! sv-52 1.0) - (set! sv-160 (vector-flatten! (-> arg0 unknown-vector-coverage-3) sv-52 (-> arg0 dynam gravity-normal))) - (set! sv-164 (new 'stack 'collide-tri-result)) - (vector-normalize! sv-160 1.0) - (if (< (vector-dot sv-160 sv-16) 0.0) (vector-negate! sv-160 sv-160)) - (set! (-> arg0 unknown-float-coverage-0) 4095996000.0) - (set! (-> arg0 unknown-float-coverage-2) 4095996000.0) - (set! sv-208 (vector+float*! (new 'stack-no-clear 'vector) (-> arg1 best-tri intersect) sv-160 2867.2)) - (set! sv-212 (vector-normalize-copy! (new 'stack-no-clear 'vector) (-> arg0 dynam gravity-normal) -20480.0)) - (vector+float*! sv-212 sv-212 sv-160 4096.0) - (when (>= (probe-using-line-sphere *collide-cache* - sv-208 - sv-212 - 409.6 - (-> arg1 best-from-prim collide-with) - sv-164 - (new 'static 'pat-surface :noentity #x1)) - 0.0) - (set! (-> arg0 unknown-float-coverage-0) - (vector-dot (-> arg0 dynam gravity-normal) - (vector-! (new 'stack-no-clear 'vector) (-> arg1 best-tri intersect) (-> sv-164 intersect)))) - (set! (-> arg0 unknown-float-coverage-1) (the-as float (-> sv-164 pat))) - (set! (-> arg0 unknown-vector-coverage-0 quad) (-> sv-164 normal quad)) - 0) - (set! sv-272 - (vector+float*! (new 'stack-no-clear 'vector) (-> arg1 best-tri intersect) (-> arg0 dynam gravity-normal) 819.2)) - (set! sv-276 (vector-normalize-copy! (new 'stack-no-clear 'vector) (-> arg0 dynam gravity-normal) -20480.0)) - (vector+float*! sv-272 sv-272 sv-160 -819.2) - (vector+float*! sv-276 sv-276 sv-160 -4096.0) - (when (>= (probe-using-line-sphere *collide-cache* - sv-272 - sv-276 - 409.6 - (-> arg1 best-from-prim collide-with) - sv-164 - (new 'static 'pat-surface :noentity #x1)) - 0.0) - (set! (-> arg0 unknown-float-coverage-2) (vector-vector-distance sv-272 (-> sv-164 intersect))) - (set! (-> arg0 unknown-u32-coverage-0) (the-as uint (-> sv-164 pat))) - (set! (-> arg0 unknown-vector-coverage-1 quad) (-> sv-164 normal quad)) - 0) - (when (and (not (logtest? sv-32 512)) - (and (or (< (* 1.25 (-> arg1 best-from-prim local-sphere w)) (-> arg0 unknown-float-coverage-0)) - (= (shr (shl (the-as int (-> arg0 unknown-float-coverage-1)) 58) 61) 1)) - (and (< (-> arg0 unknown-float-coverage-2) (* 2.0 (-> arg1 best-from-prim local-sphere w))) - (zero? (shr (shl (-> arg0 unknown-u32-coverage-0) 58) 61))))) - (set! sv-32 (logior sv-32 128)) - (set! (-> arg0 unknown-dword-coverage) (the-as int (current-time))) - (set! sv-40 (logior sv-40 128)) - (set-time! (-> arg0 unknown-dword21)) - (let ((f30-0 (vector-dot sv-52 (-> arg0 unknown-vector22))) - (f0-21 (if (logtest? sv-32 2) (cos (- 16384.0 (acos (-> arg0 coverage)))) (-> arg0 coverage))) - (f1-11 (vector-dot (-> arg0 dynam gravity-normal) - (vector-! (new 'stack-no-clear 'vector) (-> arg0 trans) (-> arg1 best-tri intersect))))) - (if (or (not (logtest? sv-32 32)) (< 0.5 f0-21)) (set! sv-48 (the-as symbol #f))) - (when (and (or (and (< f0-21 0.95) (>= f30-0 0.0)) - (and (logtest? sv-32 32) (< f0-21 0.3)) - (< f1-11 (/ (-> arg1 best-from-prim local-sphere w) -4))) - (>= (vector-dot sv-52 sv-16) -0.000001)) - (set! (-> arg0 surf) *edge-surface*) - (set! sv-32 (logior sv-32 1024)) - (set! sv-48 (the-as symbol #f)) - (when (logtest? sv-32 32) - (set! sv-48 #t) - (set! sv-32 (logior sv-32 4096)))))) - (if (< (-> arg0 surface-angle) 0.0) (set! sv-48 #t)) - (when sv-48 - (cond - ((and (or (= (-> arg0 poly-pat mode) (pat-mode ground)) - (and (logtest? sv-32 8) - (>= (* 1.25 (-> arg1 best-from-prim local-sphere w)) (-> arg0 unknown-float-coverage-0)) - (zero? (shr (shl (the-as int (-> arg0 unknown-float-coverage-1)) 58) 61)) - (< 0.3 (fabs (-> arg0 surface-angle))))) - (not (logtest? sv-32 128))) - (set! sv-32 (logior sv-32 64)) - (set! sv-40 (logior sv-40 128)) - (set-time! (-> arg0 unknown-dword21)) - (set! sv-48 (the-as symbol #f))) - (#t (set! sv-32 (logior sv-32 64)) (set! sv-40 (logior sv-40 128)) (set-time! (-> arg0 unknown-dword21))))) - (set! (-> sv-24 0) sv-40) - (set! (-> sv-20 0) sv-32) - (set! (-> sv-28 0) sv-48) + (let ((sv-16 arg2) + (sv-20 arg3) + (sv-24 arg4) + (sv-28 arg5) + (sv-32 (-> arg3 0)) + (sv-40 (-> arg4 0)) + (sv-48 (-> arg5 0))) + (let ((sv-52 (-> arg0 unknown-vector60))) + (let ((sv-56 (vector-cross! (-> arg0 unknown-vector-coverage-2) (-> arg0 poly-normal) sv-16))) + (vector-normalize! sv-56 1.0) + (if (>= (fabs (vector-dot (-> arg0 dynam gravity-normal) sv-56)) 0.866) (logior! sv-32 512)) + (vector-cross! sv-52 sv-16 sv-56)) + (if (< 0.0 (vector-dot (-> arg0 dynam gravity-normal) sv-52)) (vector-negate! sv-52 sv-52)) + (vector-normalize! sv-52 1.0) + (let ((sv-160 (vector-flatten! (-> arg0 unknown-vector-coverage-3) sv-52 (-> arg0 dynam gravity-normal))) + (sv-164 (new 'stack 'collide-tri-result))) + (vector-normalize! sv-160 1.0) + (if (< (vector-dot sv-160 sv-16) 0.0) (vector-negate! sv-160 sv-160)) + (set! (-> arg0 unknown-float-coverage-0) 4095996000.0) + (set! (-> arg0 unknown-float-coverage-2) 4095996000.0) + (let ((sv-208 (vector+float*! (new 'stack-no-clear 'vector) (-> arg1 best-tri intersect) sv-160 2867.2)) + (sv-212 (vector-normalize-copy! (new 'stack-no-clear 'vector) (-> arg0 dynam gravity-normal) -20480.0))) + (vector+float*! sv-212 sv-212 sv-160 4096.0) + (when (>= (probe-using-line-sphere *collide-cache* + sv-208 + sv-212 + 409.6 + (-> arg1 best-from-prim collide-with) + sv-164 + (new 'static 'pat-surface :noentity #x1)) + 0.0) + (set! (-> arg0 unknown-float-coverage-0) + (vector-dot (-> arg0 dynam gravity-normal) + (vector-! (new 'stack-no-clear 'vector) (-> arg1 best-tri intersect) (-> sv-164 intersect)))) + (set! (-> arg0 unknown-float-coverage-1) (the-as float (-> sv-164 pat))) + (set! (-> arg0 unknown-vector-coverage-0 quad) (-> sv-164 normal quad)) + 0)) + (let ((sv-272 (vector+float*! (new 'stack-no-clear 'vector) (-> arg1 best-tri intersect) (-> arg0 dynam gravity-normal) 819.2)) + (sv-276 (vector-normalize-copy! (new 'stack-no-clear 'vector) (-> arg0 dynam gravity-normal) -20480.0))) + (vector+float*! sv-272 sv-272 sv-160 -819.2) + (vector+float*! sv-276 sv-276 sv-160 -4096.0) + (when (>= (probe-using-line-sphere *collide-cache* + sv-272 + sv-276 + 409.6 + (-> arg1 best-from-prim collide-with) + sv-164 + (new 'static 'pat-surface :noentity #x1)) + 0.0) + (set! (-> arg0 unknown-float-coverage-2) (vector-vector-distance sv-272 (-> sv-164 intersect))) + (set! (-> arg0 unknown-u32-coverage-0) (the-as uint (-> sv-164 pat))) + (set! (-> arg0 unknown-vector-coverage-1 quad) (-> sv-164 normal quad)) + 0))) + (when (and (not (logtest? sv-32 512)) + (and (or (< (* 1.25 (-> arg1 best-from-prim local-sphere w)) (-> arg0 unknown-float-coverage-0)) + (= (shr (shl (the-as int (-> arg0 unknown-float-coverage-1)) 58) 61) 1)) + (and (< (-> arg0 unknown-float-coverage-2) (* 2.0 (-> arg1 best-from-prim local-sphere w))) + (zero? (shr (shl (-> arg0 unknown-u32-coverage-0) 58) 61))))) + (logior! sv-32 128) + (set! (-> arg0 unknown-dword-coverage) (the-as int (current-time))) + (logior! sv-40 128) + (set-time! (-> arg0 unknown-dword21)) + (let ((f30-0 (vector-dot sv-52 (-> arg0 unknown-vector22))) + (f0-21 (if (logtest? sv-32 2) (cos (- 16384.0 (acos (-> arg0 coverage)))) (-> arg0 coverage))) + (f1-11 (vector-dot (-> arg0 dynam gravity-normal) + (vector-! (new 'stack-no-clear 'vector) (-> arg0 trans) (-> arg1 best-tri intersect))))) + (if (or (not (logtest? sv-32 32)) (< 0.5 f0-21)) (set! sv-48 (the-as symbol #f))) + (when (and (or (and (< f0-21 0.95) (>= f30-0 0.0)) + (and (logtest? sv-32 32) (< f0-21 0.3)) + (< f1-11 (/ (-> arg1 best-from-prim local-sphere w) -4))) + (>= (vector-dot sv-52 sv-16) -0.000001)) + (set! (-> arg0 surf) *edge-surface*) + (logior! sv-32 1024) + (set! sv-48 (the-as symbol #f)) + (when (logtest? sv-32 32) + (set! sv-48 #t) + (logior! sv-32 4096)))))) + (if (< (-> arg0 surface-angle) 0.0) (set! sv-48 #t)) + (when sv-48 + (cond + ((and (or (= (-> arg0 poly-pat mode) (pat-mode ground)) + (and (logtest? sv-32 8) + (>= (* 1.25 (-> arg1 best-from-prim local-sphere w)) (-> arg0 unknown-float-coverage-0)) + (zero? (shr (shl (the-as int (-> arg0 unknown-float-coverage-1)) 58) 61)) + (< 0.3 (fabs (-> arg0 surface-angle))))) + (not (logtest? sv-32 128))) + (logior! sv-32 64) + (logior! sv-40 128) + (set-time! (-> arg0 unknown-dword21)) + (set! sv-48 (the-as symbol #f))) + (#t (logior! sv-32 64) (logior! sv-40 128) (set-time! (-> arg0 unknown-dword21))))) + (set! (-> sv-24 0) sv-40) + (set! (-> sv-20 0) sv-32) + (set! (-> sv-28 0) sv-48)) (the-as uint 0)) (defun target-collision-reaction ((arg0 control-info) (arg1 collide-shape-intersect) (arg2 vector) (arg3 vector)) - (local-vars (sv-80 vector) (sv-84 vector) (sv-88 matrix) (sv-96 int) (sv-104 int) (sv-160 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 vector a0-1 quad) (the-as uint128 0))) - (set! sv-88 v1-2)) - (set! sv-96 0) - (set! sv-104 0) - (set! (-> sv-88 vector 0 quad) (-> arg3 quad)) - (set! (-> sv-88 vector 1 quad) (-> arg3 quad)) - (let ((a1-3 (new 'stack-no-clear 'vector))) - (vector-float*! a1-3 (-> arg1 move-vec) (-> arg1 best-u)) - (move-by-vector! arg0 a1-3)) - (set-and-handle-pat! arg0 (-> arg1 best-tri pat)) - (if (= (-> arg0 poly-pat mode) (pat-mode wall)) (set! sv-104 (logior sv-104 1))) - (if (logtest? (-> arg0 unknown-surface00 flags) (surface-flags jump)) (set! sv-104 (logior sv-104 32))) - (let ((v1-23 (new 'stack-no-clear 'vector))) - (set! (-> v1-23 quad) (-> arg1 best-from-prim prim-core world-sphere quad)) - (vector-! sv-80 v1-23 (-> arg1 best-tri intersect))) - (vector-normalize! sv-80 1.0) - (set! (-> arg0 coverage) (vector-dot sv-80 (-> arg1 best-tri normal))) - (when (< (-> arg0 coverage) 0.0) - (set! (-> arg0 coverage) 0.0) - (vector-flatten! sv-80 sv-80 (-> arg1 best-tri normal)) - (vector-normalize! sv-80 1.0)) - (if (< (-> arg0 coverage) 0.9999) (set! sv-104 (logior sv-104 24))) - (let ((v1-33 (-> sv-80 quad))) (set! (-> sv-84 quad) v1-33)) - (if (= (-> arg1 best-u) 0.0) (move-by-vector! arg0 (vector-normalize-copy! (new-stack-vector0) sv-84 3.0))) - (set! (-> arg0 poly-normal quad) (-> arg1 best-tri normal quad)) - (collide-shape-moving-angle-set! arg0 sv-84 (the-as vector (-> sv-88 vector))) - (if (< (-> arg0 poly-angle) -0.2) (set! sv-96 (logior sv-96 16))) - (if (< (-> arg0 poly-angle) 0.0) (set! sv-96 (logior sv-96 #x4000))) - (set! sv-160 (< (fabs (-> arg0 surface-angle)) (-> *pat-mode-info* (-> arg0 cur-pat mode) wall-angle))) - (if (and sv-160 (and (= (-> arg0 unknown-surface00 mode) 'dive) (< 0.2 (fabs (-> arg0 surface-angle))))) - (set! sv-160 (the-as symbol #f))) - (if sv-160 (set! sv-104 (logior sv-104 2))) - (if (logtest? sv-104 8) - (target-collision-low-coverage arg0 - arg1 - sv-84 - (the-as (pointer uint32) (& sv-104)) - (the-as (pointer uint64) (& sv-96)) - (& sv-160))) - (when (not (logtest? (-> arg0 prev-status) (cshape-moving-flags onsurf))) - (set! (-> arg0 ground-impact-vel) (- (vector-dot (-> arg0 transv) (-> arg0 dynam gravity-normal)))) - (set! sv-96 (logior sv-96 2048)) - (when (not sv-160) - (let ((f30-0 (- 1.0 (-> arg0 surf impact-fric)))) - (when (< f30-0 1.0) - (let ((s3-1 (new-stack-vector0)) - (f28-0 (vector-dot (-> arg0 dynam gravity-normal) (the-as vector (-> sv-88 vector))))) - 0.0 - (vector-! s3-1 (the-as vector (-> sv-88 vector)) (vector-float*! s3-1 (-> arg0 dynam gravity-normal) f28-0)) - (let* ((f0-20 (vector-length s3-1)) - (f1-9 f0-20)) - (if (< f28-0 0.0) (set! f28-0 (* f28-0 f30-0))) - (vector+! (the-as vector (-> sv-88 vector)) - (vector-float*! (the-as vector (-> sv-88 vector)) (-> arg0 dynam gravity-normal) f28-0) - (vector-float*! s3-1 s3-1 (/ f0-20 f1-9))))))))) - (set! sv-96 (logior sv-96 4)) - (cond - ((-> arg1 best-to-prim) - (set! sv-96 (logior sv-96 32)) - (set! (-> arg0 unknown-vector72 quad) (-> arg1 best-tri intersect quad)) - (set! (-> arg0 unknown-vector73 quad) (-> arg0 poly-normal quad)) - (set! (-> arg0 unknown-handle00) (process->handle (-> arg1 best-to-prim cshape process)))) - ((= (-> arg0 poly-pat material) (pat-material waterbottom))) - (else (set! sv-96 (logior sv-96 4096)))) - (cond - (sv-160 - (set! sv-104 (logior sv-104 4)) - (set! sv-96 (logior sv-96 8)) - (set! (-> arg0 cur-pat mode) 1) - (set! (-> arg0 unknown-vector70 quad) (-> arg1 best-tri intersect quad)) - (set! (-> arg0 unknown-vector71 quad) (-> arg0 poly-normal quad)) - (set! (-> arg0 unknown-vector121 quad) (-> sv-84 quad)) - (set! (-> arg0 wall-pat) (-> arg1 best-tri pat)) - (-> arg0 history-data (logand (+ (-> arg0 unknown-halfword00) 127) 127)) - (cond - (#f - (sound-play "cursor-options") - (set! sv-104 (logior sv-104 8192)) - (vector-reflect-flat-above! arg2 (the-as vector (-> sv-88 vector)) sv-84)) - (else (vector-reflect-flat! arg2 (the-as vector (-> sv-88 vector)) sv-84))) - (cond - ((not (and (>= (-> arg1 best-from-prim local-sphere w) - (vector-dot (-> arg0 ground-poly-normal) - (vector-! (new 'stack-no-clear 'vector) (-> arg1 best-tri intersect) (-> arg0 ground-touch-point)))) - (and (< 0.0 (vector-dot (-> arg0 ground-poly-normal) arg2)) - (not (time-elapsed? (-> arg0 unknown-dword10) (seconds 0.3))) - (not (logtest? sv-104 32)))))) - (else - (set! sv-104 (logior sv-104 256)) - (set! sv-104 (logand -65 sv-104)) - (let ((s3-4 (vector-cross! (new 'stack-no-clear 'vector) (-> arg0 poly-normal) (-> arg0 ground-poly-normal)))) - (vector-normalize! s3-4 1.0) - (vector-float*! arg2 s3-4 (vector-dot (the-as vector (-> sv-88 vector)) s3-4))) - (vector+! arg2 arg2 (-> arg0 poly-normal))))) - (else - (set! sv-96 (logior sv-96 1)) - (set! (-> arg0 cur-pat mode) 0) - (if (= (-> arg1 best-from-prim prim-id) 6) (set! (-> arg0 local-normal quad) (-> sv-84 quad))) - (vector-reflect-flat! arg2 (the-as vector (-> sv-88 vector)) sv-84) - (vector+! arg2 arg2 sv-84) - (set! (-> arg0 ground-touch-point w) 0.0) - (when (not (or (logtest? sv-104 15) (nonzero? (-> arg0 poly-pat event)))) - (set! sv-96 (logior sv-96 2)) - (set! (-> arg0 ground-poly-normal quad) (-> arg0 poly-normal quad)) - (set! (-> arg0 unknown-vector53 quad) (-> sv-84 quad)) - (set! (-> arg0 unknown-float60) (vector-dot sv-84 (-> arg0 dynam gravity-normal))) - (set-time! (-> arg0 unknown-dword10)) - (set! (-> arg0 ground-pat) (-> arg0 poly-pat)) - (set! (-> arg0 ground-touch-point quad) (-> arg1 best-tri intersect quad)) - (set! (-> arg0 unknown-vector55 quad) (-> arg1 best-from-prim prim-core world-sphere quad)) - (set! sv-104 (logior sv-104 2048)) - (if (= (-> arg0 poly-pat material) (pat-material waterbottom)) (set! sv-96 (logior sv-96 1024)))))) - (logior! (-> arg0 status) sv-96) - (set! (-> arg0 reaction-flag) (the-as cshape-reaction-flags sv-104)) - (update! (-> arg0 history-data (-> arg0 unknown-halfword00)) arg0 (-> arg1 best-tri intersect) (-> sv-88 vector 1) arg2) - (set! (-> arg0 unknown-halfword00) (logand (+ (-> arg0 unknown-halfword00) 1) 127)) - (the-as cshape-moving-flags sv-96)) + (let ((sv-88 v1-2) + (sv-96 0)) + (let ((sv-104 0)) + (set! (-> sv-88 vector 0 quad) (-> arg3 quad)) + (set! (-> sv-88 vector 1 quad) (-> arg3 quad)) + (let ((a1-3 (new 'stack-no-clear 'vector))) + (vector-float*! a1-3 (-> arg1 move-vec) (-> arg1 best-u)) + (move-by-vector! arg0 a1-3)) + (set-and-handle-pat! arg0 (-> arg1 best-tri pat)) + (if (= (-> arg0 poly-pat mode) (pat-mode wall)) (logior! sv-104 1)) + (if (logtest? (-> arg0 unknown-surface00 flags) (surface-flags jump)) (logior! sv-104 32)) + (let ((v1-23 (new 'stack-no-clear 'vector))) + (set! (-> v1-23 quad) (-> arg1 best-from-prim prim-core world-sphere quad)) + (vector-! sv-80 v1-23 (-> arg1 best-tri intersect))) + (vector-normalize! sv-80 1.0) + (set! (-> arg0 coverage) (vector-dot sv-80 (-> arg1 best-tri normal))) + (when (< (-> arg0 coverage) 0.0) + (set! (-> arg0 coverage) 0.0) + (vector-flatten! sv-80 sv-80 (-> arg1 best-tri normal)) + (vector-normalize! sv-80 1.0)) + (if (< (-> arg0 coverage) 0.9999) (logior! sv-104 24)) + (set! (-> sv-84 quad) (-> sv-80 quad)) + (if (= (-> arg1 best-u) 0.0) (move-by-vector! arg0 (vector-normalize-copy! (new-stack-vector0) sv-84 3.0))) + (set! (-> arg0 poly-normal quad) (-> arg1 best-tri normal quad)) + (collide-shape-moving-angle-set! arg0 sv-84 (-> sv-88 vector 0)) + (if (< (-> arg0 poly-angle) -0.2) (logior! sv-96 16)) + (if (< (-> arg0 poly-angle) 0.0) (logior! sv-96 #x4000)) + (let ((sv-160 (< (fabs (-> arg0 surface-angle)) (-> *pat-mode-info* (-> arg0 cur-pat mode) wall-angle)))) + (if (and sv-160 (and (= (-> arg0 unknown-surface00 mode) 'dive) (< 0.2 (fabs (-> arg0 surface-angle))))) + (set! sv-160 (the-as symbol #f))) + (if sv-160 (logior! sv-104 2)) + (if (logtest? sv-104 8) + (target-collision-low-coverage arg0 + arg1 + sv-84 + (the-as (pointer uint32) (& sv-104)) + (the-as (pointer uint64) (& sv-96)) + (& sv-160))) + (when (not (logtest? (-> arg0 prev-status) (cshape-moving-flags onsurf))) + (set! (-> arg0 ground-impact-vel) (- (vector-dot (-> arg0 transv) (-> arg0 dynam gravity-normal)))) + (logior! sv-96 2048) + (when (not sv-160) + (let ((f30-0 (- 1.0 (-> arg0 surf impact-fric)))) + (when (< f30-0 1.0) + (let ((s3-1 (new-stack-vector0)) + (f28-0 (vector-dot (-> arg0 dynam gravity-normal) (-> sv-88 vector 0)))) + 0.0 + (vector-! s3-1 (-> sv-88 vector 0) (vector-float*! s3-1 (-> arg0 dynam gravity-normal) f28-0)) + (let* ((f0-20 (vector-length s3-1)) + (f1-9 f0-20)) + (if (< f28-0 0.0) (set! f28-0 (* f28-0 f30-0))) + (vector+! (-> sv-88 vector 0) + (vector-float*! (-> sv-88 vector 0) (-> arg0 dynam gravity-normal) f28-0) + (vector-float*! s3-1 s3-1 (/ f0-20 f1-9))))))))) + (logior! sv-96 4) + (cond + ((-> arg1 best-to-prim) + (logior! sv-96 32) + (set! (-> arg0 unknown-vector72 quad) (-> arg1 best-tri intersect quad)) + (set! (-> arg0 unknown-vector73 quad) (-> arg0 poly-normal quad)) + (set! (-> arg0 unknown-handle00) (process->handle (-> arg1 best-to-prim cshape process)))) + ((= (-> arg0 poly-pat material) (pat-material waterbottom))) + (else (logior! sv-96 4096))) + (cond + (sv-160 + (logior! sv-104 4) + (logior! sv-96 8) + (set! (-> arg0 cur-pat mode) 1) + (set! (-> arg0 unknown-vector70 quad) (-> arg1 best-tri intersect quad)) + (set! (-> arg0 unknown-vector71 quad) (-> arg0 poly-normal quad)) + (set! (-> arg0 unknown-vector121 quad) (-> sv-84 quad)) + (set! (-> arg0 wall-pat) (-> arg1 best-tri pat)) + (-> arg0 history-data (logand (+ (-> arg0 unknown-halfword00) 127) 127)) + (cond + (#f (sound-play "cursor-options") (logior! sv-104 8192) (vector-reflect-flat-above! arg2 (-> sv-88 vector 0) sv-84)) + (else (vector-reflect-flat! arg2 (-> sv-88 vector 0) sv-84))) + (cond + ((not (and (>= (-> arg1 best-from-prim local-sphere w) + (vector-dot (-> arg0 ground-poly-normal) + (vector-! (new 'stack-no-clear 'vector) (-> arg1 best-tri intersect) (-> arg0 ground-touch-point)))) + (and (< 0.0 (vector-dot (-> arg0 ground-poly-normal) arg2)) + (not (time-elapsed? (-> arg0 unknown-dword10) (seconds 0.3))) + (not (logtest? sv-104 32)))))) + (else + (logior! sv-104 256) + (logand! sv-104 -65) + (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 + (logior! sv-96 1) + (set! (-> arg0 cur-pat mode) 0) + (if (= (-> arg1 best-from-prim prim-id) 6) (set! (-> arg0 local-normal quad) (-> sv-84 quad))) + (vector-reflect-flat! arg2 (-> sv-88 vector 0) sv-84) + (vector+! arg2 arg2 sv-84) + (set! (-> arg0 ground-touch-point w) 0.0) + (when (not (or (logtest? sv-104 15) (nonzero? (-> arg0 poly-pat event)))) + (logior! sv-96 2) + (set! (-> arg0 ground-poly-normal quad) (-> arg0 poly-normal quad)) + (set! (-> arg0 unknown-vector53 quad) (-> sv-84 quad)) + (set! (-> arg0 unknown-float60) (vector-dot sv-84 (-> arg0 dynam gravity-normal))) + (set-time! (-> arg0 unknown-dword10)) + (set! (-> arg0 ground-pat) (-> arg0 poly-pat)) + (set! (-> arg0 ground-touch-point quad) (-> arg1 best-tri intersect quad)) + (set! (-> arg0 unknown-vector55 quad) (-> arg1 best-from-prim prim-core world-sphere quad)) + (logior! sv-104 2048) + (if (= (-> arg0 poly-pat material) (pat-material waterbottom)) (logior! sv-96 1024)))))) + (logior! (-> arg0 status) sv-96) + (set! (-> arg0 reaction-flag) (the-as cshape-reaction-flags sv-104))) + (update! (-> arg0 history-data (-> arg0 unknown-halfword00)) arg0 (-> arg1 best-tri intersect) (-> sv-88 vector 1) arg2) + (set! (-> arg0 unknown-halfword00) (logand (+ (-> arg0 unknown-halfword00) 1) 127)) + (the-as cshape-moving-flags sv-96)))) (defun target-collision-no-reaction ((arg0 control-info) (arg1 collide-shape-intersect) (arg2 vector) (arg3 vector)) (if (= (-> arg0 unknown-surface00 mode) 'air) (logior! (-> arg0 reaction-flag) (cshape-reaction-flags csrf05))) diff --git a/goal_src/jak1/engine/target/logic-target.gc b/goal_src/jak1/engine/target/logic-target.gc index 3af68683f5..4caafc2456 100644 --- a/goal_src/jak1/engine/target/logic-target.gc +++ b/goal_src/jak1/engine/target/logic-target.gc @@ -159,37 +159,25 @@ ;; WARN: Stack slot load at 160 mismatch: defined as size 4, got size 16 ;; WARN: Stack slot load at 176 mismatch: defined as size 4, got size 16 (defun-debug target-print-stats ((arg0 target) (arg1 symbol)) - (local-vars - (sv-64 string) - (sv-80 string) - (sv-96 string) - (sv-112 string) - (sv-128 string) - (sv-144 string) - (sv-160 float) - (sv-176 float)) (when (and *display-ground-stats* arg0) - (let ((s4-0 format) - (s3-0 arg1) - (s2-0 "~0kpoly:~6X mode:~-8S material:~-10S event:~S~%") - (s1-0 (-> arg0 control poly-pat)) - (s0-0 (pat-mode->string (-> arg0 control poly-pat)))) - (set! sv-64 (pat-material->string (-> arg0 control poly-pat))) - (let ((t1-0 (pat-event->string (-> arg0 control poly-pat)))) (s4-0 s3-0 s2-0 s1-0 s0-0 sv-64 t1-0))) - (let ((s4-1 format) - (s3-1 arg1) - (s2-1 "~0kgrnd:~6X mode:~-8S material:~-10S event:~S~%") - (s1-1 (-> arg0 control ground-pat)) - (s0-1 (pat-mode->string (-> arg0 control ground-pat)))) - (set! sv-80 (pat-material->string (-> arg0 control ground-pat))) - (let ((t1-1 (pat-event->string (-> arg0 control ground-pat)))) (s4-1 s3-1 s2-1 s1-1 s0-1 sv-80 t1-1))) - (let ((s4-2 format) - (s3-2 arg1) - (s2-2 "~0kwall:~6X mode:~-8S material:~-10S event:~S~%") - (s1-2 (-> arg0 control wall-pat)) - (s0-2 (pat-mode->string (-> arg0 control wall-pat)))) - (set! sv-96 (pat-material->string (-> arg0 control wall-pat))) - (let ((t1-2 (pat-event->string (-> arg0 control wall-pat)))) (s4-2 s3-2 s2-2 s1-2 s0-2 sv-96 t1-2)))) + (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))) + (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))) + (format arg1 + "~0kwall:~6X mode:~-8S material:~-10S event:~S~%" + (-> arg0 control wall-pat) + (pat-mode->string (-> arg0 control wall-pat)) + (pat-material->string (-> arg0 control wall-pat)) + (pat-event->string (-> arg0 control wall-pat)))) (when (and *stats-target* arg0) (format arg1 "~0ks: ~M ~X/~X ~A ~A ~A~%" @@ -230,39 +218,36 @@ (-> arg0 control poly-angle)) (let ((v1-74 (-> arg0 control trans))) (format arg1 "pos: ~6,,2m ~6,,2m ~6,,2m " (-> v1-74 x) (-> v1-74 y) (-> v1-74 z))) - (let ((s4-3 format) - (s3-3 arg1) - (s2-3 "~0kpol:~X/~S/~S/~S~%") - (s1-3 (-> arg0 control poly-pat)) - (s0-3 (pat-mode->string (-> arg0 control poly-pat)))) - (set! sv-112 (pat-material->string (-> arg0 control poly-pat))) - (let ((t1-7 (pat-event->string (-> arg0 control poly-pat)))) (s4-3 s3-3 s2-3 s1-3 s0-3 sv-112 t1-7))) - (let ((s4-4 format) - (s3-4 arg1) - (s2-4 "~0kcur:~X/~S/~S/~S ") - (s1-4 (-> arg0 control cur-pat)) - (s0-4 (pat-mode->string (-> arg0 control cur-pat)))) - (set! sv-128 (pat-material->string (-> arg0 control cur-pat))) - (let ((t1-8 (pat-event->string (-> arg0 control cur-pat)))) (s4-4 s3-4 s2-4 s1-4 s0-4 sv-128 t1-8))) - (let ((s4-5 format) - (s3-5 arg1) - (s2-5 "~0kgnd:~X/~S/~S/~S~%") - (s1-5 (-> arg0 control ground-pat)) - (s0-5 (pat-mode->string (-> arg0 control ground-pat)))) - (set! sv-144 (pat-material->string (-> arg0 control ground-pat))) - (let ((t1-9 (pat-event->string (-> arg0 control ground-pat)))) (s4-5 s3-5 s2-5 s1-5 s0-5 sv-144 t1-9))) + (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))) + (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))) + (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 ((s4-6 format) (s3-6 arg1) (s2-6 "~0kvel: x:~M y:~M z:~M yv:~M xzv:~M~%") (s1-6 (-> arg0 control transv x)) - (s0-6 (-> arg0 control transv y))) - (set! sv-160 (-> arg0 control transv z)) - (set! sv-176 (vector-dot (-> arg0 control dynam gravity-normal) (-> arg0 control transv))) - (let ((a0-36 (new-stack-vector0))) - (let ((f0-17 (vector-dot (-> arg0 control dynam gravity-normal) (-> arg0 control transv)))) - 0.0 - (vector-! a0-36 (-> arg0 control transv) (vector-float*! a0-36 (-> arg0 control dynam gravity-normal) f0-17))) - (let ((f0-18 (vector-length a0-36))) f0-18 (let ((t2-4 f0-18)) (s4-6 s3-6 s2-6 s1-6 s0-6 sv-160 sv-176 t2-4))))) + (s0-6 (-> arg0 control transv y)) + (sv-160 (-> arg0 control transv z)) + (sv-176 (vector-dot (-> arg0 control dynam gravity-normal) (-> arg0 control transv))) + (a0-36 (new-stack-vector0))) + (let ((f0-17 (vector-dot (-> arg0 control dynam gravity-normal) (-> arg0 control transv)))) + 0.0 + (vector-! a0-36 (-> arg0 control transv) (vector-float*! a0-36 (-> arg0 control dynam gravity-normal) f0-17))) + (let ((f0-18 (vector-length a0-36))) f0-18 (s4-6 s3-6 s2-6 s1-6 s0-6 sv-160 sv-176 f0-18))) (format arg1 "~0ky:~,,2M t:~d cy: ~,,2M my: ~,,2M impv:~,,2M " (-> arg0 control unknown-vector52 y) @@ -425,7 +410,7 @@ (f0-11 (vector-xz-length s5-0))) (if (< 0.0 f30-1) (vector-xz-normalize! s5-0 (+ f0-11 (* f30-1 (-> self control unknown-surface01 slope-down-factor)))) - (vector-xz-normalize! s5-0 (- f0-11 (* f30-1 f30-1 (-> self control unknown-surface01 slope-up-factor))))))))) + (vector-xz-normalize! s5-0 (- f0-11 (* (square f30-1) (-> self control unknown-surface01 slope-up-factor))))))))) (let ((t9-12 vector-xz-normalize!) (a0-17 (new-stack-vector0))) (set! (-> a0-17 quad) (-> s5-0 quad)) @@ -470,7 +455,7 @@ (< 0.0 (vector-dot (-> self control dynam gravity-normal) (vector-! (new 'stack-no-clear 'vector) - (the-as vector (-> self control unknown-sphere-array00 1 prim-core)) + (-> self control unknown-sphere-array00 1 prim-core world-sphere) (-> self control unknown-vector70))))) (set-time! (-> self control unknown-dword70))) (if (not (time-elapsed? (-> self control unknown-dword70) (seconds 0.2))) (set! f30-4 (+ 204800.0 f30-4))) @@ -755,8 +740,7 @@ (if (not (edge-grab-info-method-9 s5-0)) (send-event self 'end-mode)) (if *display-edge-collision-marks* (debug-draw s5-0)) (set! (-> self control ground-pat) (the-as pat-surface (-> s5-0 edge-tri-pat))) - (vector-normalize! (vector-! (-> self control unknown-vector100) (the-as vector (-> s5-0 world-vertex)) (-> s5-0 world-vertex 1)) - 1.0) + (vector-normalize! (vector-! (-> self control unknown-vector100) (-> s5-0 world-vertex 0) (-> s5-0 world-vertex 1)) 1.0) (let ((gp-1 (vector-cross! (-> self control unknown-vector101) (-> self control unknown-vector100) (-> self control dynam gravity-normal)))) @@ -789,8 +773,7 @@ (let ((gp-0 *edge-grab-info*)) (if (not (edge-grab-info-method-9 gp-0)) (send-event self 'end-mode)) (if *display-edge-collision-marks* (debug-draw gp-0)) - (vector-normalize! (vector-! (-> self control unknown-vector100) (the-as vector (-> gp-0 world-vertex)) (-> gp-0 world-vertex 1)) - 1.0) + (vector-normalize! (vector-! (-> self control unknown-vector100) (-> gp-0 world-vertex 0) (-> gp-0 world-vertex 1)) 1.0) (vector-cross! (-> self control unknown-vector101) (-> self control unknown-vector100) (-> self control dynam gravity-normal)) @@ -863,26 +846,25 @@ (vector<-cspace! gp-0 (joint-node eichar-lod0-jg main)) (+! (-> gp-0 y) -5896.192) (< (fabs (- (-> gp-0 y) (-> self control trans y))) 8192.0))) - (set! (-> (&-> (-> self control) unknown-qword00) 0) (-> gp-0 quad))) + (set! (-> (&-> self control unknown-qword00) 0) (-> gp-0 quad))) (else (let ((v1-11 (-> self water flags))) (cond ((and (logtest? v1-11 (water-flags wt09)) (logtest? v1-11 (water-flags wt11 wt12))) - (vector<-cspace! (the-as vector (&-> (-> self control) unknown-qword00)) (the-as cspace (-> self node-list data))) + (vector<-cspace! (the-as vector (&-> self control unknown-qword00)) (-> self node-list data 0)) (if (not (and (logtest? (-> self water flags) (water-flags wt12)) (not (logtest? (-> self water flags) (water-flags wt04))))) (set! (-> self control unknown-float30) (- (-> self water base-height) (-> self water swim-height)))) - (&-> (-> self control) unknown-qword00)) + (&-> self control unknown-qword00)) ((and (logtest? (-> self water flags) (water-flags wt09)) (logtest? (water-flags wt18) (-> self water flags))) - (vector<-cspace! (the-as vector (&-> (-> self control) unknown-qword00)) (the-as cspace (-> self node-list data))) + (vector<-cspace! (the-as vector (&-> self control unknown-qword00)) (-> self node-list data 0)) (set! (-> self control unknown-float30) (-> self water base-height))) ((logtest? (-> self control root-prim prim-core action) (collide-action racer)) - (set! (-> (&-> (-> self control) unknown-qword00) 0) (-> self control trans quad))) + (set! (-> (&-> self control unknown-qword00) 0) (-> self control trans quad))) ((logtest? (-> self control root-prim prim-core action) (collide-action tube)) - (set! (-> (&-> (-> self control) unknown-qword00) 0) (-> self control shadow-pos quad))) + (set! (-> (&-> self control unknown-qword00) 0) (-> self control shadow-pos quad))) ((logtest? (-> self draw status) (draw-status hidden no-anim)) - (set! (-> (&-> (-> self control) unknown-qword00) 0) (-> self control trans quad))) - (else - (vector<-cspace! (the-as vector (&-> (-> self control) unknown-qword00)) (the-as cspace (-> self node-list data))))))))) + (set! (-> (&-> self control unknown-qword00) 0) (-> self control trans quad))) + (else (vector<-cspace! (the-as vector (&-> self control unknown-qword00)) (-> self node-list data 0)))))))) 0 (none)) @@ -1155,7 +1137,7 @@ (quaternion-identity! (-> self control unknown-quaternion00)) (quaternion-identity! (-> self control dir-targ)) (set! (-> self control transv quad) (the-as uint128 0)) - (set! (-> (&-> (-> self control) unknown-qword00) 0) (-> self control trans quad))) + (set! (-> (&-> self control unknown-qword00) 0) (-> self control trans quad))) (target-exit) (target-timed-invulnerable-off self) (set! (-> self control status) (cshape-moving-flags)) @@ -1234,7 +1216,7 @@ (backup-collide-with-as (-> self control)) (set! (-> self game) *game-info*) (move-to-point! (-> self control) (-> arg0 trans)) - (set! (-> (&-> (-> self control) unknown-qword00) 0) (-> arg0 trans quad)) + (set! (-> (&-> self control unknown-qword00) 0) (-> arg0 trans quad)) (set! (-> self control unknown-cpad-info00) (-> *cpad-list* cpads 0)) (set! (-> self control unknown-surface01) (new 'process 'surface)) (set! (-> self control unknown-surface01 name) 'current) diff --git a/goal_src/jak1/engine/target/target-handler.gc b/goal_src/jak1/engine/target/target-handler.gc index 6b3d0f3b50..a10f8d4558 100644 --- a/goal_src/jak1/engine/target/target-handler.gc +++ b/goal_src/jak1/engine/target/target-handler.gc @@ -237,30 +237,6 @@ (go arg4 arg0 (-> self attack-info-rec)))))) (defbehavior target-send-attack target ((arg0 process) (arg1 uint) (arg2 touching-shapes-entry) (arg3 int) (arg4 int)) - (local-vars - (sv-96 touching-prims-entry) - (sv-128 touching-prims-entry) - (sv-176 touching-prims-entry) - (sv-224 int) - (sv-240 symbol) - (sv-256 symbol) - (sv-272 symbol) - (sv-288 int) - (sv-304 symbol) - (sv-320 symbol) - (sv-336 symbol) - (sv-352 int) - (sv-368 symbol) - (sv-384 symbol) - (sv-400 symbol) - (sv-416 int) - (sv-432 symbol) - (sv-448 symbol) - (sv-464 symbol) - (sv-480 int) - (sv-496 symbol) - (sv-512 symbol) - (sv-528 symbol)) (let ((v1-0 (new 'stack-no-clear 'event-message-block))) (set! (-> v1-0 from) self) (set! (-> v1-0 num-params) 4) @@ -274,33 +250,20 @@ (let ((v1-5 (-> self control unknown-symbol30))) (cond ((or (= v1-5 'spin) (= v1-5 'spin-air)) - (set! sv-96 (prims-touching? arg2 (-> self control) (the-as uint 64))) - (cond - (sv-96 - (let ((s4-0 (get-process *default-dead-pool* part-tracker #x4000))) - (when s4-0 - (let ((t9-3 (method-of-type part-tracker activate))) - (t9-3 (the-as part-tracker s4-0) self 'part-tracker (the-as pointer #x70004000))) - (let ((s3-0 run-function-in-process) - (s2-0 s4-0) - (s1-0 part-tracker-init) - (s0-0 group-spin-hit)) - (set! sv-224 -1) - (set! sv-240 (the-as symbol #f)) - (set! sv-256 (the-as symbol #f)) - (set! sv-272 (the-as symbol #f)) - (let ((t3-0 (get-intersect-point (new 'stack-no-clear 'vector) sv-96 (-> self control) arg2))) - ((the-as (function object object object object object object object object none) s3-0) - s2-0 - s1-0 - s0-0 - sv-224 - sv-240 - sv-256 - sv-272 - t3-0))) - (-> s4-0 ppointer)))) - (else (effect-control-method-10 (-> self skel effect) 'group-spin-hit (the-as float -1.0) 74))) + (let ((sv-96 (prims-touching? arg2 (-> self control) (the-as uint 64)))) + (if sv-96 + (process-spawn part-tracker + :init + part-tracker-init + group-spin-hit + -1 + (the-as symbol #f) + (the-as symbol #f) + (the-as symbol #f) + (get-intersect-point (new 'stack-no-clear 'vector) sv-96 (-> self control) arg2) + :to + self) + (effect-control-method-10 (-> self skel effect) 'group-spin-hit (the-as float -1.0) 74))) (effect-control-method-12 (-> self skel effect) (-> self control unknown-symbol30) (the-as float -1.0) @@ -309,56 +272,32 @@ (static-sound-name "spin-hit")) (cpad-set-buzz! (-> *cpad-list* cpads 0) 1 127 (seconds 0.2))) ((= v1-5 'punch) - (set! sv-128 (prims-touching? arg2 (-> self control) (the-as uint 64))) - (cond - (sv-128 - (let ((s4-1 (get-process *default-dead-pool* part-tracker #x4000))) - (when s4-1 - (let ((t9-11 (method-of-type part-tracker activate))) - (t9-11 (the-as part-tracker s4-1) self 'part-tracker (the-as pointer #x70004000))) - (let ((s3-1 run-function-in-process) - (s2-1 s4-1) - (s1-1 part-tracker-init) - (s0-1 group-punch-hit)) - (set! sv-288 -1) - (set! sv-304 (the-as symbol #f)) - (set! sv-320 (the-as symbol #f)) - (set! sv-336 (the-as symbol #f)) - (let ((t3-1 (get-intersect-point (new 'stack-no-clear 'vector) sv-128 (-> self control) arg2))) - ((the-as (function object object object object object object object object none) s3-1) - s2-1 - s1-1 - s0-1 - sv-288 - sv-304 - sv-320 - sv-336 - t3-1))) - (-> s4-1 ppointer)))) - ((let ((v0-14 (prims-touching? arg2 (-> self control) (the-as uint 32)))) (set! sv-128 v0-14) v0-14) - (let ((s4-2 (get-process *default-dead-pool* part-tracker #x4000))) - (when s4-2 - (let ((t9-16 (method-of-type part-tracker activate))) - (t9-16 (the-as part-tracker s4-2) self 'part-tracker (the-as pointer #x70004000))) - (let ((s3-2 run-function-in-process) - (s2-2 s4-2) - (s1-2 part-tracker-init) - (s0-2 group-punch-hit)) - (set! sv-352 -1) - (set! sv-368 (the-as symbol #f)) - (set! sv-384 (the-as symbol #f)) - (set! sv-400 (the-as symbol #f)) - (let ((t3-2 (get-intersect-point (new 'stack-no-clear 'vector) sv-128 (-> self control) arg2))) - ((the-as (function object object object object object object object object none) s3-2) - s2-2 - s1-2 - s0-2 - sv-352 - sv-368 - sv-384 - sv-400 - t3-2))) - (-> s4-2 ppointer))))) + (let ((sv-128 (prims-touching? arg2 (-> self control) (the-as uint 64)))) + (cond + (sv-128 + (process-spawn part-tracker + :init + part-tracker-init + group-punch-hit + -1 + (the-as symbol #f) + (the-as symbol #f) + (the-as symbol #f) + (get-intersect-point (new 'stack-no-clear 'vector) sv-128 (-> self control) arg2) + :to + self)) + ((let ((v0-14 (prims-touching? arg2 (-> self control) (the-as uint 32)))) (set! sv-128 v0-14) v0-14) + (process-spawn part-tracker + :init + part-tracker-init + group-punch-hit + -1 + (the-as symbol #f) + (the-as symbol #f) + (the-as symbol #f) + (get-intersect-point (new 'stack-no-clear 'vector) sv-128 (-> self control) arg2) + :to + self)))) (effect-control-method-12 (-> self skel effect) (-> self control unknown-symbol30) (the-as float -1.0) @@ -375,56 +314,32 @@ (static-sound-name "punch-hit")) (cpad-set-buzz! (-> *cpad-list* cpads 0) 1 127 (seconds 0.1))) ((= v1-5 'uppercut) - (set! sv-176 (prims-touching? arg2 (-> self control) (the-as uint 64))) - (cond - (sv-176 - (let ((s4-3 (get-process *default-dead-pool* part-tracker #x4000))) - (when s4-3 - (let ((t9-25 (method-of-type part-tracker activate))) - (t9-25 (the-as part-tracker s4-3) self 'part-tracker (the-as pointer #x70004000))) - (let ((s3-3 run-function-in-process) - (s2-3 s4-3) - (s1-3 part-tracker-init) - (s0-3 group-punch-hit)) - (set! sv-416 -1) - (set! sv-432 (the-as symbol #f)) - (set! sv-448 (the-as symbol #f)) - (set! sv-464 (the-as symbol #f)) - (let ((t3-3 (get-intersect-point (new 'stack-no-clear 'vector) sv-176 (-> self control) arg2))) - ((the-as (function object object object object object object object object none) s3-3) - s2-3 - s1-3 - s0-3 - sv-416 - sv-432 - sv-448 - sv-464 - t3-3))) - (-> s4-3 ppointer)))) - ((let ((v0-26 (prims-touching? arg2 (-> self control) (the-as uint 32)))) (set! sv-176 v0-26) v0-26) - (let ((s4-4 (get-process *default-dead-pool* part-tracker #x4000))) - (when s4-4 - (let ((t9-30 (method-of-type part-tracker activate))) - (t9-30 (the-as part-tracker s4-4) self 'part-tracker (the-as pointer #x70004000))) - (let ((s3-4 run-function-in-process) - (s2-4 s4-4) - (s1-4 part-tracker-init) - (s0-4 group-punch-hit)) - (set! sv-480 -1) - (set! sv-496 (the-as symbol #f)) - (set! sv-512 (the-as symbol #f)) - (set! sv-528 (the-as symbol #f)) - (let ((t3-4 (get-intersect-point (new 'stack-no-clear 'vector) sv-176 (-> self control) arg2))) - ((the-as (function object object object object object object object object none) s3-4) - s2-4 - s1-4 - s0-4 - sv-480 - sv-496 - sv-512 - sv-528 - t3-4))) - (-> s4-4 ppointer))))) + (let ((sv-176 (prims-touching? arg2 (-> self control) (the-as uint 64)))) + (cond + (sv-176 + (process-spawn part-tracker + :init + part-tracker-init + group-punch-hit + -1 + (the-as symbol #f) + (the-as symbol #f) + (the-as symbol #f) + (get-intersect-point (new 'stack-no-clear 'vector) sv-176 (-> self control) arg2) + :to + self)) + ((let ((v0-26 (prims-touching? arg2 (-> self control) (the-as uint 32)))) (set! sv-176 v0-26) v0-26) + (process-spawn part-tracker + :init + part-tracker-init + group-punch-hit + -1 + (the-as symbol #f) + (the-as symbol #f) + (the-as symbol #f) + (get-intersect-point (new 'stack-no-clear 'vector) sv-176 (-> self control) arg2) + :to + self)))) (effect-control-method-10 (-> self skel effect) 'group-uppercut-hit (the-as float -1.0) 23) (effect-control-method-12 (-> self skel effect) (-> self control unknown-symbol30) diff --git a/goal_src/jak1/engine/target/target-part.gc b/goal_src/jak1/engine/target/target-part.gc index c57c3f809c..5b656f32bd 100644 --- a/goal_src/jak1/engine/target/target-part.gc +++ b/goal_src/jak1/engine/target/target-part.gc @@ -63,15 +63,15 @@ (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*) - ;; og:preserve-this added check here - (if (not sv-16) (return #f)) - (let ((s3-0 (new 'stack-no-clear 'vector))) + (let ((sv-16 *target*) + (s3-0 (new 'stack-no-clear 'vector))) + ;; og:preserve-this added check here + (if (not sv-16) (return #f)) (new 'stack-no-clear 'vector) (let ((s5-0 (new 'stack-no-clear 'quaternion))) (let ((s2-0 (-> sv-16 control local-normal))) diff --git a/goal_src/jak1/engine/target/target2.gc b/goal_src/jak1/engine/target/target2.gc index 523cca5124..e8fef19fa7 100644 --- a/goal_src/jak1/engine/target/target2.gc +++ b/goal_src/jak1/engine/target/target2.gc @@ -114,7 +114,6 @@ hud-normal hud-waiting)) - (define *fp-hud-stack* (malloc 'global #x3800)) (defmethod deactivate ((this first-person-hud)) @@ -341,7 +340,6 @@ (camera-change-to (the-as string 'base) 60 #f))) :trans (behavior () - (local-vars (sv-48 vector)) (rlet ((vf0 :class vf) (vf4 :class vf) (vf5 :class vf) @@ -364,15 +362,20 @@ (let ((s3-0 run-function-in-process) (s2-0 s4-0) (s1-0 projectile-init-by-other) - (s0-0 (-> self entity))) - (set! sv-48 s5-1) + (s0-0 (-> self entity)) + (sv-48 s5-1)) (let ((v0-3 (camera-pos))) (.mov.vf.w vf6 vf0) (.lvf vf4 (&-> v0-3 quad))) (.lvf vf5 (&-> s5-1 quad)) (.add.vf.xyz vf6 vf4 vf5) (.svf (&-> sv-48 quad) vf6) - (let ((t1-0 (if (>= (-> self fact eco-level) (-> *FACT-bank* eco-level-max)) 56 40)) - (t2-0 #f)) - ((the-as (function object object object object object object object none) s3-0) s2-0 s1-0 s0-0 sv-48 gp-1 t1-0 t2-0))) + ((the-as (function object object object object object object object none) s3-0) + s2-0 + s1-0 + s0-0 + sv-48 + gp-1 + (if (>= (-> self fact eco-level) (-> *FACT-bank* eco-level-max)) 56 40) + #f)) (-> s4-0 ppointer)))) (set-time! (-> self control unknown-dword82))) (when (cpad-pressed? (-> self control unknown-cpad-info00 number) triangle) @@ -420,7 +423,6 @@ (target-exit)) :trans (behavior () - (local-vars (sv-48 vector)) (rlet ((vf0 :class vf) (vf4 :class vf) (vf5 :class vf) @@ -443,15 +445,20 @@ (let ((s3-0 run-function-in-process) (s2-0 s4-0) (s1-0 projectile-init-by-other) - (s0-0 (-> self entity))) - (set! sv-48 s5-1) + (s0-0 (-> self entity)) + (sv-48 s5-1)) (let ((v0-4 (camera-pos))) (.mov.vf.w vf6 vf0) (.lvf vf4 (&-> v0-4 quad))) (.lvf vf5 (&-> s5-1 quad)) (.add.vf.xyz vf6 vf4 vf5) (.svf (&-> sv-48 quad) vf6) - (let ((t1-0 (if (>= (-> self fact eco-level) (-> *FACT-bank* eco-level-max)) 120 104)) - (t2-0 #f)) - ((the-as (function object object object object object object object none) s3-0) s2-0 s1-0 s0-0 sv-48 gp-1 t1-0 t2-0))) + ((the-as (function object object object object object object object none) s3-0) + s2-0 + s1-0 + s0-0 + sv-48 + gp-1 + (if (>= (-> self fact eco-level) (-> *FACT-bank* eco-level-max)) 120 104) + #f)) (-> s4-0 ppointer)))) (set-time! (-> self control unknown-dword82))))) :code @@ -1638,37 +1645,38 @@ (if (nonzero? arg3) (process-spawn-function process (lambda :behavior process ((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))) (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 unknown-vector52 y)) arg2)) - (vector-xz-normalize! (-> (the-as target s4-0) control transv) (the-as float 0.0)) - ;; og:preserve-this PAL patch here - (when (< (vector-vector-xz-distance (-> (the-as target s4-0) control trans) sv-40) 20480.0) - (let ((v1-16 (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-16 x))))) - (set! (-> (the-as target s4-0) control trans z) (+ (-> sv-40 z) (fmax -2867.2 (fmin 2867.2 (-> v1-16 z)))))))) - (else - (if sv-44 (set! sv-32 (current-time))) - (set! sv-44 (the-as symbol #f)) - (when (or (= (-> (the-as target s4-0) next-state name) 'target-duck-high-jump-jump) - (= (-> (the-as target s4-0) next-state name) 'target-falling)) - (let ((v1-30 (-> (the-as target s4-0) control trans)) - (s3-0 (-> (the-as target s4-0) control transv))) - (set! (-> s3-0 x) (- (-> sv-40 x) (-> v1-30 x))) - (set! (-> s3-0 z) (- (-> sv-40 z) (-> v1-30 z))) - (let ((f30-0 (vector-xz-length s3-0))) - (if (< 122880.0 f30-0) (vector-xz-normalize! s3-0 (the-as float 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 (the-as float 1.0)) - (vector-y-quaternion! (new 'stack-no-clear 'vector) (-> (the-as target s4-0) control quat)))))))))) - (suspend) - 0) + (let ((sv-32 (current-time)) + (v1-2 (new-stack-vector0))) + (set! (-> v1-2 quad) (-> arg0 quad)) + (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 unknown-vector52 y)) arg2)) + (vector-xz-normalize! (-> (the-as target s4-0) control transv) (the-as float 0.0)) + ;; og:preserve-this PAL patch here + (when (< (vector-vector-xz-distance (-> (the-as target s4-0) control trans) sv-40) 20480.0) + (let ((v1-16 (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-16 x))))) + (set! (-> (the-as target s4-0) control trans z) (+ (-> sv-40 z) (fmax -2867.2 (fmin 2867.2 (-> v1-16 z)))))))) + (else + (if sv-44 (set! sv-32 (current-time))) + (set! sv-44 (the-as symbol #f)) + (when (or (= (-> (the-as target s4-0) next-state name) 'target-duck-high-jump-jump) + (= (-> (the-as target s4-0) next-state name) 'target-falling)) + (let ((v1-30 (-> (the-as target s4-0) control trans)) + (s3-0 (-> (the-as target s4-0) control transv))) + (set! (-> s3-0 x) (- (-> sv-40 x) (-> v1-30 x))) + (set! (-> s3-0 z) (- (-> sv-40 z) (-> v1-30 z))) + (let ((f30-0 (vector-xz-length s3-0))) + (if (< 122880.0 f30-0) (vector-xz-normalize! s3-0 (the-as float 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 (the-as float 1.0)) + (vector-y-quaternion! (new 'stack-no-clear 'vector) (-> (the-as target s4-0) control quat)))))))))) + (suspend) + 0))) #f) arg2 arg3 diff --git a/goal_src/jak1/engine/ui/progress/progress-draw.gc b/goal_src/jak1/engine/ui/progress/progress-draw.gc index c0f620a9a7..06775a5dd6 100644 --- a/goal_src/jak1/engine/ui/progress/progress-draw.gc +++ b/goal_src/jak1/engine/ui/progress/progress-draw.gc @@ -11,15 +11,6 @@ (if (< arg0 arg1) 0 (- arg0 arg1))) (defmethod draw-fuel-cell-screen ((this progress) (arg0 int)) - (local-vars - (sv-112 int) - (sv-128 int) - (sv-144 int) - (sv-160 (function trsqv float quaternion)) - (sv-176 trsqv) - (sv-192 int) - (sv-208 int) - (sv-224 (function string float font-context int none))) (hide-progress-icons) (let ((s5-0 (-> *level-task-data* arg0))) (if (and (= *cheat-mode* 'debug) (cpad-hold? 0 l3)) (format *stdcon* "fcd:~d~%" (-> *game-info* fuel-cell-deaths))) @@ -27,92 +18,88 @@ (set! (-> *progress-process* 0 particles 15 init-pos x) -320.0) (set! (-> *progress-process* 0 icons 4 icon-x) -320) (when (and (!= s5-0 #f) (= (-> *game-info* level-opened arg0) 1)) - (set! sv-112 (- (-> *task-egg-starting-x* (-> s5-0 nb-of-tasks)) (-> this left-x-offset))) - (set! sv-128 (the int (* 47.0 (-> this transition-percentage-invert)))) - 0 - (let ((s0-0 6) - (s2-0 0) - (s4-1 (if (= (-> this level-transition) 1) (- (-> this transition-offset)) (-> this transition-offset))) - (f30-0 (-> this transition-percentage-invert)) - (s1-0 0) - (s3-0 #f)) - (when (-> this stat-transition) - (set! sv-128 47) - (set! s2-0 - (if (!= (-> this display-state) (-> this next-display-state)) (- (-> this transition-offset)) (-> this transition-offset))) - (set! s4-1 0) - (set! f30-0 1.0)) - (set! sv-144 0) - (while (< sv-144 4) - (let ((a0-18 (-> this icons sv-144 icon 0 root))) - (set! sv-176 a0-18) - (set! sv-160 (method-of-object sv-176 set-yaw-angle-clear-roll-pitch!)) - (let ((a1-2 (+ (y-angle a0-18) (* 182.04445 (/ (-> *display* time-adjust-ratio) 2))))) (sv-160 sv-176 a1-2))) - (set! sv-144 (+ sv-144 1))) - (set! sv-192 (+ sv-112 (/ (- (* 47 (-> s5-0 nb-of-tasks)) (* sv-128 (-> s5-0 nb-of-tasks))) 2))) - (set! sv-208 0) - (while (< sv-208 (-> s5-0 nb-of-tasks)) - (let ((v0-4 (get-task-status (-> s5-0 task-info sv-208 task-id))) - (v1-59 -1) - (a0-25 #f)) - (set! (-> this particle-state s0-0) 2) - (cond - ((or (= v0-4 (task-status need-hint)) (= v0-4 (task-status unknown))) - (if (= *kernel-boot-message* 'play) (set! (-> this particle-state s0-0) 1))) - ((= v0-4 (task-status invalid)) - (set! v1-59 (-> s5-0 task-info sv-208 text-index-when-resolved)) - (set! (-> this particle-state s0-0) 3) - (set! a0-25 #t)) - ((= v0-4 (task-status need-introduction)) (set! v1-59 0)) - ((= v0-4 (task-status need-reminder-a)) (set! v1-59 0)) - ((= v0-4 (task-status need-reminder)) (set! v1-59 1)) - ((= v0-4 (task-status need-reward-speech)) (set! v1-59 2)) - ((= v0-4 (task-status need-resolution)) (set! v1-59 2))) - (if (and (!= *kernel-boot-message* 'play) (= v1-59 -1)) (set! v1-59 0)) - (set! (-> this particles s0-0 init-pos x) (the float (+ sv-192 s2-0))) - (set! (-> this particles s0-0 init-pos y) (the float (+ s4-1 204))) - (+! s0-0 1) - (when (= sv-208 (-> this task-index)) - (set! s1-0 v1-59) - (set! s3-0 a0-25) - (set! (-> this particles 5 init-pos x) (the float (+ sv-192 s2-0))) - (set! (-> this particles 5 init-pos y) (the float (+ s4-1 204))))) - (set! sv-192 (+ sv-192 sv-128)) - (set! sv-208 (+ sv-208 1))) - (dotimes (v1-77 (- 8 (-> s5-0 nb-of-tasks))) - (set! (-> *progress-process* 0 particles s0-0 init-pos x) (the float (+ s2-0 -320))) - (set! (-> this particles s0-0 init-pos y) (the float (+ s4-1 194))) - (+! s0-0 1)) - (when *common-text* - (when (and (!= s1-0 -1) - (> (-> s5-0 nb-of-tasks) 0) - (>= (-> this task-index) 0) - (< (-> this task-index) (-> s5-0 nb-of-tasks))) - (let ((s0-1 (new 'stack - 'font-context - *font-default-matrix* - (- (+ s2-0 32) (-> this left-x-offset)) - (+ (/ s4-1 2) 125) - 8325000.0 - (font-color progress-yellow) - (font-flags shadow kerning)))) - (let ((v1-91 s0-1)) (set! (-> v1-91 width) (the float 328))) - (let ((v1-92 s0-1)) (set! (-> v1-92 height) (the float 50))) - (let ((v1-93 s0-1)) (set! (-> v1-93 scale) 0.7)) - (set! (-> s0-1 flags) (font-flags shadow kerning middle middle-vert large)) - (set! sv-224 print-game-text-scaled) - (let ((a0-47 (lookup-text! *common-text* (-> s5-0 task-info (-> this task-index) task-name s1-0) #f)) - (a1-57 f30-0) - (a2-15 s0-1) - (a3-2 (the int (* 128.0 f30-0)))) - (sv-224 a0-47 a1-57 a2-15 a3-2)) - (when s3-0 - (set! (-> s0-1 origin x) (the float (- (+ s2-0 32) (-> this left-x-offset)))) - (set! (-> s0-1 origin y) (the float (+ (/ s4-1 2) 175))) - (let ((a0-49 s0-1)) (set! (-> a0-49 color) (font-color progress-blue))) - (let ((v1-104 s0-1)) (set! (-> v1-104 height) (the float 15))) - (let ((v1-105 s0-1)) (set! (-> v1-105 scale) 0.5)) - (print-game-text-scaled (lookup-text! *common-text* (text-id task-completed) #f) f30-0 s0-1 (the int (* 128.0 f30-0)))))))))) + (let ((sv-112 (- (-> *task-egg-starting-x* (-> s5-0 nb-of-tasks)) (-> this left-x-offset))) + (sv-128 (the int (* 47.0 (-> this transition-percentage-invert))))) + 0 + (let ((s0-0 6) + (s2-0 0) + (s4-1 (if (= (-> this level-transition) 1) (- (-> this transition-offset)) (-> this transition-offset))) + (f30-0 (-> this transition-percentage-invert)) + (s1-0 0) + (s3-0 #f)) + (when (-> this stat-transition) + (set! sv-128 47) + (set! s2-0 + (if (!= (-> this display-state) (-> this next-display-state)) (- (-> this transition-offset)) (-> this transition-offset))) + (set! s4-1 0) + (set! f30-0 1.0)) + (let ((sv-144 0)) + (while (< sv-144 4) + (let ((a0-18 (-> this icons sv-144 icon 0 root))) + (set-yaw-angle-clear-roll-pitch! a0-18 (+ (y-angle a0-18) (* 182.04445 (/ (-> *display* time-adjust-ratio) 2))))) + (+! sv-144 1))) + (let ((sv-192 (+ sv-112 (/ (- (* 47 (-> s5-0 nb-of-tasks)) (* sv-128 (-> s5-0 nb-of-tasks))) 2))) + (sv-208 0)) + (while (< sv-208 (-> s5-0 nb-of-tasks)) + (let ((v0-4 (get-task-status (-> s5-0 task-info sv-208 task-id))) + (v1-59 -1) + (a0-25 #f)) + (set! (-> this particle-state s0-0) 2) + (cond + ((or (= v0-4 (task-status need-hint)) (= v0-4 (task-status unknown))) + (if (= *kernel-boot-message* 'play) (set! (-> this particle-state s0-0) 1))) + ((= v0-4 (task-status invalid)) + (set! v1-59 (-> s5-0 task-info sv-208 text-index-when-resolved)) + (set! (-> this particle-state s0-0) 3) + (set! a0-25 #t)) + ((= v0-4 (task-status need-introduction)) (set! v1-59 0)) + ((= v0-4 (task-status need-reminder-a)) (set! v1-59 0)) + ((= v0-4 (task-status need-reminder)) (set! v1-59 1)) + ((= v0-4 (task-status need-reward-speech)) (set! v1-59 2)) + ((= v0-4 (task-status need-resolution)) (set! v1-59 2))) + (if (and (!= *kernel-boot-message* 'play) (= v1-59 -1)) (set! v1-59 0)) + (set! (-> this particles s0-0 init-pos x) (the float (+ sv-192 s2-0))) + (set! (-> this particles s0-0 init-pos y) (the float (+ s4-1 204))) + (+! s0-0 1) + (when (= sv-208 (-> this task-index)) + (set! s1-0 v1-59) + (set! s3-0 a0-25) + (set! (-> this particles 5 init-pos x) (the float (+ sv-192 s2-0))) + (set! (-> this particles 5 init-pos y) (the float (+ s4-1 204))))) + (+! sv-192 sv-128) + (+! sv-208 1))) + (dotimes (v1-77 (- 8 (-> s5-0 nb-of-tasks))) + (set! (-> *progress-process* 0 particles s0-0 init-pos x) (the float (+ s2-0 -320))) + (set! (-> this particles s0-0 init-pos y) (the float (+ s4-1 194))) + (+! s0-0 1)) + (when *common-text* + (when (and (!= s1-0 -1) + (> (-> s5-0 nb-of-tasks) 0) + (>= (-> this task-index) 0) + (< (-> this task-index) (-> s5-0 nb-of-tasks))) + (let ((s0-1 (new 'stack + 'font-context + *font-default-matrix* + (- (+ s2-0 32) (-> this left-x-offset)) + (+ (/ s4-1 2) 125) + 8325000.0 + (font-color progress-yellow) + (font-flags shadow kerning)))) + (set-width! s0-1 328) + (set-height! s0-1 50) + (set-scale! s0-1 0.7) + (set! (-> s0-1 flags) (font-flags shadow kerning middle middle-vert large)) + (print-game-text-scaled (lookup-text! *common-text* (-> s5-0 task-info (-> this task-index) task-name s1-0) #f) + f30-0 + s0-1 + (the int (* 128.0 f30-0))) + (when s3-0 + (set! (-> s0-1 origin x) (the float (- (+ s2-0 32) (-> this left-x-offset)))) + (set! (-> s0-1 origin y) (the float (+ (/ s4-1 2) 175))) + (let ((a0-49 s0-1)) (set! (-> a0-49 color) (font-color progress-blue))) + (set-height! s0-1 15) + (set-scale! s0-1 0.5) + (print-game-text-scaled (lookup-text! *common-text* (text-id task-completed) #f) f30-0 s0-1 (the int (* 128.0 f30-0))))))))))) 0 (none)) @@ -142,13 +129,13 @@ 8325000.0 (font-color default) (font-flags shadow kerning)))) - (let ((v1-19 s4-1)) (set! (-> v1-19 width) (the float 328))) - (let ((v1-20 s4-1)) (set! (-> v1-20 height) (the float 70))) + (set-width! s4-1 328) + (set-height! s4-1 70) (set! (-> s4-1 flags) (font-flags shadow kerning large)) (let ((s3-1 print-game-text-scaled)) (format (clear *temp-string*) "~D/~D" (-> *game-info* money-per-level arg0) (-> *game-counts* data arg0 money-count)) (s3-1 *temp-string* f30-0 s4-1 (the int (* 128.0 f30-0)))) - (let ((v1-26 s4-1)) (set! (-> v1-26 width) (the float 428))) + (set-width! s4-1 428) (+! (-> s4-1 origin x) -220.0) (+! (-> s4-1 origin y) 40.0) (set! (-> s4-1 flags) (font-flags shadow kerning middle large)) @@ -189,13 +176,13 @@ 8325000.0 (font-color default) (font-flags shadow kerning)))) - (let ((v1-9 s4-1)) (set! (-> v1-9 width) (the float 328))) - (let ((v1-10 s4-1)) (set! (-> v1-10 height) (the float 70))) + (set-width! s4-1 328) + (set-height! s4-1 70) (set! (-> s4-1 flags) (font-flags shadow kerning large)) (let ((s3-1 print-game-text-scaled)) (format (clear *temp-string*) "~D/~D" s2-0 (-> *game-counts* data arg0 buzzer-count)) (s3-1 *temp-string* f30-0 s4-1 (the int (* 128.0 f30-0)))) - (let ((v1-14 s4-1)) (set! (-> v1-14 width) (the float 428))) + (set-width! s4-1 428) (+! (-> s4-1 origin x) -220.0) (+! (-> s4-1 origin y) 40.0) (set! (-> s4-1 flags) (font-flags shadow kerning middle large)) @@ -211,9 +198,9 @@ (none)) (defmethod draw-memcard-storage-error ((this progress) (arg0 font-context)) - (let ((v1-0 arg0)) (set! (-> v1-0 scale) 0.55)) - (let ((v1-1 arg0)) (set! (-> v1-1 width) (the float 265))) - (let ((v1-2 arg0)) (set! (-> v1-2 height) (the float 55))) + (set-scale! arg0 0.55) + (set-width! arg0 265) + (set-height! arg0 55) (set! (-> arg0 flags) (font-flags shadow kerning middle middle-vert large)) (let ((s4-0 (text-id memcard-not-formatted-title))) (case (-> this display-state) @@ -224,20 +211,20 @@ (s3-0 *temp-string* (-> this transition-percentage-invert) arg0 128))) (set! (-> arg0 origin x) (the float (- 20 (-> this left-x-offset)))) (set! (-> arg0 origin y) 70.0) - (let ((v1-12 arg0)) (set! (-> v1-12 width) (the float 350))) - (let ((v1-13 arg0)) (set! (-> v1-13 height) (the float 40))) + (set-width! arg0 350) + (set-height! arg0 40) (let ((s4-1 print-game-text-scaled)) (format (clear *temp-string*) (lookup-text! *common-text* (text-id memcard-space-requirement1) #f) (if (-> this card-info) (-> this card-info mem-required) 0)) (s4-1 *temp-string* (-> this transition-percentage-invert) arg0 128)) (set! (-> arg0 origin y) 115.0) - (let ((v1-17 arg0)) (set! (-> v1-17 height) (the float 60))) + (set-height! arg0 60) (print-game-text-scaled (lookup-text! *common-text* (text-id memcard-space-requirement2) #f) (-> this transition-percentage-invert) arg0 128) - (let ((v1-19 arg0)) (set! (-> v1-19 scale) 0.65)) + (set-scale! arg0 0.65) (set! (-> arg0 origin y) 160.0) (print-game-text-scaled (lookup-text! *common-text* (text-id continue?) #f) (-> this transition-percentage-invert) @@ -248,24 +235,24 @@ (defmethod draw-memcard-format ((this progress) (arg0 font-context)) (set! (-> arg0 origin y) 35.0) - (let ((v1-0 arg0)) (set! (-> v1-0 scale) 0.55)) - (let ((v1-1 arg0)) (set! (-> v1-1 width) (the float 265))) - (let ((v1-2 arg0)) (set! (-> v1-2 height) (the float 55))) + (set-scale! arg0 0.55) + (set-width! arg0 265) + (set-height! arg0 55) (set! (-> arg0 flags) (font-flags shadow kerning middle middle-vert large)) (let ((s4-0 print-game-text-scaled)) (format (clear *temp-string*) (lookup-text! *common-text* (text-id memcard-not-formatted-title) #f) 1) (s4-0 *temp-string* (-> this transition-percentage-invert) arg0 128)) (set! (-> arg0 origin x) (the float (- 20 (-> this left-x-offset)))) (set! (-> arg0 origin y) 105.0) - (let ((v1-7 arg0)) (set! (-> v1-7 width) (the float 360))) - (let ((v1-8 arg0)) (set! (-> v1-8 height) (the float 40))) + (set-width! arg0 360) + (set-height! arg0 40) (print-game-text-scaled (lookup-text! *common-text* (text-id memcard-not-formatted-msg) #f) (-> this transition-percentage-invert) arg0 128) - (let ((v1-10 arg0)) (set! (-> v1-10 scale) 0.65)) + (set-scale! arg0 0.65) (set! (-> arg0 origin y) 138.0) - (let ((v1-11 arg0)) (set! (-> v1-11 height) (the float 60))) + (set-height! arg0 60) (print-game-text-scaled (lookup-text! *common-text* (text-id format?) #f) (-> this transition-percentage-invert) arg0 @@ -274,19 +261,19 @@ (none)) (defmethod draw-memcard-data-exists ((this progress) (arg0 font-context)) - (let ((v1-0 arg0)) (set! (-> v1-0 scale) 0.65)) + (set-scale! arg0 0.65) (set! (-> arg0 flags) (font-flags shadow kerning middle middle-vert large)) (set! (-> arg0 origin x) (the float (- 20 (-> this left-x-offset)))) (set! (-> arg0 origin y) 55.0) - (let ((v1-4 arg0)) (set! (-> v1-4 width) (the float 365))) - (let ((v1-5 arg0)) (set! (-> v1-5 height) (the float 75))) + (set-width! arg0 365) + (set-height! arg0 75) (print-game-text-scaled (lookup-text! *common-text* (text-id save-data-already-exists) #f) (-> this transition-percentage-invert) arg0 128) (set! (-> arg0 origin y) 140.0) - (let ((v1-7 arg0)) (set! (-> v1-7 width) (the float 360))) - (let ((v1-8 arg0)) (set! (-> v1-8 height) (the float 40))) + (set-width! arg0 360) + (set-height! arg0 40) (print-game-text-scaled (lookup-text! *common-text* (text-id overwrite?) #f) (-> this transition-percentage-invert) arg0 @@ -295,18 +282,18 @@ (none)) (defmethod draw-memcard-no-data ((this progress) (arg0 font-context)) - (let ((v1-0 arg0)) (set! (-> v1-0 scale) 0.65)) + (set-scale! arg0 0.65) (set! (-> arg0 flags) (font-flags shadow kerning middle middle-vert large)) (set! (-> arg0 origin x) (the float (- 20 (-> this left-x-offset)))) (set! (-> arg0 origin y) 40.0) - (let ((v1-4 arg0)) (set! (-> v1-4 width) (the float 365))) - (let ((v1-5 arg0)) (set! (-> v1-5 height) (the float 75))) + (set-width! arg0 365) + (set-height! arg0 75) (let ((s4-0 print-game-text-scaled)) (format (clear *temp-string*) (lookup-text! *common-text* (text-id no-save-data) #f) 1) (s4-0 *temp-string* (-> this transition-percentage-invert) arg0 128)) (set! (-> arg0 origin y) 130.0) - (let ((v1-7 arg0)) (set! (-> v1-7 width) (the float 360))) - (let ((v1-8 arg0)) (set! (-> v1-8 height) (the float 40))) + (set-width! arg0 360) + (set-height! arg0 40) (print-game-text-scaled (lookup-text! *common-text* (text-id create-save-data?) #f) (-> this transition-percentage-invert) arg0 @@ -315,12 +302,12 @@ (none)) (defmethod draw-memcard-accessing ((this progress) (arg0 font-context)) - (let ((v1-0 arg0)) (set! (-> v1-0 scale) 1.0)) + (set-scale! arg0 1.0) (set! (-> arg0 flags) (font-flags shadow kerning middle middle-vert large)) (set! (-> arg0 origin x) (the float (- 20 (-> this left-x-offset)))) (set! (-> arg0 origin y) 35.0) - (let ((v1-4 arg0)) (set! (-> v1-4 width) (the float 365))) - (let ((v1-5 arg0)) (set! (-> v1-5 height) (the float 75))) + (set-width! arg0 365) + (set-height! arg0 75) (when (or (< (mod (-> *display* real-frame-counter) 300) 150) (!= (-> this transition-percentage-invert) 1.0)) (let ((a1-1 (text-id loading-data))) (case (-> this display-state) @@ -328,12 +315,12 @@ (((progress-screen memcard-formatting)) (set! a1-1 (text-id formatting))) (((progress-screen memcard-creating)) (set! a1-1 (text-id creating-save-data)))) (print-game-text-scaled (lookup-text! *common-text* a1-1 #f) (-> this transition-percentage-invert) arg0 128))) - (let ((v1-18 arg0)) (set! (-> v1-18 scale) 0.65)) + (set-scale! arg0 0.65) (set! (-> arg0 flags) (font-flags shadow kerning middle middle-vert large)) (set! (-> arg0 origin x) (the float (- 15 (-> this left-x-offset)))) (set! (-> arg0 origin y) 100.0) - (let ((v1-22 arg0)) (set! (-> v1-22 width) (the float 370))) - (let ((v1-23 arg0)) (set! (-> v1-23 height) (the float 75))) + (set-width! arg0 370) + (set-height! arg0 75) (let ((s4-1 print-game-text-scaled)) (format (clear *temp-string*) (lookup-text! *common-text* (text-id memcard-do-not-remove) #f) 1) (s4-1 *temp-string* (-> this transition-percentage-invert) arg0 128)) @@ -341,12 +328,12 @@ (none)) (defmethod draw-memcard-insert ((this progress) (arg0 font-context)) - (let ((v1-0 arg0)) (set! (-> v1-0 scale) 0.65)) + (set-scale! arg0 0.65) (set! (-> arg0 flags) (font-flags shadow kerning middle middle-vert large)) (set! (-> arg0 origin x) (the float (- 50 (-> this left-x-offset)))) (set! (-> arg0 origin y) 35.0) - (let ((v1-4 arg0)) (set! (-> v1-4 width) (the float 310))) - (let ((v1-5 arg0)) (set! (-> v1-5 height) (the float 110))) + (set-width! arg0 310) + (set-height! arg0 110) ;; og:preserve-this PAL patch here (let ((v1-6 (-> this card-info))) (when (and (= (-> *setting-control* default language) (language-enum japanese)) v1-6 (zero? (-> v1-6 handle))) @@ -358,24 +345,14 @@ (let ((s4-1 print-game-text-scaled)) (format (clear *temp-string*) (lookup-text! *common-text* (text-id insert-memcard) #f) 1) (s4-1 *temp-string* (-> this transition-percentage-invert) arg0 128)) - (let ((v1-12 arg0)) (set! (-> v1-12 scale) 0.65)) + (set-scale! arg0 0.65) (set! (-> arg0 origin y) 130.0) - (let ((v1-13 arg0)) (set! (-> v1-13 height) (the float 60))) + (set-height! arg0 60) (print-game-text-scaled (lookup-text! *common-text* (text-id back?) #f) (-> this transition-percentage-invert) arg0 128) 0 (none)) (defmethod draw-memcard-file-select ((this progress) (arg0 font-context)) - (local-vars - (sv-16 (function _varargs_ object)) - (sv-32 (function _varargs_ object)) - (sv-48 (function _varargs_ object)) - (sv-64 (function _varargs_ object)) - (sv-80 (function _varargs_ object)) - (sv-96 (function _varargs_ object)) - (sv-112 (function _varargs_ object)) - (sv-128 (function _varargs_ object)) - (sv-144 (function _varargs_ object))) (let ((s4-0 (* (+ (-> this transition-offset) -256) 2))) (if (< s4-0 0) (set! s4-0 0)) (if (< 500 s4-0) (set! s4-0 700)) @@ -392,12 +369,12 @@ 128 (if (< f0-13 0.0) (set! f0-13 0.0)) (let ((s4-1 (the int (* 128.0 f0-13)))) - (let ((v1-29 arg0)) (set! (-> v1-29 scale) 0.5)) + (set-scale! arg0 0.5) (set! (-> arg0 flags) (font-flags shadow kerning middle middle-vert large)) (set! (-> arg0 origin x) (the float (- 102 (-> this left-x-offset)))) (set! (-> arg0 origin y) 5.0) - (let ((v1-33 arg0)) (set! (-> v1-33 width) (the float 200))) - (let ((v1-34 arg0)) (set! (-> v1-34 height) (the float 20))) + (set-width! arg0 200) + (set-height! arg0 20) (print-game-text (lookup-text! *common-text* (if (= (-> this display-state) (progress-screen load-game)) (text-id select-file-to-load) (text-id select-file-to-save)) #f) @@ -406,18 +383,18 @@ s4-1 22) (set! (-> arg0 origin y) 26.0) - (let ((v1-37 arg0)) (set! (-> v1-37 height) (the float 20))) + (set-height! arg0 20) (let ((s3-3 (-> this card-info)) (s2-0 23)) (dotimes (s1-0 4) (set! (-> arg0 origin x) (the float (- 41 (-> this left-x-offset)))) (set! (-> arg0 flags) (font-flags shadow kerning middle middle-vert large)) (let ((a0-17 arg0)) (set! (-> a0-17 color) (font-color default))) - (let ((v1-42 arg0)) (set! (-> v1-42 width) (the float 320))) + (set-width! arg0 320) (cond ((and s3-3 (= (-> s3-3 formatted) 1) (= (-> s3-3 inited) 1) (= (-> s3-3 file s1-0 present) 1)) (set! (-> this particles s2-0 init-pos x) (the float (- 66 (-> this left-x-offset)))) - (let ((v1-57 arg0)) (set! (-> v1-57 scale) 0.6)) + (set-scale! arg0 0.6) (if (and (< (-> s3-3 file s1-0 level-index) (length *level-task-data-remap*)) (> (-> s3-3 file s1-0 level-index) 0)) (print-game-text (lookup-text! *common-text* (-> *level-task-data* (-> *level-task-data-remap* (+ (-> s3-3 file s1-0 level-index) -1)) level-name-id) @@ -433,46 +410,30 @@ (or (< (mod (- (-> *display* real-frame-counter) (-> this last-option-index-change)) 1200) 600) (!= (-> this option-index) s1-0) (-> this in-transition))) - (let ((v1-87 arg0)) (set! (-> v1-87 scale) 0.5)) + (set-scale! arg0 0.5) (+! (-> arg0 origin y) 16.0) (set! (-> arg0 flags) (font-flags shadow kerning middle large)) (set! (-> arg0 origin x) (the float (- -73 (-> this left-x-offset)))) - (let ((v1-91 arg0)) (set! (-> v1-91 width) (the float 350))) + (set-width! arg0 350) (let ((s0-2 print-game-text)) - (set! sv-16 format) - (let ((a0-40 (clear *temp-string*)) - (a1-13 "~D") - (a2-5 (the int (-> s3-3 file s1-0 fuel-cell-count)))) - (sv-16 a0-40 a1-13 a2-5)) + (format (clear *temp-string*) "~D" (the int (-> s3-3 file s1-0 fuel-cell-count))) (s0-2 *temp-string* arg0 #f s4-1 22)) (set! (-> arg0 origin x) (the float (- 1 (-> this left-x-offset)))) (let ((s0-3 print-game-text)) - (set! sv-32 format) - (let ((a0-44 (clear *temp-string*)) - (a1-15 "~D") - (a2-7 (the int (-> s3-3 file s1-0 money-count)))) - (sv-32 a0-44 a1-15 a2-7)) + (format (clear *temp-string*) "~D" (the int (-> s3-3 file s1-0 money-count))) (s0-3 *temp-string* arg0 #f s4-1 22)) (set! (-> arg0 origin x) (the float (- 79 (-> this left-x-offset)))) (let ((s0-4 print-game-text)) - (set! sv-48 format) - (let ((a0-48 (clear *temp-string*)) - (a1-17 "~D") - (a2-9 (the int (-> s3-3 file s1-0 buzzer-count)))) - (sv-48 a0-48 a1-17 a2-9)) + (format (clear *temp-string*) "~D" (the int (-> s3-3 file s1-0 buzzer-count))) (s0-4 *temp-string* arg0 #f s4-1 22)) (+! (-> arg0 origin y) 1.0) - (let ((v1-108 arg0)) (set! (-> v1-108 scale) 1.0)) + (set-scale! arg0 1.0) (set! (-> arg0 flags) (font-flags shadow kerning right large)) (set! (-> arg0 origin x) (the float (- 352 (-> this left-x-offset)))) (let ((s0-5 print-game-text)) - (set! sv-64 format) - (let ((a0-52 (clear *temp-string*)) - (a1-19 "~D%") - (a2-11 (the int (-> s3-3 file s1-0 completion-percentage)))) - (sv-64 a0-52 a1-19 a2-11)) + (format (clear *temp-string*) "~D%" (the int (-> s3-3 file s1-0 completion-percentage))) (s0-5 *temp-string* arg0 #f s4-1 22)) - (let ((v1-116 arg0)) (set! (-> v1-116 scale) 0.5)) + (set-scale! arg0 0.5) (+! (-> arg0 origin y) 9.0) ;; og:preserve-this add 'middle' flag when custom-aspect to snap totals with counts (if (-> *pc-settings* use-vis?) @@ -481,37 +442,28 @@ ;; og:preserve-this when custom-aspect use same offsets from counts for totals (set! (-> arg0 origin x) (the float (- (if (-> *pc-settings* use-vis?) 85 -73) (-> this left-x-offset)))) (let ((s0-6 print-game-text)) - (set! sv-80 format) - (let ((a0-56 (clear *temp-string*)) - (a1-21 "/~D") - (a2-17 (if (< 100 (the int (-> s3-3 file s1-0 fuel-cell-count))) (-> this total-nb-of-power-cells) 100))) - (sv-80 a0-56 a1-21 a2-17)) + (let ((sv-80 format)) + (sv-80 (clear *temp-string*) + "/~D" + (if (< 100 (the int (-> s3-3 file s1-0 fuel-cell-count))) (-> this total-nb-of-power-cells) 100))) (s0-6 *temp-string* arg0 #f s4-1 22)) ;; og:preserve-this when custom-aspect use same offsets from counts for totals (set! (-> arg0 origin x) (the float (- (if (-> *pc-settings* use-vis?) 150 1) (-> this left-x-offset)))) (let ((s0-7 print-game-text)) - (set! sv-96 format) - (let ((a0-60 (clear *temp-string*)) - (a1-23 "/~D") - (a2-19 (-> this total-nb-of-orbs))) - (sv-96 a0-60 a1-23 a2-19)) + (format (clear *temp-string*) "/~D" (-> this total-nb-of-orbs)) (s0-7 *temp-string* arg0 #f s4-1 22)) ;; og:preserve-this when custom-aspect use same offsets from counts for totals (set! (-> arg0 origin x) (the float (- (if (-> *pc-settings* use-vis?) 238 79) (-> this left-x-offset)))) (let ((s0-8 print-game-text)) - (set! sv-112 format) - (let ((a0-64 (clear *temp-string*)) - (a1-25 "/~D") - (a2-21 (-> this total-nb-of-buzzers))) - (sv-112 a0-64 a1-25 a2-21)) + (format (clear *temp-string*) "/~D" (-> this total-nb-of-buzzers)) (s0-8 *temp-string* arg0 #f s4-1 22)) (+! (-> arg0 origin y) 15.0)) (else (+! (-> arg0 origin y) 18.0) (set! (-> arg0 origin x) (the float (- 28 (-> this left-x-offset)))) - (let ((v1-131 arg0)) (set! (-> v1-131 scale) 0.8)) + (set-scale! arg0 0.8) (set! (-> arg0 flags) (font-flags shadow kerning middle large)) - (let ((v1-133 arg0)) (set! (-> v1-133 width) (the float 350))) + (set-width! arg0 350) ;; og:preserve-this pc port stuff here, added YMD (case (scf-get-territory) ((GAME_TERRITORY_SCEA) @@ -552,7 +504,7 @@ (else (set! (-> this particles s2-0 init-pos x) -320.0) (+! (-> arg0 origin y) 12.0) - (let ((v1-173 arg0)) (set! (-> v1-173 scale) 0.7)) + (set-scale! arg0 0.7) (print-game-text (lookup-text! *common-text* (text-id empty) #f) arg0 #f s4-1 22) (+! (-> arg0 origin y) 29.0))) (+! s2-0 1))))) @@ -560,40 +512,40 @@ (none)) (defmethod draw-memcard-auto-save-error ((this progress) (arg0 font-context)) - (let ((v1-0 arg0)) (set! (-> v1-0 scale) 0.6)) + (set-scale! arg0 0.6) (set! (-> arg0 flags) (font-flags shadow kerning middle middle-vert large)) (set! (-> arg0 origin x) (the float (- 70 (-> this left-x-offset)))) (set! (-> arg0 origin y) 5.0) - (let ((v1-4 arg0)) (set! (-> v1-4 width) (the float 265))) - (let ((v1-5 arg0)) (set! (-> v1-5 height) (the float 35))) + (set-width! arg0 265) + (set-height! arg0 35) (print-game-text-scaled (lookup-text! *common-text* (text-id error-saving) #f) (-> this transition-percentage-invert) arg0 128) (set! (-> arg0 origin x) (the float (- 20 (-> this left-x-offset)))) (set! (-> arg0 origin y) 34.0) - (let ((v1-9 arg0)) (set! (-> v1-9 width) (the float 360))) - (let ((v1-10 arg0)) (set! (-> v1-10 height) (the float 50))) + (set-width! arg0 360) + (set-height! arg0 50) (let ((s4-1 print-game-text-scaled)) (format (clear *temp-string*) (lookup-text! *common-text* (text-id check-memcard) #f) 1) (s4-1 *temp-string* (-> this transition-percentage-invert) arg0 128)) (set! (-> arg0 origin y) 89.0) - (let ((v1-12 arg0)) (set! (-> v1-12 width) (the float 360))) - (let ((v1-13 arg0)) (set! (-> v1-13 height) (the float 20))) + (set-width! arg0 360) + (set-height! arg0 20) (print-game-text-scaled (lookup-text! *common-text* (text-id autosave-disabled-title) #f) (-> this transition-percentage-invert) arg0 128) (set! (-> arg0 origin y) 118.0) - (let ((v1-15 arg0)) (set! (-> v1-15 width) (the float 360))) - (let ((v1-16 arg0)) (set! (-> v1-16 height) (the float 60))) + (set-width! arg0 360) + (set-height! arg0 60) (print-game-text-scaled (lookup-text! *common-text* (text-id autosave-disabled-msg) #f) (-> this transition-percentage-invert) arg0 128) - (let ((v1-18 arg0)) (set! (-> v1-18 scale) 0.65)) + (set-scale! arg0 0.65) (set! (-> arg0 origin y) 160.0) - (let ((v1-19 arg0)) (set! (-> v1-19 height) (the float 60))) + (set-height! arg0 60) (print-game-text-scaled (lookup-text! *common-text* (text-id continue?) #f) (-> this transition-percentage-invert) arg0 @@ -602,33 +554,33 @@ (none)) (defmethod draw-memcard-removed ((this progress) (arg0 font-context)) - (let ((v1-0 arg0)) (set! (-> v1-0 scale) 0.6)) + (set-scale! arg0 0.6) (set! (-> arg0 flags) (font-flags shadow kerning middle middle-vert large)) (set! (-> arg0 origin x) (the float (- 70 (-> this left-x-offset)))) (set! (-> arg0 origin y) 10.0) - (let ((v1-4 arg0)) (set! (-> v1-4 width) (the float 265))) - (let ((v1-5 arg0)) (set! (-> v1-5 height) (the float 55))) + (set-width! arg0 265) + (set-height! arg0 55) (let ((s4-0 print-game-text-scaled)) (format (clear *temp-string*) (lookup-text! *common-text* (text-id memcard-removed) #f) 1) (s4-0 *temp-string* (-> this transition-percentage-invert) arg0 128)) (set! (-> arg0 origin x) (the float (- 20 (-> this left-x-offset)))) (set! (-> arg0 origin y) 78.0) - (let ((v1-9 arg0)) (set! (-> v1-9 width) (the float 360))) - (let ((v1-10 arg0)) (set! (-> v1-10 height) (the float 20))) + (set-width! arg0 360) + (set-height! arg0 20) (print-game-text-scaled (lookup-text! *common-text* (text-id autosave-disabled-title) #f) (-> this transition-percentage-invert) arg0 128) (set! (-> arg0 origin y) 112.0) - (let ((v1-12 arg0)) (set! (-> v1-12 width) (the float 360))) - (let ((v1-13 arg0)) (set! (-> v1-13 height) (the float 60))) + (set-width! arg0 360) + (set-height! arg0 60) (print-game-text-scaled (lookup-text! *common-text* (text-id autosave-disabled-msg) #f) (-> this transition-percentage-invert) arg0 128) - (let ((v1-15 arg0)) (set! (-> v1-15 scale) 0.65)) + (set-scale! arg0 0.65) (set! (-> arg0 origin y) 160.0) - (let ((v1-16 arg0)) (set! (-> v1-16 height) (the float 60))) + (set-height! arg0 60) (print-game-text-scaled (lookup-text! *common-text* (text-id continue?) #f) (-> this transition-percentage-invert) arg0 @@ -638,9 +590,9 @@ (defmethod draw-memcard-error ((this progress) (arg0 font-context)) (set! (-> arg0 origin y) 15.0) - (let ((v1-0 arg0)) (set! (-> v1-0 scale) 0.7)) - (let ((v1-1 arg0)) (set! (-> v1-1 width) (the float 265))) - (let ((v1-2 arg0)) (set! (-> v1-2 height) (the float 55))) + (set-scale! arg0 0.7) + (set-width! arg0 265) + (set-height! arg0 55) (set! (-> arg0 flags) (font-flags shadow kerning middle middle-vert large)) (let ((s4-0 (text-id error-loading))) (case (-> this display-state) @@ -652,14 +604,14 @@ (s3-0 *temp-string* (-> this transition-percentage-invert) arg0 128))) (set! (-> arg0 origin x) (the float (- 20 (-> this left-x-offset)))) (set! (-> arg0 origin y) 80.0) - (let ((v1-13 arg0)) (set! (-> v1-13 width) (the float 360))) - (let ((v1-14 arg0)) (set! (-> v1-14 height) (the float 70))) + (set-width! arg0 360) + (set-height! arg0 70) (let ((s4-1 print-game-text-scaled)) (format (clear *temp-string*) (lookup-text! *common-text* (text-id check-memcard-and-retry) #f) 1) (s4-1 *temp-string* (-> this transition-percentage-invert) arg0 128)) - (let ((v1-16 arg0)) (set! (-> v1-16 scale) 0.65)) + (set-scale! arg0 0.65) (set! (-> arg0 origin y) 155.0) - (let ((v1-17 arg0)) (set! (-> v1-17 height) (the float 60))) + (set-height! arg0 60) (print-game-text-scaled (lookup-text! *common-text* (text-id continue?) #f) (-> this transition-percentage-invert) arg0 @@ -670,9 +622,9 @@ (defmethod draw-auto-save ((this progress) (arg0 font-context)) (set! (-> arg0 origin x) (the float (- 35 (-> this left-x-offset)))) (set! (-> arg0 origin y) 18.0) - (let ((v1-2 arg0)) (set! (-> v1-2 scale) 0.6)) - (let ((v1-3 arg0)) (set! (-> v1-3 width) (the float 330))) - (let ((v1-4 arg0)) (set! (-> v1-4 height) (the float 60))) + (set-scale! arg0 0.6) + (set-width! arg0 330) + (set-height! arg0 60) (set! (-> arg0 flags) (font-flags shadow kerning middle middle-vert large)) (print-game-text-scaled (lookup-text! *common-text* (text-id autosave-warn-title) #f) (-> this transition-percentage-invert) @@ -680,15 +632,15 @@ 128) (set! (-> arg0 origin x) (the float (- 15 (-> this left-x-offset)))) (set! (-> arg0 origin y) 110.0) - (let ((v1-9 arg0)) (set! (-> v1-9 width) (the float 370))) - (let ((v1-10 arg0)) (set! (-> v1-10 height) (the float 60))) + (set-width! arg0 370) + (set-height! arg0 60) (print-game-text-scaled (lookup-text! *common-text* (text-id autosave-warn-msg) #f) (-> this transition-percentage-invert) arg0 128) - (let ((v1-12 arg0)) (set! (-> v1-12 scale) 0.65)) + (set-scale! arg0 0.65) (set! (-> arg0 origin y) 175.0) - (let ((v1-13 arg0)) (set! (-> v1-13 height) (the float 20))) + (set-height! arg0 20) (print-game-text-scaled (lookup-text! *common-text* (text-id continue?) #f) (-> this transition-percentage-invert) arg0 @@ -704,9 +656,9 @@ (defmethod draw-pal-change-to-60hz ((this progress) (arg0 font-context)) (set! (-> arg0 origin x) (the float (- 50 (-> this left-x-offset)))) (set! (-> arg0 origin y) 20.0) - (let ((v1-2 arg0)) (set! (-> v1-2 scale) 0.6)) - (let ((v1-3 arg0)) (set! (-> v1-3 width) (the float 300))) - (let ((v1-4 arg0)) (set! (-> v1-4 height) (the float 40))) + (set-scale! arg0 0.6) + (set-width! arg0 300) + (set-height! arg0 40) (set! (-> arg0 flags) (font-flags shadow kerning middle middle-vert large)) (print-game-text-scaled (lookup-text! *common-text* (text-id screen-change-to-60hz) #f) (-> this transition-percentage-invert) @@ -714,21 +666,21 @@ 128) (set! (-> arg0 origin x) (the float (- 15 (-> this left-x-offset)))) (set! (-> arg0 origin y) 60.0) - (let ((v1-9 arg0)) (set! (-> v1-9 width) (the float 370))) - (let ((v1-10 arg0)) (set! (-> v1-10 height) (the float 60))) + (set-width! arg0 370) + (set-height! arg0 60) (print-game-text-scaled (lookup-text! *common-text* (text-id screen-60hz-warn-support) #f) (-> this transition-percentage-invert) arg0 128) (set! (-> arg0 origin y) 120.0) - (let ((v1-12 arg0)) (set! (-> v1-12 height) (the float 50))) + (set-height! arg0 50) (print-game-text-scaled (lookup-text! *common-text* (text-id screen-60hz-warn-timer) #f) (-> this transition-percentage-invert) arg0 128) - (let ((v1-14 arg0)) (set! (-> v1-14 scale) 0.65)) + (set-scale! arg0 0.65) (set! (-> arg0 origin y) 175.0) - (let ((v1-15 arg0)) (set! (-> v1-15 height) (the float 20))) + (set-height! arg0 20) (print-game-text-scaled (lookup-text! *common-text* (text-id continue?) #f) (-> this transition-percentage-invert) arg0 @@ -739,9 +691,9 @@ (defmethod draw-no-disc ((this progress) (arg0 font-context)) (set! (-> arg0 origin x) (the float (- 50 (-> this left-x-offset)))) (set! (-> arg0 origin y) 50.0) - (let ((v1-2 arg0)) (set! (-> v1-2 scale) 0.6)) - (let ((v1-3 arg0)) (set! (-> v1-3 width) (the float 300))) - (let ((v1-4 arg0)) (set! (-> v1-4 height) (the float 40))) + (set-scale! arg0 0.6) + (set-width! arg0 300) + (set-height! arg0 40) (set! (-> arg0 flags) (font-flags shadow kerning middle middle-vert large)) (print-game-text-scaled (lookup-text! *common-text* (text-id no-disc-title) #f) (-> this transition-percentage-invert) @@ -749,16 +701,16 @@ 128) (set! (-> arg0 origin x) (the float (- 20 (-> this left-x-offset)))) (set! (-> arg0 origin y) 90.0) - (let ((v1-9 arg0)) (set! (-> v1-9 width) (the float 360))) - (let ((v1-10 arg0)) (set! (-> v1-10 height) (the float 60))) + (set-width! arg0 360) + (set-height! arg0 60) (print-game-text-scaled (lookup-text! *common-text* (text-id no-disc-msg) #f) (-> this transition-percentage-invert) arg0 128) (when (is-cd-in?) - (let ((v1-13 arg0)) (set! (-> v1-13 scale) 0.65)) + (set-scale! arg0 0.65) (set! (-> arg0 origin y) 155.0) - (let ((v1-14 arg0)) (set! (-> v1-14 height) (the float 20))) + (set-height! arg0 20) (print-game-text-scaled (lookup-text! *common-text* (text-id continue?) #f) (-> this transition-percentage-invert) arg0 @@ -769,9 +721,9 @@ (defmethod draw-bad-disc ((this progress) (arg0 font-context)) (set! (-> arg0 origin x) (the float (- 50 (-> this left-x-offset)))) (set! (-> arg0 origin y) 50.0) - (let ((v1-2 arg0)) (set! (-> v1-2 scale) 0.6)) - (let ((v1-3 arg0)) (set! (-> v1-3 width) (the float 300))) - (let ((v1-4 arg0)) (set! (-> v1-4 height) (the float 40))) + (set-scale! arg0 0.6) + (set-width! arg0 300) + (set-height! arg0 40) (set! (-> arg0 flags) (font-flags shadow kerning middle middle-vert large)) (print-game-text-scaled (lookup-text! *common-text* (text-id bad-disc-title) #f) (-> this transition-percentage-invert) @@ -779,15 +731,15 @@ 128) (set! (-> arg0 origin x) (the float (- 20 (-> this left-x-offset)))) (set! (-> arg0 origin y) 90.0) - (let ((v1-9 arg0)) (set! (-> v1-9 width) (the float 360))) - (let ((v1-10 arg0)) (set! (-> v1-10 height) (the float 60))) + (set-width! arg0 360) + (set-height! arg0 60) (print-game-text-scaled (lookup-text! *common-text* (text-id bad-disc-msg) #f) (-> this transition-percentage-invert) arg0 128) - (let ((v1-12 arg0)) (set! (-> v1-12 scale) 0.65)) + (set-scale! arg0 0.65) (set! (-> arg0 origin y) 155.0) - (let ((v1-13 arg0)) (set! (-> v1-13 height) (the float 20))) + (set-height! arg0 20) (print-game-text-scaled (lookup-text! *common-text* (text-id continue?) #f) (-> this transition-percentage-invert) arg0 @@ -798,9 +750,9 @@ (defmethod draw-quit ((this progress) (arg0 font-context)) (set! (-> arg0 origin x) (the float (- 50 (-> this left-x-offset)))) (set! (-> arg0 origin y) 70.0) - (let ((v1-2 arg0)) (set! (-> v1-2 scale) 0.6)) - (let ((v1-3 arg0)) (set! (-> v1-3 width) (the float 300))) - (let ((v1-4 arg0)) (set! (-> v1-4 height) (the float 40))) + (set-scale! arg0 0.6) + (set-width! arg0 300) + (set-height! arg0 40) (set! (-> arg0 flags) (font-flags shadow kerning middle middle-vert large)) (print-game-text-scaled (lookup-text! *common-text* (text-id quit?) #f) (-> this transition-percentage-invert) arg0 128) 0 @@ -809,16 +761,16 @@ (defmethod draw-pal-now-60hz ((this progress) (arg0 font-context)) (set! (-> arg0 origin x) (the float (- 50 (-> this left-x-offset)))) (set! (-> arg0 origin y) 45.0) - (let ((v1-2 arg0)) (set! (-> v1-2 scale) 0.6)) - (let ((v1-3 arg0)) (set! (-> v1-3 width) (the float 300))) - (let ((v1-4 arg0)) (set! (-> v1-4 height) (the float 50))) + (set-scale! arg0 0.6) + (set-width! arg0 300) + (set-height! arg0 50) (set! (-> arg0 flags) (font-flags shadow kerning middle middle-vert large)) (print-game-text-scaled (lookup-text! *common-text* (text-id screen-now-60hz) #f) (-> this transition-percentage-invert) arg0 128) (set! (-> arg0 origin y) 95.0) - (let ((v1-7 arg0)) (set! (-> v1-7 height) (the float 50))) + (set-height! arg0 50) (print-game-text-scaled (lookup-text! *common-text* (text-id screen-60hz-keep?) #f) (-> this transition-percentage-invert) arg0 @@ -1085,14 +1037,14 @@ 0.0 (font-color default) (font-flags shadow kerning)))) - (let ((v1-29 s4-2)) (set! (-> v1-29 width) (the float 100))) - (let ((v1-30 s4-2)) (set! (-> v1-30 height) (the float 15))) - (let ((v1-31 s4-2)) (set! (-> v1-31 scale) 0.5)) + (set-width! s4-2 100) + (set-height! s4-2 15) + (set-scale! s4-2 0.5) (set! (-> s4-2 flags) (font-flags shadow kerning large)) (print-game-text (lookup-text! *common-text* (text-id options) #f) s4-2 #f 128 22) - (let ((v1-34 s4-2)) (set! (-> v1-34 width) (the float 160))) - (let ((v1-35 s4-2)) (set! (-> v1-35 height) (the float 22))) - (let ((v1-36 s4-2)) (set! (-> v1-36 scale) 1.3)) + (set-width! s4-2 160) + (set-height! s4-2 22) + (set-scale! s4-2 1.3) (let ((a0-31 s4-2)) (set! (-> a0-31 color) (font-color progress-percent))) (set! (-> s4-2 origin x) (+ (- 435.0 (the float (if (< (-> *progress-process* 0 completion-percentage) 10.0) 93 80))) f30-0)) diff --git a/goal_src/jak1/engine/ui/progress/progress.gc b/goal_src/jak1/engine/ui/progress/progress.gc index ffba0c1920..1ff70d3576 100644 --- a/goal_src/jak1/engine/ui/progress/progress.gc +++ b/goal_src/jak1/engine/ui/progress/progress.gc @@ -32,8 +32,8 @@ (movie?) (handle->process (-> *game-info* pov-camera-handle)) (handle->process (-> *game-info* other-camera-handle)) - (< (-> *display* base-frame-counter) (-> *game-info* letterbox-time)) - (< (-> *display* base-frame-counter) (-> *game-info* blackout-time)) + (< (current-time) (-> *game-info* letterbox-time)) + (< (current-time) (-> *game-info* blackout-time)) (!= (-> *setting-control* current bg-a) 0.0) (!= (-> *setting-control* current bg-a-force) 0.0) (not (-> *setting-control* current allow-progress)) @@ -43,7 +43,7 @@ (= *cheat-mode* 'camera))))) (defun pause-allowed? () - (not (or (< (-> *display* base-frame-counter) (-> *game-info* blackout-time)) + (not (or (< (current-time) (-> *game-info* blackout-time)) (!= (-> *setting-control* current bg-a) 0.0) (!= (-> *setting-control* current bg-a-force) 0.0) (not (-> *setting-control* current allow-pause)) @@ -229,6 +229,7 @@ (define *progress-save-info* (new 'global 'mc-slot-info)) +;; og:preserve-this (defmacro progress-make-icon (this &key skel &key x &key y &key z &key scale-x &key scale-y) `(when (< (-> ,this nb-of-icons) 6) (let ((icon-idx (-> ,this nb-of-icons))) @@ -410,6 +411,7 @@ (define *progress-stack* (the-as (pointer uint8) (malloc 'global #x3800))) +;; og:preserve-this (defconstant *progress-stack-top* (&-> *progress-stack* #x3800)) (defun activate-progress ((creator process) (screen progress-screen)) @@ -421,6 +423,7 @@ (make-levels-with-tasks-available-to-progress) (disable-level-text-file-loading) (set! (-> *progress-state* starting-state) screen) + ;; og:preserve-this (set! *progress-process* (process-spawn progress :to creator :stack *progress-stack-top*)) (let ((s5-1 *progress-process*)) (set! (-> s5-1 0 completion-percentage) (calculate-completion (-> s5-1 0))) @@ -485,18 +488,18 @@ 0 (none)) -(defmethod relocate ((this game-count-info) (arg0 int)) +(defmethod relocate ((this game-count-info) (offset int)) "Load in the game-count-info. This is a bit of a hack." (set! *game-counts* this) this) -(defmethod relocate ((this progress) (arg0 int)) +(defmethod relocate ((this progress) (offset int)) (dotimes (v1-0 (-> this nb-of-particles)) (when (-> this particles v1-0 part) (if (nonzero? (-> this particles v1-0 part)) (set! (-> this particles v1-0 part) - (the-as sparticle-launch-control (&+ (the-as pointer (-> this particles v1-0 part)) arg0)))))) - (the-as progress ((method-of-type process relocate) this arg0))) + (the-as sparticle-launch-control (&+ (the-as pointer (-> this particles v1-0 part)) offset)))))) + (the-as progress ((method-of-type process relocate) this offset))) (defmethod adjust-sprites ((this progress)) (let ((f0-1 (* (1/ METER_LENGTH) (the float (-> this in-out-position))))) @@ -998,7 +1001,7 @@ (set! (-> (the-as (pointer float) (-> s5-0 (-> this option-index) value-to-modify))) (-> *progress-state* slider-backup))) (((game-option-type language)) - (set! (-> (the-as (pointer language-enum) (-> s5-0 (-> this option-index) value-to-modify))) + (set! (-> (the-as (pointer language-enum) (-> s5-0 (-> this option-index) value-to-modify)) 0) (-> *progress-state* language-backup))) (((game-option-type on-off)) (set! (-> (the-as (pointer symbol) (-> s5-0 (-> this option-index) value-to-modify)) 0) @@ -1157,7 +1160,7 @@ (sound-volume-off) (set! (-> *game-info* mode) 'play) (cond - ;; Start a new game differently if speedrunning mode is active + ;; og:preserve-this start a new game differently if speedrunning mode is active ((= (-> *pc-settings* speedrunner-mode?) #t) (speedrun-start-full-game-run)) ;; start the game normally (else @@ -1356,8 +1359,8 @@ (the-as float 8325000.0) (font-color progress-blue) (font-flags shadow kerning)))) - (let ((v1-103 s5-1)) (set! (-> v1-103 width) (the float 328))) - (let ((v1-104 s5-1)) (set! (-> v1-104 height) (the float 45))) + (set-width! s5-1 328) + (set-height! s5-1 45) (set! (-> s5-1 flags) (font-flags shadow kerning middle middle-vert large)) (print-game-text-scaled (lookup-text! *common-text* (-> gp-0 level-name-id) #f) f30-0 s5-1 (the int (* 128.0 f30-0))))))) (case (-> self display-state) @@ -1523,9 +1526,9 @@ (bucket-id debug) gp-3 (the-as (pointer dma-tag) a3-10)))) - (let ((gp-4 (new 'stack 'font-context *font-default-matrix* 32 50 0.0 (font-color default) (font-flags shadow kerning)))) - (let ((v1-42 gp-4)) (set! (-> v1-42 width) (the float 328))) - (let ((v1-43 gp-4)) (set! (-> v1-43 height) (the float 100))) + (let ((gp-4 (new 'stack 'font-context *font-default-matrix* 32 50 (the-as float 0.0) (font-color default) (font-flags shadow kerning)))) + (set-width! gp-4 328) + (set-height! gp-4 100) (logior! (-> gp-4 flags) (font-flags shadow kerning large)) (draw-debug-text-box gp-4) (print-game-text (-> *common-text* data (-> self current-debug-string) text) gp-4 #f 128 22)))) diff --git a/goal_src/jak1/engine/util/capture.gc b/goal_src/jak1/engine/util/capture.gc index c1df875b54..43b4a6cfe7 100644 --- a/goal_src/jak1/engine/util/capture.gc +++ b/goal_src/jak1/engine/util/capture.gc @@ -57,7 +57,6 @@ (defun store-image ((oddeven int)) "Store an image to image.raw" - (local-vars (ptr-1 (pointer uint128)) (y-idx int) (y-idx-2 int)) (let ((width 512) (height (-> *video-parms* screen-sy)) (file (new 'debug 'file-stream "image.raw" 'write))) @@ -77,21 +76,21 @@ (gs-store-image packet (-> buff1 data))) ;; wait for capture to complete. (sync-path 0 0) - (let ((ptr-0 (-> buff0 data))) - (set! ptr-1 (-> buff1 data)) + (let ((ptr-0 (-> buff0 data)) + (ptr-1 (-> buff1 data))) (cond ((zero? oddeven) - (set! y-idx 0) - (while (< y-idx height) - (file-stream-write file (&+ ptr-0 (* y-idx (* width 4))) (the-as uint (* width 4))) - (file-stream-write file (&+ ptr-1 (* y-idx (* width 4))) (the-as uint (* width 4))) - (set! y-idx (+ y-idx 1)))) + (let ((y-idx 0)) + (while (< y-idx height) + (file-stream-write file (&+ ptr-0 (* y-idx (* width 4))) (the-as uint (* width 4))) + (file-stream-write file (&+ ptr-1 (* y-idx (* width 4))) (the-as uint (* width 4))) + (+! y-idx 1)))) (else - (set! y-idx-2 0) - (while (< y-idx-2 height) - (file-stream-write file (&+ ptr-1 (* y-idx-2 (* width 4))) (the-as uint (* width 4))) - (file-stream-write file (&+ ptr-0 (* y-idx-2 (* width 4))) (the-as uint (* width 4))) - (set! y-idx-2 (+ y-idx-2 1)))))) + (let ((y-idx-2 0)) + (while (< y-idx-2 height) + (file-stream-write file (&+ ptr-1 (* y-idx-2 (* width 4))) (the-as uint (* width 4))) + (file-stream-write file (&+ ptr-0 (* y-idx-2 (* width 4))) (the-as uint (* width 4))) + (+! y-idx-2 1)))))) (format #t "oddeven = ~d~%" oddeven) ;; this does nothing. (delete buff1)) diff --git a/goal_src/jak1/engine/util/sync-info.gc b/goal_src/jak1/engine/util/sync-info.gc index 98dc0bf8f1..ee4f53093e 100644 --- a/goal_src/jak1/engine/util/sync-info.gc +++ b/goal_src/jak1/engine/util/sync-info.gc @@ -39,7 +39,7 @@ (let* ((total-normal-phase (- 1.0 total-easing-phase)) (f0-10 out-param) (f1-12 (+ out-param total-normal-phase)) - (f2-5 (* f0-10 f0-10)) + (f2-5 (square f0-10)) (f3-3 (+ (* 2.0 f0-10 (- f1-12 f0-10)) f2-5)) (f4-3 (/ f0-10 (- 1.0 f1-12))) (y-end (+ (* (- 1.0 f1-12) (- 1.0 f1-12) f4-3) f3-3))) @@ -74,9 +74,8 @@ (defmethod load-params! ((this sync-info) (proc process) (default-period uint) (default-phase float) (default-out float) (default-in float)) "Load params from the res of a process, and set them up. If the res lookup fails, returns #f and uses the specified defaults." - (local-vars (sv-16 res-tag)) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-1 (res-lump-data (-> proc entity) 'sync pointer :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-1 (res-lump-data (-> proc entity) 'sync pointer :tag-ptr (& sv-16)))) (cond (v1-1 ;; res lookup succeeded, we should have two values: a period (not yet in seconds) and a phase. @@ -94,9 +93,8 @@ (defmethod load-params! ((this sync-info-eased) (proc process) (default-period uint) (default-phase float) (default-out float) (default-in float)) "Load settings from a res. Can load settings from just a sync-info and uses defaults. If res lookup totally fails, will return #f and use all defaults." - (local-vars (sv-16 res-tag)) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-1 (res-lump-data (-> proc entity) 'sync pointer :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-1 (res-lump-data (-> proc entity) 'sync pointer :tag-ptr (& sv-16)))) (cond (v1-1 ;; we may not get all the parameters @@ -116,9 +114,8 @@ (defmethod load-params! ((this sync-info-paused) (proc process) (default-period uint) (default-phase float) (default-out float) (default-in float)) "Load and setup a sync-info-paused." - (local-vars (sv-16 res-tag)) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-1 (res-lump-data (-> proc entity) 'sync pointer :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-1 (res-lump-data (-> proc entity) 'sync pointer :tag-ptr (& sv-16)))) (cond (v1-1 (if (>= (-> sv-16 elt-count) (the-as uint 4)) @@ -286,7 +283,7 @@ max-times-two: maximum range. result is centered around zero." (set! (-> this min-time) min-tim) (set! (-> this max-time) max-time) - (set! (-> this max-val) (* 0.5 max-times-two)) + (set! (-> this max-val) (/ max-times-two 2)) (set! (-> this start-time) 0) (set! (-> this timer) 0) (set! (-> this value) 0.0) @@ -383,8 +380,8 @@ y-range: y results in (-range/2, range/2)" (set! (-> this min-time) min-time) (set! (-> this max-time) max-time) - (set! (-> this xz-max) (* 0.5 xz-range)) - (set! (-> this y-max) (* 0.5 y-range)) + (set! (-> this xz-max) (/ xz-range 2)) + (set! (-> this y-max) (/ y-range 2)) (set! (-> this start-time) 0) (set! (-> this timer) 0) (vector-reset! (-> this value)) diff --git a/goal_src/jak1/levels/beach/beach-obs.gc b/goal_src/jak1/levels/beach/beach-obs.gc index 1e9d666585..709ef47252 100644 --- a/goal_src/jak1/levels/beach/beach-obs.gc +++ b/goal_src/jak1/levels/beach/beach-obs.gc @@ -473,7 +473,6 @@ (set-time! (-> self state-time))) :code (behavior ((arg0 symbol)) - (local-vars (sv-128 symbol)) (ja-channel-set! 0) (clear-collide-with-as (-> self root)) (ja-post) @@ -497,7 +496,7 @@ (f1-2 (- (-> s5-1 z) (-> v1-14 z))) (f2-1 7372.8) (f30-0 5734.4) - (f2-2 (/ f2-1 (sqrtf (+ (* f0-1 f0-1) (* f1-2 f1-2))))) + (f2-2 (/ f2-1 (sqrtf (+ (square f0-1) (square f1-2))))) (f28-0 (* f0-1 f2-2)) (f26-0 (* f1-2 f2-2)) (s4-0 (new-stack-vector0)) @@ -525,20 +524,20 @@ (vector-float*! s3-0 s3-0 10.0) (spawn-flying-rock s4-0 s3-0 1.0 (-> self entity)))) (when (or (-> self link prev) (-> self link next)) - (set! sv-128 (the-as symbol #f)) - (apply-all (-> self link) actor-link-subtask-complete-hook (& sv-128)) - (when sv-128 - (suspend-for (seconds 0.5)) - (let ((gp-1 (cond - (arg0 (the-as int #f)) - (else - (ambient-hint-spawn "gamcam10" (the-as vector #f) *entity-pool* 'camera) - (ppointer->handle (process-spawn pov-camera (-> self root trans) *beachcam-sg* (-> self name) 0 #f '() :to self)))))) - (process-drawable-birth-fuel-cell (the-as entity #f) (the-as vector #f) #f) - (while (handle->process (the-as handle gp-1)) - (suspend))) - (while (-> self child) - (suspend)))) + (let ((sv-128 (the-as symbol #f))) + (apply-all (-> self link) actor-link-subtask-complete-hook (& sv-128)) + (when sv-128 + (suspend-for (seconds 0.5)) + (let ((gp-1 (cond + (arg0 (the-as int #f)) + (else + (ambient-hint-spawn "gamcam10" (the-as vector #f) *entity-pool* 'camera) + (ppointer->handle (process-spawn pov-camera (-> self root trans) *beachcam-sg* (-> self name) 0 #f '() :to self)))))) + (process-drawable-birth-fuel-cell (the-as entity #f) (the-as vector #f) #f) + (while (handle->process (the-as handle gp-1)) + (suspend))) + (while (-> self child) + (suspend))))) (process-entity-status! self (entity-perm-status dead) #t) (deactivate self))) diff --git a/goal_src/jak1/levels/citadel/citadel-obs.gc b/goal_src/jak1/levels/citadel/citadel-obs.gc index fadff1cc9f..d5f4443ff0 100644 --- a/goal_src/jak1/levels/citadel/citadel-obs.gc +++ b/goal_src/jak1/levels/citadel/citadel-obs.gc @@ -559,7 +559,6 @@ (defstate citb-robotboss-idle (citb-robotboss) :event (behavior ((proc process) (argc int) (message symbol) (block event-message-block)) - (local-vars (sv-96 int) (sv-112 int)) (the-as symbol (cond ((= message 'shield-off) @@ -570,15 +569,7 @@ ((= message 'shield-on) (let ((v0-3 #t)) (set! (-> self shield-on) v0-3) v0-3)) ((= message 'die) (cleanup-for-death self) (the-as symbol (deactivate self))) ((or (= message 'touch) (= message 'attack)) - (let ((s4-0 sound-play-by-name) - (s3-0 (make-u128 #x7061 (the-as uint #x7a2d646c65696873))) - (s2-0 (new-sound-id)) - (s1-0 1024) - (s0-0 0)) - (set! sv-96 0) - (set! sv-112 1) - (let ((t2-1 (target-pos 0))) - (s4-0 (the-as sound-name s3-0) s2-0 s1-0 s0-0 sv-96 (the-as sound-group sv-112) (the-as symbol t2-1)))) + (sound-play "shield-zap" :position (the-as symbol (target-pos 0))) (the-as symbol (send-event proc 'shove (-> block param 0) (static-attack-info ((shove-up (meters 2)) (shove-back (meters 3)))))))))) :code diff --git a/goal_src/jak1/levels/citadel/citadel-part.gc b/goal_src/jak1/levels/citadel/citadel-part.gc index 5094a16066..0da8e46e4b 100644 --- a/goal_src/jak1/levels/citadel/citadel-part.gc +++ b/goal_src/jak1/levels/citadel/citadel-part.gc @@ -538,7 +538,7 @@ (set! (-> v1-3 x) f0-13) (set! (-> v1-3 y) f1-4) (set! (-> v1-3 z) f2-0) - (set! (-> v1-3 w) (sqrtf (- (- (- 1.0 (* f2-0 f2-0)) (* f1-4 f1-4)) (* f0-13 f0-13))))) + (set! (-> v1-3 w) (sqrtf (- (- (- 1.0 (square f2-0)) (square f1-4)) (square f0-13))))) (quaternion-rotate-y! (the-as quaternion s5-0) (the-as quaternion s5-0) (+ 16384.0 f30-0)) (cond ((< (-> s5-0 w) 0.0) diff --git a/goal_src/jak1/levels/citadel/citb-drop-plat.gc b/goal_src/jak1/levels/citadel/citb-drop-plat.gc index 3f8b131de8..16afb171bb 100644 --- a/goal_src/jak1/levels/citadel/citb-drop-plat.gc +++ b/goal_src/jak1/levels/citadel/citb-drop-plat.gc @@ -123,8 +123,7 @@ (set! (-> gp-0 quad) (-> self root trans quad)) (set! (-> gp-0 y) (-> (the-as process-drawable (-> self parent 0)) root trans y)) (loop - (let ((f0-6 (fmax 0.0 (- 1.0 (* 0.0033333334 (the float (- (current-time) (-> self state-time)))))))) - (set! (-> self interp) (* f0-6 f0-6))) + (set! (-> self interp) (square (fmax 0.0 (- 1.0 (* 0.0033333334 (the float (- (current-time) (-> self state-time)))))))) (set! (-> self root trans y) (- (-> (the-as process-drawable (-> self parent 0)) root trans y) (* 204800.0 (-> self interp)))) (when (and (not s5-0) (< (-> self interp) 0.05)) @@ -204,9 +203,7 @@ (s5-0 (new 'stack-no-clear 'vector)) (s4-0 (new 'stack-no-clear 'vector))) (set! (-> s3-0 x) (* 65536.0 (rand-vu))) - (let ((f30-1 14563.556) - (f0-2 (rand-vu-float-range -1.0 1.0))) - (set! (-> s3-0 y) (* f30-1 (* f0-2 f0-2)))) + (set! (-> s3-0 y) (* 14563.556 (square (rand-vu-float-range -1.0 1.0)))) (vector-sincos! s5-0 s4-0 s3-0) (set! (-> this spin-axis x) (* (-> s4-0 y) (-> s4-0 x))) (set! (-> this spin-axis y) (-> s5-0 y)) @@ -259,7 +256,7 @@ (the-as citb-drop-plat ((method-of-type process-drawable relocate) this offset))) (defbehavior citb-drop-plat-spawn-children citb-drop-plat () - (local-vars (s0-0 int) (sv-48 process) (sv-64 int)) + (local-vars (s0-0 int)) (let ((gp-0 (new 'stack-no-clear 'vector))) 6 0 @@ -276,19 +273,19 @@ (vector+*! gp-0 gp-0 (-> self z-dir) (* (-> self z-spacing) (the float s5-0))) (if (-> self child-color-array) (set! s0-0 (-> self child-color-array s1-0)) (set! s0-0 (rand-vu-int-range 0 5))) (when (nonzero? s0-0) - (set! sv-64 (the int (* 150.0 (rand-vu)))) - (set! sv-48 (get-process *default-dead-pool* drop-plat #x4000)) - (set! (-> self child-array data s1-0) - (ppointer->handle (when sv-48 - (let ((t9-6 (method-of-type drop-plat activate))) - (t9-6 (the-as drop-plat sv-48) self 'drop-plat (the-as pointer #x70004000))) - (let ((t9-7 run-function-in-process) - (a0-8 sv-48) - (a1-5 drop-plat-init-by-other) - (a2-4 gp-0) - (t0-0 (-> self duration))) - ((the-as (function process function vector int int int none) t9-7) a0-8 a1-5 a2-4 sv-64 (the-as int t0-0) s0-0)) - (-> sv-48 ppointer))))))) + (let ((sv-64 (the int (* 150.0 (rand-vu)))) + (sv-48 (get-process *default-dead-pool* drop-plat #x4000))) + (set! (-> self child-array data s1-0) + (ppointer->handle (when sv-48 + ((method-of-type drop-plat activate) (the-as drop-plat sv-48) self 'drop-plat (the-as pointer #x70004000)) + ((the-as (function process function vector int int int none) run-function-in-process) + sv-48 + drop-plat-init-by-other + gp-0 + sv-64 + (the-as int (-> self duration)) + s0-0) + (-> sv-48 ppointer)))))))) (suspend-for (seconds 0.12)) (+! s5-0 s4-0)))) (set-time! (-> self drop-time)) diff --git a/goal_src/jak1/levels/citadel/citb-plat.gc b/goal_src/jak1/levels/citadel/citb-plat.gc index a69903bbe8..604d134bd9 100644 --- a/goal_src/jak1/levels/citadel/citb-plat.gc +++ b/goal_src/jak1/levels/citadel/citb-plat.gc @@ -234,7 +234,7 @@ (when (< f30-0 0.0) (set! (-> self root trans y) (-> self rise-height)) (go-virtual citb-base-plat-active)) - (set! (-> self root trans y) (lerp (-> self rise-height) (-> self idle-height) (* f30-0 f30-0)))) + (set! (-> self root trans y) (lerp (-> self rise-height) (-> self idle-height) (square f30-0)))) (let ((f0-12 (fmax 0.0 (fmin 1.0 (* 0.000012207031 (+ 409600.0 (-> self root trans y))))))) (set! (-> self draw color-mult x) f0-12) (set! (-> self draw color-mult y) f0-12) @@ -770,7 +770,7 @@ (when (< f30-0 0.0) (set! (-> self root trans y) (-> self rise-height)) (go-virtual plat-button-idle)) - (set! (-> self root trans y) (lerp (-> self rise-height) (-> self idle-height) (* f30-0 f30-0)))) + (set! (-> self root trans y) (lerp (-> self rise-height) (-> self idle-height) (square f30-0)))) (suspend))) :post rider-post) diff --git a/goal_src/jak1/levels/common/battlecontroller.gc b/goal_src/jak1/levels/common/battlecontroller.gc index a15f5103fd..8838912585 100644 --- a/goal_src/jak1/levels/common/battlecontroller.gc +++ b/goal_src/jak1/levels/common/battlecontroller.gc @@ -390,7 +390,6 @@ battlecontroller-default-event-handler (none))) (defmethod battlecontroller-method-27 ((this battlecontroller)) - (local-vars (sv-16 res-tag)) (set! (-> this fact) (new 'process 'fact-info this (pickup-type eco-pill-random) (-> *FACT-bank* default-pill-inc))) (set! (-> this path) (new 'process 'path-control this 'path 0.0)) (logior! (-> this path flags) (path-control-flag display draw-line draw-point draw-text)) @@ -439,8 +438,8 @@ battlecontroller-default-event-handler (set! (-> this creature-type-array 0 type2) babak) (set! (-> this creature-type-array 0 percent) 1.0) (let ((s5-3 0)) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-49 (res-lump-data (-> this entity) 'lurker-type pointer :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-49 (res-lump-data (-> this entity) 'lurker-type pointer :tag-ptr (& sv-16)))) (when v1-49 (dotimes (a0-22 (the-as int (-> sv-16 elt-count))) (let ((a1-15 (-> (the-as (pointer uint32) (&+ v1-49 (* a0-22 4)))))) diff --git a/goal_src/jak1/levels/demo/static-screen.gc b/goal_src/jak1/levels/demo/static-screen.gc index 71a44ee0e9..9e4dc57f19 100644 --- a/goal_src/jak1/levels/demo/static-screen.gc +++ b/goal_src/jak1/levels/demo/static-screen.gc @@ -12,15 +12,16 @@ (state-time time-frame)) (:state-methods (idle int time-frame symbol))) -(defmethod relocate ((this static-screen) (arg0 int)) + +(defmethod relocate ((this static-screen) (offset int)) (let ((v1-0 *kernel-context*)) (set! (-> v1-0 relocating-process) this) (set! (-> v1-0 relocating-min) (the-as int (&-> this type))) (set! (-> v1-0 relocating-max) (the-as int (+ (+ (-> this allocated-length) -4 (-> process size)) (the-as int this)))) - (set! (-> v1-0 relocating-offset) arg0)) + (set! (-> v1-0 relocating-offset) offset)) (dotimes (v1-2 1) - (if (nonzero? (-> this part v1-2)) (&+! (-> this part v1-2) arg0))) - (the-as static-screen ((method-of-type process relocate) this arg0))) + (if (nonzero? (-> this part v1-2)) (&+! (-> this part v1-2) offset))) + (the-as static-screen ((method-of-type process relocate) this offset))) (defmethod deactivate ((this static-screen)) (dotimes (s5-0 1) diff --git a/goal_src/jak1/levels/finalboss/final-door.gc b/goal_src/jak1/levels/finalboss/final-door.gc index 46116fd1ac..5c0d6d41ea 100644 --- a/goal_src/jak1/levels/finalboss/final-door.gc +++ b/goal_src/jak1/levels/finalboss/final-door.gc @@ -244,7 +244,6 @@ (set-letterbox-frames (seconds 0.017))) :code (behavior ((arg0 basic) (arg1 handle)) - (local-vars (sv-144 process) (sv-160 vector) (sv-176 process) (sv-192 vector)) (let ((a0-2 (get-task-control (game-task finalboss-movies)))) (save-reminder a0-2 (logior (get-reminder a0-2 0) 2) 0)) (move-to-point! (-> self control) (new 'static 'vector :x 11368946.0 :y 2215900.2 :z -19405602.0 :w 1.0)) (set-quaternion! (-> self control) (the-as quaternion (new 'static 'vector :y -0.8472 :w 0.5312))) @@ -259,24 +258,22 @@ (s3-1 (vector<-cspace! (new 'stack-no-clear 'vector) (joint-node eichar-lod0-jg neckB)))) (dotimes (s2-0 50) (when (handle->process (the-as handle arg0)) - (let ((s1-0 (handle->process (the-as handle arg0))) - (s0-0 (+ s2-0 4))) - (set! sv-160 (vector<-cspace! (new 'stack-no-clear 'vector) (-> (the-as process-drawable s1-0) node-list data s0-0))) - (set! sv-144 (get-process *default-dead-pool* powercellalt #x4000)) + (let* ((s1-0 (handle->process (the-as handle arg0))) + (s0-0 (+ s2-0 4)) + (sv-160 (vector<-cspace! (new 'stack-no-clear 'vector) (-> (the-as process-drawable s1-0) node-list data s0-0))) + (sv-144 (get-process *default-dead-pool* powercellalt #x4000))) (when sv-144 - (let ((t9-16 (method-of-type powercellalt activate))) - (t9-16 (the-as powercellalt sv-144) s1-0 'powercellalt (the-as pointer #x70004000))) + ((method-of-type powercellalt activate) (the-as powercellalt sv-144) s1-0 'powercellalt (the-as pointer #x70004000)) (run-now-in-process sv-144 powercellalt-init-by-other s4-3 s3-1 sv-160 s0-0) (-> sv-144 ppointer)))) (suspend-for (seconds 0.1)) (when (handle->process arg1) - (let ((s1-2 (handle->process arg1)) - (s0-1 (+ s2-0 4))) - (set! sv-192 (vector<-cspace! (new 'stack-no-clear 'vector) (-> (the-as process-drawable s1-2) node-list data s0-1))) - (set! sv-176 (get-process *default-dead-pool* powercellalt #x4000)) + (let* ((s1-2 (handle->process arg1)) + (s0-1 (+ s2-0 4)) + (sv-192 (vector<-cspace! (new 'stack-no-clear 'vector) (-> (the-as process-drawable s1-2) node-list data s0-1))) + (sv-176 (get-process *default-dead-pool* powercellalt #x4000))) (when sv-176 - (let ((t9-20 (method-of-type powercellalt activate))) - (t9-20 (the-as powercellalt sv-176) s1-2 'powercellalt (the-as pointer #x70004000))) + ((method-of-type powercellalt activate) (the-as powercellalt sv-176) s1-2 'powercellalt (the-as pointer #x70004000)) (run-now-in-process sv-176 powercellalt-init-by-other s4-3 s3-1 sv-192 s0-1) (-> sv-176 ppointer)))) (suspend-for (seconds 0.1)))) diff --git a/goal_src/jak1/levels/finalboss/robotboss-weapon.gc b/goal_src/jak1/levels/finalboss/robotboss-weapon.gc index a8aafbe67b..de46c89568 100644 --- a/goal_src/jak1/levels/finalboss/robotboss-weapon.gc +++ b/goal_src/jak1/levels/finalboss/robotboss-weapon.gc @@ -25,7 +25,7 @@ (vector-flatten! s5-0 gp-0 (-> this axis)) (vector-normalize! s5-0 (-> this radius-primary)) (vector-! arg1 gp-0 s5-0) - (< (vector-length-squared arg1) (* f30-0 f30-0)))) + (< (vector-length-squared arg1) (square f30-0)))) (defmethod torus-method-11 ((this torus) (arg0 vector)) (let ((s4-0 (the-as collide-shape-prim-group (-> *target* control root-prim)))) @@ -43,7 +43,6 @@ (defmethod torus-method-9 ((this torus) (arg0 vector)) - (local-vars (sv-256 int) (sv-272 int) (sv-288 int)) (let ((s0-0 (new 'stack-no-clear 'vector)) (s4-0 (new 'stack-no-clear 'vector)) (s3-0 (new 'stack-no-clear 'vector)) @@ -55,30 +54,27 @@ (vector-cross! s4-0 s0-0 (-> this axis)) (matrix-axis-angle! s2-0 s4-0 8192.0) (vector-float*! (-> s1-0 0) s0-0 (-> this radius-secondary)) - (set! sv-256 0) - (while (< sv-256 7) - (vector-matrix*! (-> s1-0 (+ sv-256 1)) (-> s1-0 sv-256) s2-0) - (set! sv-256 (+ sv-256 1))) + (let ((sv-256 0)) (while (< sv-256 7) (vector-matrix*! (-> s1-0 (+ sv-256 1)) (-> s1-0 sv-256) s2-0) (+! sv-256 1))) (vector-float*! s0-0 s0-0 (-> this radius-primary)) (dotimes (v1-21 8) (vector+! (-> s1-0 v1-21) (-> s1-0 v1-21) s0-0)) (matrix-axis-angle! s2-0 (-> this axis) 4096.0) (dotimes (s0-1 16) - (set! sv-272 0) - (while (< sv-272 7) - (vector+! s4-0 (-> s1-0 sv-272) (-> this origin)) - (vector+! s3-0 (-> s1-0 (+ sv-272 1)) (-> this origin)) - (camera-line s4-0 s3-0 (the-as vector4w arg0)) - (set! sv-272 (+ sv-272 1))) + (let ((sv-272 0)) + (while (< sv-272 7) + (vector+! s4-0 (-> s1-0 sv-272) (-> this origin)) + (vector+! s3-0 (-> s1-0 (+ sv-272 1)) (-> this origin)) + (camera-line s4-0 s3-0 (the-as vector4w arg0)) + (+! sv-272 1))) (vector+! s4-0 (-> s1-0 0) (-> this origin)) (camera-line s4-0 s3-0 (the-as vector4w arg0)) - (set! sv-288 0) - (while (< sv-288 8) - (vector+! s4-0 (-> s1-0 sv-288) (-> this origin)) - (vector-matrix*! (-> s1-0 sv-288) (-> s1-0 sv-288) s2-0) - (vector+! s3-0 (-> s1-0 sv-288) (-> this origin)) - (camera-line s4-0 s3-0 (the-as vector4w arg0)) - (set! sv-288 (+ sv-288 1))))) + (let ((sv-288 0)) + (while (< sv-288 8) + (vector+! s4-0 (-> s1-0 sv-288) (-> this origin)) + (vector-matrix*! (-> s1-0 sv-288) (-> s1-0 sv-288) s2-0) + (vector+! s3-0 (-> s1-0 sv-288) (-> this origin)) + (camera-line s4-0 s3-0 (the-as vector4w arg0)) + (+! sv-288 1))))) 0 (none)) @@ -122,7 +118,7 @@ (if (< (-> arg0 y) (-> arg1 y)) (set! v1-2 (+ v1-2 (- (-> arg1 y) (-> arg0 y))))) (let ((f0-6 (* -4.0 v1-2)) (f3-1 (* 4.0 v1-2 (- (-> arg1 y) (-> arg0 y))))) - (set! (-> self y-vel) (* 0.5 (- (sqrtf (- (* f0-6 f0-6) (* 4.0 f3-1))) f0-6)))) + (set! (-> self y-vel) (* 0.5 (- (sqrtf (- (square f0-6) (* 4.0 f3-1))) f0-6)))) (set! (-> self grav) (/ (- (* (-> self y-vel) (-> self y-vel))) (* 2.0 v1-2))))) (defbehavior arcing-shot-calculate arcing-shot ((arg0 vector) (arg1 float)) @@ -529,19 +525,18 @@ :post transform-post) (defbehavior redshot-init-by-other redshot ((arg0 vector) (arg1 vector) (arg2 float) (arg3 time-frame) (arg4 time-frame) (arg5 int)) - (local-vars (sv-16 collide-shape-prim-sphere)) (let ((s0-0 (new 'process 'collide-shape-moving self (collide-list-enum usually-hit-by-player)))) (set! (-> s0-0 dynam) (copy *standard-dynamics* 'process)) (set! (-> s0-0 reaction) default-collision-reaction) (set! (-> s0-0 no-reaction) (the-as (function collide-shape-moving collide-shape-intersect vector vector none) nothing)) - (set! sv-16 (new 'process 'collide-shape-prim-sphere s0-0 (the-as uint 0))) - (set! (-> sv-16 prim-core collide-as) (collide-kind wall-object)) - (set! (-> sv-16 collide-with) (collide-kind target)) - (set! (-> sv-16 prim-core action) (collide-action solid)) - (set! (-> sv-16 prim-core offense) (collide-offense indestructible)) - (set! (-> sv-16 transform-index) 4) - (set-vector! (-> sv-16 local-sphere) 0.0 0.0 0.0 12288.0) - (set-root-prim! s0-0 sv-16) + (let ((sv-16 (new 'process 'collide-shape-prim-sphere s0-0 (the-as uint 0)))) + (set! (-> sv-16 prim-core collide-as) (collide-kind wall-object)) + (set! (-> sv-16 collide-with) (collide-kind target)) + (set! (-> sv-16 prim-core action) (collide-action solid)) + (set! (-> sv-16 prim-core offense) (collide-offense indestructible)) + (set! (-> sv-16 transform-index) 4) + (set-vector! (-> sv-16 local-sphere) 0.0 0.0 0.0 12288.0) + (set-root-prim! s0-0 sv-16)) (set! (-> s0-0 nav-radius) (* 0.75 (-> s0-0 root-prim local-sphere w))) (backup-collide-with-as s0-0) (set! (-> self root) s0-0)) diff --git a/goal_src/jak1/levels/finalboss/robotboss.gc b/goal_src/jak1/levels/finalboss/robotboss.gc index a795b79bf4..5b111d6f13 100644 --- a/goal_src/jak1/levels/finalboss/robotboss.gc +++ b/goal_src/jak1/levels/finalboss/robotboss.gc @@ -919,38 +919,38 @@ ;; WARN: Stack slot load at 64 mismatch: defined as size 4, got size 16 (defbehavior robotboss-redshot robotboss ((arg0 redshot-launch-info) (arg1 symbol)) - (local-vars (sv-32 redshot-launch-info) (sv-48 vector) (sv-64 float) (sv-80 time-frame) (sv-96 time-frame)) - (set! sv-32 arg0) - (let ((s5-0 arg1)) + (let ((sv-32 arg0) + (s5-0 arg1)) (+! (-> self children-spawned) 1) (let ((gp-0 (new 'stack-no-clear 'vector))) (vector<-cspace! gp-0 (joint-node robotboss-basic-lod0-jg red_ecoTip)) (let ((s4-0 (get-process *default-dead-pool* redshot #x4000))) (when s4-0 (let ((t9-2 (method-of-type redshot activate))) (t9-2 (the-as redshot s4-0) self 'redshot (the-as pointer #x70004000))) - (let ((s3-0 run-function-in-process) - (s2-0 s4-0) - (s1-0 redshot-init-by-other) - (s0-0 gp-0)) - (set! sv-48 (-> sv-32 dest)) - (let ((f30-0 20480.0) - (f28-0 12288.0)) - (set! sv-64 (+ f30-0 (* f28-0 (rand-float-gen))))) - (set! sv-80 (-> sv-32 flight-time)) - (set! sv-96 (-> sv-32 stall-time)) - (let* ((f30-1 300.0) - (v1-19 (/ (the-as int (rand-uint31-gen *random-generator*)) 256)) - (v1-20 (the-as number (logior #x3f800000 v1-19))) - (t3-0 (the int (* f30-1 (+ -1.0 (the-as float v1-20)))))) - ((the-as (function object object object object object object object object none) s3-0) - s2-0 - s1-0 - s0-0 - sv-48 - sv-64 - sv-80 - sv-96 - t3-0))) + (let* ((s3-0 run-function-in-process) + (s2-0 s4-0) + (s1-0 redshot-init-by-other) + (s0-0 gp-0) + (sv-48 (-> sv-32 dest)) + (f30-0 20480.0) + (f28-0 12288.0) + (v1-10 (/ (the-as int (rand-uint31-gen *random-generator*)) 256)) + (v1-11 (the-as number (logior #x3f800000 v1-10))) + (sv-64 (+ f30-0 (* f28-0 (+ -1.0 (the-as float v1-11))))) + (sv-80 (-> sv-32 flight-time)) + (sv-96 (-> sv-32 stall-time)) + (f30-1 300.0) + (v1-19 (/ (the-as int (rand-uint31-gen *random-generator*)) 256)) + (v1-20 (the-as number (logior #x3f800000 v1-19)))) + ((the-as (function object object object object object object object object none) s3-0) + s2-0 + s1-0 + s0-0 + sv-48 + sv-64 + sv-80 + sv-96 + (the int (* f30-1 (+ -1.0 (the-as float v1-20)))))) (-> s4-0 ppointer))) (when s5-0 (process-spawn part-tracker :init part-tracker-init group-robotboss-redshot-launch 300 #f #f #f gp-0 :to *entity-pool*) diff --git a/goal_src/jak1/levels/jungle/jungle-mirrors.gc b/goal_src/jak1/levels/jungle/jungle-mirrors.gc index b90dd32dc5..450a19b2f9 100644 --- a/goal_src/jak1/levels/jungle/jungle-mirrors.gc +++ b/goal_src/jak1/levels/jungle/jungle-mirrors.gc @@ -577,7 +577,6 @@ (if (not (logtest? (-> *camera* master-options) 2)) (cam-slave-go cam-free-floating))) :code (behavior () - (local-vars (sv-32 int) (sv-48 int)) (let* ((gp-0 (-> self change-event-from)) (f28-0 (the-as float (-> (the-as periscope (-> gp-0 0)) tilt))) (f30-0 (the-as float (-> (the-as periscope (-> gp-0 0)) turn))) @@ -599,18 +598,10 @@ -1.0))) (set! (-> s5-0 y) (- (-> s5-0 y) (* 136.53334 (- f26-0)))) (set! (-> s5-0 x) (- (-> s5-0 x) (* 136.53334 (- f0-0)))) - (cond - ((and (= f26-0 0.0) (= f0-0 0.0)) (sound-stop (-> (the-as periscope (-> gp-0 0)) sound-id))) - (else - (let ((s4-0 sound-play-by-name) - (s3-0 (make-u128 101 (the-as uint #x706f6373656c6574))) - (s2-0 (-> (the-as periscope (-> gp-0 0)) sound-id)) - (s1-0 1024) - (s0-0 0)) - (set! sv-32 0) - (set! sv-48 1) - (let ((t2-0 (target-pos 0))) - (the-as int (s4-0 (the-as sound-name s3-0) s2-0 s1-0 s0-0 sv-32 (the-as sound-group sv-48) (the-as symbol t2-0))))))))) + (if (and (= f26-0 0.0) (= f0-0 0.0)) + (sound-stop (-> (the-as periscope (-> gp-0 0)) sound-id)) + (the-as int + (sound-play "telescope" :id (-> (the-as periscope (-> gp-0 0)) sound-id) :position (the-as symbol (target-pos 0))))))) (cond ((< 136.53334 (-> s5-0 x)) (set! (-> s5-0 x) 136.53334)) ((< (-> s5-0 x) -136.53334) (set! (-> s5-0 x) -136.53334))) @@ -871,15 +862,14 @@ (none)) (defbehavior periscope-test-task-complete? periscope () - (local-vars (sv-16 symbol)) - (set! sv-16 #t) - (apply-all (-> self link) - (lambda ((arg0 entity-actor) (arg1 (pointer symbol))) - (when (and (= (-> arg0 etype) periscope) (not (logtest? (-> arg0 extra perm status) (entity-perm-status complete)))) - (set! (-> arg1 0) #f) - #t)) - (& sv-16)) - sv-16) + (let ((sv-16 #t)) + (apply-all (-> self link) + (lambda ((arg0 entity-actor) (arg1 (pointer symbol))) + (when (and (= (-> arg0 etype) periscope) (not (logtest? (-> arg0 extra perm status) (entity-perm-status complete)))) + (set! (-> arg1 0) #f) + #t)) + (& sv-16)) + sv-16)) (defbehavior peri-beamcam-init-by-other process ((arg0 string)) (let ((gp-0 (entity-by-name "junglecam-1"))) diff --git a/goal_src/jak1/levels/jungle/jungle-obs.gc b/goal_src/jak1/levels/jungle/jungle-obs.gc index 574683d2a4..56e3514a89 100644 --- a/goal_src/jak1/levels/jungle/jungle-obs.gc +++ b/goal_src/jak1/levels/jungle/jungle-obs.gc @@ -56,7 +56,7 @@ ((> (-> self draw cur-lod) 0) (ja-post)) (else (transform-post) - (if *target* (look-at-enemy! (-> *target* neck) (the-as vector (-> self root root-prim prim-core)) #f self))))) + (if *target* (look-at-enemy! (-> *target* neck) (-> self root root-prim prim-core world-sphere) #f self))))) (suspend) (ja :num! (seek!)))))) @@ -305,7 +305,6 @@ :post rider-post) (defmethod init-from-entity! ((this lurkerm-piston) (arg0 entity-actor)) - (local-vars (sv-16 res-tag) (sv-32 res-tag)) (logior! (-> this mask) (process-mask platform)) (let ((s4-0 (new 'process 'collide-shape-moving this (collide-list-enum hit-by-player)))) (set! (-> s4-0 dynam) (copy *standard-dynamics* 'process)) @@ -329,15 +328,15 @@ (logior! (-> this skel status) (janim-status inited)) (update-transforms! (-> this root)) (set! (-> this base quad) (-> this root trans quad)) - (let ((f30-0 (-> this base y))) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-32 (res-lump-data arg0 'height-info pointer :tag-ptr (& sv-16)))) - (set! (-> this base y) - (+ f30-0 (if (and v1-32 (> (the-as int (-> sv-16 elt-count)) 0)) (-> (the-as (pointer float) v1-32)) 0.0))))) + (let* ((f30-0 (-> this base y)) + (sv-16 (new 'static 'res-tag)) + (v1-32 (res-lump-data arg0 'height-info pointer :tag-ptr (& sv-16)))) + (set! (-> this base y) + (+ f30-0 (if (and v1-32 (> (the-as int (-> sv-16 elt-count)) 0)) (-> (the-as (pointer float) v1-32)) 0.0)))) (let ((s4-1 (-> this height))) (set! (-> s4-1 x) 0.0) - (set! sv-32 (new 'static 'res-tag)) - (let ((v1-35 (res-lump-data arg0 'height-info (pointer float) :tag-ptr (& sv-32)))) + (let* ((sv-32 (new 'static 'res-tag)) + (v1-35 (res-lump-data arg0 'height-info (pointer float) :tag-ptr (& sv-32)))) (set! (-> s4-1 y) (if (and v1-35 (< 1 (the-as int (-> sv-32 elt-count)))) (-> v1-35 1) 20480.0))) (set! (-> s4-1 z) 0.0) (set! (-> s4-1 w) 1.0)) diff --git a/goal_src/jak1/levels/jungleb/plat-flip.gc b/goal_src/jak1/levels/jungleb/plat-flip.gc index 02b2ded0fd..9af6284125 100644 --- a/goal_src/jak1/levels/jungleb/plat-flip.gc +++ b/goal_src/jak1/levels/jungleb/plat-flip.gc @@ -20,6 +20,7 @@ (:states plat-flip-idle)) + (defskelgroup *plat-flip-sg* plat-flip plat-flip-geo-jg @@ -75,7 +76,6 @@ :post rider-post) (defmethod init-from-entity! ((this plat-flip) (arg0 entity-actor)) - (local-vars (sv-16 res-tag) (sv-32 res-tag) (sv-48 res-tag)) (logior! (-> this mask) (process-mask platform)) (let ((s4-0 (new 'process 'collide-shape-moving this (collide-list-enum hit-by-player)))) (set! (-> s4-0 dynam) (copy *standard-dynamics* 'process)) @@ -97,30 +97,30 @@ (set! (-> this base-pos quad) (-> this root trans quad)) (initialize-skeleton this *plat-flip-sg* '()) (logior! (-> this skel status) (janim-status inited)) - (let ((f30-0 300.0)) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-28 (res-lump-data arg0 'delay pointer :tag-ptr (& sv-16)))) - (set! (-> this before-turn-down-time) - (* f30-0 (if (and v1-28 (> (the-as int (-> sv-16 elt-count)) 0)) (-> (the-as (pointer float) v1-28)) 2.0))))) - (let ((f30-1 300.0)) - (set! sv-32 (new 'static 'res-tag)) - (let ((v1-31 (res-lump-data arg0 'delay pointer :tag-ptr (& sv-32)))) - (set! (-> this before-turn-up-time) - (* f30-1 (if (and v1-31 (< 1 (the-as int (-> sv-32 elt-count)))) (-> (the-as (pointer float) v1-31) 1) 0.2))))) + (let* ((f30-0 300.0) + (sv-16 (new 'static 'res-tag)) + (v1-28 (res-lump-data arg0 'delay pointer :tag-ptr (& sv-16)))) + (set! (-> this before-turn-down-time) + (* f30-0 (if (and v1-28 (> (the-as int (-> sv-16 elt-count)) 0)) (-> (the-as (pointer float) v1-28)) 2.0)))) + (let* ((f30-1 300.0) + (sv-32 (new 'static 'res-tag)) + (v1-31 (res-lump-data arg0 'delay pointer :tag-ptr (& sv-32)))) + (set! (-> this before-turn-up-time) + (* f30-1 (if (and v1-31 (< 1 (the-as int (-> sv-32 elt-count)))) (-> (the-as (pointer float) v1-31) 1) 0.2)))) (set! (-> this turn-down-time) 300.0) (set! (-> this turn-up-time) 300.0) (set! (-> this total-time) (+ (-> this before-turn-down-time) (-> this turn-down-time) (-> this before-turn-up-time) (-> this turn-up-time))) - (let ((s4-1 (-> this sync)) - (s3-1 (method-of-type sync-info setup-params!)) - (s2-0 (the int (-> this total-time)))) - (set! sv-48 (new 'static 'res-tag)) - (let ((v1-35 (res-lump-data arg0 'sync-percent pointer :tag-ptr (& sv-48)))) - (s3-1 s4-1 - (the-as uint s2-0) - (if (and v1-35 (> (the-as int (-> sv-48 elt-count)) 0)) (-> (the-as (pointer float) v1-35) 0) 0.0) - 0.15 - 0.15))) + (let* ((s4-1 (-> this sync)) + (s3-1 (method-of-type sync-info setup-params!)) + (s2-0 (the int (-> this total-time))) + (sv-48 (new 'static 'res-tag)) + (v1-35 (res-lump-data arg0 'sync-percent pointer :tag-ptr (& sv-48)))) + (s3-1 s4-1 + (the-as uint s2-0) + (if (and v1-35 (> (the-as int (-> sv-48 elt-count)) 0)) (-> (the-as (pointer float) v1-35) 0) 0.0) + 0.15 + 0.15)) (update-transforms! (-> this root)) (go plat-flip-idle) (none)) diff --git a/goal_src/jak1/levels/lavatube/lavatube-obs.gc b/goal_src/jak1/levels/lavatube/lavatube-obs.gc index 6a37a96485..77c3d2ff7d 100644 --- a/goal_src/jak1/levels/lavatube/lavatube-obs.gc +++ b/goal_src/jak1/levels/lavatube/lavatube-obs.gc @@ -555,14 +555,13 @@ (ja :num! (seek!)))))) (defmethod init-from-entity! ((this darkecobarrel) (arg0 entity-actor)) - (local-vars (sv-16 res-tag)) (set! (-> this root) (the-as collide-shape-moving (new 'process 'trsqv))) (darkecobarrel-base-init arg0) (set! (-> this sound) (new 'process 'ambient-sound (static-sound-spec "lav-dark-eco" :fo-max 30) (-> this root trans))) (logior! (-> this draw status) (draw-status hidden)) (set! (-> this speed) (/ 300.0 (res-lump-float (-> this entity) 'speed :default 61440.0))) - (set! sv-16 (new 'static 'res-tag)) - (let ((s5-1 (res-lump-data arg0 'delay pointer :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (s5-1 (res-lump-data arg0 'delay pointer :tag-ptr (& sv-16)))) (cond (s5-1 (set! (-> this spawn-array) (new 'process 'boxed-array time-frame (the-as int (-> sv-16 elt-count)))) diff --git a/goal_src/jak1/levels/maincave/driller-lurker.gc b/goal_src/jak1/levels/maincave/driller-lurker.gc index 3dab95eacc..af5c8385f2 100644 --- a/goal_src/jak1/levels/maincave/driller-lurker.gc +++ b/goal_src/jak1/levels/maincave/driller-lurker.gc @@ -192,7 +192,6 @@ (:conerot-y (degrees 0) (degrees 360)))) (defbehavior driller-lurker-default-event-handler driller-lurker ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) - (local-vars (sv-96 collide-shape-prim)) (cond ((= arg2 'attack) (cond @@ -215,11 +214,11 @@ (let* ((s1-0 (the-as touching-shapes-entry (-> arg3 param 0))) (s0-0 (-> s1-0 head))) (while s0-0 - (set! sv-96 (get-touched-prim s0-0 (-> self root-overeride) s1-0)) - (if (and (logtest? (-> (get-touched-prim s0-0 (-> s4-0 control) s1-0) prim-core action) (collide-action solid)) - (logtest? (-> sv-96 prim-id) 1)) - (set! s2-0 #t)) - (if (logtest? (-> sv-96 prim-id) 2) (set! s3-0 #t)) + (let ((sv-96 (get-touched-prim s0-0 (-> self root-overeride) s1-0))) + (if (and (logtest? (-> (get-touched-prim s0-0 (-> s4-0 control) s1-0) prim-core action) (collide-action solid)) + (logtest? (-> sv-96 prim-id) 1)) + (set! s2-0 #t)) + (if (logtest? (-> sv-96 prim-id) 2) (set! s3-0 #t))) (set! s0-0 (-> s0-0 next)))) (cond ((or s2-0 (not s3-0)) @@ -644,7 +643,6 @@ (none)) (defmethod init-from-entity! ((this driller-lurker) (arg0 entity-actor)) - (local-vars (sv-16 res-tag)) (set! (-> this hit-player?) #f) (set! (-> this played-drill-sound?) #f) (set! (-> this hit-player-time) 0) @@ -731,7 +729,7 @@ (set! (-> this path-speed) 15360.0) (set! (-> this targ-path-speed) 15360.0) (set! (-> this up-blend) 0.0) - (set! sv-16 (new 'static 'res-tag)) + (let ((sv-16 (new 'static 'res-tag)))) (let ((v1-91 (res-lump-data arg0 'driller-lurker (pointer float) :tag-ptr (the-as (pointer res-tag) (new 'stack-no-clear 'vector))))) (when v1-91 (set! (-> this path-u) (fmax 0.0 (fmin 1.0 (-> v1-91 0)))) diff --git a/goal_src/jak1/levels/maincave/gnawer.gc b/goal_src/jak1/levels/maincave/gnawer.gc index 05693dee84..773c85700c 100644 --- a/goal_src/jak1/levels/maincave/gnawer.gc +++ b/goal_src/jak1/levels/maincave/gnawer.gc @@ -359,7 +359,6 @@ (none)) (defmethod gnawer-method-24 ((this gnawer)) - (local-vars (sv-48 vector) (sv-64 vector)) (let ((s5-0 0) (s4-0 0)) (let ((f30-0 -1.0) @@ -370,15 +369,15 @@ (when (= s1-0 s0-0) (set! s0-0 (rand-vu-int-count s3-0)) (if (= s1-0 s0-0) (set! s0-0 (mod (+ s1-0 1) s3-0)))) - (set! sv-48 (new 'stack-no-clear 'vector)) - (set! sv-64 (new 'stack-no-clear 'vector)) - (eval-path-curve-div! (-> this path) sv-48 (the float s1-0) 'interp) - (eval-path-curve-div! (-> this path) sv-64 (the float s0-0) 'interp) - (let ((f0-4 (vector-vector-distance sv-48 sv-64))) - (when (< f30-0 f0-4) - (set! f30-0 f0-4) - (set! s5-0 s1-0) - (set! s4-0 s0-0)))))) + (let ((sv-48 (new 'stack-no-clear 'vector)) + (sv-64 (new 'stack-no-clear 'vector))) + (eval-path-curve-div! (-> this path) sv-48 (the float s1-0) 'interp) + (eval-path-curve-div! (-> this path) sv-64 (the float s0-0) 'interp) + (let ((f0-4 (vector-vector-distance sv-48 sv-64))) + (when (< f30-0 f0-4) + (set! f30-0 f0-4) + (set! s5-0 s1-0) + (set! s4-0 s0-0))))))) (set! (-> this route src-pt-index) s5-0) (set! (-> this route dest-pt-index) s4-0)) (let ((v1-13 (-> this route src-pt-index)) @@ -411,7 +410,7 @@ (f28-0 (- (-> this route dest-pt-offset y) (-> this route src-pt-offset y)))) (set-vector! (-> this route surface-dir) f30-5 f28-0 0.0 1.0) (vector-normalize! (-> this route surface-dir) 1.0) - (let ((f0-25 (sqrtf (+ (* f30-5 f30-5) (* f28-0 f28-0))))) + (let ((f0-25 (sqrtf (+ (square f30-5) (square f28-0))))) (set! (-> this route surface-dist) f0-25) (set! (-> this route total-dist) (+ 20480.0 f0-25)))) (set! (-> this route total-travel-time) @@ -442,7 +441,7 @@ (let* ((f0-10 (- (-> s4-0 max x) (-> this root trans x))) (f1-12 (- (-> s4-0 max y) (-> this root trans y))) (f2-7 (- (-> s4-0 max z) (-> this root trans z))) - (f0-14 (sqrtf (+ (* f0-10 f0-10) (* f1-12 f1-12) (* f2-7 f2-7)))) + (f0-14 (sqrtf (+ (square f0-10) (square f1-12) (square f2-7)))) (a0-3 (-> this draw bounds)) (v1-21 (-> this root root-prim)) (f0-15 (+ 12288.0 f0-14))) @@ -574,7 +573,6 @@ (set! (-> arg2 y) (+ 4096.0 (-> arg2 y)))) (defmethod gnawer-method-30 ((this gnawer) (arg0 process-drawable)) - (local-vars (sv-48 vector)) (let ((gp-0 (-> this entity extra perm))) (logior! (-> gp-0 status) (entity-perm-status user-set-from-cstage)) (let ((s5-0 (-> gp-0 user-uint16 0)) @@ -583,15 +581,13 @@ (s1-0 (-> this path curve num-cverts))) (dotimes (s0-0 s1-0) (when (logtest? (ash 1 s0-0) s5-0) - (let ((a2-0 (new 'stack-no-clear 'vector))) - (set! sv-48 (new 'stack-no-clear 'vector)) - (gnawer-method-29 this s0-0 a2-0 sv-48)) - (let* ((t9-1 vector-vector-xz-distance) - (a1-2 (-> arg0 root trans)) - (f0-0 (t9-1 sv-48 a1-2))) - (when (or (< s2-0 0) (< f0-0 f30-0)) - (set! s2-0 s0-0) - (set! f30-0 f0-0)))))) + (let ((a2-0 (new 'stack-no-clear 'vector)) + (sv-48 (new 'stack-no-clear 'vector))) + (gnawer-method-29 this s0-0 a2-0 sv-48) + (let ((f0-0 (vector-vector-xz-distance sv-48 (-> arg0 root trans)))) + (when (or (< s2-0 0) (< f0-0 f30-0)) + (set! s2-0 s0-0) + (set! f30-0 f0-0))))))) (when (>= s2-0 0) (let ((v0-2 (logxor s5-0 (the-as uint (ash 1 s2-0))))) (set! (-> gp-0 user-int16 0) (the-as int v0-2)) v0-2))))) @@ -807,7 +803,6 @@ (spool-push *art-control* "maincavecam-gnawer-fuel-cell" 0 self -1.0)) :code (behavior () - (local-vars (sv-128 symbol)) (clear-collide-with-as (-> self root)) (set! (-> self skel postbind-function) #f) (ja-channel-set! 0) @@ -832,11 +827,11 @@ (set-time! (-> self state-time)) (until (time-elapsed? (-> self state-time) (seconds 0.05)) (suspend))) - (set! sv-128 (the-as symbol #f)) - (apply-all (-> self link) actor-link-subtask-complete-hook (& sv-128)) - (when sv-128 - (save-reminder (get-task-control (game-task cave-gnawers)) (-> self gnawer-id) 3) - (go gnawer-give-fuel-cell)) + (let ((sv-128 (the-as symbol #f))) + (apply-all (-> self link) actor-link-subtask-complete-hook (& sv-128)) + (when sv-128 + (save-reminder (get-task-control (game-task cave-gnawers)) (-> self gnawer-id) 3) + (go gnawer-give-fuel-cell))) (set! (-> self trans-hook) #f) (process-entity-status! self (entity-perm-status bit-3) #f) (logior! (-> self mask) (process-mask actor-pause)) @@ -953,7 +948,6 @@ (call-parent-method this offset)) (defmethod init-from-entity! ((this gnawer) (arg0 entity-actor)) - (local-vars (sv-16 res-tag) (sv-32 res-tag) (sv-48 res-tag)) (set! (-> this hidden?) #f) (set! (-> this show-damage?) #f) (set! (-> this hit-points) 6) @@ -1034,8 +1028,8 @@ (let ((f0-40 (res-lump-float (-> this entity) 'rotoffset))) (quaternion-rotate-y! (-> this root quat) (-> this root quat) f0-40)) (+! (-> this root trans y) -2048.0) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-81 (res-lump-data arg0 'trans-offset (pointer float) :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-81 (res-lump-data arg0 'trans-offset (pointer float) :tag-ptr (& sv-16)))) (when v1-81 (+! (-> this root trans x) (-> v1-81 0)) (+! (-> this root trans y) (-> v1-81 1)) @@ -1046,14 +1040,14 @@ (set! (-> this part2) (create-launch-control group-gnawer-crumbs this)) (set! (-> this total-money) 0) (set! (-> this money-mask) (the-as uint 0)) - (set! sv-32 (new 'static 'res-tag)) - (let ((v1-96 (res-lump-data arg0 'extra-count (pointer int32) :tag-ptr (& sv-32)))) + (let* ((sv-32 (new 'static 'res-tag)) + (v1-96 (res-lump-data arg0 'extra-count (pointer int32) :tag-ptr (& sv-32)))) (when v1-96 (case (-> v1-96 0) ((5) (set! (-> this total-money) (-> v1-96 1)))))) (when (> (-> this total-money) 0) - (set! sv-48 (new 'static 'res-tag)) - (let ((a0-49 (res-lump-data arg0 'gnawer (pointer int32) :tag-ptr (& sv-48)))) + (let* ((sv-48 (new 'static 'res-tag)) + (a0-49 (res-lump-data arg0 'gnawer (pointer int32) :tag-ptr (& sv-48)))) (cond (a0-49 (let ((v1-100 0)) diff --git a/goal_src/jak1/levels/maincave/maincave-obs.gc b/goal_src/jak1/levels/maincave/maincave-obs.gc index 4a0e5e275a..df74b901a7 100644 --- a/goal_src/jak1/levels/maincave/maincave-obs.gc +++ b/goal_src/jak1/levels/maincave/maincave-obs.gc @@ -346,7 +346,7 @@ (cond ((< gp-0 a0-1) (when (sphere-in-view-frustum? (the-as sphere (-> self root root-prim prim-core))) - (launch-particles (-> *part-id-table* 704) (the-as vector (-> self launch-pos))) + (launch-particles (-> *part-id-table* 704) (-> self launch-pos 0)) (launch-particles (-> *part-id-table* 705) (the-as vector (&-> self stack 112)))) (when (-> self should-play-sound?) (set! (-> self should-play-sound?) #f) @@ -369,7 +369,6 @@ (suspend)))) (defmethod init-from-entity! ((this caveflamepots) (arg0 entity-actor)) - (local-vars (sv-16 res-tag) (sv-32 res-tag) (sv-48 res-tag)) (set! (-> this was-deadly?) #f) (set! (-> this should-play-sound?) #f) (set! (-> this shove-up) (res-lump-float arg0 'shove :default 8192.0)) @@ -424,8 +423,8 @@ (set! (-> v1-53 0 y) 0.0) (set! (-> v1-53 0 z) 0.0) (set! (-> v1-53 0 w) 1.0)) - (vector-rotate-around-y! (the-as vector s4-1) (the-as vector s4-1) f30-0) - (vector+! (the-as vector s4-1) (the-as vector s4-1) (-> this root trans))) + (vector-rotate-around-y! (-> s4-1 0) (-> s4-1 0) f30-0) + (vector+! (-> s4-1 0) (-> s4-1 0) (-> this root trans))) (let ((s4-2 (the-as object (&-> this stack 112)))) (set-vector! (the-as vector s4-2) -6144.0 0.0 0.0 1.0) (vector-rotate-around-y! (the-as vector s4-2) (the-as vector s4-2) f30-0) @@ -435,21 +434,21 @@ (let ((a1-19 (-> (the-as collide-shape-prim-group s4-3) prims s3-1 local-sphere))) (vector-rotate-around-y! a1-19 a1-19 f30-0))))) (update-transforms! (-> this root)) - (let ((f30-1 300.0)) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-70 (res-lump-data arg0 'cycle-speed (pointer float) :tag-ptr (& sv-16)))) - (set! (-> this cycle-speed) - (the int (* f30-1 (if (and v1-70 (> (the-as int (-> sv-16 elt-count)) 0)) (-> v1-70 0) 4.0)))))) - (let ((f30-2 (the float (-> this cycle-speed)))) - (set! sv-32 (new 'static 'res-tag)) - (let ((v1-74 (res-lump-data arg0 'cycle-speed (pointer float) :tag-ptr (& sv-32)))) - (set! (-> this cycle-offset) - (the-as uint (the int (* f30-2 (if (and v1-74 (< 1 (the-as int (-> sv-32 elt-count)))) (-> v1-74 1) 0.0))))))) - (let ((f30-3 300.0)) - (set! sv-48 (new 'static 'res-tag)) - (let ((v1-77 (res-lump-data arg0 'cycle-speed (pointer float) :tag-ptr (& sv-48)))) - (set! (-> this cycle-pause) - (the int (* f30-3 (if (and v1-77 (< 2 (the-as int (-> sv-48 elt-count)))) (-> v1-77 2) 2.0)))))) + (let* ((f30-1 300.0) + (sv-16 (new 'static 'res-tag)) + (v1-70 (res-lump-data arg0 'cycle-speed (pointer float) :tag-ptr (& sv-16)))) + (set! (-> this cycle-speed) + (the int (* f30-1 (if (and v1-70 (> (the-as int (-> sv-16 elt-count)) 0)) (-> v1-70 0) 4.0))))) + (let* ((f30-2 (the float (-> this cycle-speed))) + (sv-32 (new 'static 'res-tag)) + (v1-74 (res-lump-data arg0 'cycle-speed (pointer float) :tag-ptr (& sv-32)))) + (set! (-> this cycle-offset) + (the-as uint (the int (* f30-2 (if (and v1-74 (< 1 (the-as int (-> sv-32 elt-count)))) (-> v1-74 1) 0.0)))))) + (let* ((f30-3 300.0) + (sv-48 (new 'static 'res-tag)) + (v1-77 (res-lump-data arg0 'cycle-speed (pointer float) :tag-ptr (& sv-48)))) + (set! (-> this cycle-pause) + (the int (* f30-3 (if (and v1-77 (< 2 (the-as int (-> sv-48 elt-count)))) (-> v1-77 2) 2.0))))) (go caveflamepots-active) (none)) @@ -809,7 +808,7 @@ (none)) (defmethod init-from-entity! ((this caveelevator) (arg0 entity-actor)) - (local-vars (v1-43 int) (sv-16 res-tag)) + (local-vars (v1-43 int)) (set! (-> this prev-frame-num) 10000.0) (set! (-> this last-update-bounce-time) 0) (logior! (-> this mask) (process-mask platform)) @@ -833,8 +832,8 @@ (initialize-skeleton this *caveelevator-sg* '()) (logior! (-> this skel status) (janim-status inited)) (set! (-> this skel postbind-function) caveelevator-joint-callback) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-28 (res-lump-data arg0 'trans-offset (pointer float) :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-28 (res-lump-data arg0 'trans-offset (pointer float) :tag-ptr (& sv-16)))) (when v1-28 (+! (-> this root trans x) (-> v1-28 0)) (+! (-> this root trans y) (-> v1-28 1)) diff --git a/goal_src/jak1/levels/maincave/mother-spider.gc b/goal_src/jak1/levels/maincave/mother-spider.gc index 8f145d48eb..df3ac0c9dd 100644 --- a/goal_src/jak1/levels/maincave/mother-spider.gc +++ b/goal_src/jak1/levels/maincave/mother-spider.gc @@ -340,7 +340,6 @@ #f) (defmethod mother-spider-method-21 ((this mother-spider) (arg0 vector) (arg1 float) (arg2 symbol)) - (local-vars (sv-112 process) (sv-128 vector) (sv-144 vector)) (let ((f30-0 (vector-length (-> this swing-pos)))) (when (< 0.0 f30-0) (let ((s1-0 (new 'stack-no-clear 'vector)) @@ -367,9 +366,9 @@ (logior! (-> this leg-socket-part-mask) (ash 1 s4-1)) (set-time! (-> this leg-socket-part-time s4-1)) (let ((s1-1 (-> *mother-spider-leg-infos* s4-1))) - (let ((s0-0 (new 'stack-no-clear 'vector))) - (set! sv-128 (new 'stack-no-clear 'vector)) - (set! sv-144 (new 'stack-no-clear 'vector)) + (let ((s0-0 (new 'stack-no-clear 'vector)) + (sv-128 (new 'stack-no-clear 'vector)) + (sv-144 (new 'stack-no-clear 'vector))) (vector<-cspace! s0-0 (-> this node-list data (-> s1-1 joint-index0))) (vector<-cspace! sv-128 (-> this node-list data (-> s1-1 joint-index1))) (vector-! sv-128 sv-128 s0-0) @@ -378,12 +377,15 @@ (vector-normalize! sv-144 1.0) (+! (-> sv-144 y) (rand-vu-float-range 0.0 0.3)) (vector-normalize! sv-144 1.0) - (set! sv-112 (get-process *default-dead-pool* mother-spider-leg #x4000)) - (when sv-112 - (let ((t9-15 (method-of-type mother-spider-leg activate))) - (t9-15 (the-as mother-spider-leg sv-112) this 'mother-spider-leg (the-as pointer #x70004000))) - (run-now-in-process sv-112 mother-spider-leg-init-by-other this s0-0 sv-128 sv-144) - (-> sv-112 ppointer))) + (let ((sv-112 (get-process *default-dead-pool* mother-spider-leg #x4000))) + (when sv-112 + ((method-of-type mother-spider-leg activate) + (the-as mother-spider-leg sv-112) + this + 'mother-spider-leg + (the-as pointer #x70004000)) + (run-now-in-process sv-112 mother-spider-leg-init-by-other this s0-0 sv-128 sv-144) + (-> sv-112 ppointer)))) (let ((v1-43 (-> (the-as collide-shape-prim-group s3-1) prims (-> s1-1 cprim-index)))) (set! (-> v1-43 collide-with) (collide-kind)) (set! (-> v1-43 prim-core collide-as) (collide-kind)))) @@ -1068,7 +1070,6 @@ (the-as mother-spider ((method-of-type process-drawable relocate) this offset))) (defmethod init-from-entity! ((this mother-spider) (arg0 entity-actor)) - (local-vars (sv-16 res-tag) (sv-64 vector)) (set! (-> this baby-count) 0) (set! (-> this spit-counter) 0) (set! (-> this leg-socket-part-mask) 0) @@ -1194,8 +1195,8 @@ (set! (-> this max-swing-radius) 73728.0) (set! (-> this max-baby-count) 4) (let ((s4-1 #f)) - (set! sv-16 (new 'static 'res-tag)) - (let ((v0-31 (res-lump-data arg0 'mother-spider pointer :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v0-31 (res-lump-data arg0 'mother-spider pointer :tag-ptr (& sv-16)))) (cond (v0-31 (+! (-> this thread-min-trans y) (-> (the-as (pointer float) v0-31) 0)) @@ -1246,10 +1247,7 @@ (eval-path-curve-div! (-> this path) s4-2 (the float s2-9) 'interp) (vector-! s3-1 (target-pos 0) s4-2) (set! (-> s3-1 y) 0.0) - (let ((s1-2 vector-rotate-around-y!) - (s0-0 s3-1)) - (set! sv-64 s3-1) - (let ((a2-21 (rand-vu-float-range -7281.778 7281.778))) (s1-2 s0-0 sv-64 a2-21))) + (vector-rotate-around-y! s3-1 s3-1 (rand-vu-float-range -7281.778 7281.778)) (vector-normalize! s3-1 1.0) (spawn-child this s4-2 s3-1 #f)))) (logclear! (-> this mask) (process-mask actor-pause)) diff --git a/goal_src/jak1/levels/misty/balloonlurker.gc b/goal_src/jak1/levels/misty/balloonlurker.gc index eb2a3758f1..e720e86670 100644 --- a/goal_src/jak1/levels/misty/balloonlurker.gc +++ b/goal_src/jak1/levels/misty/balloonlurker.gc @@ -577,27 +577,25 @@ (set! (-> self dead) #t)) :code (behavior () - (local-vars (v1-27 symbol) (sv-16 symbol) (sv-20 (pointer process-tree)) (sv-24 entity-actor)) + (local-vars (v1-27 symbol)) (process-entity-status! self (entity-perm-status bit-4) #t) (process-entity-status! self (entity-perm-status dead) #t) (when (or (-> self link prev) (-> self link next)) - (set! sv-16 (the-as symbol #f)) - (set! sv-20 (-> self child)) - (set! sv-24 (entity-actor-lookup (-> self entity) 'alt-actor 0)) - (entity-birth-no-kill sv-24) - (apply-all (-> self link) actor-link-dead-hook (& sv-16)) - (when (and sv-16 sv-24) - (process-grab? *target*) - (suspend-for (seconds 1)) - (process-release? *target*) - (while (let ((a1-4 (new 'stack-no-clear 'event-message-block))) - (set! (-> a1-4 from) self) - (set! (-> a1-4 num-params) 0) - (set! (-> a1-4 message) 'task-complete) - (let ((t9-7 send-event-function) - (v1-17 sv-24)) - (not (t9-7 (if v1-17 (-> v1-17 extra process)) a1-4)))) - (suspend)))) + (let ((sv-16 (the-as symbol #f))) + (let ((sv-20 (-> self child)))) + (let ((sv-24 (entity-actor-lookup (-> self entity) 'alt-actor 0))) + (entity-birth-no-kill sv-24) + (apply-all (-> self link) actor-link-dead-hook (& sv-16)) + (when (and sv-16 sv-24) + (process-grab? *target*) + (suspend-for (seconds 1)) + (process-release? *target*) + (while (let ((a1-4 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-4 from) self) + (set! (-> a1-4 num-params) 0) + (set! (-> a1-4 message) 'task-complete) + (let ((v1-17 sv-24)) (not (send-event-function (if v1-17 (-> v1-17 extra process)) a1-4)))) + (suspend)))))) (set! (-> self buoyancy-factor) (* 4.0 (-> self buoyancy-factor))) (until v1-27 (suspend) diff --git a/goal_src/jak1/levels/misty/misty-conveyor.gc b/goal_src/jak1/levels/misty/misty-conveyor.gc index 1b466d3b2e..b6954089aa 100644 --- a/goal_src/jak1/levels/misty/misty-conveyor.gc +++ b/goal_src/jak1/levels/misty/misty-conveyor.gc @@ -183,7 +183,6 @@ :event keg-event-handler :code (behavior () - (local-vars (sv-48 float) (sv-64 float) (sv-80 float) (sv-96 float) (sv-112 float)) (let ((gp-0 (new-stack-vector0)) (s5-0 (new 'stack 'vector3s))) 0.0 @@ -195,62 +194,62 @@ (f24-0 102379.1)) (/ 1.0 f24-0) (let ((f22-0 1.0) - (f20-0 2.5)) - (set! sv-48 0.0) - (set! sv-64 0.0) - (set! sv-80 (- (-> *standard-dynamics* gravity-length))) + (f20-0 2.5) + (sv-48 0.0) + (sv-64 0.0) + (sv-80 (- (-> *standard-dynamics* gravity-length)))) (loop - (let ((f0-13 (+ (get-current-phase (-> (the-as keg-conveyor-paddle (-> self parent 0)) sync)) f26-1))) - (set! sv-96 (- f0-13 (the float (the int f0-13))))) - (if (< sv-96 f30-0) (go keg-in-chute)) - (set! f30-0 sv-96) - (set! sv-112 (* sv-96 f28-0)) - (eval-path-curve-div! (-> (the-as keg-conveyor-paddle (-> self parent 0)) path) (-> self path-position) sv-112 'interp) - (path-control-method-12 (-> (the-as keg-conveyor-paddle (-> self parent 0)) path) gp-0 sv-112) - (seek-toward-heading-vec! (-> self root) gp-0 131072.0 (seconds 0.1)) - (set! (-> self root trans quad) (-> self path-position quad)) - (when (= (-> self keg-behavior) 1) - (cond - ((>= (vector4-dot (camera-pos) (-> self shadow-enable-plane)) 0.0) - (let ((v1-32 (-> self draw shadow-ctrl))) (logclear! (-> v1-32 settings flags) (shadow-flags disable-draw))) - 0 - (let ((v1-35 (-> self draw shadow-ctrl))) (set! (-> v1-35 settings top-plane w) (- (-> self path-position y)))) - 0 - (let ((v1-38 (-> self draw shadow-ctrl))) - (set! (-> v1-38 settings bot-plane w) (- (+ -8192.0 (-> self path-position y))))) - 0) - (else - (let ((v1-41 (-> self draw shadow-ctrl))) (logior! (-> v1-41 settings flags) (shadow-flags disable-draw))) - 0 - (let ((v1-44 (-> self draw shadow-ctrl))) (set! (-> v1-44 settings top-plane w) (- (-> self path-position y)))) - 0 - (let ((v1-47 (-> self draw shadow-ctrl))) - (set! (-> v1-47 settings bot-plane w) (- (+ -8192.0 (-> self path-position y))))) - 0)) - (let ((f0-32 (- f28-0 sv-112))) (if (< f0-32 f20-0) (set! f22-0 (/ f0-32 f20-0)))) - (set! sv-64 (+ sv-64 (* sv-80 (seconds-per-frame)))) - (set! sv-48 (+ sv-48 (* sv-64 (seconds-per-frame)))) - (when (< sv-48 0.0) - (set! sv-48 0.0) - (activate! (-> self smush) -0.15 90 150 1.0 1.0) - (set! sv-64 f24-0) - (sound-play "barrel-bounce" :vol 80) - (process-spawn part-tracker - :init - part-tracker-init - group-keg-bounce - -1 - keg-bounce-set-particle-rotation-callback - (-> self ppointer) - #f - (-> self root trans) - :to - self)) - (let ((f0-39 (update! (-> self smush)))) (keg-update-smush self f0-39)) - (+! (-> self root trans y) (* f22-0 sv-48)) - (set! (-> s5-0 x) 0.0) - (set! (-> s5-0 y) 1.0) - (set! (-> s5-0 z) 0.0)) + (let* ((f0-13 (+ (get-current-phase (-> (the-as keg-conveyor-paddle (-> self parent 0)) sync)) f26-1)) + (sv-96 (- f0-13 (the float (the int f0-13))))) + (if (< sv-96 f30-0) (go keg-in-chute)) + (set! f30-0 sv-96) + (let ((sv-112 (* sv-96 f28-0))) + (eval-path-curve-div! (-> (the-as keg-conveyor-paddle (-> self parent 0)) path) (-> self path-position) sv-112 'interp) + (path-control-method-12 (-> (the-as keg-conveyor-paddle (-> self parent 0)) path) gp-0 sv-112) + (seek-toward-heading-vec! (-> self root) gp-0 131072.0 (seconds 0.1)) + (set! (-> self root trans quad) (-> self path-position quad)) + (when (= (-> self keg-behavior) 1) + (cond + ((>= (vector4-dot (camera-pos) (-> self shadow-enable-plane)) 0.0) + (let ((v1-32 (-> self draw shadow-ctrl))) (logclear! (-> v1-32 settings flags) (shadow-flags disable-draw))) + 0 + (let ((v1-35 (-> self draw shadow-ctrl))) (set! (-> v1-35 settings top-plane w) (- (-> self path-position y)))) + 0 + (let ((v1-38 (-> self draw shadow-ctrl))) + (set! (-> v1-38 settings bot-plane w) (- (+ -8192.0 (-> self path-position y))))) + 0) + (else + (let ((v1-41 (-> self draw shadow-ctrl))) (logior! (-> v1-41 settings flags) (shadow-flags disable-draw))) + 0 + (let ((v1-44 (-> self draw shadow-ctrl))) (set! (-> v1-44 settings top-plane w) (- (-> self path-position y)))) + 0 + (let ((v1-47 (-> self draw shadow-ctrl))) + (set! (-> v1-47 settings bot-plane w) (- (+ -8192.0 (-> self path-position y))))) + 0)) + (let ((f0-32 (- f28-0 sv-112))) (if (< f0-32 f20-0) (set! f22-0 (/ f0-32 f20-0)))) + (+! sv-64 (* sv-80 (seconds-per-frame))) + (+! sv-48 (* sv-64 (seconds-per-frame))) + (when (< sv-48 0.0) + (set! sv-48 0.0) + (activate! (-> self smush) -0.15 90 150 1.0 1.0) + (set! sv-64 f24-0) + (sound-play "barrel-bounce" :vol 80) + (process-spawn part-tracker + :init + part-tracker-init + group-keg-bounce + -1 + keg-bounce-set-particle-rotation-callback + (-> self ppointer) + #f + (-> self root trans) + :to + self)) + (let ((f0-39 (update! (-> self smush)))) (keg-update-smush self f0-39)) + (+! (-> self root trans y) (* f22-0 sv-48)) + (set! (-> s5-0 x) 0.0) + (set! (-> s5-0 y) 1.0) + (set! (-> s5-0 z) 0.0)))) (ja :num! (loop!)) (suspend)))))))) :post keg-post) diff --git a/goal_src/jak1/levels/misty/mistycannon.gc b/goal_src/jak1/levels/misty/mistycannon.gc index 4dafe5715e..41844cb9ba 100644 --- a/goal_src/jak1/levels/misty/mistycannon.gc +++ b/goal_src/jak1/levels/misty/mistycannon.gc @@ -973,7 +973,7 @@ (f0-3 f1-3) (f30-0 (- (* arg2 arg1 arg1))) (f2-6 (+ f1-3 (* arg1 arg1 arg3))) - (f1-5 (- (* f30-0 f30-0) (* 4.0 f2-6 f0-3))) + (f1-5 (- (square f30-0) (* 4.0 f2-6 f0-3))) (f28-0 (/ 0.5 f0-3))) (if (< f1-5 0.0) (return #f)) (let ((f26-0 (sqrtf f1-5))) @@ -1230,7 +1230,6 @@ :post rider-post) (defmethod init-from-entity! ((this mistycannon) (arg0 entity-actor)) - (local-vars (sv-16 res-tag) (sv-32 res-tag) (sv-48 res-tag)) (logior! (-> this mask) (process-mask enemy)) (let ((s4-0 (new 'process 'collide-shape-moving this (collide-list-enum hit-by-others)))) (set! (-> s4-0 dynam) (copy *standard-dynamics* 'process)) @@ -1286,15 +1285,15 @@ (set! (-> this center-point quad) (-> this root trans quad)) (set! (-> this center-point w) (-> this fact idle-distance))) (else - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-64 (res-lump-data arg0 'center-point pointer :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-64 (res-lump-data arg0 'center-point pointer :tag-ptr (& sv-16)))) (set! (-> this center-point x) (if (and v1-64 (< 0.0 (the float (-> sv-16 elt-count)))) (-> (the-as (pointer float) v1-64)) 0.0))) - (set! sv-32 (new 'static 'res-tag)) - (let ((v1-67 (res-lump-data arg0 'center-point (pointer float) :tag-ptr (& sv-32)))) + (let* ((sv-32 (new 'static 'res-tag)) + (v1-67 (res-lump-data arg0 'center-point (pointer float) :tag-ptr (& sv-32)))) (set! (-> this center-point y) (if (and v1-67 (< 1.0 (the float (-> sv-32 elt-count)))) (-> v1-67 1) 0.0))) - (set! sv-48 (new 'static 'res-tag)) - (let ((v1-70 (res-lump-data arg0 'center-point (pointer float) :tag-ptr (& sv-48)))) + (let* ((sv-48 (new 'static 'res-tag)) + (v1-70 (res-lump-data arg0 'center-point (pointer float) :tag-ptr (& sv-48)))) (set! (-> this center-point z) (if (and v1-70 (< 2.0 (the float (-> sv-48 elt-count)))) (-> v1-70 2) 0.0))))) (set! (-> this accuracy-range) 16384.0) (mistycannon-pick-random-target-point) diff --git a/goal_src/jak1/levels/ogre/ogreboss.gc b/goal_src/jak1/levels/ogre/ogreboss.gc index b207362549..41516c54ef 100644 --- a/goal_src/jak1/levels/ogre/ogreboss.gc +++ b/goal_src/jak1/levels/ogre/ogreboss.gc @@ -1044,11 +1044,8 @@ (until (ja-done? 0) (suspend) (ja :num! (seek!))))) - (let* ((gp-0 (the int (* (-> self difficulty) (+ 8.0 (* 4.0 (-> self level)))))) - (f0-17 1.0) - (f1-2 0.15) - (f2-2 (-> self difficulty)) - (f30-0 (+ f0-17 (* f1-2 (* f2-2 f2-2) (-> self level))))) + (let ((gp-0 (the int (* (-> self difficulty) (+ 8.0 (* 4.0 (-> self level)))))) + (f30-0 (+ 1.0 (* 0.15 (square (-> self difficulty)) (-> self level))))) (ja-channel-push! 1 (seconds 0.1)) (ja-no-eval :group! ogreboss-attack2-start-ja :num! (seek! max f30-0) :frame-num 0.0) (until (ja-done? 0) diff --git a/goal_src/jak1/levels/racer_common/collide-reaction-racer.gc b/goal_src/jak1/levels/racer_common/collide-reaction-racer.gc index 73f8e80af1..134ecd813b 100644 --- a/goal_src/jak1/levels/racer_common/collide-reaction-racer.gc +++ b/goal_src/jak1/levels/racer_common/collide-reaction-racer.gc @@ -6,120 +6,119 @@ ;; DECOMP BEGINS (defun racer-collision-reaction ((arg0 control-info) (arg1 collide-shape-intersect) (arg2 vector) (arg3 vector)) - (local-vars (sv-80 vector) (sv-84 vector) (sv-88 (inline-array vector)) (sv-96 int) (sv-104 int)) - (set! sv-80 (new-stack-vector0)) - (set! sv-84 (new-stack-vector0)) - (let ((v1-2 (new 'stack-no-clear 'inline-array 'vector 2))) + (let ((sv-80 (new-stack-vector0)) + (sv-84 (new-stack-vector0)) + (v1-2 (new 'stack-no-clear 'inline-array 'vector 2))) (dotimes (a0-1 2) (set! (-> v1-2 a0-1 quad) (the-as uint128 0))) - (set! sv-88 v1-2)) - (set! sv-96 0) - (set! sv-104 0) - (set! (-> sv-88 0 quad) (-> arg3 quad)) - (set! (-> sv-88 1 quad) (-> arg3 quad)) - (let ((a1-3 (new 'stack-no-clear 'vector))) - (vector-float*! a1-3 (-> arg1 move-vec) (-> arg1 best-u)) - (move-by-vector! arg0 a1-3)) - (set-and-handle-pat! arg0 (-> arg1 best-tri pat)) - (if (= (-> arg0 poly-pat mode) (pat-mode wall)) (set! sv-104 (logior sv-104 1))) - (if (= (-> arg0 unknown-surface00 mode) 'air) (set! sv-104 (logior sv-104 32))) - (let ((v1-21 (new 'stack-no-clear 'vector))) - (set! (-> v1-21 quad) (-> arg1 best-from-prim prim-core world-sphere quad)) - (vector-! sv-80 v1-21 (-> arg1 best-tri intersect))) - (vector-normalize! sv-80 1.0) - (set! (-> arg0 coverage) (vector-dot sv-80 (-> arg1 best-tri normal))) - (when (< (-> arg0 coverage) 0.0) - (set! (-> arg0 coverage) 0.0) - (vector-flatten! sv-80 sv-80 (-> arg1 best-tri normal)) - (vector-normalize! sv-80 1.0)) - (if (< (-> arg0 coverage) 0.9999) (set! sv-104 (logior sv-104 24))) - (let ((v1-31 (-> sv-80 quad))) (set! (-> sv-84 quad) v1-31)) - (if (= (-> arg1 best-u) 0.0) (move-by-vector! arg0 (vector-normalize-copy! (new-stack-vector0) sv-84 3.0))) - (set! (-> arg0 poly-normal quad) (-> arg1 best-tri normal quad)) - (collide-shape-moving-angle-set! arg0 sv-84 (-> sv-88 0)) - (if (< (-> arg0 poly-angle) -0.2) (set! sv-96 (logior sv-96 16))) - (let ((s3-1 (< (fabs (-> arg0 surface-angle)) (-> *pat-mode-info* (-> arg0 cur-pat mode) wall-angle)))) - (if s3-1 (set! sv-104 (logior sv-104 2))) - (when (not (logtest? (-> arg0 prev-status) (cshape-moving-flags onsurf))) - (set! (-> arg0 ground-impact-vel) (- (vector-dot (-> arg0 transv) (-> arg0 dynam gravity-normal)))) - (set! sv-96 (logior sv-96 2048)) - (when (not s3-1) - (let ((f30-0 (- 1.0 (-> arg0 surf impact-fric)))) - (when (< f30-0 1.0) - (let ((s2-1 (new-stack-vector0)) - (f28-0 (vector-dot (-> arg0 dynam gravity-normal) (-> sv-88 0)))) - 0.0 - (vector-! s2-1 (-> sv-88 0) (vector-float*! s2-1 (-> arg0 dynam gravity-normal) f28-0)) - (let* ((f0-18 (vector-length s2-1)) - (f1-6 f0-18)) - (if (< f28-0 0.0) (set! f28-0 (* f28-0 f30-0))) - (vector+! (-> sv-88 0) - (vector-float*! (-> sv-88 0) (-> arg0 dynam gravity-normal) f28-0) - (vector-float*! s2-1 s2-1 (/ f0-18 f1-6))))))))) - (set! sv-96 (logior sv-96 4)) - (cond - ((-> arg1 best-to-prim) - (set! sv-96 (logior sv-96 32)) - (set! (-> arg0 unknown-vector72 quad) (-> arg1 best-tri intersect quad)) - (set! (-> arg0 unknown-vector73 quad) (-> arg0 poly-normal quad)) - (set! (-> arg0 unknown-handle00) (process->handle (-> arg1 best-to-prim cshape process)))) - ((= (-> arg0 poly-pat material) (pat-material waterbottom))) - (else (set! sv-96 (logior sv-96 4096)))) - (if (and s3-1 (logtest? (collide-action racer-unused) (-> arg0 root-prim prim-core action))) (set! s3-1 #f)) - (cond - (s3-1 - (set! sv-104 (logior sv-104 4)) - (set! sv-96 (logior sv-96 8)) - (set! (-> arg0 cur-pat mode) 1) - (set! (-> arg0 unknown-vector70 quad) (-> arg1 best-tri intersect quad)) - (set! (-> arg0 unknown-vector71 quad) (-> arg0 poly-normal quad)) - (set! (-> arg0 wall-pat) (-> arg1 best-tri pat)) - (vector-reflect-flat-above! arg2 (-> sv-88 0) sv-84) - (cond - ((not (and (>= (-> arg1 best-from-prim local-sphere w) - (vector-dot (-> arg0 ground-poly-normal) - (vector-! (new 'stack-no-clear 'vector) (-> arg1 best-tri intersect) (-> arg0 ground-touch-point)))) - (and (< 0.0 (vector-dot (-> arg0 ground-poly-normal) arg2)) - (not (time-elapsed? (-> arg0 unknown-dword10) (seconds 0.3))) - (not (logtest? sv-104 32)))))) - (else - (set! sv-104 (logior sv-104 256)) - (set! sv-104 (logand -65 sv-104)) - (let ((s3-3 (vector-cross! (new 'stack-no-clear 'vector) (-> arg0 poly-normal) (-> arg0 ground-poly-normal)))) - (vector-normalize! s3-3 1.0) - (vector-float*! arg2 s3-3 (vector-dot (-> sv-88 0) s3-3))) - (vector+! arg2 arg2 (-> arg0 poly-normal)))) - (let* ((s2-2 (vector-normalize-copy! (new 'stack-no-clear 'vector) (-> sv-88 0) 1.0)) - (s3-4 (new-stack-vector0)) - (f30-1 (vector-dot s2-2 arg2))) - 0.0 - (vector-! s3-4 arg2 (vector-float*! s3-4 s2-2 f30-1)) - (let* ((f1-11 (vector-length s3-4)) - (f0-27 f1-11) - (f1-12 (* 0.9 f1-11))) - (vector+! arg2 (vector-float*! arg2 s2-2 f30-1) (vector-float*! s3-4 s3-4 (/ f1-12 f0-27)))))) - (else - (set! sv-96 (logior sv-96 1)) - (set! (-> arg0 cur-pat mode) 0) - (if (and (= (-> arg1 best-from-prim prim-id) 6) (not (logtest? sv-104 7))) - (set! (-> arg0 local-normal quad) (-> sv-84 quad))) - (vector-reflect-flat! arg2 (-> sv-88 0) sv-84) - (dotimes (v1-142 16) - (vector+! arg2 arg2 (-> arg0 poly-normal))) - (set! sv-96 (logior sv-96 2)) - (set! (-> arg0 ground-touch-point w) 0.0) - (when (not (logtest? sv-104 15)) - (set! sv-96 (logior sv-96 2)) - (set! (-> arg0 ground-poly-normal quad) (-> arg0 poly-normal quad)) - (set! (-> arg0 unknown-vector53 quad) (-> sv-84 quad)) - (set! (-> arg0 unknown-float60) (vector-dot sv-84 (-> arg0 dynam gravity-normal))) - (set-time! (-> arg0 unknown-dword10)) - (set! (-> arg0 ground-pat) (-> arg0 poly-pat)) - (set! (-> arg0 ground-touch-point quad) (-> arg1 best-tri intersect quad)) - (set! sv-104 (logior sv-104 2048)) - (if (= (-> arg0 poly-pat material) (pat-material waterbottom)) (set! sv-96 (logior sv-96 1024))))))) - (logior! (-> arg0 status) sv-96) - (set! (-> arg0 reaction-flag) (the-as cshape-reaction-flags sv-104)) - (update! (-> arg0 history-data (-> arg0 unknown-halfword00)) arg0 (-> arg1 best-tri intersect) (-> sv-88 1) arg2) - (set! (-> arg0 unknown-halfword00) (logand (+ (-> arg0 unknown-halfword00) 1) 127)) - (the-as cshape-moving-flags sv-96)) + (let ((sv-88 v1-2) + (sv-96 0)) + (let ((sv-104 0)) + (set! (-> sv-88 0 quad) (-> arg3 quad)) + (set! (-> sv-88 1 quad) (-> arg3 quad)) + (let ((a1-3 (new 'stack-no-clear 'vector))) + (vector-float*! a1-3 (-> arg1 move-vec) (-> arg1 best-u)) + (move-by-vector! arg0 a1-3)) + (set-and-handle-pat! arg0 (-> arg1 best-tri pat)) + (if (= (-> arg0 poly-pat mode) (pat-mode wall)) (logior! sv-104 1)) + (if (= (-> arg0 unknown-surface00 mode) 'air) (logior! sv-104 32)) + (let ((v1-21 (new 'stack-no-clear 'vector))) + (set! (-> v1-21 quad) (-> arg1 best-from-prim prim-core world-sphere quad)) + (vector-! sv-80 v1-21 (-> arg1 best-tri intersect))) + (vector-normalize! sv-80 1.0) + (set! (-> arg0 coverage) (vector-dot sv-80 (-> arg1 best-tri normal))) + (when (< (-> arg0 coverage) 0.0) + (set! (-> arg0 coverage) 0.0) + (vector-flatten! sv-80 sv-80 (-> arg1 best-tri normal)) + (vector-normalize! sv-80 1.0)) + (if (< (-> arg0 coverage) 0.9999) (logior! sv-104 24)) + (set! (-> sv-84 quad) (-> sv-80 quad)) + (if (= (-> arg1 best-u) 0.0) (move-by-vector! arg0 (vector-normalize-copy! (new-stack-vector0) sv-84 3.0))) + (set! (-> arg0 poly-normal quad) (-> arg1 best-tri normal quad)) + (collide-shape-moving-angle-set! arg0 sv-84 (-> sv-88 0)) + (if (< (-> arg0 poly-angle) -0.2) (logior! sv-96 16)) + (let ((s3-1 (< (fabs (-> arg0 surface-angle)) (-> *pat-mode-info* (-> arg0 cur-pat mode) wall-angle)))) + (if s3-1 (logior! sv-104 2)) + (when (not (logtest? (-> arg0 prev-status) (cshape-moving-flags onsurf))) + (set! (-> arg0 ground-impact-vel) (- (vector-dot (-> arg0 transv) (-> arg0 dynam gravity-normal)))) + (logior! sv-96 2048) + (when (not s3-1) + (let ((f30-0 (- 1.0 (-> arg0 surf impact-fric)))) + (when (< f30-0 1.0) + (let ((s2-1 (new-stack-vector0)) + (f28-0 (vector-dot (-> arg0 dynam gravity-normal) (-> sv-88 0)))) + 0.0 + (vector-! s2-1 (-> sv-88 0) (vector-float*! s2-1 (-> arg0 dynam gravity-normal) f28-0)) + (let* ((f0-18 (vector-length s2-1)) + (f1-6 f0-18)) + (if (< f28-0 0.0) (set! f28-0 (* f28-0 f30-0))) + (vector+! (-> sv-88 0) + (vector-float*! (-> sv-88 0) (-> arg0 dynam gravity-normal) f28-0) + (vector-float*! s2-1 s2-1 (/ f0-18 f1-6))))))))) + (logior! sv-96 4) + (cond + ((-> arg1 best-to-prim) + (logior! sv-96 32) + (set! (-> arg0 unknown-vector72 quad) (-> arg1 best-tri intersect quad)) + (set! (-> arg0 unknown-vector73 quad) (-> arg0 poly-normal quad)) + (set! (-> arg0 unknown-handle00) (process->handle (-> arg1 best-to-prim cshape process)))) + ((= (-> arg0 poly-pat material) (pat-material waterbottom))) + (else (logior! sv-96 4096))) + (if (and s3-1 (logtest? (collide-action racer-unused) (-> arg0 root-prim prim-core action))) (set! s3-1 #f)) + (cond + (s3-1 + (logior! sv-104 4) + (logior! sv-96 8) + (set! (-> arg0 cur-pat mode) 1) + (set! (-> arg0 unknown-vector70 quad) (-> arg1 best-tri intersect quad)) + (set! (-> arg0 unknown-vector71 quad) (-> arg0 poly-normal quad)) + (set! (-> arg0 wall-pat) (-> arg1 best-tri pat)) + (vector-reflect-flat-above! arg2 (-> sv-88 0) sv-84) + (cond + ((not (and (>= (-> arg1 best-from-prim local-sphere w) + (vector-dot (-> arg0 ground-poly-normal) + (vector-! (new 'stack-no-clear 'vector) (-> arg1 best-tri intersect) (-> arg0 ground-touch-point)))) + (and (< 0.0 (vector-dot (-> arg0 ground-poly-normal) arg2)) + (not (time-elapsed? (-> arg0 unknown-dword10) (seconds 0.3))) + (not (logtest? sv-104 32)))))) + (else + (logior! sv-104 256) + (logand! sv-104 -65) + (let ((s3-3 (vector-cross! (new 'stack-no-clear 'vector) (-> arg0 poly-normal) (-> arg0 ground-poly-normal)))) + (vector-normalize! s3-3 1.0) + (vector-float*! arg2 s3-3 (vector-dot (-> sv-88 0) s3-3))) + (vector+! arg2 arg2 (-> arg0 poly-normal)))) + (let* ((s2-2 (vector-normalize-copy! (new 'stack-no-clear 'vector) (-> sv-88 0) 1.0)) + (s3-4 (new-stack-vector0)) + (f30-1 (vector-dot s2-2 arg2))) + 0.0 + (vector-! s3-4 arg2 (vector-float*! s3-4 s2-2 f30-1)) + (let* ((f1-11 (vector-length s3-4)) + (f0-27 f1-11) + (f1-12 (* 0.9 f1-11))) + (vector+! arg2 (vector-float*! arg2 s2-2 f30-1) (vector-float*! s3-4 s3-4 (/ f1-12 f0-27)))))) + (else + (logior! sv-96 1) + (set! (-> arg0 cur-pat mode) 0) + (if (and (= (-> arg1 best-from-prim prim-id) 6) (not (logtest? sv-104 7))) + (set! (-> arg0 local-normal quad) (-> sv-84 quad))) + (vector-reflect-flat! arg2 (-> sv-88 0) sv-84) + (dotimes (v1-142 16) + (vector+! arg2 arg2 (-> arg0 poly-normal))) + (logior! sv-96 2) + (set! (-> arg0 ground-touch-point w) 0.0) + (when (not (logtest? sv-104 15)) + (logior! sv-96 2) + (set! (-> arg0 ground-poly-normal quad) (-> arg0 poly-normal quad)) + (set! (-> arg0 unknown-vector53 quad) (-> sv-84 quad)) + (set! (-> arg0 unknown-float60) (vector-dot sv-84 (-> arg0 dynam gravity-normal))) + (set-time! (-> arg0 unknown-dword10)) + (set! (-> arg0 ground-pat) (-> arg0 poly-pat)) + (set! (-> arg0 ground-touch-point quad) (-> arg1 best-tri intersect quad)) + (logior! sv-104 2048) + (if (= (-> arg0 poly-pat material) (pat-material waterbottom)) (logior! sv-96 1024)))))) + (logior! (-> arg0 status) sv-96) + (set! (-> arg0 reaction-flag) (the-as cshape-reaction-flags sv-104))) + (update! (-> arg0 history-data (-> arg0 unknown-halfword00)) arg0 (-> arg1 best-tri intersect) (-> sv-88 1) arg2) + (set! (-> arg0 unknown-halfword00) (logand (+ (-> arg0 unknown-halfword00) 1) 127)) + (the-as cshape-moving-flags sv-96)))) diff --git a/goal_src/jak1/levels/rolling/rolling-lightning-mole.gc b/goal_src/jak1/levels/rolling/rolling-lightning-mole.gc index 5de632d972..2dce7bde3a 100644 --- a/goal_src/jak1/levels/rolling/rolling-lightning-mole.gc +++ b/goal_src/jak1/levels/rolling/rolling-lightning-mole.gc @@ -8,7 +8,7 @@ ;; DECOMP BEGINS (defun find-adjacent-bounds-one ((arg0 nav-mesh) (arg1 nav-poly) (arg2 int) (arg3 (array int8)) (arg4 (array int8)) (arg5 vector)) - (local-vars (v0-2 object) (v1-2 int) (v1-30 int) (a0-2 int) (a0-12 int) (sv-16 nav-poly) (sv-32 int)) + (local-vars (v0-2 object) (v1-2 int) (v1-30 int) (a0-2 int) (a0-12 int)) (let ((v1-1 (+ arg2 1))) (let ((a0-1 2)) (set-on-less-than a0-2 a0-1 v1-1)) (move-if-not-zero v1-2 0 a0-2 v1-1)) (let ((v1-4 (-> arg1 adj-poly v1-2))) (cond @@ -16,32 +16,32 @@ ((not (logtest? (-> arg0 poly v1-4 pat) 1)) (format 0 "ERROR: find-adjacent-bounds-one given a non-boundary edge to start~%") (return #f)))) - (let ((s0-0 (-> arg1 vertex (-> arg3 arg2)))) - (set! sv-16 arg1) + (let ((s0-0 (-> arg1 vertex (-> arg3 arg2))) + (sv-16 arg1)) (while (begin (label cfg-28) #t) - (set! sv-32 0) - (while (< sv-32 3) - (cond - ((and (= sv-32 arg2) (= sv-16 arg1))) - ((= s0-0 (-> sv-16 vertex (-> arg4 sv-32))) - (vector+! arg5 (-> arg0 origin) (the-as vector (-> arg0 vertex (-> sv-16 vertex (-> arg3 sv-32))))) - (let ((v1-29 (+ sv-32 1))) - (let ((a0-11 2)) (set-on-less-than a0-12 a0-11 v1-29)) - (move-if-not-zero v1-30 0 a0-12 v1-29)) - (let ((v1-32 (-> sv-16 adj-poly v1-30))) - (if (= v1-32 255) (return #t)) - (let ((v1-35 (-> arg0 poly v1-32))) - (set! v0-2 - (cond - ((= arg1 v1-35) (format 0 "ERROR: find-adjacent-bounds-one given tried to go back~%")) - (else - (cond - ((logtest? (-> v1-35 pat) 1) (return #t)) - (else (set! arg1 sv-16) (set! sv-16 v1-35) (goto cfg-28))) - v0-2))))))) - (set! sv-32 (+ sv-32 1))) + (let ((sv-32 0)) + (while (< sv-32 3) + (cond + ((and (= sv-32 arg2) (= sv-16 arg1))) + ((= s0-0 (-> sv-16 vertex (-> arg4 sv-32))) + (vector+! arg5 (-> arg0 origin) (the-as vector (-> arg0 vertex (-> sv-16 vertex (-> arg3 sv-32))))) + (let ((v1-29 (+ sv-32 1))) + (let ((a0-11 2)) (set-on-less-than a0-12 a0-11 v1-29)) + (move-if-not-zero v1-30 0 a0-12 v1-29)) + (let ((v1-32 (-> sv-16 adj-poly v1-30))) + (if (= v1-32 255) (return #t)) + (let ((v1-35 (-> arg0 poly v1-32))) + (set! v0-2 + (cond + ((= arg1 v1-35) (format 0 "ERROR: find-adjacent-bounds-one given tried to go back~%")) + (else + (cond + ((logtest? (-> v1-35 pat) 1) (return #t)) + (else (set! arg1 sv-16) (set! sv-16 v1-35) (goto cfg-28))) + v0-2))))))) + (+! sv-32 1))) (format 0 "ERROR: abnormal exit from find-adjacent-bounds-one~%") (return #f))) #f) @@ -127,7 +127,6 @@ (parameter-ease-sin-clamp (* 0.00081380206 (+ -409.6 f30-0))))))) (defun fleeing-nav-enemy-clip-travel ((arg0 fleeing-nav-enemy) (arg1 vector)) - (local-vars (sv-224 vector) (sv-240 vector) (sv-256 vector) (sv-272 vector) (sv-288 vector)) (let ((s2-0 (new 'stack 'clip-travel-vector-to-mesh-return-info)) (gp-0 (new 'stack-no-clear 'vector)) (s1-0 #f)) @@ -155,33 +154,18 @@ (cond ((< (cos f28-1) f30-0) (vector--float*! s3-0 s0-0 (-> s2-0 boundary-normal) f30-0) - (let ((s0-1 vector-normalize!)) (set! sv-224 s3-0) (let ((a1-7 (sin f28-1))) (s0-1 sv-224 a1-7))) - (let ((s0-2 vector+float*!)) - (set! sv-240 s3-0) - (set! sv-256 s3-0) - (let ((s2-1 (-> s2-0 boundary-normal)) - (a3-1 (cos f28-1))) - (s0-2 sv-240 sv-256 s2-1 a3-1)))) + (vector-normalize! s3-0 (sin f28-1)) + (vector+float*! s3-0 s3-0 (-> s2-0 boundary-normal) (cos f28-1))) (else (let ((v1-15 s3-0)) (set! (-> v1-15 quad) (-> s0-0 quad)) v1-15))))) ((< (cos (-> arg0 flee-info min-reflect-angle)) f30-0) (vector--float*! s3-0 s0-0 (-> s2-0 boundary-normal) f30-0) (vector-normalize! s3-0 (sin (-> arg0 flee-info min-reflect-angle))) - (let ((s1-2 vector--float*!) - (s0-4 s3-0)) - (set! sv-272 s3-0) - (let ((s2-2 (-> s2-0 boundary-normal)) - (a3-3 (cos (-> arg0 flee-info min-reflect-angle)))) - (s1-2 s0-4 sv-272 s2-2 a3-3))) + (vector--float*! s3-0 s3-0 (-> s2-0 boundary-normal) (cos (-> arg0 flee-info min-reflect-angle))) (set! s1-0 #t)) ((< f30-0 (cos (-> arg0 flee-info max-reflect-angle))) (vector--float*! s3-0 s0-0 (-> s2-0 boundary-normal) f30-0) (vector-normalize! s3-0 (sin (-> arg0 flee-info max-reflect-angle))) - (let ((s1-4 vector--float*!) - (s0-6 s3-0)) - (set! sv-288 s3-0) - (let ((s2-3 (-> s2-0 boundary-normal)) - (a3-5 (cos (-> arg0 flee-info max-reflect-angle)))) - (s1-4 s0-6 sv-288 s2-3 a3-5))) + (vector--float*! s3-0 s3-0 (-> s2-0 boundary-normal) (cos (-> arg0 flee-info max-reflect-angle))) (set! s1-0 #t)) (else (vector--float*! s3-0 s0-0 (-> s2-0 boundary-normal) (* 2.0 f30-0)) (set! s1-0 #t))))) (vector-normalize-copy! arg1 s3-0 (-> arg0 flee-info deflection-max-dist)))) @@ -385,25 +369,24 @@ :shadow lightning-mole-shadow-mg) (defbehavior lightning-mole-task-complete? lightning-mole () - (local-vars (sv-16 symbol)) (process-entity-status! self (entity-perm-status complete) #t) (when (or (-> self link prev) (-> self link next)) - (set! sv-16 (the-as symbol #f)) - (apply-all (-> self link) actor-link-subtask-complete-hook (& sv-16)) - (cond - (sv-16 - (close-specific-task! (-> self entity extra perm task) (task-status need-reminder)) - (process-spawn-function process - (lambda :behavior lightning-mole () - (while (or (-> *setting-control* current ambient) (-> *setting-control* current movie) (-> *setting-control* current hint)) - (suspend)) - (level-hint-spawn (text-id rolling-moles-resolution) "sksp0112" (the-as entity #f) *entity-pool* (game-task none)) - (none)) - :to - self) - (format #t "lightning-mole task is complete~%")) - (else)) - sv-16)) + (let ((sv-16 (the-as symbol #f))) + (apply-all (-> self link) actor-link-subtask-complete-hook (& sv-16)) + (cond + (sv-16 + (close-specific-task! (-> self entity extra perm task) (task-status need-reminder)) + (process-spawn-function process + (lambda :behavior lightning-mole () + (while (or (-> *setting-control* current ambient) (-> *setting-control* current movie) (-> *setting-control* current hint)) + (suspend)) + (level-hint-spawn (text-id rolling-moles-resolution) "sksp0112" (the-as entity #f) *entity-pool* (game-task none)) + (none)) + :to + self) + (format #t "lightning-mole task is complete~%")) + (else)) + sv-16))) (defbehavior lightning-mole-hole-post lightning-mole () (set! (-> self nav target-pos quad) (-> *lightning-mole-hole* quad)) diff --git a/goal_src/jak1/levels/rolling/rolling-robber.gc b/goal_src/jak1/levels/rolling/rolling-robber.gc index bac5e00810..e87ff0c842 100644 --- a/goal_src/jak1/levels/rolling/rolling-robber.gc +++ b/goal_src/jak1/levels/rolling/rolling-robber.gc @@ -84,6 +84,7 @@ robber-initial-notice robber-tired)) + (defskelgroup *robber-sg* robber robber-lod0-jg @@ -97,17 +98,16 @@ (('attack) (go robber-die)))) (defbehavior robber-task-complete? robber () - (local-vars (sv-16 symbol)) (process-entity-status! self (entity-perm-status complete) #t) (when (or (-> self link prev) (-> self link next)) - (set! sv-16 (the-as symbol #f)) - (apply-all (-> self link) actor-link-subtask-complete-hook (& sv-16)) - (cond - (sv-16 - (close-specific-task! (-> self entity extra perm task) (task-status need-reminder)) - (format #t "robber task is complete~%")) - (else)) - sv-16)) + (let ((sv-16 (the-as symbol #f))) + (apply-all (-> self link) actor-link-subtask-complete-hook (& sv-16)) + (cond + (sv-16 + (close-specific-task! (-> self entity extra perm task) (task-status need-reminder)) + (format #t "robber task is complete~%")) + (else)) + sv-16))) (defbehavior robber-find-ground robber () (let ((gp-0 (new 'stack-no-clear 'vector))) @@ -146,7 +146,7 @@ (matrix->quaternion (-> self root quat) s5-0) (set! (-> self run-blend-interp) (acos (vector-dot gp-0 (-> self facing)))) (set! (-> self run-blend-interp) (* 0.0002746582 (-> self run-blend-interp))) - (if (< (vector-dot (-> self facing) (the-as vector (-> s5-0 vector))) 0.0) + (if (< (vector-dot (-> self facing) (-> s5-0 vector 0)) 0.0) (set! (-> self run-blend-interp) (- (-> self run-blend-interp)))) (let ((v0-10 (-> self facing))) (set! (-> v0-10 quad) (-> gp-0 quad)) v0-10))) diff --git a/goal_src/jak1/levels/snow/snow-ball.gc b/goal_src/jak1/levels/snow/snow-ball.gc index 9deec808c3..ea8868a9a5 100644 --- a/goal_src/jak1/levels/snow/snow-ball.gc +++ b/goal_src/jak1/levels/snow/snow-ball.gc @@ -135,9 +135,7 @@ (let ((f0-6 (-> this path-faded-up-u))) (cond ((< (-> this path-u) f0-6) - (let* ((f0-7 (/ (-> this path-u) f0-6)) - (f0-8 (* f0-7 f0-7))) - (set-vector! (-> this draw color-mult) f0-8 f0-8 f0-8 1.0))) + (let ((f0-8 (square (/ (-> this path-u) f0-6)))) (set-vector! (-> this draw color-mult) f0-8 f0-8 f0-8 1.0))) (else (vector-identity! (-> this draw color-mult))))) (cond ((>= (-> this path-u) (-> this path-fall-u)) diff --git a/goal_src/jak1/levels/snow/snow-bumper.gc b/goal_src/jak1/levels/snow/snow-bumper.gc index 8239784457..41f8255482 100644 --- a/goal_src/jak1/levels/snow/snow-bumper.gc +++ b/goal_src/jak1/levels/snow/snow-bumper.gc @@ -170,7 +170,6 @@ :trans rider-trans :code (behavior () - (local-vars (sv-16 symbol)) (logclear! (-> self mask) (process-mask actor-pause)) (sound-play "bumper-pwr-dwn") (ja-no-eval :group! snow-bumper-button-ja :num! (seek! max 0.05) :frame-num 0.0) @@ -188,11 +187,11 @@ (suspend) (ja :num! (seek! max 0.02))) (process-entity-status! self (entity-perm-status complete) #t) - (set! sv-16 (the-as symbol #f)) - (apply-all (-> self link) actor-link-subtask-complete-hook (& sv-16)) - (when sv-16 - (save-reminder (get-task-control (game-task snow-bumpers)) (-> self bumper-id) 0) - (go snow-bumper-spawn-fuel-cell)) + (let ((sv-16 (the-as symbol #f))) + (apply-all (-> self link) actor-link-subtask-complete-hook (& sv-16)) + (when sv-16 + (save-reminder (get-task-control (game-task snow-bumpers)) (-> self bumper-id) 0) + (go snow-bumper-spawn-fuel-cell))) (go snow-bumper-inactive-idle)) :post rider-post) @@ -235,7 +234,6 @@ (call-parent-method this offset)) (defmethod init-from-entity! ((this snow-bumper) (arg0 entity-actor)) - (local-vars (sv-16 res-tag)) (set! (-> this last-shoved-player-time) 0) (let ((s4-0 (new 'process 'collide-shape-moving this (collide-list-enum hit-by-player)))) (set! (-> s4-0 dynam) (copy *standard-dynamics* 'process)) @@ -281,8 +279,8 @@ (transform-post) (set! (-> this base-shove-ry) 0.0) (set! (-> this max-shove-diff-ry) 32768.0) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-52 (res-lump-data (-> this entity) 'rotmin (pointer float) :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-52 (res-lump-data (-> this entity) 'rotmin (pointer float) :tag-ptr (& sv-16)))) (when v1-52 (set! (-> this base-shove-ry) (-> v1-52 0)) (set! (-> this max-shove-diff-ry) (-> v1-52 1)))) diff --git a/goal_src/jak1/levels/snow/snow-bunny.gc b/goal_src/jak1/levels/snow/snow-bunny.gc index b51024dc70..a8d8e5e7c5 100644 --- a/goal_src/jak1/levels/snow/snow-bunny.gc +++ b/goal_src/jak1/levels/snow/snow-bunny.gc @@ -364,7 +364,6 @@ #f) (defmethod nav-enemy-method-54 ((this snow-bunny)) - (local-vars (sv-48 (function float float))) (set! (-> this using-jump-event?) #f) (let* ((s5-1 (vector-! (new 'stack-no-clear 'vector) (-> this final-dest) (-> this collide-info trans))) (f30-0 (vector-length s5-1)) @@ -380,12 +379,7 @@ (vector-rotate-around-y! s5-1 s5-1 16384.0) (vector-normalize! s5-1 (- f30-0 f28-0)) (let ((s4-0 (new 'stack-no-clear 'vector))) - (let ((s3-0 vector+*!) - (s2-0 s4-0) - (s1-0 (-> this final-dest)) - (s0-0 s5-1)) - (set! sv-48 sin) - (let ((a0-9 (rand-vu-float-range -16384.0 16384.0))) (s3-0 s2-0 s1-0 s0-0 (sv-48 a0-9)))) + (vector+*! s4-0 (-> this final-dest) s5-1 (sin (rand-vu-float-range -16384.0 16384.0))) (vector-! s5-1 s4-0 (-> this collide-info trans)) (when (< f28-0 (vector-length s5-1)) (vector-normalize! s5-1 f28-0) @@ -499,7 +493,6 @@ :post #f) (defmethod nav-enemy-method-52 ((this snow-bunny)) - (local-vars (sv-48 (function float float))) (set! (-> this using-jump-event?) #f) (if (not *target*) (return #f)) (let ((s4-0 (-> this final-dest))) @@ -515,11 +508,7 @@ (vector-rotate-around-y! s5-2 s5-2 16384.0) (vector-normalize! s5-2 (- f28-0 f30-0)) (let ((s3-0 (new 'stack-no-clear 'vector))) - (let ((s2-0 vector+*!) - (s1-0 s3-0) - (s0-0 s5-2)) - (set! sv-48 sin) - (let ((a0-11 (rand-vu-float-range -16384.0 16384.0))) (s2-0 s1-0 s4-0 s0-0 (sv-48 a0-11)))) + (vector+*! s3-0 s4-0 s5-2 (sin (rand-vu-float-range -16384.0 16384.0))) (vector-! s5-2 s3-0 (-> this collide-info trans)) (when (< f30-0 (vector-length s5-2)) (vector-normalize! s5-2 f30-0) diff --git a/goal_src/jak1/levels/snow/snow-flutflut-obs.gc b/goal_src/jak1/levels/snow/snow-flutflut-obs.gc index b0be8b0a60..caea3ab2af 100644 --- a/goal_src/jak1/levels/snow/snow-flutflut-obs.gc +++ b/goal_src/jak1/levels/snow/snow-flutflut-obs.gc @@ -458,8 +458,7 @@ (behavior () (plat-trans) (let* ((f0-1 (fmin 1.0 (/ (the float (- (current-time) (-> self state-time))) (the float (-> self rise-time))))) - (f0-2 (- 1.0 f0-1)) - (f0-3 (* f0-2 f0-2)) + (f0-3 (square (- 1.0 f0-1))) (f30-0 (- 1.0 f0-3))) (vector-lerp! (-> self basetrans) (-> self appear-trans-bottom) (-> self appear-trans-top) f30-0) (quaternion-slerp! (-> self root quat) (-> self appear-quat-bottom) (-> self appear-quat-top) f30-0) @@ -543,8 +542,7 @@ :trans (behavior () (plat-trans) - (let* ((f0-1 (fmin 1.0 (/ (the float (- (current-time) (-> self state-time))) (the float (-> self fall-time))))) - (f30-0 (* f0-1 f0-1))) + (let ((f30-0 (square (fmin 1.0 (/ (the float (- (current-time) (-> self state-time))) (the float (-> self fall-time))))))) (vector-lerp! (-> self basetrans) (-> self start-trans) (-> self appear-trans-bottom) f30-0) (quaternion-slerp! (-> self root quat) (-> self appear-quat-top) (-> self appear-quat-bottom) f30-0) (let ((f0-3 (- 1.0 f30-0))) (set-vector! (-> self draw color-mult) f0-3 f0-3 f0-3 1.0)) diff --git a/goal_src/jak1/levels/snow/snow-obs.gc b/goal_src/jak1/levels/snow/snow-obs.gc index 83997615c2..5491cef54a 100644 --- a/goal_src/jak1/levels/snow/snow-obs.gc +++ b/goal_src/jak1/levels/snow/snow-obs.gc @@ -403,12 +403,11 @@ :post pusher-post) (defmethod init-from-entity! ((this snowpusher) (arg0 entity-actor)) - (local-vars (sv-16 res-tag)) (logior! (-> this mask) (process-mask enemy platform)) (let ((s3-0 0) (s4-0 0)) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-3 (res-lump-data (-> this entity) 'mode (pointer int32) :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-3 (res-lump-data (-> this entity) 'mode (pointer int32) :tag-ptr (& sv-16)))) (when v1-3 (set! s3-0 (-> v1-3 0)) (set! s4-0 (-> v1-3 1)))) diff --git a/goal_src/jak1/levels/snow/snow-ram.gc b/goal_src/jak1/levels/snow/snow-ram.gc index e12765544a..ff7ab137e8 100644 --- a/goal_src/jak1/levels/snow/snow-ram.gc +++ b/goal_src/jak1/levels/snow/snow-ram.gc @@ -170,7 +170,6 @@ (if (-> self give-fuel-cell-anim) (spool-push *art-control* (-> self give-fuel-cell-anim name) 0 self -99.0))) :code (behavior () - (local-vars (sv-16 symbol)) (ja-channel-push! 1 (seconds 0.075)) (loop (sound-play "set-ram") @@ -191,14 +190,14 @@ (suspend) (ja :num! (seek!)))) (logior! (-> self mask) (process-mask actor-pause)) - (set! sv-16 (the-as symbol #f)) - (apply-function-forward (-> self link) actor-link-dead-hook (& sv-16)) - (when (or sv-16 (nonzero? (-> self root riders num-riders))) - (let ((v1-67 (-> self entity extra perm))) - (logior! (-> v1-67 status) (entity-perm-status user-set-from-cstage)) - (set! (-> v1-67 user-int8 0) 1)) - (send-event (ppointer->process (-> self child)) 'jump) - (go ram-fun-idle)))) + (let ((sv-16 (the-as symbol #f))) + (apply-function-forward (-> self link) actor-link-dead-hook (& sv-16)) + (when (or sv-16 (nonzero? (-> self root riders num-riders))) + (let ((v1-67 (-> self entity extra perm))) + (logior! (-> v1-67 status) (entity-perm-status user-set-from-cstage)) + (set! (-> v1-67 user-int8 0) 1)) + (send-event (ppointer->process (-> self child)) 'jump) + (go ram-fun-idle))))) :post rider-post) (defstate ram-fun-idle (ram) diff --git a/goal_src/jak1/levels/sunken/puffer.gc b/goal_src/jak1/levels/sunken/puffer.gc index a888caa327..f72929d319 100644 --- a/goal_src/jak1/levels/sunken/puffer.gc +++ b/goal_src/jak1/levels/sunken/puffer.gc @@ -380,7 +380,7 @@ (when *target* (if *target* (look-at-enemy! (-> *target* neck) - (the-as vector (-> (the-as collide-shape-prim-group (-> self root root-prim)) prims 0 prim-core)) + (-> (the-as collide-shape-prim-group (-> self root root-prim)) prims 0 prim-core world-sphere) 'attacking self)) (set-target! (-> self neck) (target-pos 5))) @@ -656,7 +656,6 @@ (call-parent-method this offset)) (defmethod init-from-entity! ((this puffer) (arg0 entity-actor)) - (local-vars (sv-16 res-tag)) (set! (-> this cprims-type) (the-as uint 0)) (set! (-> this attacking?) #f) (set! (-> this buddy) #f) @@ -698,8 +697,8 @@ (set! (-> this patrol-bottom-y) (-> this root trans y)) (let ((f28-0 8192.0) (f30-0 -8192.0)) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-54 (res-lump-data arg0 'distance (pointer float) :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-54 (res-lump-data arg0 'distance (pointer float) :tag-ptr (& sv-16)))) (when v1-54 (set! f28-0 (-> v1-54 0)) (set! f30-0 (-> v1-54 1)))) diff --git a/goal_src/jak1/levels/sunken/shover.gc b/goal_src/jak1/levels/sunken/shover.gc index b2ea4a14d7..d48dce8c8c 100644 --- a/goal_src/jak1/levels/sunken/shover.gc +++ b/goal_src/jak1/levels/sunken/shover.gc @@ -15,6 +15,7 @@ (:states shover-idle)) + (defskelgroup *shover-sg* shover shover-lod0-jg @@ -50,7 +51,6 @@ :code anim-loop) (defmethod init-from-entity! ((this shover) (arg0 entity-actor)) - (local-vars (sv-16 res-tag)) (set! (-> this shove-up) (res-lump-float arg0 'shove :default 12288.0)) (let ((s3-0 (res-lump-value arg0 'collision-mesh-id uint128)) (s4-0 (new 'process 'collide-shape this (collide-list-enum hit-by-player)))) @@ -71,8 +71,8 @@ (set! (-> this path) v1-17) (logior! (-> v1-17 flags) (path-control-flag display draw-line draw-point draw-text)) (if (<= (-> v1-17 curve num-cverts) 0) (go process-drawable-art-error "no path"))) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-23 (res-lump-data arg0 'trans-offset (pointer float) :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-23 (res-lump-data arg0 'trans-offset (pointer float) :tag-ptr (& sv-16)))) (when v1-23 (+! (-> this root trans x) (-> v1-23 0)) (+! (-> this root trans y) (-> v1-23 1)) diff --git a/goal_src/jak1/levels/sunken/square-platform.gc b/goal_src/jak1/levels/sunken/square-platform.gc index 5ffd81ed4b..f9aa8ef7ce 100644 --- a/goal_src/jak1/levels/sunken/square-platform.gc +++ b/goal_src/jak1/levels/sunken/square-platform.gc @@ -150,7 +150,7 @@ :parts ((sp-item 2222 :flags (is-3d)) (sp-item 2315 :flags (is-3d)))) (defmethod square-platform-method-27 ((this square-platform) (arg0 symbol)) - (local-vars (v0-3 sound-id) (sv-48 int)) + (local-vars (v0-3 sound-id)) (let ((s4-0 (new 'stack-no-clear 'vector))) (set! (-> s4-0 quad) (-> this root trans quad)) (+! (-> s4-0 y) -20480.0) @@ -171,15 +171,7 @@ (else (when (>= f0-2 (-> s4-0 y)) (set-time! (-> this start-splash-time)) - (let ((s2-0 sound-play-by-name) - (s1-0 (make-u128 #x6873616c (the-as uint #x70732d656772616c))) - (s0-0 (new-sound-id))) - (set! sv-48 1024) - (let ((a3-0 (the int (* 1524.0 (rand-vu-float-range -0.8 0.8)))) - (t0-0 0) - (t1-0 1) - (t2-0 #t)) - (s2-0 (the-as sound-name s1-0) s0-0 sv-48 a3-0 t0-0 (the-as sound-group t1-0) t2-0)))))))) + (sound-play "large-splash" :pitch (rand-vu-float-range -0.8 0.8))))))) (when (nonzero? (-> this start-splash-time)) (cond (arg0 @@ -293,7 +285,6 @@ (call-parent-method this offset)) (defmethod init-from-entity! ((this square-platform) (arg0 entity-actor)) - (local-vars (sv-16 res-tag) (sv-32 res-tag)) (set! (-> this pos-u) 0.0) (let ((s4-0 (new 'process 'collide-shape-moving this (collide-list-enum hit-by-player)))) (set! (-> s4-0 dynam) (copy *standard-dynamics* 'process)) @@ -320,16 +311,16 @@ (let ((s4-1 (-> this skel root-channel 0))) (joint-control-channel-group-eval! s4-1 (the-as art-joint-anim (-> this draw art-group data 3)) num-func-identity) (set! (-> s4-1 frame-num) 0.0)) - (set! sv-16 (new 'static 'res-tag)) - (let* ((v1-32 (res-lump-data (-> this entity) 'distance pointer :tag-ptr (& sv-16))) - (f30-0 (if (and v1-32 (> (the-as int (-> sv-16 elt-count)) 0)) (-> (the-as (pointer float) v1-32)) -8192.0))) - (set! sv-32 (new 'static 'res-tag)) - (let* ((v1-35 (res-lump-data (-> this entity) 'distance pointer :tag-ptr (& sv-32))) - (f0-10 (if (and v1-35 (< 1 (the-as int (-> sv-32 elt-count)))) (-> (the-as (pointer float) v1-35) 1) 16384.0))) - (set! (-> this down-pos quad) (-> this root trans quad)) - (+! (-> this down-pos y) f30-0) - (set! (-> this up-pos quad) (-> this root trans quad)) - (+! (-> this up-pos y) f0-10))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-32 (res-lump-data (-> this entity) 'distance pointer :tag-ptr (& sv-16))) + (f30-0 (if (and v1-32 (> (the-as int (-> sv-16 elt-count)) 0)) (-> (the-as (pointer float) v1-32)) -8192.0)) + (sv-32 (new 'static 'res-tag)) + (v1-35 (res-lump-data (-> this entity) 'distance pointer :tag-ptr (& sv-32))) + (f0-10 (if (and v1-35 (< 1 (the-as int (-> sv-32 elt-count)))) (-> (the-as (pointer float) v1-35) 1) 16384.0))) + (set! (-> this down-pos quad) (-> this root trans quad)) + (+! (-> this down-pos y) f30-0) + (set! (-> this up-pos quad) (-> this root trans quad)) + (+! (-> this up-pos y) f0-10)) (set! (-> this basetrans quad) (-> this down-pos quad)) (set! (-> this root trans quad) (-> this basetrans quad)) (set! (-> this part2) (create-launch-control group-square-platform-breach-splash this)) diff --git a/goal_src/jak1/levels/sunken/steam-cap.gc b/goal_src/jak1/levels/sunken/steam-cap.gc index 8951165bb0..52bfa4c052 100644 --- a/goal_src/jak1/levels/sunken/steam-cap.gc +++ b/goal_src/jak1/levels/sunken/steam-cap.gc @@ -543,7 +543,6 @@ (none)) (defmethod init-from-entity! ((this steam-cap) (arg0 entity-actor)) - (local-vars (sv-16 res-tag)) (logior! (-> this mask) (process-mask platform)) (let ((s4-0 (new 'process 'collide-shape-moving this (collide-list-enum hit-by-player)))) (set! (-> s4-0 dynam) (copy *standard-dynamics* 'process)) @@ -575,8 +574,8 @@ (load-params! (-> this sync) this (the-as uint 1800) 0.0 0.15 0.15) (let ((f30-0 0.4) (f28-0 0.9)) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-36 (res-lump-data arg0 'percent (pointer float) :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-36 (res-lump-data arg0 'percent (pointer float) :tag-ptr (& sv-16)))) (when v1-36 (set! f30-0 (-> v1-36 0)) (set! f28-0 (-> v1-36 1)) diff --git a/goal_src/jak1/levels/sunken/sun-iris-door.gc b/goal_src/jak1/levels/sunken/sun-iris-door.gc index ab8916a5eb..8acc9bceb3 100644 --- a/goal_src/jak1/levels/sunken/sun-iris-door.gc +++ b/goal_src/jak1/levels/sunken/sun-iris-door.gc @@ -26,6 +26,7 @@ sun-iris-door-open sun-iris-door-opening)) + (defskelgroup *sun-iris-door-sg* sun-iris-door sun-iris-door-lod0-jg @@ -204,7 +205,6 @@ (else (transform-post))))) (defmethod init-from-entity! ((this sun-iris-door) (arg0 entity-actor)) - (local-vars (sv-16 res-tag)) (set! (-> this move-to?) #f) (let ((s4-0 (new 'process 'collide-shape this (collide-list-enum hit-by-others)))) (let ((s3-0 (new 'process 'collide-shape-prim-mesh s4-0 (the-as uint 0) (the-as uint 0)))) @@ -234,8 +234,8 @@ (set-vector! (-> this root scale) f0-11 f0-11 f0-11 1.0) (set! (-> this draw bounds w) (* 18432.0 f0-11)) (let ((v1-25 (-> this root root-prim))) (set! (-> v1-25 local-sphere w) (* 24576.0 f0-11 f0-11)))) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-28 (res-lump-data (-> this entity) 'trans-offset (pointer float) :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-28 (res-lump-data (-> this entity) 'trans-offset (pointer float) :tag-ptr (& sv-16)))) (when v1-28 (+! (-> this root trans x) (-> v1-28 0)) (+! (-> this root trans y) (-> v1-28 1)) diff --git a/goal_src/jak1/levels/sunken/sunken-fish.gc b/goal_src/jak1/levels/sunken/sunken-fish.gc index c24140fd02..a5d5f23ed0 100644 --- a/goal_src/jak1/levels/sunken/sunken-fish.gc +++ b/goal_src/jak1/levels/sunken/sunken-fish.gc @@ -33,6 +33,7 @@ (:states sunkenfisha-idle)) + (defskelgroup *sunkenfisha-red-yellow-sg* sunkenfisha sunkenfisha-red-yellow-lod0-jg @@ -169,13 +170,12 @@ (set! (-> s5-0 frame-num) 0.0))) (defmethod sunkenfisha-method-27 ((this sunkenfisha)) - (local-vars (sv-16 res-tag) (sv-32 res-tag) (sv-48 res-tag)) (vector-reset! (-> this path-trans-offset)) (set! (-> this path-u) (rand-vu-float-range 0.0 1.0)) (if (zero? (rand-vu-int-count 2)) (set! (-> this path-dir) 1.0) (set! (-> this path-dir) -1.0)) (set-vector! (-> this max-local-path-offset) 16384.0 28672.0 0.0 1.0) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-5 (res-lump-data (-> this entity) 'path-max-offset (pointer float) :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-5 (res-lump-data (-> this entity) 'path-max-offset (pointer float) :tag-ptr (& sv-16)))) (when v1-5 (set! (-> this max-local-path-offset x) (-> v1-5 0)) (set! (-> this max-local-path-offset y) (-> v1-5 1)))) @@ -194,8 +194,8 @@ (set! (-> this change-path-dir-time) (+ (current-time) (rand-vu-int-range (seconds 5) (seconds 18)))) (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)) - (set! sv-32 (new 'static 'res-tag)) - (let ((v1-16 (res-lump-data (-> this entity) 'path-trans-offset (pointer float) :tag-ptr (& sv-32)))) + (let* ((sv-32 (new 'static 'res-tag)) + (v1-16 (res-lump-data (-> this entity) 'path-trans-offset (pointer float) :tag-ptr (& sv-32)))) (when v1-16 (+! (-> this path-trans-offset x) (-> v1-16 0)) (+! (-> this path-trans-offset y) (-> v1-16 1)) @@ -203,8 +203,8 @@ (if (< (-> this path curve num-cverts) 2) (go process-drawable-art-error "bad path")) (let ((f28-0 8192.0) (f30-0 26624.0)) - (set! sv-48 (new 'static 'res-tag)) - (let ((v1-23 (res-lump-data (-> this entity) 'speed (pointer float) :tag-ptr (& sv-48)))) + (let* ((sv-48 (new 'static 'res-tag)) + (v1-23 (res-lump-data (-> this entity) 'speed (pointer float) :tag-ptr (& sv-48)))) (when v1-23 (set! f28-0 (-> v1-23 0)) (set! f30-0 (-> v1-23 1)))) diff --git a/goal_src/jak1/levels/sunken/whirlpool.gc b/goal_src/jak1/levels/sunken/whirlpool.gc index 69293e2dfe..5f57b232a1 100644 --- a/goal_src/jak1/levels/sunken/whirlpool.gc +++ b/goal_src/jak1/levels/sunken/whirlpool.gc @@ -276,8 +276,7 @@ (let* ((gp-0 (target-pos 0)) (f28-0 (vector-vector-xz-distance (-> this root trans) gp-0))) (when (< f28-0 40960.0) - (let* ((f0-2 (* 0.000024414063 (- 40960.0 f28-0))) - (f26-0 (* f0-2 f0-2)) + (let* ((f26-0 (square (* 0.000024414063 (- 40960.0 f28-0)))) (f0-7 (atan (- (-> gp-0 x) (-> this root trans x)) (- (-> gp-0 z) (-> this root trans z)))) (f30-0 (* (/ f26-0 2) arg0 (seconds-per-frame))) (f24-0 (+ f0-7 f30-0)) @@ -317,7 +316,6 @@ (none)) (defmethod init-from-entity! ((this whirlpool) (arg0 entity-actor)) - (local-vars (sv-16 res-tag)) (set! (-> this spin-ry) (rand-vu-float-range 0.0 65536.0)) (let ((s4-0 (new 'process 'collide-shape this (collide-list-enum hit-by-player)))) (let ((s3-0 (new 'process 'collide-shape-prim-sphere s4-0 (the-as uint 0)))) @@ -335,8 +333,8 @@ (load-params! (-> this sync) this (the-as uint 1500) 0.0 0.15 0.15) (let ((f30-0 32768.0) (f28-0 145635.56)) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-17 (res-lump-data arg0 'speed (pointer float) :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-17 (res-lump-data arg0 'speed (pointer float) :tag-ptr (& sv-16)))) (when v1-17 (set! f30-0 (-> v1-17 0)) (set! f28-0 (-> v1-17 1)))) diff --git a/goal_src/jak1/levels/village1/fishermans-boat.gc b/goal_src/jak1/levels/village1/fishermans-boat.gc index 758b774fd2..80e0828c0d 100644 --- a/goal_src/jak1/levels/village1/fishermans-boat.gc +++ b/goal_src/jak1/levels/village1/fishermans-boat.gc @@ -78,7 +78,6 @@ (none)) (defmethod debug-draw ((this vehicle-path)) - (local-vars (sv-64 int) (sv-80 (function _varargs_ object))) (let ((s5-0 (new 'stack-no-clear 'vector)) (s4-0 (new 'stack-no-clear 'vector)) (s3-0 (new 'stack-no-clear 'vector))) @@ -99,18 +98,10 @@ (add-debug-line #t (bucket-id debug-no-zbuf) s4-0 s3-0 (new 'static 'rgba :r #xff :g #xff :a #x80) #f (the-as rgba -1)) (add-debug-vector #t (bucket-id debug-no-zbuf) s4-0 s5-0 (meters 0.00024414062) (new 'static 'rgba :r #xff :a #x80)) (let ((s1-0 add-debug-text-3d) - (s0-0 #t)) - (set! sv-64 68) - (set! sv-80 format) - (let ((a0-9 (clear *temp-string*)) - (a1-6 "~D") - (a2-2 s2-0)) - (sv-80 a0-9 a1-6 a2-2)) - (let ((a2-3 *temp-string*) - (a3-2 s4-0) - (t0-2 4) - (t1-2 #f)) - (s1-0 s0-0 (the-as bucket-id sv-64) a2-3 a3-2 (the-as font-color t0-2) (the-as vector2h t1-2)))))) + (s0-0 #t) + (sv-64 68)) + (format (clear *temp-string*) "~D" s2-0) + (s1-0 s0-0 (the-as bucket-id sv-64) *temp-string* s4-0 (font-color orange) (the-as vector2h #f))))) #f) (define *boat-turning-radius-table* @@ -268,12 +259,9 @@ (set! (-> s3-0 x) (-> s5-0 z)) (set! (-> s3-0 z) (- (-> s5-0 x))) (if (= (-> this left-circle) 1) (vector-float*! s3-0 s3-0 -1.0)) - (let* ((f0-5 f30-0) - (f0-7 (* f0-5 f0-5)) - (f1-0 f28-0) - (f0-9 (sqrtf (- f0-7 (* f1-0 f1-0)))) + (let* ((f0-9 (sqrtf (- (square f30-0) (square f28-0)))) (f28-1 (/ (* f28-0 f0-9) f30-0))) - (let ((f0-12 (/ (* f0-9 f0-9) f30-0))) + (let ((f0-12 (/ (square f0-9) f30-0))) (set! (-> arg1 quad) (-> arg0 quad)) (vector+*! arg1 (-> this target-point) s5-0 f0-12)) (vector+*! arg1 (-> this target-point) s3-0 f28-1)))) @@ -425,7 +413,6 @@ :bounds (static-spherem 0 0 0 1)) (defmethod rigid-body-platform-method-23 ((this fishermans-boat) (arg0 float)) - (local-vars (sv-128 int) (sv-144 rigid-body-control-point) (sv-160 int) (sv-176 vector)) (let ((s4-0 (new 'stack-no-clear 'vector)) (s1-0 (new 'stack-no-clear 'vector)) (s5-0 (new 'stack-no-clear 'vector)) @@ -433,37 +420,37 @@ (s2-0 (new 'stack-no-clear 'vector)) (s3-0 (-> this rbody matrix))) (set! (-> s2-0 quad) (-> s3-0 vector 2 quad)) - (set! sv-128 0) - (while (< sv-128 6) - (set! sv-144 (-> this control-point-array data sv-128)) - (vector-matrix*! s5-0 (-> sv-144 local-pos) s3-0) - (set! (-> sv-144 world-pos quad) (-> s5-0 quad)) - (rigid-body-method-17 (-> this rbody) s5-0 s1-0) - (set! (-> sv-144 velocity quad) (-> s1-0 quad)) - (set! (-> sv-144 world-pos w) (ocean-get-height s5-0)) - (let* ((f0-2 (- (-> sv-144 world-pos w) (-> s5-0 y))) - (f30-0 (fmin 1.0 (/ f0-2 (-> this info max-buoyancy-depth))))) - (when (< 0.0 f0-2) - (vector-float*! s4-0 *y-vector* (* 20.0 f0-2 (-> this rbody mass))) - (rigid-body-method-13 (-> this rbody) s5-0 s4-0) - (vector-float*! s4-0 *y-vector* (* 1.6 f30-0 (fmax 0.0 (vector-dot s2-0 s1-0)))) - (rigid-body-method-13 (-> this rbody) s5-0 s4-0) - (vector-float*! s4-0 s1-0 (* -1.0 (-> this info drag-factor) f30-0)) - (rigid-body-method-13 (-> this rbody) s5-0 s4-0) - (vector-float*! s4-0 (the-as vector (-> s3-0 vector)) (* -0.5 (vector-dot (the-as vector (-> s3-0 vector)) s1-0))) - (rigid-body-method-13 (-> this rbody) s5-0 s4-0))) - 0 - (set! sv-128 (+ sv-128 1))) - (set! sv-160 0) - (while (< sv-160 2) - (set! sv-176 (-> this stabilizer-array sv-160 local-pos)) - (vector-matrix*! s5-0 (the-as vector (&-> sv-176 x)) s3-0) - (vector-rotate*! s0-0 (&+ sv-176 16) s3-0) - (rigid-body-method-17 (-> this rbody) s5-0 s1-0) - (vector-float*! s4-0 s0-0 (* -1.0 (vector-dot s0-0 s1-0))) - (rigid-body-method-13 (-> this rbody) s5-0 s4-0) - 0 - (set! sv-160 (+ sv-160 1))) + (let ((sv-128 0)) + (while (< sv-128 6) + (let ((sv-144 (-> this control-point-array data sv-128))) + (vector-matrix*! s5-0 (-> sv-144 local-pos) s3-0) + (set! (-> sv-144 world-pos quad) (-> s5-0 quad)) + (rigid-body-method-17 (-> this rbody) s5-0 s1-0) + (set! (-> sv-144 velocity quad) (-> s1-0 quad)) + (set! (-> sv-144 world-pos w) (ocean-get-height s5-0)) + (let* ((f0-2 (- (-> sv-144 world-pos w) (-> s5-0 y))) + (f30-0 (fmin 1.0 (/ f0-2 (-> this info max-buoyancy-depth))))) + (when (< 0.0 f0-2) + (vector-float*! s4-0 *y-vector* (* 20.0 f0-2 (-> this rbody mass))) + (rigid-body-method-13 (-> this rbody) s5-0 s4-0) + (vector-float*! s4-0 *y-vector* (* 1.6 f30-0 (fmax 0.0 (vector-dot s2-0 s1-0)))) + (rigid-body-method-13 (-> this rbody) s5-0 s4-0) + (vector-float*! s4-0 s1-0 (* -1.0 (-> this info drag-factor) f30-0)) + (rigid-body-method-13 (-> this rbody) s5-0 s4-0) + (vector-float*! s4-0 (-> s3-0 vector 0) (* -0.5 (vector-dot (-> s3-0 vector 0) s1-0))) + (rigid-body-method-13 (-> this rbody) s5-0 s4-0)))) + 0 + (+! sv-128 1))) + (let ((sv-160 0)) + (while (< sv-160 2) + (let ((sv-176 (-> this stabilizer-array sv-160 local-pos))) + (vector-matrix*! s5-0 (the-as vector (&-> sv-176 x)) s3-0) + (vector-rotate*! s0-0 (&+ sv-176 16) s3-0)) + (rigid-body-method-17 (-> this rbody) s5-0 s1-0) + (vector-float*! s4-0 s0-0 (* -1.0 (vector-dot s0-0 s1-0))) + (rigid-body-method-13 (-> this rbody) s5-0 s4-0) + 0 + (+! sv-160 1))) (when (-> this anchored) (let ((s1-1 (new 'stack-no-clear 'vector))) (vector+*! s5-0 (-> s3-0 vector 3) s2-0 24576.0) @@ -645,8 +632,8 @@ (kill-current-level-hint '() '(sidekick voicebox) 'exit) (when (and (hud-hidden?) (can-grab-display? self) (= *kernel-boot-message* 'play)) (let ((s5-1 (new 'stack 'font-context *font-default-matrix* 32 160 0.0 (font-color default) (font-flags shadow kerning)))) - (let ((v1-17 s5-1)) (set! (-> v1-17 width) (the float 440))) - (let ((v1-18 s5-1)) (set! (-> v1-18 height) (the float 80))) + (set-width! s5-1 440) + (set-height! s5-1 80) (set! (-> s5-1 flags) (font-flags shadow kerning large)) (print-game-text (lookup-text! *common-text* (text-id press-to-use) #f) s5-1 #f 128 22)) (when (and (cpad-pressed? 0 circle) (process-grab? *target*)) @@ -1100,7 +1087,7 @@ (fishermans-boat-reset-physics) (transform-post) (when *target* - (vector<-cspace! (the-as vector (-> self old-target-pos)) (-> *target* node-list data 3)) + (vector<-cspace! (-> self old-target-pos trans) (-> *target* node-list data 3)) (send-event *target* 'trans 'restore (-> self old-target-pos)) (send-event *target* 'end-mode) (update-transforms! (-> self root-overlay)) @@ -1180,7 +1167,7 @@ (fishermans-boat-reset-physics) (transform-post) (when *target* - (vector<-cspace! (the-as vector (-> self old-target-pos)) (-> *target* node-list data 3)) + (vector<-cspace! (-> self old-target-pos trans) (-> *target* node-list data 3)) (send-event *target* 'trans 'restore (-> self old-target-pos)) (send-event *target* 'end-mode) (update-transforms! (-> self root-overlay)) diff --git a/goal_src/jak1/levels/village1/yakow.gc b/goal_src/jak1/levels/village1/yakow.gc index b1442d04d0..e3eb073fdc 100644 --- a/goal_src/jak1/levels/village1/yakow.gc +++ b/goal_src/jak1/levels/village1/yakow.gc @@ -140,35 +140,34 @@ yakow-default-event-handler (defbehavior yakow-task-complete? yakow ((arg0 symbol)) - (local-vars (sv-16 symbol) (sv-20 (pointer process-tree))) (let ((gp-0 (not (and (-> self entity) (logtest? (-> self entity extra perm status) (entity-perm-status complete)))))) (if arg0 (process-entity-status! self (entity-perm-status complete) #t) (process-entity-status! self (entity-perm-status complete) #f)) (when (or (-> self link prev) (-> self link next)) - (set! sv-16 (the-as symbol #f)) - (set! sv-20 (-> self child)) - (apply-all (-> self link) actor-link-subtask-complete-hook (& sv-16)) - (cond - (sv-16 - (close-specific-task! (-> self entity extra perm task) (task-status need-hint)) - (close-specific-task! (-> self entity extra perm task) (task-status need-introduction)) - (close-specific-task! (-> self entity extra perm task) (task-status need-reminder)) - (if gp-0 (yakow-cam)) - ;; og:preserve-this PAL patch here - (process-spawn-function process - (lambda :behavior process () - (while (or (-> *setting-control* current ambient) (-> *setting-control* current movie) (-> *setting-control* current hint)) - (suspend)) - (level-hint-spawn (text-id village1-yakow-resolution) "sksp018a" (the-as entity #f) *entity-pool* (game-task none))) - :to - self)) - (else (open-specific-task! (-> self entity extra perm task) (task-status need-reminder)))) - sv-16))) + (let ((sv-16 (the-as symbol #f))) + (let ((sv-20 (-> self child)))) + (apply-all (-> self link) actor-link-subtask-complete-hook (& sv-16)) + (cond + (sv-16 + (close-specific-task! (-> self entity extra perm task) (task-status need-hint)) + (close-specific-task! (-> self entity extra perm task) (task-status need-introduction)) + (close-specific-task! (-> self entity extra perm task) (task-status need-reminder)) + (if gp-0 (yakow-cam)) + ;; og:preserve-this PAL patch here + (process-spawn-function process + (lambda :behavior process () + (while (or (-> *setting-control* current ambient) (-> *setting-control* current movie) (-> *setting-control* current hint)) + (suspend)) + (level-hint-spawn (text-id village1-yakow-resolution) "sksp018a" (the-as entity #f) *entity-pool* (game-task none))) + :to + self)) + (else (open-specific-task! (-> self entity extra perm task) (task-status need-reminder)))) + sv-16)))) (defbehavior yakow-common-post yakow () (update-direction-from-time-of-day (-> self draw shadow-ctrl)) - (if *target* (look-at-enemy! (-> *target* neck) (the-as vector (-> self root root-prim prim-core)) #f self)) + (if *target* (look-at-enemy! (-> *target* neck) (-> self root root-prim prim-core world-sphere) #f self)) (ja-post) (none)) diff --git a/goal_src/jak1/levels/village2/swamp-blimp.gc b/goal_src/jak1/levels/village2/swamp-blimp.gc index 59db49e46f..f2ee80dae9 100644 --- a/goal_src/jak1/levels/village2/swamp-blimp.gc +++ b/goal_src/jak1/levels/village2/swamp-blimp.gc @@ -712,10 +712,7 @@ (cond ((>= arg0 1.0) 1.0) ((>= 0.0 arg0) 0.0) - (else - (let ((f0-2 1.0) - (f1-3 (- 1.0 arg0))) - (- f0-2 (* f1-3 f1-3)))))) + (else (- 1.0 (square (- 1.0 arg0)))))) (defstate precursor-arm-idle (precursor-arm) :event diff --git a/goal_src/jak1/levels/village_common/villagep-obs.gc b/goal_src/jak1/levels/village_common/villagep-obs.gc index c1c14d6032..3e7161171c 100644 --- a/goal_src/jak1/levels/village_common/villagep-obs.gc +++ b/goal_src/jak1/levels/village_common/villagep-obs.gc @@ -97,9 +97,9 @@ (if (and (cpad-pressed? 0 circle) (process-grab? *target*)) (go-virtual active)) (if (and *cheat-mode* (cpad-pressed? 0 l3)) (set! (-> self max-slot) 4)) (let ((gp-0 (new 'stack 'font-context *font-default-matrix* 32 160 0.0 (font-color default) (font-flags shadow kerning)))) - (let ((v1-53 gp-0)) (set! (-> v1-53 width) (the float 440))) - (let ((v1-54 gp-0)) (set! (-> v1-54 height) (the float 80))) - (let ((v1-55 gp-0)) (set! (-> v1-55 scale) 0.9)) + (set-width! gp-0 440) + (set-height! gp-0 80) + (set-scale! gp-0 0.9) (set! (-> gp-0 flags) (font-flags shadow kerning large)) (print-game-text (lookup-text! *common-text* (text-id press-to-use) #f) gp-0 #f 128 22)))) (suspend)))) @@ -154,7 +154,6 @@ (send-event *target* 'rotate-y-angle (fmax (fmin f0-0 (* 65536.0 (seconds-per-frame))) (* -65536.0 (seconds-per-frame)))))))) :code (behavior () - (local-vars (sv-112 int) (sv-128 int) (sv-144 int)) (let ((gp-0 (get-next-slot-up self (+ (-> self level-slot) -1)))) 0 (let ((s5-0 #f) @@ -188,45 +187,31 @@ (logclear! (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons circle)) (go-virtual use gp-0 (the-as level s1-2)))) (let ((s1-3 (new 'stack 'font-context *font-default-matrix* 6 110 0.0 (font-color default) (font-flags shadow kerning)))) - (let ((v1-38 s1-3)) (set! (-> v1-38 scale) 0.7)) - (let ((v1-39 s1-3)) (set! (-> v1-39 width) (the float 500))) - (let ((v1-40 s1-3)) (set! (-> v1-40 height) (the float 55))) + (set-scale! s1-3 0.7) + (set-width! s1-3 500) + (set-height! s1-3 55) (set! (-> s1-3 flags) (font-flags shadow kerning middle middle-vert large)) (print-game-text (lookup-text! *common-text* (text-id warp-gate-use-dpad) #f) s1-3 #f 128 22) (+! (-> s1-3 origin y) 35.0) - (let ((v1-43 s1-3)) (set! (-> v1-43 height) (the float 40))) + (set-height! s1-3 40) (let ((a0-34 s1-3)) (set! (-> a0-34 color) (font-color progress-blue))) 0 - (let ((s0-3 (get-next-slot-up self gp-0))) - (set! sv-112 (get-next-slot-down self gp-0)) - (set! sv-144 (get-next-slot-up self s0-3)) - (set! sv-128 (get-next-slot-down self sv-112)) + (let* ((s0-3 (get-next-slot-up self gp-0)) + (sv-112 (get-next-slot-down self gp-0)) + (sv-144 (get-next-slot-up self s0-3)) + (sv-128 (get-next-slot-down self sv-112))) (cond (s4-0 - (let ((a2-6 (- 300 (+ s2-0 150))) - (t9-20 print-level-name) - (a1-16 s1-3) - (a3-4 #f)) - (t9-20 sv-112 a1-16 a2-6 (the-as int a3-4))) + (let ((a2-6 (- 300 (+ s2-0 150)))) (print-level-name sv-112 s1-3 a2-6 (the-as int #f))) (let ((a2-7 (+ s2-0 150))) (cond ((< a2-7 225) (print-level-name s0-3 s1-3 a2-7 (the-as int #t))) - (else - (let ((a2-8 (- 300 s2-0)) - (t9-22 print-level-name) - (a1-18 s1-3) - (a3-6 #f)) - (t9-22 sv-128 a1-18 a2-8 (the-as int a3-6))))))) + (else (let ((a2-8 (- 300 s2-0))) (print-level-name sv-128 s1-3 a2-8 (the-as int #f))))))) (else (let ((a2-9 (+ s2-0 150))) (cond ((< a2-9 225) (print-level-name sv-112 s1-3 a2-9 (the-as int #f))) - (else - (let ((a2-10 (- 300 s2-0)) - (t9-24 print-level-name) - (a1-20 s1-3) - (a3-8 #t)) - (t9-24 sv-144 a1-20 a2-10 (the-as int a3-8)))))) + (else (let ((a2-10 (- 300 s2-0))) (print-level-name sv-144 s1-3 a2-10 (the-as int #t)))))) (let ((a2-11 (- 300 (+ s2-0 150)))) (print-level-name s0-3 s1-3 a2-11 (the-as int #t)))))) (when (not s5-0) (let ((a0-47 s1-3)) (set! (-> a0-47 color) (font-color progress-yellow)))) diff --git a/goal_src/jak2/engine/ai/enemy.gc b/goal_src/jak2/engine/ai/enemy.gc index 73ff61f130..9286c6cd66 100644 --- a/goal_src/jak2/engine/ai/enemy.gc +++ b/goal_src/jak2/engine/ai/enemy.gc @@ -952,7 +952,6 @@ (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!)) @@ -1019,8 +1018,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)) @@ -1515,7 +1515,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)) @@ -1578,14 +1578,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 @@ -2941,11 +2939,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)) @@ -2953,11 +2947,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 @@ -3066,12 +3056,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/goal_src/jak2/engine/anim/joint-exploder.gc b/goal_src/jak2/engine/anim/joint-exploder.gc index d09e512e7b..331cec3abe 100644 --- a/goal_src/jak2/engine/anim/joint-exploder.gc +++ b/goal_src/jak2/engine/anim/joint-exploder.gc @@ -232,15 +232,6 @@ ) (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) @@ -264,22 +255,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) ) @@ -292,15 +284,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) ) @@ -313,15 +307,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) ) @@ -334,19 +330,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 ) @@ -354,14 +350,13 @@ ;; 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)) @@ -382,11 +377,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 (the-as joint-exploder-list sv-64) s2-0) - (set! s2-0 sv-48) - (update-bbox-for-joint this (the-as joint-exploder-list sv-64) 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)) @@ -678,11 +675,11 @@ ) ;; WARN: Return type mismatch process-drawable vs joint-exploder. -(defmethod relocate ((this joint-exploder) (arg0 int)) +(defmethod relocate ((this joint-exploder) (offset int)) (if (nonzero? (-> this joints)) - (&+! (-> this joints) arg0) + (&+! (-> this joints) offset) ) - (the-as joint-exploder ((method-of-type process-drawable relocate) this arg0)) + (the-as joint-exploder ((method-of-type process-drawable relocate) this offset)) ) ;; WARN: Return type mismatch object vs none. diff --git a/goal_src/jak2/engine/anim/joint-mod.gc b/goal_src/jak2/engine/anim/joint-mod.gc index 464ba76cfd..8beb7c26cb 100644 --- a/goal_src/jak2/engine/anim/joint-mod.gc +++ b/goal_src/jak2/engine/anim/joint-mod.gc @@ -26,22 +26,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) @@ -105,9 +90,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)) ) @@ -153,144 +138,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) + ) ) - ;; og:preserve-this inlined vector-dot - ; (.mula.s f0-23 f3-5) - ; (.madda.s f1-16 f4-0) - ; (.madd.s f0-24 f2-6 f5-0) - (set! f0-24 (+ (* f0-23 f3-5) (* f1-16 f4-0) (* 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)) ) ) ) @@ -339,149 +304,145 @@ ) (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) ) @@ -521,8 +482,8 @@ (s0-0 (matrix->trans gp-0 (new 'stack-no-clear 'vector))) ) (set! (-> gp-0 vector 1 quad) (-> s5-0 twist-max quad)) - (vector-cross! (-> gp-0 vector 2) (the-as vector (-> gp-0 vector)) (-> gp-0 vector 1)) - (vector-cross! (the-as vector (-> gp-0 vector)) (-> gp-0 vector 1) (-> gp-0 vector 2)) + (vector-cross! (-> gp-0 vector 2) (-> gp-0 vector 0) (-> gp-0 vector 1)) + (vector-cross! (-> gp-0 vector 0) (-> gp-0 vector 1) (-> gp-0 vector 2)) (set! (-> gp-0 vector 0 w) 0.0) (set! (-> gp-0 vector 1 w) 0.0) (set! (-> gp-0 vector 2 w) 0.0) @@ -733,19 +694,9 @@ (defmethod look-at! ((this joint-mod) (arg0 vector) (arg1 symbol) (arg2 process)) (when (= arg1 'attacking) - (let* ((s2-0 arg2) - (s1-0 (if (type? s2-0 process-drawable) - (the-as process-drawable s2-0) - ) - ) - ) + (let ((s1-0 (as-type arg2 process-drawable))) (when s1-0 - (let* ((s0-0 (-> s1-0 fact)) - (s2-1 (if (type? s0-0 fact-info-enemy) - (the-as fact-info-enemy s0-0) - ) - ) - ) + (let ((s2-1 (as-type (-> s1-0 fact) fact-info-enemy))) (when s2-1 (when (< (vector-vector-distance (-> this process root trans) (-> s1-0 root trans)) (-> s2-1 cam-notice-dist)) (set-time! (-> this notice-time)) @@ -791,184 +742,154 @@ ;; 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)) - (rlet ((vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - ) - (init-vf0-vector) - (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! - (vector-cross! - (new 'stack-no-clear 'vector) - (-> arg0 bone transform vector (-> gp-0 up)) - (-> arg0 bone transform vector (-> gp-0 nose)) - ) - 1.0 - ) - ) - (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)) - ) - ;; og:preserve-this inlined vector-dot - ; (.mula.s f0-0 f3-0) - ; (.madda.s f1-0 f4-0) - ; (.madd.s f0-1 f2-0 f5-0) - (set! f0-1 (+ (* f0-0 f3-0) (* f1-0 f4-0) (* f2-0 f5-0))) - ) - (if (< f0-1 0.0) - (set! sv-80 #t) - ) - (let* ((f30-0 (vector-y-angle s3-0)) - (a0-18 (vector-flatten! (new-stack-vector0) s2-1 s1-0)) - (f0-3 (vector-y-angle a0-18)) - (f30-1 (deg-diff f30-0 f0-3)) - (f0-4 (if (= (-> gp-0 base-joint) (+ (-> arg0 joint number) 1)) - 0.0 - (deg-diff (vector-y-angle s3-0) (vector-y-angle sv-160)) - ) - ) + (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 + ) ) - (if (< (-> gp-0 ignore-angle) (fabs f30-1)) - (set! f30-1 0.0) - ) - (let ((f30-2 - (fmax - (fmin (* f30-1 (-> gp-0 blend) (-> gp-0 flex-blend)) (+ (-> gp-0 twist-max y) (* f0-4 (-> gp-0 flex-blend)))) - (+ (- (-> gp-0 twist-max y)) (* f0-4 (-> gp-0 flex-blend))) - ) - ) - ) - (when (and (-> gp-0 shutting-down?) (< (fabs (- (-> gp-0 twist y) f30-2)) 18.204445)) - (if (and (= (-> gp-0 scale x) 1.0) (= (-> gp-0 scale y) 1.0) (= (-> gp-0 scale z) 1.0)) - (mode-set! gp-0 (joint-mod-mode reset)) - (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) (s1-2 s0-2 sv-176 a2-3)) - ) - ) - ) - ) - 0.0 - (let ((f0-25 (if sv-80 - (- (-> gp-0 twist y)) - (-> gp-0 twist y) - ) + (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)) + (-> arg0 bone transform vector (-> gp-0 nose)) ) - (v1-49 (-> gp-0 up)) - ) - (cond - ((zero? v1-49) - (quaternion-rotate-x! (-> arg1 quat) (-> arg1 quat) f0-25) - ) - ((= v1-49 1) - (quaternion-rotate-local-y! (-> arg1 quat) (-> arg1 quat) f0-25) - ) - (else - (quaternion-rotate-z! (-> arg1 quat) (-> arg1 quat) f0-25) - ) - ) - ) - (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)) + (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)) + ) + (set! f0-1 (vector-dot sv-144 s0-0)) + (if (< f0-1 0.0) + (set! sv-80 #t) + ) + (let* ((f30-0 (vector-y-angle s3-0)) + (a0-18 (vector-flatten! (new-stack-vector0) s2-1 s1-0)) + (f0-3 (vector-y-angle a0-18)) + (f30-1 (deg-diff f30-0 f0-3)) + (f0-4 (if (= (-> gp-0 base-joint) (+ (-> arg0 joint number) 1)) + 0.0 + (deg-diff (vector-y-angle s3-0) (vector-y-angle sv-160)) + ) ) - ) - ) - (if (< (vector-dot s2-2 s3-0) 0.1) - (set! f0-32 0.0) + ) + (if (< (-> gp-0 ignore-angle) (fabs f30-1)) + (set! f30-1 0.0) + ) + (let ((f30-2 + (fmax + (fmin (* f30-1 (-> gp-0 blend) (-> gp-0 flex-blend)) (+ (-> gp-0 twist-max y) (* f0-4 (-> gp-0 flex-blend)))) + (+ (- (-> gp-0 twist-max y)) (* f0-4 (-> gp-0 flex-blend))) + ) + ) ) - (set! (-> gp-0 twist x) + (when (and (-> gp-0 shutting-down?) (< (fabs (- (-> gp-0 twist y) f30-2)) 18.204445)) + (if (and (= (-> gp-0 scale x) 1.0) (= (-> gp-0 scale y) 1.0) (= (-> gp-0 scale z) 1.0)) + (mode-set! gp-0 (joint-mod-mode reset)) + (mode-set! gp-0 (joint-mod-mode rotate2)) + ) + ) + (set! (-> gp-0 twist y) (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)) + (-> 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)) ) ) ) ) - ) - (let ((v1-60 (-> gp-0 ear))) - (cond - ((zero? v1-60) - (quaternion-rotate-x! (-> arg1 quat) (-> arg1 quat) (-> gp-0 twist x)) - ) - ((= v1-60 1) - (quaternion-rotate-local-y! (-> arg1 quat) (-> arg1 quat) (-> gp-0 twist x)) - ) - (else - (quaternion-rotate-z! (-> arg1 quat) (-> arg1 quat) (-> gp-0 twist x)) - ) - ) - ) - (vector+! (-> arg1 trans) (-> arg1 trans) (-> gp-0 trans)) - (quaternion-normalize! (quaternion*! (-> arg1 quat) (-> arg1 quat) (-> gp-0 quat))) - (let ((a1-36 (-> arg1 scale))) - (let ((v1-63 (-> arg1 scale)) - (a0-46 (-> gp-0 scale)) + 0.0 + (let ((f0-25 (if sv-80 + (- (-> gp-0 twist y)) + (-> gp-0 twist y) + ) + ) + (v1-49 (-> gp-0 up)) + ) + (cond + ((zero? v1-49) + (quaternion-rotate-x! (-> arg1 quat) (-> arg1 quat) f0-25) + ) + ((= v1-49 1) + (quaternion-rotate-local-y! (-> arg1 quat) (-> arg1 quat) f0-25) + ) + (else + (quaternion-rotate-z! (-> arg1 quat) (-> arg1 quat) f0-25) ) - (.lvf vf4 (&-> v1-63 quad)) - (.lvf vf5 (&-> a0-46 quad)) - ) - (.add.x.vf.w vf6 vf0 vf0) - (.mul.vf.xyz vf6 vf4 vf5) - (.svf (&-> a1-36 quad) vf6) - ) - (cspace<-parented-transformq-joint! arg0 arg1) - (if (-> gp-0 parented-scale?) - (set-vector! (-> arg0 bone scale) 1.0 1.0 1.0 1.0) - ) - (if (and (= (-> gp-0 process type) target) (!= (-> gp-0 blend) 0.0)) - (add-debug-text-sphere - *display-target-marks* - (bucket-id debug-no-zbuf1) - (-> gp-0 target) - (meters 0.2) - "look" - (new 'static 'rgba :r #xff :g #xff :a #x80) ) ) + ) + (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)) + ) + ) + ) + (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)) + ) + ) + ) ) - 0 - (none) + (let ((v1-60 (-> gp-0 ear))) + (cond + ((zero? v1-60) + (quaternion-rotate-x! (-> arg1 quat) (-> arg1 quat) (-> gp-0 twist x)) + ) + ((= v1-60 1) + (quaternion-rotate-local-y! (-> arg1 quat) (-> arg1 quat) (-> gp-0 twist x)) + ) + (else + (quaternion-rotate-z! (-> arg1 quat) (-> arg1 quat) (-> gp-0 twist x)) + ) + ) + ) + (vector+! (-> arg1 trans) (-> arg1 trans) (-> gp-0 trans)) + (quaternion-normalize! (quaternion*! (-> arg1 quat) (-> arg1 quat) (-> gp-0 quat))) + (vector*! (-> arg1 scale) (-> arg1 scale) (-> gp-0 scale)) + (cspace<-parented-transformq-joint! arg0 arg1) + (if (-> gp-0 parented-scale?) + (set-vector! (-> arg0 bone scale) 1.0 1.0 1.0 1.0) + ) + (if (and (= (-> gp-0 process type) target) (!= (-> gp-0 blend) 0.0)) + (add-debug-text-sphere + *display-target-marks* + (bucket-id debug-no-zbuf1) + (-> gp-0 target) + (meters 0.2) + "look" + (new 'static 'rgba :r #xff :g #xff :a #x80) + ) + ) ) + 0 + (none) ) ;; WARN: Return type mismatch symbol vs none. @@ -984,20 +905,16 @@ (s4-0 (new 'stack-no-clear 'matrix)) ) (let ((s2-0 (new 'stack-no-clear 'vector))) - (vector-normalize-copy! (the-as vector (-> s4-0 vector)) (the-as vector (-> arg0 bone transform)) 1.0) + (vector-normalize-copy! (-> s4-0 vector 0) (the-as vector (-> arg0 bone transform)) 1.0) (vector-normalize-copy! (-> s4-0 vector 1) (-> arg0 bone transform vector 1) 1.0) (vector-normalize-copy! (-> s4-0 vector 2) (-> arg0 bone transform vector 2) 1.0) (set-vector! (-> s4-0 trans) 0.0 0.0 0.0 1.0) (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)) ) @@ -1028,11 +945,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) @@ -1057,13 +972,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) ) ) @@ -1101,75 +1010,76 @@ ) (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 @@ -1410,7 +1320,7 @@ ) (vector-reset! (-> arg0 bone transform trans)) (set! (-> arg0 bone transform trans w) 1.0) - (vector-float*! (the-as vector (-> s3-0 vector)) (the-as vector (-> s3-0 vector)) (-> s5-0 scale x)) + (vector-float*! (-> s3-0 vector 0) (-> s3-0 vector 0) (-> s5-0 scale x)) (vector-float*! (-> s3-0 vector 1) (-> s3-0 vector 1) (-> s5-0 scale y)) (vector-float*! (-> s3-0 vector 2) (-> s3-0 vector 2) (-> s5-0 scale z)) (set! (-> s3-0 vector 0 w) 0.0) diff --git a/goal_src/jak2/engine/anim/joint.gc b/goal_src/jak2/engine/anim/joint.gc index db5a31cfc5..a570830b73 100644 --- a/goal_src/jak2/engine/anim/joint.gc +++ b/goal_src/jak2/engine/anim/joint.gc @@ -527,13 +527,13 @@ this ) -(defmethod mem-usage ((this joint) (arg0 memory-usage-block) (arg1 int)) - (set! (-> arg0 length) (max 68 (-> arg0 length))) - (set! (-> arg0 data 67 name) "joint") - (+! (-> arg0 data 67 count) 1) +(defmethod mem-usage ((this joint) (usage memory-usage-block) (flags int)) + (set! (-> usage length) (max 68 (-> usage length))) + (set! (-> usage data 67 name) "joint") + (+! (-> usage data 67 count) 1) (let ((v1-6 (asize-of this))) - (+! (-> arg0 data 67 used) v1-6) - (+! (-> arg0 data 67 total) (logand -16 (+ v1-6 15))) + (+! (-> usage data 67 used) v1-6) + (+! (-> usage data 67 total) (logand -16 (+ v1-6 15))) ) this ) @@ -562,13 +562,13 @@ (the-as int (+ (-> joint-anim-drawable size) (* (-> this length) 4))) ) -(defun joint-anim-login ((arg0 joint-anim-drawable)) - (dotimes (s5-0 (-> arg0 length)) - (if (-> arg0 data s5-0) - (login (-> arg0 data s5-0)) +(defun joint-anim-login ((jad joint-anim-drawable)) + (dotimes (s5-0 (-> jad length)) + (if (-> jad data s5-0) + (login (-> jad data s5-0)) ) ) - arg0 + jad ) (defun joint-anim-inspect-elt ((arg0 joint-anim) (arg1 float)) @@ -583,16 +583,16 @@ arg0 ) -(defmethod mem-usage ((this joint-anim-drawable) (arg0 memory-usage-block) (arg1 int)) - (set! (-> arg0 length) (max 80 (-> arg0 length))) - (set! (-> arg0 data 79 name) "joint-anim-drawable") - (+! (-> arg0 data 79 count) 1) +(defmethod mem-usage ((this joint-anim-drawable) (usage memory-usage-block) (flags int)) + (set! (-> usage length) (max 80 (-> usage length))) + (set! (-> usage data 79 name) "joint-anim-drawable") + (+! (-> usage data 79 count) 1) (let ((v1-6 (asize-of this))) - (+! (-> arg0 data 79 used) v1-6) - (+! (-> arg0 data 79 total) (logand -16 (+ v1-6 15))) + (+! (-> usage data 79 used) v1-6) + (+! (-> usage data 79 total) (logand -16 (+ v1-6 15))) ) (dotimes (s3-0 (-> this length)) - (mem-usage (-> this data s3-0) arg0 arg1) + (mem-usage (-> this data s3-0) usage flags) ) this ) @@ -812,42 +812,42 @@ this ) -(defmethod mem-usage ((this art-mesh-anim) (arg0 memory-usage-block) (arg1 int)) - (set! (-> arg0 length) (max 75 (-> arg0 length))) - (set! (-> arg0 data 74 name) "art-mesh-anim") - (+! (-> arg0 data 74 count) 1) +(defmethod mem-usage ((this art-mesh-anim) (usage memory-usage-block) (flags int)) + (set! (-> usage length) (max 75 (-> usage length))) + (set! (-> usage data 74 name) "art-mesh-anim") + (+! (-> usage data 74 count) 1) (let ((v1-6 (asize-of this))) - (+! (-> arg0 data 74 used) v1-6) - (+! (-> arg0 data 74 total) (logand -16 (+ v1-6 15))) + (+! (-> usage data 74 used) v1-6) + (+! (-> usage data 74 total) (logand -16 (+ v1-6 15))) ) (if (-> this extra) - (mem-usage (-> this extra) arg0 (logior arg1 512)) + (mem-usage (-> this extra) usage (logior flags 512)) ) (dotimes (s3-0 (-> this length)) - (mem-usage (-> this data s3-0) arg0 arg1) + (mem-usage (-> this data s3-0) usage flags) ) this ) -(defmethod mem-usage ((this art-joint-anim) (arg0 memory-usage-block) (arg1 int)) - (set! (-> arg0 length) (max 78 (-> arg0 length))) - (set! (-> arg0 data 77 name) "art-joint-anim") - (+! (-> arg0 data 77 count) 1) +(defmethod mem-usage ((this art-joint-anim) (usage memory-usage-block) (flags int)) + (set! (-> usage length) (max 78 (-> usage length))) + (set! (-> usage data 77 name) "art-joint-anim") + (+! (-> usage data 77 count) 1) (let ((v1-6 (asize-of this))) - (+! (-> arg0 data 77 used) v1-6) - (+! (-> arg0 data 77 total) (logand -16 (+ v1-6 15))) + (+! (-> usage data 77 used) v1-6) + (+! (-> usage data 77 total) (logand -16 (+ v1-6 15))) ) (if (-> this extra) - (mem-usage (-> this extra) arg0 (logior arg1 512)) + (mem-usage (-> this extra) usage (logior flags 512)) ) - (jacc-mem-usage (-> this frames) arg0 arg1) + (jacc-mem-usage (-> this frames) usage flags) (when (and (nonzero? (-> this eye-anim)) (-> this eye-anim)) - (set! (-> arg0 length) (max 112 (-> arg0 length))) - (set! (-> arg0 data 111 name) "eye-anim") - (+! (-> arg0 data 111 count) 1) + (set! (-> usage length) (max 112 (-> usage length))) + (set! (-> usage data 111 name) "eye-anim") + (+! (-> usage data 111 count) 1) (let ((v1-26 (* (* (+ (-> this eye-anim max-frame) 1) 2) 8))) - (+! (-> arg0 data 111 used) v1-26) - (+! (-> arg0 data 111 total) (logand -16 (+ v1-26 15))) + (+! (-> usage data 111 used) v1-26) + (+! (-> usage data 111 total) (logand -16 (+ v1-26 15))) ) ) this @@ -889,7 +889,7 @@ (dotimes (s2-0 (-> this length)) (if (and (-> this data s2-0) (= (-> this data s2-0 type) arg1) - (or (name= arg0 (-> this data s2-0 name)) (string-charp= arg0 (&-> (-> this data s2-0 name) data s3-0))) + (or (name= arg0 (-> this data s2-0 name)) (string-charp= arg0 (&-> this data s2-0 name data s3-0))) ) (return (the-as basic (-> this data s2-0))) ) @@ -915,7 +915,7 @@ (dotimes (s2-0 (-> this length)) (if (and (-> this data s2-0) (= (-> this data s2-0 type) arg1) - (or (name= arg0 (-> this data s2-0 name)) (string-charp= arg0 (&-> (-> this data s2-0 name) data s3-0))) + (or (name= arg0 (-> this data s2-0 name)) (string-charp= arg0 (&-> this data s2-0 name data s3-0))) ) (return s2-0) ) @@ -943,29 +943,29 @@ this ) -(defmethod mem-usage ((this art-group) (arg0 memory-usage-block) (arg1 int)) - (set! (-> arg0 length) (max 74 (-> arg0 length))) - (set! (-> arg0 data 73 name) "art-group") - (+! (-> arg0 data 73 count) 1) +(defmethod mem-usage ((this art-group) (usage memory-usage-block) (flags int)) + (set! (-> usage length) (max 74 (-> usage length))) + (set! (-> usage data 73 name) "art-group") + (+! (-> usage data 73 count) 1) (let ((v1-6 (asize-of this))) - (+! (-> arg0 data 73 used) v1-6) - (+! (-> arg0 data 73 total) (logand -16 (+ v1-6 15))) + (+! (-> usage data 73 used) v1-6) + (+! (-> usage data 73 total) (logand -16 (+ v1-6 15))) ) (if (-> this extra) - (mem-usage (-> this extra) arg0 (logior arg1 512)) + (mem-usage (-> this extra) usage (logior flags 512)) ) (dotimes (s3-0 (-> this length)) (if (-> this data s3-0) - (mem-usage (-> this data s3-0) arg0 arg1) + (mem-usage (-> this data s3-0) usage flags) ) ) this ) ;; WARN: Return type mismatch art-group vs none. -(defmethod relocate ((this art-group) (arg0 kheap) (arg1 (pointer uint8))) +(defmethod relocate ((this art-group) (heap kheap) (name (pointer uint8))) (let ((s4-0 (clear *temp-string*))) - (string<-charp s4-0 arg1) + (string<-charp s4-0 name) (set! this (cond ((not this) @@ -1033,19 +1033,19 @@ (the-as int (+ (-> art size) (* (-> this length) 4))) ) -(defmethod mem-usage ((this art-mesh-geo) (arg0 memory-usage-block) (arg1 int)) - (set! (-> arg0 length) (max 76 (-> arg0 length))) - (set! (-> arg0 data 75 name) "art-mesh-geo") - (+! (-> arg0 data 75 count) 1) +(defmethod mem-usage ((this art-mesh-geo) (usage memory-usage-block) (flags int)) + (set! (-> usage length) (max 76 (-> usage length))) + (set! (-> usage data 75 name) "art-mesh-geo") + (+! (-> usage data 75 count) 1) (let ((v1-6 (asize-of this))) - (+! (-> arg0 data 75 used) v1-6) - (+! (-> arg0 data 75 total) (logand -16 (+ v1-6 15))) + (+! (-> usage data 75 used) v1-6) + (+! (-> usage data 75 total) (logand -16 (+ v1-6 15))) ) (if (-> this extra) - (mem-usage (-> this extra) arg0 (logior arg1 512)) + (mem-usage (-> this extra) usage (logior flags 512)) ) (dotimes (s3-0 (-> this length)) - (mem-usage (-> this data s3-0) arg0 arg1) + (mem-usage (-> this data s3-0) usage flags) ) this ) @@ -1118,52 +1118,52 @@ ) ) -(defmethod mem-usage ((this art-joint-geo) (arg0 memory-usage-block) (arg1 int)) - (set! (-> arg0 length) (max 77 (-> arg0 length))) - (set! (-> arg0 data 76 name) "art-joint-geo") - (+! (-> arg0 data 76 count) 1) +(defmethod mem-usage ((this art-joint-geo) (usage memory-usage-block) (flags int)) + (set! (-> usage length) (max 77 (-> usage length))) + (set! (-> usage data 76 name) "art-joint-geo") + (+! (-> usage data 76 count) 1) (let ((v1-6 (asize-of this))) - (+! (-> arg0 data 76 used) v1-6) - (+! (-> arg0 data 76 total) (logand -16 (+ v1-6 15))) + (+! (-> usage data 76 used) v1-6) + (+! (-> usage data 76 total) (logand -16 (+ v1-6 15))) ) (if (-> this extra) - (mem-usage (-> this extra) arg0 (logior arg1 512)) + (mem-usage (-> this extra) usage (logior flags 512)) ) (dotimes (s3-0 (-> this length)) - (mem-usage (-> this data s3-0) arg0 arg1) + (mem-usage (-> this data s3-0) usage flags) ) this ) -(defbehavior joint-control-channel-eval process ((arg0 joint-control-channel)) - (let ((f0-3 ((-> arg0 num-func) arg0 (-> arg0 param 0) (-> arg0 param 1) (-> arg0 param 2)))) - (set! (-> arg0 eval-time) (the-as uint (current-time))) +(defbehavior joint-control-channel-eval process ((jcc joint-control-channel)) + (let ((f0-3 ((-> jcc num-func) jcc (-> jcc param 0) (-> jcc param 1) (-> jcc param 2)))) + (set! (-> jcc eval-time) (the-as uint (current-time))) f0-3 ) ) -(defbehavior joint-control-channel-eval! process ((arg0 joint-control-channel) (arg1 (function joint-control-channel float float float float))) - (set! (-> arg0 num-func) arg1) - (let ((f0-3 (arg1 arg0 (-> arg0 param 0) (-> arg0 param 1) (-> arg0 param 2)))) - (set! (-> arg0 eval-time) (the-as uint (current-time))) +(defbehavior joint-control-channel-eval! process ((jcc joint-control-channel) (num-func (function joint-control-channel float float float float))) + (set! (-> jcc num-func) num-func) + (let ((f0-3 (num-func jcc (-> jcc param 0) (-> jcc param 1) (-> jcc param 2)))) + (set! (-> jcc eval-time) (the-as uint (current-time))) f0-3 ) ) -(defun joint-control-channel-group-eval! ((arg0 joint-control-channel) - (arg1 art-joint-anim) - (arg2 (function joint-control-channel float float float float)) +(defun joint-control-channel-group-eval! ((jcc joint-control-channel) + (ja art-joint-anim) + (num-func (function joint-control-channel float float float float)) ) - (set! (-> arg0 num-func) arg2) + (set! (-> jcc num-func) num-func) (cond - ((= (-> arg0 command) (joint-control-command stack)) + ((= (-> jcc command) (joint-control-command stack)) ) (else - (if arg1 - (set! (-> arg0 frame-group) arg1) + (if ja + (set! (-> jcc frame-group) ja) ) - (arg2 arg0 (-> arg0 param 0) (-> arg0 param 1) (-> arg0 param 2)) - (set! (-> arg0 eval-time) (the-as uint (current-time))) + (num-func jcc (-> jcc param 0) (-> jcc param 1) (-> jcc param 2)) + (set! (-> jcc eval-time) (the-as uint (current-time))) ) ) 0 @@ -1184,106 +1184,106 @@ 0 ) -(defun joint-control-copy! ((arg0 joint-control) (arg1 joint-control)) - (set! (-> arg0 blend-index) (-> arg1 blend-index)) - (set! (-> arg0 active-channels) (-> arg1 active-channels)) - (set! (-> arg0 float-channels) (the-as uint 0)) - (set! (-> arg0 root-channel) +(defun joint-control-copy! ((dst joint-control) (src joint-control)) + (set! (-> dst blend-index) (-> src blend-index)) + (set! (-> dst active-channels) (-> src active-channels)) + (set! (-> dst float-channels) (the-as uint 0)) + (set! (-> dst root-channel) (the-as (inline-array joint-control-channel) - (-> arg0 + (-> dst channel - (/ (the-as int (- (the-as uint (-> arg1 root-channel)) (the-as uint (the-as uint (-> arg1 channel))))) 64) + (/ (the-as int (- (the-as uint (-> src root-channel)) (the-as uint (the-as uint (-> src channel))))) 64) ) ) ) - (let ((v1-10 (min (the-as int (-> arg0 allocated-length)) (the-as int (-> arg1 active-channels))))) - (mem-copy! (the-as pointer (-> arg0 channel)) (the-as pointer (-> arg1 channel)) (* v1-10 64)) + (let ((v1-10 (min (the-as int (-> dst allocated-length)) (the-as int (-> src active-channels))))) + (mem-copy! (the-as pointer (-> dst channel)) (the-as pointer (-> src channel)) (* v1-10 64)) ) - (dotimes (v1-12 (the-as int (-> arg0 allocated-length))) - (set! (-> arg0 channel v1-12 parent) arg0) + (dotimes (v1-12 (the-as int (-> dst allocated-length))) + (set! (-> dst channel v1-12 parent) dst) ) - arg0 + dst ) ;; WARN: Using new Jak 2 rtype-of -(defun joint-control-remap! ((arg0 joint-control) (arg1 art-group) (arg2 art-group) (arg3 pair) (arg4 int) (arg5 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 (-> arg2 name)) 1)) - (set! sv-24 #t) - (set! sv-32 arg4) - (set! sv-40 2) - (while (and (< sv-40 (-> arg1 length)) (or (not (-> arg1 data sv-40)) (!= (-> arg1 data sv-40 type) art-joint-anim))) - (set! sv-40 (+ sv-40 1)) - ) - (dotimes (s2-1 (the-as int (+ (-> arg0 active-channels) (-> arg0 float-channels)))) - (set! sv-48 (-> arg0 channel s2-1)) - (set! sv-52 (the-as basic #f)) - (when (-> sv-48 frame-group) - (format (clear *temp-string*) "~S~G" arg5 (&+ (-> sv-48 frame-group name data) sv-16)) - (when (not (null? arg3)) - (set! sv-56 (nassoc *temp-string* arg3)) - (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) arg0 sv-48 0))) - (s1-3 s0-0 sv-80 a2-4) - ) - ) - ) - ) - ) +(defun joint-control-remap! ((jc joint-control) + (dst-art-group art-group) + (parent-art-group art-group) + (remap-list pair) + (seed int) + (prefix string) + ) + (let ((sv-16 (+ (length (-> parent-art-group name)) 1)) + (sv-24 #t) ) - (set! sv-64 (get-art-by-name arg1 *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) arg0 sv-48 1) - ) + (let ((sv-32 seed) + (sv-40 2) ) - (else - (set! (-> sv-48 frame-group) (the-as art-joint-anim (-> arg1 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 ) ;; ERROR: Failed load: (set! vf2 (l.vf (the-as int a2-1))) at op 46 @@ -1464,34 +1464,34 @@ ) ;; WARN: Return type mismatch object vs matrix. -(defun matrix-from-joint-anim-frame ((arg0 joint-anim-compressed-control) (arg1 int) (arg2 int)) - (let ((v1-1 (the-as object (-> arg0 fixed data))) - (v0-0 (the-as object (-> arg0 data arg2 data))) +(defun matrix-from-joint-anim-frame ((jacc joint-anim-compressed-control) (joint-idx int) (frame-idx int)) + (let ((fixed-matrix (the-as object (-> jacc fixed data))) + (frame-matrix (the-as object (-> jacc data frame-idx data))) ) (cond - ((not (logtest? (-> arg0 fixed hdr matrix-bits) 1)) - (set! v1-1 (cond - ((zero? arg1) - (return (the-as matrix v1-1)) - v1-1 - ) - (else - (-> (the-as (inline-array vector) v1-1) 4) - ) - ) + ((not (logtest? (-> jacc fixed hdr matrix-bits) 1)) + (set! fixed-matrix (cond + ((zero? joint-idx) + (return (the-as matrix fixed-matrix)) + fixed-matrix + ) + (else + (-> (the-as (inline-array vector) fixed-matrix) 4) + ) + ) ) ) - ((zero? arg1) - (return (the-as matrix v0-0)) + ((zero? joint-idx) + (return (the-as matrix frame-matrix)) ) (else - (set! v0-0 (-> (the-as (inline-array vector) v0-0) 4)) + (set! frame-matrix (-> (the-as (inline-array vector) frame-matrix) 4)) ) ) - (if (not (logtest? (-> arg0 fixed hdr matrix-bits) 2)) - (return (the-as matrix v1-1)) + (if (not (logtest? (-> jacc fixed hdr matrix-bits) 2)) + (return (the-as matrix fixed-matrix)) ) - (the-as matrix v0-0) + (the-as matrix frame-matrix) ) ) @@ -1664,7 +1664,7 @@ (set! (-> gp-0 quad 2) a1-1) (set! (-> gp-0 trans quad) a2-1) ) - (vector-normalize! (the-as vector (-> gp-0 vector)) 1.0) + (vector-normalize! (-> gp-0 vector 0) 1.0) (vector-normalize! (-> gp-0 vector 1) 1.0) (vector-normalize! (-> gp-0 vector 2) 1.0) gp-0 @@ -1688,44 +1688,44 @@ ) ) -(defun cspace<-rot-yxy! ((arg0 cspace) (arg1 transform)) - (let ((s5-0 (-> arg0 bone transform))) - (matrix-rotate-yxy! s5-0 (-> arg1 rot)) - (scale-matrix! s5-0 (-> arg1 scale) s5-0) +(defun cspace<-rot-yxy! ((dst cspace) (src transform)) + (let ((s5-0 (-> dst bone transform))) + (matrix-rotate-yxy! s5-0 (-> src rot)) + (scale-matrix! s5-0 (-> src scale) s5-0) ) ) -(defun cspace<-transform-yxy! ((arg0 cspace) (arg1 transform)) - (let ((s4-0 (-> arg0 bone transform)) +(defun cspace<-transform-yxy! ((dst cspace) (src transform)) + (let ((s4-0 (-> dst bone transform)) (s5-0 (new 'stack-no-clear 'matrix)) (s3-0 (new 'stack-no-clear 'matrix)) ) (matrix-identity! s4-0) - (matrix-translate! s4-0 (-> arg1 trans)) - (matrix-rotate-yxy! s5-0 (-> arg1 rot)) + (matrix-translate! s4-0 (-> src trans)) + (matrix-rotate-yxy! s5-0 (-> src rot)) (matrix*! s3-0 s5-0 s4-0) - (scale-matrix! s4-0 (-> arg1 scale) s3-0) + (scale-matrix! s4-0 (-> src scale) s3-0) ) ) -(defun cspace<-transformq! ((arg0 cspace) (arg1 transformq)) - (matrix<-transformq! (-> arg0 bone transform) arg1) +(defun cspace<-transformq! ((dst cspace) (src transformq)) + (matrix<-transformq! (-> dst bone transform) src) ) -(defun cspace<-transformq+trans! ((arg0 cspace) (arg1 transformq) (arg2 vector)) - (matrix<-transformq+trans! (-> arg0 bone transform) arg1 arg2) +(defun cspace<-transformq+trans! ((dst cspace) (src transformq) (extra-trans vector)) + (matrix<-transformq+trans! (-> dst bone transform) src extra-trans) ) -(defun cspace<-transformq+world-trans! ((arg0 cspace) (arg1 transformq) (arg2 vector)) - (matrix<-transformq+world-trans! (-> arg0 bone transform) arg1 arg2) +(defun cspace<-transformq+world-trans! ((dst cspace) (src transformq) (extra-trans vector)) + (matrix<-transformq+world-trans! (-> dst bone transform) src extra-trans) ) -(defun cspace<-transformq+rot-offset! ((arg0 cspace) (arg1 transformq) (arg2 vector)) - (matrix<-transformq+rot-offset! (-> arg0 bone transform) arg1 arg2) +(defun cspace<-transformq+rot-offset! ((dst cspace) (src transformq) (extra-rot vector)) + (matrix<-transformq+rot-offset! (-> dst bone transform) src extra-rot) ) -(defun cspace-calc-total-matrix! ((arg0 cspace) (arg1 matrix)) - (matrix*! arg1 (-> arg0 bone transform) (-> *math-camera* camera-temp)) +(defun cspace-calc-total-matrix! ((csp cspace) (dst matrix)) + (matrix*! dst (-> csp bone transform) (-> *math-camera* camera-temp)) ) (defun cspace<-matrix-no-push-joint! ((arg0 cspace) (arg1 joint-control)) @@ -1816,16 +1816,13 @@ ) ) -(defun cspace<-parented-matrix-mirror! ((arg0 cspace) (arg1 matrix)) - (let ((gp-0 (matrix-mirror! - (new 'stack-no-clear 'matrix) - (the-as vector (-> arg0 param1)) - (the-as vector (-> arg0 param2)) - ) - ) +(defun cspace<-parented-matrix-mirror! ((dst cspace) (joint-mat matrix)) + (let ((gp-0 + (matrix-mirror! (new 'stack-no-clear 'matrix) (the-as vector (-> dst param1)) (the-as vector (-> dst param2))) + ) ) - (cspace<-parented-matrix-joint! arg0 arg1) - (matrix*! (-> arg0 bone transform) (-> arg0 bone transform) gp-0) + (cspace<-parented-matrix-joint! dst joint-mat) + (matrix*! (-> dst bone transform) (-> dst bone transform) gp-0) ) ) @@ -1908,9 +1905,9 @@ (def-mips2c cspace<-parented-transformq-joint! (function cspace transformq none)) -(defun cspace<-parented-transformq-joint-flip-z! ((arg0 cspace) (arg1 transformq)) - (cspace<-parented-transformq-joint! arg0 arg1) - (cspace<-matrix-joint-flip-z! arg0 (-> arg0 bone transform)) +(defun cspace<-parented-transformq-joint-flip-z! ((dst cspace) (joint-transformq transformq)) + (cspace<-parented-transformq-joint! dst joint-transformq) + (cspace<-matrix-joint-flip-z! dst (-> dst bone transform)) 0 (none) ) @@ -2049,7 +2046,7 @@ (def-mips2c calc-animation-from-spr (function joint-anim-frame int none)) - +;; og:preserve-this (defun create-interpolated-joint-animation-frame ((output-frame joint-anim-frame) (arg1 int) (arg2 joint-control)) (let ((start (get-cpu-clock))) (cond diff --git a/goal_src/jak2/engine/camera/cam-combiner.gc b/goal_src/jak2/engine/camera/cam-combiner.gc index be765f0979..92464b63a0 100644 --- a/goal_src/jak2/engine/camera/cam-combiner.gc +++ b/goal_src/jak2/engine/camera/cam-combiner.gc @@ -8,9 +8,8 @@ ;; DECOMP BEGINS (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)) ) @@ -50,14 +49,10 @@ (let ((s4-0 (new-stack-vector0))) 0.0 (let ((s3-0 (new-stack-matrix0))) - (vector-! - (the-as vector (-> s2-0 vector)) - (the-as vector (-> sv-144 inv-mat)) - (the-as vector (-> gp-0 inv-mat)) - ) + (vector-! (-> s2-0 vector 0) (the-as vector (-> sv-144 inv-mat)) (the-as vector (-> gp-0 inv-mat))) (vector-! (-> s2-0 vector 1) (-> sv-144 inv-mat vector 1) (-> gp-0 inv-mat vector 1)) (vector-! (-> s2-0 vector 2) (-> sv-144 inv-mat vector 2) (-> gp-0 inv-mat vector 2)) - (let ((f0-6 (vector-length (the-as vector (-> s2-0 vector)))) + (let ((f0-6 (vector-length (-> s2-0 vector 0))) (f1-0 (vector-length (-> s2-0 vector 1))) (f2-0 (vector-length (-> s2-0 vector 2))) ) @@ -66,10 +61,10 @@ (vector-cross! s4-0 (-> s2-0 vector 1) (-> s2-0 vector 2)) ) ((and (< f1-0 f0-6) (< f1-0 f2-0)) - (vector-cross! s4-0 (the-as vector (-> s2-0 vector)) (-> s2-0 vector 2)) + (vector-cross! s4-0 (-> s2-0 vector 0) (-> s2-0 vector 2)) ) (else - (vector-cross! s4-0 (the-as vector (-> s2-0 vector)) (-> s2-0 vector 1)) + (vector-cross! s4-0 (-> s2-0 vector 0) (-> s2-0 vector 1)) ) ) ) @@ -80,38 +75,38 @@ ) (cond ((and (< f0-9 f1-3) (< f0-9 f2-3)) - (vector-flatten! (the-as vector (-> s2-0 vector)) (the-as vector (-> sv-144 inv-mat)) s4-0) + (vector-flatten! (-> s2-0 vector 0) (the-as vector (-> sv-144 inv-mat)) s4-0) (vector-flatten! (-> s2-0 vector 1) (the-as vector (-> gp-0 inv-mat)) s4-0) ) ((< f1-3 f2-3) - (vector-flatten! (the-as vector (-> s2-0 vector)) (-> sv-144 inv-mat vector 1) s4-0) + (vector-flatten! (-> s2-0 vector 0) (-> sv-144 inv-mat vector 1) s4-0) (vector-flatten! (-> s2-0 vector 1) (-> gp-0 inv-mat vector 1) s4-0) ) (else - (vector-flatten! (the-as vector (-> s2-0 vector)) (-> sv-144 inv-mat vector 2) s4-0) + (vector-flatten! (-> s2-0 vector 0) (-> sv-144 inv-mat vector 2) s4-0) (vector-flatten! (-> s2-0 vector 1) (-> gp-0 inv-mat vector 2) s4-0) ) ) ) - (vector-normalize! (the-as vector (-> s2-0 vector)) 1.0) + (vector-normalize! (-> s2-0 vector 0) 1.0) (vector-normalize! (-> s2-0 vector 1) 1.0) - (vector-cross! (-> s2-0 vector 2) (the-as vector (-> s2-0 vector)) (-> s2-0 vector 1)) + (vector-cross! (-> s2-0 vector 2) (-> s2-0 vector 0) (-> s2-0 vector 1)) (if (< (vector-dot (-> s2-0 vector 2) s4-0) 0.0) (vector-negate! s4-0 s4-0) ) - (let ((f30-0 (acos (vector-dot (the-as vector (-> s2-0 vector)) (-> s2-0 vector 1))))) + (let ((f30-0 (acos (vector-dot (-> s2-0 vector 0) (-> s2-0 vector 1))))) (cond ((logtest? (-> *camera* master-options) (cam-master-options-u32 SET_COMBINER_AXIS)) (logclear! (-> *camera* master-options) (cam-master-options-u32 SET_COMBINER_AXIS FLIP_COMBINER)) (when (and (< 8192.0 f30-0) (logtest? (-> *camera* master-options) (cam-master-options-u32 HAVE_TARGET))) - (vector-! (the-as vector (-> s2-0 vector)) (-> *camera* tpos-curr) s1-0) + (vector-! (-> s2-0 vector 0) (-> *camera* tpos-curr) s1-0) (vector-! (-> s2-0 vector 1) s0-0 s1-0) - (vector-flatten! (the-as vector (-> s2-0 vector)) (the-as vector (-> s2-0 vector)) (-> *camera* local-down)) + (vector-flatten! (-> s2-0 vector 0) (-> s2-0 vector 0) (-> *camera* local-down)) (vector-flatten! (-> s2-0 vector 1) (-> s2-0 vector 1) (-> *camera* local-down)) - (when (and (< 4096.0 (vector-normalize-ret-len! (the-as vector (-> s2-0 vector)) 1.0)) + (when (and (< 4096.0 (vector-normalize-ret-len! (-> s2-0 vector 0) 1.0)) (< 4096.0 (vector-normalize-ret-len! (-> s2-0 vector 1) 1.0)) ) - (vector-cross! (-> s2-0 vector 2) (-> s2-0 vector 1) (the-as vector (-> s2-0 vector))) + (vector-cross! (-> s2-0 vector 2) (-> s2-0 vector 1) (-> s2-0 vector 0)) (when (< (vector-dot (-> s2-0 vector 2) s4-0) -0.01) ) ) @@ -130,7 +125,7 @@ (matrix-axis-sin-cos! s3-0 s4-0 (sin f30-1) (cos f30-1)) ) ) - (matrix*! (-> self inv-camera-rot) (the-as matrix gp-0) s3-0) + (matrix*! (-> self inv-camera-rot) (-> gp-0 inv-mat) s3-0) ) ) ) diff --git a/goal_src/jak2/engine/camera/cam-layout.gc b/goal_src/jak2/engine/camera/cam-layout.gc index c8d572f5a8..e6ea1a9c8c 100644 --- a/goal_src/jak2/engine/camera/cam-layout.gc +++ b/goal_src/jak2/engine/camera/cam-layout.gc @@ -157,35 +157,21 @@ ;; 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) @@ -201,121 +187,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)) - ) - ) ) ) ) @@ -791,7 +793,7 @@ ) (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)) @@ -861,35 +863,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)) ) ) ) @@ -2253,10 +2255,11 @@ ) (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/goal_src/jak2/engine/camera/cam-master.gc b/goal_src/jak2/engine/camera/cam-master.gc index 63edb3655c..2312e4b097 100644 --- a/goal_src/jak2/engine/camera/cam-master.gc +++ b/goal_src/jak2/engine/camera/cam-master.gc @@ -343,16 +343,7 @@ ) (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 @@ -369,8 +360,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 @@ -398,22 +390,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))) @@ -440,26 +431,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) ) ) ) @@ -479,13 +465,7 @@ #f ) ((-> arg0 mode-name) - (let ((s5-1 (-> arg0 mode-name value))) - (set! (-> arg0 cam-mode) (the-as symbol (if (type? s5-1 state) - s5-1 - ) - ) - ) - ) + (set! (-> arg0 cam-mode) (the-as symbol (the-as object (as-type (-> arg0 mode-name value) state)))) (set! (-> arg0 real-entity-name) #f) #f ) diff --git a/goal_src/jak2/engine/camera/cam-states-dbg.gc b/goal_src/jak2/engine/camera/cam-states-dbg.gc index 9d741277e9..058a784f5b 100644 --- a/goal_src/jak2/engine/camera/cam-states-dbg.gc +++ b/goal_src/jak2/engine/camera/cam-states-dbg.gc @@ -67,14 +67,14 @@ (matrix-axis-angle! s3-0 (-> *camera* local-down) (- (-> s5-0 y))) (vector-matrix*! s4-0 s4-0 s3-0) ) - (forward-down->inv-matrix (the-as matrix (-> self tracking)) s4-0 (-> *camera* local-down)) + (forward-down->inv-matrix (-> self tracking inv-mat) s4-0 (-> *camera* local-down)) ) (set! (-> self pivot-rad) (- (-> self pivot-rad) (-> gp-0 z))) (if (< (-> self pivot-rad) 4096.0) (set! (-> self pivot-rad) 4096.0) ) (set-vector! gp-0 0.0 0.0 (- (-> self pivot-rad)) 1.0) - (vector-matrix*! (-> self trans) gp-0 (the-as matrix (-> self tracking))) + (vector-matrix*! (-> self trans) gp-0 (-> self tracking inv-mat)) ) ) (suspend) @@ -95,7 +95,7 @@ (defun cam-mouse-input ((arg0 vector) (arg1 vector)) (let ((v1-0 (new 'stack-no-clear 'vector))) - (vector-! v1-0 (the-as vector (-> *mouse* pos)) (-> *mouse* pos 1)) + (vector-! v1-0 (-> *mouse* pos 0) (-> *mouse* pos 1)) (cond ((mouse-hold? left) (let ((a0-7 (new 'stack-no-clear 'vector))) @@ -106,12 +106,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)) ) @@ -287,13 +282,13 @@ ((cpad-hold? arg3 r2) (when (logtest? (-> *camera* settings master-options) (cam-master-options READ_BUTTONS)) (if (cpad-hold? arg3 r1) - (+! (-> arg1 y) (+ (* 0.2 (-> *CAM_FREE-bank* speed)) (analog-input - (the-as int (-> *cpad-list* cpads arg3 abutton (abutton-idx r1))) ;; og:preserve-this abutton indexing - 0.0 - 32.0 - 230.0 - (* 0.2 (-> *CAM_FREE-bank* speed)) - ) + (+! (-> arg1 y) (+ (/ (-> *CAM_FREE-bank* speed) 5) (analog-input + (the-as int (-> *cpad-list* cpads arg3 abutton (abutton-idx r1))) ;; og:preserve-this abutton indexing + 0.0 + 32.0 + 230.0 + (/ (-> *CAM_FREE-bank* speed) 5) + ) ) ) ) @@ -301,13 +296,13 @@ (when (logtest? (-> *camera* settings master-options) (cam-master-options READ_BUTTONS)) (if (cpad-hold? arg3 l1) (set! (-> arg1 y) - (- (-> arg1 y) (+ (* 0.2 (-> *CAM_FREE-bank* speed)) (analog-input - (the-as int (-> *cpad-list* cpads arg3 abutton (abutton-idx l1))) ;; og:preserve-this abutton indexing - 0.0 - 32.0 - 230.0 - (* 0.2 (-> *CAM_FREE-bank* speed)) - ) + (- (-> arg1 y) (+ (/ (-> *CAM_FREE-bank* speed) 5) (analog-input + (the-as int (-> *cpad-list* cpads arg3 abutton (abutton-idx l1))) ;; og:preserve-this abutton indexing + 0.0 + 32.0 + 230.0 + (/ (-> *CAM_FREE-bank* speed) 5) + ) ) ) ) @@ -417,7 +412,7 @@ (matrix*! arg0 arg0 (-> s3-0 tm)) ) ) - (matrix-axis-angle! (-> s3-0 tm) (the-as vector (-> arg0 vector)) (- (-> s3-0 rv x))) + (matrix-axis-angle! (-> s3-0 tm) (-> arg0 vector 0) (- (-> s3-0 rv x))) (matrix*! arg0 arg0 (-> s3-0 tm)) (matrix-axis-angle! (-> s3-0 tm) (-> arg0 vector 2) (- (-> s3-0 rv z))) (matrix*! arg0 arg0 (-> s3-0 tm)) @@ -451,7 +446,7 @@ (set! a2-0 (the-as vector #f)) ) (cam-free-floating-move - (the-as matrix (-> self tracking)) + (-> self tracking inv-mat) (-> self trans) a2-0 (the-as int (-> *CAMERA-bank* joypad)) diff --git a/goal_src/jak2/engine/camera/cam-states.gc b/goal_src/jak2/engine/camera/cam-states.gc index 9b5ab1dbd8..972f325b04 100644 --- a/goal_src/jak2/engine/camera/cam-states.gc +++ b/goal_src/jak2/engine/camera/cam-states.gc @@ -63,7 +63,7 @@ (cam-curve-pos (-> self trans) gp-0 (the-as curve #f) #f) (when (!= (-> gp-0 w) 0.0) (vector-normalize! gp-0 1.0) - (forward-down->inv-matrix (the-as matrix (-> self tracking)) gp-0 (-> *camera* local-down)) + (forward-down->inv-matrix (-> self tracking inv-mat) gp-0 (-> *camera* local-down)) ) ) ) @@ -90,7 +90,7 @@ ) ((-> self cam-entity) (cam-slave-get-vector-with-offset (the-as entity-actor (-> self cam-entity)) (-> self trans) 'trans) - (cam-slave-get-rot (the-as entity-actor (-> self cam-entity)) (the-as matrix (-> self tracking))) + (cam-slave-get-rot (the-as entity-actor (-> self cam-entity)) (-> self tracking inv-mat)) (set! (-> self fov) (cam-slave-get-fov (-> self cam-entity))) (cam-curve-setup (-> self trans)) ((-> cam-fixed enter)) @@ -163,7 +163,7 @@ ) (vector-reset! (-> self tracking inv-mat trans)) (let ((gp-0 (new 'stack-no-clear 'vector))) - (vector-matrix*! gp-0 (-> *camera* settings pov-offset) (the-as matrix (-> self tracking))) + (vector-matrix*! gp-0 (-> *camera* settings pov-offset) (-> self tracking inv-mat)) (vector+! (-> self trans) (-> self trans) gp-0) ) ) @@ -252,7 +252,7 @@ (cond ((and (< (vector-vector-distance s2-0 gp-0) 40960.0) (< (cos 3640.889) (vector-dot s5-0 s3-0))) (set! (-> self trans quad) (-> s2-0 quad)) - (vector-negate! (the-as vector (-> self tracking)) (the-as vector (-> s0-0 vector))) + (vector-negate! (the-as vector (-> self tracking)) (-> s0-0 vector 0)) (set! (-> (the-as vector (-> self tracking inv-mat vector 1)) quad) (-> s0-0 vector 1 quad)) (vector-negate! (-> self tracking inv-mat vector 2) (-> s0-0 vector 2)) (set! (-> self fov) (* 2.0 (atan (/ 12.700255 (* 20.3 (-> s1-0 x))) 1.0))) @@ -419,7 +419,7 @@ (set! (-> self fov) (cam-slave-get-fov (-> self cam-entity))) (logior! (-> self options) (cam-slave-get-flags (-> self cam-entity) 'flags)) (if (logtest? (-> self options) (cam-slave-options-u32 NO_ROTATE)) - (cam-slave-get-rot (the-as entity-actor (-> self cam-entity)) (the-as matrix (-> self tracking))) + (cam-slave-get-rot (the-as entity-actor (-> self cam-entity)) (-> self tracking inv-mat)) (set! (-> self tracking tilt-adjust target) (cam-slave-get-float (-> self cam-entity) 'tiltAdjust (-> *CAMERA-bank* default-tilt-adjust)) ) @@ -509,6 +509,7 @@ -1.0 ) ) + ;; og:preserve-this (f0-0 (analog-input-vertical-first (the-as int (+ (-> *cpad-list* cpads 0 righty) -256 (-> *cpad-list* cpads 0 lefty))) 0.0 @@ -552,23 +553,23 @@ ) ) (matrix-axis-angle! s5-0 (-> *camera* local-down) (-> s4-0 y)) - (matrix*! (the-as matrix (-> self tracking)) (the-as matrix (-> self tracking)) s5-0) + (matrix*! (-> self tracking inv-mat) (-> self tracking inv-mat) s5-0) (when (not (logtest? (-> self options) (cam-slave-options-u32 ALLOW_Z_ROT))) (if (< (vector-dot (-> self tracking inv-mat vector 1) (-> *camera* local-down)) 0.0) (forward-down->inv-matrix - (the-as matrix (-> self tracking)) + (-> self tracking inv-mat) (-> self tracking inv-mat vector 2) (-> *camera* local-down) ) (forward-down->inv-matrix - (the-as matrix (-> self tracking)) + (-> self tracking inv-mat) (-> self tracking inv-mat vector 2) (vector-negate! (new-stack-vector0) (-> *camera* local-down)) ) ) ) (matrix-axis-angle! s5-0 (the-as vector (-> self tracking)) (- (-> s4-0 x))) - (matrix*! (the-as matrix (-> self tracking)) (the-as matrix (-> self tracking)) s5-0) + (matrix*! (-> self tracking inv-mat) (-> self tracking inv-mat) s5-0) ) (when (not (logtest? (-> self options) (cam-slave-options-u32 ALLOW_Z_ROT))) (let ((f30-1 (vector-dot (-> *camera* local-down) (-> self tracking inv-mat vector 2)))) @@ -629,7 +630,7 @@ (set! (-> self fov) (cam-slave-get-fov (-> self cam-entity))) (logior! (-> self options) (cam-slave-get-flags (-> self cam-entity) 'flags)) (if (logtest? (-> self options) (cam-slave-options-u32 NO_ROTATE)) - (cam-slave-get-rot (the-as entity-actor (-> self cam-entity)) (the-as matrix (-> self tracking))) + (cam-slave-get-rot (the-as entity-actor (-> self cam-entity)) (-> self tracking inv-mat)) (set! (-> self tracking tilt-adjust target) (cam-slave-get-float (-> self cam-entity) 'tiltAdjust (-> *CAMERA-bank* default-tilt-adjust)) ) @@ -1117,7 +1118,7 @@ ((logtest? (-> self options) (cam-slave-options-u32 NO_ROTATE)) (set! (-> self blend-from-type) (the-as uint 0)) (set! (-> self blend-to-type) (camera-blend-to-type unknown-0)) - (cam-slave-get-rot (the-as entity-actor (-> self cam-entity)) (the-as matrix (-> self tracking))) + (cam-slave-get-rot (the-as entity-actor (-> self cam-entity)) (-> self tracking inv-mat)) ) (else (set! (-> self blend-from-type) (the-as uint 2)) @@ -1401,86 +1402,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 ) ) ) @@ -1691,153 +1689,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)) - ;; og:preserve-this inlined vector-dot - ;; (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) - ;; ) - (set! f2-1 (vector-dot arg1 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* - (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)) ) ) ) @@ -1913,13 +1887,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 (the-as vector sv-816) 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) ) ) @@ -2507,11 +2481,7 @@ ) ) ((or (logtest? (-> self options) (cam-slave-options-u32 BUTT_CAM)) - (let ((s3-0 (handle->process (-> *camera* settings butt-handle)))) - (if (type? s3-0 process-drawable) - s3-0 - ) - ) + (the-as object (as-type (handle->process (-> *camera* settings butt-handle)) process-drawable)) ) (vector-normalize-copy! gp-3 (-> self view-flat) 1.0) (let ((v1-283 (handle->process (-> *camera* settings butt-handle)))) diff --git a/goal_src/jak2/engine/camera/cam-update.gc b/goal_src/jak2/engine/camera/cam-update.gc index ffbf1a91dd..cb5d9b4e5f 100644 --- a/goal_src/jak2/engine/camera/cam-update.gc +++ b/goal_src/jak2/engine/camera/cam-update.gc @@ -27,7 +27,6 @@ ) (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))) @@ -53,7 +52,7 @@ (vector-matrix*! (-> s5-0 yon-bottom-left) (-> s5-0 yon-bottom-left) arg3) (vector-matrix*! (-> s5-0 yon-bottom-right) (-> s5-0 yon-bottom-right) arg3) (when (= arg2 1.0) - (vector-! (the-as vector (-> *fog-texture-work* corner)) (-> s5-0 yon-top-left) (-> arg3 trans)) + (vector-! (-> *fog-texture-work* corner 0) (-> s5-0 yon-top-left) (-> arg3 trans)) (vector-! (-> *fog-texture-work* corner 1) (-> s5-0 yon-top-right) (-> arg3 trans)) (vector-! (-> *fog-texture-work* corner 2) (-> s5-0 yon-bottom-left) (-> arg3 trans)) (vector-! (-> *fog-texture-work* corner 3) (-> s5-0 yon-bottom-right) (-> arg3 trans)) @@ -64,22 +63,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/goal_src/jak2/engine/camera/camera.gc b/goal_src/jak2/engine/camera/camera.gc index e6c6ea9e16..5bf064b01d 100644 --- a/goal_src/jak2/engine/camera/camera.gc +++ b/goal_src/jak2/engine/camera/camera.gc @@ -294,9 +294,7 @@ ) (defun fourth-power ((arg0 float)) - (let ((f0-2 (* arg0 arg0))) - (* f0-2 f0-2) - ) + (square (square arg0)) ) (defun third-power ((arg0 float)) @@ -312,19 +310,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))))) ) ) ) @@ -361,19 +350,12 @@ ) (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*) @@ -389,7 +371,7 @@ (s3-2 (cond (v0-8 - (vector+! (the-as vector (-> this vec)) (the-as vector (&+ s3-2 0)) (the-as vector v0-8)) + (vector+! (-> this vec 0) (the-as vector (&+ s3-2 0)) (the-as vector v0-8)) (vector+! (-> this vec 1) (the-as vector (&+ s3-2 16)) (the-as vector v0-8)) ) (else @@ -414,7 +396,7 @@ ((logtest? (-> this flags) (cam-index-options SPHERICAL)) (vector-! v1-11 (-> this vec 1) arg2) (set! (-> this vec 1 w) (vector-length v1-11)) - (vector-! v1-11 (the-as vector (-> this vec)) arg2) + (vector-! v1-11 (-> this vec 0) arg2) (set! (-> this vec 1 x) (vector-length v1-11)) (set! (-> this vec 1 w) (- (-> this vec 1 w) (-> this vec 1 x))) (set! (-> this vec 0 quad) (-> arg2 quad)) @@ -422,13 +404,13 @@ ((logtest? (-> this flags) (cam-index-options RADIAL)) (vector-! v1-11 (-> this vec 1) arg2) (set! (-> this vec 1 w) (vector-length v1-11)) - (vector-! v1-11 (the-as vector (-> this vec)) arg2) + (vector-! v1-11 (-> this vec 0) arg2) (set! (-> this vec 1 x) (vector-length v1-11)) (set! (-> this vec 1 w) (- (-> this vec 1 w) (-> this vec 1 x))) (set! (-> this vec 0 quad) (-> arg2 quad)) ) (else - (vector-! (-> this vec 1) (-> this vec 1) (the-as vector (-> this vec))) + (vector-! (-> this vec 1) (-> this vec 1) (-> this vec 0)) (set! (-> this vec 1 w) (vector-normalize-ret-len! (-> this vec 1) 1.0)) ) ) @@ -439,7 +421,7 @@ (defmethod cam-index-method-10 ((this cam-index) (arg0 vector)) (let ((s5-0 (new-stack-vector0))) 0.0 - (vector-! s5-0 arg0 (the-as vector (-> this vec))) + (vector-! s5-0 arg0 (-> this vec 0)) (cond ((logtest? (-> this flags) (cam-index-options SPHERICAL)) (vector-flatten! s5-0 s5-0 (-> *camera* local-down)) @@ -496,8 +478,8 @@ (set! (-> this summed-len) (- (-> this summed-len) (-> this point arg0 tp-length))) (vector-! (the-as vector (+ (the-as uint (-> this point 0 direction)) (* 48 arg0))) - (the-as vector (-> this point v1-11)) - (the-as vector (-> this point arg0)) + (-> this point v1-11 position) + (-> this point arg0 position) ) ) (set! (-> this point arg0 tp-length) @@ -642,7 +624,7 @@ (vector-! (the-as vector (+ (the-as uint (-> this point 0 direction)) (* 48 s2-0))) arg0 - (the-as vector (-> this point s2-0)) + (-> this point s2-0 position) ) (set! (-> this point s2-0 tp-length) (vector-normalize-ret-len! (the-as vector (+ (the-as uint (-> this point 0 direction)) (* 48 s2-0))) 1.0) @@ -689,7 +671,7 @@ (cond ((= (-> arg2 cur-pt) (-> this end-point)) (set! (-> arg2 partial-pt) 0.0) - (vector+! arg1 arg1 (the-as vector (-> this point (-> arg2 cur-pt)))) + (vector+! arg1 arg1 (-> this point (-> arg2 cur-pt) position)) (return arg1) ) ((begin (set! f0-4 (+ (-> arg2 partial-pt) (/ arg0 (-> this point (-> arg2 cur-pt) tp-length)))) (< f0-4 1.0)) @@ -698,8 +680,8 @@ (let ((a2-5 (-> this point (-> arg2 cur-pt) next))) (vector-lerp! (the-as vector s5-0) - (the-as vector (-> this point (-> arg2 cur-pt))) - (the-as vector (-> this point a2-5)) + (-> this point (-> arg2 cur-pt) position) + (-> this point a2-5 position) f0-4 ) ) @@ -728,11 +710,7 @@ (defmethod tracking-spline-method-20 ((this tracking-spline) (arg0 vector) (arg1 int)) (let ((s3-0 (new 'stack-no-clear 'vector))) - (vector-! - s3-0 - (the-as vector (-> this point (-> this used-point))) - (the-as vector (-> this point (-> this end-point))) - ) + (vector-! s3-0 (-> this point (-> this used-point) position) (-> this point (-> this end-point) position)) (let* ((f0-0 (vector-length s3-0)) (f1-1 (* 0.33333334 (- 1.5 (/ f0-0 METER_LENGTH)))) ) @@ -780,7 +758,7 @@ ((< f26-0 0.0) (if (and *debug-segment* *display-camera-marks*) (camera-line-rel-len - (the-as vector (-> this point s1-0)) + (-> this point s1-0 position) s2-0 (* -40.96 f26-0) (new 'static 'vector4w :x #xff :y #xff :w #x80) @@ -790,7 +768,7 @@ ) ((and *debug-segment* *display-camera-marks*) (camera-line-rel-len - (the-as vector (-> this point s1-0)) + (-> this point s1-0 position) s2-0 (* 40.96 f26-0) (new 'static 'vector4w :x #x80 :y #x80 :w #x80) @@ -958,7 +936,7 @@ ) (else (vector-reset! (-> self trans)) - (matrix-identity! (the-as matrix (-> self tracking))) + (matrix-identity! (-> self tracking inv-mat)) (set! (-> self fov) 11650.845) (vector-reset! (-> self velocity)) ) @@ -1153,7 +1131,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 @@ -1184,11 +1161,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)) ) @@ -1206,10 +1185,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) ) @@ -1257,10 +1233,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)) ) ) ) @@ -1416,7 +1392,6 @@ ) (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) @@ -1436,30 +1411,32 @@ (let ((f26-0 (vector-length s3-0))) (vector-flatten! s3-0 s3-0 (-> arg0 vector 1)) (vector-normalize! s3-0 1.0) - (let ((f28-0 (vector-dot s3-0 (the-as vector (-> arg0 vector))))) - (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 ((f28-0 (vector-dot s3-0 (-> arg0 vector 0)))) + (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 (the-as vector (-> arg0 vector)) 6144.0) + (vector--float*! s2-0 s2-0 (-> arg0 vector 0) 6144.0) (vector-normalize! s2-0 1.0) - (let ((f0-9 (fmax 0.0 (vector-dot s2-0 (the-as vector (-> arg0 vector)))))) + (let ((f0-9 (fmax 0.0 (vector-dot s2-0 (-> arg0 vector 0))))) (when (< f0-9 (fabs f28-0)) (if (< f28-0 0.0) - (vector--float*! s2-0 s2-0 (the-as vector (-> arg0 vector)) (* 2.0 f0-9)) + (vector--float*! s2-0 s2-0 (-> arg0 vector 0) (* 2.0 f0-9)) ) (matrix-from-two-vectors! s5-0 s2-0 s3-0) (vector-matrix*! (-> arg0 vector 2) (-> arg0 vector 2) s5-0) - (vector-cross! (the-as vector (-> arg0 vector)) (-> arg0 vector 1) (-> arg0 vector 2)) + (vector-cross! (-> arg0 vector 0) (-> arg0 vector 1) (-> arg0 vector 2)) ) ) ) @@ -1467,20 +1444,22 @@ (vector-! s3-0 (-> *camera* tpos-curr) (-> *camera* pitch-off)) (vector-! s3-0 s3-0 arg1) (vector--float*! s3-0 s3-0 (-> *camera* local-down) (-> *camera* settings foot-offset)) - (vector-flatten! s3-0 s3-0 (the-as vector (-> arg0 vector))) + (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)))) @@ -1493,15 +1472,10 @@ (vector-! s3-0 (-> *camera* tpos-curr) (-> *camera* pitch-off)) (vector-! s3-0 s3-0 arg1) (vector--float*! s3-0 s3-0 (-> *camera* local-down) (-> *camera* settings head-offset)) - (vector-flatten! s3-0 s3-0 (the-as vector (-> arg0 vector))) + (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)))) @@ -1526,13 +1500,13 @@ ) ) ) - (matrix-axis-angle! s5-0 (the-as vector (-> arg0 vector)) f0-35) + (matrix-axis-angle! s5-0 (-> arg0 vector 0) f0-35) ) ) ) (vector-matrix*! (-> arg0 vector 2) (-> arg0 vector 2) s5-0) ) - (vector-cross! (-> arg0 vector 1) (-> arg0 vector 2) (the-as vector (-> arg0 vector))) + (vector-cross! (-> arg0 vector 1) (-> arg0 vector 2) (-> arg0 vector 0)) ) ) @@ -1540,15 +1514,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) @@ -1564,22 +1530,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*! @@ -1599,49 +1566,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) - ;; og:preserve-this inlined vector-dot - ;; (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) - ;; ) - (set! f0-9 (vector-dot (-> *camera* local-down) sv-224)) - (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) ) ) ) @@ -1654,12 +1607,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) @@ -1715,99 +1663,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)) - ;; og:preserve-this inlined vector-dot - ;; (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) - ;; ) - (set! f0-10 (vector-dot s0-0 sv-160)) - (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))) @@ -1821,10 +1741,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 @@ -1856,33 +1777,16 @@ ) ) (let ((t9-10 acos)) - ;; og:preserve-this inlined vector-dot - ;; (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) - ;; ) - (set! f0-7 (vector-dot s1-0 sv-160)) + (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/goal_src/jak2/engine/collide/collide-cache.gc b/goal_src/jak2/engine/collide/collide-cache.gc index a910b970d5..5bc3fb3cdf 100644 --- a/goal_src/jak2/engine/collide/collide-cache.gc +++ b/goal_src/jak2/engine/collide/collide-cache.gc @@ -28,7 +28,7 @@ (add-debug-box #t (bucket-id debug2) - (the-as vector (-> arg2 bbox)) + (-> arg2 bbox min) (-> arg2 bbox max) (new 'static 'rgba :g #xff :b #xff :a #x80) ) @@ -631,20 +631,18 @@ ) (when (logtest? s4-0 (-> v1-18 prim-core collide-as)) (let ((s0-0 (-> v1-18 prim-core))) - (vector-! (-> s3-0 vector 1) (the-as vector s0-0) (-> arg0 start-pos)) + (vector-! (-> s3-0 vector 1) (-> s0-0 world-sphere) (-> arg0 start-pos)) (let* ((f1-2 (* (vector-dot (-> arg0 move-dist) (-> s3-0 vector 1)) f30-0)) (f0-6 (fmax 0.0 (fmin 1.0 f1-2))) ) - (vector+float*! (the-as vector (-> s3-0 vector)) (-> arg0 start-pos) (-> arg0 move-dist) f0-6) + (vector+float*! (-> s3-0 vector 0) (-> arg0 start-pos) (-> arg0 move-dist) f0-6) ) - (let ((f0-7 (vector-vector-distance-squared (the-as vector (-> s3-0 vector)) (the-as vector s0-0))) - (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)) ) ) ) @@ -667,20 +665,18 @@ ) (when (logtest? s4-0 (-> v1-39 prim-core collide-as)) (let ((s0-1 (-> v1-39 prim-core))) - (vector-! (-> s3-0 vector 1) (the-as vector s0-1) (-> arg0 start-pos)) + (vector-! (-> s3-0 vector 1) (-> s0-1 world-sphere) (-> arg0 start-pos)) (let* ((f1-8 (* (vector-dot (-> arg0 move-dist) (-> s3-0 vector 1)) f30-0)) (f0-11 (fmax 0.0 (fmin 1.0 f1-8))) ) - (vector+float*! (the-as vector (-> s3-0 vector)) (-> arg0 start-pos) (-> arg0 move-dist) f0-11) + (vector+float*! (-> s3-0 vector 0) (-> arg0 start-pos) (-> arg0 move-dist) f0-11) ) - (let ((f0-12 (vector-vector-distance-squared (the-as vector (-> s3-0 vector)) (the-as vector s0-1))) - (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)) ) ) ) @@ -765,7 +761,7 @@ ((>= (the-as int (-> (the-as collide-cache-prim s4-0) prim-core prim-type)) 0) (let ((f0-0 ((method-of-type collide-cache-prim resolve-moving-sphere-tri) (the-as collide-cache-prim s4-0) - (the-as collide-tri-result arg0) + (-> arg0 best-other-tri) (the-as collide-prim-core (-> s5-0 vertex 1)) (-> s5-0 vertex 2) f30-0 @@ -785,7 +781,7 @@ ) (let ((f0-1 ((method-of-type collide-cache-prim resolve-moving-sphere-sphere) (the-as collide-cache-prim s4-0) - (the-as collide-tri-result arg0) + (-> arg0 best-other-tri) (the-as collide-prim-core (-> s5-0 vertex 1)) (-> s5-0 vertex 2) f30-0 diff --git a/goal_src/jak2/engine/collide/collide-edge-grab.gc b/goal_src/jak2/engine/collide/collide-edge-grab.gc index 6996d25764..a8e40eed52 100644 --- a/goal_src/jak2/engine/collide/collide-edge-grab.gc +++ b/goal_src/jak2/engine/collide/collide-edge-grab.gc @@ -130,7 +130,6 @@ ;; 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) @@ -164,19 +163,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)) @@ -194,7 +195,7 @@ (-> (the-as collide-shape-moving (-> this process 0 root)) dynam gravity-normal quad) ) (vector-normalize! - (vector-! (-> arg1 hanging-matrix vector 2) (-> arg1 world-vertex 1) (the-as vector (-> arg1 world-vertex))) + (vector-! (-> arg1 hanging-matrix vector 2) (-> arg1 world-vertex 1) (-> arg1 world-vertex 0)) 1.0 ) (vector-normalize! @@ -287,8 +288,8 @@ (-> (the-as collide-shape-moving (-> arg0 process 0 root)) dynam gravity-normal quad) ) (vector-normalize! (vector-! (-> s4-0 vector 2) (-> this vertex-ptr 1 0) (-> this vertex-ptr 0 0)) 1.0) - (vector-normalize! (vector-cross! (the-as vector (-> s4-0 vector)) (-> s4-0 vector 2) (-> s4-0 vector 1)) 1.0) - (vector-cross! (-> s4-0 vector 2) (the-as vector (-> s4-0 vector)) (-> s4-0 vector 1)) + (vector-normalize! (vector-cross! (-> s4-0 vector 0) (-> s4-0 vector 2) (-> s4-0 vector 1)) 1.0) + (vector-cross! (-> s4-0 vector 2) (-> s4-0 vector 0) (-> s4-0 vector 1)) (vector-average! (-> s4-0 trans) (-> this vertex-ptr 1 0) (-> this vertex-ptr 0 0)) (transform-vectors! s4-0 s5-0 (-> arg0 spec local-player-spheres) 6) (let ((a1-11 (new 'stack-no-clear 'collide-query))) @@ -472,7 +473,7 @@ (add-debug-line #t (bucket-id debug-no-zbuf1) - (the-as vector (-> this world-vertex)) + (-> this world-vertex 0) (-> this world-vertex 1) (new 'static 'rgba :r #xff :a #x60) #f @@ -504,7 +505,7 @@ #t (bucket-id debug-no-zbuf1) (-> this adjacent-edge-left-vertex) - (the-as vector (-> this world-vertex)) + (-> this world-vertex 0) (new 'static 'rgba :r #x80 :a #x60) #f (the-as rgba -1) @@ -524,7 +525,7 @@ (add-debug-outline-triangle #t (bucket-id debug-no-zbuf1) - (the-as vector (-> this tri-vertex)) + (-> this tri-vertex 0) (-> this world-vertex 4) (-> this world-vertex 5) (new 'static 'rgba :r #xff :a #x30) @@ -544,7 +545,6 @@ ) (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)) @@ -581,13 +581,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)) ) ) @@ -664,7 +658,7 @@ (add-debug-sphere #t (bucket-id debug-no-zbuf1) - (the-as vector (-> this attempts s5-1)) + (-> this attempts s5-1 vector) (meters 0.1) (new 'static 'rgba :a #x40) ) @@ -680,7 +674,7 @@ (add-debug-outline-triangle #t (bucket-id debug-no-zbuf1) - (the-as vector (-> v1-3 vertex)) + (-> v1-3 vertex 0) (-> v1-3 vertex 1) (-> v1-3 vertex 2) t1-0 diff --git a/goal_src/jak2/engine/collide/collide-shape-rider.gc b/goal_src/jak2/engine/collide/collide-shape-rider.gc index ce05b6ec11..f88e3a914f 100644 --- a/goal_src/jak2/engine/collide/collide-shape-rider.gc +++ b/goal_src/jak2/engine/collide/collide-shape-rider.gc @@ -21,7 +21,7 @@ (logtest? (-> s5-0 prim-core action) (collide-action rideable)) (logtest? (-> s4-0 prim-core action) (collide-action can-ride)) ) - (let ((f0-4 (- (- (vector-vector-distance (the-as vector (-> s5-0 prim-core)) (the-as vector (-> s4-0 prim-core))) + (let ((f0-4 (- (- (vector-vector-distance (-> s5-0 prim-core world-sphere) (-> s4-0 prim-core world-sphere)) (-> s5-0 prim-core world-sphere w) ) (-> s4-0 prim-core world-sphere w) @@ -51,7 +51,7 @@ (when (and (logtest? (-> s3-0 prim-core collide-with) s4-0) (logtest? (-> s3-0 prim-core action) (collide-action rideable)) ) - (let ((f0-2 (- (- (vector-vector-distance (the-as vector (-> s3-0 prim-core)) (the-as vector (-> arg0 prim-core))) + (let ((f0-2 (- (- (vector-vector-distance (-> s3-0 prim-core world-sphere) (-> arg0 prim-core world-sphere)) (-> s3-0 prim-core world-sphere w) ) (-> arg0 prim-core world-sphere w) @@ -83,7 +83,7 @@ (when (and (logtest? s4-0 (-> s3-0 prim-core collide-as)) (logtest? (-> s3-0 prim-core action) (collide-action can-ride)) ) - (let ((f0-2 (- (- (vector-vector-distance (the-as vector (-> this prim-core)) (the-as vector (-> s3-0 prim-core))) + (let ((f0-2 (- (- (vector-vector-distance (-> this prim-core world-sphere) (-> s3-0 prim-core world-sphere)) (-> this prim-core world-sphere w) ) (-> s3-0 prim-core world-sphere w) @@ -105,14 +105,9 @@ (let ((v1-13 (populate-for-prim-mesh *collide-mesh-cache* this))) (when v1-13 (let* ((s4-1 (new 'stack-no-clear 'collide-tri-result)) - (f0-4 (sphere-on-platform-test - s3-1 - (the-as collide-mesh-cache-tri (-> v1-13 tris)) - s4-1 - (the-as vector (-> arg0 prim-core)) - (-> arg1 best-dist) - ) - ) + (f0-4 + (sphere-on-platform-test s3-1 (-> v1-13 tris 0) s4-1 (-> arg0 prim-core world-sphere) (-> arg1 best-dist)) + ) ) (when (< f0-4 (-> arg1 best-dist)) (set! (-> arg1 best-dist) f0-4) @@ -193,14 +188,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)) ) ) ) @@ -234,14 +225,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/goal_src/jak2/engine/collide/collide-shape.gc b/goal_src/jak2/engine/collide/collide-shape.gc index f454c0d007..c51b475e64 100644 --- a/goal_src/jak2/engine/collide/collide-shape.gc +++ b/goal_src/jak2/engine/collide/collide-shape.gc @@ -934,103 +934,94 @@ it returns a triangle and normal direction to push in. (defun cshape-reaction-update-state ((arg0 control-info) (arg1 collide-query) (arg2 vector)) "Common update for cshape reaction." - (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)) - - ;; do the move! - (let ((a1-1 (new 'stack-no-clear 'vector))) - (vector-float*! a1-1 (-> arg1 move-dist) (-> arg1 best-dist)) - (move-by-vector! arg0 a1-1) - ) - - ;; do reactions - (react-to-pat! arg0 (-> arg1 best-other-tri pat)) - - ;; direction to the collision point - (vector-! sv-48 (the-as vector (-> arg1 best-my-prim prim-core)) (-> arg1 best-other-tri intersect)) - - ;; compute "coverage". this is a measure of how much the triangle below us "supports" us. - (cond - ((and (= (-> arg1 best-dist) 0.0) ;; can't move - (< (vector-length sv-48) (+ -40.96 (-> arg1 best-my-prim prim-core world-sphere w))) ;; 1m in collision! - ) - - ;; hack: things have gone very wrong. - ;; added print - ;; (format 0 "very far in collision hack running~%") - (set! (-> sv-48 quad) (-> arg1 best-other-tri normal quad)) ;; just use the triangle's normal, things are bad. - (set! (-> arg0 coverage) 0.0) - ) - (else - (set! (-> sv-48 w) 1.0) - (vector-normalize! sv-48 1.0) - ;; dot with normal is the coverage - (set! (-> arg0 coverage) (vector-dot sv-48 (-> arg1 best-other-tri normal))) - ;; hack - (when (< (-> arg0 coverage) 0.0) - ;; no idea how this can happen, but cheat things to project to the plane of the triangle. - (set! (-> arg0 coverage) 0.0) ;; would be 0 - ;; projects to plane - (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)) + ) + ;; do the move! + (let ((a1-1 (new 'stack-no-clear 'vector))) + (vector-float*! a1-1 (-> arg1 move-dist) (-> arg1 best-dist)) + (move-by-vector! arg0 a1-1) + ) + ;; do reactions + (react-to-pat! arg0 (-> arg1 best-other-tri pat)) + ;; direction to the collision point + (vector-! sv-48 (-> arg1 best-my-prim prim-core world-sphere) (-> arg1 best-other-tri intersect)) + ;; compute "coverage". this is a measure of how much the triangle below us "supports" us. + (cond + ((and (= (-> arg1 best-dist) 0.0) ;; can't move + (< (vector-length sv-48) (+ -40.96 (-> arg1 best-my-prim prim-core world-sphere w))) ;; 1m in collision! + ) + ;; hack: things have gone very wrong. + ;; added print + ;; (format 0 "very far in collision hack running~%") + (set! (-> sv-48 quad) (-> arg1 best-other-tri normal quad)) ;; just use the triangle's normal, things are bad. + (set! (-> arg0 coverage) 0.0) + ) + (else + (set! (-> sv-48 w) 1.0) (vector-normalize! sv-48 1.0) + ;; dot with normal is the coverage + (set! (-> arg0 coverage) (vector-dot sv-48 (-> arg1 best-other-tri normal))) + ;; hack + (when (< (-> arg0 coverage) 0.0) + ;; no idea how this can happen, but cheat things to project to the plane of the triangle. + (set! (-> arg0 coverage) 0.0) ;; would be 0 + ;; projects to plane + (vector-flatten! sv-48 sv-48 (-> arg1 best-other-tri normal)) + (vector-normalize! sv-48 1.0) + ) ) ) + ;; ?? + (set! (-> sv-52 quad) (-> sv-48 quad)) + ;; hack: if we can't move, move out, but only a very small amount. + (if (= (-> arg1 best-dist) 0.0) + (move-by-vector! arg0 (vector-normalize-copy! (new-stack-vector0) sv-52 6.0)) + ) + ;; fill out normals/angles + (set! (-> arg0 poly-normal quad) (-> arg1 best-other-tri normal quad)) + (collide-shape-moving-angle-set! arg0 sv-52 arg2) + ;; flags! + (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)))) + ;; if we hit this function, we hit some surface + (logior! sv-56 (collide-status touch-surface)) + ;; if the thing we hit is spheres, it's not water or background. + (if (-> arg1 num-spheres) + (logior! sv-56 (collide-status touch-actor)) + ) + (cond + (sv-96 + ;; on a wall + (logior! sv-56 (collide-status touch-wall)) + (set! (-> arg0 cur-pat mode) 1) + ) + (else + ;; on the ground + (logior! sv-56 (collide-status on-surface)) + (set! (-> arg0 local-normal quad) (-> sv-52 quad)) + ) + ) + (when (and (not sv-96) (>= (-> arg0 coverage) 0.9)) + ;; on the ground, and not slipping off an edge. + (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)) + ) + ) + ) + ;; catch transition to ground. + (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) - ) - ;; hack: if we can't move, move out, but only a very small amount. - (if (= (-> arg1 best-dist) 0.0) - (move-by-vector! arg0 (vector-normalize-copy! (new-stack-vector0) sv-52 6.0)) - ) - - ;; fill out normals/angles - (set! (-> arg0 poly-normal quad) (-> arg1 best-other-tri normal quad)) - (collide-shape-moving-angle-set! arg0 sv-52 arg2) - - ;; flags! - (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))) - - ;; if we hit this function, we hit some surface - (set! sv-56 (logior sv-56 (collide-status touch-surface))) - - ;; if the thing we hit is spheres, it's not water or background. - (if (-> arg1 num-spheres) - (set! sv-56 (logior sv-56 (collide-status touch-actor))) - ) - (cond - (sv-96 - ;; on a wall - (set! sv-56 (logior sv-56 (collide-status touch-wall))) - (set! (-> arg0 cur-pat mode) 1) - ) - (else - ;; on the ground - (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)) - ;; on the ground, and not slipping off an edge. - (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)) - ) - ) - ;; catch transition to ground. - (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) ) @@ -1101,108 +1092,100 @@ it returns a triangle and normal direction to push in. (defmethod step-collison! ((this collide-shape-moving) (arg0 vector) (arg1 vector) (arg2 float) (arg3 int)) "Main function to move forward until we hit a single thing, then react." - (local-vars (sv-592 int)) - (with-pp - (let ((s5-0 (new 'stack 'collide-query)) - (s2-0 (new 'stack-no-clear 'vector)) - ) - ;; figure out how far we want to move - (vector-float*! s2-0 arg1 (* arg2 (seconds-per-frame))) - ;; setup collision query - (set! (-> s5-0 move-dist quad) (-> s2-0 quad)) - (set! (-> s5-0 best-dist) -100000000.0) - (set! (-> s5-0 best-my-prim) #f) - (set! (-> s5-0 num-spheres) (the-as uint #f)) - (let* ((s1-1 (-> this root-prim)) - (v1-5 *collide-cache*) - (s0-0 (the-as collide-cache-prim (-> v1-5 prims))) - ) - (set! sv-592 (-> v1-5 num-prims)) - - ;; collide against everything in the collide cache - (while (nonzero? sv-592) - (set! sv-592 (+ 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) - (collide-with-collide-cache-prim-sphere s1-1 s5-0 s0-0) - ) - ) - (&+! s0-0 48) - ) + (let ((s5-0 (new 'stack 'collide-query)) + (s2-0 (new 'stack-no-clear 'vector)) ) - - ;; see how far we can move - (let ((f30-0 (-> s5-0 best-dist))) - (set! f30-0 (cond - ((>= f30-0 0.0) ;; set a positive value, means we can't move all the way! - - ;; remember velocity before reaction - (let ((s2-1 (new 'stack-no-clear 'vector))) - (if *display-collision-marks* - (set! (-> s2-1 quad) (-> arg1 quad)) + ;; figure out how far we want to move + (vector-float*! s2-0 arg1 (* arg2 (seconds-per-frame))) + ;; setup collision query + (set! (-> s5-0 move-dist quad) (-> s2-0 quad)) + (set! (-> s5-0 best-dist) -100000000.0) + (set! (-> s5-0 best-my-prim) #f) + (set! (-> s5-0 num-spheres) (the-as uint #f)) + (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)) + ) + ;; collide against everything in the collide cache + (while (nonzero? sv-592) + (+! 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) + (collide-with-collide-cache-prim-sphere s1-1 s5-0 s0-0) + ) + ) + (&+! s0-0 48) + ) + ) + ;; see how far we can move + (let ((f30-0 (-> s5-0 best-dist))) + (set! f30-0 (cond + ((>= f30-0 0.0) ;; set a positive value, means we can't move all the way! + ;; remember velocity before reaction + (let ((s2-1 (new 'stack-no-clear 'vector))) + (if *display-collision-marks* + (set! (-> s2-1 quad) (-> arg1 quad)) + ) + ;; handle collision. will move us. + (set! (-> this prev-status) ((-> this reaction) (the-as control-info this) s5-0 arg0 arg1)) + ;; debug draw + (when *display-collision-marks* + (let ((t1-0 (-> *pat-mode-info* (-> s5-0 best-other-tri pat mode) hilite-color))) + (add-debug-outline-triangle + #t + (bucket-id debug-no-zbuf1) + (the-as vector (-> s5-0 best-other-tri)) + (-> s5-0 best-other-tri vertex 1) + (-> s5-0 best-other-tri vertex 2) + t1-0 ) - - ;; handle collision. will move us. - (set! (-> this prev-status) ((-> this reaction) (the-as control-info this) s5-0 arg0 arg1)) - - ;; debug draw - (when *display-collision-marks* - (let ((t1-0 (-> *pat-mode-info* (-> s5-0 best-other-tri pat mode) hilite-color))) - (add-debug-outline-triangle + ) + (add-debug-vector + #t + (bucket-id debug-no-zbuf1) + (-> s5-0 best-other-tri intersect) + s2-1 + (meters 0.00007324219) + (new 'static 'rgba :r #xff :g #xa0 :a #x80) + ) + (add-debug-vector + #t + (bucket-id debug-no-zbuf1) + (-> s5-0 best-other-tri intersect) + arg0 + (meters 0.00007324219) + (new 'static 'rgba :r #xff :g #xff :b #xff :a #x80) + ) + (if (= (-> this process type) target) + (add-debug-vector #t (bucket-id debug-no-zbuf1) - (the-as vector (-> s5-0 best-other-tri)) - (-> s5-0 best-other-tri vertex 1) - (-> s5-0 best-other-tri vertex 2) - t1-0 + (-> s5-0 best-other-tri intersect) + (-> this surface-normal) + (meters 0.5) + (-> *pat-mode-info* (-> this cur-pat mode) hilite-color) ) ) - (add-debug-vector - #t - (bucket-id debug-no-zbuf1) - (-> s5-0 best-other-tri intersect) - s2-1 - (meters 0.00007324219) - (new 'static 'rgba :r #xff :g #xa0 :a #x80) - ) - (add-debug-vector - #t - (bucket-id debug-no-zbuf1) - (-> s5-0 best-other-tri intersect) - arg0 - (meters 0.00007324219) - (new 'static 'rgba :r #xff :g #xff :b #xff :a #x80) - ) - (if (= (-> this process type) target) - (add-debug-vector - #t - (bucket-id debug-no-zbuf1) - (-> s5-0 best-other-tri intersect) - (-> this surface-normal) - (meters 0.5) - (-> *pat-mode-info* (-> this cur-pat mode) hilite-color) - ) - ) - ) ) - ;; return how far we went. - f30-0 ) - (else - ;; didn't collide. call no reaction and clear stuff - (set! (-> this reaction-flag) (cshape-reaction-flags)) - ((-> this no-reaction) this s5-0 arg0 arg1) - (set! (-> this prev-status) (collide-status)) - ;; move all the way - (move-by-vector! this s2-0) - (set! (-> arg0 quad) (-> arg1 quad)) - 1.0 ;; return 1 to indicate that we did the whole thing. - ) + ;; return how far we went. + f30-0 + ) + (else + ;; didn't collide. call no reaction and clear stuff + (set! (-> this reaction-flag) (cshape-reaction-flags)) + ((-> this no-reaction) this s5-0 arg0 arg1) + (set! (-> this prev-status) (collide-status)) + ;; move all the way + (move-by-vector! this s2-0) + (set! (-> arg0 quad) (-> arg1 quad)) + 1.0 ;; return 1 to indicate that we did the whole thing. ) - ) - f30-0 - ) + ) + ) + f30-0 ) ) ) @@ -1870,51 +1853,50 @@ it returns a triangle and normal direction to push in. ) (defmethod move-to-ground ((this collide-shape-moving) (arg0 float) (arg1 float) (arg2 symbol) (arg3 collide-spec)) - "Find the ground a move to it." - (local-vars (sv-576 profile-segment) (sv-592 int)) + "Find the ground and move to it." (with-profiler 'collide *profile-collide-color* (let ((s1-1 (new 'stack-no-clear 'collide-query))) (cond ((find-ground this s1-1 arg3 arg0 arg1 1024.0) - (let ((a1-4 (new 'stack-no-clear 'vector))) - (set! (-> a1-4 quad) (-> this trans quad)) - (set! (-> a1-4 y) (-> s1-1 best-other-tri intersect y)) - (move-to-point! this a1-4) - ) - (let ((a1-5 (-> s1-1 best-other-tri intersect)) - (a0-19 (-> s1-1 best-other-tri normal)) - (v1-25 (-> s1-1 best-other-tri pat)) - ) - (set! (-> this grount-touch-point quad) (-> a1-5 quad)) - (set! (-> this poly-normal quad) (-> a0-19 quad)) - (set! (-> this surface-normal quad) (-> a0-19 quad)) - (set! (-> this local-normal quad) (-> a0-19 quad)) - (set! (-> this ground-poly-normal quad) (-> a0-19 quad)) - (set! (-> this poly-pat) v1-25) - (set! (-> this cur-pat) v1-25) - (set! (-> this ground-pat) v1-25) - ) - (logior! (-> this status) (collide-status on-surface on-ground touch-surface)) - #t - ) + (let ((a1-4 (new 'stack-no-clear 'vector))) + (set! (-> a1-4 quad) (-> this trans quad)) + (set! (-> a1-4 y) (-> s1-1 best-other-tri intersect y)) + (move-to-point! this a1-4) + ) + (let ((a1-5 (-> s1-1 best-other-tri intersect)) + (a0-19 (-> s1-1 best-other-tri normal)) + (v1-25 (-> s1-1 best-other-tri pat)) + ) + (set! (-> this grount-touch-point quad) (-> a1-5 quad)) + (set! (-> this poly-normal quad) (-> a0-19 quad)) + (set! (-> this surface-normal quad) (-> a0-19 quad)) + (set! (-> this local-normal quad) (-> a0-19 quad)) + (set! (-> this ground-poly-normal quad) (-> a0-19 quad)) + (set! (-> this poly-pat) v1-25) + (set! (-> this cur-pat) v1-25) + (set! (-> this ground-pat) v1-25) + ) + (logior! (-> this status) (collide-status on-surface on-ground touch-surface)) + #t + ) (else (logclear! (-> this status) (collide-status - on-surface - on-ground - touch-surface - touch-wall - touch-ceiling - touch-actor - on-special-surface - touch-edge - blocked - on-water - impact-surface - touch-background - stuck - glance - ) - ) + on-surface + on-ground + touch-surface + touch-wall + touch-ceiling + touch-actor + on-special-surface + touch-edge + blocked + on-water + impact-surface + touch-background + stuck + glance + ) + ) (when (not (logtest? (-> this root-prim prim-core action) (collide-action no-normal-reset))) (let ((v1-36 (-> this dynam gravity-normal))) (set! (-> this local-normal quad) (-> v1-36 quad)) @@ -2474,6 +2456,7 @@ it returns a triangle and normal direction to push in. (defmethod do-push-aways ((this collide-shape)) "Push away things." + ;; og:preserve-this float -> int (local-vars (at-0 int) (v1-55 int) (a2-5 float) (a2-12 float)) (with-pp (rlet ((vf0 :class vf) @@ -2518,14 +2501,10 @@ it returns a triangle and normal direction to push in. (.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)) ) ) ) @@ -2561,14 +2540,10 @@ it returns a triangle and normal direction to push in. (.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)) ) ) ) @@ -2706,11 +2681,7 @@ it returns a triangle and normal direction to push in. (.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) @@ -2747,11 +2718,7 @@ it returns a triangle and normal direction to push in. (.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) @@ -3065,7 +3032,6 @@ it returns a triangle and normal direction to push in. ) (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) @@ -3073,51 +3039,48 @@ it returns a triangle and normal direction to push in. ) (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/goal_src/jak2/engine/collide/find-nearest.gc b/goal_src/jak2/engine/collide/find-nearest.gc index d9863cf72c..59a6f714da 100644 --- a/goal_src/jak2/engine/collide/find-nearest.gc +++ b/goal_src/jak2/engine/collide/find-nearest.gc @@ -52,33 +52,19 @@ (when (and (logtest? (process-mask crate enemy collectable guard) (-> arg0 mask)) (not (logtest? (process-mask no-track) (-> arg0 mask))) ) - (let* ((gp-0 *search-info*) - (s4-0 arg0) - (s5-0 (if (type? s4-0 process-drawable) - s4-0 - ) - ) - ) + (let ((gp-0 *search-info*) + (s5-0 (as-type arg0 process-drawable)) + ) (when s5-0 - (let* ((s4-1 (-> s5-0 root)) - (s3-0 (if (type? s4-1 collide-shape) - s4-1 - ) - ) - ) + (let ((s3-0 (the-as trsqv (as-type (-> s5-0 root) collide-shape)))) (when s3-0 (let* ((s4-2 (the-as structure (-> (the-as collide-shape s3-0) root-prim prim-core))) - (f30-0 (- (vector-vector-distance (-> gp-0 point) (the-as vector s4-2)) + (f30-0 (- (vector-vector-distance (-> gp-0 point) (-> (the-as collide-prim-core s4-2) world-sphere)) (-> (the-as collide-prim-core s4-2) world-sphere w) ) ) ) - (let* ((s1-0 s5-0) - (s2-0 (if (type? s1-0 process-focusable) - s1-0 - ) - ) - ) + (let ((s2-0 (the-as process-drawable (as-type s5-0 process-focusable)))) (if (and (type? s2-0 process-focusable) s2-0 s2-0 @@ -215,12 +201,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) @@ -250,11 +230,7 @@ (while (begin (label cfg-89) (nonzero? s4-0)) (+! s4-0 -1) (let* ((s1-0 (-> arg0 s4-0)) - (s2-0 (-> s1-0 process)) - (s3-0 (if (type? s2-0 process-focusable) - s2-0 - ) - ) + (s3-0 (the-as process-drawable (as-type (-> s1-0 process) process-focusable))) ) (when (and (and s3-0 (not (logtest? (-> (the-as process-focusable s3-0) focus-status) (focus-status disable dead)))) (and (logtest? (process-mask crate enemy collectable guard) (-> s3-0 mask)) @@ -270,11 +246,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))) @@ -308,15 +280,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/goal_src/jak2/engine/common_objs/basebutton.gc b/goal_src/jak2/engine/common_objs/basebutton.gc index 2024104168..a0436fe9bc 100644 --- a/goal_src/jak2/engine/common_objs/basebutton.gc +++ b/goal_src/jak2/engine/common_objs/basebutton.gc @@ -268,9 +268,9 @@ (defmethod send-event! ((this basebutton) (event-type symbol)) "Prepares an [[event-message-block]] using the provided type to send an event to: -- the `notify-actor` -- every [[entity-actor]] in the `actor-group` array -@see [[entity-actor]]" + - the `notify-actor` + - every [[entity-actor]] in the `actor-group` array + @see [[entity-actor]]" (when event-type (let ((event (new 'stack-no-clear 'event-message-block))) (set! (-> event from) (process->ppointer self)) @@ -394,12 +394,11 @@ ;; WARN: Return type mismatch object vs none. (defmethod init-from-entity! ((this basebutton) (arg0 entity-actor)) "Typically the method that does the initial setup on the process, potentially using the [[entity-actor]] provided as part of that. -This commonly includes things such as: -- stack size -- collision information -- loading the skeleton group / bones -- sounds" - (local-vars (sv-16 res-tag)) + This commonly includes things such as: + - stack size + - collision information + - loading the skeleton group / bones + - sounds" (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))) @@ -414,8 +413,9 @@ This commonly includes things such as: (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/goal_src/jak2/engine/common_objs/blocking-plane.gc b/goal_src/jak2/engine/common_objs/blocking-plane.gc index c010c0f01f..e52798ef9f 100644 --- a/goal_src/jak2/engine/common_objs/blocking-plane.gc +++ b/goal_src/jak2/engine/common_objs/blocking-plane.gc @@ -113,25 +113,21 @@ (vector+! (-> s2-1 trans) s3-0 s4-0) (vector-float*! (-> s2-1 trans) (-> s2-1 trans) 0.5) (+! (-> s2-1 trans y) (/ height 2)) - (vector-! (the-as vector (-> s1-0 vector)) s4-0 s3-0) - (let ((f30-1 (vector-normalize-ret-len! (the-as vector (-> s1-0 vector)) 1.0))) + (vector-! (-> s1-0 vector 0) s4-0 s3-0) + (let ((f30-1 (vector-normalize-ret-len! (-> s1-0 vector 0) 1.0))) (set! (-> s2-1 scale x) (/ f30-1 METER_LENGTH)) (set! (-> s2-1 scale y) (/ height METER_LENGTH)) (set! (-> s2-1 scale z) 0.0) (set! (-> s1-0 vector 1 quad) (-> (new 'static 'vector :y 1.0 :w 1.0) quad)) - (vector-cross! (-> s1-0 vector 2) (the-as vector (-> s1-0 vector)) (-> s1-0 vector 1)) + (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/goal_src/jak2/engine/common_objs/conveyor.gc b/goal_src/jak2/engine/common_objs/conveyor.gc index 35c947e00f..6fef041336 100644 --- a/goal_src/jak2/engine/common_objs/conveyor.gc +++ b/goal_src/jak2/engine/common_objs/conveyor.gc @@ -70,19 +70,18 @@ (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 @@ -92,7 +91,7 @@ ;; WARN: Return type mismatch object vs ambient-sound. (defmethod set-and-get-ambient-sound! ((this conveyor)) "So long as [[actor-option::16]] is not set, fetch the [[ambient-sound]] for the [[conveyor]] -and return it as well. Otherwise, set it to `0`" + and return it as well. Otherwise, set it to `0`" (let ((actor-options (res-lump-value (-> this entity) 'options actor-option :time -1000000000.0))) (the-as ambient-sound @@ -195,11 +194,7 @@ and return it as well. Otherwise, set it to `0`" (.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)) @@ -236,11 +231,7 @@ and return it as well. Otherwise, set it to `0`" (.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)) @@ -276,11 +267,7 @@ and return it as well. Otherwise, set it to `0`" (.mov a0-10 vf3) (let ((s4-0 (-> v1-23 process))) (b! (< f0-2 a0-10) cfg-27) - (let ((a1-29 (if (type? s4-0 process-focusable) - (the-as process-focusable s4-0) - ) - ) - ) + (let ((a1-29 (as-type s4-0 process-focusable))) (if a1-29 (conveyor-method-26 this a1-29) ) @@ -298,7 +285,6 @@ and return it as well. Otherwise, set it to `0`" (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)) @@ -308,26 +294,28 @@ and return it as well. Otherwise, set it to `0`" (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 ) ) @@ -336,7 +324,7 @@ and return it as well. Otherwise, set it to `0`" (set! (-> this leading quad) (-> s2-1 0 pull-dir quad)) (set! (-> this leading y) 0.0) (vector-normalize! (-> this leading) 1.0) - (set! (-> this leading w) (- (vector-dot (the-as vector (-> s2-1 0)) (the-as vector (-> this leading))))) + (set! (-> this leading w) (- (vector-dot (-> s2-1 0 start) (the-as vector (-> this leading))))) ) (let ((f0-19 (/ 1.0 (the float s4-0))) (f30-0 0.0) @@ -369,11 +357,11 @@ and return it as well. Otherwise, set it to `0`" ;; WARN: Return type mismatch object vs none. (defmethod init-from-entity! ((this conveyor) (arg0 entity-actor)) "Typically the method that does the initial setup on the process, potentially using the [[entity-actor]] provided as part of that. -This commonly includes things such as: -- stack size -- collision information -- loading the skeleton group / bones -- sounds" + This commonly includes things such as: + - stack size + - collision information + - loading the skeleton group / bones + - sounds" (reset-root! this) (process-drawable-from-entity! this arg0) (initialize-skeleton this (the-as skeleton-group (get-art-group this)) (the-as pair 0)) diff --git a/goal_src/jak2/engine/common_objs/dark-eco-pool.gc b/goal_src/jak2/engine/common_objs/dark-eco-pool.gc index 5f099e83f1..074b82d48b 100644 --- a/goal_src/jak2/engine/common_objs/dark-eco-pool.gc +++ b/goal_src/jak2/engine/common_objs/dark-eco-pool.gc @@ -296,8 +296,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/goal_src/jak2/engine/common_objs/elevator.gc b/goal_src/jak2/engine/common_objs/elevator.gc index 623d65bd90..da09f635b6 100644 --- a/goal_src/jak2/engine/common_objs/elevator.gc +++ b/goal_src/jak2/engine/common_objs/elevator.gc @@ -115,10 +115,10 @@ (defmethod move-between-points ((this elevator) (arg0 vector) (arg1 float) (arg2 float)) "Move between two points on the elevator's path -@param vec TODO not sure -@param point-a The first point fetched from the elevator's path -@param point-b The second point fetched from the path -@see [[path-control]] and [[elevator]]" + @param vec TODO not sure + @param point-a The first point fetched from the elevator's path + @param point-b The second point fetched from the path + @see [[path-control]] and [[elevator]]" #f ) @@ -146,7 +146,7 @@ (when (< 0.0 f0-5) (vector-float*! (-> s5-0 move-dist) (-> s5-0 move-dist) f0-5) (vector+! (-> s5-0 move-dist) (-> s5-0 move-dist) (-> s5-0 start-pos)) - (vector-! (-> s5-0 move-dist) (-> s5-0 move-dist) (the-as vector (-> s4-0 prim-core))) + (vector-! (-> s5-0 move-dist) (-> s5-0 move-dist) (-> s4-0 prim-core world-sphere)) (move-by-vector! (-> target control) (-> s5-0 move-dist)) ) ) @@ -158,11 +158,11 @@ (defmethod init-defaults! ((this elevator)) "Initializes default settings related to the [[elevator]]: -- `elevator-xz-threshold` -- `elevator-y-threshold` -- `elevator-start-pos` -- `elevator-move-rate` -- `elevator-flags`" + - `elevator-xz-threshold` + - `elevator-y-threshold` + - `elevator-start-pos` + - `elevator-move-rate` + - `elevator-flags`" (let ((entity (-> this entity))) (set! (-> this params xz-threshold) ((method-of-object entity get-property-value-float) entity @@ -226,12 +226,12 @@ (defun ease-value-in-out ((value float) (step-amount float)) "TODO - the math in this function is full of duplication and isn't totally clear -but if the name is to be believed, it's to slow a values grow at the beginning and end of it's range -which is obviously useful for an elevator." + but if the name is to be believed, it's to slow a values grow at the beginning and end of it's range + which is obviously useful for an elevator." (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)) ) @@ -243,9 +243,7 @@ which is obviously useful for an elevator." (+ (* 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 @@ -283,12 +281,7 @@ which is obviously useful for an elevator." (set! (-> self move-pos 0) (-> self move-pos 1)) (cond ((not (logtest? (-> event param 0) 7)) - (let ((gp-0 (the-as number (-> event param 0)))) - (set! (-> self move-pos 1) (if (type? (the-as uint gp-0) float) - (the-as float gp-0) - ) - ) - ) + (set! (-> self move-pos 1) (as-type (-> event param 0) float)) ) (else (case (-> event param 0) @@ -307,12 +300,7 @@ which is obviously useful for an elevator." (('jump-to) (cond ((not (logtest? (-> event param 0) 7)) - (let ((gp-1 (the-as number (-> event param 0)))) - (set! (-> self move-pos 1) (if (type? (the-as uint gp-1) float) - (the-as float gp-1) - ) - ) - ) + (set! (-> self move-pos 1) (as-type (-> event param 0) float)) ) (else (case (-> event param 0) @@ -392,36 +380,34 @@ which is obviously useful for an elevator." (defmethod find-closest-point-in-path! ((this elevator) (arg0 vector) (arg1 (pointer float)) (arg2 symbol) (arg3 symbol)) "Finds and sets the provided [[path-step]]'s `next-pos` field to the vertex index in the path which is closest to -the provided [[vector]] + the provided [[vector]] -@param vec The point at which distance calculations are based off -@param! next-step If a point is found, `next-pos` will be set to the correct point -@param arg2 TODO -@param arg3 TODO -@returns [[#t]] if a point in the path was found" - (local-vars (path-point vector)) + @param vec The point at which distance calculations are based off + @param! next-step If a point is found, `next-pos` will be set to the correct point + @param arg2 TODO + @param arg3 TODO + @returns [[#t]] if a point in the path was found" (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)) + ) ) ) ) @@ -435,12 +421,7 @@ the provided [[vector]] ;; WARN: Return type mismatch object vs symbol. (defmethod elevator-method-44 ((this elevator)) - (let* ((target-temp *target*) - (target (if (type? target-temp process-focusable) - target-temp - ) - ) - ) + (let ((target (the-as target (as-type *target* process-focusable)))) (the-as symbol (and target (move-between-points this (get-trans target 0) (-> this move-pos 0) (-> this move-pos 1))) @@ -455,9 +436,8 @@ the provided [[vector]] (defmethod move-to-next-point! ((this elevator)) "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)) + do so. + @see [[elevator::47]]" (let ((target *target*)) (when (and target (not (logtest? (focus-status dead inactive in-air grabbed edge-grab pole pilot-riding pilot teleporting) @@ -465,12 +445,13 @@ do so. ) ) ) - (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)) + ) ) ) ) @@ -723,8 +704,8 @@ do so. (defmethod calc-dist-between-points! ((this elevator) (path-point-x int) (path-point-y int)) "Calculates the distance between two points in the elevator's path. -@param path-point-x The index of the first point in the distance calculation, and where `next-pos` and `dist` are stored in the `path-seq` array -@param path-point-y The second point in the distance calculation" + @param path-point-x The index of the first point in the distance calculation, and where `next-pos` and `dist` are stored in the `path-seq` array + @param path-point-y The second point in the distance calculation" (set! (-> this path-seq data path-point-x next-pos) (the float path-point-y)) (let ((point-x (get-point-in-path! (-> this path) (new 'stack-no-clear 'vector) (the float path-point-x) 'interp)) (point-y (get-point-in-path! (-> this path) (new 'stack-no-clear 'vector) (the float path-point-y) 'interp)) @@ -744,16 +725,16 @@ do so. (defmethod init-plat! ((this elevator)) "Does any necessary initial platform setup. -For example for an elevator pre-compute the distance between the first and last points (both ways) and clear the sound." + For example for an elevator pre-compute the distance between the first and last points (both ways) and clear the sound." 0 (none) ) -(defmethod relocate ((this elevator) (arg0 int)) +(defmethod relocate ((this elevator) (offset int)) (if (nonzero? (-> this path-seq)) - (&+! (-> this path-seq) arg0) + (&+! (-> this path-seq) offset) ) - (call-parent-method this arg0) + (call-parent-method this offset) ) (defmethod activate-elevator ((this elevator)) @@ -767,12 +748,11 @@ For example for an elevator pre-compute the distance between the first and last ;; WARN: Return type mismatch object vs none. (defmethod init-from-entity! ((this elevator) (entity entity-actor)) "Typically the method that does the initial setup on the process, potentially using the [[entity-actor]] provided as part of that. -This commonly includes things such as: -- stack size -- collision information -- loading the skeleton group / bones -- sounds" - (local-vars (sv-32 float) (sv-36 path-control) (sv-40 target)) + This commonly includes things such as: + - stack size + - collision information + - loading the skeleton group / bones + - sounds" (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)) @@ -810,24 +790,22 @@ This commonly includes things such as: ) ) ) - (set! sv-32 (the-as float 0.0)) - (set! sv-36 (-> this path)) - (let ((s5-2 *target*)) - (set! sv-40 (if (type? s5-2 process-focusable) - s5-2 + (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)) ) - ) - (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/goal_src/jak2/engine/common_objs/generic-obs.gc b/goal_src/jak2/engine/common_objs/generic-obs.gc index d232285e44..fa4d8658ae 100644 --- a/goal_src/jak2/engine/common_objs/generic-obs.gc +++ b/goal_src/jak2/engine/common_objs/generic-obs.gc @@ -55,10 +55,10 @@ ;; 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)) ) @@ -1762,7 +1762,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)) @@ -1776,44 +1775,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/goal_src/jak2/engine/common_objs/water-anim.gc b/goal_src/jak2/engine/common_objs/water-anim.gc index 23db141d42..b17b430d8e 100644 --- a/goal_src/jak2/engine/common_objs/water-anim.gc +++ b/goal_src/jak2/engine/common_objs/water-anim.gc @@ -39,11 +39,11 @@ ) -(defmethod relocate ((this water-anim) (arg0 int)) +(defmethod relocate ((this water-anim) (offset int)) (if (nonzero? (-> this flow)) - (&+! (-> this flow) arg0) + (&+! (-> this flow) offset) ) - (call-parent-method this arg0) + (call-parent-method this offset) ) (defskelgroup skel-water-anim-nest-dark-eco-largepool water-anim-nest-dark-eco water-anim-nest-dark-eco-largepool-lod0-jg -1 @@ -326,13 +326,9 @@ v0-1 ) (('water) - (let* ((s5-0 (the-as object (-> arg3 param 0))) - (s4-0 (the-as object (-> arg3 param 1))) - (gp-0 (if (type? (the-as process s4-0) process-focusable) - (the-as uint s4-0) - ) - ) - ) + (let ((s5-0 (the-as object (-> arg3 param 0))) + (gp-0 (the-as object (as-type (-> arg3 param 1) process-focusable))) + ) (when (and (logtest? (-> self flags) (water-flags deadly)) (logtest? (water-flags touch-water) (-> (the-as water-info s5-0) flags)) (the-as uint gp-0) @@ -453,14 +449,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)) @@ -517,7 +513,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 @@ -541,19 +536,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)) @@ -600,11 +595,11 @@ ;; WARN: Return type mismatch object vs none. (defmethod init-from-entity! ((this water-anim) (arg0 entity-actor)) "Typically the method that does the initial setup on the process, potentially using the [[entity-actor]] provided as part of that. -This commonly includes things such as: -- stack size -- collision information -- loading the skeleton group / bones -- sounds" + This commonly includes things such as: + - stack size + - collision information + - loading the skeleton group / bones + - sounds" (water-anim-method-27 this) (reset-root! this) (water-anim-init! this) diff --git a/goal_src/jak2/engine/common_objs/water-flow.gc b/goal_src/jak2/engine/common_objs/water-flow.gc index 03fce89283..54b8f4204e 100644 --- a/goal_src/jak2/engine/common_objs/water-flow.gc +++ b/goal_src/jak2/engine/common_objs/water-flow.gc @@ -52,14 +52,14 @@ ) -(defmethod relocate ((this flow-control) (arg0 int)) +(defmethod relocate ((this flow-control) (offset int)) (if (nonzero? (-> this sections)) - (&+! (-> this sections) arg0) + (&+! (-> this sections) offset) ) (if (nonzero? (-> this path)) - (&+! (-> this path) arg0) + (&+! (-> this path) offset) ) - (call-parent-method this arg0) + (call-parent-method this offset) ) (defmethod draw-path ((this flow-control)) @@ -197,14 +197,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)) ) ) ) @@ -242,11 +238,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) @@ -284,11 +276,7 @@ (.mov a0-10 vf3) (let ((s4-0 (-> v1-23 process))) (b! (< f0-2 a0-10) cfg-27) - (let ((a1-29 (if (type? s4-0 process-focusable) - s4-0 - ) - ) - ) + (let ((a1-29 (the-as process-drawable (as-type s4-0 process-focusable)))) (if a1-29 (push-process this (the-as process-focusable a1-29)) ) @@ -309,7 +297,6 @@ ) (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)) @@ -319,30 +306,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 ) ) @@ -351,7 +340,7 @@ (set! (-> this leading quad) (-> s2-1 0 pull-dir quad)) (set! (-> this leading y) 0.0) (vector-normalize! (-> this leading) 1.0) - (set! (-> this leading w) (- (vector-dot (the-as vector (-> s2-1 0)) (the-as vector (-> this leading))))) + (set! (-> this leading w) (- (vector-dot (-> s2-1 0 start) (the-as vector (-> this leading))))) ) (let ((f0-19 (/ 1.0 (the float s4-0))) (f30-0 0.0) diff --git a/goal_src/jak2/engine/common_objs/water.gc b/goal_src/jak2/engine/common_objs/water.gc index 1b682c71b4..6f5ba3a2b1 100644 --- a/goal_src/jak2/engine/common_objs/water.gc +++ b/goal_src/jak2/engine/common_objs/water.gc @@ -654,11 +654,6 @@ ) (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)) @@ -760,37 +755,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) @@ -1484,7 +1460,6 @@ (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)) @@ -1500,22 +1475,22 @@ (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) - ;; og:preserve-this scratchpad - (collect-regions - a0-10 - (the-as sphere (-> (scratchpad-object region-prim-area) pos)) - 0 - (-> (scratchpad-object region-prim-area) 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) + ;; og:preserve-this scratchpad + (collect-regions + a0-10 + (the-as sphere (-> (scratchpad-object region-prim-area) pos)) + 0 + (-> (scratchpad-object region-prim-area) 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/goal_src/jak2/engine/debug/debug-sphere.gc b/goal_src/jak2/engine/debug/debug-sphere.gc index a21cdccaaf..f095a9d912 100644 --- a/goal_src/jak2/engine/debug/debug-sphere.gc +++ b/goal_src/jak2/engine/debug/debug-sphere.gc @@ -16,7 +16,6 @@ Do not call these functions unless *debug-segment* is set. "Fills points with positions that make a wireframe sphere made of the given number of horizontal and vertical lines. The points array is expected to have a capacity of at least (h-lines * v-lines * 3). Both h-lines and v-lines should be whole numbers." - (local-vars (next-hz vector) (next-vt vector) (h-line int)) (let ((offset (new-stack-vector0)) (scale 1.0) (num-points 0) @@ -26,27 +25,29 @@ Do not call these functions unless *debug-segment* is set. (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) + ) + ) ) ) ) @@ -68,7 +69,6 @@ Do not call these functions unless *debug-segment* is set. "Adds a debug sphere to a bucket. The table-idx specifies the resolution of the sphere and must be >= 0 and <= 9, where 9 would specify the highest resolution available and 0 would draw nothing." - (local-vars (sphere-points vector-array) (point-3 vector)) (rlet ((vf1 :class vf) (vf2 :class vf) (vf3 :class vf) @@ -83,12 +83,12 @@ Do not call these functions unless *debug-segment* is set. ) ) ) - (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)) @@ -109,6 +109,7 @@ Do not call these functions unless *debug-segment* is set. (add-debug-line #t bucket point-1 point-3 color #f (the-as rgba -1)) ) ) + 0 + (none) ) - (none) ) diff --git a/goal_src/jak2/engine/debug/default-menu.gc b/goal_src/jak2/engine/debug/default-menu.gc index be9a791186..194b9f5a8e 100644 --- a/goal_src/jak2/engine/debug/default-menu.gc +++ b/goal_src/jak2/engine/debug/default-menu.gc @@ -1145,6 +1145,7 @@ (let ((s3-0 (-> (the-as drawable-tree-instance-shrub v1-7) info prototype-inline-array-shrub))) (dotimes (s2-0 (-> s3-0 length)) (let ((a1-4 + ;; og:preserve-this allocate on debug heap (new 'debug 'debug-menu-item-flag (-> s3-0 data s2-0 name) (-> s3-0 data s2-0 name) dm-instance-pick-func) ) ) @@ -2666,20 +2667,6 @@ ) (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 '()) ) @@ -2691,34 +2678,21 @@ (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 'debug) - (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 'debug) - (set! sv-48 pair) - (set! sv-64 'flag) - (set! sv-80 (method-of-type pair new)) - (set! sv-96 'debug) - (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 'debug) - (set! sv-176 pair) - (set! sv-192 (-> (the-as continue-point v1-2) name)) - (let* ((a3-1 (dcons '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)) - ) + ;; og:preserve-this cons -> dcons + (set! s5-0 (dcons + (dcons 'flag (dcons + (-> (the-as continue-point v1-2) name) + (dcons (-> (the-as continue-point v1-2) name) (dcons 'dm-current-continue '())) + ) + ) + s5-0 + ) + ) ) - ) ) (set! s3-0 (cdr s3-0)) ) @@ -2730,11 +2704,13 @@ (let ((a3-5 '())) (let ((a2-6 (car s5-0))) (while (not (null? s5-0)) + ;; og:preserve-this cons -> dcons (set! a3-5 (dcons a2-6 a3-5)) (set! s5-0 (cdr s5-0)) (set! a2-6 (car s5-0)) ) ) + ;; og:preserve-this cons -> dcons (dcons 'menu (dcons (symbol->string arg1) a3-5)) ) ) @@ -2742,60 +2718,27 @@ (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 'debug) - (s0-0 pair) - ) - (set! sv-16 (method-of-type pair new)) - (set! sv-32 'debug) - (set! sv-48 pair) - (set! sv-64 'flag) - (set! sv-80 (method-of-type pair new)) - (set! sv-96 'debug) - (set! sv-112 pair) - (set! sv-128 (-> v1-4 name)) - (set! sv-144 (method-of-type pair new)) - (set! sv-160 'debug) - (set! sv-176 pair) - (set! sv-192 (* s3-0 8)) - (let* ((a3-1 (dcons '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 + ;; og:preserve-this cons -> dcons + (dcons (dcons 'flag (dcons (-> v1-4 name) (dcons (* s3-0 8) (dcons 'dm-task-menu-pick-func '())))) gp-0) + ) ) - ) ) ) ) ) + ;; og:preserve-this cons -> dcons (dcons 'menu (dcons (symbol->string arg0) gp-0)) ) ) (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)) ) @@ -2824,14 +2767,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)) @@ -2936,51 +2874,16 @@ ) (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)) - ;; og:preserve-this allocate on debug heap - (s2-0 'debug) - (s1-0 pair) - (s0-0 (method-of-type pair new)) - ) - (set! sv-16 'debug) - (set! sv-32 pair) - (set! sv-48 'function) - (set! sv-64 (method-of-type pair new)) - (set! sv-80 'debug) - (set! sv-96 pair) - (set! sv-112 (-> v1-4 name)) - (set! sv-128 (method-of-type pair new)) - (set! sv-144 'debug) - (set! sv-160 pair) - (set! sv-176 (* s4-0 8)) - (let* ((a3-1 (dcons '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) + ;; og:preserve-this cons -> dcons + (set! gp-0 (dcons (dcons 'function (dcons (-> v1-4 name) (dcons (* s4-0 8) (dcons 'dm-play-task '())))) gp-0)) ) - ) ) ) - ;; og:preserve-this + ;; og:preserve-this cons -> dcons (debug-menu-make-from-template arg0 (dcons 'menu (dcons "Play" gp-0))) ) ) @@ -3055,6 +2958,7 @@ #f ) +;; og:preserve-this added (defun dm-game-opengoal-cheat-toggle-pick-func ((arg0 int) (arg1 debug-menu-msg)) (if (= arg1 (debug-menu-msg press)) (logxor! (-> *pc-settings* cheats) (the-as uint (/ arg0 8))) @@ -3542,14 +3446,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)) @@ -3569,6 +3468,7 @@ (flag "Blerc" *stats-blerc* dm-boolean-toggle-pick-func) (flag "Profile bars" *stats-profile-bars* dm-boolean-toggle-pick-func) (flag "Perf" *stats-perf* dm-boolean-toggle-pick-func) + ;; og:preserve-this (flag "Joint" *stats-joint* dm-boolean-toggle-pick-func) (menu "Memory Stats" @@ -4092,6 +3992,7 @@ ) (menu "Gun" + ;; og:preserve-this (flag "yellow" (the binteger (game-feature gun-yellow)) dm-game-feature-toggle-pick-func) (flag "red" (the binteger (game-feature gun-red)) dm-game-feature-toggle-pick-func) (flag "blue" (the binteger (game-feature gun-blue)) dm-game-feature-toggle-pick-func) diff --git a/goal_src/jak2/engine/debug/history.gc b/goal_src/jak2/engine/debug/history.gc index 875f82a46f..ddfe8e0bc9 100644 --- a/goal_src/jak2/engine/debug/history.gc +++ b/goal_src/jak2/engine/debug/history.gc @@ -154,9 +154,9 @@ (defmethod clear-history-entries! ((this history)) "Iterates through each [[history-elt]] in the `elt` dynamic array -For each entry: -- clear `timestamp` -- clear `record-tag`" + For each entry: + - clear `timestamp` + - clear `record-tag`" (set! (-> this alloc-index) 0) (countdown (v1-0 (-> this allocated-length)) (let ((a1-3 (-> this elts v1-0))) @@ -176,10 +176,10 @@ For each entry: ;; WARN: new jak 2 until loop case, check carefully (defmethod clear-record-tags! ((this history) (arg0 history-channel) (arg1 uint) (arg2 uint)) "First grab the latest [[history-elt]] at `alloc-index` -1. update it's `channel`, `record-id` and `owner` from the provided args -2. - if it's `record-tag` is zero -- return it -- otherwise, iterate through all `elts` until one is found that does not match it's `timestamp` -- if not `0` out the `record-tag` for that elt and continue iteration" + 1. update it's `channel`, `record-id` and `owner` from the provided args + 2. - if it's `record-tag` is zero -- return it + - otherwise, iterate through all `elts` until one is found that does not match it's `timestamp` + - if not `0` out the `record-tag` for that elt and continue iteration" (let* ((t1-0 (-> this alloc-index)) (v1-0 (-> this elts)) (v0-0 (-> v1-0 t1-0)) @@ -228,9 +228,9 @@ For each entry: (defmethod update-entries! ((this history-iterator)) "Iterate through each [[history-elt]] in [[*history*]] -- If we hit the end set `done?` to true -- If the `timestamp` on the elt, minus the current framecounter exceeds `max-age`, we are also done, return #f -- However if we find an elt who's `owner` matches the iterator's, break out early returning that `elt`" + - If we hit the end set `done?` to true + - If the `timestamp` on the elt, minus the current framecounter exceeds `max-age`, we are also done, return #f + - However if we find an elt who's `owner` matches the iterator's, break out early returning that `elt`" (let ((v1-0 *history*) (a1-2 (-> *display* base-clock frame-counter)) ) @@ -276,150 +276,143 @@ For each entry: ;; 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) - ) - ) + ) + ) + ) ) ) ) @@ -432,113 +425,114 @@ For each entry: ;; 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/goal_src/jak2/engine/debug/memory-usage.gc b/goal_src/jak2/engine/debug/memory-usage.gc index 3b3cf5b239..b105c75eb8 100644 --- a/goal_src/jak2/engine/debug/memory-usage.gc +++ b/goal_src/jak2/engine/debug/memory-usage.gc @@ -39,7 +39,7 @@ obj ) -(defmethod mem-usage ((this object) (arg0 memory-usage-block) (arg1 int)) +(defmethod mem-usage ((this object) (usage memory-usage-block) (flags int)) this ) @@ -66,9 +66,9 @@ (defun mem-size ((data basic) (inspect-usage? symbol) (arg2 int)) "@param data The [[basic]] to call `mem-usage` on -@param inspect-usage? Set to [[#t]] if `inspect` should be called on the resulting [[memory-usage-block]] -@param arg2 TODO - unsure, some sort of bitfield -@returns The total memory footprint of the provided [[basic]]" + @param inspect-usage? Set to [[#t]] if `inspect` should be called on the resulting [[memory-usage-block]] + @param arg2 TODO - unsure, some sort of bitfield + @returns The total memory footprint of the provided [[basic]]" (let ((block (new 'stack 'memory-usage-block))) (mem-usage data block arg2) (if inspect-usage? @@ -80,11 +80,11 @@ (defmethod compute-memory-usage! ((this level) (force? symbol)) "Calculates the memory usage of the level, returns and stores the [[memory-usage-block]] -in `mem-usage-block` as well as the total size in `mem-usage` + in `mem-usage-block` as well as the total size in `mem-usage` -@param force? - Will re-compute the usage if set to [[#t]], even if `mem-usage` has been set to a non-zero value -@returns The [[memory-usage-block]] representing the footprint of the level -@see [[memory-usage-block::10]]" + @param force? - Will re-compute the usage if set to [[#t]], even if `mem-usage` has been set to a non-zero value + @returns The [[memory-usage-block]] representing the footprint of the level + @see [[memory-usage-block::10]]" (if (zero? (-> this mem-usage-block)) (set! (-> this mem-usage-block) (new 'debug 'memory-usage-block)) ) @@ -97,23 +97,23 @@ in `mem-usage-block` as well as the total size in `mem-usage` (-> this mem-usage-block) ) -(defmethod mem-usage ((this process-tree) (arg0 memory-usage-block) (arg1 int)) +(defmethod mem-usage ((this process-tree) (usage memory-usage-block) (flags int)) (let ((v1-0 90)) (let* ((a0-1 *dead-pool-list*) (a3-0 (car a0-1)) ) (while (not (null? a0-1)) - (set! (-> arg0 data v1-0 name) (symbol->string (the-as symbol a3-0))) + (set! (-> usage data v1-0 name) (symbol->string (the-as symbol a3-0))) (+! v1-0 1) (set! a0-1 (cdr a0-1)) (set! a3-0 (car a0-1)) ) ) - (set! (-> arg0 length) (max (-> arg0 length) v1-0)) + (set! (-> usage length) (max (-> usage length) v1-0)) ) - (set! (-> arg0 data 96 name) "*debug-dead-pool*") - (set! *temp-mem-usage* arg0) - (when (logtest? arg1 32) + (set! (-> usage data 96 name) "*debug-dead-pool*") + (set! *temp-mem-usage* usage) + (when (logtest? flags 32) (let* ((s5-0 90) (s4-0 *dead-pool-list*) (v1-4 (car s4-0)) @@ -311,7 +311,6 @@ in `mem-usage-block` as well as the total size in `mem-usage` (define *max-dma* 0) (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) @@ -348,218 +347,210 @@ in `mem-usage-block` as well as the total size in `mem-usage` (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 (the-as int (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 (the-as int (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/goal_src/jak2/engine/debug/menu.gc b/goal_src/jak2/engine/debug/menu.gc index d513a60d48..09066915fc 100644 --- a/goal_src/jak2/engine/debug/menu.gc +++ b/goal_src/jak2/engine/debug/menu.gc @@ -505,18 +505,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) @@ -591,79 +580,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 ) @@ -845,13 +799,7 @@ (draw-string "..." s1-0 s5-0) (set! arg4 (and (zero? arg3) arg4)) (when arg4 - (let ((v1-14 s5-0) - (a1-5 20) - (a0-8 379) - ) - (set! (-> v1-14 origin x) (the float a1-5)) - (set! (-> v1-14 origin y) (the float a0-8)) - ) + (set-origin! s5-0 20 379) (draw-string-adv (-> arg0 name) s1-0 s5-0) (draw-string-adv ":" s1-0 s5-0) (draw-string (-> arg0 display-str) s1-0 s5-0) @@ -892,7 +840,6 @@ ) (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)) @@ -929,28 +876,24 @@ (font-color menu) ) ) - (let ((v1-20 (-> arg0 context font)) - (a1-5 s3-1) - (a0-15 s2-1) + (set-origin! (-> arg0 context font) s3-1 s2-1) + (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) ) - (set! (-> v1-20 origin x) (the float a1-5)) - (set! (-> v1-20 origin y) (the float a0-15)) - ) - (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) ) ) ) diff --git a/goal_src/jak2/engine/debug/nav/mysql-nav-graph.gc b/goal_src/jak2/engine/debug/nav/mysql-nav-graph.gc index f1c3a6b4d9..510e387d4e 100644 --- a/goal_src/jak2/engine/debug/nav/mysql-nav-graph.gc +++ b/goal_src/jak2/engine/debug/nav/mysql-nav-graph.gc @@ -238,7 +238,7 @@ (defmethod alloc-new-node! ((this mysql-nav-graph)) "Allocates a new `[[mysql-nav-node]]`, if `node-array`'s `length` exceeds `3000` return `-1` -otherwise, return the new size of the array" + otherwise, return the new size of the array" (cond ((>= (-> this node-array length) 3000) (format #t "mysql-nav-graph : nodes buffer too small, increase NAV_GRAPH_EDITOR_NODE_COUNT~%") @@ -262,7 +262,7 @@ otherwise, return the new size of the array" (defmethod alloc-new-edge! ((this mysql-nav-graph)) "Allocates a new `[[mysql-nav-edge]]`, if `edge-array`'s `length` exceeds `5000` return `-1` -otherwise, return the new size of the array" + otherwise, return the new size of the array" (cond ((>= (-> this edge-array length) 5000) (format #t "mysql-nav-graph : edges buffer too small, increase NAV_GRAPH_EDITOR_EDGE_COUNT~%") @@ -286,7 +286,7 @@ otherwise, return the new size of the array" (defmethod indexof-visnode ((this mysql-nav-graph) (edge-id int) (node-id int)) "Returns the index in the `visnode-array` whom's [[mysql-nav-visnode]] has the provided `runtime-edge-id` and `runtime-node-id` -if none exist, return `-1`" + if none exist, return `-1`" (dotimes (v1-0 (-> this visnode-array length)) (let ((a3-2 (-> this visnode-array data v1-0))) (if (and (= (-> a3-2 runtime-edge-id) edge-id) (= (-> a3-2 runtime-node-id) node-id)) @@ -299,9 +299,9 @@ if none exist, return `-1`" (defmethod alloc-new-visnode! ((this mysql-nav-graph) (edge-id int) (node-id int)) "Potentially allocates a new `[[mysql-nav-visnode]]`: -- if `visnode-array`'s `length` exceeds `3000` return `-1` -- otherwise, if the node already exists, TODO -- if the node does not already exist, create it!" + - if `visnode-array`'s `length` exceeds `3000` return `-1` + - otherwise, if the node already exists, TODO + - if the node does not already exist, create it!" (cond ((>= (-> this visnode-array length) 3000) (format #t "mysql-nav-graph : visnodes buffer too small, increase NAV_GRAPH_EDITOR_VISNODE_COUNT~%") @@ -697,7 +697,7 @@ if none exist, return `-1`" (defmethod indexof-nav-node ((this mysql-nav-graph) (node-id int)) "Iterate through the `node-array` and return the index for the first [[mysql-nav-node]] whom's `nav_node_id` matches the provided id -returns `-1` if none is found" + returns `-1` if none is found" (dotimes (v1-0 (-> this node-array length)) (if (= node-id (-> (the-as mysql-nav-node (-> this node-array data v1-0)) nav_node_id)) (return v1-0) @@ -708,7 +708,7 @@ returns `-1` if none is found" (defmethod indexof-nav-edge ((this mysql-nav-graph) (edge-id int)) "Iterate through the `edge-array` and return the index for the first [[mysql-nav-edge]] whom's `nav_edge_id` matches the provided id -returns `-1` if none is found" + returns `-1` if none is found" (dotimes (v1-0 (-> this edge-array length)) (if (= edge-id (-> (the-as mysql-nav-edge (-> this edge-array data v1-0)) nav_edge_id)) (return v1-0) @@ -726,7 +726,6 @@ returns `-1` if none is found" ;; 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) @@ -774,35 +773,36 @@ returns `-1` if none is found" (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 @@ -846,155 +846,155 @@ returns `-1` if none is found" (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) ) ) ) @@ -1168,6 +1168,43 @@ returns `-1` if none is found" ) ) +(defmethod mysql-nav-graph-method-19 ((this mysql-nav-graph)) + (set! (-> this level-info-array-length) 0) + (set! (-> this level-info-last-lookup) 0) + (dotimes (v1-0 32) + (let ((a0-3 (-> this level-info-array v1-0))) + (set! (-> a0-3 level) #f) + (set! (-> a0-3 level-id) (the-as uint v1-0)) + (set! (-> a0-3 node-count) 0) + (set! (-> a0-3 branch-count) 0) + (set! (-> a0-3 to-link-count) 0) + ) + 0 + ) + (dotimes (s5-0 (-> this node-array length)) + (let ((s4-0 (-> this node-array data s5-0))) + (when (not (logtest? (-> s4-0 mysql-save-flag) (mysql-save-flag delete))) + (let ((v1-10 (lookup-level-info2 this s4-0 #t))) + (set! (-> s4-0 level-node-index) (-> v1-10 node-count)) + (+! (-> v1-10 node-count) 1) + (let ((a0-10 (the-as mysql-nav-edge (-> s4-0 temp-edge-list)))) + (while a0-10 + (when (not (logtest? (-> a0-10 mysql-save-flag) (mysql-save-flag delete))) + (if (!= (-> v1-10 level) (-> this node-array data (-> a0-10 runtime-node-id-2) level_name)) + (+! (-> v1-10 to-link-count) 1) + ) + (+! (-> v1-10 branch-count) 1) + ) + (set! a0-10 (-> a0-10 temp-next-edge)) + ) + ) + ) + ) + ) + ) + 0 + (none) + ) (defmethod mysql-nav-graph-method-20 ((this mysql-nav-graph)) (mysql-nav-graph-method-17 this) @@ -1175,3 +1212,43 @@ returns `-1` if none is found" 0 (none) ) + +(defmethod exec-sql! ((this mysql-nav-graph)) + (format #t "Saving nodes ...~%") + (dotimes (s5-0 (-> this node-array length)) + (let ((a0-3 (-> this node-array data s5-0))) + (set! (-> a0-3 nav_graph_id) (-> this nav_graph_id)) + (if (not (exec-sql! a0-3)) + (return #f) + ) + ) + ) + (format #t "Done.~%") + (format #t "Saving edges ...~%") + (dotimes (s5-1 (-> this edge-array length)) + (let ((a0-7 (-> this edge-array data s5-1))) + (set! (-> a0-7 nav_graph_id) (-> this nav_graph_id)) + (set! (-> a0-7 nav_node_id_1) (-> this node-array data (-> a0-7 runtime-node-id-1) nav_node_id)) + (set! (-> a0-7 nav_node_id_2) (-> this node-array data (-> a0-7 runtime-node-id-2) nav_node_id)) + (exec-sql! a0-7) + ) + ) + (format #t "Done.~%") + (format #t "Saving visible nodes ...~%") + (dotimes (s5-2 (-> this visnode-array length)) + (let ((a0-11 (-> this visnode-array data s5-2))) + (set! (-> a0-11 nav_graph_id) (-> this nav_graph_id)) + (set! (-> a0-11 nav_node_id) (-> this node-array data (-> a0-11 runtime-node-id) nav_node_id)) + (set! (-> a0-11 nav_edge_id) + (-> (the-as mysql-nav-edge (+ (the-as uint (-> this edge-array)) (* 80 (-> a0-11 runtime-edge-id)))) + nav_node_id_2 + ) + ) + (if (not (exec-sql! a0-11)) + (return #f) + ) + ) + ) + (format #t "Done.~%") + #t + ) diff --git a/goal_src/jak2/engine/debug/nav/nav-graph-editor.gc b/goal_src/jak2/engine/debug/nav/nav-graph-editor.gc index 1bb6f5d495..965e96f388 100644 --- a/goal_src/jak2/engine/debug/nav/nav-graph-editor.gc +++ b/goal_src/jak2/engine/debug/nav/nav-graph-editor.gc @@ -191,12 +191,7 @@ (dotimes (s2-0 (-> s3-0 length)) (let ((s1-0 (-> s3-0 s2-0))) (-> s1-0 aid) - (let* ((s0-0 s1-0) - (v1-14 (if (type? s0-0 entity-nav-mesh) - s0-0 - ) - ) - ) + (let ((v1-14 (as-type s1-0 entity-nav-mesh))) (when v1-14 (let ((a0-7 (-> v1-14 nav-mesh)) (a1-2 (new 'stack-no-clear 'nav-find-poly-parms)) @@ -261,28 +256,25 @@ (let ((v1-23 (-> this nav-graph visnode-array data s3-1))) (when (and (= (-> v1-23 runtime-edge-id) arg0) (not (logtest? (-> v1-23 mysql-save-flag) (mysql-save-flag delete)))) (vector-! - (the-as vector (-> s4-0 vector)) + (-> s4-0 vector 0) (the-as vector (+ (the-as uint (-> this nav-graph node-array data 0 position)) (* 80 (-> v1-23 runtime-node-id))) ) (-> s4-0 trans) ) - (vector-normalize! - (the-as vector (-> s4-0 vector)) - (fmax 15360.0 (+ -15360.0 (vector-length (the-as vector (-> s4-0 vector))))) - ) - (vector-rotate-around-y! (-> s4-0 vector 1) (the-as vector (-> s4-0 vector)) 24576.0) + (vector-normalize! (-> s4-0 vector 0) (fmax 15360.0 (+ -15360.0 (vector-length (-> s4-0 vector 0))))) + (vector-rotate-around-y! (-> s4-0 vector 1) (-> s4-0 vector 0) 24576.0) (vector-normalize! (-> s4-0 vector 1) 16384.0) - (vector-rotate-around-y! (-> s4-0 vector 2) (the-as vector (-> s4-0 vector)) -24576.0) + (vector-rotate-around-y! (-> s4-0 vector 2) (-> s4-0 vector 0) -24576.0) (vector-normalize! (-> s4-0 vector 2) 16384.0) - (vector+! (the-as vector (-> s4-0 vector)) (the-as vector (-> s4-0 vector)) (-> s4-0 trans)) - (vector+! (-> s4-0 vector 2) (-> s4-0 vector 2) (the-as vector (-> s4-0 vector))) - (vector+! (-> s4-0 vector 1) (-> s4-0 vector 1) (the-as vector (-> s4-0 vector))) + (vector+! (-> s4-0 vector 0) (-> s4-0 vector 0) (-> s4-0 trans)) + (vector+! (-> s4-0 vector 2) (-> s4-0 vector 2) (-> s4-0 vector 0)) + (vector+! (-> s4-0 vector 1) (-> s4-0 vector 1) (-> s4-0 vector 0)) (add-debug-line #t (bucket-id debug2) - (the-as vector (-> s4-0 vector)) + (-> s4-0 vector 0) (-> s4-0 vector 1) *color-light-yellow* #f @@ -291,7 +283,7 @@ (add-debug-line #t (bucket-id debug2) - (the-as vector (-> s4-0 vector)) + (-> s4-0 vector 0) (-> s4-0 vector 2) *color-light-yellow* #f @@ -306,12 +298,12 @@ #f (the-as rgba -1) ) - (vector-lerp! (the-as vector (-> s4-0 vector)) (-> s4-0 vector 1) (-> s4-0 vector 2) 0.5) + (vector-lerp! (-> s4-0 vector 0) (-> s4-0 vector 1) (-> s4-0 vector 2) 0.5) (add-debug-line #t (bucket-id debug2) (-> s4-0 trans) - (the-as vector (-> s4-0 vector)) + (-> s4-0 vector 0) *color-light-yellow* #f (the-as rgba -1) @@ -434,7 +426,6 @@ ) (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) @@ -455,11 +446,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)))) ) @@ -494,48 +481,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))) @@ -681,10 +666,7 @@ (dotimes (s2-1 (-> s3-3 length)) (let* ((s0-1 (-> s3-3 s2-1)) (s1-1 (-> s0-1 aid)) - (v1-28 (if (type? s0-1 entity-nav-mesh) - s0-1 - ) - ) + (v1-28 (as-type s0-1 entity-nav-mesh)) ) (when v1-28 (let ((a0-24 (-> v1-28 nav-mesh)) @@ -755,7 +737,7 @@ ) ) ((and (-> this next-state) (= (-> this next-state name) 'move-plane)) - (vector-cross! s3-0 *up-vector* (the-as vector (-> (camera-matrix) vector))) + (vector-cross! s3-0 *up-vector* (-> (camera-matrix) vector 0)) (vector-normalize! s3-0 1.0) (set! (-> s2-0 quad) (-> this mouse-hit quad)) (reverse-transform-point! s5-1 s2-0 s3-0 s1-0) @@ -832,7 +814,7 @@ (dotimes (a0-64 4) (set! (-> v1-57 quad a0-64) (the-as uint128 0)) ) - (vector+! (the-as vector (-> v1-57 vector)) s5-1 (new 'static 'vector :x 8192.0 :z 8192.0 :w 1.0)) + (vector+! (-> v1-57 vector 0) s5-1 (new 'static 'vector :x 8192.0 :z 8192.0 :w 1.0)) (vector+! (-> v1-57 vector 1) s5-1 (new 'static 'vector :x 8192.0 :z -8192.0 :w 1.0)) (vector+! (-> v1-57 vector 2) s5-1 (new 'static 'vector :x -8192.0 :z -8192.0 :w 1.0)) (vector+! (-> v1-57 trans) s5-1 (new 'static 'vector :x -8192.0 :z 8192.0 :w 1.0)) @@ -1005,7 +987,6 @@ ;; 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) @@ -1039,9 +1020,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)) ) @@ -1051,18 +1032,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) ) ) ) @@ -2110,16 +2094,6 @@ ) (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) @@ -2132,52 +2106,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)) @@ -2221,7 +2197,6 @@ ) (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))) @@ -2239,32 +2214,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/goal_src/jak2/engine/debug/viewer.gc b/goal_src/jak2/engine/debug/viewer.gc index c304e160c4..87bf272644 100644 --- a/goal_src/jak2/engine/debug/viewer.gc +++ b/goal_src/jak2/engine/debug/viewer.gc @@ -204,11 +204,11 @@ ;; WARN: Return type mismatch object vs none. (defmethod init-from-entity! ((this viewer) (arg0 entity-actor)) "Typically the method that does the initial setup on the process, potentially using the [[entity-actor]] provided as part of that. -This commonly includes things such as: -- stack size -- collision information -- loading the skeleton group / bones -- sounds" + This commonly includes things such as: + - stack size + - collision information + - loading the skeleton group / bones + - sounds" (set! *viewer* this) (set! (-> this root) (new 'process 'trsqv)) (process-drawable-from-entity! this arg0) @@ -233,31 +233,29 @@ This commonly includes things such as: ) (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/goal_src/jak2/engine/dma/dma-buffer.gc b/goal_src/jak2/engine/dma/dma-buffer.gc index fedf0f823b..3cc7f25857 100644 --- a/goal_src/jak2/engine/dma/dma-buffer.gc +++ b/goal_src/jak2/engine/dma/dma-buffer.gc @@ -233,7 +233,8 @@ note that the second vifcode can also hold other stuff depending on the mode. ;; The first 4 bytes of a vu-function object's data are discarded because they aren't aligned. (let ((func-ptr (the-as pointer (&-> vu-func data 4))) - (qlen (-> vu-func qlength)) ;; number of quadwords + ;; og:preserve-this we rely on the vu functions being empty on pc + (qlen (#if PC_PORT 0 (-> vu-func qlength))) ;; number of quadwords (origin (-> vu-func origin)) ;; destination address in VU instruction memory. ) ;; loop until whole program is transferred. diff --git a/goal_src/jak2/engine/entity/actor-link-h.gc b/goal_src/jak2/engine/entity/actor-link-h.gc index 0eb153a904..131a14362f 100644 --- a/goal_src/jak2/engine/entity/actor-link-h.gc +++ b/goal_src/jak2/engine/entity/actor-link-h.gc @@ -13,9 +13,10 @@ ;; WARN: Return type mismatch entity vs entity-actor. (defun entity-actor-lookup ((arg0 res-lump) (arg1 symbol) (arg2 int)) - (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)))) + "Given an entity (the res-lump), look up a reference to another entity and return that entity." + (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)))) @@ -30,15 +31,22 @@ ;; WARN: Check prologue - tricky store of r0 (defun entity-actor-count ((arg0 res-lump) (arg1 symbol)) - (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 - ) + "Get the number of entities that this res references under the name. + This works on more than just next/prev." + (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 + ) + ) ) (deftype actor-link-info (basic) + "A linked list of actors. + +Actors allocate this on their process heap if they have a +`next-actor` or `prev-actor` defined in their lump +and use it for entity lookups." ((process process) (next entity-actor) (prev entity-actor) @@ -75,6 +83,9 @@ ) (defmethod new actor-link-info ((allocation symbol) (type-to-make type) (arg0 process) (arg1 symbol)) + "Set up an actor-link-info for the given process. + The entity of this process should be the entity-actor + that will get this actor-link-info." (let* ((a0-1 (-> arg0 entity)) (s4-0 (entity-actor-lookup a0-1 'next-actor 0)) (a0-2 (-> arg0 entity)) @@ -101,15 +112,18 @@ ;; WARN: Return type mismatch basic vs process. (defmethod get-next-process ((this actor-link-info)) + "Get the process for the next, if it exists." (the-as process (and (-> this next) (-> this next extra process))) ) ;; WARN: Return type mismatch basic vs process. (defmethod get-prev-process ((this actor-link-info)) + "Get the process for the prev, if it exists." (the-as process (and (-> this prev) (-> this prev extra process))) ) (defmethod link-to-next-and-prev-actor ((this actor-link-info)) + "Redo the linking in the constructor by looking up the next/prev actor." (let ((a0-1 (-> this process entity))) (set! (-> this next) (entity-actor-lookup a0-1 'next-actor 0)) ) @@ -120,6 +134,8 @@ ) (defmethod apply-function-forward ((this actor-link-info) (arg0 (function entity-actor object object)) (arg1 object)) + "Iterate forward through actors, and apply this function. Starts at (-> this next) + If the function returns truthy, stop iterating." (let ((s3-0 (-> this next))) (while s3-0 (if (arg0 s3-0 arg1) @@ -132,6 +148,8 @@ ) (defmethod apply-function-reverse ((this actor-link-info) (arg0 (function entity-actor object object)) (arg1 object)) + "Iterate backward through actors and apply function. + If the function returns truth, stop iterating." (let ((s3-0 (-> this prev))) (while s3-0 (if (arg0 s3-0 arg1) @@ -144,6 +162,7 @@ ) (defmethod apply-all ((this actor-link-info) (arg0 (function entity-actor object object)) (arg1 object)) + "Apply to all entities. Starts at the back and hits everyone, including this object." (let ((s4-0 (-> this process entity))) (while (let ((a0-2 s4-0)) (entity-actor-lookup a0-2 'prev-actor 0) @@ -163,6 +182,7 @@ ) (defmethod send-to-all-after ((this actor-link-info) (arg0 symbol)) + "Send an event to all processes after this link with no parameters." (with-pp (let ((s4-0 (-> this next)) (s5-0 (the-as object #f)) @@ -186,6 +206,7 @@ ) (defmethod send-to-all-before ((this actor-link-info) (arg0 symbol)) + "Send an event to all processes before this link with no parameters." (with-pp (let ((s4-0 (-> this prev)) (s5-0 (the-as object #f)) @@ -210,6 +231,7 @@ ;; WARN: Return type mismatch symbol vs none. (defmethod send-to-next ((this actor-link-info) (arg0 symbol)) + "Send event arg0 to the next actor's process." (let ((a0-1 (-> this next))) (when a0-1 (let ((a0-2 (-> a0-1 extra process))) @@ -224,6 +246,7 @@ ;; WARN: Return type mismatch symbol vs none. (defmethod send-to-prev ((this actor-link-info) (arg0 symbol)) + "Send event arg1 to the next actor's process." (let ((a0-1 (-> this prev))) (when a0-1 (let ((a0-2 (-> a0-1 extra process))) @@ -238,6 +261,7 @@ ;; WARN: Return type mismatch symbol vs none. (defmethod send-to-next-and-prev ((this actor-link-info) (arg0 symbol)) + "Send an event to both next and prev with no params." (send-to-next this arg0) (send-to-prev this arg0) (none) @@ -251,6 +275,7 @@ ) (defmethod actor-count ((this actor-link-info)) + "Count the number of actors in the entire list." (let ((s5-0 (-> this process entity)) (gp-0 0) ) @@ -270,6 +295,8 @@ ) (defmethod get-matching-actor-type-mask ((this actor-link-info) (arg0 type)) + "Iterate through _all_ actors that are part of this actor list. + If the nth actor is type matching-type, then set the nth bit of the result." (let ((s3-0 (-> this process entity)) (s5-0 0) ) @@ -294,6 +321,7 @@ ) (defmethod actor-count-before ((this actor-link-info)) + "Get the number of actors before this actor in the list." (let* ((s5-0 (-> this process entity)) (s4-0 s5-0) (gp-0 0) @@ -314,6 +342,7 @@ ) (defun actor-link-subtask-complete-hook ((arg0 entity-actor) (arg1 (pointer symbol))) + "Sets arg1 if the thing is complete. Does not continue the apply if the complete perm is set." (cond ((logtest? (-> arg0 extra perm status) (entity-perm-status subtask-complete)) (set! (-> arg1 0) #t) @@ -339,6 +368,7 @@ ) (defun actor-link-dead-hook ((arg0 entity-actor) (arg1 (pointer symbol))) + "Sets arg1 if the thing is dead. Does not continue the apply if the dead perm is set." (cond ((logtest? (-> arg0 extra perm status) (entity-perm-status dead)) (set! (-> arg1 0) #t) @@ -352,6 +382,7 @@ ) (defun alt-actor-list-subtask-incomplete-count ((arg0 process-drawable)) + "Get the number of alt-actors which do not have the complete bit set in their perm." (let ((s4-0 (entity-actor-count (-> arg0 entity) 'alt-actor)) (gp-0 0) ) diff --git a/goal_src/jak2/engine/entity/res.gc b/goal_src/jak2/engine/entity/res.gc index 435bceb5da..2d53a508b8 100644 --- a/goal_src/jak2/engine/entity/res.gc +++ b/goal_src/jak2/engine/entity/res.gc @@ -74,12 +74,12 @@ This is updated from the entity system used in Crash 2, which had most of these ) (defmethod get-tag-index-data ((this res-lump) (arg0 int)) - "get the data address of the n'th tag." + "Get the data address of the n'th tag." (&+ (-> this data-base) (-> this tag arg0 data-offset)) ) (defmethod get-tag-data ((this res-lump) (arg0 res-tag)) - "get the data address of the specified tag." + "Get the data address of the specified tag." (&+ (-> this data-base) (-> arg0 data-offset)) ) @@ -89,8 +89,8 @@ This is updated from the entity system used in Crash 2, which had most of these (set! (-> v0-0 allocated-length) arg0) (set! (-> v0-0 data-size) arg1) (set! (-> v0-0 length) 0) - (set! (-> v0-0 data-base) (&-> (-> v0-0 tag) arg0)) - (set! (-> v0-0 data-top) (&-> (-> v0-0 tag) arg0)) + (set! (-> v0-0 data-base) (&-> v0-0 tag arg0)) + (set! (-> v0-0 data-top) (&-> v0-0 tag arg0)) v0-0 ) ) @@ -100,6 +100,7 @@ This is updated from the entity system used in Crash 2, which had most of these (-> this length) ) +;; WARN: Return type mismatch uint vs int. (defmethod asize-of ((this res-lump)) "get the allocated size of a res-lump." (the-as int (+ (-> this type psize) (* (-> this allocated-length) 16) (-> this data-size))) @@ -130,18 +131,19 @@ This is updated from the entity system used in Crash 2, which had most of these this ) +;; WARN: Return type mismatch int vs res-tag-pair. (defmethod lookup-tag-idx ((this res-lump) (arg0 symbol) (arg1 symbol) (arg2 float)) "Look up the index of the tag containing with the given name and timestamp. Correct lookups return a res-tag-pair, which contains one tag index in the lower 32 bits and one in the upper 32 bits. Depending on the mode, they may be the same, or they may be two tags that you should interpolate between, if the exact time was not found. - name-sym should be the name of the thing you want. - time is for the timestamp you want. + @param name-sym should be the name of the thing you want. + @param time is for the timestamp you want. If mode = 'base, then both the indices are the same and the timestamp is ignored. - If mode = 'interp, then it tries to get closest below/closest above (or both the same, if exact match found) + If mode = 'interp, then it tries to get closest below/closest above (or both the same, if exact match found). If mode = 'exact, then it requires an exact timestamp match and both indices are the same. - If things go wrong, returns a negative number" + If things go wrong, returns a negative number." (local-vars (t4-1 int)) (when (or (= arg0 'id) (= arg0 'aid) @@ -201,7 +203,7 @@ This is updated from the entity system used in Crash 2, which had most of these (goto cfg-73) ) (let ((t3-13 t4-1) - (t4-4 (&-> (-> this tag) t4-1)) + (t4-4 (&-> this tag t4-1)) ) (while (not (or (>= t3-13 (-> this length)) (< t2-4 (-> (&+ (the-as (pointer uint64) (symbol->string (-> t4-4 0 name))) 4) 0)) @@ -239,8 +241,8 @@ This is updated from the entity system used in Crash 2, which had most of these ) ) -(defmethod make-property-data ((this res-lump) (arg0 float) (arg1 res-tag-pair) (arg2 pointer)) - "Returns (a pointer to) the value data of a property with the tag-pair. +(defmethod make-property-data ((this res-lump) (arg1 float) (tag-pair res-tag-pair) (arg3 pointer)) + "Returns (a pointer to) the value data of a property with the tag-pair. If tag-pair does not represent an exact point in the timeline, then the data is interpolated based on time with the result written into buf. buf must have enough space to copy all of the data. Otherwise, simply returns an address to the resource binary." @@ -249,16 +251,16 @@ This is updated from the entity system used in Crash 2, which had most of these (vf3 :class vf) (vf4 :class vf) ) - (let* ((t0-2 (-> this tag (-> arg1 lo))) - (t1-2 (-> this tag (-> arg1 hi))) + (let* ((t0-2 (-> this tag (-> tag-pair lo))) + (t1-2 (-> this tag (-> tag-pair hi))) (v1-6 (-> t0-2 elt-count)) ) (cond ((zero? (-> t0-2 inlined?)) (&+ (-> this data-base) (-> t0-2 data-offset)) ) - ((or (not arg2) - (= (-> arg1 lo) (-> arg1 hi)) + ((or (not arg3) + (= (-> tag-pair lo) (-> tag-pair hi)) (!= v1-6 (-> t1-2 elt-count)) (!= (-> t0-2 elt-type) (-> t1-2 elt-type)) ) @@ -267,7 +269,7 @@ This is updated from the entity system used in Crash 2, which had most of these ) ) (else - (let* ((f0-2 (/ (- arg0 (-> t0-2 key-frame)) (- (-> t1-2 key-frame) (-> t0-2 key-frame)))) + (let* ((f0-2 (/ (- arg1 (-> t0-2 key-frame)) (- (-> t1-2 key-frame) (-> t0-2 key-frame)))) (a1-4 this) (a2-7 t0-2) (a1-6 (&+ (-> a1-4 data-base) (-> a2-7 data-offset))) @@ -276,18 +278,18 @@ This is updated from the entity system used in Crash 2, which had most of these (case (-> t0-2 elt-type symbol) (('float) (dotimes (a0-8 (the-as int v1-6)) - (set! (-> (the-as (pointer float) (&+ arg2 (* a0-8 4)))) + (set! (-> (the-as (pointer float) (&+ arg3 (* a0-8 4)))) (+ (* (-> (the-as (pointer float) (&+ a1-6 (* a0-8 4)))) (- 1.0 f0-2)) (* (-> (the-as (pointer float) (&+ a2-13 (* a0-8 4)))) f0-2) ) ) ) - arg2 + arg3 ) (('integer 'sinteger 'uinteger 'int64 'uint64) (let ((a0-10 (the int (* 4096.0 f0-2)))) (dotimes (t0-10 (the-as int v1-6)) - (set! (-> (the-as (pointer int64) (&+ arg2 (* t0-10 8)))) + (set! (-> (the-as (pointer int64) (&+ arg3 (* t0-10 8)))) (sar (+ (* (the-as int (-> (the-as (pointer uint64) (&+ a1-6 (* t0-10 8))))) (- 4096 a0-10)) (* (the-as int (-> (the-as (pointer uint64) (&+ a2-13 (* t0-10 8))))) a0-10) @@ -297,12 +299,12 @@ This is updated from the entity system used in Crash 2, which had most of these ) ) ) - arg2 + arg3 ) (('int8) (let ((a0-12 (the int (* 4096.0 f0-2)))) (dotimes (t0-11 (the-as int v1-6)) - (set! (-> (the-as (pointer int8) (&+ arg2 t0-11))) + (set! (-> (the-as (pointer int8) (&+ arg3 t0-11))) (sar (+ (* (-> (the-as (pointer int8) (&+ a1-6 t0-11))) (- 4096 a0-12)) (* (-> (the-as (pointer int8) (&+ a2-13 t0-11))) a0-12) @@ -312,12 +314,12 @@ This is updated from the entity system used in Crash 2, which had most of these ) ) ) - arg2 + arg3 ) (('uint8) (let ((a0-14 (the int (* 4096.0 f0-2)))) (dotimes (t0-12 (the-as int v1-6)) - (set! (-> (the-as (pointer uint8) (&+ arg2 t0-12))) + (set! (-> (the-as (pointer uint8) (&+ arg3 t0-12))) (shr (+ (* (-> (the-as (pointer uint8) (&+ a1-6 t0-12))) (the-as uint (- 4096 a0-14))) (* (-> (the-as (pointer uint8) (&+ a2-13 t0-12))) (the-as uint a0-14)) @@ -327,12 +329,12 @@ This is updated from the entity system used in Crash 2, which had most of these ) ) ) - arg2 + arg3 ) (('int16) (let ((a0-16 (the int (* 4096.0 f0-2)))) (dotimes (t0-13 (the-as int v1-6)) - (set! (-> (the-as (pointer int16) (&+ arg2 (* t0-13 2)))) + (set! (-> (the-as (pointer int16) (&+ arg3 (* t0-13 2)))) (sar (+ (* (-> (the-as (pointer int16) (&+ a1-6 (* t0-13 2)))) (- 4096 a0-16)) (* (-> (the-as (pointer int16) (&+ a2-13 (* t0-13 2)))) a0-16) @@ -342,12 +344,12 @@ This is updated from the entity system used in Crash 2, which had most of these ) ) ) - arg2 + arg3 ) (('uint16) (let ((a0-18 (the int (* 4096.0 f0-2)))) (dotimes (t0-14 (the-as int v1-6)) - (set! (-> (the-as (pointer uint16) (&+ arg2 (* t0-14 2)))) + (set! (-> (the-as (pointer uint16) (&+ arg3 (* t0-14 2)))) (shr (+ (* (-> (the-as (pointer uint16) (&+ a1-6 (* t0-14 2)))) (the-as uint (- 4096 a0-18))) (* (-> (the-as (pointer uint16) (&+ a2-13 (* t0-14 2)))) (the-as uint a0-18)) @@ -357,12 +359,12 @@ This is updated from the entity system used in Crash 2, which had most of these ) ) ) - arg2 + arg3 ) (('int32) (let ((a0-20 (the int (* 4096.0 f0-2)))) (dotimes (t0-15 (the-as int v1-6)) - (set! (-> (the-as (pointer int32) (&+ arg2 (* t0-15 4)))) + (set! (-> (the-as (pointer int32) (&+ arg3 (* t0-15 4)))) (sar (+ (* (-> (the-as (pointer int32) (&+ a1-6 (* t0-15 4)))) (- 4096 a0-20)) (* (-> (the-as (pointer int32) (&+ a2-13 (* t0-15 4)))) a0-20) @@ -372,12 +374,12 @@ This is updated from the entity system used in Crash 2, which had most of these ) ) ) - arg2 + arg3 ) (('uint32) (let ((a0-22 (the int (* 4096.0 f0-2)))) (dotimes (t0-16 (the-as int v1-6)) - (set! (-> (the-as (pointer uint32) (&+ arg2 (* t0-16 4)))) + (set! (-> (the-as (pointer uint32) (&+ arg3 (* t0-16 4)))) (shr (+ (* (-> (the-as (pointer uint32) (&+ a1-6 (* t0-16 4)))) (the-as uint (- 4096 a0-22))) (* (-> (the-as (pointer uint32) (&+ a2-13 (* t0-16 4)))) (the-as uint a0-22)) @@ -387,7 +389,7 @@ This is updated from the entity system used in Crash 2, which had most of these ) ) ) - arg2 + arg3 ) (('vector) (let ((a0-23 f0-2)) @@ -406,9 +408,9 @@ This is updated from the entity system used in Crash 2, which had most of these (.mul.x.vf vf1 vf1 vf4) (.mul.x.vf vf2 vf2 vf3) (.add.vf vf1 vf1 vf2) - (.svf (&-> (the-as (pointer uint128) (+ (* a0-26 16) (the-as int arg2))) 0) vf1) + (.svf (&-> (the-as (pointer uint128) (+ (* a0-26 16) (the-as int arg3))) 0) vf1) ) - arg2 + arg3 ) (else (let ((a0-27 t0-2)) @@ -424,19 +426,18 @@ This is updated from the entity system used in Crash 2, which had most of these ) (defmethod get-property-data ((this res-lump) - (arg0 symbol) - (arg1 symbol) - (arg2 float) - (arg3 pointer) - (arg4 (pointer res-tag)) - (arg5 pointer) - ) + (arg0 symbol) + (arg1 symbol) + (arg2 float) + (arg3 pointer) + (arg4 (pointer res-tag)) + (arg5 pointer) + ) "Returns an address to a given property's data at a specific time stamp, or default on error. - name is the name of the property you want, mode is its lookup mode ('interp 'base 'exact), time is the timestamp. - default is the default result returned in the case of an error. - tag-addr is an address to a res-tag. The current base tag is written to this. Ignored if tag-addr is #f - buf-addr is an address to the data buffer used to write interpolated data to. It must have enough space! Only necessary for 'interp mode." - + @param name is the name of the property you want, mode is its lookup mode ('interp 'base 'exact), time is the timestamp. + @param default is the default result returned in the case of an error. + @param tag-addr is an address to a res-tag. The current base tag is written to this. Ignored if tag-addr is #f + @param buf-addr is an address to the data buffer used to write interpolated data to. It must have enough space! Only necessary for 'interp mode." (let ((s3-0 (lookup-tag-idx this arg0 arg1 arg2))) (cond ((< (the-as int s3-0) 0) @@ -453,19 +454,21 @@ This is updated from the entity system used in Crash 2, which had most of these arg3 ) +;; WARN: Return type mismatch object vs structure. (defmethod get-property-struct ((this res-lump) - (arg0 symbol) - (arg1 symbol) - (arg2 float) - (arg3 structure) - (arg4 (pointer res-tag)) - (arg5 pointer) - ) + (arg0 symbol) + (arg1 symbol) + (arg2 float) + (arg3 structure) + (arg4 (pointer res-tag)) + (arg5 pointer) + ) "Returns a given struct property's value at a specific time stamp, or default on error. - name is the name of the property you want, mode is its lookup mode ('interp 'base 'exact), time is the timestamp. - default is the default result returned in the case of an error. - tag-addr is an address to a res-tag. The current base tag is written to this. Ignored if tag-addr is #f - buf-addr is an address to the data buffer used to write interpolated data to. It must have enough space! Only necessary for 'interp mode." + @param name is the name of the property you want, `mode` is its lookup mode ('interp 'base 'exact), `time` is the timestamp. + @param default is the default result returned in the case of an error. + @param tag-addr is an address to a [[res-tag]]. The current base tag is written to this. Ignored if tag-addr is #f. + @param buf-addr is an address to the data buffer used to write interpolated data to. + It must have enough space! Only necessary for 'interp mode." (let ((s3-0 (lookup-tag-idx this arg0 arg1 arg2))) (cond ((< (the-as int s3-0) 0) @@ -488,19 +491,21 @@ This is updated from the entity system used in Crash 2, which had most of these (the-as structure arg3) ) +;; WARN: Return type mismatch int vs uint128. (defmethod get-property-value ((this res-lump) - (arg0 symbol) - (arg1 symbol) - (arg2 float) - (arg3 uint128) - (arg4 (pointer res-tag)) - (arg5 pointer) - ) + (arg0 symbol) + (arg1 symbol) + (arg2 float) + (arg3 uint128) + (arg4 (pointer res-tag)) + (arg5 pointer) + ) "Returns a given value property's value at a specific time stamp, or default on error. - name is the name of the property you want, mode is its lookup mode ('interp 'base 'exact), time is the timestamp. - default is the default result returned in the case of an error. - tag-addr is an address to a res-tag. The current base tag is written to this. Ignored if tag-addr is #f - buf-addr is an address to the data buffer used to write interpolated data to. It must have enough space! Only necessary for 'interp mode." + @param name is the name of the property you want, `mode` is its lookup mode ('interp 'base 'exact), `time` is the timestamp. + @param default is the default result returned in the case of an error. + @param tag-addr is an address to a res-tag. The current base tag is written to this. Ignored if `tag-addr` is #f. + @param buf-addr is an address to the data buffer used to write interpolated data to. + It must have enough space! Only necessary for 'interp mode." (let ((a2-1 (lookup-tag-idx this arg0 arg1 arg2))) (cond ((< (the-as int a2-1) 0) @@ -568,8 +573,14 @@ This is updated from the entity system used in Crash 2, which had most of these (the-as uint128 arg3) ) -(defmethod get-property-value-float ((this res-lump) (arg0 symbol) (arg1 symbol) (arg2 float) (arg3 float) (arg4 (pointer res-tag)) (arg5 pointer)) - "same as get-property-value but float type is checked first?" +(defmethod get-property-value-float ((this res-lump) + (arg0 symbol) + (arg1 symbol) + (arg2 float) + (arg3 float) + (arg4 (pointer res-tag)) + (arg5 pointer) + ) (local-vars (v1-8 uint) (v1-11 int)) (let ((a2-1 (lookup-tag-idx this arg0 arg1 arg2))) (cond @@ -672,7 +683,7 @@ This is updated from the entity system used in Crash 2, which had most of these "Find space for the data described by arg0 in this. Returns a tag with data-offset set correctly for this res-lump. If the lump already contains memory for the given tag, and it is big enough, - it will be reused. Alignment will be at least 8 bytes. + it will be reused. Alignment will be at least 8 bytes. If the input tag has elt-count = 0, it will return a tag for elt-count = 1." (local-vars (resource-mem pointer)) (let* ((tag-pair (lookup-tag-idx this (-> arg0 name) 'exact (-> arg0 key-frame))) @@ -736,11 +747,11 @@ This is updated from the entity system used in Crash 2, which had most of these ) ) -(defmethod add-data! ((this res-lump) (arg0 res-tag) (arg1 pointer)) +(defmethod add-data! ((this res-lump) (tag res-tag) (arg2 pointer)) "Given a tag and a pointer to its data, copy it to this res-lump. This doesn't seem to do the right thing if the given tag is a non-inline tag with > 1 element." - (let ((a0-2 (allocate-data-memory-for-tag! this arg0))) + (let ((a0-2 (allocate-data-memory-for-tag! this tag))) (when a0-2 (let* ((v1-2 this) (a1-1 a0-2) @@ -749,11 +760,11 @@ This is updated from the entity system used in Crash 2, which had most of these (cond ((zero? (-> a0-2 inlined?)) (length a0-2) - (set! (-> (the-as (pointer pointer) s4-0) 0) arg1) + (set! (-> (the-as (pointer pointer) s4-0) 0) arg2) ) (else (let ((a2-1 (length a0-2))) - (mem-copy! s4-0 arg1 a2-1) + (mem-copy! s4-0 arg2 a2-1) ) ) ) @@ -764,30 +775,31 @@ This is updated from the entity system used in Crash 2, which had most of these ) (defmethod add-32bit-data! ((this res-lump) (arg0 res-tag) (arg1 object)) - "Add a single 32-bit value using add-data." - (set! (-> arg0 inlined?) 1) - (add-data! this arg0 (& arg1)) ;; note, only 32-bits are spilled to the stack here. - ;; og:preserve-this - #| - (local-vars (sv-16 object)) - (set! sv-16 arg1) - (let* ((v1-0 arg0) - (a1-4 (copy-and-set-bf v1-0 :inlined? 1)) + "Add a single 32-bit value using [[add-data!]]." + (let* ((sv-16 arg1) + (v1-0 arg0) + (a1-4 (copy-and-set-field v1-0 inlined? 1)) ) - (add-data! this a1-4 (& sv-16)) - ) - |# + (add-data! this a1-4 (& sv-16)) + ) ) (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)) + "Read curve data and write it to curve-target. Return #t if both + control points and knots data was succesfully read, #f otherwise." (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))) @@ -800,11 +812,18 @@ This is updated from the entity system used in Crash 2, which had most of these ) (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))) @@ -817,32 +836,37 @@ This is updated from the entity system used in Crash 2, which had most of these ) ) -(defmethod mem-usage ((this res-lump) (arg0 memory-usage-block) (arg1 int)) - "Get the memory usage of this lump and its data" - (local-vars (sv-16 int)) +;; WARN: Return type mismatch int vs res-lump. +;; WARN: Using new Jak 2 rtype-of +;; WARN: Using new Jak 2 rtype-of +;; WARN: Using new Jak 2 rtype-of +;; WARN: Using new Jak 2 rtype-of +;; 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)) (let ((s3-0 48) (s2-0 "res") ) (cond - ((logtest? arg1 256) + ((logtest? flags 256) (set! s3-0 44) (set! s2-0 "camera") ) - ((logtest? arg1 64) + ((logtest? flags 64) (set! s3-0 43) (set! s2-0 "entity") ) - ((logtest? arg1 512) + ((logtest? flags 512) (set! s3-0 76) (set! s2-0 "art-joint-geo") ) ) - (set! (-> arg0 length) (max (-> arg0 length) (+ s3-0 1))) - (set! (-> arg0 data s3-0 name) s2-0) - (+! (-> arg0 data s3-0 count) 1) + (set! (-> usage length) (max (-> usage length) (+ s3-0 1))) + (set! (-> usage data s3-0 name) s2-0) + (+! (-> usage data s3-0 count) 1) (let ((v1-19 (asize-of this))) - (+! (-> arg0 data s3-0 used) v1-19) - (+! (-> arg0 data s3-0 total) (logand -16 (+ v1-19 15))) + (+! (-> usage data s3-0 used) v1-19) + (+! (-> usage data s3-0 total) (logand -16 (+ v1-19 15))) ) (dotimes (s1-0 (-> this length)) (when (zero? (-> this tag s1-0 inlined?)) @@ -856,46 +880,47 @@ This is updated from the entity system used in Crash 2, which had most of these ((or (= v1-34 symbol) (or (= v1-34 type) (= v1-34 pair))) ) ((= v1-34 string) - (set! (-> arg0 length) (max (-> arg0 length) (+ s3-0 1))) - (set! (-> arg0 data s3-0 name) s2-0) - (+! (-> arg0 data s3-0 count) 1) + (set! (-> usage length) (max (-> usage length) (+ s3-0 1))) + (set! (-> usage data s3-0 name) s2-0) + (+! (-> usage data s3-0 count) 1) (let ((v1-48 ((method-of-type (rtype-of (the-as int s0-0)) asize-of) (the-as int s0-0)))) - (+! (-> arg0 data s3-0 used) v1-48) - (+! (-> arg0 data s3-0 total) (logand -16 (+ v1-48 15))) + (+! (-> usage data s3-0 used) v1-48) + (+! (-> usage data s3-0 total) (logand -16 (+ v1-48 15))) ) ) ((or (= v1-34 nav-mesh) (= v1-34 collide-mesh)) (let ((a0-48 (the-as (array object) s0-0))) - ((method-of-type (rtype-of a0-48) mem-usage) a0-48 arg0 arg1) + ((method-of-type (rtype-of a0-48) mem-usage) a0-48 usage flags) ) ) ((= v1-34 array) - (set! (-> arg0 length) (max (-> arg0 length) (+ s3-0 1))) - (set! (-> arg0 data s3-0 name) s2-0) - (+! (-> arg0 data s3-0 count) 1) + (set! (-> usage length) (max (-> usage length) (+ s3-0 1))) + (set! (-> usage data s3-0 name) s2-0) + (+! (-> usage data s3-0 count) 1) (let* ((a0-53 (the-as (array object) s0-0)) (v1-68 ((method-of-type (rtype-of a0-53) asize-of) a0-53)) ) - (+! (-> arg0 data s3-0 used) v1-68) - (+! (-> arg0 data s3-0 total) (logand -16 (+ v1-68 15))) + (+! (-> 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 arg0 arg1) + (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 - (set! (-> arg0 length) (max (-> arg0 length) (+ s3-0 1))) - (set! (-> arg0 data s3-0 name) s2-0) - (+! (-> arg0 data s3-0 count) 1) + (set! (-> usage length) (max (-> usage length) (+ s3-0 1))) + (set! (-> usage data s3-0 name) s2-0) + (+! (-> usage data s3-0 count) 1) (let* ((a0-68 (the-as int s0-0)) (v1-96 ((method-of-type (rtype-of a0-68) asize-of) a0-68)) ) - (+! (-> arg0 data s3-0 used) v1-96) - (+! (-> arg0 data s3-0 total) (logand -16 (+ v1-96 15))) + (+! (-> usage data s3-0 used) v1-96) + (+! (-> usage data s3-0 total) (logand -16 (+ v1-96 15))) ) ) ) @@ -908,7 +933,6 @@ This is updated from the entity system used in Crash 2, which had most of these (the-as res-lump 0) ) -;; definition for symbol *res-static-buf*, type pointer (define *res-static-buf* (malloc 'global 128)) diff --git a/goal_src/jak2/engine/game/effect-control.gc b/goal_src/jak2/engine/game/effect-control.gc index d40b1d13d3..001e5359c0 100644 --- a/goal_src/jak2/engine/game/effect-control.gc +++ b/goal_src/jak2/engine/game/effect-control.gc @@ -95,12 +95,7 @@ ((25) (logior! (-> arg0 mask) (sound-mask reg0)) (set! (-> arg0 reg 0) (the-as uint (-> *footstep-surface* material))) - (let* ((s2-3 arg3) - (v1-33 (if (type? s2-3 process-focusable) - s2-3 - ) - ) - ) + (let ((v1-33 (as-type arg3 process-focusable))) (when v1-33 (cond ((focus-test? v1-33 in-air) @@ -110,12 +105,7 @@ (set! (-> arg0 reg 0) (the-as uint 127)) ) (else - (let* ((s2-4 (-> v1-33 root)) - (v1-34 (if (type? s2-4 collide-shape-moving) - s2-4 - ) - ) - ) + (let ((v1-34 (the-as collide-shape (as-type (-> v1-33 root) collide-shape-moving)))) (if v1-34 (set! (-> arg0 reg 0) (the-as uint (-> (the-as collide-shape-moving v1-34) ground-pat material))) ) @@ -163,13 +153,13 @@ (set! (-> this res) (-> s5-0 extra)) (let ((v1-6 (-> (lookup-tag-idx (-> s5-0 extra) 'effect-name 'base -1000000000.0) lo))) (set! (-> this name) (if (>= (the-as int v1-6) 0) - (&-> (-> s5-0 extra tag) v1-6) + (&-> s5-0 extra tag v1-6) (the-as (pointer res-tag) #f) ) ) ) (if (and (-> this name) (= (-> this name 0 key-frame) -1000000000.0)) - (set! (-> this name) (&-> (-> this name) 1)) + (set! (-> this name) (&-> this name 1)) ) (play-effects-from-res-lump this f30-0 f30-0 f30-0) ) @@ -280,21 +270,6 @@ ;; 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) @@ -358,11 +333,7 @@ (= (-> v1-23 data 5) 116) (= (-> v1-23 data 6) 45) ) - (let* ((s3-1 (-> this process root)) - (v1-27 (if (type? s3-1 collide-shape-moving) - s3-1 - ) - ) + (let* ((v1-27 (the-as trsqv (as-type (-> this process root) collide-shape-moving))) (t1-2 (if v1-27 (-> (the-as collide-shape-moving v1-27) ground-pat) *footstep-surface* @@ -421,16 +392,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 @@ -527,16 +497,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 @@ -592,17 +561,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)) ) ) @@ -617,26 +585,6 @@ ) (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 @@ -914,18 +862,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) ) ) ) @@ -968,18 +912,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) ) ) ) @@ -1022,18 +962,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) ) ) ) @@ -1048,9 +984,8 @@ ) (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) @@ -1062,15 +997,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 @@ -1095,22 +1032,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/goal_src/jak2/engine/game/fact-h.gc b/goal_src/jak2/engine/game/fact-h.gc index c899ea2fe9..f749f81495 100644 --- a/goal_src/jak2/engine/game/fact-h.gc +++ b/goal_src/jak2/engine/game/fact-h.gc @@ -357,51 +357,53 @@ ;; 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) ) (defmethod pickup-collectable! ((this fact-info) (arg0 pickup-type) (arg1 float) (arg2 handle)) @@ -423,7 +425,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)) @@ -435,8 +436,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)) @@ -459,8 +461,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/goal_src/jak2/engine/game/game-info.gc b/goal_src/jak2/engine/game/game-info.gc index 2dbae61776..5478c50e12 100644 --- a/goal_src/jak2/engine/game/game-info.gc +++ b/goal_src/jak2/engine/game/game-info.gc @@ -47,8 +47,8 @@ (>= (vector-dot (vector-! (new 'stack-no-clear 'vector) arg0 (-> this trans)) (-> this normal)) 0.0) ) -(defmethod task-complete? ((this game-info) (arg0 game-task)) - (logtest? (-> this task-perm-list data arg0 status) (entity-perm-status complete)) +(defmethod task-complete? ((this game-info) (task game-task)) + (logtest? (-> this task-perm-list data task status) (entity-perm-status complete)) ) (defmethod subtask-index-by-name ((this game-info) (arg0 string)) @@ -100,8 +100,8 @@ (defmethod continue-point-method-10 ((this continue-point) (arg0 load-state)) (let ((v1-0 (lookup-level-info (-> this vis-nick)))) (set! (-> this vis-nick) (if v1-0 - (-> v1-0 name) - ) + (-> v1-0 name) + ) ) ) (dotimes (s4-0 6) @@ -294,7 +294,7 @@ ) (defmethod initialize! ((this game-info) (arg0 symbol) (arg1 game-save) (arg2 string)) - (local-vars (v0-3 int) (sv-96 game-task-node-info) (sv-112 symbol)) + (local-vars (v0-3 int)) (case arg0 (('dead 'life) (+! (-> this total-deaths) 1) @@ -328,20 +328,21 @@ (let ((s1-0 (-> *game-info* sub-task-list))) (dotimes (s0-0 (-> s1-0 length)) (when (nonzero? s0-0) - (set! 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 - ) - ) - ) + (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 + ) + ) + ) + ) ) ) ) @@ -520,43 +521,33 @@ (set! *spawn-actors* #f) (set-blackout-frames (seconds 0.1)) (send-event *target* 'reset) - (let* ((s3-2 (get-process *4k-dead-pool* process #x4000)) - (v1-157 (when s3-2 - (let ((t9-29 (method-of-type process activate))) - (t9-29 s3-2 *default-pool* (symbol->string (-> process symbol)) (the-as pointer #x70004000)) - ) - set-to-run - (let ((s1-2 (-> s3-2 main-thread)) - (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) - ) - ) - ) - (set! sv-112 (-> this mode)) - (let ((t0-3 (get-current-continue-forced this)) - (t1-3 arg1) - ) - (run-next-time-in-process s3-2 s0-1 sv-112 arg0 t0-3 t1-3) - ) - ) - (-> s3-2 ppointer) - ) - ) - ) + (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 @@ -909,25 +900,19 @@ (set! (-> v1-9 origin z) (the float (/ (-> s3-0 z) 16))) ) (set! (-> s5-0 flags) (font-flags shadow kerning large)) - (let ((s3-1 (current-time))) - (until (>= (- (current-time) s3-1) (+ arg2 -75)) - (+! (-> s5-0 origin y) (* -120.0 (seconds-per-frame))) - (let ((s2-0 print-game-text)) - (format (clear *temp-string*) "~4,,0f" arg1) - (s2-0 *temp-string* s5-0 #f 44 (bucket-id debug-no-zbuf1)) - ) - (suspend) + (suspend-for (+ arg2 -75) + (+! (-> s5-0 origin y) (* -120.0 (seconds-per-frame))) + (let ((s2-0 print-game-text)) + (format (clear *temp-string*) "~4,,0f" arg1) + (s2-0 *temp-string* s5-0 #f 44 (bucket-id debug-no-zbuf1)) ) ) - (let ((s4-1 (current-time))) - (until (>= (- (current-time) s4-1) (seconds 0.25)) - (set! (-> s5-0 alpha) (lerp-scale 1.0 0.0 (the float (- (current-time) s4-1)) 0.0 150.0)) - (+! (-> s5-0 origin y) (* -120.0 (seconds-per-frame))) - (let ((s3-2 print-game-text)) - (format (clear *temp-string*) "~4,,0f" arg1) - (s3-2 *temp-string* s5-0 #f 44 (bucket-id debug-no-zbuf1)) - ) - (suspend) + (suspend-for (seconds 0.25) + (set! (-> s5-0 alpha) (lerp-scale 1.0 0.0 (the float (- (current-time) time)) 0.0 150.0)) + (+! (-> s5-0 origin y) (* -120.0 (seconds-per-frame))) + (let ((s3-2 print-game-text)) + (format (clear *temp-string*) "~4,,0f" arg1) + (s3-2 *temp-string* s5-0 #f 44 (bucket-id debug-no-zbuf1)) ) ) ) @@ -1347,11 +1332,8 @@ process (lambda :behavior process ((arg0 string)) - (let ((s5-0 (current-time))) - (until (>= (- (current-time) s5-0) (seconds 10)) - (format *stdcon* "~S~%" arg0) - (suspend) - ) + (suspend-for (seconds 10) + (format *stdcon* "~S~%" arg0) ) (none) ) @@ -1378,14 +1360,14 @@ (defun-debug print-continues () (let ((levels *level-load-list*)) (while (not (null? levels)) - (let ((conts (-> (the-as level-load-info (-> (the-as symbol (car levels)) value)) continues))) - (while (not (null? conts)) - (let ((cont (the-as continue-point (car conts)))) - (if (not (logtest? (-> cont flags) (continue-flags change-continue))) - (format #t "~S~%" (-> cont name)) + (let ((continues (-> (the-as level-load-info (-> (the-as symbol (car levels)) value)) continues))) + (while (not (null? continues)) + (let ((continue (the-as continue-point (car continues)))) + (if (not (logtest? (-> continue flags) (continue-flags change-continue))) + (format #t "~S~%" (-> continue name)) ) ) - (set! conts (cdr conts)) + (set! continues (cdr continues)) ) ) (set! levels (cdr levels)) @@ -1400,18 +1382,7 @@ ) (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:~%") @@ -1422,48 +1393,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) @@ -1474,30 +1447,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/goal_src/jak2/engine/game/game-save.gc b/goal_src/jak2/engine/game/game-save.gc index 756fc623a0..40d490fc4c 100644 --- a/goal_src/jak2/engine/game/game-save.gc +++ b/goal_src/jak2/engine/game/game-save.gc @@ -160,7 +160,6 @@ ) (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)) @@ -186,19 +185,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))) @@ -210,31 +205,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)))) ) ) ) @@ -391,7 +376,7 @@ (set! (-> s1-0 elt-count) (+ (length arg1) 1)) (set! (-> s1-0 elt-size) (the-as uint 1)) ) - (copy-charp<-charp (the-as (pointer uint8) (-> (the-as (inline-array game-save-tag) s2-2) 1)) (-> arg1 data)) + (copy-charp<-charp (-> (the-as (inline-array game-save-tag) s2-2) 1 user-uint8) (-> arg1 data)) (let ((v1-59 (the-as (inline-array game-save-tag) @@ -410,7 +395,7 @@ (set! (-> a0-31 elt-size) (the-as uint 8)) ) (let ((s3-1 (-> v1-59 1))) - (save! (-> *display* base-clock) (the-as (pointer uint64) s3-1)) + (save! (-> *display* base-clock) (&-> s3-1 user-uint64)) (let ((v1-63 (the-as object (&+ s3-1 16)))) (let ((a0-33 (-> (the-as (inline-array game-save-tag) v1-63) 0))) (set! (-> a0-33 elt-type) (game-save-elt game-time)) @@ -418,7 +403,7 @@ (set! (-> a0-33 elt-size) (the-as uint 8)) ) (let ((s3-2 (&+ (the-as game-save-tag v1-63) 16))) - (save! (-> *display* game-clock) (the-as (pointer uint64) s3-2)) + (save! (-> *display* game-clock) (&-> s3-2 user-uint64)) (let ((v1-67 (the-as object (&+ s3-2 16)))) (let ((a0-35 (-> (the-as (inline-array game-save-tag) v1-67) 0))) (set! (-> a0-35 elt-type) (game-save-elt total-game-time)) @@ -426,7 +411,7 @@ (set! (-> a0-35 elt-size) (the-as uint 8)) ) (let ((s3-3 (&+ (the-as game-save-tag v1-67) 16))) - (save! (-> *display* total-game-clock) (the-as (pointer uint64) s3-3)) + (save! (-> *display* total-game-clock) (&-> s3-3 user-uint64)) (let ((v1-71 (the-as object (&+ s3-3 16)))) (let ((a0-37 (-> (the-as (inline-array game-save-tag) v1-71) 0))) (set! (-> a0-37 elt-type) (game-save-elt real-time)) @@ -434,7 +419,7 @@ (set! (-> a0-37 elt-size) (the-as uint 8)) ) (let ((s3-4 (&+ (the-as game-save-tag v1-71) 16))) - (save! (-> *display* real-clock) (the-as (pointer uint64) s3-4)) + (save! (-> *display* real-clock) (&-> s3-4 user-uint64)) (let ((v1-75 (the-as object (&+ s3-4 16)))) (let ((a0-39 (-> (the-as (inline-array game-save-tag) v1-75) 0))) (set! (-> a0-39 elt-type) (game-save-elt frame-time)) @@ -442,7 +427,7 @@ (set! (-> a0-39 elt-size) (the-as uint 8)) ) (let ((s3-5 (&+ (the-as game-save-tag v1-75) 16))) - (save! (-> *display* frame-clock) (the-as (pointer uint64) s3-5)) + (save! (-> *display* frame-clock) (&-> s3-5 user-uint64)) (let ((v1-79 (the-as object (&+ s3-5 16)))) (let ((a0-41 (-> (the-as (inline-array game-save-tag) v1-79) 0))) (set! (-> a0-41 elt-type) (game-save-elt real-frame-time)) @@ -450,7 +435,7 @@ (set! (-> a0-41 elt-size) (the-as uint 8)) ) (let ((s3-6 (&+ (the-as game-save-tag v1-79) 16))) - (save! (-> *display* real-frame-clock) (the-as (pointer uint64) s3-6)) + (save! (-> *display* real-frame-clock) (&-> s3-6 user-uint64)) (let ((v1-83 (the-as object (&+ s3-6 16)))) (let ((a0-43 (-> (the-as (inline-array game-save-tag) v1-83) 0))) (set! (-> a0-43 elt-type) (game-save-elt session-time)) @@ -458,7 +443,7 @@ (set! (-> a0-43 elt-size) (the-as uint 8)) ) (let ((s3-7 (&+ (the-as game-save-tag v1-83) 16))) - (save! (-> *display* session-clock) (the-as (pointer uint64) s3-7)) + (save! (-> *display* session-clock) (&-> s3-7 user-uint64)) (let ((v1-87 (the-as object (&+ s3-7 16)))) (let ((a0-45 (-> (the-as (inline-array game-save-tag) v1-87) 0))) (set! (-> a0-45 elt-type) (game-save-elt bg-time)) @@ -466,7 +451,7 @@ (set! (-> a0-45 elt-size) (the-as uint 8)) ) (let ((s3-8 (&+ (the-as game-save-tag v1-87) 16))) - (save! (-> *display* bg-clock) (the-as (pointer uint64) s3-8)) + (save! (-> *display* bg-clock) (&-> s3-8 user-uint64)) (let ((s3-9 (the-as object (&+ s3-8 16)))) (let ((s4-2 (-> s4-1 name))) (let ((s2-3 (-> (the-as (inline-array game-save-tag) s3-9) 0))) @@ -474,7 +459,7 @@ (set! (-> s2-3 elt-count) (+ (length s4-2) 1)) (set! (-> s2-3 elt-size) (the-as uint 1)) ) - (copy-charp<-charp (the-as (pointer uint8) (&+ (the-as game-save-tag s3-9) 16)) (-> s4-2 data)) + (copy-charp<-charp (-> (&+ (the-as game-save-tag s3-9) 16) user-uint8) (-> s4-2 data)) ) (let ((v1-99 (the-as object @@ -1166,7 +1151,6 @@ (the int (-> (the-as (inline-array game-save-tag) v1-0) 0 user-float0)) ) ) - (else (format 0 "PC PORT: Skipping setting from game save, its stored in the pc-settings now~%")) ) (set! v1-0 (&+ (the-as pointer v1-0) @@ -1218,14 +1202,11 @@ (((game-save-elt base-time)) ) (((game-save-elt game-time)) - (load! (-> *display* game-clock) (the-as (pointer uint64) (-> (the-as (inline-array game-save-tag) s4-0) 1))) + (load! (-> *display* game-clock) (&-> (the-as (inline-array game-save-tag) s4-0) 1 user-uint64)) (set! (-> *game-info* kiosk-timeout) (the-as uint (-> *display* game-clock frame-counter))) ) (((game-save-elt total-game-time)) - (load! - (-> *display* total-game-clock) - (the-as (pointer uint64) (-> (the-as (inline-array game-save-tag) s4-0) 1)) - ) + (load! (-> *display* total-game-clock) (&-> (the-as (inline-array game-save-tag) s4-0) 1 user-uint64)) (set! (-> *game-info* kiosk-timeout) (the-as uint (-> *display* game-clock frame-counter))) ) (((game-save-elt continue)) @@ -1654,12 +1635,8 @@ (new 'stack 'font-context *font-default-matrix* 32 320 0.0 (font-color default) (font-flags shadow kerning)) ) ) - (let ((v1-5 gp-0)) - (set! (-> v1-5 width) (the float 440)) - ) - (let ((v1-6 gp-0)) - (set! (-> v1-6 height) (the float 80)) - ) + (set-width! gp-0 440) + (set-height! gp-0 80) (set! (-> gp-0 flags) (font-flags shadow kerning)) (format (clear *temp-string*) "~S / ~S ~D~%" (-> self mode) (-> self state name) (-> self which)) (print-game-text *temp-string* gp-0 #f 44 (bucket-id progress)) @@ -1670,15 +1647,9 @@ (new 'stack 'font-context *font-default-matrix* 20 80 0.0 (font-color default) (font-flags shadow kerning)) ) ) - (let ((v1-17 gp-1)) - (set! (-> v1-17 scale) 0.8) - ) - (let ((v1-18 gp-1)) - (set! (-> v1-18 width) (the float 432)) - ) - (let ((v1-19 gp-1)) - (set! (-> v1-19 height) (the float 20)) - ) + (set-scale! gp-1 0.8) + (set-width! gp-1 432) + (set-height! gp-1 20) (set! (-> gp-1 flags) (font-flags shadow kerning middle middle-vert large)) (when (and (>= 1 (-> *game-info* auto-save-count)) (-> self next-state) (= (-> self next-state name) 'save)) (print-game-text @@ -1690,12 +1661,8 @@ ) (set! (-> gp-1 origin x) 20.0) (set! (-> gp-1 origin y) 130.0) - (let ((v1-30 gp-1)) - (set! (-> v1-30 scale) 0.7) - ) - (let ((v1-31 gp-1)) - (set! (-> v1-31 height) (the float 200)) - ) + (set-scale! gp-1 0.7) + (set-height! gp-1 200) (let ((s5-2 print-game-text)) (format (clear *temp-string*) (lookup-text! *common-text* (text-id progress-memcard-dont-remove) #f) 1) (s5-2 *temp-string* gp-1 #f 44 (bucket-id progress)) @@ -2025,7 +1992,7 @@ auto-save-post 0 (label cfg-5) (set! (-> self result) - (mc-save (-> self card) (-> self which) (&-> (-> self save) type) (the-as int (-> self save info-int32))) + (mc-save (-> self card) (-> self which) (&-> self save type) (the-as int (-> self save info-int32))) ) (when (!= (-> self result) (mc-status-code ok)) (suspend) diff --git a/goal_src/jak2/engine/game/task/task-arrow.gc b/goal_src/jak2/engine/game/task/task-arrow.gc index 18c3fa68ad..256eccdf0d 100644 --- a/goal_src/jak2/engine/game/task/task-arrow.gc +++ b/goal_src/jak2/engine/game/task/task-arrow.gc @@ -136,16 +136,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)) ) ) ) @@ -193,12 +191,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/goal_src/jak2/engine/geometry/cylinder.gc b/goal_src/jak2/engine/geometry/cylinder.gc index 3938559bd0..4ef9faff11 100644 --- a/goal_src/jak2/engine/geometry/cylinder.gc +++ b/goal_src/jak2/engine/geometry/cylinder.gc @@ -40,21 +40,6 @@ (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) @@ -79,76 +64,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) @@ -227,7 +221,6 @@ (defmethod debug-draw ((this cylinder-flat) (arg0 vector4w)) - (local-vars (sv-448 vector)) (rlet ((vf0 :class vf) (vf4 :class vf) (vf5 :class vf) @@ -248,14 +241,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/goal_src/jak2/engine/geometry/path-h.gc b/goal_src/jak2/engine/geometry/path-h.gc index 25008bc30e..260cf8e723 100644 --- a/goal_src/jak2/engine/geometry/path-h.gc +++ b/goal_src/jak2/engine/geometry/path-h.gc @@ -19,10 +19,11 @@ ;; DECOMP BEGINS (deftype path-control (basic) - "An abstraction around a [[curve]], providing tools such as: -- debug drawing -- conveniant vertex accessing -- vertex finding/searching algorithms" + "The path-control is a reference a path data, which is just a list of points. +Although it contains a `curve`, the knot part is not populated, so it's just treated as +a bunch of line segments from the control points. +The child class curve-control does fill out the knot data and is a proper b-spline. +These path-controls are typically allocated on a process heap." ((flags path-control-flag) (name symbol) (process process-drawable) @@ -55,7 +56,7 @@ (set! (-> path-control method-table 9) nothing) (deftype curve-control (path-control) - "Identical in terms of data to a [[path-control]] but has different implementation" + "A curve-control is like a path control, but it has both control points and knot points." () (:methods (new (symbol type process symbol float) _type_) @@ -68,21 +69,22 @@ ;; WARN: Return type mismatch object vs path-control. (defmethod new path-control ((allocation symbol) (type-to-make type) - (arg0 process) - (arg1 symbol) - (arg2 float) - (arg3 entity) - (arg4 symbol) + (proc process) + (lump-name symbol) + (lump-time float) + (lump-actor entity) + (must-exist symbol) ) - (local-vars (v0-3 object) (sv-16 res-tag) (sv-32 float)) - (set! sv-32 arg2) - (let ((s0-0 arg3) - (s1-0 arg4) + "Allocate a new path-control, set up the curve to point to the specified lump data." + (local-vars (v0-3 object)) + (let ((sv-32 lump-time) + (s0-0 lump-actor) + (s1-0 must-exist) ) (if (not s0-0) - (set! s0-0 (-> arg0 entity)) + (set! s0-0 (-> proc entity)) ) - (when (= arg1 'path) + (when (= lump-name 'path) (let ((v0-0 (entity-actor-lookup s0-0 'path-actor 0))) (if v0-0 (set! s0-0 v0-0) @@ -90,22 +92,16 @@ ) ) (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 arg1) - (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 (set! s2-0 (object-new allocation type-to-make (the-as int (-> type-to-make size)))) (set! v0-3 (cond ((nonzero? (the-as path-control s2-0)) - (set! (-> (the-as path-control s2-0) process) (the-as process-drawable arg0)) - (set! (-> (the-as path-control s2-0) name) arg1) + (set! (-> (the-as path-control s2-0) process) (the-as process-drawable proc)) + (set! (-> (the-as path-control s2-0) name) lump-name) (set! (-> (the-as path-control s2-0) curve cverts) (the-as (inline-array vector) s0-1)) (set! v0-3 (-> sv-16 elt-count)) (set! (-> (the-as path-control s2-0) curve num-cverts) (the-as int v0-3)) @@ -123,8 +119,8 @@ (cond ((nonzero? (the-as path-control s2-0)) (logior! (-> (the-as path-control s2-0) flags) (path-control-flag not-found)) - (set! (-> (the-as path-control s2-0) process) (the-as process-drawable arg0)) - (set! (-> (the-as path-control s2-0) name) arg1) + (set! (-> (the-as path-control s2-0) process) (the-as process-drawable proc)) + (set! (-> (the-as path-control s2-0) name) lump-name) (set! (-> (the-as path-control s2-0) curve cverts) (the-as (inline-array vector) #f)) (set! (-> (the-as path-control s2-0) curve num-cverts) 0) 0 diff --git a/goal_src/jak2/engine/geometry/vol.gc b/goal_src/jak2/engine/geometry/vol.gc index dd291a7a77..55680e3c58 100644 --- a/goal_src/jak2/engine/geometry/vol.gc +++ b/goal_src/jak2/engine/geometry/vol.gc @@ -19,140 +19,143 @@ ) (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/goal_src/jak2/engine/gfx/background/tie/tie.gc b/goal_src/jak2/engine/gfx/background/tie/tie.gc index 86a692792c..7fbd744b09 100644 --- a/goal_src/jak2/engine/gfx/background/tie/tie.gc +++ b/goal_src/jak2/engine/gfx/background/tie/tie.gc @@ -8,6 +8,7 @@ ;; DECOMP BEGINS (defmethod login ((this tie-fragment)) + "Initialize the object after it is loaded." (let ((s5-0 (the-as adgif-shader (-> this gif-ref))) (s4-0 (/ (-> this tex-count) (the-as uint 5))) ) @@ -49,6 +50,7 @@ this ) +;; WARN: Return type mismatch uint vs int. (defmethod asize-of ((this drawable-inline-array-instance-tie)) (the-as int (+ (-> drawable-inline-array-instance-tie size) (* (+ (-> this length) -1) 64))) ) @@ -74,36 +76,38 @@ this ) + (defmethod login ((this prototype-tie)) + "Initialize the object after it is loaded." (dotimes (s5-0 (-> this length)) (login (-> this data s5-0)) ) this ) -(defmethod mem-usage ((this drawable-tree-instance-tie) (arg0 memory-usage-block) (arg1 int)) - (set! (-> arg0 length) (max 1 (-> arg0 length))) - (set! (-> arg0 data 0 name) (symbol->string 'drawable-group)) - (+! (-> arg0 data 0 count) 1) +(defmethod mem-usage ((this drawable-tree-instance-tie) (usage memory-usage-block) (flags int)) + (set! (-> usage length) (max 1 (-> usage length))) + (set! (-> usage data 0 name) (symbol->string 'drawable-group)) + (+! (-> usage data 0 count) 1) (let ((v1-7 32)) - (+! (-> arg0 data 0 used) v1-7) - (+! (-> arg0 data 0 total) (logand -16 (+ v1-7 15))) + (+! (-> usage data 0 used) v1-7) + (+! (-> usage data 0 total) (logand -16 (+ v1-7 15))) ) (dotimes (s3-0 (-> this length)) - (mem-usage (-> this data s3-0) arg0 arg1) + (mem-usage (-> this data s3-0) usage flags) ) - (mem-usage (-> this prototypes prototype-array-tie) arg0 (logior arg1 1)) + (mem-usage (-> this prototypes prototype-array-tie) usage (logior flags 1)) this ) -(defmethod mem-usage ((this tie-fragment) (arg0 memory-usage-block) (arg1 int)) - (when (logtest? arg1 2) +(defmethod mem-usage ((this tie-fragment) (usage memory-usage-block) (flags int)) + (when (logtest? flags 2) (let ((v1-3 (* (-> this color-count) 4)) (a0-2 (cond - ((logtest? arg1 4) + ((logtest? flags 4) 20 ) - ((logtest? arg1 8) + ((logtest? flags 8) 21 ) (else @@ -112,54 +116,54 @@ ) ) ) - (+! (-> arg0 data a0-2 count) 1) - (+! (-> arg0 data a0-2 used) v1-3) - (+! (-> arg0 data a0-2 total) (logand -4 (+ v1-3 3))) + (+! (-> usage data a0-2 count) 1) + (+! (-> usage data a0-2 used) v1-3) + (+! (-> usage data a0-2 total) (logand -4 (+ v1-3 3))) ) - (set! (-> arg0 length) (max 23 (-> arg0 length))) + (set! (-> usage length) (max 23 (-> usage length))) (set! this this) (goto cfg-13) ) - (set! (-> arg0 length) (max 18 (-> arg0 length))) - (set! (-> arg0 data 9 name) "tie-fragment") - (set! (-> arg0 data 10 name) "tie-gif") - (set! (-> arg0 data 11 name) "tie-points") - (set! (-> arg0 data 12 name) "tie-colors") - (set! (-> arg0 data 14 name) "tie-debug") - (set! (-> arg0 data 13 name) "tie-draw-points") - (set! (-> arg0 data 17 name) "tie-generic") - (+! (-> arg0 data 9 count) 1) + (set! (-> usage length) (max 18 (-> usage length))) + (set! (-> usage data 9 name) "tie-fragment") + (set! (-> usage data 10 name) "tie-gif") + (set! (-> usage data 11 name) "tie-points") + (set! (-> usage data 12 name) "tie-colors") + (set! (-> usage data 14 name) "tie-debug") + (set! (-> usage data 13 name) "tie-draw-points") + (set! (-> usage data 17 name) "tie-generic") + (+! (-> usage data 9 count) 1) (let ((v1-21 (asize-of this))) - (+! (-> arg0 data 9 used) v1-21) - (+! (-> arg0 data 9 total) (logand -16 (+ v1-21 15))) + (+! (-> usage data 9 used) v1-21) + (+! (-> usage data 9 total) (logand -16 (+ v1-21 15))) ) (let ((v1-26 (* (-> this gif-count) 16))) - (+! (-> arg0 data 10 count) (-> this tex-count)) - (+! (-> arg0 data 10 used) v1-26) - (+! (-> arg0 data 10 total) (logand -16 (+ v1-26 15))) + (+! (-> usage data 10 count) (-> this tex-count)) + (+! (-> usage data 10 used) v1-26) + (+! (-> usage data 10 total) (logand -16 (+ v1-26 15))) ) (let ((v1-31 (* (-> this vertex-count) 16))) - (+! (-> arg0 data 11 count) (-> this vertex-count)) - (+! (-> arg0 data 11 used) v1-31) - (+! (-> arg0 data 11 total) (logand -16 (+ v1-31 15))) + (+! (-> usage data 11 count) (-> this vertex-count)) + (+! (-> usage data 11 used) v1-31) + (+! (-> usage data 11 total) (logand -16 (+ v1-31 15))) ) (let ((v1-36 (* (-> this dp-qwc) 16))) - (+! (-> arg0 data 13 count) (* (-> this dp-qwc) 16)) - (+! (-> arg0 data 13 used) v1-36) - (+! (-> arg0 data 13 total) (logand -16 (+ v1-36 15))) + (+! (-> usage data 13 count) (* (-> this dp-qwc) 16)) + (+! (-> usage data 13 used) v1-36) + (+! (-> usage data 13 total) (logand -16 (+ v1-36 15))) ) (let ((v1-41 (* (-> this generic-count) 16))) - (+! (-> arg0 data 17 count) 1) - (+! (-> arg0 data 17 used) v1-41) - (+! (-> arg0 data 17 total) (logand -16 (+ v1-41 15))) + (+! (-> usage data 17 count) 1) + (+! (-> usage data 17 used) v1-41) + (+! (-> usage data 17 total) (logand -16 (+ v1-41 15))) ) (let ((s4-0 (-> this debug debug-lines))) (when (nonzero? s4-0) (dotimes (s3-0 (-> s4-0 length)) - (+! (-> arg0 data 14 count) (-> s4-0 s3-0 length)) + (+! (-> usage data 14 count) (-> s4-0 s3-0 length)) (let ((v1-52 (asize-of (-> s4-0 s3-0)))) - (+! (-> arg0 data 12 used) v1-52) - (+! (-> arg0 data 12 total) (logand -16 (+ v1-52 15))) + (+! (-> usage data 12 used) v1-52) + (+! (-> usage data 12 total) (logand -16 (+ v1-52 15))) ) ) ) @@ -168,29 +172,29 @@ this ) -(defmethod mem-usage ((this instance-tie) (arg0 memory-usage-block) (arg1 int)) - (set! (-> arg0 length) (max 19 (-> arg0 length))) - (set! (-> arg0 data 18 name) "instance-tie") - (+! (-> arg0 data 18 count) 1) +(defmethod mem-usage ((this instance-tie) (usage memory-usage-block) (flags int)) + (set! (-> usage length) (max 19 (-> usage length))) + (set! (-> usage data 18 name) "instance-tie") + (+! (-> usage data 18 count) 1) (let ((v1-6 (asize-of this))) - (+! (-> arg0 data 18 used) v1-6) - (+! (-> arg0 data 18 total) (logand -16 (+ v1-6 15))) + (+! (-> usage data 18 used) v1-6) + (+! (-> usage data 18 total) (logand -16 (+ v1-6 15))) ) (when (nonzero? (-> this color-indices)) - (set! (-> arg0 length) (max 24 (-> arg0 length))) - (set! (-> arg0 data 23 name) "instance-tie-colors*") - (set! (-> arg0 data 19 name) "instance-tie-colors0") - (set! (-> arg0 data 20 name) "instance-tie-colors1") - (set! (-> arg0 data 21 name) "instance-tie-colors2") - (set! (-> arg0 data 22 name) "instance-tie-colors3") - (+! (-> arg0 data 23 count) 1) + (set! (-> usage length) (max 24 (-> usage length))) + (set! (-> usage data 23 name) "instance-tie-colors*") + (set! (-> usage data 19 name) "instance-tie-colors0") + (set! (-> usage data 20 name) "instance-tie-colors1") + (set! (-> usage data 21 name) "instance-tie-colors2") + (set! (-> usage data 22 name) "instance-tie-colors3") + (+! (-> usage data 23 count) 1) (let ((s3-0 (-> this bucket-ptr))) - (+ (-> arg0 data 19 used) (-> arg0 data 20 used) (-> arg0 data 21 used) (-> arg0 data 22 used)) + (+ (-> usage data 19 used) (-> usage data 20 used) (-> usage data 21 used) (-> usage data 22 used)) (dotimes (s2-0 4) (let ((a0-10 (-> s3-0 tie-geom s2-0))) (when (nonzero? a0-10) (let ((t9-1 (method-of-object a0-10 mem-usage)) - (a1-2 arg0) + (a1-2 usage) (v1-29 s2-0) ) (t9-1 a0-10 a1-2 (logior (logior (cond @@ -209,7 +213,7 @@ ) 2 ) - arg1 + flags ) ) ) @@ -221,53 +225,54 @@ this ) -(defmethod mem-usage ((this drawable-inline-array-instance-tie) (arg0 memory-usage-block) (arg1 int)) - (set! (-> arg0 length) (max 1 (-> arg0 length))) - (set! (-> arg0 data 0 name) (symbol->string 'drawable-group)) - (+! (-> arg0 data 0 count) 1) +(defmethod mem-usage ((this drawable-inline-array-instance-tie) (usage memory-usage-block) (flags int)) + (set! (-> usage length) (max 1 (-> usage length))) + (set! (-> usage data 0 name) (symbol->string 'drawable-group)) + (+! (-> usage data 0 count) 1) (let ((v1-7 32)) - (+! (-> arg0 data 0 used) v1-7) - (+! (-> arg0 data 0 total) (logand -16 (+ v1-7 15))) + (+! (-> usage data 0 used) v1-7) + (+! (-> usage data 0 total) (logand -16 (+ v1-7 15))) ) (dotimes (s3-0 (-> this length)) - (mem-usage (-> this data s3-0) arg0 arg1) + (mem-usage (-> this data s3-0) usage flags) ) this ) -(defmethod mem-usage ((this prototype-tie) (arg0 memory-usage-block) (arg1 int)) - (set! (-> arg0 length) (max 1 (-> arg0 length))) - (set! (-> arg0 data 0 name) (symbol->string 'drawable-group)) - (+! (-> arg0 data 0 count) 1) +(defmethod mem-usage ((this prototype-tie) (usage memory-usage-block) (flags int)) + (set! (-> usage length) (max 1 (-> usage length))) + (set! (-> usage data 0 name) (symbol->string 'drawable-group)) + (+! (-> usage data 0 count) 1) (let ((v1-7 32)) - (+! (-> arg0 data 0 used) v1-7) - (+! (-> arg0 data 0 total) (logand -16 (+ v1-7 15))) + (+! (-> usage data 0 used) v1-7) + (+! (-> usage data 0 total) (logand -16 (+ v1-7 15))) ) (dotimes (s3-0 (-> this length)) - (mem-usage (-> this data s3-0) arg0 arg1) + (mem-usage (-> this data s3-0) usage flags) ) this ) +;; WARN: Return type mismatch uint vs int. (defmethod asize-of ((this prototype-tie)) (the-as int (+ (-> prototype-tie size) (* (+ (-> this length) -1) 64))) ) (deftype tie-consts (structure) - ((data uint32 40 :offset 0) - (vector vector 10 :offset 0) - (quads uint128 10 :offset 0) - (adgif gs-gif-tag :inline :offset 0) - (strgif gs-gif-tag :inline :offset 16) - (extra vector :inline :offset 32) - (gifbufs vector :inline :offset 48) - (clrbufs qword :inline :offset 64) - (misc qword :inline :offset 80) - (atestgif gs-gif-tag :inline :offset 96) - (alpha gs-adcmd :inline :offset 112) - (atest gs-adcmd 2 :inline :offset 128) - (atest-tra gs-adcmd :inline :offset 128) - (atest-def gs-adcmd :inline :offset 144) + ((data uint32 40 :offset 0) + (vector vector 10 :overlay-at (-> data 0)) + (quads uint128 10 :overlay-at (-> data 0)) + (adgif gs-gif-tag :inline :overlay-at (-> vector 0)) + (strgif gs-gif-tag :inline :overlay-at (-> vector 4)) + (extra vector :inline :overlay-at (-> vector 8)) + (gifbufs vector :inline :overlay-at (-> data 12)) + (clrbufs qword :inline :overlay-at (-> data 16)) + (misc qword :inline :overlay-at (-> data 20)) + (atestgif gs-gif-tag :inline :overlay-at (-> data 24)) + (alpha gs-adcmd :inline :overlay-at (-> data 28)) + (atest gs-adcmd 2 :inline :overlay-at (-> data 32)) + (atest-tra gs-adcmd :inline :overlay-at (-> atest 0)) + (atest-def gs-adcmd :inline :overlay-at (-> atest 1)) ) ) @@ -576,31 +581,28 @@ ) ) +;; 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) ) ) ) (none) ) +;; 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) @@ -615,23 +617,16 @@ (-> 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) ) ) ) (none) ) - - - - diff --git a/goal_src/jak2/engine/gfx/foreground/eye.gc b/goal_src/jak2/engine/gfx/foreground/eye.gc index 4444597f9f..d1a22a5b5d 100644 --- a/goal_src/jak2/engine/gfx/foreground/eye.gc +++ b/goal_src/jak2/engine/gfx/foreground/eye.gc @@ -63,7 +63,6 @@ ) (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)) @@ -71,8 +70,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)) @@ -273,7 +272,6 @@ ) (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)) @@ -281,8 +279,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)) @@ -540,7 +538,6 @@ ) (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)) @@ -548,8 +545,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)) @@ -750,7 +747,6 @@ ) (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)) @@ -758,8 +754,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)) @@ -1260,12 +1256,7 @@ ) (convert-eye-data s2-0 (-> s5-0 eye-anim data (* s0-1 2) dword)) (convert-eye-data s1-0 (-> s5-0 eye-anim data (* s3-2 2) dword)) - (vector4-lerp! - (the-as vector (-> s4-0 left)) - (the-as vector (-> s2-0 data)) - (the-as vector (-> s1-0 data)) - f30-0 - ) + (vector4-lerp! (the-as vector (-> s4-0 left)) (-> s2-0 data 0) (-> s1-0 data 0) f30-0) (vector4-lerp! (the-as vector (&-> s4-0 left iris-scale)) (the-as vector (&-> s2-0 iris-scale)) @@ -1275,12 +1266,7 @@ (convert-eye-data s2-0 (-> s5-0 eye-anim data (+ (* s0-1 2) 1) dword)) (convert-eye-data s1-0 (-> s5-0 eye-anim data (+ (* s3-2 2) 1) dword)) ) - (vector4-lerp! - (the-as vector (-> s4-0 right)) - (the-as vector (-> s2-0 data)) - (the-as vector (-> s1-0 data)) - f30-0 - ) + (vector4-lerp! (the-as vector (-> s4-0 right)) (-> s2-0 data 0) (-> s1-0 data 0) f30-0) (vector4-lerp! (the-as vector (&-> s4-0 right iris-scale)) (the-as vector (&-> s2-0 iris-scale)) diff --git a/goal_src/jak2/engine/gfx/foreground/lightning.gc b/goal_src/jak2/engine/gfx/foreground/lightning.gc index 11b08e5ff3..c9201f266c 100644 --- a/goal_src/jak2/engine/gfx/foreground/lightning.gc +++ b/goal_src/jak2/engine/gfx/foreground/lightning.gc @@ -39,12 +39,12 @@ ) (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) @@ -79,7 +79,6 @@ ) (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)))) @@ -90,29 +89,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) @@ -162,7 +162,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) @@ -171,78 +170,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) @@ -326,7 +330,7 @@ ) (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 @@ -335,8 +339,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)))) ) @@ -368,27 +372,19 @@ ) (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 (the-as vector (-> sv-24 data)) (-> sv-24 data s4-0)))) + (let ((f1-1 (vector-vector-distance (-> sv-24 data 0) (-> sv-24 data s4-0)))) (set! (-> s5-0 box-size) (* (-> sv-16 box-size) (fmax 1.0 (fmin 5.0 (/ f1-1 (* 4096.0 (the float (-> sv-16 adjust-distance))))))) ) @@ -458,22 +454,7 @@ ) (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) @@ -487,255 +468,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! (the-as adgif-shader (-> sv-176 shader)) sv-32) - (adgif-shader-update! (the-as adgif-shader (-> sv-176 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/goal_src/jak2/engine/gfx/foreground/ripple.gc b/goal_src/jak2/engine/gfx/foreground/ripple.gc index 394c317f53..d5703ca663 100644 --- a/goal_src/jak2/engine/gfx/foreground/ripple.gc +++ b/goal_src/jak2/engine/gfx/foreground/ripple.gc @@ -144,9 +144,9 @@ ) (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) ) @@ -180,20 +180,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/goal_src/jak2/engine/gfx/mood/mood-funcs2.gc b/goal_src/jak2/engine/gfx/mood/mood-funcs2.gc index 91847ce638..cd8fb2d8f3 100644 --- a/goal_src/jak2/engine/gfx/mood/mood-funcs2.gc +++ b/goal_src/jak2/engine/gfx/mood/mood-funcs2.gc @@ -194,12 +194,7 @@ ) (let ((f0-5 (get-sphere-interp a0-10 a1-4 61440.0 69632.0))) (set-vector! (-> arg0 times 0) 1.0 1.0 1.0 1.0) - (vector-lerp! - (the-as vector (-> arg0 times)) - (the-as vector (-> arg0 times)) - (the-as vector (-> *level* default-level mood-context times)) - f0-5 - ) + (vector-lerp! (-> arg0 times 0) (-> arg0 times 0) (-> *level* default-level mood-context times 0) f0-5) ) ) ) @@ -699,12 +694,7 @@ ) (set-vector! a0-121 -364544.0 0.0 5324800.0 1.0) (let ((f0-76 (get-sphere-interp a0-121 a1-40 139264.0 24576.0))) - (vector-lerp! - (the-as vector (-> arg0 times)) - (the-as vector (-> arg0 times)) - (the-as vector (-> *level* default-level mood-context times)) - f0-76 - ) + (vector-lerp! (-> arg0 times 0) (-> arg0 times 0) (-> *level* default-level mood-context times 0) f0-76) ) ) ) @@ -1891,7 +1881,6 @@ (defun update-under-lights ((arg0 mood-context)) - (local-vars (sv-80 vector)) (rlet ((vf0 :class vf) (vf4 :class vf) (vf5 :class vf) @@ -1924,28 +1913,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) ) ) ) @@ -2285,7 +2273,6 @@ ;; ERROR: Stack slot load at 16 mismatch: defined as size 4, got size 16 ;; ERROR: Stack slot load at 32 mismatch: defined as size 4, got size 16 (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 @@ -2296,31 +2283,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/goal_src/jak2/engine/gfx/mood/mood.gc b/goal_src/jak2/engine/gfx/mood/mood.gc index 1e227377f3..c73bc49bf9 100644 --- a/goal_src/jak2/engine/gfx/mood/mood.gc +++ b/goal_src/jak2/engine/gfx/mood/mood.gc @@ -197,7 +197,7 @@ ) ) (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) @@ -245,18 +245,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! (the-as vector s1-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/goal_src/jak2/engine/gfx/ocean/ocean-mid.gc b/goal_src/jak2/engine/gfx/ocean/ocean-mid.gc index 6cd7e1d7a6..4e7f4e5763 100644 --- a/goal_src/jak2/engine/gfx/ocean/ocean-mid.gc +++ b/goal_src/jak2/engine/gfx/ocean/ocean-mid.gc @@ -532,9 +532,8 @@ ;; 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) @@ -994,43 +993,44 @@ ) (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))) - ;; og:preserve-this - (when (sphere-cull-for-ocean 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))) + ;; og:preserve-this + (when (sphere-cull-for-ocean 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) @@ -1043,7 +1043,7 @@ ) (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) @@ -1100,23 +1100,15 @@ (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)))))) ;; og:preserve-this (when (sphere-cull-for-ocean 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/goal_src/jak2/engine/gfx/ocean/ocean-near.gc b/goal_src/jak2/engine/gfx/ocean/ocean-near.gc index 013c9463f8..e02f0b5043 100644 --- a/goal_src/jak2/engine/gfx/ocean/ocean-near.gc +++ b/goal_src/jak2/engine/gfx/ocean/ocean-near.gc @@ -651,7 +651,6 @@ ) (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))) ) @@ -674,8 +673,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/goal_src/jak2/engine/gfx/ocean/ocean-texture.gc b/goal_src/jak2/engine/gfx/ocean/ocean-texture.gc index b6c44ba387..5619087e27 100644 --- a/goal_src/jak2/engine/gfx/ocean/ocean-texture.gc +++ b/goal_src/jak2/engine/gfx/ocean/ocean-texture.gc @@ -603,7 +603,6 @@ ) (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)) @@ -617,9 +616,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) @@ -748,7 +748,6 @@ ) (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 @@ -802,34 +801,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/goal_src/jak2/engine/gfx/ocean/ocean-transition.gc b/goal_src/jak2/engine/gfx/ocean/ocean-transition.gc index a2d1cd8341..a69d72cc3e 100644 --- a/goal_src/jak2/engine/gfx/ocean/ocean-transition.gc +++ b/goal_src/jak2/engine/gfx/ocean/ocean-transition.gc @@ -486,21 +486,22 @@ ) (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 @@ -632,34 +633,36 @@ ) (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-for-ocean sv-36) ;; modified - (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))) + ;; og:preserve-this + (when (sphere-cull-for-ocean 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) ) ) ) @@ -705,16 +708,6 @@ ) (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)) @@ -722,125 +715,132 @@ (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-for-ocean sv-36) ;; modified - (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))) + ;; og:preserve-this + (if (sphere-cull-for-ocean 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/goal_src/jak2/engine/gfx/ocean/ocean.gc b/goal_src/jak2/engine/gfx/ocean/ocean.gc index 7b5f45ef3d..dcdbfcf4a0 100644 --- a/goal_src/jak2/engine/gfx/ocean/ocean.gc +++ b/goal_src/jak2/engine/gfx/ocean/ocean.gc @@ -140,7 +140,6 @@ ) (defmethod ocean-method-60 ((this ocean) (arg0 dma-buffer)) - (local-vars (sv-48 float) (sv-52 vector) (sv-56 vector)) ;; og:preserve-this scratchpad (let ((vertices (scratchpad-object (inline-array ocean-vertex)))) (let ((f0-0 (-> this start-corner z))) @@ -155,79 +154,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) + ) + ) ) ) ) @@ -240,7 +241,6 @@ ) (defmethod ocean-method-61 ((this ocean) (arg0 dma-buffer)) - (local-vars (sv-48 float) (sv-52 vector) (sv-56 vector)) ;; og:preserve-this scratchpad (let ((vertices (scratchpad-object (inline-array ocean-vertex)))) (let* ((f0-1 (+ 18874368.0 (-> this start-corner z))) @@ -255,79 +255,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) + ) + ) ) ) ) @@ -340,7 +342,6 @@ ) (defmethod ocean-method-62 ((this ocean) (arg0 dma-buffer)) - (local-vars (sv-48 float) (sv-52 vector) (sv-56 vector)) ;; og:preserve-this scratchpad (let ((vertices (scratchpad-object (inline-array ocean-vertex)))) (let* ((f0-0 (-> this start-corner x)) @@ -355,79 +356,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) + ) + ) ) ) ) @@ -440,7 +443,6 @@ ) (defmethod ocean-method-63 ((this ocean) (arg0 dma-buffer)) - (local-vars (sv-48 float) (sv-52 vector) (sv-56 vector)) ;; og:preserve-this scratchpad (let ((vertices (scratchpad-object (inline-array ocean-vertex)))) (let ((f0-1 (+ 18874368.0 (-> this start-corner x)))) @@ -455,79 +457,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/goal_src/jak2/engine/gfx/sprite/sprite-distort.gc b/goal_src/jak2/engine/gfx/sprite/sprite-distort.gc index 97c8002a9f..c2d480e409 100644 --- a/goal_src/jak2/engine/gfx/sprite/sprite-distort.gc +++ b/goal_src/jak2/engine/gfx/sprite/sprite-distort.gc @@ -194,15 +194,7 @@ across the screen. The resolution of the circle is defined by the number of "tur ;; - Sprites are uploaded in chunks of 85. ;; - For every 2 chunks, a call into the VU program is added. (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) @@ -229,10 +221,11 @@ across the screen. The resolution of the circle is defined by the number of "tur (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)) @@ -273,32 +266,32 @@ across the screen. The resolution of the circle is defined by the number of "tur (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/goal_src/jak2/engine/gfx/sprite/sprite-glow.gc b/goal_src/jak2/engine/gfx/sprite/sprite-glow.gc index cdeb2581d8..de9cda8e5d 100644 --- a/goal_src/jak2/engine/gfx/sprite/sprite-glow.gc +++ b/goal_src/jak2/engine/gfx/sprite/sprite-glow.gc @@ -601,29 +601,31 @@ ) (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)) - ;; og:preserve-this - (when (> (-> this count) 128) - (format 0 "TOO MANY SPRITES (~D)~%" (-> this count)) - (break!) - ) - (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))) + ) + ;; og:preserve-this + (when (> (-> this count) 128) + (format 0 "simple-sprite-system::draw-all-sprites!: TOO MANY SPRITES (~D)~%" (-> this count)) + (break!) + ) + (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/goal_src/jak2/engine/level/region.gc b/goal_src/jak2/engine/level/region.gc index 578ed7b95e..d9f8780b6a 100644 --- a/goal_src/jak2/engine/level/region.gc +++ b/goal_src/jak2/engine/level/region.gc @@ -8,29 +8,29 @@ ;; DECOMP BEGINS ;; WARN: Return type mismatch int vs drawable-region-prim. -(defmethod mem-usage ((this drawable-region-prim) (arg0 memory-usage-block) (arg1 int)) - (set! (-> arg0 length) (max 50 (-> arg0 length))) - (set! (-> arg0 data 49 name) "region") - (+! (-> arg0 data 49 count) 1) +(defmethod mem-usage ((this drawable-region-prim) (usage memory-usage-block) (flags int)) + (set! (-> usage length) (max 50 (-> usage length))) + (set! (-> usage data 49 name) "region") + (+! (-> usage data 49 count) 1) (let ((v1-6 (asize-of this))) - (+! (-> arg0 data 49 used) v1-6) - (+! (-> arg0 data 49 total) (logand -16 (+ v1-6 15))) + (+! (-> usage data 49 used) v1-6) + (+! (-> usage data 49 total) (logand -16 (+ v1-6 15))) ) - (mem-usage (-> this region) arg0 (logior arg1 128)) + (mem-usage (-> this region) usage (logior flags 128)) (the-as drawable-region-prim 0) ) ;; WARN: Return type mismatch int vs drawable-inline-array-region-prim. -(defmethod mem-usage ((this drawable-inline-array-region-prim) (arg0 memory-usage-block) (arg1 int)) - (set! (-> arg0 length) (max 1 (-> arg0 length))) - (set! (-> arg0 data 0 name) (symbol->string 'drawable-group)) - (+! (-> arg0 data 0 count) 1) +(defmethod mem-usage ((this drawable-inline-array-region-prim) (usage memory-usage-block) (flags int)) + (set! (-> usage length) (max 1 (-> usage length))) + (set! (-> usage data 0 name) (symbol->string 'drawable-group)) + (+! (-> usage data 0 count) 1) (let ((v1-7 32)) - (+! (-> arg0 data 0 used) v1-7) - (+! (-> arg0 data 0 total) (logand -16 (+ v1-7 15))) + (+! (-> usage data 0 used) v1-7) + (+! (-> usage data 0 total) (logand -16 (+ v1-7 15))) ) (dotimes (s3-0 (-> this length)) - (mem-usage (-> this data s3-0) arg0 arg1) + (mem-usage (-> this data s3-0) usage flags) ) (the-as drawable-inline-array-region-prim 0) ) @@ -45,11 +45,11 @@ ) (defmethod collect-regions ((this drawable-region-prim) (area-of-interest sphere) (_count int) (region-list region-prim-list)) - "Determines the number of [[drawable]]s in the `this` that overlap the given `area-of-interest` this number is stored in the `region-list`'s item count -@param area-of-interest The area defined by a sphere that we care about overlaps -@param _count The amount of [[drawable]]s in the object to enumerate through -@param! region-list Stores the overlapping regions and a count for how many were found -@returns none" + "Determines the number of [[drawable]]s in the `obj` that overlap the given `area-of-interest` this number is stored in the `region-list`'s item count + @param area-of-interest The area defined by a sphere that we care about overlaps + @param _count The amount of [[drawable]]s in the object to enumerate through + @param! region-list Stores the overlapping regions and a count for how many were found + @returns none" (dotimes (count _count) (when (spheres-overlap? area-of-interest (the-as sphere (-> this bsphere))) (set! (-> region-list items (-> region-list num-items)) this) @@ -62,80 +62,83 @@ ) (defmethod collect-regions ((this drawable-inline-array-region-prim) (arg0 sphere) (arg1 int) (arg2 region-prim-list)) - "Determines the number of [[drawable]]s in the `this` that overlap the given `area-of-interest` this number is stored in the `region-list`'s item count -@param area-of-interest The area defined by a sphere that we care about overlaps -@param _count The amount of [[drawable]]s in the object to enumerate through -@param! region-list Stores the overlapping regions and a count for how many were found -@returns none" + "Determines the number of [[drawable]]s in the `obj` that overlap the given `area-of-interest` this number is stored in the `region-list`'s item count + @param area-of-interest The area defined by a sphere that we care about overlaps + @param _count The amount of [[drawable]]s in the object to enumerate through + @param! region-list Stores the overlapping regions and a count for how many were found + @returns none" (collect-regions (the-as drawable-region-prim (-> this data)) arg0 (-> this length) arg2) 0 (none) ) (defmethod collect-regions ((this drawable-tree-region-prim) (arg0 sphere) (arg1 int) (arg2 region-prim-list)) - "Determines the number of [[drawable]]s in the `this` that overlap the given `area-of-interest` this number is stored in the `region-list`'s item count -@param area-of-interest The area defined by a sphere that we care about overlaps -@param _count The amount of [[drawable]]s in the object to enumerate through -@param! region-list Stores the overlapping regions and a count for how many were found -@returns none" + "Determines the number of [[drawable]]s in the `obj` that overlap the given `area-of-interest` this number is stored in the `region-list`'s item count + @param area-of-interest The area defined by a sphere that we care about overlaps + @param _count The amount of [[drawable]]s in the object to enumerate through + @param! region-list Stores the overlapping regions and a count for how many were found + @returns none" (collect-regions (-> this data2 0) arg0 (-> this length) arg2) 0 (none) ) (defmethod debug-draw-region ((this drawable-region-prim) (arg0 int)) + ;; og:preserve-this (#when PC_PORT (when (and *debug-region-hide-empty* (nonzero? (-> this region)) (not (or (-> this region on-enter) (-> this region on-exit) (-> this region on-inside)))) ;; no scripts to run means the region is "empty" so do not render (unless enabled) (return 0))) - (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 (#if PC_PORT (if *debug-region-color-alt* (static-rgba #x00 #xff #x00 #x80) (new 'static 'rgba :r #xff :g #xff :a #x80)) - (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 (bucket-id debug-no-zbuf1)) - ) - (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 (bucket-id debug-no-zbuf1)) - ) - (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 (bucket-id debug-no-zbuf1)) - ) - (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) + ;; og:preserve-this + (add-debug-x #t (bucket-id debug-no-zbuf1) sv-36 (#if PC_PORT (if *debug-region-color-alt* (static-rgba #x00 #xff #x00 #x80) (new 'static 'rgba :r #xff :g #xff :a #x80)) + (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 (bucket-id debug-no-zbuf1)) + ) + (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 (bucket-id debug-no-zbuf1)) - ) - (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 (bucket-id debug-no-zbuf1)) + ) + (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 (bucket-id debug-no-zbuf1)) + ) + (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 (bucket-id debug-no-zbuf1)) + ) + (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) ) ) ) @@ -156,10 +159,10 @@ ;; WARN: Function (method 9 region-prim-area) has a return type of none, but the expression builder found a return statement. (defmethod track-entered-region! ((this region-prim-area) (region-sphere drawable-region-sphere)) "Enumerates through the objects `region-enter-list`, if we find the provided `region`, do nothing and exit -otherwise, add the [[drawable-region-sphere]] to `region-enter-prim-list` and increment `region-enter-count` + otherwise, add the [[drawable-region-sphere]] to `region-enter-prim-list` and increment `region-enter-count` -@param region-sphere Defines the region in question -@returns nothing" + @param region-sphere Defines the region in question + @returns nothing" (let ((regions-entered (-> this region-enter-count))) (let ((region (-> region-sphere region))) (countdown (idx regions-entered) @@ -179,10 +182,10 @@ otherwise, add the [[drawable-region-sphere]] to `region-enter-prim-list` and in ;; WARN: Function (method 10 region-prim-area) has a return type of none, but the expression builder found a return statement. (defmethod track-exited-region! ((this region-prim-area) (arg0 drawable-region-sphere)) "Enumerates through the objects `region-exit-list`, if we find the provided `region`, do nothing and exit -otherwise, add the [[drawable-region-sphere]] to `region-exit-prim-list` and increment `region-exit-count` + otherwise, add the [[drawable-region-sphere]] to `region-exit-prim-list` and increment `region-exit-count` -@param region-sphere Defines the region in question -@returns nothing" + @param region-sphere Defines the region in question + @returns nothing" (let ((regions-exited (-> this region-exit-count))) (let ((region (-> arg0 region))) (countdown (idx regions-exited) @@ -202,10 +205,10 @@ otherwise, add the [[drawable-region-sphere]] to `region-exit-prim-list` and inc ;; WARN: Function (method 11 region-prim-area) has a return type of none, but the expression builder found a return statement. (defmethod track-inside-region! ((this region-prim-area) (arg0 drawable-region-sphere)) "Enumerates through the objects `region-inside-list`, if we find the provided `region`, do nothing and exit -otherwise, add the [[drawable-region-sphere]] to `region-inside-prim-list` and increment `region-inside-count` + otherwise, add the [[drawable-region-sphere]] to `region-inside-prim-list` and increment `region-inside-count` -@param region-sphere Defines the region in question -@returns nothing" + @param region-sphere Defines the region in question + @returns nothing" (let ((regions-inside (-> this region-inside-count))) (let ((region (-> arg0 region))) (countdown (idx regions-inside) @@ -225,10 +228,10 @@ otherwise, add the [[drawable-region-sphere]] to `region-inside-prim-list` and i ;; WARN: Function (method 12 region-prim-area) has a return type of none, but the expression builder found a return statement. (defmethod track-start-region! ((this region-prim-area) (arg0 drawable-region-sphere)) "Enumerates through the objects `region-start-list`, if we find the provided `region`, do nothing and exit -otherwise, add the [[drawable-region-sphere]] to `region-start-prim-list` and increment `region-start-count` + otherwise, add the [[drawable-region-sphere]] to `region-start-prim-list` and increment `region-start-count` -@param region-sphere Defines the region in question -@returns nothing" + @param region-sphere Defines the region in question + @returns nothing" (let ((regions-started (-> this region-start-count))) (let ((region (-> arg0 region))) (countdown (idx regions-started) @@ -246,6 +249,7 @@ otherwise, add the [[drawable-region-sphere]] to `region-start-prim-list` and in ) (defmethod debug-draw-region ((this drawable-region-sphere) (arg0 int)) + ;; og:preserve-this (#when PC_PORT (when (and *debug-region-hide-empty* (nonzero? (-> this region)) (not (or (-> this region on-enter) (-> this region on-exit) (-> this region on-inside)))) ;; no scripts to run means the region is "empty" so do not render (unless enabled) @@ -254,6 +258,7 @@ otherwise, add the [[drawable-region-sphere]] to `region-start-prim-list` and in (t9-0 this arg0) ) (let ((a2-0 (-> this bsphere))) + ;; og:preserve-this (add-debug-sphere #t (bucket-id debug2) a2-0 (-> this bsphere w) (#if PC_PORT (if *debug-region-color-alt* (static-rgba #xff #x00 #xff #x80) (new 'static 'rgba :r #xff :a #x80)) (new 'static 'rgba :r #xff :a #x80))) ) @@ -293,6 +298,7 @@ otherwise, add the [[drawable-region-sphere]] to `region-start-prim-list` and in ) (defmethod debug-draw-region ((this drawable-region-face) (arg0 int)) + ;; og:preserve-this (#when PC_PORT (when (and *debug-region-hide-empty* (nonzero? (-> this region)) (not (or (-> this region on-enter) (-> this region on-exit) (-> this region on-inside)))) ;; no scripts to run means the region is "empty" so do not render (unless enabled) @@ -302,6 +308,7 @@ otherwise, add the [[drawable-region-sphere]] to `region-start-prim-list` and in (t9-0 this arg0) ) ) + ;; og:preserve-this (#cond (PC_PORT (when *debug-region-show-bsphere* @@ -335,7 +342,7 @@ otherwise, add the [[drawable-region-sphere]] to `region-start-prim-list` and in (bucket-id debug2) (-> this data points) (the-as int (-> this data num-points)) - ;; tone down the opacity of the boundary so you aren't blinded / can actually stand a chance at reading the text + ;; og:preserve-this tone down the opacity of the boundary so you aren't blinded / can actually stand a chance at reading the text (#if PC_PORT (if *debug-region-color-alt* (static-rgba #x00 #xff #x00 #x30) @@ -354,7 +361,6 @@ otherwise, add the [[drawable-region-sphere]] to `region-start-prim-list` and in (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)) @@ -363,46 +369,24 @@ otherwise, add the [[drawable-region-sphere]] to `region-start-prim-list` and in ) (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) @@ -420,6 +404,7 @@ otherwise, add the [[drawable-region-sphere]] to `region-start-prim-list` and in ) (defmethod debug-draw-region ((this drawable-region-volume) (arg0 int)) + ;; og:preserve-this (#when PC_PORT (when (and *debug-region-hide-empty* (nonzero? (-> this region)) (not (or (-> this region on-enter) (-> this region on-exit) (-> this region on-inside)))) ;; no scripts to run means the region is "empty" so do not render (unless enabled) @@ -482,12 +467,14 @@ otherwise, add the [[drawable-region-sphere]] to `region-start-prim-list` and in ) (defmethod drawable-tree-region-prim-method-17 ((this drawable-tree-region-prim) (arg0 vector)) + ;; og:preserve-this (sphere<-vector+r! (the-as sphere (-> (the-as region-prim-area (scratchpad-object region-prim-area)) pos)) arg0 0.0) (let* ((s5-0 (-> this data2 (+ (-> this length) -1) length)) (s4-0 0) (a0-8 (the-as object (+ (+ (* s4-0 32) 32) (the-as int (-> this data2 (+ (-> this length) -1)))))) ) (while (< s4-0 s5-0) + ;; og:preserve-this (if (within-area? (the-as drawable-region-prim a0-8) (scratchpad-object region-prim-area)) (return #t) ) @@ -500,7 +487,8 @@ otherwise, add the [[drawable-region-sphere]] to `region-start-prim-list` and in ;; WARN: Return type mismatch int vs symbol. (defmethod point-in-region-debug! ((this region) (arg0 vector)) - (local-vars (sv-16 int) (sv-32 int)) + "Debug check to see if point is in region. This is not efficient, since it has to find the parent geometry of this region." + ;; og:preserve-this (sphere<-vector+r! (the-as sphere (-> (the-as region-prim-area (scratchpad-object region-prim-area)) pos)) arg0 0.0) (dotimes (s5-0 (-> *level* length)) (let ((s4-0 (-> *level* level s5-0))) @@ -511,19 +499,21 @@ otherwise, add the [[drawable-region-sphere]] to `region-start-prim-list` and in (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? (the-as drawable-region-prim sv-32) + ;; og:preserve-this (the-as region-prim-area (-> (the-as region-prim-area (scratchpad-object region-prim-area)) region-prim-list)) ) ) (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))))) ) ) @@ -539,12 +529,14 @@ otherwise, add the [[drawable-region-sphere]] to `region-start-prim-list` and in ) (defmethod debug-print ((this drawable-tree-region-prim) (arg0 vector) (arg1 object)) + ;; og:preserve-this (sphere<-vector+r! (the-as sphere (-> (scratchpad-object region-prim-area) pos)) arg0 0.0) (let* ((s4-0 (-> this data2 (+ (-> this length) -1) length)) (s3-0 0) (s2-0 (the-as object (+ (+ (* s3-0 32) 32) (the-as int (-> this data2 (+ (-> this length) -1)))))) ) (while (< s3-0 s4-0) + ;; og:preserve-this (if (within-area? (the-as drawable-region-prim s2-0) (scratchpad-object region-prim-area)) (format arg1 @@ -562,33 +554,34 @@ otherwise, add the [[drawable-region-sphere]] to `region-start-prim-list` and in ) (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! (-> (scratchpad-object region-prim-area) region-prim-list num-items) 0) - (set! (-> (scratchpad-object region-prim-area) region-enter-count) 0) - (set! (-> (scratchpad-object region-prim-area) region-exit-count) 0) - (set! (-> (scratchpad-object region-prim-area) region-inside-count) 0) - (set! (-> (scratchpad-object region-prim-area) region-start-count) 0) - (sphere<-vector+r! (the-as sphere (-> (scratchpad-object region-prim-area) pos)) arg1 0.0) - (sphere<-vector+r! (the-as sphere (-> (scratchpad-object region-prim-area) unknown-vector-uiyb1)) arg2 0.0) - (vector-! (the-as vector (-> (scratchpad-object region-prim-area) ray)) arg2 arg1) - (vector-! (the-as vector (-> (scratchpad-object region-prim-area) unknown-vector-t3edh)) 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 (-> (scratchpad-object region-prim-area) region-prim-list)) - ) - (+! 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))) + ;; og:preserve-this + (set! (-> (scratchpad-object region-prim-area) region-prim-list num-items) 0) + (set! (-> (scratchpad-object region-prim-area) region-enter-count) 0) + (set! (-> (scratchpad-object region-prim-area) region-exit-count) 0) + (set! (-> (scratchpad-object region-prim-area) region-inside-count) 0) + (set! (-> (scratchpad-object region-prim-area) region-start-count) 0) + (sphere<-vector+r! (the-as sphere (-> (scratchpad-object region-prim-area) pos)) arg1 0.0) + (sphere<-vector+r! (the-as sphere (-> (scratchpad-object region-prim-area) unknown-vector-uiyb1)) arg2 0.0) + (vector-! (the-as vector (-> (scratchpad-object region-prim-area) ray)) arg2 arg1) + (vector-! (the-as vector (-> (scratchpad-object region-prim-area) unknown-vector-t3edh)) 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 (-> (scratchpad-object region-prim-area) region-prim-list)) + ) + (+! s2-0 1) + (set! a0-14 (-> s4-1 s2-0)) + ) ) ) ) @@ -596,12 +589,14 @@ otherwise, add the [[drawable-region-sphere]] to `region-start-prim-list` and in ) ) ) + ;; og:preserve-this (countdown (gp-1 (-> (scratchpad-object region-prim-area) region-prim-list num-items)) (track-region (-> (scratchpad-object region-prim-area) region-prim-list items gp-1) - (the-as region-prim-area (-> (scratchpad-object region-prim-area) region-prim-list)) + (the-as region-prim-area (-> (scratchpad-object region-prim-area) region-prim-list)) ) ) + ;; og:preserve-this (let ((gp-2 (-> (scratchpad-object region-prim-area) region-enter-count))) (while (begin (label cfg-22) (nonzero? gp-2)) (+! gp-2 -1) @@ -609,6 +604,7 @@ otherwise, add the [[drawable-region-sphere]] to `region-start-prim-list` and in (s5-2 (-> a2-5 on-enter)) ) (when s5-2 + ;; og:preserve-this (countdown (v1-47 (-> (scratchpad-object region-prim-area) region-start-count)) (if (= a2-5 (-> (scratchpad-object region-prim-area) region-start-list v1-47)) (goto cfg-22) @@ -617,12 +613,14 @@ otherwise, add the [[drawable-region-sphere]] to `region-start-prim-list` and in (script-eval s5-2 :key a2-5 + ;; og:preserve-this :vector (-> (scratchpad-object region-prim-area) region-enter-prim-list gp-2 bsphere) ) ) ) ) ) + ;; og:preserve-this (let ((gp-3 (-> (scratchpad-object region-prim-area) region-exit-count))) (while (begin (label cfg-31) (nonzero? gp-3)) (+! gp-3 -1) @@ -630,6 +628,7 @@ otherwise, add the [[drawable-region-sphere]] to `region-start-prim-list` and in (s5-3 (-> a2-6 on-exit)) ) (when s5-3 + ;; og:preserve-this (countdown (v1-64 (-> (scratchpad-object region-prim-area) region-inside-count)) (if (= a2-6 (-> (scratchpad-object region-prim-area) region-inside-list v1-64)) (goto cfg-31) @@ -638,12 +637,14 @@ otherwise, add the [[drawable-region-sphere]] to `region-start-prim-list` and in (script-eval s5-3 :key a2-6 + ;; og:preserve-this :vector (-> (scratchpad-object region-prim-area) region-exit-prim-list gp-3 bsphere) ) ) ) ) ) + ;; og:preserve-this (countdown (gp-4 (-> (scratchpad-object region-prim-area) region-inside-count)) (let* ((a2-7 (-> (scratchpad-object region-prim-area) region-inside-list gp-4)) (s5-4 (-> a2-7 on-inside)) @@ -652,6 +653,7 @@ otherwise, add the [[drawable-region-sphere]] to `region-start-prim-list` and in (script-eval s5-4 :key a2-7 + ;; og:preserve-this :vector (-> (scratchpad-object region-prim-area) region-inside-prim-list gp-4 bsphere) ) ) @@ -667,8 +669,8 @@ otherwise, add the [[drawable-region-sphere]] to `region-start-prim-list` and in (set! (-> *level* target-pos 1 quad) (-> *level* target-pos 0 quad)) (set! (-> *level* target-pos 0 quad) (-> (target-pos 0) quad)) (when (and *execute-regions* (-> *setting-control* user-current region-mode) (not (paused?))) - (region-tree-execute 'camera (-> *level* camera-pos 1) (the-as vector (-> *level* camera-pos))) - (region-tree-execute 'target (-> *level* target-pos 1) (the-as vector (-> *level* target-pos))) + (region-tree-execute 'camera (-> *level* camera-pos 1) (-> *level* camera-pos 0)) + (region-tree-execute 'target (-> *level* target-pos 1) (-> *level* target-pos 0)) ) 0 (none) diff --git a/goal_src/jak2/engine/load/decomp.gc b/goal_src/jak2/engine/load/decomp.gc index bc5a14cd45..10f392845f 100644 --- a/goal_src/jak2/engine/load/decomp.gc +++ b/goal_src/jak2/engine/load/decomp.gc @@ -253,7 +253,7 @@ It's not super clear to me why they ditched this system. Maybe the visibility da ) (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)) @@ -322,6 +322,7 @@ It's not super clear to me why they ditched this system. Maybe the visibility da ) ) ) + ;; og:preserve-this (spad-start (&-> (the-as (pointer int8) *fake-scratchpad-data*) 0)) (spad-end (the-as (pointer int8) (&+ *fake-scratchpad-data* 2048))) (list-len (-> this bsp visible-list-length)) @@ -329,6 +330,7 @@ It's not super clear to me why they ditched this system. Maybe the visibility da (when (zero? (the-as vis-info-flag lower-flag-bits)) (let ((qwc (/ (+ list-len 15) 16))) (dotimes (a0-19 qwc) + ;; og:preserve-this (set! (-> (the-as (pointer int128) (&+ spad-start (* a0-19 16)))) (the int128 0)) ) ) @@ -340,12 +342,14 @@ It's not super clear to me why they ditched this system. Maybe the visibility da ((= comp-mode 1) (let ((qwc2 (/ (+ list-len 15) 16))) (dotimes (a0-23 qwc2) + ;; og:preserve-this (set! (-> (the-as (pointer int128) (&+ spad-start (* a0-23 16)))) (the int128 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/goal_src/jak2/engine/load/loader.gc b/goal_src/jak2/engine/load/loader.gc index c1d7ed8fcc..a3924a7a09 100644 --- a/goal_src/jak2/engine/load/loader.gc +++ b/goal_src/jak2/engine/load/loader.gc @@ -9,43 +9,43 @@ ;; DECOMP BEGINS -(defmethod mem-usage ((this subtitle-range) (arg0 memory-usage-block) (arg1 int)) - (set! (-> arg0 length) (max 73 (-> arg0 length))) - (set! (-> arg0 data 72 name) "subtitle") - (+! (-> arg0 data 72 count) 1) +(defmethod mem-usage ((this subtitle-range) (usage memory-usage-block) (flags int)) + (set! (-> usage length) (max 73 (-> usage length))) + (set! (-> usage data 72 name) "subtitle") + (+! (-> usage data 72 count) 1) (let ((v1-6 (asize-of this))) - (+! (-> arg0 data 72 used) v1-6) - (+! (-> arg0 data 72 total) (logand -16 (+ v1-6 15))) + (+! (-> usage data 72 used) v1-6) + (+! (-> usage data 72 total) (logand -16 (+ v1-6 15))) ) this ) ;; WARN: Return type mismatch symbol vs load-dir. -(defmethod mem-usage ((this load-dir) (arg0 memory-usage-block) (arg1 int)) - (set! (-> arg0 length) (max 85 (-> arg0 length))) - (set! (-> arg0 data 84 name) "array") - (+! (-> arg0 data 84 count) 1) +(defmethod mem-usage ((this load-dir) (usage memory-usage-block) (flags int)) + (set! (-> usage length) (max 85 (-> usage length))) + (set! (-> usage data 84 name) "array") + (+! (-> usage data 84 count) 1) (let ((v1-6 (asize-of this))) - (+! (-> arg0 data 84 used) v1-6) - (+! (-> arg0 data 84 total) (logand -16 (+ v1-6 15))) + (+! (-> usage data 84 used) v1-6) + (+! (-> usage data 84 total) (logand -16 (+ v1-6 15))) ) - (set! (-> arg0 length) (max 85 (-> arg0 length))) - (set! (-> arg0 data 84 name) "array") - (set! (-> arg0 data 84 count) (-> arg0 data 84 count)) + (set! (-> usage length) (max 85 (-> usage length))) + (set! (-> usage data 84 name) "array") + (set! (-> usage data 84 count) (-> usage data 84 count)) (let ((v1-15 (asize-of (-> this string-array)))) - (+! (-> arg0 data 84 used) v1-15) - (+! (-> arg0 data 84 total) (logand -16 (+ v1-15 15))) + (+! (-> usage data 84 used) v1-15) + (+! (-> usage data 84 total) (logand -16 (+ v1-15 15))) ) - (set! (-> arg0 length) (max 85 (-> arg0 length))) - (set! (-> arg0 data 84 name) "array") - (set! (-> arg0 data 84 count) (-> arg0 data 84 count)) + (set! (-> usage length) (max 85 (-> usage length))) + (set! (-> usage data 84 name) "array") + (set! (-> usage data 84 count) (-> usage data 84 count)) (let ((v1-24 (asize-of (-> this data-array)))) - (+! (-> arg0 data 84 used) v1-24) - (+! (-> arg0 data 84 total) (logand -16 (+ v1-24 15))) + (+! (-> usage data 84 used) v1-24) + (+! (-> usage data 84 total) (logand -16 (+ v1-24 15))) ) (dotimes (s3-0 (-> this data-array length)) - (mem-usage (-> this data-array s3-0) arg0 arg1) + (mem-usage (-> this data-array s3-0) usage flags) ) (the-as load-dir #f) ) @@ -208,13 +208,9 @@ (defmethod link-art! ((this art-group)) (when this (countdown (s5-0 (-> this length)) - (let* ((s3-0 (-> this data s5-0)) - (s4-0 (if (type? s3-0 art-joint-anim) - (the-as art-joint-anim s3-0) - ) - ) - (s2-0 #f) - ) + (let ((s4-0 (as-type (-> this data s5-0) art-joint-anim)) + (s2-0 #f) + ) (when s4-0 (let ((s3-1 LEVEL_TOTAL)) (while (begin (label cfg-24) (nonzero? s3-1)) @@ -260,13 +256,9 @@ (defmethod unlink-art! ((this art-group)) (when this (countdown (s5-0 (-> this length)) - (let* ((s3-0 (-> this data s5-0)) - (s4-0 (if (type? s3-0 art-joint-anim) - (the-as art-joint-anim s3-0) - ) - ) - (s3-1 #f) - ) + (let ((s4-0 (as-type (-> this data s5-0) art-joint-anim)) + (s3-1 #f) + ) (when s4-0 (let ((s2-0 LEVEL_TOTAL)) (while (begin (label cfg-13) (nonzero? s2-0)) @@ -405,7 +397,9 @@ (let ((a0-34 (-> this buf))) (cond ((-> this login?) - (set! (-> this art-group) (the-as art-group (link a0-34 (-> this load-file data) (-> this len) (-> this heap) 0))) + (set! (-> this art-group) + (the-as art-group (link a0-34 (-> this load-file data) (-> this len) (-> this heap) 0)) + ) (let ((s4-0 (-> this art-group)) (s3-0 (-> this load-file)) ) @@ -507,9 +501,9 @@ (defmethod update ((this external-art-control) (arg0 symbol)) (if (nonzero? (-> this reserve-buffer-count)) (spool-push this "reserved" 0 *dproc* (if (-> this reserve-buffer) - -110.0 - -0.5 - ) + -110.0 + -0.5 + ) ) ) (dotimes (v1-5 2) @@ -522,7 +516,9 @@ (let ((s3-0 (-> this rec s4-0))) (when (-> s3-0 name) (dotimes (s2-0 2) - (when (and (file-status (-> this buffer s2-0) (-> s3-0 name) (-> s3-0 parts)) (not (-> this buffer s2-0 frame-lock))) + (when (and (file-status (-> this buffer s2-0) (-> s3-0 name) (-> s3-0 parts)) + (not (-> this buffer s2-0 frame-lock)) + ) (set! (-> this buffer s2-0 frame-lock) #t) (set! (-> s3-0 anim-name) (-> this buffer s2-0)) (set! (-> this buffer s2-0 pending-load-file-owner) (-> s3-0 owner)) @@ -578,7 +574,7 @@ (set! (-> s4-4 length) 0) (dotimes (s3-2 3) (when (-> this rec s3-2 name) - (mem-copy! (&-> (-> s4-4 (-> s4-4 length)) type) (&-> (-> this rec s3-2) type) 44) + (mem-copy! (&-> s4-4 (-> s4-4 length) type) (&-> this rec s3-2 type) 44) (+! (-> s4-4 length) 1) ) ) @@ -704,8 +700,8 @@ (if (>= arg3 (-> this rec 0 priority)) (return (the-as int #f)) ) - (mem-copy! (&-> (-> this rec) 0 type) (&-> (-> this rec 1) type) 44) - (mem-copy! (&-> (-> this rec 1) type) (&-> (-> this rec 2) type) 44) + (mem-copy! (&-> this rec 0 type) (&-> this rec 1 type) 44) + (mem-copy! (&-> this rec 1 type) (&-> this rec 2 type) 44) (set! (-> this rec 2 name) #f) (set! (-> this rec 2 owner) (the-as handle #f)) ) @@ -713,7 +709,7 @@ (if (>= arg3 (-> this rec 1 priority)) (return (the-as int #f)) ) - (mem-copy! (&-> (-> this rec 1) type) (&-> (-> this rec 2) type) 44) + (mem-copy! (&-> this rec 1 type) (&-> this rec 2 type) 44) (set! (-> this rec 2 name) #f) (set! (-> this rec 2 owner) (the-as handle #f)) ) @@ -727,15 +723,15 @@ ) (cond ((< arg3 (-> this rec 0 priority)) - (mem-copy! (&-> (-> this rec 2) type) (&-> (-> this rec 1) type) 44) - (mem-copy! (&-> (-> this rec 1) type) (&-> (-> this rec) 0 type) 44) + (mem-copy! (&-> this rec 2 type) (&-> this rec 1 type) 44) + (mem-copy! (&-> this rec 1 type) (&-> this rec 0 type) 44) (set! (-> this rec 0 name) arg0) (set! (-> this rec 0 parts) arg1) (set! (-> this rec 0 priority) arg3) (set! (-> this rec 0 owner) (process->handle arg2)) ) ((< arg3 (-> this rec 1 priority)) - (mem-copy! (&-> (-> this rec 2) type) (&-> (-> this rec 1) type) 44) + (mem-copy! (&-> this rec 2 type) (&-> this rec 1 type) 44) (set! (-> this rec 1 name) arg0) (set! (-> this rec 1 parts) arg1) (set! (-> this rec 1 priority) arg3) @@ -774,7 +770,7 @@ (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)) @@ -855,7 +851,7 @@ (set-setting! 'spooling (process->ppointer self) 0.0 0) (set-setting! 'spool-anim (-> gp-0 anim) 0.0 0) (apply-settings *setting-control*) - (set! (-> gp-0 old-time) (current-time)) + (set-time! (-> gp-0 old-time)) (while (< (-> gp-0 part) (-> gp-0 anim parts)) (when (> (-> gp-0 part) 0) (while (let ((v1-99 (file-status *art-control* (-> gp-0 anim name) (-> gp-0 part)))) @@ -1000,65 +996,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! (-> gp-0 good-time) (current-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) (>= (- (current-time) (-> 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! (-> gp-0 good-time) (current-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! (-> gp-0 old-time) (current-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) ) @@ -1067,7 +1064,8 @@ (else (format 0 - "ERROR: ~A in spool anim loop for ~A ~D, but not loaded.~%" ;; fixed missing %. + ;; og:preserve-this fixed missing % + "ERROR: ~A in spool anim loop for ~A ~D, but not loaded.~%" self (-> gp-0 anim name) (-> gp-0 part) @@ -1196,7 +1194,7 @@ (or (= arg2 (gui-action none)) (= arg2 (-> s2-0 action))) (or (not arg0) (string= arg0 (-> s2-0 name))) ) - (return (-> s2-0 id)) + (return (the-as sound-id (-> s2-0 id))) ) (set! s2-0 (the-as gui-connection s1-0)) (-> this engine) @@ -1211,7 +1209,7 @@ (or (= arg2 (gui-action none)) (= arg2 (-> s1-1 action))) (or (not arg0) (string= arg0 (-> s1-1 name))) ) - (return (-> s1-1 id)) + (return (the-as sound-id (-> s1-1 id))) ) ) ) @@ -1337,7 +1335,6 @@ ) (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))) @@ -1353,8 +1350,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) @@ -1364,8 +1362,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) @@ -1375,8 +1374,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) @@ -1456,7 +1456,7 @@ (cond (gp-0 (dotimes (s4-0 4) - (when (and (string-charp= (-> gp-0 name) (the-as (pointer uint8) (-> *sound-iop-info* stream-name s4-0))) + (when (and (string-charp= (-> gp-0 name) (-> *sound-iop-info* stream-name s4-0 name)) (or (= (-> gp-0 id) (-> *sound-iop-info* stream-id s4-0)) (zero? (-> *sound-iop-info* stream-id s4-0))) (logtest? (-> *sound-iop-info* stream-status s4-0) (stream-status ststatus-one ststatus-six)) (if (and (>= (the-as uint (-> gp-0 channel)) (the-as uint 16)) @@ -1537,48 +1537,50 @@ ) (defmethod set-action! ((this gui-control) - (arg0 gui-action) - (arg1 sound-id) - (arg2 gui-channel) - (arg3 gui-action) - (arg4 string) - (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) - ;; og:preserve-this fixed naughty dog bug here. was 'play instead of (gui-action play) - (if (and (= sv-16 (gui-action play)) (handle-command-list this (-> s1-0 channel) s1-0)) - (channel-id-set! this s1-0 (-> s1-0 id)) - ) + (arg0 gui-action) + (arg1 sound-id) + (arg2 gui-channel) + (arg3 gui-action) + (arg4 string) + (arg5 (function gui-connection symbol)) + (arg6 process) + ) + (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) + ;; og:preserve-this fixed naughty dog bug here. was 'play instead of (gui-action play) + (if (and (= sv-16 (gui-action 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)) ) ) ) @@ -1587,75 +1589,73 @@ ;; WARN: Return type mismatch int vs sound-id. (defmethod add-process ((this gui-control) - (arg0 process) - (arg1 gui-channel) - (arg2 gui-action) - (arg3 string) - (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 + (arg0 process) + (arg1 gui-channel) + (arg2 gui-action) + (arg3 string) + (arg4 float) + (arg5 time-frame) ) + (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 + ) + ) + ) + ) ) (defmethod remove-process ((this gui-control) (arg0 process) (arg1 gui-channel)) @@ -1678,103 +1678,95 @@ ;; WARN: Return type mismatch int vs sound-id. (defmethod gui-control-method-12 ((this gui-control) - (arg0 process) - (arg1 gui-channel) - (arg2 gui-action) - (arg3 string) - (arg4 int) - (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 (-> 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))) + (arg0 process) + (arg1 gui-channel) + (arg2 gui-action) + (arg3 string) + (arg4 int) + (arg5 float) + (arg6 sound-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 ((s2-1 arg0)) - (set! sv-28 (if (type? s2-1 process-drawable) - (the-as process-drawable s2-1) - ) - ) - ) - (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-48 arg6) + (sv-16 (the-as gui-connection #f)) + (sv-20 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 + ) + ) + ) + ) ) (defmethod gui-control-method-21 ((this gui-control) (arg0 gui-connection) (arg1 vector)) @@ -1785,12 +1777,7 @@ (((gui-action queue) (gui-action play) (gui-action playing) (gui-action fade)) (let ((f30-0 (-> arg0 priority))) (when (= f30-0 -99.0) - (let* ((s2-0 (get-process arg0)) - (v1-10 (if (type? s2-0 process-drawable) - (the-as process-drawable s2-0) - ) - ) - ) + (let ((v1-10 (as-type (get-process arg0) process-drawable))) (set! f30-0 (cond ((= (-> arg0 id) (-> this ids (-> arg0 channel))) -1.0 @@ -1912,6 +1899,7 @@ (b! (!= v1-43 (gui-status ready)) cfg-36 :delay (empty-form)) (case (shr (the-as int (-> arg0 channel)) 4) ((1 2) + ;; og:preserve-this (if (#if PC_PORT (or *gui-kick-str* (not (paused?))) (not (paused?))) (str-play-async (-> arg0 name) (-> arg0 id)) @@ -1947,7 +1935,7 @@ ) (begin (dotimes (s3-0 4) - (when (and (string-charp= (-> arg0 name) (the-as (pointer uint8) (-> *sound-iop-info* stream-name s3-0))) + (when (and (string-charp= (-> arg0 name) (-> *sound-iop-info* stream-name s3-0 name)) (= (-> arg0 id) (-> *sound-iop-info* stream-id s3-0)) (logtest? (-> *sound-iop-info* stream-status s3-0) (stream-status ststatus-six)) ) @@ -1966,12 +1954,7 @@ (when (and (logtest? (-> arg0 flags) (gui-connection-flags gcf1 fo-curve fo-min fo-max)) (logtest? (-> arg0 flags) (gui-connection-flags gcf0)) ) - (let* ((s5-1 (get-process arg0)) - (s4-1 (if (type? s5-1 process-drawable) - s5-1 - ) - ) - ) + (let ((s4-1 (the-as process (as-type (get-process arg0) process-drawable)))) (when (and s4-1 (nonzero? (-> (the-as process-drawable s4-1) root))) (when *sound-player-enable* (let ((s5-2 (the-as sound-rpc-set-param (get-sound-buffer-entry)))) @@ -2146,10 +2129,10 @@ (dotimes (s1-1 4) (set! (-> s4-1 s1-1) (-> this spool-connections s1-1 id)) (when (and (-> this spool-connections s1-1 name) (case (-> this spool-connections s1-1 channel) - (((gui-channel art-load) (gui-channel art-load-next)) - #t + (((gui-channel art-load) (gui-channel art-load-next)) + #t + ) ) - ) ) (set! s3-2 (logior s3-2 (ash 1 s1-1))) (if (and s2-2 (string= (-> this spool-connections s1-1 name) (the-as string s2-2))) diff --git a/goal_src/jak2/engine/math/euler.gc b/goal_src/jak2/engine/math/euler.gc index b2b805dbca..17d1243b0a 100644 --- a/goal_src/jak2/engine/math/euler.gc +++ b/goal_src/jak2/engine/math/euler.gc @@ -110,11 +110,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 @@ -142,11 +143,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) @@ -206,14 +208,10 @@ ) (defun quat->eul ((arg0 euler-angles) (arg1 quaternion) (arg2 int)) - "Conver quaternion to euler angles with given order, not very efficient." + "Convert quaternion to euler angles with given order, not very efficient." (let ((s5-0 (new 'stack-no-clear 'matrix))) (quaternion->matrix s5-0 arg1) (matrix->eul arg0 s5-0 arg2) ) arg0 ) - - - - diff --git a/goal_src/jak2/engine/math/math.gc b/goal_src/jak2/engine/math/math.gc index b3e77dd799..e3b4c2958f 100644 --- a/goal_src/jak2/engine/math/math.gc +++ b/goal_src/jak2/engine/math/math.gc @@ -9,6 +9,8 @@ ;; - lerp-scale rewritten to not use accumulator ;; - logf, log2f, cube-root manually fixed due to float hacks +(defmacro square (x) + `(* ,x ,x)) ;; DECOMP BEGINS @@ -87,9 +89,7 @@ (* arg0 (+ 0.33333334 (* arg0 - (+ -0.25 - (* arg0 (+ 0.2 (* arg0 (+ -0.16666666 (* arg0 (+ 0.14285715 (* arg0 (+ -0.125 (* 0.11111111 arg0))))))))) - ) + (+ -0.25 (* arg0 (+ 0.2 (* arg0 (+ -0.16666666 (* arg0 (+ 0.14285715 (* arg0 (+ -0.125 (/ arg0 9)))))))))) ) ) ) @@ -99,8 +99,6 @@ ) ) - - (defun logf ((arg0 float)) "Natural log." (let ((v1-1 (the-as int (+ (shr (the-as int arg0) 23) -126))) @@ -118,9 +116,7 @@ (* f0-5 (+ 0.33333334 (* f0-5 - (+ -0.25 - (* f0-5 (+ 0.2 (* f0-5 (+ -0.16666666 (* f0-5 (+ 0.14285715 (* f0-5 (+ -0.125 (* 0.11111111 f0-5))))))))) - ) + (+ -0.25 (* f0-5 (+ 0.2 (* f0-5 (+ -0.16666666 (* f0-5 (+ 0.14285715 (* f0-5 (+ -0.125 (/ f0-5 9)))))))))) ) ) ) @@ -152,9 +148,7 @@ (* f0-5 (+ 0.33333334 (* f0-5 - (+ -0.25 - (* f0-5 (+ 0.2 (* f0-5 (+ -0.16666666 (* f0-5 (+ 0.14285715 (* f0-5 (+ -0.125 (* 0.11111111 f0-5))))))))) - ) + (+ -0.25 (* f0-5 (+ 0.2 (* f0-5 (+ -0.16666666 (* f0-5 (+ 0.14285715 (* f0-5 (+ -0.125 (/ f0-5 9)))))))))) ) ) ) @@ -169,7 +163,6 @@ ) ) - (deftype float-type (uint32) () ) @@ -397,7 +390,6 @@ (exp (* arg1 (logf arg0))) ) - (defun print-exp ((arg0 float)) "Print in the format AeB where A is in the range (1, 10)" (let* ((f30-1 (floor (/ (logf (fabs arg0)) (logf 10.0)))) @@ -443,7 +435,7 @@ (defun print-time ((arg0 object) (arg1 time-frame)) "Print a time-frame as minutes:seconds:milliseconds" (let* ((f0-1 (* 0.0033333334 (the float arg1))) - (a2-0 (the int (* 0.016666668 f0-1))) + (a2-0 (the int (/ f0-1 60))) (f0-2 (- f0-1 (* 60.0 (the float a2-0)))) (a3-0 (the int f0-2)) (f0-3 (- f0-2 (the float a3-0))) @@ -455,8 +447,8 @@ (none) ) +;; WARN: Return type mismatch uint vs int. (defun log2 ((arg0 int)) - "Log base 2." (the-as int (+ (sar (the-as int (the float arg0)) 23) -127)) ) @@ -590,7 +582,9 @@ (defun seekl ((arg0 int) (arg1 int) (arg2 int)) "Move arg0 toward arg1, by at most arg2." - (let* ((v1-0 (- arg1 arg0)) (a3-0 (abs v1-0))) + (let* ((v1-0 (- arg1 arg0)) + (a3-0 (abs v1-0)) + ) (cond ((>= arg2 a3-0) arg1 @@ -678,17 +672,17 @@ ) (defun rand-vu-float-range ((arg0 float) (arg1 float)) - "Get a random float in between arg0 and arg1" + "Get a random float in between arg0 and arg1." (+ arg0 (* (rand-vu) (- arg1 arg0))) ) (defun rand-vu-percent? ((arg0 float)) - "Get a boolean that's true with the given probability (in 0, 1)" + "Get a boolean that's true with the given probability (in 0, 1)." (>= arg0 (rand-vu)) ) (defun rand-vu-int-range ((arg0 int) (arg1 int)) - "Get an integer in the given range (inclusive)" + "Get an integer in the given range (inclusive)." (if (< arg0 arg1) (set! arg1 (+ arg1 1)) (set! arg0 (+ arg0 1)) @@ -706,6 +700,7 @@ (the int (* (rand-vu) (the float arg0))) ) +;; WARN: new jak 2 until loop case, check carefully (defun rand-vu-int-count-excluding ((arg0 int) (arg1 int)) "Get an integer in the range [0, arg0). If bit n is set in arg1, exclude this value from being returned." @@ -715,7 +710,7 @@ (let ((v1-0 1)) (while (nonzero? arg0) (+! arg0 -1) - (if (zero? (logand arg1 v1-0)) + (if (not (logtest? arg1 v1-0)) (+! s4-0 1) ) (set! v1-0 (* v1-0 2)) @@ -747,6 +742,7 @@ ) ) +;; WARN: new jak 2 until loop case, check carefully (defun rand-vu-int-range-exclude ((arg0 int) (arg1 int) (arg2 int)) "Get an integer in the range [0, arg0), excluding arg2. Note that this doesn't use bits like rand-vu-int-count-excluding." @@ -761,12 +757,13 @@ ) (deftype random-generator (basic) - ((seed uint32) + ((seed uint32) ) ) (define *random-generator* (new 'global 'random-generator)) + (set! (-> *random-generator* seed) (the-as uint #x666edd1e)) (defmacro sext32-64 (x) @@ -830,7 +827,6 @@ ) ) - (defun int-noise ((arg0 int)) "Generate random-ish floats in range -1, 1." (let ((v1-1 (logxor (shl arg0 13) arg0))) @@ -860,9 +856,8 @@ (defun smooth-interp ((arg0 float) (arg1 float) (arg2 float) (arg3 float) (arg4 float)) "Remap arg2 from (arg3, arg4) to (arg0, arg1), using cubic interpolation. Satisfies: - - f(arg3) = arg0 - - f(arg4) = arg1 - - f'(arg3) = f'(arg4) = 0" + - f(arg3) = arg0 + - f(arg4) = arg1 + - f'(arg3) = f'(arg4) = 0" (+ arg0 (* (- arg1 arg0) (smooth-step (/ (- arg2 arg3) (- arg4 arg3))))) ) - diff --git a/goal_src/jak2/engine/math/quaternion.gc b/goal_src/jak2/engine/math/quaternion.gc index 06dddb7b2d..6de9368db7 100644 --- a/goal_src/jak2/engine/math/quaternion.gc +++ b/goal_src/jak2/engine/math/quaternion.gc @@ -23,7 +23,7 @@ (defun quaternion-axis-angle! ((arg0 quaternion) (arg1 float) (arg2 float) (arg3 float) (arg4 float)) "Construct a quaternion from an axis and angle. The axis should be normalized." (let ((s5-0 (new 'stack-no-clear 'vector))) - (sincos! s5-0 (* 0.5 arg4)) + (sincos! s5-0 (/ arg4 2)) (let ((f0-2 (-> s5-0 x))) (set! (-> arg0 x) (* arg1 f0-2)) (set! (-> arg0 y) (* arg2 f0-2)) @@ -37,7 +37,7 @@ (defun quaternion-vector-angle! ((arg0 quaternion) (arg1 vector) (arg2 float)) "Construct a quaternion from an axis and angle. The axis should be normalized." (let ((s5-0 (new 'stack-no-clear 'vector))) - (sincos! s5-0 (* 0.5 arg2)) + (sincos! s5-0 (/ arg2 2)) (let ((f0-2 (-> s5-0 x))) (set! (-> arg0 x) (* (-> arg1 x) f0-2)) (set! (-> arg0 y) (* (-> arg1 y) f0-2)) @@ -50,12 +50,9 @@ (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)) @@ -67,55 +64,55 @@ (defun quaternion-look-at! ((arg0 quaternion) (arg1 vector) (arg2 vector)) "Look along arg1, with arg2 as up." (let ((s5-0 (new 'stack-no-clear 'matrix))) - (vector-cross! (the-as vector (-> s5-0 data)) arg2 arg1) - (vector-cross! (the-as vector (&-> s5-0 data 4)) arg1 (the-as vector (-> s5-0 data))) - (set! (-> (the-as vector (&-> s5-0 data 8)) quad) (-> arg1 quad)) + (vector-cross! (-> s5-0 vector 0) arg2 arg1) + (vector-cross! (-> s5-0 vector 1) arg1 (-> s5-0 vector 0)) + (set! (-> (the-as vector (-> s5-0 vector 2)) quad) (-> arg1 quad)) (quaternion-normalize! (matrix->quaternion arg0 s5-0)) ) ) (defun quaternion-zero! ((arg0 quaternion)) - "Set quaternion to all 0's" - (set! (-> arg0 vec quad) (the-as uint128 0)) + "Set quaternion to all 0's." + (set! (-> arg0 quad) (the-as uint128 0)) arg0 ) (defun quaternion-identity! ((arg0 quaternion)) - "Set quaternion to 0,0,0,1 (identity)" - (set! (-> arg0 vec quad) (the-as uint128 0)) + "Set quaternion to 0,0,0,1 (identity)." + (set! (-> arg0 quad) (the-as uint128 0)) (set! (-> arg0 w) 1.0) arg0 ) (defun quaternion-i! ((arg0 quaternion)) - "Create unit i quaternion" - (set! (-> arg0 vec quad) (the-as uint128 0)) + "Create unit i quaternion." + (set! (-> arg0 quad) (the-as uint128 0)) (set! (-> arg0 x) 1.0) arg0 ) (defun quaternion-j! ((arg0 quaternion)) "Create unit j quaternion." - (set! (-> arg0 vec quad) (the-as uint128 0)) + (set! (-> arg0 quad) (the-as uint128 0)) (set! (-> arg0 y) 1.0) arg0 ) (defun quaternion-k! ((arg0 quaternion)) - "Create unit k quaternion" - (set! (-> arg0 vec quad) (the-as uint128 0)) + "Create unit k quaternion." + (set! (-> arg0 quad) (the-as uint128 0)) (set! (-> arg0 z) 1.0) arg0 ) (defun quaternion-copy! ((arg0 quaternion) (arg1 quaternion)) - "Set arg0 = arg1" - (set! (-> arg0 vec quad) (-> arg1 vec quad)) + "Set arg0 = arg1." + (set! (-> arg0 quad) (-> arg1 quad)) arg0 ) (defun quaternion-set! ((arg0 quaternion) (arg1 float) (arg2 float) (arg3 float) (arg4 float)) - "Set arg0 = [arg1, arg2, arg3, arg4]" + "Set arg0 = [arg1, arg2, arg3, arg4]." (set! (-> arg0 x) arg1) (set! (-> arg0 y) arg2) (set! (-> arg0 z) arg3) @@ -128,10 +125,10 @@ (rlet ((vf1 :class vf) (vf2 :class vf) ) - (.lvf vf1 (&-> arg1 vec quad)) - (.lvf vf2 (&-> arg2 vec quad)) + (.lvf vf1 (&-> arg1 quad)) + (.lvf vf2 (&-> arg2 quad)) (.add.vf vf1 vf1 vf2) - (.svf (&-> arg0 vec quad) vf1) + (.svf (&-> arg0 quad) vf1) arg0 ) ) @@ -141,24 +138,25 @@ (rlet ((vf1 :class vf) (vf2 :class vf) ) - (.lvf vf1 (&-> arg1 vec quad)) - (.lvf vf2 (&-> arg2 vec quad)) + (.lvf vf1 (&-> arg1 quad)) + (.lvf vf2 (&-> arg2 quad)) (.sub.vf vf1 vf1 vf2) - (.svf (&-> arg0 vec quad) vf1) + (.svf (&-> arg0 quad) vf1) arg0 ) ) +;; ERROR: Bad vector register dependency: vf2 (defun quaternion-negate! ((arg0 quaternion) (arg1 quaternion)) "Set arg0 = -arg1." (rlet ((vf1 :class vf) (vf2 :class vf) ) - (.lvf vf1 (&-> arg1 vec quad)) + (.lvf vf1 (&-> arg1 quad)) ;;(.sub.vf vf2 vf2 vf2) (.xor.vf vf2 vf2 vf2) (.sub.vf vf1 vf2 vf1) - (.svf (&-> arg0 vec quad) vf1) + (.svf (&-> arg0 quad) vf1) arg0 ) ) @@ -170,31 +168,31 @@ (rlet ((vf1 :class vf) (vf2 :class vf) ) - (.lvf vf1 (&-> arg1 vec quad)) + (.lvf vf1 (&-> arg1 quad)) ;; (.sub.vf vf2 vf2 vf2) (.xor.vf vf2 vf2 vf2) (.sub.vf.xyz vf2 vf2 vf1) (.add.vf.w vf2 vf2 vf1) - (.svf (&-> arg0 vec quad) vf2) + (.svf (&-> arg0 quad) vf2) arg0 ) ) (defun quaternion-float*! ((arg0 quaternion) (arg1 quaternion) (arg2 float)) - "Multiply each element" + "Multiply each element." (rlet ((vf1 :class vf) (vf2 :class vf) ) - (.lvf vf1 (&-> arg1 vec quad)) + (.lvf vf1 (&-> arg1 quad)) (.mov vf2 arg2) (.mul.x.vf vf1 vf1 vf2) - (.svf (&-> arg0 vec quad) vf1) + (.svf (&-> arg0 quad) vf1) arg0 ) ) (defun quaternion-float/! ((arg0 quaternion) (arg1 quaternion) (arg2 float)) - "Divide each element" + "Divide each element." (let ((f0-1 (/ 1.0 arg2))) (quaternion-float*! arg0 arg1 f0-1) ) @@ -202,14 +200,14 @@ ) (defun quaternion-norm2 ((arg0 quaternion)) - "Get the squared norm of a quaternion" + "Get the squared norm of a quaternion." (local-vars (v0-0 float)) (rlet ((acc :class vf) (vf0 :class vf) (vf1 :class vf) ) (init-vf0-vector) - (.lvf vf1 (&-> arg0 vec quad)) + (.lvf vf1 (&-> arg0 quad)) (.mul.vf vf1 vf1 vf1) (.add.z.vf.w acc vf1 vf1) (.add.mul.y.vf.w acc vf0 vf1 acc) @@ -228,7 +226,7 @@ (vf1 :class vf) ) (init-vf0-vector) - (.lvf vf1 (&-> arg0 vec quad)) + (.lvf vf1 (&-> arg0 quad)) (.mul.vf vf1 vf1 vf1) (.add.z.vf.w acc vf1 vf1) (.add.mul.y.vf.w acc vf0 vf1 acc) @@ -240,7 +238,7 @@ ) (defun quaternion-normalize! ((arg0 quaternion)) - "Normalize a quaternion" + "Normalize a quaternion." (rlet ((acc :class vf) (Q :class vf) (vf0 :class vf) @@ -248,7 +246,7 @@ (vf2 :class vf) ) (init-vf0-vector) - (.lvf vf1 (&-> arg0 vec quad)) + (.lvf vf1 (&-> arg0 quad)) (.mul.vf vf2 vf1 vf1) (.add.z.vf.w acc vf2 vf2) (.add.mul.y.vf.w acc vf0 vf2 acc) @@ -258,7 +256,7 @@ (.mul.vf vf2 vf1 Q) ;; (.nop.vf) ;; (.nop.vf) - (.svf (&-> arg0 vec quad) vf2) + (.svf (&-> arg0 quad) vf2) arg0 ) ) @@ -274,7 +272,7 @@ (vf3 :class vf) ) (init-vf0-vector) - (.lvf vf1 (&-> arg1 vec quad)) + (.lvf vf1 (&-> arg1 quad)) (.mul.vf vf2 vf1 vf1) ;; (.sub.vf vf3 vf3 vf3) (.xor.vf vf3 vf3 vf3) @@ -288,7 +286,7 @@ (.mul.vf vf3 vf3 Q) (.nop.vf) (.nop.vf) - (.svf (&-> arg0 vec quad) vf3) + (.svf (&-> arg0 quad) vf3) arg0 ) ) @@ -302,8 +300,8 @@ (vf2 :class vf) ) (init-vf0-vector) - (.lvf vf1 (&-> arg0 vec quad)) - (.lvf vf2 (&-> arg1 vec quad)) + (.lvf vf1 (&-> arg0 quad)) + (.lvf vf2 (&-> arg1 quad)) (.mul.vf vf1 vf1 vf2) (.add.z.vf.w acc vf1 vf1) (.add.mul.y.vf.w acc vf0 vf1 acc) @@ -315,7 +313,7 @@ ) (defun quaternion*! ((arg0 quaternion) (arg1 quaternion) (arg2 quaternion)) - "Real quaternion multiplication" + "Real quaternion multiplication." (rlet ((acc :class vf) (vf0 :class vf) (vf1 :class vf) @@ -324,8 +322,8 @@ (vf4 :class vf) ) (init-vf0-vector) - (.lvf vf1 (&-> arg1 vec quad)) - (.lvf vf2 (&-> arg2 vec quad)) + (.lvf vf1 (&-> arg1 quad)) + (.lvf vf2 (&-> arg2 quad)) (.sub.vf.w vf4 vf0 vf0) (.mul.vf vf3 vf1 vf2) (.outer.product.a.vf acc vf1 vf2) @@ -337,7 +335,7 @@ (.sub.mul.y.vf.w acc vf0 vf3 acc) (.sub.mul.x.vf.w acc vf0 vf3 acc) (.add.mul.w.vf vf1 vf4 vf0 acc) - (.svf (&-> arg0 vec quad) vf1) + (.svf (&-> arg0 quad) vf1) arg0 ) ) @@ -352,18 +350,18 @@ (f1-0 (-> arg1 z)) (f0-0 (-> arg1 w)) ) - (set! (-> arg0 data 0) f0-0) - (set! (-> arg0 data 1) f1-0) - (set! (-> arg0 data 2) (- f2-0)) - (set! (-> arg0 data 3) f3-0) - (set! (-> arg0 data 4) (- f1-0)) - (set! (-> arg0 data 5) f0-0) - (set! (-> arg0 data 6) f3-0) - (set! (-> arg0 data 7) f2-0) - (set! (-> arg0 data 8) f2-0) - (set! (-> arg0 data 9) (- f3-0)) - (set! (-> arg0 data 10) f0-0) - (set! (-> arg0 data 11) f1-0) + (set! (-> arg0 vector 0 x) f0-0) + (set! (-> arg0 vector 0 y) f1-0) + (set! (-> arg0 vector 0 z) (- f2-0)) + (set! (-> arg0 vector 0 w) f3-0) + (set! (-> arg0 vector 1 x) (- f1-0)) + (set! (-> arg0 vector 1 y) f0-0) + (set! (-> arg0 vector 1 z) f3-0) + (set! (-> arg0 vector 1 w) f2-0) + (set! (-> arg0 vector 2 x) f2-0) + (set! (-> arg0 vector 2 y) (- f3-0)) + (set! (-> arg0 vector 2 z) f0-0) + (set! (-> arg0 vector 2 w) f1-0) (set! (-> arg0 trans x) (- f3-0)) (set! (-> arg0 trans y) (- f2-0)) (set! (-> arg0 trans z) (- f1-0)) @@ -379,18 +377,18 @@ (f0-0 (-> arg1 z)) ) (let ((f3-0 (-> arg1 w))) - (set! (-> arg0 data 0) f2-0) - (set! (-> arg0 data 1) f3-0) - (set! (-> arg0 data 2) (- f0-0)) - (set! (-> arg0 data 3) f1-0) - (set! (-> arg0 data 4) f1-0) - (set! (-> arg0 data 5) f0-0) - (set! (-> arg0 data 6) f3-0) - (set! (-> arg0 data 7) (- f3-0)) - (set! (-> arg0 data 8) f0-0) - (set! (-> arg0 data 9) (- f1-0)) - (set! (-> arg0 data 10) f2-0) - (set! (-> arg0 data 11) f3-0) + (set! (-> arg0 vector 0 x) f2-0) + (set! (-> arg0 vector 0 y) f3-0) + (set! (-> arg0 vector 0 z) (- f0-0)) + (set! (-> arg0 vector 0 w) f1-0) + (set! (-> arg0 vector 1 x) f1-0) + (set! (-> arg0 vector 1 y) f0-0) + (set! (-> arg0 vector 1 z) f3-0) + (set! (-> arg0 vector 1 w) (- f3-0)) + (set! (-> arg0 vector 2 x) f0-0) + (set! (-> arg0 vector 2 y) (- f1-0)) + (set! (-> arg0 vector 2 z) f2-0) + (set! (-> arg0 vector 2 w) f3-0) (set! (-> arg0 trans x) f3-0) ) (set! (-> arg0 trans y) (- f2-0)) @@ -402,7 +400,6 @@ (defun quaternion->matrix ((arg0 matrix) (arg1 quaternion)) "Convert quaternion to matrix." - (rlet ((acc :class vf) (vf0 :class vf) (vf1 :class vf) @@ -412,7 +409,7 @@ (vf5 :class vf) ) (init-vf0-vector) - (.lvf vf1 (&-> arg1 vec quad)) + (.lvf vf1 (&-> arg1 quad)) (.add.vf vf5 vf1 vf1) (.add.w.vf.x vf2 vf0 vf1) (.add.z.vf.y vf2 vf0 vf1) @@ -500,15 +497,15 @@ (defun matrix->quaternion ((arg0 quaternion) (arg1 matrix)) "Convert a rotation matrix to a quaternion." - (let ((f0-2 (+ (-> arg1 data 0) (-> arg1 data 5) (-> arg1 data 10)))) + (let ((f0-2 (+ (-> arg1 vector 0 x) (-> arg1 vector 1 y) (-> arg1 vector 2 z)))) (cond ((< 0.0 f0-2) (let ((f0-4 (sqrtf (+ 1.0 f0-2)))) - (set! (-> arg0 w) (* 0.5 f0-4)) + (set! (-> arg0 w) (/ f0-4 2)) (let ((f0-5 (/ 0.5 f0-4))) - (set! (-> arg0 x) (* f0-5 (- (-> arg1 data 6) (-> arg1 data 9)))) - (set! (-> arg0 y) (* f0-5 (- (-> arg1 data 8) (-> arg1 data 2)))) - (set! (-> arg0 z) (* f0-5 (- (-> arg1 data 1) (-> arg1 data 4)))) + (set! (-> arg0 x) (* f0-5 (- (-> arg1 vector 1 z) (-> arg1 vector 2 y)))) + (set! (-> arg0 y) (* f0-5 (- (-> arg1 vector 2 x) (-> arg1 vector 0 z)))) + (set! (-> arg0 z) (* f0-5 (- (-> arg1 vector 0 y) (-> arg1 vector 1 x)))) ) ) ) @@ -517,12 +514,12 @@ (a3-0 1) (v1-4 2) ) - (when (< (-> arg1 data 0) (-> arg1 data 5)) + (when (< (-> arg1 vector 0 x) (-> arg1 vector 1 y)) (set! a2-0 1) (set! a3-0 2) (set! v1-4 0) ) - (when (< (-> (the-as (pointer float) (+ (+ (* a2-0 4) (* a2-0 16)) (the-as int arg1)))) (-> arg1 data 10)) + (when (< (-> (the-as (pointer float) (+ (+ (* a2-0 4) (* a2-0 16)) (the-as int arg1)))) (-> arg1 vector 2 z)) (set! a2-0 2) (set! a3-0 0) (set! v1-4 1) @@ -539,7 +536,7 @@ ) ) ) - (set! (-> arg0 data a2-0) (* 0.5 f0-12)) + (set! (-> arg0 data a2-0) (/ f0-12 2)) (if (!= f0-12 0.0) (set! f0-12 (/ 0.5 f0-12)) ) @@ -573,7 +570,7 @@ ) (defun matrix-with-scale->quaternion ((arg0 quaternion) (arg1 matrix)) - "Convert a matrix with a rotation and scale into a quaternion (just the rotation)" + "Convert a matrix with a rotation and scale into a quaternion (just the rotation)." (local-vars (a1-4 float)) (rlet ((vf1 :class vf) (vf2 :class vf) @@ -584,9 +581,9 @@ (vf7 :class vf) ) (let ((v1-0 (new-stack-matrix0))) - (let* ((f0-1 (vector-dot (the-as vector (-> arg1 data)) (the-as vector (-> arg1 data)))) - (f1-1 (vector-dot (the-as vector (&-> arg1 data 4)) (the-as vector (&-> arg1 data 4)))) - (f2-1 (vector-dot (the-as vector (&-> arg1 data 8)) (the-as vector (&-> arg1 data 8)))) + (let* ((f0-1 (vector-dot (-> arg1 vector 0) (-> arg1 vector 0))) + (f1-1 (vector-dot (-> arg1 vector 1) (-> arg1 vector 1))) + (f2-1 (vector-dot (-> arg1 vector 2) (-> arg1 vector 2))) (f0-3 (/ 1.0 (sqrtf f0-1))) (f1-3 (/ 1.0 (sqrtf f1-1))) (f2-3 (/ 1.0 (sqrtf f2-1))) @@ -620,11 +617,7 @@ (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)))) ) (defun quaternion-log! ((arg0 quaternion) (arg1 quaternion)) @@ -649,8 +642,8 @@ ) (defun quaternion-exp! ((arg0 quaternion) (arg1 quaternion)) - "Quaternion exponentiation. Unused" - (let ((f30-0 (vector-length (the-as vector arg1)))) + "Quaternion exponentiation. Unused." + (let ((f30-0 (vector-length (-> arg1 vec)))) (cond ((= f30-0 0.0) (set! (-> arg0 x) 0.0) @@ -699,17 +692,15 @@ (let ((v1-8 (* arg3 f30-0))) (.mov vf2 v1-8) ) - (.lvf vf3 (&-> arg1 vec quad)) - (.lvf vf4 (&-> arg2 vec quad)) + (.lvf vf3 (&-> arg1 quad)) + (.lvf vf4 (&-> arg2 quad)) (.mul.x.vf acc vf3 vf1) (.add.mul.x.vf vf3 vf4 vf2 acc) - (.svf (&-> arg0 vec quad) vf3) + (.svf (&-> arg0 quad) vf3) (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)) ) @@ -726,11 +717,11 @@ ) ) (.mul.x.vf vf1 vf1 vf2) - (.lvf vf3 (&-> arg1 vec quad)) - (.lvf vf4 (&-> arg2 vec quad)) + (.lvf vf3 (&-> arg1 quad)) + (.lvf vf4 (&-> arg2 quad)) (.mul.x.vf acc vf3 vf1) (.add.mul.y.vf vf3 vf4 vf1 acc) - (.svf (&-> arg0 vec quad) vf3) + (.svf (&-> arg0 quad) vf3) (.mov v1-15 vf3) ) ) @@ -763,11 +754,11 @@ (.mov vf2 v1-6) ) ) - (.lvf vf3 (&-> arg1 vec quad)) - (.lvf vf4 (&-> arg2 vec quad)) + (.lvf vf3 (&-> arg1 quad)) + (.lvf vf4 (&-> arg2 quad)) (.mul.x.vf acc vf3 vf1) (.add.mul.x.vf vf3 vf4 vf2 acc) - (.svf (&-> arg0 vec quad) vf3) + (.svf (&-> arg0 quad) vf3) (quaternion-normalize! arg0) arg0 ) @@ -783,10 +774,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))) ) ) @@ -847,54 +836,54 @@ (.mul.x.vf.w vf5 vf0 vf5) (.mul.vf acc vf6 vf4) (.add.mul.vf vf7 vf5 vf3 acc) - (.svf (&-> arg0 vec quad) vf7) + (.svf (&-> arg0 quad) vf7) arg0 ) ) (defun vector-x-quaternion! ((arg0 vector) (arg1 quaternion)) - "Get the first row of the rotation matrix for this quaternion" + "Get the first row of the rotation matrix for this quaternion." (let ((s5-0 (new-stack-matrix0))) (quaternion->matrix s5-0 arg1) - (set! (-> arg0 quad) (-> (the-as (pointer uint128) (-> s5-0 data)) 0)) + (set! (-> arg0 quad) (-> (the-as (pointer uint128) (-> s5-0 vector)) 0)) ) arg0 ) (defun vector-y-quaternion! ((arg0 vector) (arg1 quaternion)) - "Get the second row of the rotation matrix for this quaternion" + "Get the second row of the rotation matrix for this quaternion." (let ((s5-0 (new-stack-matrix0))) (quaternion->matrix s5-0 arg1) - (set! (-> arg0 quad) (-> (the-as (pointer uint128) (&-> s5-0 data 4)) 0)) + (set! (-> arg0 quad) (-> (the-as (pointer uint128) (-> s5-0 vector 1)) 0)) ) arg0 ) (defun vector-z-quaternion! ((arg0 vector) (arg1 quaternion)) - "Get the third row of the rotation matrix for this quaternion" + "Get the third row of the rotation matrix for this quaternion." (let ((s5-0 (new-stack-matrix0))) (quaternion->matrix s5-0 arg1) - (set! (-> arg0 quad) (-> (the-as (pointer uint128) (&-> s5-0 data 8)) 0)) + (set! (-> arg0 quad) (-> (the-as (pointer uint128) (-> s5-0 vector 2)) 0)) ) arg0 ) (defun quaternion-x-angle ((arg0 quaternion)) - "Get the x rotation angle. Not very efficient" + "Get the x rotation angle. Not very efficient." (let ((v1-1 (vector-y-quaternion! (new 'stack-no-clear 'vector) arg0))) (atan (-> v1-1 z) (-> v1-1 y)) ) ) (defun quaternion-y-angle ((arg0 quaternion)) - "Get the y rotation angle. Not very efficient" + "Get the y rotation angle. Not very efficient." (let ((v1-1 (vector-z-quaternion! (new 'stack-no-clear 'vector) arg0))) (atan (-> v1-1 x) (-> v1-1 z)) ) ) (defun quaternion-z-angle ((arg0 quaternion)) - "Get the z rotation angle. Not very efficient" + "Get the z rotation angle. Not very efficient." (let ((v1-1 (vector-y-quaternion! (new 'stack-no-clear 'vector) arg0))) (atan (-> v1-1 x) (-> v1-1 y)) ) @@ -931,14 +920,14 @@ ) (defun quaternion-rotate-y! ((arg0 quaternion) (arg1 quaternion) (arg2 float)) - "Rotate existing quaternion along y axis (right multiply)" + "Rotate existing quaternion along y axis (right multiply)." (let ((a1-2 (quaternion-vector-angle! (new-stack-quaternion0) (new 'static 'vector :y 1.0 :w 1.0) arg2))) (quaternion-normalize! (quaternion*! arg0 a1-2 arg1)) ) ) (defun quaternion-rotate-x! ((arg0 quaternion) (arg1 quaternion) (arg2 float)) - "Rotate existing quaternion along x axis (right multiply)" + "Rotate existing quaternion along x axis (right multiply)." (let ((a1-3 (quaternion-vector-angle! (new-stack-quaternion0) (vector-x-quaternion! (new-stack-vector0) arg1) arg2)) ) (quaternion-normalize! (quaternion*! arg0 a1-3 arg1)) @@ -946,7 +935,7 @@ ) (defun quaternion-rotate-z! ((arg0 quaternion) (arg1 quaternion) (arg2 float)) - "Rotate existing quaternion along z axis (right multiply)" + "Rotate existing quaternion along z axis (right multiply)." (let ((a1-3 (quaternion-vector-angle! (new-stack-quaternion0) (vector-z-quaternion! (new-stack-vector0) arg1) arg2)) ) (quaternion-normalize! (quaternion*! arg0 a1-3 arg1)) @@ -954,7 +943,7 @@ ) (defun quaternion-delta-y ((arg0 quaternion) (arg1 quaternion)) - "Difference in yaw between two quaternions" + "Difference in yaw between two quaternions." (acos (vector-dot (vector-z-quaternion! (new 'stack-no-clear 'vector) arg0) (vector-z-quaternion! (new 'stack-no-clear 'vector) arg1) @@ -963,7 +952,6 @@ ) (defun quaternion-rotate-y-to-vector! ((arg0 quaternion) (arg1 quaternion) (arg2 quaternion) (arg3 float)) - "Rotate along y so z-axis points to match another. Use arg3 as the max rotation amount." (let ((s5-0 (new 'stack-no-clear 'quaternion))) (let ((t9-0 vector-xz-normalize!) (a0-1 (new 'stack-no-clear 'vector)) @@ -1029,7 +1017,7 @@ ) (defun quaternion<-rotate-y-vector ((arg0 quaternion) (arg1 vector)) - "Create a quaternion representing only the yaw of the given vector" + "Create a quaternion representing only the yaw of the given vector." (quaternion-vector-angle! arg0 (new 'static 'vector :y 1.0 :w 1.0) (vector-y-angle arg1)) ) @@ -1051,7 +1039,7 @@ ) (defun quaternion-xz-angle ((arg0 quaternion)) - "yet another function to compute the yaw of a quaternion. This is a particularly inefficient version." + "Yet another function to compute the yaw of a quaternion. This is a particularly inefficient version." (let ((gp-0 (new 'stack-no-clear 'matrix)) (s5-0 (new 'stack-no-clear 'vector)) ) @@ -1061,7 +1049,3 @@ (vector-y-angle s5-0) ) ) - - - - diff --git a/goal_src/jak2/engine/math/transformq.gc b/goal_src/jak2/engine/math/transformq.gc index 8faa9f2ba1..16bae4c0df 100644 --- a/goal_src/jak2/engine/math/transformq.gc +++ b/goal_src/jak2/engine/math/transformq.gc @@ -129,7 +129,7 @@ ) (let ((s4-0 (-> s3-0 vector 2))) (vector-normalize! (vector-flatten! (-> s3-0 vector 1) s1-0 s4-0) 1.0) - (vector-cross! (the-as vector (-> s3-0 vector)) (-> s3-0 vector 1) s4-0) + (vector-cross! (-> s3-0 vector 0) (-> s3-0 vector 1) s4-0) ) (let ((a1-5 (matrix-rotate-z! (new 'stack-no-clear 'matrix) arg0))) (matrix*! s3-0 a1-5 s3-0) @@ -138,7 +138,7 @@ ) ) -(defmethod roll-relative-to-gravity trsqv ((this trsqv)) +(defmethod roll-relative-to-gravity ((this trsqv)) "Get our roll, relative to 'down' from gravity" (let* ((s5-0 (get-quaternion this)) (gp-0 (vector-z-quaternion! (new 'stack-no-clear 'vector) s5-0)) @@ -154,6 +154,9 @@ ) ) +;; ERROR: Unsupported inline assembly instruction kind - [mula.s f0, f3] +;; 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)) "Adjust our orientation toward target, subject to some rate limits. For jak 1, I said: @@ -161,65 +164,47 @@ where an axis flips by 180 degrees. But now they use matrix-from-two-vectors-the-long-way-smooth to fix it! Good job. This additionally uses the fancy logic of matrix-from-two-vectors-smooth." - (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)) - ;; og:preserve-this inlined vector-dot - ; (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)) - ) - (set! f0-4 (vector-dot sv-256 v1-5)) - ; (.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/goal_src/jak2/engine/nav/nav-control.gc b/goal_src/jak2/engine/nav/nav-control.gc index 7cf3ea264d..e0af77746a 100644 --- a/goal_src/jak2/engine/nav/nav-control.gc +++ b/goal_src/jak2/engine/nav/nav-control.gc @@ -12,11 +12,12 @@ (define *nav-last-triangle-test-count* 0) (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 ) ) @@ -27,9 +28,9 @@ (none) ) -(defmethod relocate ((this nav-control) (arg0 int)) - (&+! (-> this process) arg0) - (&+! (-> this shape) arg0) +(defmethod relocate ((this nav-control) (offset int)) + (&+! (-> this process) offset) + (&+! (-> this shape) offset) this ) @@ -185,10 +186,10 @@ ;; WARN: Function get-nav-control has a return type of none, but the expression builder found a return statement. (defun get-nav-control ((arg0 process-drawable) (arg1 nav-mesh)) "Given a [[process-drawable]] get the associated [[nav-control]] using either: -- the provided `nav-mesh` arg -- the `nav-mesh` associated with the [[process-drawable]]'s [[entity]] -If no [[nav-mesh]] is set or found, set the [[entity]]'s [[entity-perm-status]] to TODO and return an error. -Note that this doesn't actually return the nav-control, but instead adds this process-drawable to the nav-mesh." + - the provided `nav-mesh` arg + - the `nav-mesh` associated with the [[process-drawable]]'s [[entity]] + If no [[nav-mesh]] is set or found, set the [[entity]]'s [[entity-perm-status]] to TODO and return an error. + Note that this doesn't actually return the nav-control, but instead adds this process-drawable to the nav-mesh." (if (not arg1) (set! arg1 (nav-mesh-from-res-tag (-> arg0 entity) 'nav-mesh-actor 0)) ) @@ -239,50 +240,51 @@ Note that this doesn't actually return the nav-control, but instead adds this pr ) (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)) + ) ) ) ) @@ -348,7 +350,7 @@ Note that this doesn't actually return the nav-control, but instead adds this pr (defun add-nav-sphere ((nav nav-control) (sphere sphere) (max-spheres int)) "Adds the given [[sphere]] to the [[nav-control]]'s `sphere-array` so long as -`max-spheres` is less than [[nav-control]]'s `sphere-count`" + `max-spheres` is less than [[nav-control]]'s `sphere-count`" (local-vars (a2-4 float)) (rlet ((vf1 :class vf) (vf2 :class vf) @@ -369,10 +371,7 @@ Note that this doesn't actually return the nav-control, but instead adds this pr (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) @@ -412,10 +411,7 @@ Note that this doesn't actually return the nav-control, but instead adds this pr (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) @@ -446,10 +442,7 @@ Note that this doesn't actually return the nav-control, but instead adds this pr (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) @@ -572,10 +565,7 @@ Note that this doesn't actually return the nav-control, but instead adds this pr (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)) @@ -622,19 +612,13 @@ Note that this doesn't actually return the nav-control, but instead adds this pr (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 @@ -666,19 +650,13 @@ Note that this doesn't actually return the nav-control, but instead adds this pr (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 @@ -757,9 +735,7 @@ Note that this doesn't actually return the nav-control, but instead adds this pr (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)) @@ -773,16 +749,13 @@ Note that this doesn't actually return the nav-control, but instead adds this pr (.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-! (the-as vector (-> s5-0 temp-dir)) (-> arg0 current-pos) (the-as vector a0-13)) + (vector-! (-> s5-0 temp-dir 0) (-> arg0 current-pos) (the-as vector a0-13)) (set! (-> s5-0 temp-dir 0 y) 0.0) - (if (< 0.0 (vector-dot (the-as vector (-> s5-0 temp-dir)) (-> s5-0 in-dir))) + (if (< 0.0 (vector-dot (-> s5-0 temp-dir 0) (-> s5-0 in-dir))) (+! (-> s5-0 initial-ignore-mask) (ash 1 v1-10)) ) (set! (-> s5-0 inside-dist) (- (-> a0-13 r) (sqrtf (-> s5-0 dist2)))) @@ -812,12 +785,7 @@ Note that this doesn't actually return the nav-control, but instead adds this pr (label cfg-13) (+! (-> s5-0 initial-ignore-mask) (ash 1 (-> s5-0 i-first-sphere))) (let ((a1-17 (-> this sphere-array (-> s5-0 i-first-sphere)))) - (circle-tangent-directions - (-> arg0 current-pos) - a1-17 - (the-as vector (-> s5-0 temp-dir)) - (-> s5-0 temp-dir 1) - ) + (circle-tangent-directions (-> arg0 current-pos) a1-17 (-> s5-0 temp-dir 0) (-> s5-0 temp-dir 1)) ) (dotimes (v1-20 2) (let ((a0-28 (vector-dot (-> s5-0 right-dir) (-> s5-0 temp-dir v1-20)))) @@ -844,7 +812,7 @@ Note that this doesn't actually return the nav-control, but instead adds this pr (circle-tangent-directions (-> arg0 current-pos) (-> this sphere-array v1-28) - (the-as vector (-> s5-0 temp-dir)) + (-> s5-0 temp-dir 0) (-> s5-0 temp-dir 1) ) (set! (-> s5-0 dir-update) #f) @@ -990,9 +958,9 @@ Note that this doesn't actually return the nav-control, but instead adds this pr (.svf (&-> v1-55 quad) vf1) ) ) - (vector-dot (-> s5-0 in-dir) (the-as vector (-> s5-0 best-dir))) + (vector-dot (-> s5-0 in-dir) (-> s5-0 best-dir 0)) (vector-dot (-> s5-0 in-dir) (-> s5-0 best-dir 1)) - (let* ((f0-52 (vector-dot (-> arg0 pref-dir) (the-as vector (-> s5-0 best-dir)))) + (let* ((f0-52 (vector-dot (-> arg0 pref-dir) (-> s5-0 best-dir 0))) (a1-41 (if (< (vector-dot (-> arg0 pref-dir) (-> s5-0 best-dir 1)) f0-52) 0 1 @@ -1000,7 +968,7 @@ Note that this doesn't actually return the nav-control, but instead adds this pr ) (v1-65 (- 1 a1-41)) ) - (vector-float*! (the-as vector (-> arg0 out-travel)) (-> s5-0 best-dir a1-41) (-> s5-0 travel-len)) + (vector-float*! (-> arg0 out-travel 0) (-> s5-0 best-dir a1-41) (-> s5-0 travel-len)) (vector-float*! (-> arg0 out-travel 1) (-> s5-0 best-dir v1-65) (-> s5-0 travel-len)) ) ) @@ -1052,9 +1020,7 @@ Note that this doesn't actually return the nav-control, but instead adds this pr (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)) @@ -1068,16 +1034,13 @@ Note that this doesn't actually return the nav-control, but instead adds this pr (.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-! (the-as vector (-> s5-0 temp-dir)) (-> arg0 current-pos) (the-as vector a0-13)) + (vector-! (-> s5-0 temp-dir 0) (-> arg0 current-pos) (the-as vector a0-13)) (set! (-> s5-0 temp-dir 0 y) 0.0) - (if (< 0.0 (vector-dot (the-as vector (-> s5-0 temp-dir)) (-> s5-0 in-dir))) + (if (< 0.0 (vector-dot (-> s5-0 temp-dir 0) (-> s5-0 in-dir))) (+! (-> s5-0 initial-ignore-mask) (ash 1 v1-9)) ) ) @@ -1102,12 +1065,7 @@ Note that this doesn't actually return the nav-control, but instead adds this pr (label cfg-11) (+! (-> s5-0 initial-ignore-mask) (ash 1 (-> s5-0 i-first-sphere))) (let ((a1-15 (-> this sphere-array (-> s5-0 i-first-sphere)))) - (circle-tangent-directions - (-> arg0 current-pos) - a1-15 - (the-as vector (-> s5-0 temp-dir)) - (-> s5-0 temp-dir 1) - ) + (circle-tangent-directions (-> arg0 current-pos) a1-15 (-> s5-0 temp-dir 0) (-> s5-0 temp-dir 1)) ) (dotimes (v1-19 2) (let ((a0-31 (vector-dot (-> s5-0 right-dir) (-> s5-0 temp-dir v1-19)))) @@ -1121,9 +1079,9 @@ Note that this doesn't actually return the nav-control, but instead adds this pr ) ) 0 - (vector-dot (-> s5-0 in-dir) (the-as vector (-> s5-0 best-dir))) + (vector-dot (-> s5-0 in-dir) (-> s5-0 best-dir 0)) (vector-dot (-> s5-0 in-dir) (-> s5-0 best-dir 1)) - (let* ((f0-28 (vector-dot (-> arg0 pref-dir) (the-as vector (-> s5-0 best-dir)))) + (let* ((f0-28 (vector-dot (-> arg0 pref-dir) (-> s5-0 best-dir 0))) (a1-25 (if (< (vector-dot (-> arg0 pref-dir) (-> s5-0 best-dir 1)) f0-28) 0 1 @@ -1131,7 +1089,7 @@ Note that this doesn't actually return the nav-control, but instead adds this pr ) (v1-32 (- 1 a1-25)) ) - (vector-float*! (the-as vector (-> arg0 out-travel)) (-> s5-0 best-dir a1-25) (-> s5-0 travel-len)) + (vector-float*! (-> arg0 out-travel 0) (-> s5-0 best-dir a1-25) (-> s5-0 travel-len)) (vector-float*! (-> arg0 out-travel 1) (-> s5-0 best-dir v1-32) (-> s5-0 travel-len)) ) ) @@ -1154,33 +1112,7 @@ Note that this doesn't actually return the nav-control, but instead adds this pr ) (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) @@ -1191,180 +1123,193 @@ Note that this doesn't actually return the nav-control, but instead adds this pr (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 @@ -1375,15 +1320,14 @@ Note that this doesn't actually return the nav-control, but instead adds this pr ;; 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) @@ -1450,34 +1394,7 @@ Note that this doesn't actually return the nav-control, but instead adds this pr (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) @@ -1490,203 +1407,218 @@ Note that this doesn't actually return the nav-control, but instead adds this pr (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 @@ -1785,9 +1717,9 @@ Note that this doesn't actually return the nav-control, but instead adds this pr (none) ) -(defmethod relocate ((this nav-state) (arg0 int)) +(defmethod relocate ((this nav-state) (offset int)) (break!) - (&+! (-> this nav) arg0) + (&+! (-> this nav) offset) this ) @@ -2090,9 +2022,9 @@ Note that this doesn't actually return the nav-control, but instead adds this pr ) (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)))) @@ -2131,9 +2063,7 @@ Note that this doesn't actually return the nav-control, but instead adds this pr (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) ) @@ -2159,10 +2089,7 @@ Note that this doesn't actually return the nav-control, but instead adds this pr (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))) @@ -2172,7 +2099,7 @@ Note that this doesn't actually return the nav-control, but instead adds this pr ) (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))) ) ) ) @@ -2185,13 +2112,7 @@ Note that this doesn't actually return the nav-control, but instead adds this pr ) (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) @@ -2199,159 +2120,157 @@ Note that this doesn't actually return the nav-control, but instead adds this pr ) (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-! (the-as vector (-> s5-1 vector)) (-> sv-120 1) (-> sv-120 0)) - (vector-normalize! (the-as vector (-> s5-1 vector)) 409.6) - (vector+! (-> sv-120 0) (-> sv-120 0) (the-as vector (-> s5-1 vector))) - (vector-! (-> sv-120 1) (-> sv-120 1) (the-as vector (-> s5-1 vector))) - ) - (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)) @@ -2361,10 +2280,8 @@ Note that this doesn't actually return the nav-control, but instead adds this pr (.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))) ) ) @@ -2374,21 +2291,6 @@ Note that this doesn't actually return the nav-control, but instead adds this pr ) (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) @@ -2399,13 +2301,9 @@ Note that this doesn't actually return the nav-control, but instead adds this pr (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)) @@ -2448,66 +2346,71 @@ Note that this doesn't actually return the nav-control, but instead adds this pr (+! 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) + ) ) ) ) @@ -2533,21 +2436,6 @@ Note that this doesn't actually return the nav-control, but instead adds this pr ) (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) @@ -2569,13 +2457,9 @@ Note that this doesn't actually return the nav-control, but instead adds this pr (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)) @@ -2618,66 +2502,71 @@ Note that this doesn't actually return the nav-control, but instead adds this pr (+! 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) + ) ) ) ) @@ -2736,10 +2625,9 @@ Note that this doesn't actually return the nav-control, but instead adds this pr (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) @@ -2783,10 +2671,9 @@ Note that this doesn't actually return the nav-control, but instead adds this pr ) ) (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) @@ -2837,11 +2724,8 @@ Note that this doesn't actually return the nav-control, but instead adds this pr ) (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)) ) ) @@ -2857,7 +2741,6 @@ Note that this doesn't actually return the nav-control, but instead adds this pr ) (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)) @@ -2868,23 +2751,22 @@ Note that this doesn't actually return the nav-control, but instead adds this pr (-> 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)) @@ -2974,7 +2856,6 @@ Note that this doesn't actually return the nav-control, but instead adds this pr ) (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 @@ -2991,11 +2872,8 @@ Note that this doesn't actually return the nav-control, but instead adds this pr ) (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)) ) ) @@ -3010,17 +2888,19 @@ Note that this doesn't actually return the nav-control, but instead adds this pr 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)) @@ -3028,16 +2908,16 @@ Note that this doesn't actually return the nav-control, but instead adds this pr ) (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) ) @@ -3151,21 +3031,6 @@ Note that this doesn't actually return the nav-control, but instead adds this pr ) (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) @@ -3188,13 +3053,9 @@ Note that this doesn't actually return the nav-control, but instead adds this pr (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)) @@ -3237,66 +3098,71 @@ Note that this doesn't actually return the nav-control, but instead adds this pr (+! 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) + ) ) ) ) @@ -3339,8 +3205,8 @@ Note that this doesn't actually return the nav-control, but instead adds this pr (vector-reset! (-> s5-0 in-dir)) (set! (-> s5-0 best-dir 0 quad) (-> this travel quad)) (set! (-> s5-0 best-dir 0 y) 0.0) - (vector-normalize! (the-as vector (-> s5-0 best-dir)) (-> this nav target-speed)) - (vector-! (-> s5-0 right-dir) (the-as vector (-> s5-0 best-dir)) (-> this velocity)) + (vector-normalize! (-> s5-0 best-dir 0) (-> this nav target-speed)) + (vector-! (-> s5-0 right-dir) (-> s5-0 best-dir 0) (-> this velocity)) (vector-float*! (-> s5-0 right-dir) (-> s5-0 right-dir) 4.0) (vector+! (-> s5-0 in-dir) (-> s5-0 in-dir) (-> s5-0 right-dir)) (dotimes (s4-0 (-> this nav sphere-count)) @@ -3355,8 +3221,7 @@ Note that this doesn't actually return the nav-control, but instead adds this pr (.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)) @@ -3376,10 +3241,8 @@ Note that this doesn't actually return the nav-control, but instead adds this pr (.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))) ) ) @@ -3412,10 +3275,9 @@ Note that this doesn't actually return the nav-control, but instead adds this pr (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/goal_src/jak2/engine/nav/nav-enemy.gc b/goal_src/jak2/engine/nav/nav-enemy.gc index ae804edada..a9e735ea72 100644 --- a/goal_src/jak2/engine/nav/nav-enemy.gc +++ b/goal_src/jak2/engine/nav/nav-enemy.gc @@ -27,7 +27,7 @@ (defmethod general-event-handler ((this nav-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" + @TODO - unsure if there is a pattern for the events and this should have a more specific name" (case arg2 (('nav-mesh-kill) (deactivate this) @@ -106,9 +106,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) ) @@ -199,9 +197,9 @@ (defmethod common-post ((self nav-enemy)) "Does a lot of various things relating to interacting with the target -- tracks when the enemy was last drawn -- looks at the target and handles attacking -@TODO Not extremely well understood yet" + - tracks when the enemy was last drawn + - looks at the target and handles attacking + @TODO Not extremely well understood yet" (if (and (nonzero? (-> self draw)) (logtest? (-> self draw status) (draw-control-status on-screen))) (set-time! (-> self last-draw-time)) ) @@ -906,10 +904,10 @@ (defmethod in-aggro-range? ((this nav-enemy) (arg0 process-focusable) (arg1 vector)) "Should the enemy activate. -- if `activate-distance` is `0.0`, always true -- otherwise, check if the provided process is close enough -@param proc The process used to distance check -@returns true/false" + - if `activate-distance` is `0.0`, always true + - otherwise, check if the provided process is close enough + @param proc The process used to distance check + @returns true/false" (if (and arg0 (not arg1)) (set! arg1 (get-trans arg0 1)) ) @@ -920,10 +918,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) ) ) @@ -1042,7 +1038,7 @@ ;; WARN: Return type mismatch float vs none. (defmethod set-enemy-info! ((this nav-enemy) (arg0 nav-enemy-info)) "In addition to setting the `enemy-info`, also init the `neck-joint` if applicable from it -@param info Set `enemy-info` accordingly" + @param info Set `enemy-info` accordingly" (set! (-> this enemy-info) arg0) (set! (-> arg0 callback-info) *nav-enemy-callback-info*) (when (and (!= (-> this enemy-info neck-joint) -1) (zero? (-> this neck))) @@ -1061,7 +1057,6 @@ (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!)) @@ -1163,8 +1158,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)) @@ -1232,11 +1228,11 @@ (defmethod init-from-entity! ((this nav-enemy) (arg0 entity-actor)) "Typically the method that does the initial setup on the process, potentially using the [[entity-actor]] provided as part of that. -This commonly includes things such as: -- stack size -- collision information -- loading the skeleton group / bones -- sounds" + This commonly includes things such as: + - stack size + - collision information + - loading the skeleton group / bones + - sounds" (init-enemy-collision! this) (process-drawable-from-entity! this arg0) (init-enemy! this) diff --git a/goal_src/jak2/engine/nav/nav-mesh-h.gc b/goal_src/jak2/engine/nav/nav-mesh-h.gc index 5db13770f6..0819294382 100644 --- a/goal_src/jak2/engine/nav/nav-mesh-h.gc +++ b/goal_src/jak2/engine/nav/nav-mesh-h.gc @@ -20,6 +20,7 @@ ;; DECOMP BEGINS (deftype nav-mesh-work-debug (structure) + "Debug outputs for the nav-mesh assembly functions" ((debug-vec1 vector :inline) (debug-vec2 vector :inline) (debug-vec3 vector :inline) @@ -38,6 +39,7 @@ (deftype nav-mesh-work (structure) + "Workspace for nav-mesh processing functions." ((vert0-table int8 4) (vert1-table int8 4) (edge-mask-table uint8 3) @@ -61,6 +63,7 @@ (deftype nav-mesh-link (structure) + "Link between two different meshes" ((id uint32) (dest-mesh-id uint32) (src-link-poly-id uint8) @@ -73,6 +76,8 @@ (deftype nav-poly (structure) + "Polygon within a nav-mesh. Can be a tri or quad. +Based on the implementation of point-poly-intersection?, these should likely be convex." ((data uint8 64) (vertex vector 4 :inline :overlay-at (-> data 0)) (vertex0 vector :inline :overlay-at (-> data 0)) @@ -162,6 +167,7 @@ and declared out of order (cannot use forward declared structures in inline arra (deftype nav-mesh (basic) + "Mesh used for creature/enemy navigation." ((work nav-mesh-work) (poly-array (inline-array nav-poly)) (static-sphere-count uint8) @@ -231,6 +237,7 @@ and declared out of order (cannot use forward declared structures in inline arra (defun vector-normalize-unity! ((arg0 vector)) + "Normalize a vector (xyz only) in place." (rlet ((acc :class vf) (Q :class vf) (vf0 :class vf) @@ -263,6 +270,7 @@ and declared out of order (cannot use forward declared structures in inline arra ) (defun vector-normalize-unity-copy! ((arg0 vector) (arg1 vector)) + "Normalize a vector (xyz only)" (rlet ((acc :class vf) (Q :class vf) (vf0 :class vf) @@ -296,10 +304,12 @@ and declared out of order (cannot use forward declared structures in inline arra ) (defun-debug debug-validate-current-poly () + "Not implemented." #f ) (defun init-ray ((arg0 nav-ray)) + "Set up a nav-ray. Assumes that dest-pos and current-pos are set." (rlet ((acc :class vf) (Q :class vf) (vf0 :class vf) @@ -342,17 +352,18 @@ and declared out of order (cannot use forward declared structures in inline arra ) ) -(defun point-poly-intersection? ((arg0 nav-mesh) (arg1 vector) (arg2 int) (arg3 (inline-array vector))) - (let ((v1-1 (-> arg0 work vert0-table)) - (a0-2 (-> arg0 work vert1-table)) +(defun point-poly-intersection? ((mesh nav-mesh) (pt vector) (num-verts int) (verts (inline-array vector))) + "Check if a point is inside a poly." + (let ((v1-1 (-> mesh work vert0-table)) + (a0-2 (-> mesh work vert1-table)) ) - (dotimes (t0-0 arg2) - (let* ((t1-3 (-> arg3 (-> v1-1 t0-0))) - (t2-3 (-> arg3 (-> a0-2 t0-0))) + (dotimes (t0-0 num-verts) + (let* ((t1-3 (-> verts (-> v1-1 t0-0))) + (t2-3 (-> verts (-> a0-2 t0-0))) (f0-1 (- (-> t1-3 z) (-> t2-3 z))) (f1-2 (- (-> t2-3 x) (-> t1-3 x))) - (f2-2 (- (-> arg1 x) (-> t1-3 x))) - (f3-2 (- (-> arg1 z) (-> t1-3 z))) + (f2-2 (- (-> pt x) (-> t1-3 x))) + (f3-2 (- (-> pt z) (-> t1-3 z))) (f0-3 (+ (* f2-2 f0-1) (* f3-2 f1-2))) ) (if (< 0.0 f0-3) @@ -365,6 +376,7 @@ and declared out of order (cannot use forward declared structures in inline arra ) (defmethod point-in-poly? ((this nav-mesh) (arg0 nav-poly) (arg1 vector)) + "Check if a point is inside a poly of this mesh" (let* ((a3-0 this) (v1-0 arg1) (a0-1 (-> arg0 vertex-count)) @@ -392,40 +404,43 @@ 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)) - (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)) - ) + "Find the point on the polygon edge that is closest to the query point." + (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) ) ;; WARN: Return type mismatch vector vs none. (defmethod project-point-into-poly-2d ((this nav-mesh) (arg0 nav-poly) (arg1 vector) (arg2 vector)) - (local-vars (sv-48 vector) (sv-52 vector) (sv-56 float)) + "Find the point in the polygon closest to the query point." (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)) @@ -446,81 +461,72 @@ and declared out of order (cannot use forward declared structures in inline arra ) (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) + ) ) ) ) @@ -530,6 +536,7 @@ and declared out of order (cannot use forward declared structures in inline arra ) (defun-debug nav-sphere-from-cam () + "Print out a SPHEREM from the current camera position, possibly used by their level-building tool." (let ((v1-0 (camera-pos))) (format #t "SPHEREM(~4,,1M, ~4,,1M, ~4,,1M, 1.0)~%" (-> v1-0 x) (-> v1-0 y) (-> v1-0 z)) ) diff --git a/goal_src/jak2/engine/physics/chain-physics.gc b/goal_src/jak2/engine/physics/chain-physics.gc index 81d11dccaf..dbed76fa43 100644 --- a/goal_src/jak2/engine/physics/chain-physics.gc +++ b/goal_src/jak2/engine/physics/chain-physics.gc @@ -70,27 +70,7 @@ ) (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) @@ -133,209 +113,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! (the-as vector (-> s4-0 vector)) (-> s4-0 vector 1) s2-0) - (vector-normalize! (the-as vector (-> s4-0 vector)) 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 (the-as vector (-> s4-0 vector)) sv-496) (cos (-> this axial-slop))) - (vector-cross! sv-496 sv-496 (the-as vector (-> s4-0 vector))) - (vector-cross! sv-496 (the-as vector (-> s4-0 vector)) 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) (the-as vector (-> s4-0 vector)) (-> 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 ) ) @@ -345,10 +330,10 @@ ) ) -(defmethod relocate ((this chain-physics) (arg0 int)) +(defmethod relocate ((this chain-physics) (offset int)) (dotimes (v1-0 (the-as int (-> this num-joints))) (if (nonzero? (-> this chain-joints v1-0 joint-mod)) - (&+! (-> this chain-joints v1-0 joint-mod) arg0) + (&+! (-> this chain-joints v1-0 joint-mod) offset) ) ) this diff --git a/goal_src/jak2/engine/physics/rigid-body.gc b/goal_src/jak2/engine/physics/rigid-body.gc index 8f109b41fe..23e4168c9a 100644 --- a/goal_src/jak2/engine/physics/rigid-body.gc +++ b/goal_src/jak2/engine/physics/rigid-body.gc @@ -65,16 +65,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))) @@ -219,8 +212,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) @@ -634,16 +626,6 @@ ) (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) @@ -675,46 +657,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))) @@ -1131,11 +1119,11 @@ (let ((s5-1 (get-touched-prim s3-0 (-> this root) arg1))) (when s5-1 (set! (-> arg0 prim-id) (-> s5-1 prim-id)) - (vector-! (-> arg0 normal) (-> arg0 point) (the-as vector (-> s5-1 prim-core))) + (vector-! (-> arg0 normal) (-> arg0 point) (-> s5-1 prim-core world-sphere)) (vector-normalize! (-> arg0 normal) 1.0) (vector+float*! (-> arg0 point) - (the-as vector (-> s5-1 prim-core)) + (-> s5-1 prim-core world-sphere) (-> arg0 normal) (-> s5-1 prim-core world-sphere w) ) @@ -1319,11 +1307,7 @@ (format *stdcon* "rigid-body-object got touched~%") ) (when (zero? (-> arg0 rbody)) - (let ((s3-0 (if (type? arg0 process-focusable) - (the-as process-focusable arg0) - ) - ) - ) + (let ((s3-0 (as-type arg0 process-focusable))) (when s3-0 (when (logtest? (-> s3-0 mask) (process-mask target)) (logior! (-> this flags) (rigid-body-object-flag player-touching)) @@ -1350,11 +1334,7 @@ (('edge-grabbed 'pilot-edge-grab) (let ((s5-2 (the-as object (-> arg3 param 0)))) (when (not (logtest? (-> this flags) (rigid-body-object-flag player-impulse-force))) - (let ((a0-25 (if (type? arg0 process-focusable) - (the-as process-focusable arg0) - ) - ) - ) + (let ((a0-25 (as-type arg0 process-focusable))) (when a0-25 (let ((f0-1 (/ 163840.0 (get-inv-mass a0-25)))) (logior! (-> this flags) (rigid-body-object-flag player-touching player-edge-grabbing player-contact-force)) @@ -1371,12 +1351,7 @@ (('ridden) (let ((v1-45 (the-as object (-> arg3 param 0)))) (when (the-as uint v1-45) - (let* ((s5-3 (handle->process (-> (the-as focus v1-45) handle))) - (a0-34 (if (type? s5-3 process-focusable) - (the-as process-focusable s5-3) - ) - ) - ) + (let ((a0-34 (as-type (handle->process (-> (the-as focus v1-45) handle)) process-focusable))) (when (and a0-34 (logtest? (-> a0-34 mask) (process-mask target)) (not (logtest? (-> a0-34 focus-status) (focus-status on-water under-water))) @@ -1398,11 +1373,7 @@ ) (('bonk) (when #t - (let ((a0-38 (if (type? arg0 process-focusable) - (the-as process-focusable arg0) - ) - ) - ) + (let ((a0-38 (as-type arg0 process-focusable))) (when a0-38 (logior! (-> this flags) (rigid-body-object-flag player-touching player-impulse-force)) (set! (-> this player-force-position quad) (-> a0-38 root trans quad)) diff --git a/goal_src/jak2/engine/physics/trajectory.gc b/goal_src/jak2/engine/physics/trajectory.gc index 20f4d92032..a3da6df602 100644 --- a/goal_src/jak2/engine/physics/trajectory.gc +++ b/goal_src/jak2/engine/physics/trajectory.gc @@ -45,10 +45,9 @@ ) (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))) @@ -79,13 +78,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)) @@ -96,9 +89,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) ) @@ -147,8 +138,8 @@ (defmethod update-from-cspace ((this impact-control)) (when (>= (-> this joint) 0) (set! (-> this trans 1 quad) (-> this trans 0 quad)) - (vector<-cspace! (the-as vector (-> this trans)) (-> this process 0 node-list data (-> this joint))) - (vector-! (-> this dir) (the-as vector (-> this trans)) (-> this trans 1)) + (vector<-cspace! (-> this trans 0) (-> this process 0 node-list data (-> this joint))) + (vector-! (-> this dir) (-> this trans 0) (-> this trans 1)) ) 0 (none) @@ -169,13 +160,9 @@ ) (let ((f30-0 (fill-and-probe-using-line-sphere *collide-cache* arg0))) (when (and arg1 (>= f30-0 0.0) (>= 0.0 (vector-dot (-> arg0 best-other-tri normal) (-> this dir)))) - (let* ((s3-0 (new 'stack-no-clear 'touching-shapes-entry)) - (s2-0 (-> arg0 best-other-tri collide-ptr)) - (v1-12 (if (type? s2-0 collide-shape-prim) - (the-as collide-shape-prim s2-0) - ) - ) - ) + (let ((s3-0 (new 'stack-no-clear 'touching-shapes-entry)) + (v1-12 (as-type (-> arg0 best-other-tri collide-ptr) collide-shape-prim)) + ) (set! (-> s3-0 cshape1) #f) (set! (-> s3-0 cshape2) (if v1-12 (-> v1-12 cshape) @@ -237,11 +224,7 @@ (defmethod combo-tracker-method-13 ((this combo-tracker) (arg0 handle) (arg1 vector) (arg2 float) (arg3 vector) (arg4 float)) (cond ((send-event (handle->process arg0) 'combo) - (let ((gp-1 (handle->process arg0))) - (if (type? gp-1 process-focusable) - gp-1 - ) - ) + (the-as basic (as-type (handle->process arg0) process-focusable)) ) (else (let ((s1-0 (new 'stack-no-clear 'sphere)) @@ -261,25 +244,23 @@ (-> s2-1 allocated-length) ) ) - (let ((gp-2 (find-nearest-focusable - (the-as (array collide-shape) s2-1) - arg1 - arg2 - (if (= arg4 65536.0) - (search-info-flag crate enemy combo) - (search-info-flag crate enemy prefer-angle cull-angle combo) + (the-as basic (as-type + (find-nearest-focusable + (the-as (array collide-shape) s2-1) + arg1 + arg2 + (if (= arg4 65536.0) + (search-info-flag crate enemy combo) + (search-info-flag crate enemy prefer-angle cull-angle combo) + ) + (search-info-flag) + arg3 + (the-as vector #f) + arg4 ) - (search-info-flag) - arg3 - (the-as vector #f) - arg4 - ) - ) - ) - (if (type? gp-2 process-focusable) - gp-2 - ) - ) + process-focusable + ) + ) ) ) ) @@ -307,12 +288,7 @@ (set! (-> a1-4 from) (process->ppointer pp)) (set! (-> a1-4 num-params) 0) (set! (-> a1-4 message) 'nav-control) - (let* ((s3-0 (send-event-function (handle->process (-> this target)) a1-4)) - (s4-1 (if (type? s3-0 nav-control) - s3-0 - ) - ) - ) + (let ((s4-1 (the-as object (as-type (send-event-function (handle->process (-> this target)) a1-4) nav-control)))) (when s4-1 (let ((a2-3 ((method-of-type nav-control find-poly-containing-point-1) (the-as nav-control s4-1) arg1))) (if a2-3 diff --git a/goal_src/jak2/engine/process-drawable/process-drawable.gc b/goal_src/jak2/engine/process-drawable/process-drawable.gc index be37ce4637..9e99aa159e 100644 --- a/goal_src/jak2/engine/process-drawable/process-drawable.gc +++ b/goal_src/jak2/engine/process-drawable/process-drawable.gc @@ -148,7 +148,6 @@ ;; 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)) ) @@ -174,15 +173,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*) ) ) ) @@ -234,8 +230,8 @@ ) ) -(defmethod lod-set! ((this draw-control) (arg0 int)) - (let ((v1-1 (max 0 (min arg0 (-> this lod-set max-lod))))) +(defmethod lod-set! ((this draw-control) (lod int)) + (let ((v1-1 (max 0 (min lod (-> this lod-set max-lod))))) (set! (-> this desired-lod) v1-1) (when (!= (-> this cur-lod) v1-1) (set! (-> this mgeo) (-> this lod-set lod v1-1 geo)) @@ -249,11 +245,11 @@ (none) ) -(defmethod lods-assign! ((this draw-control) (arg0 lod-set)) - (mem-copy! (the-as pointer (-> this lod-set)) (the-as pointer arg0) 49) - (let ((a1-2 (min (-> this cur-lod) (-> this lod-set max-lod)))) +(defmethod lods-assign! ((this draw-control) (lods lod-set)) + (mem-copy! (the-as pointer (-> this lod-set)) (the-as pointer lods) 49) + (let ((lod (min (-> this cur-lod) (-> this lod-set max-lod)))) (set! (-> this cur-lod) -1) - (lod-set! this a1-2) + (lod-set! this lod) ) 0 (none) @@ -288,7 +284,6 @@ ) (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)) ) @@ -311,13 +306,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))))) ) ) ) @@ -335,7 +330,7 @@ (set! s5-0 (the-as cspace-array #f)) (goto cfg-13) ) - (let ((v1-9 ((method-of-type cspace reset-and-assign-geo!) (the-as cspace (-> s5-0 data)) (the-as drawable #f)))) + (let ((v1-9 ((method-of-type cspace reset-and-assign-geo!) (-> s5-0 data 0) (the-as drawable #f)))) (set! (-> v1-9 bone) (the-as bone (-> s3-1 bones))) ) (let ((v1-10 (-> s5-0 data))) @@ -403,7 +398,7 @@ ) ((zero? arg1) (matrix<-transformq+trans! - (the-as matrix (-> this skeleton bones 3)) + (-> this skeleton bones 3 transform) (the-as transformq (-> (the-as process-drawable (-> this process)) root trans)) (-> this skeleton bones 0 transform trans) ) @@ -462,7 +457,7 @@ (let ((a1-11 (new 'stack-no-clear 'vector))) (set! (-> a1-11 quad) (-> this bounds quad)) (set! (-> a1-11 w) 1.0) - (vector-matrix*! (-> this origin) a1-11 (the-as matrix (-> this skeleton bones (-> this origin-joint-index)))) + (vector-matrix*! (-> this origin) a1-11 (-> this skeleton bones (-> this origin-joint-index) transform)) ) (let ((f0-2 (-> this bounds w))) (set! (-> this origin w) f0-2) @@ -509,12 +504,6 @@ ;; 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)) @@ -527,17 +516,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 (the-as int (bucket-id debug-no-zbuf1))) - (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)) + ) ) ) ) @@ -551,12 +542,13 @@ (none) ) -(defun draw-root ((arg0 process-drawable)) - (add-debug-quaternion #t (bucket-id debug-no-zbuf1) (-> arg0 root trans) (-> arg0 root quat)) +(defun draw-root ((proc process-drawable)) + (add-debug-quaternion #t (bucket-id debug-no-zbuf1) (-> proc root trans) (-> proc root quat)) (none) ) (defmethod deactivate ((this process-drawable)) + "Make a process dead, clean it up, remove it from the active pool, and return to dead pool." (if (nonzero? (-> this part)) (kill-and-free-particles (-> this part)) ) @@ -568,12 +560,7 @@ (remove! a0-3) ) ) - (let* ((s5-0 (-> this root)) - (a0-5 (if (type? s5-0 collide-shape) - s5-0 - ) - ) - ) + (let ((a0-5 (the-as trsqv (as-type (-> this root) collide-shape)))) (when a0-5 (let ((a2-0 (-> (the-as collide-shape a0-5) actor-hash-index)) (v1-12 *actor-hash*) @@ -606,12 +593,7 @@ (if (-> self entity) (logior! (-> self entity extra perm status) (entity-perm-status error)) ) - (let* ((s5-0 (-> self root)) - (v1-6 (if (type? s5-0 collide-shape) - s5-0 - ) - ) - ) + (let ((v1-6 (the-as trsqv (as-type (-> self root) collide-shape)))) (when v1-6 (let ((a0-5 (-> (the-as collide-shape v1-6) root-prim))) (set! (-> a0-5 prim-core collide-as) (collide-spec)) @@ -660,7 +642,7 @@ ) (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) @@ -673,61 +655,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)) @@ -736,12 +720,7 @@ (-> arg1 light-index) ) ) - (let* ((gp-1 (ppointer->process (-> arg0 parent))) - (v1-54 (if (type? gp-1 process-drawable) - gp-1 - ) - ) - ) + (let ((v1-54 (the-as process-tree (as-type (ppointer->process (-> arg0 parent)) process-drawable)))) (when (and v1-54 (nonzero? (-> (the-as process-drawable v1-54) draw))) (set! (-> s2-0 light-index) (-> (the-as process-drawable v1-54) draw light-index)) (set! (-> s2-0 shadow-mask) (-> (the-as process-drawable v1-54) draw shadow-mask)) @@ -1758,10 +1737,10 @@ (defbehavior rider-post process-drawable () (ja-post) - (let ((gp-0 (the-as collide-shape (-> self root)))) - (update-transforms gp-0) - (pull-riders! gp-0) - (do-push-aways gp-0) + (let ((cshape (the-as collide-shape (-> self root)))) + (update-transforms cshape) + (pull-riders! cshape) + (do-push-aways cshape) ) 0 (none) @@ -1769,14 +1748,14 @@ (defbehavior pusher-post process-drawable () (ja-post) - (let ((gp-0 (the-as collide-shape (-> self root)))) - (update-transforms gp-0) - (do-push-aways gp-0) + (let ((cshape (the-as collide-shape (-> self root)))) + (update-transforms cshape) + (do-push-aways cshape) ) 0 ) -(defbehavior process-drawable-delay-player process-drawable ((arg0 time-frame)) +(defbehavior process-drawable-delay-player process-drawable ((delay time-frame)) (while (and *target* (focus-test? *target* in-air)) (suspend) ) @@ -1789,7 +1768,7 @@ ) (suspend) ) - (while (not (time-elapsed? (-> self state-time) arg0)) + (while (not (time-elapsed? (-> self state-time) delay)) (suspend) ) (process-release? *target*) @@ -1850,14 +1829,9 @@ ;; WARN: Return type mismatch object vs process-focusable. (defbehavior find-offending-process-focusable process-drawable ((arg0 process-tree) (arg1 attack-info)) (let ((s5-0 (the-as object #f))) - (when (and arg1 (logtest? (-> arg1 mask) (attack-mask attacker))) - (let ((s4-0 (handle->process (-> arg1 attacker)))) - (set! s5-0 (if (type? s4-0 process-focusable) - s4-0 - ) - ) + (if (and arg1 (logtest? (-> arg1 mask) (attack-mask attacker))) + (set! s5-0 (the-as object (as-type (handle->process (-> arg1 attacker)) process-focusable))) ) - ) (when (not (the-as process s5-0)) (let ((a1-3 (new 'stack-no-clear 'event-message-block))) (set! (-> a1-3 from) (process->ppointer self)) diff --git a/goal_src/jak2/engine/scene/scene.gc b/goal_src/jak2/engine/scene/scene.gc index 875e6ce39d..cc25b1393f 100644 --- a/goal_src/jak2/engine/scene/scene.gc +++ b/goal_src/jak2/engine/scene/scene.gc @@ -46,7 +46,7 @@ ) (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) @@ -66,19 +66,17 @@ (goto cfg-211) ) ) - (let* ((s4-1 (art-group-get-by-name *level* (-> this art-group) (the-as (pointer uint32) #f))) - (s2-0 (if (type? s4-1 skeleton-group) - (the-as skeleton-group s4-1) - ) - ) - (s0-0 (-> arg0 level)) - (s3-0 - (or (string= (-> this name) "jak-highres") - (string= (-> this name) "jak-highres-prison") - (string= (-> this name) "darkjak-highres") - ) - ) - ) + (let ((s2-0 + (as-type (art-group-get-by-name *level* (-> this art-group) (the-as (pointer uint32) #f)) skeleton-group) + ) + (s0-0 (-> arg0 level)) + (s3-0 + (or (string= (-> this name) "jak-highres") + (string= (-> this name) "jak-highres-prison") + (string= (-> this name) "darkjak-highres") + ) + ) + ) (set! (-> arg0 level) #f) (set! s4-0 (when s2-0 @@ -88,26 +86,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) @@ -165,16 +163,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)) @@ -466,14 +467,14 @@ (-> *level* default-level) ) ) - (v1-55 (when level - (let ((s0-0 (art-group-get-by-name *level* (-> s2-0 art-group) (the-as (pointer uint32) #f)))) - (if (type? s0-0 skeleton-group) - s0-0 - ) - ) - ) - ) + (v1-55 + (if level + (the-as + art-group + (as-type (art-group-get-by-name *level* (-> s2-0 art-group) (the-as (pointer uint32) #f)) skeleton-group) + ) + ) + ) ) (cond ((or (not s1-0) (not (or (= (-> s1-0 status) 'active) (= (-> s1-0 status) 'reserved)))) @@ -609,15 +610,13 @@ ;; 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) ) @@ -647,8 +646,8 @@ ; ) ; (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))) + (let ((sv-32 (+ (log2 (the-as int (+ s5-0 -1))) 1)) + (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)) @@ -751,15 +750,9 @@ (new 'stack 'font-context *font-default-matrix* 20 290 0.0 (font-color default) (font-flags shadow kerning)) ) ) - (let ((v1-20 s2-0)) - (set! (-> v1-20 width) (the float 465)) - ) - (let ((v1-21 s2-0)) - (set! (-> v1-21 height) (the float 70)) - ) - (let ((v1-22 s2-0)) - (set! (-> v1-22 scale) 0.5) - ) + (set-width! s2-0 465) + (set-height! s2-0 70) + (set-scale! s2-0 0.5) (set! (-> s2-0 flags) (font-flags shadow kerning middle large)) (case (-> s3-0 type) ((string) @@ -775,9 +768,7 @@ ;; (log-string-bytes (the-as string s3-0) file) ;; (file-stream-close file))) (set! s3-0 (convert-korean-text (the-as string s3-0))) - (let ((v1-27 s2-0)) - (set! (-> v1-27 scale) 0.6) - ) + (set-scale! s2-0 0.6) ) (set! (-> s2-0 flags) (font-flags kerning middle middle-vert large)) (+! (-> s2-0 origin x) -1.0) @@ -1330,12 +1321,7 @@ ) (when (logtest? gp-4 (scene-controls special-fma-spheres)) (dotimes (s5-3 (-> self scene actor length)) - (let* ((s4-1 (handle->process (-> self scene actor s5-3 process))) - (v1-63 (if (type? s4-1 process-drawable) - (the-as process-drawable s4-1) - ) - ) - ) + (let ((v1-63 (as-type (handle->process (-> self scene actor s5-3 process)) process-drawable))) (if (and v1-63 (nonzero? (-> v1-63 draw))) (add-debug-sphere #t @@ -1350,12 +1336,7 @@ ) (when (logtest? gp-4 (scene-controls scene-controls-7)) (dotimes (s5-4 (-> self scene actor length)) - (let* ((s4-2 (handle->process (-> self scene actor s5-4 process))) - (v1-79 (if (type? s4-2 process-drawable) - (the-as process-drawable s4-2) - ) - ) - ) + (let ((v1-79 (as-type (handle->process (-> self scene actor s5-4 process)) process-drawable))) (if (and v1-79 (nonzero? (-> v1-79 draw))) (format *stdcon* @@ -1374,12 +1355,7 @@ ) (when (logtest? gp-4 (scene-controls scene-controls-8)) (dotimes (gp-5 (-> self scene actor length)) - (let* ((s5-5 (handle->process (-> self scene actor gp-5 process))) - (v1-94 (if (type? s5-5 process-drawable) - (the-as process-drawable s5-5) - ) - ) - ) + (let ((v1-94 (as-type (handle->process (-> self scene actor gp-5 process)) process-drawable))) (if (and v1-94 (nonzero? (-> v1-94 draw))) (add-debug-text-3d #t @@ -1407,15 +1383,9 @@ (new 'stack 'font-context *font-default-matrix* 36 60 0.0 (font-color default) (font-flags shadow kerning)) ) ) - (let ((v1-121 gp-6)) - (set! (-> v1-121 width) (the float 440)) - ) - (let ((v1-122 gp-6)) - (set! (-> v1-122 height) (the float 48)) - ) - (let ((v1-123 gp-6)) - (set! (-> v1-123 scale) 0.5) - ) + (set-width! gp-6 440) + (set-height! gp-6 48) + (set-scale! gp-6 0.5) (set! (-> gp-6 flags) (font-flags shadow kerning middle large)) (print-game-text (lookup-text! diff --git a/goal_src/jak2/engine/sound/gsound.gc b/goal_src/jak2/engine/sound/gsound.gc index 2ef2122797..232b824607 100644 --- a/goal_src/jak2/engine/sound/gsound.gc +++ b/goal_src/jak2/engine/sound/gsound.gc @@ -458,9 +458,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)) @@ -618,105 +618,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/goal_src/jak2/engine/sound/speech.gc b/goal_src/jak2/engine/sound/speech.gc index 8810fa5c7f..e2c7be6ae7 100644 --- a/goal_src/jak2/engine/sound/speech.gc +++ b/goal_src/jak2/engine/sound/speech.gc @@ -42,11 +42,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) @@ -180,14 +178,9 @@ ) (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)) @@ -259,7 +252,7 @@ (defmethod speech-control-method-14 ((this speech-control)) (speech-control-method-9 this) (let ((s5-0 (-> this channel-array))) - ((method-of-type speech-channel speech-channel-method-13) (the-as speech-channel s5-0)) + ((method-of-type speech-channel speech-channel-method-13) (-> s5-0 0)) (set! (-> s5-0 0 speech-table) (-> this speech-table)) (set! (-> s5-0 0 gui-channel) (gui-channel guard)) ) diff --git a/goal_src/jak2/engine/spatial-hash/actor-hash.gc b/goal_src/jak2/engine/spatial-hash/actor-hash.gc index 9846d1139a..4c589caa71 100644 --- a/goal_src/jak2/engine/spatial-hash/actor-hash.gc +++ b/goal_src/jak2/engine/spatial-hash/actor-hash.gc @@ -55,7 +55,6 @@ (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)) @@ -74,11 +73,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))) @@ -115,20 +115,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)) - ((method-of-type actor-hash-bucket add-actor-cshape) (the-as actor-hash-bucket (-> this data)) s4-1) + ((< 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 @@ -145,38 +140,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/goal_src/jak2/engine/spatial-hash/spatial-hash.gc b/goal_src/jak2/engine/spatial-hash/spatial-hash.gc index 60691fe014..f74b834fe8 100644 --- a/goal_src/jak2/engine/spatial-hash/spatial-hash.gc +++ b/goal_src/jak2/engine/spatial-hash/spatial-hash.gc @@ -88,7 +88,7 @@ (t1-0 (-> this dimension-array 0)) (t2-0 (-> this dimension-array 2)) (t3-0 (-> this dimension-array 1)) - (a0-2 (&-> (-> this bucket-array) (/ (the-as int arg0) 8))) + (a0-2 (&-> this bucket-array (/ (the-as int arg0) 8))) (a1-2 (ash 1 (logand (the-as int arg0) 7))) ) (dotimes (t4-3 t3-0) @@ -520,44 +520,45 @@ ) (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/goal_src/jak2/engine/target/board/board-states.gc b/goal_src/jak2/engine/target/board/board-states.gc index a7c5397f60..2314ceff1b 100644 --- a/goal_src/jak2/engine/target/board/board-states.gc +++ b/goal_src/jak2/engine/target/board/board-states.gc @@ -813,10 +813,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) ) @@ -847,36 +843,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/goal_src/jak2/engine/target/board/target-board.gc b/goal_src/jak2/engine/target/board/target-board.gc index bbf69797cf..26cebe1d7f 100644 --- a/goal_src/jak2/engine/target/board/target-board.gc +++ b/goal_src/jak2/engine/target/board/target-board.gc @@ -2057,7 +2057,6 @@ ;; WARN: Found some very strange gotos. Check result carefully, this is not well tested. (defbehavior target-board-compute-edge target () - (local-vars (sv-768 int)) (let ((s4-0 *edge-grab-info*) (gp-0 (new 'stack-no-clear 'vector)) ) @@ -2271,8 +2270,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/goal_src/jak2/engine/target/collide-reaction-target.gc b/goal_src/jak2/engine/target/collide-reaction-target.gc index 61f3a50b39..f708c27884 100644 --- a/goal_src/jak2/engine/target/collide-reaction-target.gc +++ b/goal_src/jak2/engine/target/collide-reaction-target.gc @@ -9,31 +9,32 @@ (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 ) @@ -44,456 +45,437 @@ (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) ) (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 (the-as vector (-> sv-88 vector))) - (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 (the-as (pointer float) (-> sv-88 vector)) 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) (the-as vector (-> sv-88 vector)))) - ) - 0.0 - (vector-! - v1-113 - (the-as vector (-> sv-88 vector)) - (vector-float*! v1-113 (-> arg0 dynam gravity-normal) f1-13) - ) - (let* ((f2-2 (vector-length v1-113)) - (f3-0 f2-2) - ) - (if (< f1-13 0.0) - (set! f1-13 (* f1-13 f0-21)) - ) - (vector+! - (the-as vector (-> sv-88 vector)) - (vector-float*! (the-as vector (-> sv-88 vector)) (-> arg0 dynam gravity-normal) f1-13) - (vector-float*! v1-113 v1-113 (/ f2-2 f3-0)) - ) - ) + (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 (the-as vector (-> sv-88 vector)) (-> 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 (the-as vector (-> sv-88 vector)))) - ) - (else - (vector-reflect-flat! arg2 (the-as vector (-> sv-88 vector)) sv-84) - ) - ) - (cond - ((and (or (and (>= (-> arg1 best-my-prim local-sphere w) - (vector-dot - (-> arg0 ground-poly-normal) - (vector-! (new 'stack-no-clear 'vector) (-> arg1 best-other-tri intersect) (-> arg0 grount-touch-point)) - ) + (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 (the-as vector (-> sv-88 vector)) 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 (the-as vector (-> sv-88 vector)) sv-84 (-> arg0 dynam gravity-normal)) - (vector-reflect-flat! arg2 (the-as vector (-> sv-88 vector)) sv-84) - ) - (vector+! arg2 arg2 sv-84) - (let ((f0-32 (-> arg0 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) (the-as vector (-> sv-88 vector))))) - 0.0 - (vector-! - v1-223 - (the-as vector (-> sv-88 vector)) - (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 ) (defun target-collision-no-reaction ((arg0 control-info) (arg1 collide-query) (arg2 vector) (arg3 vector)) @@ -570,11 +552,7 @@ (let ((gp-0 *edge-grab-info*)) (when (-> gp-0 found-edge?) (vector-normalize! - (vector-! - (-> self control edge-grab-edge-dir) - (the-as vector (-> gp-0 world-vertex)) - (-> gp-0 world-vertex 1) - ) + (vector-! (-> self control edge-grab-edge-dir) (-> gp-0 world-vertex 0) (-> gp-0 world-vertex 1)) 1.0 ) (set! (-> self control edge-grab-across-edge-dir quad) (-> gp-0 hanging-matrix quad 0)) diff --git a/goal_src/jak2/engine/target/gun/gun-dark-shot.gc b/goal_src/jak2/engine/target/gun/gun-dark-shot.gc index fee72495cb..1faed003a0 100644 --- a/goal_src/jak2/engine/target/gun/gun-dark-shot.gc +++ b/goal_src/jak2/engine/target/gun/gun-dark-shot.gc @@ -5,9 +5,9 @@ ;; name in dgo: gun-dark-shot ;; dgos: ENGINE, GAME -(define-extern market-object type) -(define-extern fruit-stand type) -(define-extern crate type) +(declare-type market-object process-focusable) +(declare-type fruit-stand process-focusable) +(declare-type crate process-focusable) ;; DECOMP BEGINS @@ -379,89 +379,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) ) ) ) @@ -550,14 +526,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) ) @@ -626,13 +594,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 @@ -640,23 +604,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/goal_src/jak2/engine/target/gun/gun-red-shot.gc b/goal_src/jak2/engine/target/gun/gun-red-shot.gc index 9e7cc08005..18de17f50b 100644 --- a/goal_src/jak2/engine/target/gun/gun-red-shot.gc +++ b/goal_src/jak2/engine/target/gun/gun-red-shot.gc @@ -255,14 +255,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)) ) ) ) @@ -296,14 +292,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/goal_src/jak2/engine/target/gun/gun-yellow-shot.gc b/goal_src/jak2/engine/target/gun/gun-yellow-shot.gc index 6cea8b0916..59c6282b12 100644 --- a/goal_src/jak2/engine/target/gun/gun-yellow-shot.gc +++ b/goal_src/jak2/engine/target/gun/gun-yellow-shot.gc @@ -114,7 +114,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/goal_src/jak2/engine/target/logic-target.gc b/goal_src/jak2/engine/target/logic-target.gc index ef5f2845a1..82bdd984a0 100644 --- a/goal_src/jak2/engine/target/logic-target.gc +++ b/goal_src/jak2/engine/target/logic-target.gc @@ -144,72 +144,41 @@ ;; ERROR: function was not converted to expressions. Cannot decompile. (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) @@ -420,38 +389,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) @@ -502,22 +462,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) ) @@ -682,7 +644,7 @@ (set! (-> a1-0 y) 10240.0) (set! (-> a1-0 z) 8192.0) (set! (-> a1-0 w) 1.0) - (vector-! (the-as vector v1-34) a0-13 a1-0) + (vector-! (-> v1-34 min) a0-13 a1-0) ) (let ((v1-36 (-> gp-0 bbox max)) (a0-15 (-> self control trans)) @@ -981,7 +943,7 @@ (-> self control dynam gravity-normal) (vector-! (new 'stack-no-clear 'vector) - (the-as vector (-> self control collision-spheres 1 prim-core)) + (-> self control collision-spheres 1 prim-core world-sphere) (-> self control wall-contact-pt) ) ) @@ -1349,7 +1311,7 @@ (set! (-> a1-0 y) 6144.0) (set! (-> a1-0 z) 8192.0) (set! (-> a1-0 w) 1.0) - (vector-! (the-as vector v1-0) a0-1 a1-0) + (vector-! (-> v1-0 min) a0-1 a1-0) ) (let ((v1-2 (-> gp-0 bbox max)) (a0-3 (-> self control trans)) @@ -1983,7 +1945,7 @@ (set! (-> v1-13 quad 2) a2-1) (set! (-> v1-13 trans quad) a3-1) ) - (vector-matrix*! (-> gp-0 scale) (the-as vector (-> s5-0 pilot-edge-grab)) (-> gp-0 transform)) + (vector-matrix*! (-> gp-0 scale) (-> s5-0 pilot-edge-grab local-pos) (-> gp-0 transform)) (vector-rotate*! (the-as vector (&+ gp-0 80)) (-> s5-0 pilot-edge-grab local-dir) (-> gp-0 transform)) (set! (-> s5-0 center-hold quad) (-> gp-0 scale quad)) (set! (-> self control edge-grab-edge-dir quad) (-> (&+ gp-0 80) transform quad 0)) @@ -2004,11 +1966,7 @@ ) (set! (-> self control ground-pat) (the-as pat-surface (-> s5-0 edge-tri-pat))) (vector-normalize! - (vector-! - (-> self control edge-grab-edge-dir) - (the-as vector (-> s5-0 world-vertex)) - (-> s5-0 world-vertex 1) - ) + (vector-! (-> self control edge-grab-edge-dir) (-> s5-0 world-vertex 0) (-> s5-0 world-vertex 1)) 1.0 ) ) @@ -2137,7 +2095,7 @@ (set! (-> v1-13 quad 2) a2-1) (set! (-> v1-13 trans quad) a3-1) ) - (vector-matrix*! (-> s5-0 scale) (the-as vector (-> gp-0 pilot-edge-grab)) (-> s5-0 transform)) + (vector-matrix*! (-> s5-0 scale) (-> gp-0 pilot-edge-grab local-pos) (-> s5-0 transform)) (vector-rotate*! (the-as vector (&+ s5-0 80)) (-> gp-0 pilot-edge-grab local-dir) (-> s5-0 transform)) (set! (-> gp-0 center-hold quad) (-> s5-0 scale quad)) (set! (-> self control edge-grab-edge-dir quad) (-> (&+ s5-0 80) transform quad 0)) @@ -2157,11 +2115,7 @@ (debug-draw gp-0) ) (vector-normalize! - (vector-! - (-> self control edge-grab-edge-dir) - (the-as vector (-> gp-0 world-vertex)) - (-> gp-0 world-vertex 1) - ) + (vector-! (-> self control edge-grab-edge-dir) (-> gp-0 world-vertex 0) (-> gp-0 world-vertex 1)) 1.0 ) ) @@ -2298,7 +2252,7 @@ ) ) ) - (vector<-cspace! s5-0 (the-as cspace (-> self node-list data))) + (vector<-cspace! s5-0 (-> self node-list data 0)) (if (not (and (logtest? (-> self water flags) (water-flags under-water)) (not (logtest? (-> self water flags) (water-flags swim-ground))) ) @@ -2337,7 +2291,7 @@ ) (logtest? (-> self water flags) (water-flags mud)) ) - (vector<-cspace! (-> self control camera-pos) (the-as cspace (-> self node-list data))) + (vector<-cspace! (-> self control camera-pos) (-> self node-list data 0)) (set! (-> self control camera-pos y) (-> self water base-height)) ) ((focus-test? self tube) @@ -2347,7 +2301,7 @@ (set! (-> self control camera-pos quad) (-> self control trans quad)) ) (else - (vector<-cspace! (-> self control camera-pos) (the-as cspace (-> self node-list data))) + (vector<-cspace! (-> self control camera-pos) (-> self node-list data 0)) ) ) ) @@ -2417,10 +2371,7 @@ ) (vector-matrix*! (-> self control ctrl-to-head-offset) (-> *TARGET-bank* head-offset) a2-5) ) - (vector<-cspace! - (the-as vector (&-> (-> self control) sidekick-root bone)) - (-> self control sidekick-root parent) - ) + (vector<-cspace! (the-as vector (&-> self control sidekick-root bone)) (-> self control sidekick-root parent)) (let ((gp-0 (new-stack-vector0)) (s5-0 (new-stack-vector0)) ) @@ -3048,7 +2999,7 @@ ) (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) @@ -3083,13 +3034,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/goal_src/jak2/engine/target/mech/grunt-mech.gc b/goal_src/jak2/engine/target/mech/grunt-mech.gc index b543219333..7c1f118246 100644 --- a/goal_src/jak2/engine/target/mech/grunt-mech.gc +++ b/goal_src/jak2/engine/target/mech/grunt-mech.gc @@ -181,9 +181,9 @@ (defmethod common-post ((this grunt-mech)) "Does a lot of various things relating to interacting with the target -- tracks when the enemy was last drawn -- looks at the target and handles attacking -@TODO Not extremely well understood yet" + - tracks when the enemy was last drawn + - looks at the target and handles attacking + @TODO Not extremely well understood yet" ((method-of-type grunt common-post) this) 0 (none) @@ -193,7 +193,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)) @@ -203,27 +203,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)) - ) - ;; og:preserve-this inlined vector-dot - ;; (.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)) - ) + (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))) @@ -299,10 +288,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) @@ -411,13 +398,13 @@ (vector-normalize-copy! (-> s5-0 travel) arg0 (the-as float arg1)) (set! (-> s5-0 pref-dir quad) (-> s5-0 travel quad)) (avoid-spheres-1! (-> this nav) s5-0) - (when (>= (fabs (vector-dot (the-as vector (-> s5-0 out-travel)) arg2)) 0.0) + (when (>= (fabs (vector-dot (-> s5-0 out-travel 0) arg2)) 0.0) (let ((t0-0 (new 'stack-no-clear 'clamp-travel-vector-to-mesh-return-info))) (clamp-vector-to-mesh-no-gaps (-> this nav) (-> this root trans) (-> this nav state current-poly) - (the-as vector (-> s5-0 out-travel)) + (-> s5-0 out-travel 0) t0-0 ) ) @@ -428,22 +415,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) (the-as vector (-> s5-0 out-travel))) - (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 ) ) ) @@ -503,9 +486,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/goal_src/jak2/engine/target/mech/mech-states.gc b/goal_src/jak2/engine/target/mech/mech-states.gc index 2474d80d11..75a7e45a6e 100644 --- a/goal_src/jak2/engine/target/mech/mech-states.gc +++ b/goal_src/jak2/engine/target/mech/mech-states.gc @@ -297,7 +297,6 @@ ) (defbehavior target-mech-punch-pick target ((arg0 symbol)) - (local-vars (sv-64 float)) (combo-tracker-method-12 (-> self control unknown-combo-tracker00) *null-vector* @@ -320,28 +319,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/goal_src/jak2/engine/target/surface-h.gc b/goal_src/jak2/engine/target/surface-h.gc index c45d9f6acf..14f1d06547 100644 --- a/goal_src/jak2/engine/target/surface-h.gc +++ b/goal_src/jak2/engine/target/surface-h.gc @@ -119,13 +119,13 @@ on impact, during touch, on exit, etc." (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)))) ) ) (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/goal_src/jak2/engine/target/target-anim.gc b/goal_src/jak2/engine/target/target-anim.gc index 415289f71e..0a81180aaa 100644 --- a/goal_src/jak2/engine/target/target-anim.gc +++ b/goal_src/jak2/engine/target/target-anim.gc @@ -638,7 +638,6 @@ ;; 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) @@ -991,18 +990,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/goal_src/jak2/engine/target/target-darkjak.gc b/goal_src/jak2/engine/target/target-darkjak.gc index 3c9e4a0be7..85aa41c0a1 100644 --- a/goal_src/jak2/engine/target/target-darkjak.gc +++ b/goal_src/jak2/engine/target/target-darkjak.gc @@ -592,16 +592,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 () @@ -646,276 +636,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))) @@ -1051,124 +1043,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 @@ -1177,164 +1272,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) @@ -1366,7 +1357,6 @@ ;; 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) @@ -1427,19 +1417,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) @@ -1480,20 +1472,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) @@ -1525,244 +1503,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/goal_src/jak2/engine/target/target-death.gc b/goal_src/jak2/engine/target/target-death.gc index 70d6de02b2..a683b2e678 100644 --- a/goal_src/jak2/engine/target/target-death.gc +++ b/goal_src/jak2/engine/target/target-death.gc @@ -923,258 +923,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/goal_src/jak2/engine/target/target-handler.gc b/goal_src/jak2/engine/target/target-handler.gc index ce4a4a9ddf..f16a45fabb 100644 --- a/goal_src/jak2/engine/target/target-handler.gc +++ b/goal_src/jak2/engine/target/target-handler.gc @@ -181,447 +181,278 @@ ) (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) - ;; og:preserve-this process cast - (set! arg0 (the process (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)) - ;; og:preserve-this added - (stack-size-set! (-> self main-thread) 512) - (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) + ;; og:preserve-this process cast + (set! arg0 (the process (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)) + ;; og:preserve-this added + (stack-size-set! (-> self main-thread) 512) + (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 ) (defbehavior target-generic-event-handler target ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) diff --git a/goal_src/jak2/engine/target/target-part.gc b/goal_src/jak2/engine/target/target-part.gc index e4d585b0a5..ab40c46da3 100644 --- a/goal_src/jak2/engine/target/target-part.gc +++ b/goal_src/jak2/engine/target/target-part.gc @@ -100,47 +100,48 @@ ) (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) ) @@ -2448,101 +2449,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) + ) ) ) ) @@ -2565,46 +2572,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) + ) ) ) ) @@ -2643,23 +2648,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) @@ -2668,145 +2656,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) @@ -2828,12 +2819,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) @@ -2841,8 +2827,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/goal_src/jak2/engine/target/target-turret.gc b/goal_src/jak2/engine/target/target-turret.gc index 670b4291b0..1b0d9fdefc 100644 --- a/goal_src/jak2/engine/target/target-turret.gc +++ b/goal_src/jak2/engine/target/target-turret.gc @@ -1589,7 +1589,6 @@ ) (defmethod turret-init! ((this base-turret) (arg0 entity-actor) (arg1 matrix)) - (local-vars (sv-16 res-tag)) ;; og:preserve-this changed from 512 (stack-size-set! (-> this main-thread) 1024) (let ((s3-0 (new 'process 'collide-shape-moving this (collide-list-enum hit-by-others)))) @@ -1649,8 +1648,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)) @@ -1721,7 +1721,6 @@ ) (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)) @@ -1731,27 +1730,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 @@ -1807,7 +1807,6 @@ ) (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) @@ -1830,20 +1829,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/goal_src/jak2/engine/target/target2.gc b/goal_src/jak2/engine/target/target2.gc index bc55bcfa46..7c50b5013c 100644 --- a/goal_src/jak2/engine/target/target2.gc +++ b/goal_src/jak2/engine/target/target2.gc @@ -929,7 +929,7 @@ (target-compute-edge-rider) (compute-alignment! (-> self align)) (when (not (logtest? (-> self align flags) (align-flags disabled))) - (vector-matrix*! s4-0 (the-as vector (-> self align delta)) (-> self control c-R-w)) + (vector-matrix*! s4-0 (-> self align delta trans) (-> self control c-R-w)) (move-by-vector! (-> self control) s4-0) ) (suspend) @@ -970,7 +970,7 @@ (until (ja-done? 0) (compute-alignment! (-> self align)) (when (not (logtest? (-> self align flags) (align-flags disabled))) - (vector-matrix*! gp-0 (the-as vector (-> self align delta)) (-> self control c-R-w)) + (vector-matrix*! gp-0 (-> self align delta trans) (-> self control c-R-w)) (move-by-vector! (-> self control) gp-0) ) (suspend) @@ -1303,63 +1303,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/goal_src/jak2/engine/ui/bigmap.gc b/goal_src/jak2/engine/ui/bigmap.gc index 6d37a50d51..bfe34cb051 100644 --- a/goal_src/jak2/engine/ui/bigmap.gc +++ b/goal_src/jak2/engine/ui/bigmap.gc @@ -306,14 +306,14 @@ (defmethod texture-upload-dma ((this bigmap) (arg0 dma-buffer) (arg1 (pointer uint32)) (arg2 int) (arg3 int) (arg4 int) (arg5 gs-psm)) "Add a texture upload to the DMA buffer." - (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) @@ -443,12 +443,7 @@ (init-vf0-vector) (cond ((= (-> arg1 position) #t) - (let* ((s3-0 (handle->process (-> arg1 handle))) - (v1-4 (if (type? s3-0 process-drawable) - (the-as process-drawable s3-0) - ) - ) - ) + (let ((v1-4 (as-type (handle->process (-> arg1 handle)) process-drawable))) (if (and v1-4 (nonzero? (-> v1-4 root))) (set! (-> arg1 last-world-pos quad) (-> v1-4 root trans quad)) ) @@ -458,13 +453,12 @@ (= (-> (the-as basic (-> arg1 position)) type) entity-actor) ) (let* ((v1-14 (the-as entity-actor (-> arg1 position))) - (s3-1 (if v1-14 - (-> v1-14 extra process) - ) - ) - (a0-13 (if (type? s3-1 process-drawable) - (the-as process-drawable s3-1) - ) + (a0-13 (as-type + (if v1-14 + (-> v1-14 extra process) + ) + process-drawable + ) ) ) (if a0-13 @@ -504,8 +498,8 @@ (let ((f1-2 (* 20.0 f1-0 f0-0)) (f0-1 (* 20.0 f0-0)) ) - (set! (-> a0-23 x) (the float (the int (- (-> a2-1 x) (* 0.5 f1-2))))) - (set! (-> a0-23 y) (the float (the int (- (-> a2-1 y) (* 0.5 f0-1))))) + (set! (-> a0-23 x) (the float (the int (- (-> a2-1 x) (/ f1-2 2))))) + (set! (-> a0-23 y) (the float (the int (- (-> a2-1 y) (/ f0-1 2))))) (set! (-> v1-21 x) (+ (-> a0-23 x) f1-2)) (set! (-> v1-21 y) (+ (-> a0-23 y) f0-1)) ) @@ -648,14 +642,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) @@ -684,7 +676,6 @@ ) (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)) ) @@ -759,80 +750,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*! (the-as vector (-> this corner)) (the-as vector (-> this corner)) 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/goal_src/jak2/engine/ui/hud-classes.gc b/goal_src/jak2/engine/ui/hud-classes.gc index 80e683fb81..bc37eb2e7e 100644 --- a/goal_src/jak2/engine/ui/hud-classes.gc +++ b/goal_src/jak2/engine/ui/hud-classes.gc @@ -13,7 +13,7 @@ (the int (+ 492.0 (* 140.0 (-> this offset)))) (the int (+ 281.0 (* 140.0 (-> this offset)))) ) - (set-as-offset-from! (the-as hud-sprite (-> this sprites)) (the-as vector4w (-> this sprites 1)) 11 -11) + (set-as-offset-from! (-> this sprites 0) (-> this sprites 1 pos) 11 -11) (set! (-> this sprites 0 color w) (the int (+ 70.0 (* 70.0 (sin (* 182.04445 (the float (-> this values 1 current))))))) ) @@ -39,8 +39,8 @@ (with-dma-buffer-add-bucket ((s4-0 (-> *display* frames (-> *display* on-screen) global-buf)) (bucket-id progress) ) - (set-as-offset-from! (-> this sprites 2) (the-as vector4w (-> this sprites 1)) 2 -3) - (draw-1 *minimap* s4-0 (the-as vector4w (-> this sprites 2)) #t) + (set-as-offset-from! (-> this sprites 2) (-> this sprites 1 pos) 2 -3) + (draw-1 *minimap* s4-0 (-> this sprites 2 pos) #t) ) ) ((zero? (-> *setting-control* user-current race-minimap)) @@ -56,8 +56,8 @@ (with-dma-buffer-add-bucket ((s4-2 (-> *display* frames (-> *display* on-screen) global-buf)) (bucket-id progress) ) - (set-as-offset-from! (-> this sprites 2) (the-as vector4w (-> this sprites 1)) 10 -15) - (draw-sprite2 *minimap* s4-2 (the-as vector4w (-> this sprites 2)) #t) + (set-as-offset-from! (-> this sprites 2) (-> this sprites 1 pos) 10 -15) + (draw-sprite2 *minimap* s4-2 (-> this sprites 2 pos) #t) ) ) ) @@ -75,8 +75,8 @@ (with-dma-buffer-add-bucket ((s4-4 (-> *display* frames (-> *display* on-screen) global-buf)) (bucket-id progress) ) - (set-as-offset-from! (-> this sprites 2) (the-as vector4w (-> this sprites 1)) 20 -8) - (draw-sprite2 *minimap* s4-4 (the-as vector4w (-> this sprites 2)) #t) + (set-as-offset-from! (-> this sprites 2) (-> this sprites 1 pos) 20 -8) + (draw-sprite2 *minimap* s4-4 (-> this sprites 2 pos) #t) ) ) ) @@ -94,8 +94,8 @@ (with-dma-buffer-add-bucket ((s4-6 (-> *display* frames (-> *display* on-screen) global-buf)) (bucket-id progress) ) - (set-as-offset-from! (-> this sprites 2) (the-as vector4w (-> this sprites 1)) 10 -8) - (draw-sprite2 *minimap* s4-6 (the-as vector4w (-> this sprites 2)) #t) + (set-as-offset-from! (-> this sprites 2) (-> this sprites 1 pos) 10 -8) + (draw-sprite2 *minimap* s4-6 (-> this sprites 2 pos) #t) ) ) ) @@ -166,26 +166,26 @@ ) (the int (+ 306.0 (* 130.0 (-> this offset)))) ) - (set-as-offset-from! (-> this sprites 9) (the-as vector4w (-> this sprites 8)) 40 0) - (set-as-offset-from! (-> this sprites 10) (the-as vector4w (-> this sprites 8)) 0 40) - (set-as-offset-from! (-> this sprites 11) (the-as vector4w (-> this sprites 8)) 40 40) - (set-as-offset-from! (-> this sprites 12) (the-as vector4w (-> this sprites 8)) 2 32) - (set-as-offset-from! (-> this sprites 13) (the-as vector4w (-> this sprites 8)) 7 60) - (set-as-offset-from! (-> this sprites 14) (the-as vector4w (-> this sprites 8)) 40 60) - (set-as-offset-from! (-> this sprites 15) (the-as vector4w (-> this sprites 8)) 63 32) - (set-as-offset-from! (-> this sprites 16) (the-as vector4w (-> this sprites 8)) 63 16) - (set-as-offset-from! (-> this sprites 17) (the-as vector4w (-> this sprites 8)) 41 4) - (set-as-offset-from! (-> this sprites 18) (the-as vector4w (-> this sprites 8)) 6 4) - (set-as-offset-from! (-> this sprites 19) (the-as vector4w (-> this sprites 8)) 2 17) - (set-as-offset-from! (the-as hud-sprite (-> this sprites)) (the-as vector4w (-> this sprites 8)) 40 40) - (set-as-offset-from! (-> this sprites 1) (the-as vector4w (-> this sprites 8)) 40 40) - (set-as-offset-from! (-> this sprites 2) (the-as vector4w (-> this sprites 8)) 40 40) - (set-as-offset-from! (-> this sprites 3) (the-as vector4w (-> this sprites 8)) 40 40) - (set-as-offset-from! (-> this sprites 4) (the-as vector4w (-> this sprites 8)) 40 40) - (set-as-offset-from! (-> this sprites 5) (the-as vector4w (-> this sprites 8)) 40 40) - (set-as-offset-from! (-> this sprites 6) (the-as vector4w (-> this sprites 8)) 40 40) - (set-as-offset-from! (-> this sprites 7) (the-as vector4w (-> this sprites 8)) 40 40) - (set-as-offset-from! (-> this sprites 21) (the-as vector4w (-> this sprites 8)) 25 25) + (set-as-offset-from! (-> this sprites 9) (-> this sprites 8 pos) 40 0) + (set-as-offset-from! (-> this sprites 10) (-> this sprites 8 pos) 0 40) + (set-as-offset-from! (-> this sprites 11) (-> this sprites 8 pos) 40 40) + (set-as-offset-from! (-> this sprites 12) (-> this sprites 8 pos) 2 32) + (set-as-offset-from! (-> this sprites 13) (-> this sprites 8 pos) 7 60) + (set-as-offset-from! (-> this sprites 14) (-> this sprites 8 pos) 40 60) + (set-as-offset-from! (-> this sprites 15) (-> this sprites 8 pos) 63 32) + (set-as-offset-from! (-> this sprites 16) (-> this sprites 8 pos) 63 16) + (set-as-offset-from! (-> this sprites 17) (-> this sprites 8 pos) 41 4) + (set-as-offset-from! (-> this sprites 18) (-> this sprites 8 pos) 6 4) + (set-as-offset-from! (-> this sprites 19) (-> this sprites 8 pos) 2 17) + (set-as-offset-from! (-> this sprites 0) (-> this sprites 8 pos) 40 40) + (set-as-offset-from! (-> this sprites 1) (-> this sprites 8 pos) 40 40) + (set-as-offset-from! (-> this sprites 2) (-> this sprites 8 pos) 40 40) + (set-as-offset-from! (-> this sprites 3) (-> this sprites 8 pos) 40 40) + (set-as-offset-from! (-> this sprites 4) (-> this sprites 8 pos) 40 40) + (set-as-offset-from! (-> this sprites 5) (-> this sprites 8 pos) 40 40) + (set-as-offset-from! (-> this sprites 6) (-> this sprites 8 pos) 40 40) + (set-as-offset-from! (-> this sprites 7) (-> this sprites 8 pos) 40 40) + (set-as-offset-from! (-> this sprites 21) (-> this sprites 8 pos) 25 25) (let ((v1-12 (+ (the int (* 127.0 (sin (* 182.04445 (the float (* (-> *display* game-clock frame-counter) 2)))))) 127) ) @@ -345,7 +345,7 @@ (set! f30-0 (-> (the-as hud-health v1-0) offset)) ) (set-hud-piece-position! - (the-as hud-sprite (-> this sprites)) + (-> this sprites 0) (if (= (-> *setting-control* user-default aspect-ratio) 'aspect4x3) (the int (+ 13.0 (* -130.0 f30-0))) (the int (+ 25.0 (* -130.0 f30-0))) @@ -356,7 +356,7 @@ ((or (= (-> this values 2 target) 100) (= (-> *target* game eco-pill-dark) 100.0)) (set! (-> this sprites 0 tex) (get-texture hud-darkjak-head-01 level-default-minimap)) (set-hud-piece-position! - (the-as hud-sprite (-> this sprites)) + (-> this sprites 0) (if (= (-> *setting-control* user-default aspect-ratio) 'aspect4x3) (the int (+ 13.0 (* -130.0 f30-0))) (the int (+ 25.0 (* -130.0 f30-0))) @@ -377,7 +377,7 @@ (else (set! (-> this sprites 0 tex) (get-texture hud-jak-head-01 level-default-minimap)) (set-hud-piece-position! - (the-as hud-sprite (-> this sprites)) + (-> this sprites 0) (if (= (-> *setting-control* user-default aspect-ratio) 'aspect4x3) (the int (+ 29.0 (* -130.0 f30-0))) (the int (+ 36.0 (* -130.0 f30-0))) @@ -437,7 +437,7 @@ 150 ) (set-as-offset-from! - (the-as hud-sprite (-> this sprites)) + (-> this sprites 0) (the-as vector4w (-> this icons 0 pos)) (if (= (-> *setting-control* user-default aspect-ratio) 'aspect4x3) -27 @@ -489,7 +489,7 @@ 270 ) (set-as-offset-from! - (the-as hud-sprite (-> this sprites)) + (-> this sprites 0) (the-as vector4w (-> this icons 0 pos)) (if (= (-> *setting-control* user-default aspect-ratio) 'aspect4x3) -19 @@ -555,13 +555,9 @@ ) (defmethod draw ((this hud-score)) - (set-hud-piece-position! - (the-as hud-sprite (-> this sprites)) - (the int (+ 480.0 (* 130.0 (-> this offset)))) - 140 - ) + (set-hud-piece-position! (-> this sprites 0) (the int (+ 480.0 (* 130.0 (-> this offset)))) 140) (format (clear (-> this strings 0 text)) "~D" (-> this values 0 current)) - (set-as-offset-from! (the-as hud-sprite (-> this strings 0 pos)) (the-as vector4w (-> this sprites)) -12 8) + (set-as-offset-from! (the-as hud-sprite (-> this strings 0 pos)) (-> this sprites 0 pos) -12 8) ((method-of-type hud draw) this) 0 (none) @@ -591,11 +587,7 @@ ) (defmethod draw ((this hud-timer)) - (set-hud-piece-position! - (the-as hud-sprite (-> this sprites)) - 264 - (the int (+ 50.0 (* -100.0 (-> this offset)))) - ) + (set-hud-piece-position! (-> this sprites 0) 264 (the int (+ 50.0 (* -100.0 (-> this offset))))) (format (clear (-> this strings 0 text)) "~1,'0D" (/ (-> this values 0 current) 10)) (format (clear (-> this strings 1 text)) "~1,'0D" (mod (-> this values 0 current) 10)) (format (clear (-> this strings 2 text)) ":") @@ -604,20 +596,15 @@ (let ((s5-5 20) (s4-0 -42) ) - (set-as-offset-from! (the-as hud-sprite (-> this strings 0 pos)) (the-as vector4w (-> this sprites)) s4-0 -24) + (set-as-offset-from! (the-as hud-sprite (-> this strings 0 pos)) (-> this sprites 0 pos) s4-0 -24) (let ((s4-1 (+ s4-0 s5-5))) - (set-as-offset-from! (the-as hud-sprite (-> this strings 1 pos)) (the-as vector4w (-> this sprites)) s4-1 -24) + (set-as-offset-from! (the-as hud-sprite (-> this strings 1 pos)) (-> this sprites 0 pos) s4-1 -24) (let ((s4-2 (+ s4-1 16))) - (set-as-offset-from! (the-as hud-sprite (-> this strings 2 pos)) (the-as vector4w (-> this sprites)) s4-2 -24) + (set-as-offset-from! (the-as hud-sprite (-> this strings 2 pos)) (-> this sprites 0 pos) s4-2 -24) (let ((s4-3 (+ s4-2 16))) - (set-as-offset-from! (the-as hud-sprite (-> this strings 3 pos)) (the-as vector4w (-> this sprites)) s4-3 -24) + (set-as-offset-from! (the-as hud-sprite (-> this strings 3 pos)) (-> this sprites 0 pos) s4-3 -24) (let ((a2-13 (+ s4-3 s5-5))) - (set-as-offset-from! - (the-as hud-sprite (-> this strings 4 pos)) - (the-as vector4w (-> this sprites)) - a2-13 - -24 - ) + (set-as-offset-from! (the-as hud-sprite (-> this strings 4 pos)) (-> this sprites 0 pos) a2-13 -24) ) ) ) @@ -667,13 +654,9 @@ ) (defmethod draw ((this hud-big-score)) - (set-hud-piece-position! - (the-as hud-sprite (-> this sprites)) - 264 - (the int (+ 50.0 (* -100.0 (-> this offset)))) - ) + (set-hud-piece-position! (-> this sprites 0) 264 (the int (+ 50.0 (* -100.0 (-> this offset))))) (format (clear (-> this strings 0 text)) "~D" (-> this values 0 current)) - (set-as-offset-from! (the-as hud-sprite (-> this strings 0 pos)) (the-as vector4w (-> this sprites)) -7 -24) + (set-as-offset-from! (the-as hud-sprite (-> this strings 0 pos)) (-> this sprites 0 pos) -7 -24) ((method-of-type hud draw) this) 0 (none) @@ -704,14 +687,10 @@ ) (defmethod draw ((this hud-goal)) - (set-hud-piece-position! - (the-as hud-sprite (-> this sprites)) - (the int (+ 65.0 (* -130.0 (-> this offset)))) - 70 - ) + (set-hud-piece-position! (-> this sprites 0) (the int (+ 65.0 (* -130.0 (-> this offset)))) 70) (format (clear (-> this strings 0 text)) "~D" (-> this values 0 current)) - (set-as-offset-from! (the-as hud-sprite (-> this strings 0 pos)) (the-as vector4w (-> this sprites)) 0 -8) - (set-as-offset-from! (the-as hud-sprite (-> this strings 1 pos)) (the-as vector4w (-> this sprites)) 0 -40) + (set-as-offset-from! (the-as hud-sprite (-> this strings 0 pos)) (-> this sprites 0 pos) 0 -8) + (set-as-offset-from! (the-as hud-sprite (-> this strings 1 pos)) (-> this sprites 0 pos) 0 -40) ((method-of-type hud draw) this) 0 (none) @@ -752,11 +731,7 @@ ) (defmethod draw ((this hud-miss)) - (set-hud-piece-position! - (the-as hud-sprite (-> this sprites)) - (the int (+ 448.0 (* 130.0 (-> this offset)))) - 70 - ) + (set-hud-piece-position! (-> this sprites 0) (the int (+ 448.0 (* 130.0 (-> this offset)))) 70) (format (clear (-> this strings 0 text)) "~D/~D" (-> this values 0 current) (-> this values 1 current)) (let ((s5-1 format) (s4-0 (clear (-> this strings 1 text))) @@ -765,8 +740,8 @@ (format (clear *temp-string*) (lookup-text! *common-text* (text-id miss) #f)) (s5-1 s4-0 s3-0 *temp-string*) ) - (set-as-offset-from! (the-as hud-sprite (-> this strings 0 pos)) (the-as vector4w (-> this sprites)) 0 -8) - (set-as-offset-from! (the-as hud-sprite (-> this strings 1 pos)) (the-as vector4w (-> this sprites)) 0 -40) + (set-as-offset-from! (the-as hud-sprite (-> this strings 0 pos)) (-> this sprites 0 pos) 0 -8) + (set-as-offset-from! (the-as hud-sprite (-> this strings 1 pos)) (-> this sprites 0 pos) 0 -40) ((method-of-type hud draw) this) 0 (none) @@ -811,13 +786,13 @@ (seek! (-> this sprites 2 scale-y) f0-0 (* 2.0 (-> pp clock time-adjust-ratio))) ) (set-hud-piece-position! - (the-as hud-sprite (-> this sprites)) + (-> this sprites 0) 256 (the int (+ (* -100.0 (-> this offset)) (-> this sprites 2 scale-y))) ) (set-as-offset-from! (-> this sprites 1) - (the-as vector4w (-> this sprites)) + (-> this sprites 0 pos) (+ (the int (* 0.09 (the float (-> this values 0 current)))) -42) 0 ) @@ -858,7 +833,7 @@ ) (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) ) @@ -912,7 +887,7 @@ (set! s3-0 (* s3-0 2)) ) (set-hud-piece-position! - (the-as hud-sprite (-> this sprites)) + (-> this sprites 0) (- (the int (+ 507.0 (* 130.0 (-> this offset)))) s4-0) (the int (+ (- 25.0 (the float s5-0)) (* -100.0 (-> this offset)))) ) @@ -921,47 +896,49 @@ ((zero? (-> this values 0 current)) (set! f30-0 0.0) (set! (-> this strings 0 pos 0) 0) - (set-as-offset-from! (-> this sprites 1) (the-as vector4w (-> this sprites)) -3 0) + (set-as-offset-from! (-> this sprites 1) (-> this sprites 0 pos) -3 0) ) (else - (set-as-offset-from! (-> this sprites 1) (the-as vector4w (-> this sprites)) -4 11) + (set-as-offset-from! (-> this sprites 1) (-> this sprites 0 pos) -4 11) (set-as-offset-from! (the-as hud-sprite (-> this strings 0 pos)) - (the-as vector4w (-> this sprites)) + (-> this sprites 0 pos) (+ s4-0 -70) (+ s5-0 18) ) - (set-as-offset-from! (-> this sprites 6) (the-as vector4w (-> this sprites)) (+ s4-0 -68) (+ (if (= s2-0 20) - 98 - 73 - ) - s5-0 - ) + (set-as-offset-from! (-> this sprites 6) (-> this sprites 0 pos) (+ s4-0 -68) (+ (if (= s2-0 20) + 98 + 73 + ) + s5-0 + ) ) (set! (-> this sprites 6 scale-x) 1.0) (let ((s0-0 (mod (-> this values 1 current) s2-0))) (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) (the-as vector4w (-> this sprites)) (+ 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)))) @@ -1032,10 +1009,10 @@ ) ) (format (clear (-> this strings 0 text)) "~D/~D" (-> this values 1 current) s3-0) - (set-as-offset-from! (-> this sprites 2) (the-as vector4w (-> this sprites)) (+ s4-0 -110) (+ s5-0 18)) - (set-as-offset-from! (-> this sprites 3) (the-as vector4w (-> this sprites)) (+ s4-0 -36) (+ s5-0 19)) - (set-as-offset-from! (-> this sprites 4) (the-as vector4w (-> this sprites)) (+ s4-0 -78) (+ s5-0 7)) - (set-as-offset-from! (-> this sprites 5) (the-as vector4w (-> this sprites)) (+ s4-0 -78) (+ s5-0 37)) + (set-as-offset-from! (-> this sprites 2) (-> this sprites 0 pos) (+ s4-0 -110) (+ s5-0 18)) + (set-as-offset-from! (-> this sprites 3) (-> this sprites 0 pos) (+ s4-0 -36) (+ s5-0 19)) + (set-as-offset-from! (-> this sprites 4) (-> this sprites 0 pos) (+ s4-0 -78) (+ s5-0 7)) + (set-as-offset-from! (-> this sprites 5) (-> this sprites 0 pos) (+ s4-0 -78) (+ s5-0 37)) ) ((method-of-type hud draw) this) 0 @@ -1085,9 +1062,9 @@ (the int (+ 30.0 (* -100.0 (-> this offset)))) ) (set! (-> this sprites 0 angle) (* 182.04445 (the float (- 270 (/ (* 90 (-> this values 0 current)) 100))))) - (set-as-offset-from! (the-as hud-sprite (-> this sprites)) (the-as vector4w (-> this sprites 2)) 40 16) - (set-as-offset-from! (-> this sprites 1) (the-as vector4w (-> this sprites 2)) 1 16) - (set-as-offset-from! (-> this sprites 3) (the-as vector4w (-> this sprites 2)) 7 5) + (set-as-offset-from! (-> this sprites 0) (-> this sprites 2 pos) 40 16) + (set-as-offset-from! (-> this sprites 1) (-> this sprites 2 pos) 1 16) + (set-as-offset-from! (-> this sprites 3) (-> this sprites 2 pos) 7 5) ((method-of-type hud draw) this) 0 (none) diff --git a/goal_src/jak2/engine/util/profile.gc b/goal_src/jak2/engine/util/profile.gc index a6e30e40bc..6815e5e8b7 100644 --- a/goal_src/jak2/engine/util/profile.gc +++ b/goal_src/jak2/engine/util/profile.gc @@ -10,6 +10,7 @@ ;; DMA templates for profile drawing (deftype profile-work (structure) + "DMA templates for profile drawing." ((sprite-tmpl dma-gif-packet :inline) (line-tmpl dma-gif-packet :inline) (last-index int32) @@ -62,7 +63,7 @@ (define *profile-ticks* #f) (defmethod start-frame! ((this profile-segment-array)) - "Start a frame." + "Restart the profiler for the start of a frame." (set! (-> this count) 0) (set! (-> this depth) 0) (set! (-> this max-depth) 0) @@ -73,7 +74,7 @@ ) (defmethod start-segment! ((this profile-segment-array) (arg0 symbol) (arg1 rgba)) - "Push a new segment onto the profiling stack." + "Start an event." (when (and *dproc* *debug-segment*) (let ((s4-0 (-> this data (-> this count)))) (let ((s3-0 (-> this base-time))) @@ -93,7 +94,7 @@ ) (defmethod end-segment! ((this profile-segment-array)) - "Pop the last pushed segment." + "Stop the most recently started event." (when (and *dproc* *debug-segment*) (let* ((v1-4 (+ (-> this depth) -1)) (s5-0 (-> this segment v1-4)) @@ -383,8 +384,7 @@ ) (defmethod postprocess-data! ((this profile-array)) - "Summarize data collected." - + "Create the collapsed summary of the collected data." ;; loop over both EE and VU profilers (dotimes (s5-0 2) ;; each of the two display-frames has its own profile-array @@ -393,8 +393,7 @@ (let ((s3-0 (-> *profile-array* data s5-0)) (s4-0 *profile-collapse*) ) - (mem-copy! (&-> s3-0 type) (&-> (-> this data s5-0) type) 8240) - + (mem-copy! (&-> s3-0 type) (&-> this data s5-0 type) 8240) (cond ((zero? s5-0) ;; we're the EE profiler. @@ -552,8 +551,7 @@ ) (defmethod draw-bars! ((this profile-array) (arg0 dma-buffer) (arg1 int)) - "Draw the two bars at the top." - (local-vars (sv-16 (function _varargs_ object)) (sv-32 (function _varargs_ object))) + "Generate DMA data for drawing the profile bars." (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)) @@ -631,12 +629,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 @@ -682,12 +675,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 @@ -728,9 +716,8 @@ (none) ) - (defmethod draw-text! ((this profile-array)) - "Draw the table of times." + "Generate DMA data for drawing the profile information screen." (let ((gp-0 *profile-collapse*)) (dotimes (s5-0 (-> gp-0 count)) (when (or (nonzero? (-> gp-0 data s5-0 count)) (nonzero? (-> gp-0 data s5-0 vu-count))) diff --git a/goal_src/jak2/engine/util/sync-info.gc b/goal_src/jak2/engine/util/sync-info.gc index 25acfcc1bc..6378da041f 100644 --- a/goal_src/jak2/engine/util/sync-info.gc +++ b/goal_src/jak2/engine/util/sync-info.gc @@ -71,7 +71,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 @@ -85,8 +84,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)) @@ -141,7 +141,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 @@ -159,8 +158,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)) @@ -222,7 +222,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)) @@ -274,14 +274,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))) ) ) ) @@ -312,7 +312,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 @@ -328,8 +327,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/goal_src/jak2/levels/atoll/ash1-course.gc b/goal_src/jak2/levels/atoll/ash1-course.gc index 59fc178bb1..39b66bb337 100644 --- a/goal_src/jak2/levels/atoll/ash1-course.gc +++ b/goal_src/jak2/levels/atoll/ash1-course.gc @@ -45,7 +45,7 @@ :skip-to -1 :on-set (lambda ((arg0 ashelin-battle)) (clear-speech-flags! arg0) - (move-to-point! (-> arg0 root) (the-as vector (-> arg0 ash-course spots 0))) + (move-to-point! (-> arg0 root) (-> arg0 ash-course spots 0 center)) (let ((v1-7 (get-current-task-event (-> arg0 task)))) (if (= (-> v1-7 action) (game-task-action say)) (add-process @@ -94,11 +94,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) @@ -137,9 +135,9 @@ (when (scene-release? arg1) (logior! (-> arg1 bot-flags) (bot-flags bf20)) (let ((s5-0 (-> arg1 ash-course spots))) - (vector-! (the-as vector (-> arg1 frontline)) (the-as vector (-> s5-0 2)) (the-as vector (-> s5-0 1))) + (vector-! (the-as vector (-> arg1 frontline)) (-> s5-0 2 center) (-> s5-0 1 center)) (vector-normalize! (-> arg1 frontline) 1.0) - (set! (-> arg1 frontline w) (- (vector-dot (the-as vector (-> arg1 frontline)) (the-as vector (-> s5-0 1))))) + (set! (-> arg1 frontline w) (- (vector-dot (the-as vector (-> arg1 frontline)) (-> s5-0 1 center)))) ) (set-frontline-dist! arg1) (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) diff --git a/goal_src/jak2/levels/atoll/atoll-obs.gc b/goal_src/jak2/levels/atoll/atoll-obs.gc index a7ad37cf0f..dedac627d1 100644 --- a/goal_src/jak2/levels/atoll/atoll-obs.gc +++ b/goal_src/jak2/levels/atoll/atoll-obs.gc @@ -126,7 +126,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)) @@ -181,8 +180,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)) @@ -287,7 +287,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)) @@ -319,14 +318,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))) ) @@ -439,7 +440,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)) @@ -460,16 +460,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))) @@ -607,7 +609,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)) @@ -650,8 +651,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)) @@ -691,12 +693,7 @@ (case message (('touch 'attack) (when (time-elapsed? (the-as int (-> self collide-off-timer)) (seconds 2)) - (let* ((s4-0 proc) - (s3-0 (if (type? s4-0 process-focusable) - s4-0 - ) - ) - ) + (let ((s3-0 (the-as process (as-type proc process-focusable)))) (when s3-0 (let ((s4-1 (vector-z-quaternion! (new 'stack-no-clear 'vector) (-> self root quat)))) (let* ((v1-7 (vector-z-quaternion! (new 'stack-no-clear 'vector) (get-quat (the-as process-focusable s3-0) 0))) diff --git a/goal_src/jak2/levels/atoll/atoll-part.gc b/goal_src/jak2/levels/atoll/atoll-part.gc index ab7a590df5..cacbebf4dc 100644 --- a/goal_src/jak2/levels/atoll/atoll-part.gc +++ b/goal_src/jak2/levels/atoll/atoll-part.gc @@ -301,7 +301,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)) @@ -545,7 +545,7 @@ (defun check-drop-level-atoll-drop ((arg0 sparticle-system) (arg1 sparticle-cpuinfo) (arg2 matrix)) "Ensure water drop particle effects don't go below the ocean level, render the splash" - (let ((f30-0 (get-height *ocean* (the-as vector (-> arg2 vector)) #t))) + (let ((f30-0 (get-height *ocean* (-> arg2 vector 0) #t))) (when (and (!= f30-0 4095996000.0) (< (-> arg2 vector 0 y) f30-0)) (let ((s3-0 (new 'stack-no-clear 'vector))) (sp-kill-particle arg0 arg1) diff --git a/goal_src/jak2/levels/atoll/juicer.gc b/goal_src/jak2/levels/atoll/juicer.gc index d77b0967ee..5cb32c9111 100644 --- a/goal_src/jak2/levels/atoll/juicer.gc +++ b/goal_src/jak2/levels/atoll/juicer.gc @@ -661,11 +661,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/goal_src/jak2/levels/atoll/sig0-course.gc b/goal_src/jak2/levels/atoll/sig0-course.gc index 5383f830ec..249dce6089 100644 --- a/goal_src/jak2/levels/atoll/sig0-course.gc +++ b/goal_src/jak2/levels/atoll/sig0-course.gc @@ -94,13 +94,9 @@ (let ((gp-0 (bot-simple-check-too-far arg0))) (when (nonzero? gp-0) (let* ((s5-1 (-> arg0 sig-course spots)) - (f0-0 (vector-segment-distance-point! - (target-pos 0) - (the-as vector (-> s5-1 18)) - (the-as vector (-> s5-1 19)) - (the-as vector #f) - ) - ) + (f0-0 + (vector-segment-distance-point! (target-pos 0) (-> s5-1 18 center) (-> s5-1 19 center) (the-as vector #f)) + ) ) (cond ((< f0-0 45056.0) @@ -139,11 +135,7 @@ (when (not (logtest? (-> arg0 bot-task-bits) (bot-task-bits botbits-4))) (let ((s5-0 (handle->process (-> arg0 focus handle)))) (when s5-0 - (let ((v1-9 (if (type? s5-0 nav-enemy) - s5-0 - ) - ) - ) + (let ((v1-9 (the-as process (as-type s5-0 nav-enemy)))) (when v1-9 (if (>= 20480.0 (- (-> (the-as process-focusable v1-9) root trans y) (-> arg0 root trans y))) (logior! (-> arg0 bot-task-bits) (bot-task-bits botbits-4)) @@ -682,9 +674,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) ) @@ -728,13 +718,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) @@ -841,16 +827,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) @@ -873,9 +855,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)) @@ -945,27 +925,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) ) ) ) @@ -1138,7 +1114,7 @@ ) (let ((s5-0 (new 'stack-no-clear 'vector))) (let ((v1-6 (-> arg1 sig-course spots))) - (vector-lerp! s5-0 (the-as vector (-> v1-6 21)) (the-as vector (-> v1-6 22)) 0.5) + (vector-lerp! s5-0 (-> v1-6 21 center) (-> v1-6 22 center) 0.5) ) (move-to-point! (-> arg1 root) s5-0) ) @@ -1373,26 +1349,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) ) ) ) @@ -1495,9 +1467,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))) ) ) ) @@ -1655,16 +1625,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 (the-as vector (-> s4-0 28)))) - (let ((f0-6 102400.0)) - (>= (* f0-6 f0-6) (vector-vector-xz-distance-squared s5-0 (the-as vector (-> s4-0 29)))) - ) - ) - ) + (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)) @@ -1777,26 +1742,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) ) ) ) @@ -1897,9 +1858,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))) ) ) ) @@ -2124,26 +2083,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) ) ) ) @@ -2251,9 +2206,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))) ) ) ) @@ -2703,11 +2656,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) @@ -2750,26 +2701,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) ) ) ) @@ -2886,9 +2833,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/goal_src/jak2/levels/atoll/sniper.gc b/goal_src/jak2/levels/atoll/sniper.gc index 98bdd601f4..53ceb56a02 100644 --- a/goal_src/jak2/levels/atoll/sniper.gc +++ b/goal_src/jak2/levels/atoll/sniper.gc @@ -189,9 +189,8 @@ (set! (-> *sniper-nav-enemy-info* fact-defaults) *fact-info-enemy-defaults*) (defmethod run-logic? ((this sniper)) - (let ((f0-0 573440.0)) - (>= (* f0-0 f0-0) (vector-vector-distance-squared (-> this root trans) (camera-pos))) - ) + "Should this process be run? Checked by execute-process-tree." + (>= (square 573440.0) (vector-vector-distance-squared (-> this root trans) (camera-pos))) ) (defmethod enemy-method-129 ((this sniper)) diff --git a/goal_src/jak2/levels/castle/castle-obs.gc b/goal_src/jak2/levels/castle/castle-obs.gc index 1a6e6a8b28..1f6bce3c55 100644 --- a/goal_src/jak2/levels/castle/castle-obs.gc +++ b/goal_src/jak2/levels/castle/castle-obs.gc @@ -44,7 +44,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)) @@ -55,8 +54,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)) @@ -270,7 +270,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)) @@ -294,42 +293,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))))) @@ -350,7 +324,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)) @@ -389,8 +362,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)) @@ -480,7 +454,8 @@ (sound-play "lightning-node") (suspend) (logior! (-> self entity extra perm status) (entity-perm-status dead)) - (suspend-for (seconds 4)) + (suspend-for (seconds 4) + ) (cleanup-for-death self) ) ) @@ -818,12 +793,7 @@ (defmethod commited-to-ride? ((this cas-elevator)) "@returns if the target is considered within the elevator area enough to begin descending/ascending" - (let* ((s5-0 *target*) - (a0-2 (if (type? s5-0 process-focusable) - s5-0 - ) - ) - ) + (let ((a0-2 (the-as target (as-type *target* process-focusable)))) (when a0-2 (let* ((a0-3 (get-trans a0-2 0)) (v1-2 (vector-! (new 'stack-no-clear 'vector) a0-3 (-> this root trans))) @@ -1459,7 +1429,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)) @@ -1498,8 +1467,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)) @@ -1618,12 +1588,7 @@ 0 (sound-play "trapdoor") (let ((gp-1 (new 'stack 'joint-exploder-tuning (the-as uint 1)))) - (let* ((s5-1 *target*) - (a0-3 (if (type? s5-1 process-focusable) - s5-1 - ) - ) - ) + (let ((a0-3 (the-as target (as-type *target* process-focusable)))) (when a0-3 (set! (-> gp-1 fountain-rand-transv-lo quad) (-> (get-trans a0-3 0) quad)) (+! (-> gp-1 fountain-rand-transv-lo y) -16384.0) @@ -1647,7 +1612,8 @@ (sound-play "trapdoor") (suspend) (ja-channel-set! 0) - (suspend-for (seconds 1)) + (suspend-for (seconds 1) + ) (send-event self 'death-end) (while (-> self child) (suspend) @@ -2131,7 +2097,8 @@ (suspend) (ja :num! (seek!)) ) - (suspend-for (seconds 0.5)) + (suspend-for (seconds 0.5) + ) (while (or (= (-> self spawn-total) -1) (< (-> self spawn-count-total) (-> self spawn-total))) (when (and (< (-> self player-dist) (+ 81920.0 (-> self notice-dist))) (and (< (-> self spawn-count) (-> self spawn-max)) @@ -2167,10 +2134,12 @@ ) ) ) - (suspend-for (the int (* 300.0 (rand-vu-float-range 0.5 1.0)))) + (suspend-for (the int (* 300.0 (rand-vu-float-range 0.5 1.0))) + ) ) (while (> (-> self spawn-count) 0) - (suspend-for (seconds 0.43)) + (suspend-for (seconds 0.43) + ) ) (process-entity-status! self (entity-perm-status subtask-complete) #t) (cond @@ -2188,7 +2157,8 @@ (set-setting! 'entity-name a3-4 0.0 0) ) ) - (suspend-for (seconds 2)) + (suspend-for (seconds 2) + ) (dotimes (gp-6 (-> self actor-group 1 length)) (let ((a1-17 (new 'stack-no-clear 'event-message-block))) (set! (-> a1-17 from) (process->ppointer self)) @@ -2218,7 +2188,8 @@ (set-setting! 'entity-name a3-6 0.0 0) ) ) - (suspend-for (seconds 1)) + (suspend-for (seconds 1) + ) (let ((gp-8 (-> self actor-group 0))) (dotimes (s5-3 (-> gp-8 length)) (let ((a1-21 (new 'stack-no-clear 'event-message-block))) @@ -2248,7 +2219,8 @@ (suspend) (ja :num! (seek! 0.0)) ) - (suspend-for (seconds 1)) + (suspend-for (seconds 1) + ) (remove-setting! 'entity-name) (until (process-release? *target*) (suspend) @@ -2284,7 +2256,8 @@ (label cfg-14) (not v1-28) ) - (suspend-for (seconds 0.51)) + (suspend-for (seconds 0.51) + ) ) (until (process-grab? *target* #f) (suspend) @@ -2294,7 +2267,8 @@ (set-setting! 'entity-name a3-2 0.0 0) ) ) - (suspend-for (seconds 1)) + (suspend-for (seconds 1) + ) (task-node-close! (game-task-node castle-break-in-resolution)) (let ((a1-7 (new 'stack-no-clear 'event-message-block))) (set! (-> a1-7 from) (process->ppointer self)) @@ -2330,7 +2304,8 @@ ) ) ) - (suspend-for (seconds 2.5)) + (suspend-for (seconds 2.5) + ) (remove-setting! 'entity-name) (until (process-release? *target*) (suspend) @@ -2349,7 +2324,6 @@ - sounds" ;; og:preserve-this added (stack-size-set! (-> this main-thread) 512) - (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)) @@ -2379,8 +2353,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)) @@ -2392,8 +2367,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/goal_src/jak2/levels/city/bombbot/bombbot.gc b/goal_src/jak2/levels/city/bombbot/bombbot.gc index 562dbab2ff..28e7bffd56 100644 --- a/goal_src/jak2/levels/city/bombbot/bombbot.gc +++ b/goal_src/jak2/levels/city/bombbot/bombbot.gc @@ -789,15 +789,7 @@ ;; ERROR: Stack slot load at 896 mismatch: defined as size 4, got size 16 ;; ERROR: Stack slot load at 912 mismatch: defined as size 4, got size 16 (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) @@ -855,19 +847,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)) @@ -1012,35 +1006,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)) ) ) ) @@ -1117,7 +1097,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) ) @@ -1144,56 +1123,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) + ) ) ) ) @@ -1390,7 +1374,6 @@ ;; 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) @@ -1399,25 +1382,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) @@ -1513,11 +1496,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 @@ -1529,7 +1513,7 @@ ) ) ) - (set! sv-688 (+ sv-688 1)) + (+! sv-688 1) ) ) ) @@ -1542,19 +1526,7 @@ ) (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) @@ -1563,8 +1535,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)) @@ -1627,43 +1600,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) @@ -2388,13 +2350,6 @@ ) (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) @@ -2436,25 +2391,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)) ) ) ) @@ -2532,7 +2486,6 @@ ) (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) @@ -2540,34 +2493,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) @@ -2575,7 +2529,6 @@ ) (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) @@ -2590,15 +2543,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))))) @@ -2642,7 +2597,7 @@ ) (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) @@ -2666,13 +2621,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)) @@ -2695,11 +2648,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/goal_src/jak2/levels/city/common/height-map.gc b/goal_src/jak2/levels/city/common/height-map.gc index 2dfa6089ca..d1842f0047 100644 --- a/goal_src/jak2/levels/city/common/height-map.gc +++ b/goal_src/jak2/levels/city/common/height-map.gc @@ -129,7 +129,6 @@ ) (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))) @@ -140,39 +139,32 @@ (s4-0 (-> this x-dim)) (s3-0 (-> this z-dim)) ) - (let ((s2-0 (&-> (-> this data) 0))) + (let ((s2-0 (&-> this data 0))) (set! (-> s5-0 vector 0 z) (-> this z-offset)) (countdown (s1-0 s3-0) (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)) (the-as vector (-> s5-0 vector))) - (point-in-bbox? (the-as bounding-box (-> s5-0 vector 2)) (-> s5-0 vector 1)) - ) - (add-debug-line - #t - (bucket-id debug2) - (the-as vector (-> s5-0 vector)) - (-> 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) (&+! s2-0 s4-0) ) ) - (let ((s2-1 (&-> (-> this data) 0))) + (let ((s2-1 (&-> this data 0))) (set! (-> s5-0 vector 0 x) (-> this x-offset)) (countdown (s1-1 s4-0) (let ((s0-1 (the-as pointer s2-1))) @@ -180,28 +172,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)) (the-as vector (-> s5-0 vector))) - (point-in-bbox? (the-as bounding-box (-> s5-0 vector 2)) (-> s5-0 vector 1)) - ) - (add-debug-line - #t - (bucket-id debug2) - (the-as vector (-> s5-0 vector)) - (-> s5-0 vector 1) - *color-blue* - #f - (the-as rgba -1) - ) - ) + ) ) ) (+! (-> s5-0 vector 0 x) f28-0) diff --git a/goal_src/jak2/levels/city/common/nav-graph.gc b/goal_src/jak2/levels/city/common/nav-graph.gc index c0329a9d06..05fc8c2938 100644 --- a/goal_src/jak2/levels/city/common/nav-graph.gc +++ b/goal_src/jak2/levels/city/common/nav-graph.gc @@ -93,17 +93,13 @@ #t (bucket-id debug2) (the-as vector (&-> v1-8 id)) - (the-as vector (-> v1-8 dummy-node)) + (-> v1-8 dummy-node position) *color-yellow* ) ) ) (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) @@ -894,17 +890,17 @@ (set! (-> a0-7 quad) (-> a2-0 position quad)) (set! (-> a0-7 w) 1.0) ) - (vector-! (-> s5-0 vector 2) (-> s5-0 vector 1) (the-as vector (-> s5-0 vector))) + (vector-! (-> s5-0 vector 2) (-> s5-0 vector 1) (-> s5-0 vector 0)) (let* ((f0-2 (vector-length (-> s5-0 vector 2))) (f1-2 (fmax (* 0.75 f0-2) (+ -8192.0 f0-2))) ) (vector-float*! (-> s5-0 vector 2) (-> s5-0 vector 2) (/ f1-2 f0-2)) ) - (vector+! (-> s5-0 trans) (the-as vector (-> s5-0 vector)) (-> s5-0 vector 2)) + (vector+! (-> s5-0 trans) (-> s5-0 vector 0) (-> s5-0 vector 2)) (add-debug-line #t (bucket-id debug2) - (the-as vector (-> s5-0 vector)) + (-> s5-0 vector 0) (-> s5-0 trans) (cond ((= (-> v1-9 id) #xffff) @@ -933,10 +929,9 @@ ;; 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)) @@ -990,7 +985,6 @@ ) (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)) @@ -1008,24 +1002,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)) + ) + ) ) ) ) @@ -1212,18 +1202,7 @@ ) (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) @@ -1242,8 +1221,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) @@ -1262,62 +1242,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/goal_src/jak2/levels/city/common/pilot-states.gc b/goal_src/jak2/levels/city/common/pilot-states.gc index c4144d7bdb..17440536d6 100644 --- a/goal_src/jak2/levels/city/common/pilot-states.gc +++ b/goal_src/jak2/levels/city/common/pilot-states.gc @@ -208,14 +208,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) ) ) @@ -751,24 +744,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/goal_src/jak2/levels/city/common/trail.gc b/goal_src/jak2/levels/city/common/trail.gc index bea6207c88..d9eb437e3a 100644 --- a/goal_src/jak2/levels/city/common/trail.gc +++ b/goal_src/jak2/levels/city/common/trail.gc @@ -18,21 +18,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) @@ -56,18 +45,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)) ) ) ) @@ -76,7 +63,6 @@ ;; 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)) @@ -107,24 +93,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)))))) @@ -145,33 +117,33 @@ ;; 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 @@ -382,7 +354,7 @@ (cond ((> t0-0 0) (let* ((a3-4 (-> this visgroup (+ t0-0 -1))) - (a0-2 (&-> (-> this visnode-ids) (-> a3-4 first-conn))) + (a0-2 (&-> this visnode-ids (-> a3-4 first-conn))) ) (countdown (a3-5 (-> a3-4 conn-count)) (let ((t0-8 (-> a1-2 (-> a0-2 0)))) @@ -415,7 +387,7 @@ (when (not (logtest? a2-4 a1-2)) (set! (-> arg0 cell-quads 0 byte a0-1) (logior a2-4 a1-2)) (let* ((v1-3 (-> this conn-hash cell v1-1)) - (s4-0 (&-> (-> this conn-hash conn-ids) (-> v1-3 first-conn))) + (s4-0 (&-> this conn-hash conn-ids (-> v1-3 first-conn))) ) (countdown (s3-0 (-> v1-3 conn-count)) (let* ((s2-0 (-> s4-0 0)) @@ -562,7 +534,7 @@ (cond ((> v1-1 0) (let* ((v1-4 (-> this visgroup (+ v1-1 -1))) - (s5-1 (&-> (-> this visnode-ids) (-> v1-4 first-conn))) + (s5-1 (&-> this visnode-ids (-> v1-4 first-conn))) (s4-0 (-> v1-4 conn-count)) ) (-> this visnode-ids) @@ -683,7 +655,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)))) ) @@ -699,7 +671,7 @@ (set! (-> this goal-node-id) s5-0) (return 3) ) - (let ((s3-0 (&-> (-> this conn-ids) (-> s4-0 first-conn)))) + (let ((s3-0 (&-> this conn-ids (-> s4-0 first-conn)))) (countdown (s2-0 (-> s4-0 conn-count)) (let* ((a0-7 (-> this conn (-> s3-0 0))) (v1-12 (-> a0-7 flags)) @@ -793,7 +765,7 @@ (set! (-> s5-0 p1 quad) (-> s5-0 p0 quad)) (set! (-> s5-0 best-count) (the-as uint 0)) (set! (-> s5-0 best-dist) -1.0) - (let ((s2-0 (&-> (-> this conn-ids) (-> v1-2 first-conn)))) + (let ((s2-0 (&-> this conn-ids (-> v1-2 first-conn)))) (countdown (s1-0 (-> v1-2 conn-count)) (let* ((v1-4 (-> this conn (-> s2-0 0))) (s0-0 (-> v1-4 tail-id)) diff --git a/goal_src/jak2/levels/city/ctywide-obs.gc b/goal_src/jak2/levels/city/ctywide-obs.gc index f9f4884e08..c6273e922a 100644 --- a/goal_src/jak2/levels/city/ctywide-obs.gc +++ b/goal_src/jak2/levels/city/ctywide-obs.gc @@ -190,14 +190,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)))) ) @@ -500,12 +499,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 ) ) @@ -1409,11 +1403,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)) ) ) @@ -1783,7 +1775,6 @@ ) (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) @@ -1830,69 +1821,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 ) ) ) @@ -1947,11 +1936,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))) @@ -2224,9 +2211,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)) @@ -2333,17 +2320,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)) + ) ) ) ) @@ -3028,7 +3011,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) @@ -3040,19 +3022,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)) @@ -3207,31 +3186,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) @@ -3373,11 +3327,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) @@ -3398,115 +3348,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/goal_src/jak2/levels/city/ctywide-part.gc b/goal_src/jak2/levels/city/ctywide-part.gc index b45252dfbd..bdd1b94d10 100644 --- a/goal_src/jak2/levels/city/ctywide-part.gc +++ b/goal_src/jak2/levels/city/ctywide-part.gc @@ -298,7 +298,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/goal_src/jak2/levels/city/ctywide-tasks.gc b/goal_src/jak2/levels/city/ctywide-tasks.gc index e54ebf22f1..23a78a4824 100644 --- a/goal_src/jak2/levels/city/ctywide-tasks.gc +++ b/goal_src/jak2/levels/city/ctywide-tasks.gc @@ -181,7 +181,8 @@ (talker-spawn-func (-> *talker-speech* 38) *entity-pool* (target-pos 0) (the-as region #f)) ) (wait-for-speech-end (-> self sound-id 0)) - (suspend-for (seconds 1)) + (suspend-for (seconds 1) + ) (while (or (not *target*) (focus-test? *target* dead teleporting)) (suspend) ) @@ -230,7 +231,8 @@ (talker-spawn-func (-> *talker-speech* 31) *entity-pool* (target-pos 0) (the-as region #f)) ) (wait-for-speech-end (-> self sound-id 0)) - (suspend-for (seconds 1)) + (suspend-for (seconds 1) + ) (while (or (not *target*) (focus-test? *target* dead teleporting)) (suspend) ) @@ -238,7 +240,8 @@ (talker-spawn-func (-> *talker-speech* 35) *entity-pool* (target-pos 0) (the-as region #f)) ) (wait-for-speech-end (-> self sound-id 0)) - (suspend-for (seconds 1)) + (suspend-for (seconds 1) + ) (while (or (not *target*) (focus-test? *target* dead teleporting)) (suspend) ) @@ -259,7 +262,8 @@ ) (wait-for-speech-end (-> self sound-id 0)) (set! (-> self sub-state) (the-as uint 2)) - (suspend-for (seconds 1)) + (suspend-for (seconds 1) + ) (go-virtual complete) (none) ) @@ -332,7 +336,8 @@ (talker-spawn-func (-> *talker-speech* 35) *entity-pool* (target-pos 0) (the-as region #f)) ) (wait-for-speech-end (-> self sound-id 0)) - (suspend-for (seconds 1)) + (suspend-for (seconds 1) + ) (set! (-> self sound-id 0) (talker-spawn-func (-> *talker-speech* 36) *entity-pool* (target-pos 0) (the-as region #f)) ) @@ -346,7 +351,8 @@ (talker-spawn-func (-> *talker-speech* 37) *entity-pool* (target-pos 0) (the-as region #f)) ) (wait-for-speech-end (-> self sound-id 0)) - (suspend-for (seconds 3)) + (suspend-for (seconds 3) + ) (go-virtual complete) (none) ) @@ -410,10 +416,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) ) ) @@ -431,9 +435,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)) @@ -758,10 +760,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/goal_src/jak2/levels/city/kiddogescort/crocesc-states.gc b/goal_src/jak2/levels/city/kiddogescort/crocesc-states.gc index c19fef59cb..96c8bb819b 100644 --- a/goal_src/jak2/levels/city/kiddogescort/crocesc-states.gc +++ b/goal_src/jak2/levels/city/kiddogescort/crocesc-states.gc @@ -356,12 +356,7 @@ (logclear! (-> self bot-flags) (bot-flags bf15)) (go-idle-or-move self) ) - (let* ((s5-0 (handle->process (-> self kid-handle))) - (a2-0 (if (type? s5-0 process-focusable) - s5-0 - ) - ) - ) + (let ((a2-0 (the-as process (as-type (handle->process (-> self kid-handle)) process-focusable)))) (if a2-0 (put-rider-in-seat (the-as vehicle gp-0) (-> self vehicle-seat-index) (the-as process-focusable a2-0)) ) @@ -390,7 +385,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 @@ -411,30 +405,21 @@ (until (ja-done? 0) (let ((s3-1 (handle->process (-> self vehicle-handle)))) (quaternion-copy! (the-as quaternion (-> gp-0 vector 2)) (-> (the-as vehicle s3-1) root quat)) - (compute-seat-position (the-as vehicle s3-1) (the-as vector (-> gp-0 vector)) (-> self vehicle-seat-index)) + (compute-seat-position (the-as vehicle s3-1) (-> gp-0 vector 0) (-> self vehicle-seat-index)) ) - (vector-! (-> gp-0 vector 1) (the-as vector (-> gp-0 vector)) 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) + (vector-! (-> gp-0 vector 1) (-> gp-0 vector 0) s5-2) + (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)) @@ -456,12 +441,12 @@ ) ) (vector-matrix*! - (the-as vector (-> gp-0 vector)) + (-> gp-0 vector 0) (-> self local-seat-pos) (-> (the-as vehicle s4-2) node-list data 0 bone transform) ) ) - (vector-! (-> gp-0 vector 1) (the-as vector (-> gp-0 vector)) s5-3) + (vector-! (-> gp-0 vector 1) (-> gp-0 vector 0) s5-3) (let ((f0-16 (lerp-scale 0.0 1.0 (ja-aframe-num 0) (ja-aframe 5.0 0) (ja-aframe 7.0 0)))) (vector+float*! (-> self root trans) s5-3 (-> gp-0 vector 1) f0-16) ) @@ -600,7 +585,8 @@ (set! (-> self vehicle-seat-index) -1) (set! (-> self vehicle-handle) (the-as handle #f)) (logclear! (-> self bot-flags) (bot-flags bf16)) - (logclear! (-> self focus-status) (focus-status pilot-riding pilot)) ;; og:preserve-this fix potential use-after-free bug + (logclear! (-> self focus-status) (focus-status pilot-riding pilot)) + ;; og:preserve-this fix potential use-after-free bug (if (-> self nav) (let ((v1-5 (-> self nav))) (logclear! (-> v1-5 shape nav-flags) (nav-flags has-extra-sphere)) diff --git a/goal_src/jak2/levels/city/kiddogescort/crocesc.gc b/goal_src/jak2/levels/city/kiddogescort/crocesc.gc index f96819081f..a0c2edefce 100644 --- a/goal_src/jak2/levels/city/kiddogescort/crocesc.gc +++ b/goal_src/jak2/levels/city/kiddogescort/crocesc.gc @@ -182,7 +182,7 @@ (defmethod general-event-handler ((this crocadog-escort) (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" + @TODO - unsure if there is a pattern for the events and this should have a more specific name" (case arg2 (('attack) ((method-of-type bot general-event-handler) this arg0 arg1 arg2 arg3) @@ -200,7 +200,7 @@ (defmethod get-penetrate-info ((this crocadog-escort)) "@returns the allowed way(s) this enemy can take damage -@see [[penetrate]] and [[penetrated-by-all&hit-points->penetrated-by]]" + @see [[penetrate]] and [[penetrated-by-all&hit-points->penetrated-by]]" (let ((v1-1 ((method-of-type bot get-penetrate-info) this))) (logior (penetrate jak-yellow-shot jak-red-shot jak-blue-shot) v1-1) ) @@ -259,11 +259,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 ) ) ) @@ -274,18 +272,14 @@ ) (defmethod run-logic? ((this crocadog-escort)) + "Should this process be run? Checked by execute-process-tree." (or (not (logtest? (process-mask enemy) (-> *setting-control* user-current process-mask))) (logtest? (-> this bot-flags) (bot-flags bf09)) ) ) (defmethod enemy-method-97 ((this crocadog-escort)) - (let* ((s4-0 (handle->process (-> this attacker-handle))) - (s5-0 (if (type? s4-0 process-focusable) - s4-0 - ) - ) - ) + (let ((s5-0 (the-as process (as-type (handle->process (-> this attacker-handle)) process-focusable)))) (when s5-0 (when (time-elapsed? (-> this attacker-time) (seconds 3)) (set! s5-0 (the-as process #f)) @@ -297,15 +291,7 @@ (s5-0 (empty) ) - ((begin - (let ((s4-1 (handle->process (-> this poi-handle)))) - (set! s5-0 (if (type? s4-1 process-focusable) - s4-1 - ) - ) - ) - s5-0 - ) + ((begin (set! s5-0 (the-as process (as-type (handle->process (-> this poi-handle)) process-focusable))) s5-0) (empty) ) (else @@ -315,12 +301,7 @@ (empty) ) (else - (let ((s4-2 (handle->process (-> this kid-handle)))) - (set! s5-0 (if (type? s4-2 process-focusable) - s4-2 - ) - ) - ) + (set! s5-0 (the-as process (as-type (handle->process (-> this kid-handle)) process-focusable))) *target* (let ((f30-0 -1.0) (f28-0 (vector-vector-distance (target-pos 0) (-> this root trans))) @@ -366,11 +347,11 @@ (defmethod init-from-entity! ((this crocadog-escort) (arg0 entity-actor)) "Typically the method that does the initial setup on the process, potentially using the [[entity-actor]] provided as part of that. -This commonly includes things such as: -- stack size -- collision information -- loading the skeleton group / bones -- sounds" + This commonly includes things such as: + - stack size + - collision information + - loading the skeleton group / bones + - sounds" (stack-size-set! (-> this main-thread) 512) ((method-of-type bot init-from-entity!) this arg0) (none) diff --git a/goal_src/jak2/levels/city/kiddogescort/hal4-course.gc b/goal_src/jak2/levels/city/kiddogescort/hal4-course.gc index db0f0c18c6..024a038184 100644 --- a/goal_src/jak2/levels/city/kiddogescort/hal4-course.gc +++ b/goal_src/jak2/levels/city/kiddogescort/hal4-course.gc @@ -72,7 +72,7 @@ (defmethod general-event-handler ((this hal-escort) (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" + @TODO - unsure if there is a pattern for the events and this should have a more specific name" (case arg2 (('notify) (case (-> arg3 param 0) @@ -105,12 +105,7 @@ ) (defmethod hal-escort-method-235 ((this hal-escort)) - (let* ((s5-0 (handle->process (-> this arrestor-handle))) - (v1-3 (if (type? s5-0 process-focusable) - s5-0 - ) - ) - ) + (let ((v1-3 (the-as process (as-type (handle->process (-> this arrestor-handle)) process-focusable)))) (when v1-3 (cond ((time-elapsed? (-> this arrestor-time) (seconds 4)) @@ -157,35 +152,25 @@ (let ((s5-0 *target*)) (when (focus-test? s5-0 pilot-riding pilot) (let* ((a0-2 (-> this actor-group 0 data 1 actor)) - (v1-5 (when a0-2 - (let ((s4-0 (-> a0-2 extra process))) - (if (type? s4-0 process-focusable) - s4-0 - ) + (v1-5 (if a0-2 + (the-as process (as-type (-> a0-2 extra process) process-focusable)) ) - ) ) ) (when (focus-test? (the-as process-focusable v1-5) pilot-riding pilot) (let* ((v1-12 (-> this actor-group 0 data 2 actor)) - (a0-5 (when v1-12 - (let ((s4-1 (-> v1-12 extra process))) - (if (type? s4-1 process-focusable) - s4-1 - ) + (a0-5 (if v1-12 + (the-as process (as-type (-> v1-12 extra process) process-focusable)) ) - ) ) ) - (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)) ) ) - ) ) ) ) @@ -196,13 +181,9 @@ ;; WARN: Return type mismatch object vs symbol. (defmethod hal-escort-method-228 ((this hal-escort)) (let* ((v1-3 (-> this actor-group 0 data 1 actor)) - (a0-1 (when v1-3 - (let ((s5-0 (-> v1-3 extra process))) - (if (type? s5-0 process-focusable) - s5-0 - ) + (a0-1 (if v1-3 + (the-as process (as-type (-> v1-3 extra process) process-focusable)) ) - ) ) (s5-1 *target*) ) @@ -210,13 +191,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)) + ) ) ) ) @@ -226,13 +205,9 @@ (defmethod hal-escort-method-234 ((this hal-escort) (arg0 nav-mesh)) (let ((s2-0 (the-as process #f))) (let* ((v1-3 (-> this actor-group 0 data 1 actor)) - (gp-0 (when v1-3 - (let ((s5-0 (-> v1-3 extra process))) - (if (type? s5-0 process-focusable) - s5-0 - ) + (gp-0 (if v1-3 + (the-as process (as-type (-> v1-3 extra process) process-focusable)) ) - ) ) (s5-1 (new 'stack-no-clear 'vector)) ) @@ -263,14 +238,11 @@ (set! (-> s2-2 nav-branch) #f) (set! (-> s2-2 proc) #f) (let ((v1-25 (-> this actor-group 0 data 1 actor))) - (set! (-> s2-2 handle) (process->handle (when v1-25 - (let ((s4-1 (-> v1-25 extra process))) - (if (type? s4-1 process-focusable) - s4-1 - ) - ) - ) - ) + (set! (-> s2-2 handle) + (process->handle (if v1-25 + (the-as process (as-type (-> v1-25 extra process) process-focusable)) + ) + ) ) ) (set! (-> s2-2 user-data) (the-as uint 0)) @@ -295,13 +267,9 @@ "Returns seat index" (let* ((gp-0 (handle->process (-> this vehicle-handle))) (v1-6 (-> this actor-group 0 data 1 actor)) - (s5-0 (when v1-6 - (let ((s4-0 (-> v1-6 extra process))) - (if (type? s4-0 process-focusable) - s4-0 - ) + (s5-0 (if v1-6 + (the-as process (as-type (-> v1-6 extra process) process-focusable)) ) - ) ) (s4-1 -1) ) @@ -325,22 +293,14 @@ (defmethod hal-escort-method-232 ((this hal-escort)) (let* ((target *target*) (v1-3 (-> this actor-group 0 data 1 actor)) - (s5-0 (when v1-3 - (let ((s3-0 (-> v1-3 extra process))) - (if (type? s3-0 process-focusable) - s3-0 - ) + (s5-0 (if v1-3 + (the-as process (as-type (-> v1-3 extra process) process-focusable)) ) - ) ) (a0-2 (-> this actor-group 0 data 2 actor)) - (v1-8 (when a0-2 - (let ((s3-1 (-> a0-2 extra process))) - (if (type? s3-1 process-focusable) - s3-1 - ) + (v1-8 (if a0-2 + (the-as process (as-type (-> a0-2 extra process) process-focusable)) ) - ) ) ) (when target @@ -474,14 +434,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)) ) ) ) @@ -515,14 +471,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)) ) ) ) @@ -538,12 +490,7 @@ (dotimes (s4-0 *actor-list-length*) (let ((v1-27 (-> *actor-list* s4-0))) (when (logtest? (the-as collide-spec s5-0) (-> v1-27 root-prim prim-core collide-as)) - (let* ((s3-0 (-> v1-27 process)) - (a0-16 (if (type? s3-0 process-focusable) - s3-0 - ) - ) - ) + (let ((a0-16 (the-as process-drawable (as-type (-> v1-27 process) process-focusable)))) (when (and a0-16 (= (-> a0-16 type) crimson-guard)) (let ((s3-1 (get-trans (the-as process-focusable a0-16) 0))) (if (and (>= (-> gp-0 vector 1 w) (vector-vector-xz-distance (-> gp-0 vector 1) s3-1)) @@ -566,23 +513,15 @@ (when (not (channel-active? this (gui-channel none))) (let ((s5-0 0)) (let* ((v1-5 (-> this actor-group 0 data 1 actor)) - (s4-0 (when v1-5 - (let ((s3-0 (-> v1-5 extra process))) - (if (type? s3-0 process-focusable) - s3-0 - ) + (s4-0 (if v1-5 + (the-as process (as-type (-> v1-5 extra process) process-focusable)) ) - ) ) ) (let* ((a0-3 (-> this actor-group 0 data 2 actor)) - (v1-10 (when a0-3 - (let ((s3-1 (-> a0-3 extra process))) - (if (type? s3-1 process-focusable) - s3-1 - ) + (v1-10 (if a0-3 + (the-as process (as-type (-> a0-3 extra process) process-focusable)) ) - ) ) ) (if (or (logtest? (-> (the-as process-focusable s4-0) draw status) (draw-control-status on-screen)) @@ -640,13 +579,9 @@ (defun hal4-walking-too-far ((arg0 hal-escort)) (let ((gp-0 0)) (let* ((v1-3 (-> arg0 actor-group 0 data 1 actor)) - (a0-1 (when v1-3 - (let ((s4-0 (-> v1-3 extra process))) - (if (type? s4-0 process-focusable) - s4-0 - ) + (a0-1 (if v1-3 + (the-as process (as-type (-> v1-3 extra process) process-focusable)) ) - ) ) ) (if (and a0-1 (>= (vector-vector-xz-distance (get-trans (the-as process-focusable a0-1) 0) (target-pos 0)) @@ -762,22 +697,14 @@ (function halt-wait-spot hal symbol) (lambda ((arg0 object) (arg1 hal-escort)) (let* ((v1-3 (-> arg1 actor-group 0 data 1 actor)) - (s4-0 (when v1-3 - (let ((s5-0 (-> v1-3 extra process))) - (if (type? s5-0 process-focusable) - s5-0 - ) + (s4-0 (if v1-3 + (the-as process (as-type (-> v1-3 extra process) process-focusable)) ) - ) ) (v1-8 (-> arg1 actor-group 0 data 2 actor)) - (s5-1 (when v1-8 - (let ((s3-0 (-> v1-8 extra process))) - (if (type? s3-0 process-focusable) - s3-0 - ) + (s5-1 (if v1-8 + (the-as process (as-type (-> v1-8 extra process) process-focusable)) ) - ) ) (v1-10 (the-as process *traffic-manager*)) ) @@ -857,11 +784,9 @@ :on-set (lambda ((arg0 hal-escort)) (set-setting! 'sound-mode #f 0.0 2) (let ((s5-0 (-> arg0 hal4-course spots))) - (vector-! (the-as vector (-> arg0 notice-plane)) (the-as vector (-> s5-0 4)) (the-as vector (-> s5-0 3))) + (vector-! (the-as vector (-> arg0 notice-plane)) (-> s5-0 4 center) (-> s5-0 3 center)) (vector-normalize! (-> arg0 notice-plane) 1.0) - (set! (-> arg0 notice-plane w) - (- (vector-dot (the-as vector (-> s5-0 3)) (the-as vector (-> arg0 notice-plane)))) - ) + (set! (-> arg0 notice-plane w) (- (vector-dot (-> s5-0 3 center) (the-as vector (-> arg0 notice-plane))))) ) (play-speech arg0 0) (let ((v1-10 (get-task-by-type (-> arg0 ai-ctrl) halt-wait-spot arg0))) @@ -875,13 +800,9 @@ (local-vars (v1-14 symbol)) (let ((s5-0 (new 'stack-no-clear 'vector))) (let* ((v1-3 (-> arg1 actor-group 0 data 1 actor)) - (a0-1 (when v1-3 - (let ((s4-0 (-> v1-3 extra process))) - (if (type? s4-0 process-focusable) - s4-0 - ) + (a0-1 (if v1-3 + (the-as process (as-type (-> v1-3 extra process) process-focusable)) ) - ) ) ) (when a0-1 @@ -953,13 +874,9 @@ ) (when (speech-playing? arg1 3) (let* ((v1-27 (-> arg1 actor-group 0 data 2 actor)) - (a0-11 (when v1-27 - (let ((s5-0 (-> v1-27 extra process))) - (if (type? s5-0 process-focusable) - s5-0 - ) + (a0-11 (if v1-27 + (the-as process (as-type (-> v1-27 extra process) process-focusable)) ) - ) ) ) (when (and a0-11 (>= (the-as int (send-event a0-11 'query 'waypoint)) 6)) @@ -1007,13 +924,9 @@ (return #t) ) (let* ((v1-25 (-> arg1 actor-group 0 data 2 actor)) - (a0-9 (when v1-25 - (let ((s5-0 (-> v1-25 extra process))) - (if (type? s5-0 process-focusable) - s5-0 - ) + (a0-9 (if v1-25 + (the-as process (as-type (-> v1-25 extra process) process-focusable)) ) - ) ) ) (when (and a0-9 (>= (the-as int (send-event a0-9 'query 'waypoint)) 15)) @@ -1067,22 +980,14 @@ (return #t) ) (let* ((v1-38 (-> arg1 actor-group 0 data 1 actor)) - (s4-0 (when v1-38 - (let ((s5-0 (-> v1-38 extra process))) - (if (type? s5-0 process-focusable) - s5-0 - ) + (s4-0 (if v1-38 + (the-as process (as-type (-> v1-38 extra process) process-focusable)) ) - ) ) (v1-43 (-> arg1 actor-group 0 data 2 actor)) - (s5-1 (when v1-43 - (let ((s3-0 (-> v1-43 extra process))) - (if (type? s3-0 process-focusable) - s3-0 - ) + (s5-1 (if v1-43 + (the-as process (as-type (-> v1-43 extra process) process-focusable)) ) - ) ) (a0-16 s4-0) ) @@ -1137,22 +1042,14 @@ (ai-task-control-method-12 (-> arg0 ai-ctrl) arg0) (send-event *target* 'continue (get-continue-by-name *game-info* "lkiddoge-skip0")) (let* ((v1-16 (-> arg0 actor-group 0 data 2 actor)) - (s5-1 (when v1-16 - (let ((s4-0 (-> v1-16 extra process))) - (if (type? s4-0 process-focusable) - s4-0 - ) + (s5-1 (if v1-16 + (the-as process (as-type (-> v1-16 extra process) process-focusable)) ) - ) ) (v1-21 (-> arg0 actor-group 0 data 1 actor)) - (s4-1 (when v1-21 - (let ((s3-0 (-> v1-21 extra process))) - (if (type? s3-0 process-focusable) - s3-0 - ) + (s4-1 (if v1-21 + (the-as process (as-type (-> v1-21 extra process) process-focusable)) ) - ) ) ) (send-event s5-1 'skip) @@ -1202,36 +1099,23 @@ (return #t) ) (let* ((v1-45 (-> arg1 actor-group 0 data 1 actor)) - (s5-0 (when v1-45 - (let ((s4-0 (-> v1-45 extra process))) - (if (type? s4-0 process-focusable) - s4-0 - ) + (s5-0 (if v1-45 + (the-as process (as-type (-> v1-45 extra process) process-focusable)) ) - ) ) (v1-50 (-> arg1 actor-group 0 data 2 actor)) - (s4-1 (when v1-50 - (let ((s3-0 (-> v1-50 extra process))) - (if (type? s3-0 process-focusable) - s3-0 - ) + (s4-1 (if v1-50 + (the-as process (as-type (-> v1-50 extra process) process-focusable)) ) - ) ) ) (let ((s3-1 #f)) - (let* ((s1-0 (handle->process (-> arg1 vehicle-handle))) - (s2-0 (if (type? s1-0 process-focusable) - s1-0 - ) - ) - ) + (let ((s2-0 (the-as process (as-type (handle->process (-> arg1 vehicle-handle)) process-focusable)))) (when s2-0 (let ((s1-1 (get-trans (the-as process-focusable s2-0) 0)) (s0-0 (-> arg1 hal4-course spots 7)) ) - (if (and (>= (-> arg1 hal4-course spots 7 center w) (vector-vector-xz-distance s1-1 (the-as vector s0-0))) + (if (and (>= (-> arg1 hal4-course spots 7 center w) (vector-vector-xz-distance s1-1 (-> s0-0 center))) (>= 16384.0 (- (-> s1-1 y) (-> s0-0 center y))) (>= 61440.0 (vector-length (-> (the-as process-focusable s2-0) root transv))) (>= 1.0 (vector-length (-> (the-as process-focusable s2-0) rbody state ang-velocity))) @@ -1326,42 +1210,36 @@ (set! (-> v1-1 bytes 6) 7) (set! (-> v1-1 bytes 4) 0) (set! (-> (the-as halt-wait-spot v1-1) check-done) - (the-as (function halt-wait-spot hal symbol) (lambda ((arg0 object) (arg1 hal-escort)) - (if (!= (level-status *level* 'ctyinda) 'active) - (set-time! (-> arg1 waypoint-time0)) - ) - (when (time-elapsed? (-> arg1 waypoint-time0) (seconds 0.25)) - (let* ((v1-11 (-> arg1 actor-group 0 data 2 actor)) - (s5-1 (when v1-11 - (let ((s4-0 (-> v1-11 extra process))) - (if (type? s4-0 process-focusable) - s4-0 - ) - ) - ) - ) - (v1-16 (-> arg1 actor-group 0 data 1 actor)) - (s4-1 (when v1-16 - (let ((s3-0 (-> v1-16 extra process))) - (if (type? s3-0 process-focusable) - s3-0 - ) - ) - ) - ) - ) - (send-event s5-1 'hide #f) - (send-event s4-1 'hide #f) - (send-event s5-1 'skip) - (send-event s4-1 'skip) - ) - (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) - (go-to-waypoint! arg1 19 #f) - (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) - #t - ) - ) + (the-as + (function halt-wait-spot hal symbol) + (lambda ((arg0 object) (arg1 hal-escort)) + (if (!= (level-status *level* 'ctyinda) 'active) + (set-time! (-> arg1 waypoint-time0)) ) + (when (time-elapsed? (-> arg1 waypoint-time0) (seconds 0.25)) + (let* ((v1-11 (-> arg1 actor-group 0 data 2 actor)) + (s5-1 (if v1-11 + (the-as process (as-type (-> v1-11 extra process) process-focusable)) + ) + ) + (v1-16 (-> arg1 actor-group 0 data 1 actor)) + (s4-1 (if v1-16 + (the-as process (as-type (-> v1-16 extra process) process-focusable)) + ) + ) + ) + (send-event s5-1 'hide #f) + (send-event s4-1 'hide #f) + (send-event s5-1 'skip) + (send-event s4-1 'skip) + ) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 19 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + #t + ) + ) + ) ) ) (none) @@ -1372,22 +1250,14 @@ (reset-warn-time! arg0) (ai-task-control-method-12 (-> arg0 ai-ctrl) arg0) (let* ((v1-10 (-> arg0 actor-group 0 data 2 actor)) - (s5-0 (when v1-10 - (let ((s4-0 (-> v1-10 extra process))) - (if (type? s4-0 process-focusable) - s4-0 - ) + (s5-0 (if v1-10 + (the-as process (as-type (-> v1-10 extra process) process-focusable)) ) - ) ) (v1-15 (-> arg0 actor-group 0 data 1 actor)) - (s4-1 (when v1-15 - (let ((s3-0 (-> v1-15 extra process))) - (if (type? s3-0 process-focusable) - s3-0 - ) + (s4-1 (if v1-15 + (the-as process (as-type (-> v1-15 extra process) process-focusable)) ) - ) ) ) (vector-reset! (-> (the-as process-focusable s5-0) root transv)) @@ -1438,22 +1308,14 @@ (return #t) ) (let* ((v1-27 (-> arg1 actor-group 0 data 2 actor)) - (s4-0 (when v1-27 - (let ((s5-0 (-> v1-27 extra process))) - (if (type? s5-0 process-focusable) - s5-0 - ) + (s4-0 (if v1-27 + (the-as process (as-type (-> v1-27 extra process) process-focusable)) ) - ) ) (v1-32 (-> arg1 actor-group 0 data 1 actor)) - (s5-1 (when v1-32 - (let ((s3-0 (-> v1-32 extra process))) - (if (type? s3-0 process-focusable) - s3-0 - ) + (s5-1 (if v1-32 + (the-as process (as-type (-> v1-32 extra process) process-focusable)) ) - ) ) ) (when (and (and s4-0 (>= (the-as int (send-event s4-0 'query 'waypoint)) 25)) @@ -1484,22 +1346,14 @@ (send-event arg0 'move-trans (-> arg0 hal4-course spots 7)) (send-event *target* 'continue (get-continue-by-name *game-info* "lkiddoge-skip1")) (let* ((v1-23 (-> arg0 actor-group 0 data 2 actor)) - (s5-1 (when v1-23 - (let ((s4-0 (-> v1-23 extra process))) - (if (type? s4-0 process-focusable) - s4-0 - ) + (s5-1 (if v1-23 + (the-as process (as-type (-> v1-23 extra process) process-focusable)) ) - ) ) (v1-28 (-> arg0 actor-group 0 data 1 actor)) - (gp-1 (when v1-28 - (let ((s4-1 (-> v1-28 extra process))) - (if (type? s4-1 process-focusable) - s4-1 - ) + (gp-1 (if v1-28 + (the-as process (as-type (-> v1-28 extra process) process-focusable)) ) - ) ) ) (send-event s5-1 'skip) @@ -1545,22 +1399,14 @@ ) (when (not (hal-escort-method-230 arg1)) (let* ((v1-34 (-> arg1 actor-group 0 data 2 actor)) - (s4-1 (when v1-34 - (let ((s3-1 (-> v1-34 extra process))) - (if (type? s3-1 process-focusable) - s3-1 - ) + (s4-1 (if v1-34 + (the-as process (as-type (-> v1-34 extra process) process-focusable)) ) - ) ) (v1-39 (-> arg1 actor-group 0 data 1 actor)) - (s3-2 (when v1-39 - (let ((s2-0 (-> v1-39 extra process))) - (if (type? s2-0 process-focusable) - s2-0 - ) + (s3-2 (if v1-39 + (the-as process (as-type (-> v1-39 extra process) process-focusable)) ) - ) ) ) (when (and (process-grab? s4-1 #t) @@ -1677,23 +1523,15 @@ (time-elapsed? (-> arg1 waypoint-time0) (seconds 1.2)) ) (let* ((v1-55 (-> arg1 actor-group 0 data 2 actor)) - (s5-1 (when v1-55 - (let ((s4-0 (-> v1-55 extra process))) - (if (type? s4-0 process-focusable) - s4-0 - ) + (s5-1 (if v1-55 + (the-as process (as-type (-> v1-55 extra process) process-focusable)) ) - ) ) ) (let* ((v1-60 (-> arg1 actor-group 0 data 1 actor)) - (a0-16 (when v1-60 - (let ((s4-1 (-> v1-60 extra process))) - (if (type? s4-1 process-focusable) - s4-1 - ) + (a0-16 (if v1-60 + (the-as process (as-type (-> v1-60 extra process) process-focusable)) ) - ) ) ) (logior! (-> arg1 waypoint-bits) (waypoint-bits wabits-0)) @@ -1768,13 +1606,9 @@ (when gp-0 (logior! (-> arg0 waypoint-bits) (waypoint-bits wabits-0)) (let* ((v1-8 (-> arg0 actor-group 0 data 1 actor)) - (a0-3 (when v1-8 - (let ((s5-1 (-> v1-8 extra process))) - (if (type? s5-1 process-focusable) - s5-1 - ) + (a0-3 (if v1-8 + (the-as process (as-type (-> v1-8 extra process) process-focusable)) ) - ) ) ) (send-event a0-3 'instant-arrest gp-0) @@ -1843,13 +1677,9 @@ (remove-setting! 'music) (remove-setting! 'sound-mode) (let* ((v1-7 (-> arg0 actor-group 0 data 2 actor)) - (a0-3 (when v1-7 - (let ((s5-0 (-> v1-7 extra process))) - (if (type? s5-0 process-focusable) - s5-0 - ) + (a0-3 (if v1-7 + (the-as process (as-type (-> v1-7 extra process) process-focusable)) ) - ) ) ) (send-event a0-3 'request 'too-far-fail) @@ -1906,13 +1736,9 @@ (when gp-0 (logior! (-> arg0 waypoint-bits) (waypoint-bits wabits-0)) (let* ((v1-8 (-> arg0 actor-group 0 data 1 actor)) - (a0-3 (when v1-8 - (let ((s5-1 (-> v1-8 extra process))) - (if (type? s5-1 process-focusable) - s5-1 - ) + (a0-3 (if v1-8 + (the-as process (as-type (-> v1-8 extra process) process-focusable)) ) - ) ) ) (send-event a0-3 'instant-arrest gp-0) diff --git a/goal_src/jak2/levels/city/kiddogescort/kidesc-states.gc b/goal_src/jak2/levels/city/kiddogescort/kidesc-states.gc index 28654b128a..d98a8e8e4a 100644 --- a/goal_src/jak2/levels/city/kiddogescort/kidesc-states.gc +++ b/goal_src/jak2/levels/city/kiddogescort/kidesc-states.gc @@ -36,13 +36,9 @@ (go-waiting-turn self) (b! #t cfg-15 :delay (nop!)) (label cfg-6) - (let ((gp-0 (handle->process (-> self arrestor-handle)))) - (if (if (type? gp-0 process-focusable) - gp-0 - ) - (go-virtual arrested) - ) - ) + (if (the-as process (as-type (handle->process (-> self arrestor-handle)) process-focusable)) + (go-virtual arrested) + ) (label cfg-15) (when (not (focus-test? self grabbed)) (cond @@ -104,14 +100,9 @@ (bot-method-223 self #f) (when (not (focus-test? self grabbed)) (if (and (not (outside-spot-radius? self (the-as bot-spot #f) (the-as vector #f) #f)) - (let ((gp-0 (handle->process (-> self arrestor-handle)))) - (and (not (if (type? gp-0 process-focusable) - gp-0 - ) - ) - (not (logtest? (-> self bot-flags) (bot-flags bf15))) - ) - ) + (and (not (the-as process (as-type (handle->process (-> self arrestor-handle)) process-focusable))) + (not (logtest? (-> self bot-flags) (bot-flags bf15))) + ) ) (go-virtual traveling) ) @@ -155,26 +146,22 @@ ) :trans (behavior () (bot-method-223 self #f) - (let ((gp-0 (handle->process (-> self arrestor-handle)))) - (cond - ((if (type? gp-0 process-focusable) - gp-0 - ) - (go-virtual arrested) - ) - ((logtest? (-> self bot-flags) (bot-flags bf15)) - (go-virtual move-to-vehicle) - ) - ((outside-spot-radius? self (the-as bot-spot #f) (the-as vector #f) #t) - (check-arrest self) - ) - ((and (time-elapsed? (-> self state-time) (seconds 0.5)) (bot-method-208 self)) - (go-virtual traveling-blocked) - ) - ((and (nav-enemy-method-163 self) (time-elapsed? (-> self state-time) (-> self reaction-time))) - (go-stare2 self) - ) - ) + (cond + ((the-as process (as-type (handle->process (-> self arrestor-handle)) process-focusable)) + (go-virtual arrested) + ) + ((logtest? (-> self bot-flags) (bot-flags bf15)) + (go-virtual move-to-vehicle) + ) + ((outside-spot-radius? self (the-as bot-spot #f) (the-as vector #f) #t) + (check-arrest self) + ) + ((and (time-elapsed? (-> self state-time) (seconds 0.5)) (bot-method-208 self)) + (go-virtual traveling-blocked) + ) + ((and (nav-enemy-method-163 self) (time-elapsed? (-> self state-time) (-> self reaction-time))) + (go-stare2 self) + ) ) 0 ) @@ -223,28 +210,24 @@ :trans (behavior () (bot-method-223 self #f) (let ((gp-0 (handle->process (-> self vehicle-handle)))) - (let ((s5-0 (handle->process (-> self arrestor-handle)))) - (cond - ((if (type? s5-0 process-focusable) - s5-0 - ) - (go-virtual arrested) - ) - ((or (not gp-0) - (logtest? (-> (the-as vehicle gp-0) flags) (rigid-body-object-flag dead)) - (not (logtest? (-> self bot-flags) (bot-flags bf15))) - (< (-> self vehicle-seat-index) 0) - ) - (logclear! (-> self bot-flags) (bot-flags bf15)) - (check-arrest self) - ) - ((and (time-elapsed? (-> self state-time) (seconds 0.5)) (bot-method-208 self)) - (go-virtual traveling-blocked) - ) - ((and (nav-enemy-method-163 self) (time-elapsed? (-> self state-time) (-> self reaction-time))) - (go-stare2 self) - ) - ) + (cond + ((the-as process (as-type (handle->process (-> self arrestor-handle)) process-focusable)) + (go-virtual arrested) + ) + ((or (not gp-0) + (logtest? (-> (the-as vehicle gp-0) flags) (rigid-body-object-flag dead)) + (not (logtest? (-> self bot-flags) (bot-flags bf15))) + (< (-> self vehicle-seat-index) 0) + ) + (logclear! (-> self bot-flags) (bot-flags bf15)) + (check-arrest self) + ) + ((and (time-elapsed? (-> self state-time) (seconds 0.5)) (bot-method-208 self)) + (go-virtual traveling-blocked) + ) + ((and (nav-enemy-method-163 self) (time-elapsed? (-> self state-time) (-> self reaction-time))) + (go-stare2 self) + ) ) (let ((s5-1 (new 'stack-no-clear 'inline-array 'matrix 2))) (compute-seat-position (the-as vehicle gp-0) (the-as vector (-> s5-1 0)) (-> self vehicle-seat-index)) @@ -335,7 +318,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)) @@ -371,32 +353,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) @@ -571,7 +544,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) @@ -622,17 +594,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)) @@ -655,17 +618,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) @@ -698,20 +652,16 @@ ) :trans (behavior () (bot-method-223 self #f) - (let ((gp-0 (handle->process (-> self arrestor-handle)))) - (cond - ((if (type? gp-0 process-focusable) - gp-0 - ) - (go-virtual arrested) - ) - ((and (time-elapsed? (-> self state-time) (seconds 1)) (not (bot-method-208 self))) - (if (logtest? (-> self bot-flags) (bot-flags bf15)) - (go-virtual move-to-vehicle) - (go-virtual traveling) - ) - ) - ) + (cond + ((the-as process (as-type (handle->process (-> self arrestor-handle)) process-focusable)) + (go-virtual arrested) + ) + ((and (time-elapsed? (-> self state-time) (seconds 1)) (not (bot-method-208 self))) + (if (logtest? (-> self bot-flags) (bot-flags bf15)) + (go-virtual move-to-vehicle) + (go-virtual traveling) + ) + ) ) ) :code (-> (method-of-type kid-escort waiting-idle) code) @@ -734,13 +684,9 @@ ) :trans (behavior () (bot-method-223 self #f) - (let ((gp-0 (handle->process (-> self arrestor-handle)))) - (if (if (type? gp-0 process-focusable) - gp-0 - ) - (go-virtual arrested) - ) - ) + (if (the-as process (as-type (handle->process (-> self arrestor-handle)) process-focusable)) + (go-virtual arrested) + ) (when (time-elapsed? (-> self state-time) (seconds 0.1)) (when (not (nav-enemy-method-163 self)) (if (logtest? (-> self bot-flags) (bot-flags bf15)) @@ -841,14 +787,9 @@ (go-waiting-turn self) ) (when (not (focus-test? self grabbed)) - (let ((gp-0 (handle->process (-> self arrestor-handle)))) - (if (not (if (type? gp-0 process-focusable) - gp-0 - ) - ) - (react-to-focus self) - ) - ) + (if (not (the-as process (as-type (handle->process (-> self arrestor-handle)) process-focusable))) + (react-to-focus self) + ) ) ) ) @@ -858,12 +799,7 @@ (cond ((logtest? (bot-flags bf19) (-> self bot-flags)) (fail-mission! self) - (let* ((gp-0 (handle->process (-> self arrestor-handle))) - (v1-7 (if (type? gp-0 process-focusable) - gp-0 - ) - ) - ) + (let ((v1-7 (the-as process (as-type (handle->process (-> self arrestor-handle)) process-focusable)))) (if v1-7 (logclear! (-> (the-as crimson-guard v1-7) enemy-flags) (enemy-flag vulnerable vulnerable-backup)) ) @@ -898,12 +834,7 @@ #f (label cfg-27) (fail-mission! self) - (let* ((gp-1 (handle->process (-> self arrestor-handle))) - (v1-93 (if (type? gp-1 process-focusable) - gp-1 - ) - ) - ) + (let ((v1-93 (the-as process (as-type (handle->process (-> self arrestor-handle)) process-focusable)))) (if v1-93 (logclear! (-> (the-as crimson-guard v1-93) enemy-flags) (enemy-flag vulnerable vulnerable-backup)) ) diff --git a/goal_src/jak2/levels/city/kiddogescort/kidesc.gc b/goal_src/jak2/levels/city/kiddogescort/kidesc.gc index 809d1559fc..ce256ab638 100644 --- a/goal_src/jak2/levels/city/kiddogescort/kidesc.gc +++ b/goal_src/jak2/levels/city/kiddogescort/kidesc.gc @@ -182,15 +182,10 @@ (defmethod general-event-handler ((this kid-escort) (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" + @TODO - unsure if there is a pattern for the events and this should have a more specific name" (case arg2 (('arrest) - (let* ((s4-0 (handle->process (-> this arrestor-handle))) - (v1-4 (if (type? s4-0 process-focusable) - s4-0 - ) - ) - ) + (let ((v1-4 (the-as process (as-type (handle->process (-> this arrestor-handle)) process-focusable)))) (when (or (not v1-4) (= v1-4 arg0) (and (!= v1-4 arg0) (time-elapsed? (-> this arrest-attempt-time) (seconds 0.1)))) (set! (-> this arrestor-handle) (process->handle arg0)) (set-time! (-> this arrest-attempt-time)) @@ -235,23 +230,16 @@ ) (defmethod run-logic? ((this kid-escort)) + "Should this process be run? Checked by execute-process-tree." (or (not (logtest? (process-mask enemy) (-> *setting-control* user-current process-mask))) (logtest? (-> this bot-flags) (bot-flags bf09)) ) ) (defmethod enemy-method-97 ((this kid-escort)) - (let* ((s4-0 (handle->process (-> this attacker-handle))) - (s5-0 (if (type? s4-0 process-focusable) - s4-0 - ) - ) - (s3-0 (handle->process (-> this arrestor-handle))) - (s4-1 (if (type? s3-0 process-focusable) - s3-0 - ) - ) - ) + (let ((s5-0 (the-as process (as-type (handle->process (-> this attacker-handle)) process-focusable))) + (s4-1 (the-as process (as-type (handle->process (-> this arrestor-handle)) process-focusable))) + ) (when s5-0 (cond ((= (-> s5-0 type) target) @@ -297,12 +285,7 @@ (empty) ) (else - (let ((s5-1 (handle->process (-> this poi-handle)))) - (set! s3-1 (if (type? s5-1 process-focusable) - s5-1 - ) - ) - ) + (set! s3-1 (the-as process (as-type (handle->process (-> this poi-handle)) process-focusable))) (if s3-1 (empty) (set! s3-1 *target*) @@ -319,12 +302,7 @@ (set! s3-1 s5-0) ) (else - (let ((s5-2 (handle->process (-> this poi-handle)))) - (set! s3-1 (if (type? s5-2 process-focusable) - s5-2 - ) - ) - ) + (set! s3-1 (the-as process (as-type (handle->process (-> this poi-handle)) process-focusable))) (cond (s3-1 (empty) @@ -370,11 +348,11 @@ (defmethod init-from-entity! ((this kid-escort) (arg0 entity-actor)) "Typically the method that does the initial setup on the process, potentially using the [[entity-actor]] provided as part of that. -This commonly includes things such as: -- stack size -- collision information -- loading the skeleton group / bones -- sounds" + This commonly includes things such as: + - stack size + - collision information + - loading the skeleton group / bones + - sounds" (stack-size-set! (-> this main-thread) 512) ((method-of-type bot init-from-entity!) this arg0) (none) @@ -519,19 +497,15 @@ This commonly includes things such as: ;; WARN: Return type mismatch object vs none. (defmethod check-arrest ((this kid-escort)) - (let ((s5-0 (handle->process (-> this arrestor-handle)))) - (cond - ((if (type? s5-0 process-focusable) - s5-0 - ) - (go (method-of-object this arrested)) - ) - ((logtest? (-> this bot-flags) (bot-flags bf15)) - (go (method-of-object this move-to-vehicle)) - ) - (else - (go (method-of-object this waiting-idle)) - ) + (cond + ((the-as process (as-type (handle->process (-> this arrestor-handle)) process-focusable)) + (go (method-of-object this arrested)) + ) + ((logtest? (-> this bot-flags) (bot-flags bf15)) + (go (method-of-object this move-to-vehicle)) + ) + (else + (go (method-of-object this waiting-idle)) ) ) (none) @@ -617,7 +591,7 @@ This commonly includes things such as: (defmethod get-penetrate-info ((this kid-escort)) "@returns the allowed way(s) this enemy can take damage -@see [[penetrate]] and [[penetrated-by-all&hit-points->penetrated-by]]" + @see [[penetrate]] and [[penetrated-by-all&hit-points->penetrated-by]]" (let ((v1-1 ((method-of-type bot get-penetrate-info) this))) (logior (penetrate jak-yellow-shot jak-red-shot jak-blue-shot) v1-1) ) @@ -676,11 +650,9 @@ This commonly includes things such as: (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/goal_src/jak2/levels/city/meet-brutter/meet-brutter.gc b/goal_src/jak2/levels/city/meet-brutter/meet-brutter.gc index 9eb64f217a..df821d47e5 100644 --- a/goal_src/jak2/levels/city/meet-brutter/meet-brutter.gc +++ b/goal_src/jak2/levels/city/meet-brutter/meet-brutter.gc @@ -16,13 +16,9 @@ ;; DECOMP BEGINS (defmethod draw ((this hud-lurker)) - (set-hud-piece-position! - (the-as hud-sprite (-> this sprites)) - (the int (+ 457.0 (* 130.0 (-> this offset)))) - 205 - ) + (set-hud-piece-position! (-> this sprites 0) (the int (+ 457.0 (* 130.0 (-> this offset)))) 205) (format (clear (-> this strings 0 text)) "~D" (-> this values 0 current)) - (set-as-offset-from! (the-as hud-sprite (-> this strings 0 pos)) (the-as vector4w (-> this sprites)) -19 27) + (set-as-offset-from! (the-as hud-sprite (-> this strings 0 pos)) (-> this sprites 0 pos) -19 27) ((method-of-type hud draw) this) 0 (none) @@ -879,7 +875,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) @@ -919,18 +914,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) @@ -1198,7 +1184,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) @@ -1253,19 +1238,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) @@ -2187,12 +2164,7 @@ (set! (-> gp-1 params 0 id) (the-as uint (+ s5-1 120))) (set! (-> gp-1 params 0 position quad) (-> s2-0 pos quad)) (set! (-> gp-1 params 1 position quad) (-> s2-0 pos quad)) - (let ((s4-0 (the-as - paddywagon - (vehicle-spawn *traffic-manager* paddywagon (the-as traffic-object-spawn-params (-> gp-1 params))) - ) - ) - ) + (let ((s4-0 (the-as paddywagon (vehicle-spawn *traffic-manager* paddywagon (-> gp-1 params 0))))) (when s4-0 (set! (-> s4-0 current-level) (-> s2-0 level)) (set! (-> self slave (+ s5-1 (-> self max-count))) (process->handle s4-0)) @@ -2439,12 +2411,12 @@ ) ((zero? (-> self data-int32 s5-2)) (when (the-as city-lurker s4-2) - (let* ((s2-0 (entity-nav-mesh-by-aid (the-as actor-id (-> (the-as city-lurker s4-2) nav-mesh-aid)))) - (s3-2 (if (type? s2-0 entity-nav-mesh) - s2-0 - ) - ) - ) + (let ((s3-2 (as-type + (entity-nav-mesh-by-aid (the-as actor-id (-> (the-as city-lurker s4-2) nav-mesh-aid))) + entity-nav-mesh + ) + ) + ) (when (and s3-2 (!= (-> (the-as city-lurker s4-2) nav state mesh) (-> s3-2 nav-mesh))) (when (nonzero? (-> (the-as city-lurker s4-2) nav state mesh)) (remove-process-drawable (-> (the-as city-lurker s4-2) nav state mesh) (the-as city-lurker s4-2)) @@ -2469,24 +2441,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)) ) ) ) @@ -2507,11 +2472,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) @@ -2520,11 +2481,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) @@ -2554,12 +2511,12 @@ ) ) ((= (-> self data-int32 s5-2) 2) - (let* ((s3-8 (entity-nav-mesh-by-aid (the-as actor-id (-> (the-as city-lurker s4-2) nav-mesh-aid)))) - (a0-116 (if (type? s3-8 entity-nav-mesh) - s3-8 - ) - ) - ) + (let ((a0-116 (as-type + (entity-nav-mesh-by-aid (the-as actor-id (-> (the-as city-lurker s4-2) nav-mesh-aid))) + entity-nav-mesh + ) + ) + ) (if a0-116 (change-to (-> a0-116 nav-mesh) (the-as city-lurker s4-2)) ) @@ -2751,12 +2708,7 @@ (set! (-> gp-0 params 0 id) (the-as uint (+ s5-0 120))) (set! (-> gp-0 params 0 position quad) (-> s2-0 pos quad)) (set! (-> gp-0 params 1 position quad) (-> s2-0 pos quad)) - (let ((s4-0 (the-as - paddywagon - (vehicle-spawn *traffic-manager* paddywagon (the-as traffic-object-spawn-params (-> gp-0 params))) - ) - ) - ) + (let ((s4-0 (the-as paddywagon (vehicle-spawn *traffic-manager* paddywagon (-> gp-0 params 0))))) (when s4-0 (set! (-> s4-0 current-level) (-> s2-0 level)) (set! (-> self slave (+ s5-0 (-> self max-count))) (process->handle s4-0)) @@ -2999,12 +2951,12 @@ ) ((zero? (-> self data-int32 s5-3)) (when (the-as city-lurker s4-2) - (let* ((s2-0 (entity-nav-mesh-by-aid (the-as actor-id (-> (the-as city-lurker s4-2) nav-mesh-aid)))) - (s3-2 (if (type? s2-0 entity-nav-mesh) - s2-0 - ) - ) - ) + (let ((s3-2 (as-type + (entity-nav-mesh-by-aid (the-as actor-id (-> (the-as city-lurker s4-2) nav-mesh-aid))) + entity-nav-mesh + ) + ) + ) (when (and s3-2 (!= (-> (the-as city-lurker s4-2) nav state mesh) (-> s3-2 nav-mesh))) (when (nonzero? (-> (the-as city-lurker s4-2) nav state mesh)) (remove-process-drawable (-> (the-as city-lurker s4-2) nav state mesh) (the-as city-lurker s4-2)) @@ -3031,24 +2983,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)) ) ) ) @@ -3084,11 +3029,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) @@ -3097,11 +3038,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) @@ -3117,12 +3054,12 @@ ) ) ((= (-> self data-int32 s5-3) 2) - (let* ((s3-6 (entity-nav-mesh-by-aid (the-as actor-id (-> (the-as city-lurker s4-2) nav-mesh-aid)))) - (a0-134 (if (type? s3-6 entity-nav-mesh) - s3-6 - ) - ) - ) + (let ((a0-134 (as-type + (entity-nav-mesh-by-aid (the-as actor-id (-> (the-as city-lurker s4-2) nav-mesh-aid))) + entity-nav-mesh + ) + ) + ) (if a0-134 (change-to (-> a0-134 nav-mesh) (the-as city-lurker s4-2)) ) diff --git a/goal_src/jak2/levels/city/onintent/onin-game.gc b/goal_src/jak2/levels/city/onintent/onin-game.gc index 552612d8fe..e6b65e11d4 100644 --- a/goal_src/jak2/levels/city/onintent/onin-game.gc +++ b/goal_src/jak2/levels/city/onintent/onin-game.gc @@ -2069,15 +2069,7 @@ ;; ERROR: Stack slot load at 96 mismatch: defined as size 4, got size 16 ;; ERROR: Stack slot load at 112 mismatch: defined as size 4, got size 16 (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)) @@ -2174,37 +2166,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/goal_src/jak2/levels/city/package/delivery-task.gc b/goal_src/jak2/levels/city/package/delivery-task.gc index 36e5186ca8..af2307ddde 100644 --- a/goal_src/jak2/levels/city/package/delivery-task.gc +++ b/goal_src/jak2/levels/city/package/delivery-task.gc @@ -89,11 +89,11 @@ ;; WARN: Return type mismatch entity-perm-status vs none. (defmethod init-from-entity! ((this krew-package) (arg0 entity-actor)) "Typically the method that does the initial setup on the process, potentially using the [[entity-actor]] provided as part of that. -This commonly includes things such as: -- stack size -- collision information -- loading the skeleton group / bones -- sounds" + This commonly includes things such as: + - stack size + - collision information + - loading the skeleton group / bones + - sounds" (process-entity-status! this (entity-perm-status dead) #t) (none) ) @@ -376,49 +376,49 @@ This commonly includes things such as: ) ) ) - (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) ) ) @@ -444,13 +444,11 @@ This commonly includes things such as: ) (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) ) @@ -489,13 +487,11 @@ This commonly includes things such as: ) (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/goal_src/jak2/levels/city/port/race/errol-chal.gc b/goal_src/jak2/levels/city/port/race/errol-chal.gc index e3ae31c08d..15e1278d0c 100644 --- a/goal_src/jak2/levels/city/port/race/errol-chal.gc +++ b/goal_src/jak2/levels/city/port/race/errol-chal.gc @@ -504,32 +504,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 @@ -726,14 +716,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)) @@ -1172,11 +1161,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) ) @@ -1184,9 +1170,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) ) @@ -1207,11 +1191,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) @@ -1407,11 +1389,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/goal_src/jak2/levels/city/sack/collection-task.gc b/goal_src/jak2/levels/city/sack/collection-task.gc index 2456d54747..ae7f49420f 100644 --- a/goal_src/jak2/levels/city/sack/collection-task.gc +++ b/goal_src/jak2/levels/city/sack/collection-task.gc @@ -8,13 +8,9 @@ ;; DECOMP BEGINS (defmethod draw ((this hud-moneybag)) - (set-hud-piece-position! - (the-as hud-sprite (-> this sprites)) - (the int (+ 462.0 (* 130.0 (-> this offset)))) - 210 - ) + (set-hud-piece-position! (-> this sprites 0) (the int (+ 462.0 (* 130.0 (-> this offset)))) 210) (format (clear (-> this strings 0 text)) "~D" (-> this values 0 current)) - (set-as-offset-from! (the-as hud-sprite (-> this strings 0 pos)) (the-as vector4w (-> this sprites)) -25 25) + (set-as-offset-from! (the-as hud-sprite (-> this strings 0 pos)) (-> this sprites 0 pos) -25 25) ((method-of-type hud draw) this) 0 (none) @@ -112,10 +108,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) @@ -331,13 +325,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/goal_src/jak2/levels/city/shuttle/shuttle.gc b/goal_src/jak2/levels/city/shuttle/shuttle.gc index 633bf9b893..e2867ca17e 100644 --- a/goal_src/jak2/levels/city/shuttle/shuttle.gc +++ b/goal_src/jak2/levels/city/shuttle/shuttle.gc @@ -8,13 +8,9 @@ ;; DECOMP BEGINS (defmethod draw ((this hud-citizen)) - (set-hud-piece-position! - (the-as hud-sprite (-> this sprites)) - (the int (+ 452.0 (* 130.0 (-> this offset)))) - 195 - ) + (set-hud-piece-position! (-> this sprites 0) (the int (+ 452.0 (* 130.0 (-> this offset)))) 195) (format (clear (-> this strings 0 text)) "~D" (-> this values 0 current)) - (set-as-offset-from! (the-as hud-sprite (-> this strings 0 pos)) (the-as vector4w (-> this sprites)) -15 47) + (set-as-offset-from! (the-as hud-sprite (-> this strings 0 pos)) (-> this sprites 0 pos) -15 47) ((method-of-type hud draw) this) 0 (none) @@ -411,7 +407,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)) @@ -443,22 +438,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) @@ -492,30 +478,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) @@ -1021,7 +999,7 @@ ;; 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) @@ -1189,12 +1167,7 @@ (let ((s2-0 (handle->process (-> arg0 slave s3-2)))) (cond (s2-0 - (let* ((s1-0 (entity-nav-mesh-by-aid (-> (the-as citizen-rebel s2-0) nav-mesh-aid))) - (s4-1 (if (type? s1-0 entity-nav-mesh) - s1-0 - ) - ) - ) + (let ((s4-1 (as-type (entity-nav-mesh-by-aid (-> (the-as citizen-rebel s2-0) nav-mesh-aid)) entity-nav-mesh))) (cond (s4-1 (when (focus-test? (the-as citizen-rebel s2-0) inactive) @@ -1245,22 +1218,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) + ) ) ) ) @@ -1303,11 +1269,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)) @@ -1350,11 +1314,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) @@ -1363,11 +1323,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/goal_src/jak2/levels/city/traffic/citizen/citizen.gc b/goal_src/jak2/levels/city/traffic/citizen/citizen.gc index b4b95bdf38..2fcc50931c 100644 --- a/goal_src/jak2/levels/city/traffic/citizen/citizen.gc +++ b/goal_src/jak2/levels/city/traffic/citizen/citizen.gc @@ -199,7 +199,7 @@ (defmethod citizen-method-186 ((this citizen) (arg0 nav-segment)) (vehicle-controller-method-11 (-> this controller)) - (vehicle-controller-method-13 (-> this controller) (-> arg0 branch) (the-as vector (-> arg0 vertex))) + (vehicle-controller-method-13 (-> this controller) (-> arg0 branch) (-> arg0 vertex 0)) 0 (none) ) @@ -257,12 +257,7 @@ ) ) (when v1-1 - (let* ((s5-0 (handle->process (-> this incoming attacker-handle))) - (a2-5 (if (type? s5-0 process-focusable) - s5-0 - ) - ) - ) + (let ((a2-5 (the-as process (as-type (handle->process (-> this incoming attacker-handle)) process-focusable)))) (if a2-5 (trigger-alert this 1 (the-as target a2-5)) ) @@ -888,7 +883,6 @@ ) (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)) @@ -905,54 +899,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)) ) ) ) @@ -1096,7 +1083,7 @@ (add-debug-line #t (bucket-id debug-no-zbuf1) - (the-as vector (-> gp-0 seg vertex)) + (-> gp-0 seg vertex 0) (-> gp-0 seg vertex 1) *color-blue* #f @@ -1189,7 +1176,7 @@ (add-debug-line #t (bucket-id debug-no-zbuf1) - (the-as vector (-> gp-0 seg vertex)) + (-> gp-0 seg vertex 0) (-> gp-0 seg vertex 1) *color-blue* #f @@ -1447,11 +1434,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/goal_src/jak2/levels/city/traffic/citizen/civilian.gc b/goal_src/jak2/levels/city/traffic/citizen/civilian.gc index 90c7c1b79e..969cf6ce39 100644 --- a/goal_src/jak2/levels/city/traffic/citizen/civilian.gc +++ b/goal_src/jak2/levels/city/traffic/citizen/civilian.gc @@ -554,7 +554,6 @@ ) (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-! @@ -577,67 +576,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) ) ) ) @@ -765,7 +757,6 @@ ) (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)) @@ -782,41 +773,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* @@ -1717,7 +1702,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)) @@ -1748,24 +1732,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) @@ -1933,7 +1908,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)) @@ -1991,24 +1965,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/goal_src/jak2/levels/city/traffic/citizen/guard.gc b/goal_src/jak2/levels/city/traffic/citizen/guard.gc index 08430020a2..19251e0692 100644 --- a/goal_src/jak2/levels/city/traffic/citizen/guard.gc +++ b/goal_src/jak2/levels/city/traffic/citizen/guard.gc @@ -314,14 +314,6 @@ (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) @@ -330,8 +322,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)) @@ -345,9 +338,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)) ) @@ -409,18 +402,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) @@ -1643,11 +1633,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)) ) @@ -2554,7 +2542,6 @@ ;; 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) @@ -2573,8 +2560,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) @@ -2672,11 +2660,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) @@ -2687,7 +2676,7 @@ ) ) ) - (set! sv-640 (+ sv-640 1)) + (+! sv-640 1) ) ) ) @@ -2700,7 +2689,6 @@ ;; 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) @@ -2761,15 +2749,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) @@ -3102,14 +3089,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) @@ -3124,8 +3104,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)))) @@ -3154,59 +3134,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)) - ) - ;; og:preserve-this inlined vector-dot - ; (.mula.s f0-7 f3-2) - ; (.madda.s f1-4 f4-0) - ; (.madd.s f0-8 f2-2 f5-0) - (set! f0-8 (+ (* f0-7 f3-2) (* f1-4 f4-0) (* 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/goal_src/jak2/levels/city/traffic/citizen/metalhead-grunt.gc b/goal_src/jak2/levels/city/traffic/citizen/metalhead-grunt.gc index 829b143b2d..7e3ea4c703 100644 --- a/goal_src/jak2/levels/city/traffic/citizen/metalhead-grunt.gc +++ b/goal_src/jak2/levels/city/traffic/citizen/metalhead-grunt.gc @@ -254,7 +254,7 @@ (defmethod general-event-handler ((this metalhead-grunt) (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" + @TODO - unsure if there is a pattern for the events and this should have a more specific name" (case arg2 (('hit 'hit-knocked) (logclear! (-> this mask) (process-mask actor-pause)) @@ -281,11 +281,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) ) @@ -338,12 +334,7 @@ ) ) ) - (let* ((gp-1 *target*) - (a0-4 (if (type? gp-1 process-focusable) - gp-1 - ) - ) - ) + (let ((a0-4 (the-as target (as-type *target* process-focusable)))) (when a0-4 (let* ((gp-2 (-> self root)) (s3-0 (vector-normalize! (vector-! (new 'stack-no-clear 'vector) (get-trans a0-4 0) (-> gp-2 trans)) 1.0)) @@ -591,23 +582,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)) ) ) @@ -635,10 +621,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))) ) @@ -1169,11 +1152,11 @@ ) ;; WARN: Return type mismatch citizen-enemy vs metalhead-grunt. -(defmethod relocate ((this metalhead-grunt) (arg0 int)) +(defmethod relocate ((this metalhead-grunt) (offset int)) (if (nonzero? (-> this intro-path)) - (&+! (-> this intro-path) arg0) + (&+! (-> this intro-path) offset) ) - (the-as metalhead-grunt ((method-of-type citizen-enemy relocate) this arg0)) + (the-as metalhead-grunt ((method-of-type citizen-enemy relocate) this offset)) ) (defmethod init-enemy-collision! ((this metalhead-grunt)) diff --git a/goal_src/jak2/levels/city/traffic/citizen/metalhead-predator.gc b/goal_src/jak2/levels/city/traffic/citizen/metalhead-predator.gc index 6ea6a9fa0b..d78d172067 100644 --- a/goal_src/jak2/levels/city/traffic/citizen/metalhead-predator.gc +++ b/goal_src/jak2/levels/city/traffic/citizen/metalhead-predator.gc @@ -634,27 +634,22 @@ #t ) (else - (let ((s4-1 (-> s5-0 best-other-tri collide-ptr))) - (if (and (if (type? s4-1 collide-shape-prim) - s4-1 - ) - (< (vector-dot - (-> s5-0 best-other-tri normal) - (vector-! (new 'stack-no-clear 'vector) arg2 (the-as vector (-> s5-0 best-other-tri))) - ) - 0.0 + (if (and (the-as basic (as-type (-> s5-0 best-other-tri collide-ptr) collide-shape-prim)) + (< (vector-dot + (-> s5-0 best-other-tri normal) + (vector-! (new 'stack-no-clear 'vector) arg2 (the-as vector (-> s5-0 best-other-tri))) ) - ) - #f - ) - ) + 0.0 + ) + ) + #f + ) ) ) ) ) (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) @@ -686,23 +681,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))) @@ -726,11 +720,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/goal_src/jak2/levels/city/traffic/traffic-engine.gc b/goal_src/jak2/levels/city/traffic/traffic-engine.gc index fc9d421ef4..0747609d2f 100644 --- a/goal_src/jak2/levels/city/traffic/traffic-engine.gc +++ b/goal_src/jak2/levels/city/traffic/traffic-engine.gc @@ -40,15 +40,7 @@ (defmethod debug-draw ((this vis-cell)) (dotimes (s5-0 (-> this segment-count)) (let ((s4-0 (-> this segment-array s5-0))) - (add-debug-line - #t - (bucket-id debug2) - (the-as vector (-> s4-0 vertex)) - (-> s4-0 vertex 1) - *color-gray* - #f - (the-as rgba -1) - ) + (add-debug-line #t (bucket-id debug2) (-> s4-0 vertex 0) (-> s4-0 vertex 1) *color-gray* #f (the-as rgba -1)) (add-debug-x #t (bucket-id debug2) (-> s4-0 vertex 1) *color-red*) ) ) @@ -181,7 +173,7 @@ ) (defmethod debug-draw-grid ((this grid-info) (arg0 rgba)) - (draw-grid (the-as vector (-> this box)) (-> this box max) (-> this dimension-array) arg0) + (draw-grid (-> this box min) (-> this box max) (-> this dimension-array) arg0) 0 (none) ) @@ -550,13 +542,13 @@ (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)) @@ -598,14 +590,9 @@ (let ((v1-4 s2-0)) (set! (-> s4-0 vector 2 x) (* 1024.0 (the float (-> v1-4 speed-limit)))) ) - (vector-! (the-as vector (-> s4-0 vector)) (-> arg1 vertex 1) (the-as vector (-> arg1 vertex))) - (vector-normalize! (the-as vector (-> s4-0 vector)) 1.0) - (vector+float*! - (-> s4-0 params position) - (the-as vector (-> arg1 vertex)) - (the-as vector (-> s4-0 vector)) - arg2 - ) + (vector-! (-> s4-0 vector 0) (-> arg1 vertex 1) (-> arg1 vertex 0)) + (vector-normalize! (-> s4-0 vector 0) 1.0) + (vector+float*! (-> s4-0 params position) (-> arg1 vertex 0) (-> s4-0 vector 0) arg2) (let ((f0-6 (* (+ -0.5 (rand-vu)) (* 256.0 (the float (-> s2-0 width)))))) (+! (-> s4-0 params position x) (* -1.0 (-> s4-0 vector 0 z) f0-6)) (+! (-> s4-0 params position z) (* (-> s4-0 vector 0 x) f0-6)) @@ -614,8 +601,8 @@ (set! (-> s4-0 vector 2 y) (+ (/ (-> s4-0 vector 2 x) 2) (* (-> this rand) (-> this traffic inv-density-factor) (-> arg1 spawn-spacing))) ) - (vector-float*! (-> s4-0 params velocity) (the-as vector (-> s4-0 vector)) (-> s4-0 vector 2 x)) - (vector-float*! (-> s4-0 vector 1) (the-as vector (-> s4-0 vector)) (-> s4-0 vector 2 y)) + (vector-float*! (-> s4-0 params velocity) (-> s4-0 vector 0) (-> s4-0 vector 2 x)) + (vector-float*! (-> s4-0 vector 1) (-> s4-0 vector 0) (-> s4-0 vector 2 y)) (when (not (sphere-hash-method-32 (-> this object-hash) (-> s4-0 params position) (-> s4-0 vector 1) 20480.0 -1)) (set! (-> s4-0 params behavior) (the-as uint 2)) (set! (-> s4-0 params nav-mesh) #f) @@ -625,7 +612,7 @@ ) (forward-up-nopitch->quaternion (-> s4-0 params rotation) - (the-as vector (-> s4-0 vector)) + (-> s4-0 vector 0) (new 'static 'vector :y 1.0 :w 1.0) ) (set! (-> this rand) (rand-vu)) @@ -640,12 +627,12 @@ (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)) @@ -862,7 +849,7 @@ (let ((s3-0 0)) (dotimes (s2-0 (-> s4-0 segment-count)) (let ((s1-0 (-> s4-0 segment-array s2-0))) - (vector-vector-distance (the-as vector (-> s1-0 vertex)) (-> s1-0 vertex 1)) + (vector-vector-distance (-> s1-0 vertex 0) (-> s1-0 vertex 1)) (when (< (-> s1-0 spawn-spacing) 0.0) (inspect s1-0) #t @@ -1084,7 +1071,6 @@ ) (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))) @@ -1103,51 +1089,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)) ) ) ) @@ -1355,10 +1346,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) @@ -1377,10 +1367,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) @@ -1430,12 +1419,7 @@ ) ) (dotimes (s5-1 gp-1) - (let* ((s4-1 (-> s3-1 s5-1)) - (a0-52 (if (type? s4-1 citizen) - s4-1 - ) - ) - ) + (let ((a0-52 (the-as collide-shape (as-type (-> s3-1 s5-1) citizen)))) (if a0-52 (send-event (the-as process-tree a0-52) 'clear-path s2-1) ) @@ -1465,12 +1449,7 @@ (set! (-> a1-0 r) (-> s4-0 notify-radius)) (let ((s2-0 (fill-actor-list-for-sphere (-> this object-hash) a1-0 s3-0 40))) (dotimes (s1-0 s2-0) - (let* ((s0-0 (-> s3-0 s1-0)) - (a0-6 (if (type? s0-0 citizen) - s0-0 - ) - ) - ) + (let ((a0-6 (the-as collide-shape (as-type (-> s3-0 s1-0) citizen)))) (if a0-6 (send-event (the-as process-tree a0-6) @@ -1544,12 +1523,7 @@ "Kill everything in the sphere with a traffic-off-force." (let ((gp-0 (new 'stack-no-clear 'array 'collide-shape 64))) (countdown (s5-0 (fill-actor-list-for-sphere *actor-hash* arg0 gp-0 64)) - (let* ((s4-0 (-> gp-0 s5-0)) - (v1-3 (if (type? s4-0 collide-shape) - s4-0 - ) - ) - ) + (let ((v1-3 (as-type (-> gp-0 s5-0) collide-shape))) (if v1-3 (send-event (-> v1-3 process) 'traffic-off-force) ) @@ -1562,7 +1536,6 @@ (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)) @@ -1679,20 +1652,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)) ) ) ) @@ -1799,7 +1774,7 @@ gp-0 (lambda ((arg0 traffic-find-segment-struct) (arg1 nav-segment)) (let ((v1-0 (new 'stack-no-clear 'vector))) - (vector-! v1-0 (-> arg1 vertex 1) (the-as vector (-> arg1 vertex))) + (vector-! v1-0 (-> arg1 vertex 1) (-> arg1 vertex 0)) (let ((a2-1 v1-0) (a3-1 v1-0) (f0-0 (-> arg1 length)) @@ -2035,12 +2010,7 @@ (while (!= v1-4 (-> *collide-player-list* alive-list-end)) (let ((v1-5 (the-as collide-shape (-> (the-as connection v1-4) param1)))) (when (logtest? arg1 (-> v1-5 root-prim prim-core collide-as)) - (let* ((s1-0 (-> v1-5 process)) - (s2-0 (if (type? s1-0 process-focusable) - (the-as process-focusable s1-0) - ) - ) - ) + (let ((s2-0 (as-type (-> v1-5 process) process-focusable))) (when (and s2-0 (not (focus-test? s2-0 disable dead inactive)) (!= arg0 s2-0)) (let ((f0-0 (vector-vector-xz-distance (-> arg0 root trans) (-> s2-0 root trans)))) (when (or (not gp-0) (< f0-0 f30-0)) @@ -2067,12 +2037,7 @@ (while (!= v1-22 (-> *collide-hit-by-player-list* alive-list-end)) (let ((v1-23 (the-as collide-shape (-> (the-as connection v1-22) param1)))) (when (logtest? arg1 (-> v1-23 root-prim prim-core collide-as)) - (let* ((s1-1 (-> v1-23 process)) - (s2-1 (if (type? s1-1 process-focusable) - (the-as process-focusable s1-1) - ) - ) - ) + (let ((s2-1 (as-type (-> v1-23 process) process-focusable))) (when (and s2-1 (not (focus-test? s2-1 disable dead inactive)) (!= arg0 s2-1)) (let ((f0-1 (vector-vector-xz-distance (-> arg0 root trans) (-> s2-1 root trans)))) (when (or (not gp-0) (< f0-1 f30-0)) @@ -2098,12 +2063,7 @@ (while (!= v1-38 (-> *collide-hit-by-others-list* alive-list-end)) (let ((v1-39 (the-as collide-shape (-> (the-as connection v1-38) param1)))) (when (logtest? arg1 (-> v1-39 root-prim prim-core collide-as)) - (let* ((s1-2 (-> v1-39 process)) - (s2-2 (if (type? s1-2 process-focusable) - (the-as process-focusable s1-2) - ) - ) - ) + (let ((s2-2 (as-type (-> v1-39 process) process-focusable))) (when (and s2-2 (not (focus-test? s2-2 disable dead inactive)) (!= arg0 s2-2)) (let ((f0-2 (vector-vector-xz-distance (-> arg0 root trans) (-> s2-2 root trans)))) (when (or (not gp-0) (< f0-2 f30-0)) @@ -2129,13 +2089,6 @@ ) (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))) @@ -2178,71 +2131,75 @@ (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) - ;; og:preserve-this kinda hacky, was ps2 weird infinity. - (set! sv-216 100000000000000000.0) - (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)) + ;; og:preserve-this kinda hacky, was ps2 weird infinity. + (let ((sv-216 100000000000000000.0)) + (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)) ) ) ) @@ -2591,11 +2548,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) @@ -3275,56 +3231,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 (the-as vector (-> s3-0 vertex)) (-> 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) @@ -3342,7 +3289,7 @@ (dotimes (s3-0 16) (let ((s2-0 (-> arg0 suppressor array s3-0))) (when (logtest? (-> s2-0 flags) (traffic-suppression-box-flags in-use)) - (lookup-cell-for-point (-> this grid-info) (-> s4-0 1) (the-as vector (-> s2-0 bbox))) + (lookup-cell-for-point (-> this grid-info) (-> s4-0 1) (-> s2-0 bbox min)) (lookup-cell-for-point (-> this grid-info) (-> s4-0 2) (-> s2-0 bbox max)) (set! (-> s4-0 0 y) (-> s4-0 1 y)) (countdown (v1-15 (+ (- 1 (-> s4-0 1 y)) (-> s4-0 2 y))) @@ -3418,25 +3365,20 @@ ) ) (let ((s5-0 (math-camera-pos)) - (f30-0 (meters 20)) - (f28-0 (meters 200)) - (f26-0 (meters 120)) + (f30-0 81920.0) + (f28-0 819200.0) + (f26-0 491520.0) ) (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))) ) @@ -3666,13 +3608,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)) @@ -3714,11 +3653,10 @@ ) (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)) @@ -3758,25 +3696,6 @@ ;; 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) @@ -3791,173 +3710,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 (the-as vector (-> s2-1 vertex)) (-> 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/goal_src/jak2/levels/city/traffic/vehicle/vehicle-control.gc b/goal_src/jak2/levels/city/traffic/vehicle/vehicle-control.gc index c4a9cd2ddd..4643b8dc86 100644 --- a/goal_src/jak2/levels/city/traffic/vehicle/vehicle-control.gc +++ b/goal_src/jak2/levels/city/traffic/vehicle/vehicle-control.gc @@ -218,13 +218,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)) @@ -280,22 +277,13 @@ (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)) ) ) ) (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) @@ -320,10 +308,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)) @@ -347,13 +336,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))) + ) ) ) ) @@ -387,11 +372,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)) @@ -406,12 +387,7 @@ (-> arg2 traffic-hash-id) ) ) - (let* ((s2-0 (the-as basic (-> s3-1 s4-1))) - (v1-70 (if (type? (the-as collide-shape s2-0) vehicle) - (the-as vehicle s2-0) - ) - ) - ) + (let ((v1-70 (as-type (-> s3-1 s4-1) vehicle))) (when (and v1-70 (not (logtest? (-> v1-70 flags) (rigid-body-object-flag dead))) (nonzero? (-> v1-70 flight-level-index)) @@ -429,9 +405,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)) @@ -478,18 +452,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/goal_src/jak2/levels/city/traffic/vehicle/vehicle-effects.gc b/goal_src/jak2/levels/city/traffic/vehicle/vehicle-effects.gc index a25f1de5c9..e38fb7fab0 100644 --- a/goal_src/jak2/levels/city/traffic/vehicle/vehicle-effects.gc +++ b/goal_src/jak2/levels/city/traffic/vehicle/vehicle-effects.gc @@ -65,9 +65,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) @@ -309,7 +307,6 @@ ) (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)))) @@ -381,20 +378,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) ) ) ) @@ -436,10 +429,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)) ) @@ -490,74 +480,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/goal_src/jak2/levels/city/traffic/vehicle/vehicle-guard.gc b/goal_src/jak2/levels/city/traffic/vehicle/vehicle-guard.gc index 8f79fd0dc8..4c327e7712 100644 --- a/goal_src/jak2/levels/city/traffic/vehicle/vehicle-guard.gc +++ b/goal_src/jak2/levels/city/traffic/vehicle/vehicle-guard.gc @@ -381,12 +381,7 @@ (vector+! (-> gp-0 vec-2) (-> s3-2 start-pos) (-> s3-2 move-dist)) ) (else - (let* ((s4-1 (-> s3-2 best-other-tri collide-ptr)) - (a0-43 (if (type? s4-1 collide-shape-prim) - s4-1 - ) - ) - ) + (let ((a0-43 (the-as basic (as-type (-> s3-2 best-other-tri collide-ptr) collide-shape-prim)))) (if (and a0-43 (logtest? (-> (the-as collide-shape-prim a0-43) prim-core collide-as) (collide-spec jak))) (set! s5-1 #t) ) @@ -490,7 +485,7 @@ (set! (-> v1-16 trans quad) a3-1) ) (dotimes (s3-0 (-> this info barrel-count)) - (vector-matrix*! (-> s4-0 vec-1) (the-as vector (-> this info barrel-array s3-0)) (-> s4-0 mat-1)) + (vector-matrix*! (-> s4-0 vec-1) (-> this info barrel-array s3-0 local-pos) (-> s4-0 mat-1)) (set! (-> s4-0 vec-2 quad) (-> s4-0 mat-1 vector 2 quad)) (set! (-> s4-0 proj-params pos quad) (-> s4-0 vec-1 quad)) (vector-float*! (-> s4-0 proj-params vel) (-> s4-0 vec-2) (-> this info shot-speed)) @@ -651,10 +646,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) ) ) @@ -1021,11 +1016,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) ) @@ -1211,10 +1202,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/goal_src/jak2/levels/city/traffic/vehicle/vehicle-physics.gc b/goal_src/jak2/levels/city/traffic/vehicle/vehicle-physics.gc index dcfa43d156..496df98dc2 100644 --- a/goal_src/jak2/levels/city/traffic/vehicle/vehicle-physics.gc +++ b/goal_src/jak2/levels/city/traffic/vehicle/vehicle-physics.gc @@ -36,13 +36,10 @@ (a1-1 (-> s4-0 local-pos)) (a2-0 (-> s4-0 normal)) ) - (rigid-body-method-22 (-> v1-18 state) (the-as vector a1-1) a2-0) + (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,17 +48,20 @@ (a1-3 (-> s4-0 local-pos)) (a2-1 (-> s4-0 local-pos 1)) ) - (rigid-body-method-18 (-> v1-34 state) (the-as vector a1-3) a2-1) + (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)) + ) + ) ) ) ) @@ -69,7 +69,7 @@ (a1-4 (-> s4-0 local-pos)) (a2-2 (-> s4-0 local-pos 1)) ) - (rigid-body-method-18 (-> v1-46 state) (the-as vector a1-4) a2-2) + (rigid-body-method-18 (-> v1-46 state) (-> a1-4 0) a2-2) ) ) ) @@ -158,14 +158,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)) @@ -471,7 +464,6 @@ ) (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)) @@ -482,41 +474,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)) + ) ) ) ) @@ -531,46 +524,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 ) ) ) @@ -779,16 +769,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/goal_src/jak2/levels/city/traffic/vehicle/vehicle-states.gc b/goal_src/jak2/levels/city/traffic/vehicle/vehicle-states.gc index 593b059fce..c7f9f4dd56 100644 --- a/goal_src/jak2/levels/city/traffic/vehicle/vehicle-states.gc +++ b/goal_src/jak2/levels/city/traffic/vehicle/vehicle-states.gc @@ -273,19 +273,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))) @@ -300,11 +295,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) @@ -320,11 +316,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/goal_src/jak2/levels/city/traffic/vehicle/vehicle-util.gc b/goal_src/jak2/levels/city/traffic/vehicle/vehicle-util.gc index 448196025f..e7e2ef81dc 100644 --- a/goal_src/jak2/levels/city/traffic/vehicle/vehicle-util.gc +++ b/goal_src/jak2/levels/city/traffic/vehicle/vehicle-util.gc @@ -178,187 +178,177 @@ (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)~%") + ) + ) ) ) ) @@ -1295,21 +1285,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) @@ -1325,11 +1308,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/goal_src/jak2/levels/city/traffic/vehicle/vehicle.gc b/goal_src/jak2/levels/city/traffic/vehicle/vehicle.gc index 1002017951..b1c86d41e4 100644 --- a/goal_src/jak2/levels/city/traffic/vehicle/vehicle.gc +++ b/goal_src/jak2/levels/city/traffic/vehicle/vehicle.gc @@ -167,10 +167,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)) @@ -269,7 +267,7 @@ ) ) (set! (-> s5-0 vector 0 w) 0.0) - (vehicle-method-95 this (the-as vector (-> s5-0 vector))) + (vehicle-method-95 this (-> s5-0 vector 0)) (when (= this *debug-actor*) (let ((v1-43 (-> s5-0 vector))) (format *stdcon* "steer ~f, throttle ~f, brake ~f~%" (-> v1-43 0 x) (-> v1-43 0 y) (-> v1-43 0 z)) @@ -323,11 +321,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)) ) ) @@ -449,9 +444,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)) ) @@ -647,18 +640,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) @@ -876,24 +863,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))) @@ -1062,27 +1041,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) ) ) @@ -1226,15 +1196,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 @@ -1471,7 +1437,7 @@ ) (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) @@ -1484,28 +1450,21 @@ ((logtest? (attack-mask attacker-velocity) (-> arg1 mask)) (set! (-> s5-0 vector 2 quad) (-> arg1 attacker-velocity quad)) ) - (else - (let ((s0-0 arg0)) - (cond - ((if (type? s0-0 process-focusable) - (the-as process-focusable s0-0) - ) - (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)) + ((as-type arg0 process-focusable) + (let ((sv-96 (-> s5-0 vector 2))) + (let ((s0-1 (-> s5-0 vector)) + (v1-7 (get-trans (the-as process-focusable arg0) 3)) ) - (.mov.vf.w vf6 vf0) - (.sub.vf.xyz vf6 vf4 vf5) - (.svf (&-> sv-96 quad) vf6) - ) - (else - (vector-! (-> s5-0 vector 2) (the-as vector (-> s5-0 vector)) (-> arg0 root trans)) - ) - ) - ) + (.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) + ) + ) + (else + (vector-! (-> s5-0 vector 2) (-> s5-0 vector 0) (-> arg0 root trans)) ) ) 0.0 @@ -1586,7 +1545,7 @@ (a1-11 (-> s5-0 vector)) (a2-3 s3-1) ) - (rigid-body-method-18 (-> v1-90 state) (the-as vector a1-11) a2-3) + (rigid-body-method-18 (-> v1-90 state) (-> a1-11 0) a2-3) ) (let ((v1-93 (-> this rbody)) (f0-10 1.0) @@ -1601,15 +1560,8 @@ (set! (-> *debug-vehicle-work* prim-sphere1 quad) (-> v1-103 prim1 cprim prim-core world-sphere quad)) (set! (-> *debug-vehicle-work* prim-sphere2 quad) (-> v1-103 prim2 cprim prim-core world-sphere quad)) ) - (add-debug-x #t (bucket-id debug-no-zbuf1) (the-as vector (-> s5-0 vector)) *color-blue*) - (add-debug-vector - #t - (bucket-id debug-no-zbuf1) - (the-as vector (-> s5-0 vector)) - s3-1 - (meters 0.00024414062) - *color-blue* - ) + (add-debug-x #t (bucket-id debug-no-zbuf1) (-> s5-0 vector 0) *color-blue*) + (add-debug-vector #t (bucket-id debug-no-zbuf1) (-> s5-0 vector 0) s3-1 (meters 0.00024414062) *color-blue*) ) ) (rigid-body-object-method-45 this (the-as rigid-body-impact s5-0)) @@ -1824,13 +1776,9 @@ ) ) (('pilot-on) - (let* ((s3-2 (-> arg3 param 0)) - (s2-2 arg0) - (s5-3 (if (type? s2-2 process-focusable) - s2-2 - ) - ) - ) + (let ((s3-2 (-> arg3 param 0)) + (s5-3 (the-as process-drawable (as-type arg0 process-focusable))) + ) (when s5-3 (format #t "vehicle::event-handler: pilot-on (pid ~d) from pid ~d~%" (-> this pid) (-> arg0 pid)) (logior! (-> this flags) (rigid-body-object-flag riding)) diff --git a/goal_src/jak2/levels/city/vinroom/vinroom-part.gc b/goal_src/jak2/levels/city/vinroom/vinroom-part.gc index d93637a319..dad44c78aa 100644 --- a/goal_src/jak2/levels/city/vinroom/vinroom-part.gc +++ b/goal_src/jak2/levels/city/vinroom/vinroom-part.gc @@ -2081,7 +2081,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/goal_src/jak2/levels/common/ai/ashelin/ash-shot.gc b/goal_src/jak2/levels/common/ai/ashelin/ash-shot.gc index f50d0c1e2c..44e91a1204 100644 --- a/goal_src/jak2/levels/common/ai/ashelin/ash-shot.gc +++ b/goal_src/jak2/levels/common/ai/ashelin/ash-shot.gc @@ -295,7 +295,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/goal_src/jak2/levels/common/ai/ashelin/ash.gc b/goal_src/jak2/levels/common/ai/ashelin/ash.gc index f0e1c83036..3b993c5660 100644 --- a/goal_src/jak2/levels/common/ai/ashelin/ash.gc +++ b/goal_src/jak2/levels/common/ai/ashelin/ash.gc @@ -263,12 +263,7 @@ ) (defmethod enemy-method-97 ((this ashelin)) - (let* ((s5-0 (handle->process (-> this attacker-handle))) - (v1-3 (if (type? s5-0 process-focusable) - s5-0 - ) - ) - ) + (let ((v1-3 (the-as process (as-type (handle->process (-> this attacker-handle)) process-focusable)))) (when v1-3 (cond ((= (-> v1-3 type) target) @@ -303,12 +298,7 @@ (empty) ) (else - (let ((s4-0 (handle->process (-> this poi-handle)))) - (set! s5-1 (if (type? s4-0 process-focusable) - s4-0 - ) - ) - ) + (set! s5-1 (the-as process (as-type (handle->process (-> this poi-handle)) process-focusable))) (if s5-1 (empty) (set! s5-1 *target*) @@ -322,12 +312,7 @@ (set! s5-1 v1-3) ) (else - (let ((s4-1 (handle->process (-> this poi-handle)))) - (set! s5-1 (if (type? s4-1 process-focusable) - s4-1 - ) - ) - ) + (set! s5-1 (the-as process (as-type (handle->process (-> this poi-handle)) process-focusable))) (cond (s5-1 (empty) @@ -1202,7 +1187,7 @@ ) (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) @@ -1228,11 +1213,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) @@ -1250,11 +1236,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)) ) ) ) @@ -1369,9 +1351,9 @@ (the int (+ 30.0 (* -100.0 (-> this offset)))) ) (set! (-> this sprites 0 angle) (* 182.04445 (the float (- 270 (/ (* 90 (-> this values 0 current)) 100))))) - (set-as-offset-from! (the-as hud-sprite (-> this sprites)) (the-as vector4w (-> this sprites 2)) 40 16) - (set-as-offset-from! (-> this sprites 1) (the-as vector4w (-> this sprites 2)) 1 16) - (set-as-offset-from! (-> this sprites 3) (the-as vector4w (-> this sprites 2)) 8 2) + (set-as-offset-from! (-> this sprites 0) (-> this sprites 2 pos) 40 16) + (set-as-offset-from! (-> this sprites 1) (-> this sprites 2 pos) 1 16) + (set-as-offset-from! (-> this sprites 3) (-> this sprites 2 pos) 8 2) ((method-of-type hud draw) this) 0 (none) diff --git a/goal_src/jak2/levels/common/ai/bot-h.gc b/goal_src/jak2/levels/common/ai/bot-h.gc index f4731fe963..465ed296f0 100644 --- a/goal_src/jak2/levels/common/ai/bot-h.gc +++ b/goal_src/jak2/levels/common/ai/bot-h.gc @@ -646,50 +646,50 @@ ;; 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/goal_src/jak2/levels/common/ai/bot.gc b/goal_src/jak2/levels/common/ai/bot.gc index 7eff8fe3ac..cf34930bf2 100644 --- a/goal_src/jak2/levels/common/ai/bot.gc +++ b/goal_src/jak2/levels/common/ai/bot.gc @@ -8,6 +8,7 @@ ;; DECOMP BEGINS (defmethod run-logic? ((this bot)) + "Should this process be run? Checked by execute-process-tree." #t ) @@ -32,10 +33,10 @@ (let* ((v1-5 (-> (the-as (pointer uint8) (&+ arg1 s0-0)))) (a1-2 (-> this course spots v1-5)) ) - (bot-debug-draw-sphere this (the-as vector a1-2) (if (= v1-5 arg2) - (the-as rgba s2-0) - (the-as rgba s1-0) - ) + (bot-debug-draw-sphere this (-> a1-2 center) (if (= v1-5 arg2) + (the-as rgba s2-0) + (the-as rgba s1-0) + ) ) ) ) @@ -48,7 +49,7 @@ (let ((course (-> this course))) (countdown (i (-> course spot-count)) (let ((spot (-> course spots i))) - (bot-debug-draw-sphere this (the-as vector spot) (the-as rgba (-> this spot-color))) + (bot-debug-draw-sphere this (-> spot center) (the-as rgba (-> this spot-color))) (format (clear *temp-string*) "~d" i) (let ((spot-id *temp-string*)) (add-debug-text-3d @@ -84,7 +85,7 @@ (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)))) ) ) @@ -118,12 +119,7 @@ ;; WARN: Return type mismatch symbol vs none. (defmethod reset-attacker! ((this bot)) (logclear! (-> this bot-flags) (bot-flags attacked)) - (let* ((s5-0 (handle->process (-> this attacker-handle))) - (v1-5 (if (type? s5-0 process-focusable) - s5-0 - ) - ) - ) + (let ((v1-5 (the-as process (as-type (handle->process (-> this attacker-handle)) process-focusable)))) (if (and v1-5 (= (-> v1-5 type) target)) (set! (-> this attacker-handle) (the-as handle #f)) ) @@ -205,14 +201,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)) ) ) ) @@ -246,14 +238,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)) ) ) ) @@ -269,12 +257,7 @@ (dotimes (s3-0 *actor-list-length*) (let ((v1-26 (-> *actor-list* s3-0))) (when (logtest? (the-as collide-spec s4-0) (-> v1-26 root-prim prim-core collide-as)) - (let* ((s2-0 (-> v1-26 process)) - (a1-26 (if (type? s2-0 process-focusable) - s2-0 - ) - ) - ) + (let ((a1-26 (the-as process-drawable (as-type (-> v1-26 process) process-focusable)))) (when a1-26 (set-next-focus! this (the-as enemy a1-26) (the-as enemy-best-focus (&-> s5-0 next))) (if (-> s5-0 next) @@ -300,12 +283,7 @@ (t9-0 this arg0 arg1 arg2 arg3) ) (logclear! (-> this bot-flags) (bot-flags bf03 bf04)) - (let* ((s3-0 (handle->process (-> this incoming attacker-handle))) - (s5-0 (if (type? s3-0 process-focusable) - s3-0 - ) - ) - ) + (let ((s5-0 (the-as process (as-type (handle->process (-> this incoming attacker-handle)) process-focusable)))) (when s5-0 (cond ((= (-> s5-0 type) target) @@ -386,23 +364,12 @@ (defmethod clear-poi-and-focus! ((this bot)) "Clear our point of interest and focus handles." - (let* ((s4-0 (handle->process (-> this poi-handle))) - (s5-0 (if (type? s4-0 process-focusable) - s4-0 - ) - ) - ) + (let ((s5-0 (the-as process (as-type (handle->process (-> this poi-handle)) process-focusable)))) (when s5-0 (set! (-> this poi-handle) (the-as handle #f)) - (let ((s4-1 (handle->process (-> this focus handle)))) - (if (= (if (type? s4-1 process-focusable) - s4-1 - ) - s5-0 - ) - (clear-focused (-> this focus)) - ) - ) + (if (= (the-as process (as-type (handle->process (-> this focus handle)) process-focusable)) s5-0) + (clear-focused (-> this focus)) + ) ) ) (none) @@ -424,8 +391,8 @@ ;; WARN: Return type mismatch int vs enemy-aware. (defmethod update-target-awareness! ((this bot) (arg0 process-focusable) (arg1 enemy-best-focus)) "Checks a variety of criteria to determine the level of awareness the enemy is of the target. Sets `aware` and related fields as well! -@TODO - flesh out docs -@returns the value that sets `aware`" + @TODO - flesh out docs + @returns the value that sets `aware`" (the-as enemy-aware 3) ) @@ -465,12 +432,7 @@ ) (defmethod enemy-method-97 ((this bot)) - (let* ((s5-0 (handle->process (-> this attacker-handle))) - (v1-3 (if (type? s5-0 process-focusable) - s5-0 - ) - ) - ) + (let ((v1-3 (the-as process (as-type (handle->process (-> this attacker-handle)) process-focusable)))) (when v1-3 (cond ((= (-> v1-3 type) target) @@ -505,12 +467,7 @@ (empty) ) (else - (let ((s4-0 (handle->process (-> this poi-handle)))) - (set! s5-1 (if (type? s4-0 process-focusable) - s4-0 - ) - ) - ) + (set! s5-1 (the-as process (as-type (handle->process (-> this poi-handle)) process-focusable))) (if s5-1 (empty) (set! s5-1 *target*) @@ -524,12 +481,7 @@ (set! s5-1 v1-3) ) (else - (let ((s4-1 (handle->process (-> this poi-handle)))) - (set! s5-1 (if (type? s4-1 process-focusable) - s4-1 - ) - ) - ) + (set! s5-1 (the-as process (as-type (handle->process (-> this poi-handle)) process-focusable))) (cond (s5-1 (empty) @@ -608,14 +560,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)) ) ) ) @@ -649,14 +597,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)) ) ) ) @@ -672,12 +616,7 @@ (dotimes (i *actor-list-length*) (let ((actor (-> *actor-list* i))) (when (logtest? (the-as int coll-spec) (-> actor root-prim prim-core collide-as)) - (let* ((proc (-> actor process)) - (enemy (if (type? proc process-focusable) - proc - ) - ) - ) + (let ((enemy (the-as process-drawable (as-type (-> actor process) process-focusable)))) (if (and enemy enemy (not (logtest? (-> (the-as process-focusable enemy) focus-status) (focus-status disable dead))) @@ -719,7 +658,7 @@ ;; WARN: disable def twice: 280. This may happen when a cond (no else) is nested inside of another conditional, but it should be rare. (defmethod general-event-handler ((this bot) (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" + @TODO - unsure if there is a pattern for the events and this should have a more specific name" (local-vars (v0-0 object)) (case arg2 (('track) @@ -834,13 +773,9 @@ (('notify) (case (-> arg3 param 0) (('attack) - (let ((s5-2 (-> arg3 param 1))) - (when (if (type? s5-2 process-focusable) - s5-2 - ) - (logior! (-> this enemy-flags) (enemy-flag victory)) - (set-time! (-> this hit-focus-time)) - ) + (when (the-as uint (as-type (-> arg3 param 1) process-focusable)) + (logior! (-> this enemy-flags) (enemy-flag victory)) + (set-time! (-> this hit-focus-time)) ) #t ) @@ -961,13 +896,9 @@ ) (else (when (!= (-> arg0 type) target) - (let* ((touch-entry (-> arg1 param 0)) - (s2-0 arg0) - (v1-6 (if (type? s2-0 process-focusable) - s2-0 - ) - ) - ) + (let ((touch-entry (-> arg1 param 0)) + (v1-6 (the-as process (as-type arg0 process-focusable))) + ) (cond ((and (focus-test? this dangerous) (logtest? (process-mask enemy) (-> arg0 mask)) @@ -1048,7 +979,7 @@ ;; WARN: Using new Jak 2 rtype-of (defmethod bot-check-too-far ((this bot)) "Call the current [[bot-waypoint]]'s `check-too-far` function if available, otherwise use the default `course` one. -If the player is too far, play a warning speech." + If the player is too far, play a warning speech." (let ((result 0)) (let ((too-far-check (-> this delay-too-far-check))) (cond @@ -1115,9 +1046,9 @@ If the player is too far, play a warning speech." (defmethod common-post ((this bot)) "Does a lot of various things relating to interacting with the target -- tracks when the enemy was last drawn -- looks at the target and handles attacking -@TODO Not extremely well understood yet" + - tracks when the enemy was last drawn + - looks at the target and handles attacking + @TODO Not extremely well understood yet" (set! (-> this travel-prev-ry) (-> this travel-prev-ry1)) (set! (-> this travel-prev-ry1) (quaternion-y-angle (-> this root quat))) (let ((f0-4 (/ (the float (-> this hit-points)) (the float (-> this enemy-info default-hit-points))))) @@ -1370,20 +1301,21 @@ If the player is too far, play a warning speech." ) ;; WARN: Return type mismatch nav-enemy vs bot. -(defmethod relocate ((this bot) (arg0 int)) +(defmethod relocate ((this bot) (offset int)) (if (nonzero? (-> this ai-ctrl)) - (&+! (-> this ai-ctrl) arg0) + (&+! (-> this ai-ctrl) offset) ) (if (nonzero? (-> this task)) - (&+! (-> this task) arg0) + (&+! (-> this task) offset) ) (if (nonzero? (-> this swivel-joint-mod)) - (&+! (-> this swivel-joint-mod) arg0) + (&+! (-> this swivel-joint-mod) offset) ) - (the-as bot ((method-of-type nav-enemy relocate) this arg0)) + (the-as bot ((method-of-type nav-enemy relocate) this offset)) ) (defmethod deactivate ((this bot)) + "Make a process dead, clean it up, remove it from the active pool, and return to dead pool." (send-event (handle->process (-> this health-handle)) 'hide-and-die) (if (nonzero? (-> this ai-ctrl)) (ai-task-control-method-9 (-> this ai-ctrl)) @@ -1609,9 +1541,8 @@ If the player is too far, play a warning speech." (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/goal_src/jak2/levels/common/ai/sig/sig-shot.gc b/goal_src/jak2/levels/common/ai/sig/sig-shot.gc index 57719da59d..7daa86d028 100644 --- a/goal_src/jak2/levels/common/ai/sig/sig-shot.gc +++ b/goal_src/jak2/levels/common/ai/sig/sig-shot.gc @@ -295,7 +295,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/goal_src/jak2/levels/common/ai/sig/sig.gc b/goal_src/jak2/levels/common/ai/sig/sig.gc index cebd263fa4..68fa3276b1 100644 --- a/goal_src/jak2/levels/common/ai/sig/sig.gc +++ b/goal_src/jak2/levels/common/ai/sig/sig.gc @@ -1280,14 +1280,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)) ) ) ) @@ -1321,14 +1317,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/goal_src/jak2/levels/common/battle.gc b/goal_src/jak2/levels/common/battle.gc index f1dc08e912..37af4b8bd9 100644 --- a/goal_src/jak2/levels/common/battle.gc +++ b/goal_src/jak2/levels/common/battle.gc @@ -791,7 +791,6 @@ ) (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))) ) @@ -837,13 +836,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) @@ -872,7 +865,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)) @@ -899,14 +892,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)) ) ) ) @@ -940,14 +929,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)) ) ) ) @@ -978,7 +963,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) ) ) @@ -1145,11 +1130,7 @@ ) (defmethod get-spawner-for-enemy ((this battle) (arg0 process)) - (let ((v1-0 (if (type? arg0 nav-enemy) - (the-as nav-enemy arg0) - ) - ) - ) + (let ((v1-0 (as-type arg0 nav-enemy))) (when v1-0 (dotimes (a0-3 (-> this spawners length)) (let* ((a1-5 (-> this spawners data a0-3)) @@ -1561,32 +1542,32 @@ (none) ) -(defmethod relocate ((this battle-spawner-array) (arg0 int)) +(defmethod relocate ((this battle-spawner-array) (offset int)) (dotimes (v1-0 (-> this length)) (let ((a2-3 (-> this data v1-0))) - (&+! (-> a2-3 breeds) arg0) + (&+! (-> a2-3 breeds) offset) (if (-> a2-3 intro-path) - (&+! (-> a2-3 intro-path) arg0) + (&+! (-> a2-3 intro-path) offset) ) ) ) this ) -(defmethod relocate ((this battle) (arg0 int)) - (&+! (-> this spawners) arg0) - (&+! (-> this allies) arg0) - (call-parent-method this arg0) +(defmethod relocate ((this battle) (offset int)) + (&+! (-> this spawners) offset) + (&+! (-> this allies) offset) + (call-parent-method this offset) ) (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 @@ -1619,8 +1600,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) @@ -1715,9 +1697,10 @@ ) (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)) @@ -1727,33 +1710,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)) + ) ) ) ) @@ -1828,11 +1812,11 @@ (defmethod init-from-entity! ((this battle) (arg0 entity-actor)) "Typically the method that does the initial setup on the process, potentially using the [[entity-actor]] provided as part of that. -This commonly includes things such as: -- stack size -- collision information -- loading the skeleton group / bones -- sounds" + This commonly includes things such as: + - stack size + - collision information + - loading the skeleton group / bones + - sounds" (logior! (-> this mask) (process-mask enemy)) (let ((s4-0 (new 'process 'trsqv))) (set! (-> this root) s4-0) diff --git a/goal_src/jak2/levels/common/elec-gate.gc b/goal_src/jak2/levels/common/elec-gate.gc index 1c6cfb993c..2870e05bc2 100644 --- a/goal_src/jak2/levels/common/elec-gate.gc +++ b/goal_src/jak2/levels/common/elec-gate.gc @@ -112,17 +112,16 @@ ) (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) ) @@ -141,13 +140,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) ) ) ) @@ -326,28 +326,10 @@ ) ) :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* ((target *target*) - (proc-focus (if (type? target process-focusable) - target - ) - ) - ) + (let ((proc-focus (the-as target (as-type *target* process-focusable)))) (when proc-focus (let ((focus-trans (get-trans proc-focus 0))) - (let* ((a0-3 (vector-! (new 'stack-no-clear 'vector) focus-trans (the-as vector (-> self dividing-wall)))) + (let* ((a0-3 (vector-! (new 'stack-no-clear 'vector) focus-trans (-> self dividing-wall pos))) (s4-0 (-> self plane (if (< 0.0 (vector-dot a0-3 (-> self dividing-wall dir))) 0 1 @@ -385,73 +367,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* ) ) ) @@ -701,7 +637,7 @@ (defmethod set-elec-scale-if-close! ((this elec-gate) (arg0 float)) "If [[target]]'s position is within `80` [[meters]], set the scale to the value provided -@see [[elec-gate::29]]" + @see [[elec-gate::29]]" ;; og:preserve-this changed for PC port so we can render it at any distance (if (#if PC_PORT (or (not (-> *pc-settings* ps2-lod-dist?)) (< (vector-vector-distance (-> this root trans) (target-pos 0)) (meters 80))) (< (vector-vector-distance (-> this root trans) (target-pos 0)) (meters 80))) @@ -714,10 +650,10 @@ (defmethod spawn-particles ((this elec-gate) (sparticle-lc sparticle-launch-control)) "TODO - Calls [[sparticle-launch-control::11]] on `part-spawner-left` and `part-spawner-right` if they are defined" (if (-> this part-spawner-left) - (spawn sparticle-lc (the-as vector (&-> (-> this part-spawner-left child) 8))) + (spawn sparticle-lc (the-as vector (&-> this part-spawner-left child 8))) ) (if (-> this part-spawner-right) - (spawn sparticle-lc (the-as vector (&-> (-> this part-spawner-right child) 8))) + (spawn sparticle-lc (the-as vector (&-> this part-spawner-right child 8))) ) 0 (none) @@ -830,10 +766,10 @@ (vector-cross! v1-28 v1-28 *up-vector*) (set! (-> this dividing-wall pos quad) (-> s5-3 quad)) (set! (-> this dividing-wall dir quad) (-> v1-28 quad)) - (vector+float*! (the-as vector (-> this plane)) s5-3 v1-28 12288.0) + (vector+float*! (-> this plane 0 pos) s5-3 v1-28 12288.0) (set! (-> (the-as vector (-> this plane 0 dir)) quad) (-> v1-28 quad)) (vector-float*! v1-28 v1-28 -1.0) - (vector+float*! (the-as vector (-> this plane 1)) s5-3 v1-28 12288.0) + (vector+float*! (-> this plane 1 pos) s5-3 v1-28 12288.0) (set! (-> (the-as vector (-> this plane 1 dir)) quad) (-> v1-28 quad)) ) (set! (-> this wall-xz) diff --git a/goal_src/jak2/levels/common/enemy/centurion.gc b/goal_src/jak2/levels/common/enemy/centurion.gc index 1a4a39f36c..ef0401c007 100644 --- a/goal_src/jak2/levels/common/enemy/centurion.gc +++ b/goal_src/jak2/levels/common/enemy/centurion.gc @@ -516,7 +516,6 @@ ) (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)) ) @@ -539,21 +538,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) ) @@ -1037,7 +1023,6 @@ ) (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)) @@ -1047,27 +1032,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/goal_src/jak2/levels/common/enemy/fodder/fodder.gc b/goal_src/jak2/levels/common/enemy/fodder/fodder.gc index 65d3a8e7aa..25897fb373 100644 --- a/goal_src/jak2/levels/common/enemy/fodder/fodder.gc +++ b/goal_src/jak2/levels/common/enemy/fodder/fodder.gc @@ -201,7 +201,7 @@ (defmethod look-at-target! ((this fodder) (arg0 enemy-flag)) "Logic for looking at the target that is locked on, sets some flags and adjusts the neck to look at the target if available -@param flag Reacts to [[enemy-flag::death-start]] and [[enemy-flag::enable-on-active]], see implementation for details" + @param flag Reacts to [[enemy-flag::death-start]] and [[enemy-flag::enable-on-active]], see implementation for details" (let ((parent-method (method-of-type nav-enemy look-at-target!))) (parent-method this arg0) ) @@ -232,8 +232,8 @@ (defmethod look-at-position! ((this fodder) (position vector)) "Adjusts the eyes to look at particular position, or the focused target -@param position If this is provided, it will be used with [[joint-mod::target-set!]] to adjust the eyes, otherwise the `focus` position is used -@return TODO - unsure what the return value is, but it seems to make the eyes more lazy" + @param position If this is provided, it will be used with [[joint-mod::target-set!]] to adjust the eyes, otherwise the `focus` position is used + @return TODO - unsure what the return value is, but it seems to make the eyes more lazy" (when (not position) (let ((focus-proc (handle->process (-> this focus handle)))) (if focus-proc @@ -264,12 +264,7 @@ (dotimes (group-idx (-> this actor-group-count)) (let ((group (-> this actor-group group-idx))) (dotimes (actor-idx (-> group length)) - (let* ((actor-proc (-> group data actor-idx actor extra process)) - (fodder-proc (if (type? actor-proc fodder) - (the-as fodder actor-proc) - ) - ) - ) + (let ((fodder-proc (as-type (-> group data actor-idx actor extra process) fodder))) (when (and fodder-proc (!= fodder-proc this) (time-elapsed? (-> fodder-proc look-at-other-time) (seconds 0.25))) (let* ((dir-to-other-fodder (vector-! (new 'stack-no-clear 'vector) (-> fodder-proc root trans) (-> this root trans)) @@ -317,24 +312,16 @@ ;; WARN: Return type mismatch object vs none. (defmethod common-post ((this fodder)) "Does a lot of various things relating to interacting with the target -- tracks when the enemy was last drawn -- looks at the target and handles attacking -@TODO Not extremely well understood yet" + - tracks when the enemy was last drawn + - looks at the target and handles attacking + @TODO Not extremely well understood yet" (let ((parent-method (method-of-type nav-enemy common-post))) (parent-method this) ) (let ((proc (the-as process-drawable #f))) (cond ((and (not (time-elapsed? (-> this look-at-other-time) (seconds 0.5))) - (begin - (let ((other-proc (handle->process (-> this look-at-other)))) - (set! proc (if (type? other-proc process-drawable) - (the-as process-drawable other-proc) - ) - ) - ) - proc - ) + (begin (set! proc (as-type (handle->process (-> this look-at-other)) process-drawable)) proc) ) (let ((s5-1 (vector<-cspace! (new 'static 'vector) (-> proc node-list data 5)))) (look-at-position! this s5-1) @@ -496,7 +483,7 @@ (if s4-0 (set! v1-59 (- v1-59)) ) - (vector+float*! gp-0 (-> s3-2 vector 2) (the-as vector (-> s3-2 vector)) v1-59) + (vector+float*! gp-0 (-> s3-2 vector 2) (-> s3-2 vector 0) v1-59) ) (vector-normalize! gp-0 16384.0) (vector+float*! gp-0 gp-0 (-> s3-2 vector 1) (rand-vu-float-range 5079.04 7168.0)) @@ -609,32 +596,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)) @@ -740,20 +725,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)) ) ) ) @@ -1026,14 +1009,14 @@ (none) ) -(defmethod relocate ((this fodder) (arg0 int)) +(defmethod relocate ((this fodder) (offset int)) (if (nonzero? (-> this left-eye)) - (&+! (-> this left-eye) arg0) + (&+! (-> this left-eye) offset) ) (if (nonzero? (-> this right-eye)) - (&+! (-> this right-eye) arg0) + (&+! (-> this right-eye) offset) ) - (call-parent-method this arg0) + (call-parent-method this offset) ) (defun fodder-setup-eye-control ((arg0 joint-mod)) diff --git a/goal_src/jak2/levels/common/enemy/grunt.gc b/goal_src/jak2/levels/common/enemy/grunt.gc index 50c785cc14..e5e185b2e2 100644 --- a/goal_src/jak2/levels/common/enemy/grunt.gc +++ b/goal_src/jak2/levels/common/enemy/grunt.gc @@ -358,11 +358,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) ) @@ -415,12 +411,7 @@ ) ) ) - (let* ((gp-1 *target*) - (a0-4 (if (type? gp-1 process-focusable) - gp-1 - ) - ) - ) + (let ((a0-4 (the-as target (as-type *target* process-focusable)))) (when a0-4 (let* ((gp-2 (-> self root)) (s3-0 (vector-normalize! (vector-! (new 'stack-no-clear 'vector) (get-trans a0-4 0) (-> gp-2 trans)) 1.0)) @@ -450,7 +441,8 @@ ) ) :code (behavior () - (suspend-for (seconds 0.2)) + (suspend-for (seconds 0.2) + ) (let ((v1-6 (-> self root root-prim))) (set! (-> v1-6 prim-core collide-as) (-> self root backup-collide-as)) (set! (-> v1-6 prim-core collide-with) (-> self root backup-collide-with)) @@ -688,23 +680,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)) ) ) @@ -732,10 +719,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/goal_src/jak2/levels/common/enemy/guards/crimson-guard-level.gc b/goal_src/jak2/levels/common/enemy/guards/crimson-guard-level.gc index 4989fc1ccd..cc45c934a3 100644 --- a/goal_src/jak2/levels/common/enemy/guards/crimson-guard-level.gc +++ b/goal_src/jak2/levels/common/enemy/guards/crimson-guard-level.gc @@ -1314,14 +1314,6 @@ ) (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) @@ -1330,8 +1322,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)) @@ -1345,9 +1338,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)) ) @@ -1409,18 +1402,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) @@ -2160,7 +2150,6 @@ ) (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) @@ -2210,29 +2199,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)) ) @@ -2258,44 +2249,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)) ) @@ -2322,7 +2315,6 @@ ;; 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) @@ -2385,15 +2377,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) @@ -3568,14 +3559,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) @@ -3590,8 +3574,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)))) @@ -3620,60 +3604,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)) - ) - ;; og:preserve-this inlined vector-dot - ;; (.mula.s f0-7 f3-2) - ;; (.madda.s f1-4 f4-0) - ;; (.madd.s f0-8 f2-2 f5-0) - (set! f0-8 (+ (* f0-7 f3-2) (* f1-4 f4-0) (* 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)) ) ) ) @@ -4034,14 +4011,14 @@ (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/goal_src/jak2/levels/common/enemy/guards/guard-conversation.gc b/goal_src/jak2/levels/common/enemy/guards/guard-conversation.gc index 70d917e82a..7c656cdfcc 100644 --- a/goal_src/jak2/levels/common/enemy/guards/guard-conversation.gc +++ b/goal_src/jak2/levels/common/enemy/guards/guard-conversation.gc @@ -355,12 +355,11 @@ ;; WARN: Return type mismatch object vs none. (defmethod init-from-entity! ((this guard-conversation) (arg0 entity-actor)) "Typically the method that does the initial setup on the process, potentially using the [[entity-actor]] provided as part of that. -This commonly includes things such as: -- stack size -- collision information -- loading the skeleton group / bones -- sounds" - (local-vars (sv-16 res-tag)) + This commonly includes things such as: + - stack size + - collision information + - loading the skeleton group / bones + - sounds" (set! (-> this triggered?) #f) (set! (-> this root) (new 'process 'trsqv)) (process-drawable-from-entity! this arg0) @@ -381,8 +380,9 @@ This commonly includes things such as: (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/goal_src/jak2/levels/common/enemy/hopper.gc b/goal_src/jak2/levels/common/enemy/hopper.gc index 9ebd2e90df..d25a136e52 100644 --- a/goal_src/jak2/levels/common/enemy/hopper.gc +++ b/goal_src/jak2/levels/common/enemy/hopper.gc @@ -478,7 +478,6 @@ ) (defmethod hopper-method-178 ((this hopper)) - (local-vars (sv-752 vector)) (rlet ((acc :class vf) (vf0 :class vf) (vf4 :class vf) @@ -530,28 +529,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)) ) @@ -660,6 +660,8 @@ ) (set! (-> self best-score) -2.0) (set! (-> self origin quad) (-> self root trans quad)) + ;; og:preserve-this + ; (b! #t cfg-17) (until (not (hopper-method-178 self)) (empty) ) diff --git a/goal_src/jak2/levels/common/enemy/hover/crimson-guard-hover.gc b/goal_src/jak2/levels/common/enemy/hover/crimson-guard-hover.gc index c457c9b1c0..2ba6dcef38 100644 --- a/goal_src/jak2/levels/common/enemy/hover/crimson-guard-hover.gc +++ b/goal_src/jak2/levels/common/enemy/hover/crimson-guard-hover.gc @@ -675,13 +675,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 ) @@ -858,13 +854,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!) @@ -1045,11 +1037,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)) ) @@ -1064,11 +1054,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)) ) @@ -1127,7 +1113,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))) @@ -1276,78 +1262,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 @@ -1641,7 +1621,6 @@ (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) @@ -1662,15 +1641,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)) @@ -1682,16 +1663,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/goal_src/jak2/levels/common/enemy/hover/hover-enemy-battle.gc b/goal_src/jak2/levels/common/enemy/hover/hover-enemy-battle.gc index f442d600b3..b97579d83a 100644 --- a/goal_src/jak2/levels/common/enemy/hover/hover-enemy-battle.gc +++ b/goal_src/jak2/levels/common/enemy/hover/hover-enemy-battle.gc @@ -180,13 +180,15 @@ (('wait) ) ) - (suspend-for (-> gp-0 s5-0 time)) + (suspend-for (-> gp-0 s5-0 time) + ) (while (< (-> gp-0 s5-0 alive-count) (-> self alive-count)) (suspend) ) ) ) - (suspend-for (seconds 2)) + (suspend-for (seconds 2) + ) (go-virtual die) ) :post hover-enemy-manager-post @@ -248,12 +250,12 @@ (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/goal_src/jak2/levels/common/enemy/hover/hover-enemy.gc b/goal_src/jak2/levels/common/enemy/hover/hover-enemy.gc index 880ebf36d7..a2279de128 100644 --- a/goal_src/jak2/levels/common/enemy/hover/hover-enemy.gc +++ b/goal_src/jak2/levels/common/enemy/hover/hover-enemy.gc @@ -9,7 +9,7 @@ (defmethod general-event-handler ((this hover-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" + @TODO - unsure if there is a pattern for the events and this should have a more specific name" (local-vars (v1-41 float)) (rlet ((acc :class vf) (vf0 :class vf) @@ -47,9 +47,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) @@ -175,12 +173,7 @@ (hover-formation-method-15 a0-2 gp-0 (-> self offset)) ) (else - (let* ((s5-0 (handle->process (-> self focus handle))) - (a0-7 (if (type? s5-0 process-focusable) - s5-0 - ) - ) - ) + (let ((a0-7 (the-as process (as-type (handle->process (-> self focus handle)) process-focusable)))) (cond (a0-7 (let* ((s5-1 (get-trans (the-as process-focusable a0-7) 3)) @@ -292,9 +285,9 @@ (defmethod common-post ((this hover-enemy)) "Does a lot of various things relating to interacting with the target -- tracks when the enemy was last drawn -- looks at the target and handles attacking -@TODO Not extremely well understood yet" + - tracks when the enemy was last drawn + - looks at the target and handles attacking + @TODO Not extremely well understood yet" (hover-enemy-method-148 this) (enemy-method-129 this) (let ((t9-2 (method-of-type enemy common-post))) @@ -456,16 +449,12 @@ (hover-enemy-method-141 self 1.0) ) ) - (let* ((gp-0 *target*) - (s1-0 (if (type? gp-0 process-focusable) - gp-0 - ) - ) - (gp-1 (new 'stack-no-clear 'vector)) - (s2-0 (new 'stack-no-clear 'vector)) - (s4-0 (-> self root)) - (s5-0 (get-point-at-percent-along-path! (-> self path) (new 'stack-no-clear 'vector) 0.0 'interp)) - ) + (let ((s1-0 (the-as target (as-type *target* process-focusable))) + (gp-1 (new 'stack-no-clear 'vector)) + (s2-0 (new 'stack-no-clear 'vector)) + (s4-0 (-> self root)) + (s5-0 (get-point-at-percent-along-path! (-> self path) (new 'stack-no-clear 'vector) 0.0 'interp)) + ) (let ((s0-0 (get-point-at-percent-along-path! (-> self path) (new 'stack-no-clear 'vector) 1.0 'interp)) (s3-1 (-> (the-as collide-shape-prim-group (-> self root root-prim)) @@ -893,17 +882,18 @@ ) (defmethod deactivate ((this hover-enemy)) + "Make a process dead, clean it up, remove it from the active pool, and return to dead pool." (hover-nav-control-method-9 (-> this hover)) ((method-of-type enemy deactivate) this) (none) ) ;; WARN: Return type mismatch enemy vs hover-enemy. -(defmethod relocate ((this hover-enemy) (arg0 int)) +(defmethod relocate ((this hover-enemy) (offset int)) (if (nonzero? (-> this hover)) - (&+! (-> this hover) arg0) + (&+! (-> this hover) offset) ) - (the-as hover-enemy ((method-of-type enemy relocate) this arg0)) + (the-as hover-enemy ((method-of-type enemy relocate) this offset)) ) (defmethod hover-enemy-method-155 ((this hover-enemy)) diff --git a/goal_src/jak2/levels/common/enemy/hover/hover-formation.gc b/goal_src/jak2/levels/common/enemy/hover/hover-formation.gc index e6780002cc..d621cc2a12 100644 --- a/goal_src/jak2/levels/common/enemy/hover/hover-formation.gc +++ b/goal_src/jak2/levels/common/enemy/hover/hover-formation.gc @@ -20,18 +20,10 @@ (defmethod hover-formation-control-method-16 ((this hover-formation-control)) (let ((gp-0 (hover-formation-control-method-13 this (new 'stack-no-clear 'vector))) - (s4-0 (cond - ((-> this anchor-proc) - (let ((s3-0 (handle->process (-> this anchor-proc)))) - (if (type? s3-0 process-focusable) - (the-as process-focusable s3-0) - ) - ) - ) - (else + (s4-0 (if (-> this anchor-proc) + (as-type (handle->process (-> this anchor-proc)) process-focusable) *target* ) - ) ) ) (and s4-0 @@ -62,18 +54,10 @@ ) ) ) - (s3-0 (cond - ((-> this anchor-proc) - (let ((s2-0 (handle->process (-> this anchor-proc)))) - (if (type? s2-0 process-focusable) - (the-as process-focusable s2-0) - ) - ) - ) - (else + (s3-0 (if (-> this anchor-proc) + (as-type (handle->process (-> this anchor-proc)) process-focusable) *target* ) - ) ) ) (cond @@ -114,18 +98,10 @@ ) ) ) - (a0-7 (cond - ((-> this anchor-proc) - (let ((s4-0 (handle->process (-> this anchor-proc)))) - (if (type? s4-0 process-focusable) - (the-as process-focusable s4-0) - ) - ) - ) - (else + (a0-7 (if (-> this anchor-proc) + (as-type (handle->process (-> this anchor-proc)) process-focusable) *target* ) - ) ) ) (cond @@ -205,7 +181,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) @@ -219,16 +194,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) @@ -288,18 +263,10 @@ (vector-rotate-y! arg0 arg1 arg2) (cond ((logtest? (-> this flags) 2) - (let ((s2-0 (cond - ((-> this anchor-proc) - (let ((s4-0 (handle->process (-> this anchor-proc)))) - (if (type? s4-0 process-focusable) - (the-as process-focusable s4-0) - ) - ) - ) - (else + (let ((s2-0 (if (-> this anchor-proc) + (as-type (handle->process (-> this anchor-proc)) process-focusable) *target* ) - ) ) (s4-1 (hover-formation-control-method-15 this (new 'stack-no-clear 'vector) arg0)) (s3-0 (new 'stack-no-clear 'vector)) @@ -376,12 +343,7 @@ (set! (-> s5-0 best-cost) -1.0) (set! (-> s5-0 count) 0) (dotimes (s4-0 16) - (let* ((s3-0 (handle->process (-> this actor-table s4-0))) - (a0-8 (if (type? s3-0 process-focusable) - (the-as process-focusable s3-0) - ) - ) - ) + (let ((a0-8 (as-type (handle->process (-> this actor-table s4-0)) process-focusable))) (cond (a0-8 (set! (-> s5-0 actor-position s4-0 quad) (-> (get-trans a0-8 3) quad)) @@ -645,14 +607,14 @@ ) ) -(defmethod relocate ((this hover-formation) (arg0 int)) +(defmethod relocate ((this hover-formation) (offset int)) (if (nonzero? (-> this formation)) - (&+! (-> this formation) arg0) + (&+! (-> this formation) offset) ) (if (nonzero? (-> this path)) - (&+! (-> this path) arg0) + (&+! (-> this path) offset) ) - (call-parent-method this arg0) + (call-parent-method this offset) ) (defmethod hover-formation-method-15 ((this hover-formation) (arg0 vector) (arg1 vector)) @@ -662,12 +624,11 @@ ;; WARN: Return type mismatch object vs none. (defmethod init-from-entity! ((this hover-formation) (arg0 entity-actor)) "Typically the method that does the initial setup on the process, potentially using the [[entity-actor]] provided as part of that. -This commonly includes things such as: -- stack size -- collision information -- loading the skeleton group / bones -- sounds" - (local-vars (sv-32 structure)) + This commonly includes things such as: + - stack size + - collision information + - loading the skeleton group / bones + - sounds" (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)) @@ -681,25 +642,29 @@ This commonly includes things such as: ) ) (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/goal_src/jak2/levels/common/enemy/hover/hover-nav-control.gc b/goal_src/jak2/levels/common/enemy/hover/hover-nav-control.gc index 5d926be0c0..17e3c5febe 100644 --- a/goal_src/jak2/levels/common/enemy/hover/hover-nav-control.gc +++ b/goal_src/jak2/levels/common/enemy/hover/hover-nav-control.gc @@ -788,7 +788,6 @@ ) (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) @@ -797,17 +796,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) @@ -879,12 +877,7 @@ (let ((v1-2 (the-as list-node (-> this sphere-list)))) (while v1-2 (let ((s5-0 (-> v1-2 next))) - (let* ((s3-0 (handle->process (-> (the-as hover-nav-sphere v1-2) handle))) - (s4-0 (if (type? s3-0 hover-enemy) - s3-0 - ) - ) - ) + (let ((s4-0 (the-as process (as-type (handle->process (-> (the-as hover-nav-sphere v1-2) handle)) hover-enemy)))) (when s4-0 (let ((a1-9 (new 'stack-no-clear 'event-message-block))) (set! (-> a1-9 from) (process->ppointer pp)) @@ -1012,67 +1005,62 @@ ) (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 - (the-as vector (hover-nav-control-method-17 this)) - (-> 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 - (the-as vector (hover-nav-control-method-17 this)) - (-> 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) ) ) ) @@ -1226,19 +1214,20 @@ ;; 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) ) (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))) + ) ) (defmethod hover-nav-control-method-10 ((this hover-nav-control) (arg0 vector) (arg1 vector) (arg2 vector)) @@ -1303,7 +1292,6 @@ ) (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 @@ -1339,7 +1327,7 @@ ) (hover-nav-control-method-28 this - (vector+! (new 'stack-no-clear 'vector) (the-as vector (hover-nav-control-method-17 this)) s4-0) + (vector+! (new 'stack-no-clear 'vector) (-> (hover-nav-control-method-17 this) world-sphere) s4-0) arg0 ) ) @@ -1362,33 +1350,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)) @@ -1402,7 +1389,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* @@ -1573,51 +1560,43 @@ ;; 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 (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) (the-as vector s3-0) (-> s5-0 trans))) + (v1-2 (vector-! (new 'stack-no-clear 'vector) (-> s3-0 world-sphere) (-> s5-0 trans))) (s4-1 (vector-! (new 'stack-no-clear 'vector) (-> this dest-pos) v1-2)) ) (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) (the-as vector s3-0) s2-0 (/ f0-4 f30-0))) - (s2-1 (nav-network-method-26 - (-> this nav) - (new 'stack-no-clear 'vector) - (-> this root process) - (the-as vector s3-0) - 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 #t (bucket-id debug-no-zbuf1) - (the-as vector s3-0) + (-> s3-0 world-sphere) (-> this nav-collide-impulse) (meters 0.00024414062) *color-red* diff --git a/goal_src/jak2/levels/common/enemy/hover/hover-nav-edit.gc b/goal_src/jak2/levels/common/enemy/hover/hover-nav-edit.gc index af89de6d11..3bce1dc862 100644 --- a/goal_src/jak2/levels/common/enemy/hover/hover-nav-edit.gc +++ b/goal_src/jak2/levels/common/enemy/hover/hover-nav-edit.gc @@ -120,16 +120,6 @@ ) (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))) ) ) ) @@ -336,7 +315,7 @@ (set! (-> v1-21 next) #f) ) (let ((a0-19 (-> this left point-list)) - (v1-25 (&-> (-> this left) point-list)) + (v1-25 (&-> this left point-list)) ) (when (zero? s3-1) (break!) @@ -386,7 +365,7 @@ ) (let ((v1-32 s3-1) (a1-40 (-> this right point-list)) - (a0-31 (&-> (-> this right) point-list)) + (a0-31 (&-> this right point-list)) ) (when (zero? v1-32) (break!) @@ -454,7 +433,7 @@ (-> (the-as (pointer uint128) (+ (the-as uint (-> s5-0 node-array data 0 position)) (* 80 s2-0)))) ) (let ((a1-7 (-> gp-0 root point-list)) - (a0-8 (&-> (-> gp-0 root) point-list)) + (a0-8 (&-> gp-0 root point-list)) ) (when (zero? v1-9) (break!) @@ -506,7 +485,7 @@ (set! (-> v1-3 index) (the-as int (-> arg0 s2-0 next))) (set! (-> v1-3 pos quad) (-> arg0 s2-0 pos quad)) (let ((a1-8 (-> gp-0 root point-list)) - (a0-11 (&-> (-> gp-0 root) point-list)) + (a0-11 (&-> gp-0 root point-list)) ) (when (zero? v1-3) (break!) diff --git a/goal_src/jak2/levels/common/enemy/hover/wasp.gc b/goal_src/jak2/levels/common/enemy/hover/wasp.gc index 732271cece..5da1b7ff58 100644 --- a/goal_src/jak2/levels/common/enemy/hover/wasp.gc +++ b/goal_src/jak2/levels/common/enemy/hover/wasp.gc @@ -1153,79 +1153,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) ) ) ) @@ -1431,7 +1425,6 @@ (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) @@ -1450,15 +1443,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)) @@ -1470,27 +1465,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/goal_src/jak2/levels/common/enemy/metalmonk.gc b/goal_src/jak2/levels/common/enemy/metalmonk.gc index 09016ee870..ebad9380a1 100644 --- a/goal_src/jak2/levels/common/enemy/metalmonk.gc +++ b/goal_src/jak2/levels/common/enemy/metalmonk.gc @@ -362,9 +362,9 @@ (defmethod common-post ((this metalmonk)) "Does a lot of various things relating to interacting with the target -- tracks when the enemy was last drawn -- looks at the target and handles attacking -@TODO Not extremely well understood yet" + - tracks when the enemy was last drawn + - looks at the target and handles attacking + @TODO Not extremely well understood yet" (let ((t9-0 (method-of-type nav-enemy common-post))) (t9-0 this) ) @@ -376,7 +376,7 @@ (defmethod general-event-handler ((this metalmonk) (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" + @TODO - unsure if there is a pattern for the events and this should have a more specific name" (case arg2 (('hit 'hit-knocked 'hit-flinch) (logclear! (-> this mask) (process-mask actor-pause)) @@ -403,11 +403,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) ) @@ -434,13 +430,9 @@ ) (defmethod enemy-method-104 ((this metalmonk) (arg0 process) (arg1 touching-shapes-entry) (arg2 uint)) - (let* ((s3-0 arg0) - (a0-2 (if (type? s3-0 process-focusable) - s3-0 - ) - ) - (s3-1 (new 'stack-no-clear 'vector)) - ) + (let ((a0-2 (the-as process (as-type arg0 process-focusable))) + (s3-1 (new 'stack-no-clear 'vector)) + ) (let ((s1-0 (new 'stack-no-clear 'vector))) (vector-! s3-1 (get-trans (the-as process-focusable a0-2) 0) (-> this root trans)) (set! (-> s3-1 y) 0.0) @@ -790,11 +782,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) @@ -1150,11 +1140,11 @@ #f ) -(defmethod relocate ((this metalmonk) (arg0 int)) +(defmethod relocate ((this metalmonk) (offset int)) (if (nonzero? (-> this intro-path)) - (&+! (-> this intro-path) arg0) + (&+! (-> this intro-path) offset) ) - (call-parent-method this arg0) + (call-parent-method this offset) ) (defmethod init-enemy! ((this metalmonk)) diff --git a/goal_src/jak2/levels/common/entities/fort-floor-spike.gc b/goal_src/jak2/levels/common/entities/fort-floor-spike.gc index 5f1f7096e5..94af8deda5 100644 --- a/goal_src/jak2/levels/common/entities/fort-floor-spike.gc +++ b/goal_src/jak2/levels/common/entities/fort-floor-spike.gc @@ -81,12 +81,7 @@ (case message (('touched) (when (+ (current-time) (seconds -2)) - (let* ((s3-0 proc) - (proc-draw (if (type? s3-0 process-drawable) - (the-as process-drawable s3-0) - ) - ) - ) + (let ((proc-draw (as-type proc process-drawable))) (when proc-draw (let ((spike-quat (vector-x-quaternion! (new 'stack-no-clear 'vector) (-> self root quat))) (touched-from-dir (vector-normalize! @@ -160,21 +155,21 @@ ) ;; WARN: Return type mismatch process-drawable vs fort-floor-spike. -(defmethod relocate ((this fort-floor-spike) (arg0 int)) +(defmethod relocate ((this fort-floor-spike) (offset int)) (if (nonzero? (-> this spike-row)) - (&+! (-> this spike-row) arg0) + (&+! (-> this spike-row) offset) ) - (the-as fort-floor-spike ((method-of-type process-drawable relocate) this arg0)) + (the-as fort-floor-spike ((method-of-type process-drawable relocate) this offset)) ) ;; WARN: Return type mismatch object vs none. (defmethod init-from-entity! ((this fort-floor-spike) (arg0 entity-actor)) "Typically the method that does the initial setup on the process, potentially using the [[entity-actor]] provided as part of that. -This commonly includes things such as: -- stack size -- collision information -- loading the skeleton group / bones -- sounds" + This commonly includes things such as: + - stack size + - collision information + - loading the skeleton group / bones + - sounds" (init-spike-collision! this) (process-drawable-from-entity! this arg0) (init-spike-joints! this) @@ -237,7 +232,6 @@ This commonly includes things such as: (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) @@ -255,24 +249,18 @@ This commonly includes things such as: (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)) ) @@ -291,7 +279,6 @@ This commonly includes things such as: (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) ) @@ -314,12 +301,13 @@ This commonly includes things such as: (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) @@ -375,7 +363,6 @@ This commonly includes things such as: (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) @@ -404,24 +391,18 @@ This commonly includes things such as: (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)) ) @@ -440,7 +421,6 @@ This commonly includes things such as: (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) ) @@ -465,12 +445,13 @@ This commonly includes things such as: (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) @@ -526,7 +507,6 @@ This commonly includes things such as: (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) @@ -560,24 +540,23 @@ This commonly includes things such as: (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)) ) @@ -596,7 +575,6 @@ This commonly includes things such as: (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) ) @@ -626,12 +604,13 @@ This commonly includes things such as: (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/goal_src/jak2/levels/common/entities/gun-buoy.gc b/goal_src/jak2/levels/common/entities/gun-buoy.gc index 228a91be97..72027cce7e 100644 --- a/goal_src/jak2/levels/common/entities/gun-buoy.gc +++ b/goal_src/jak2/levels/common/entities/gun-buoy.gc @@ -51,13 +51,9 @@ (s4-0 (new 'stack-no-clear 'vector)) ) (set! (-> s4-0 quad) (-> s5-0 transv quad)) - (let* ((f30-0 (vector-length s4-0)) - (s1-0 *target*) - (a0-2 (if (type? s1-0 process-focusable) - s1-0 - ) - ) - ) + (let ((f30-0 (vector-length s4-0)) + (a0-2 (the-as target (as-type *target* process-focusable))) + ) (when a0-2 (let ((s1-1 (new 'stack-no-clear 'vector))) (set! (-> s1-1 quad) (-> (get-trans a0-2 0) quad)) @@ -423,7 +419,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)))) ) @@ -439,12 +434,7 @@ (nav-enemy-method-166 self) (logior! (-> self flags) (gun-buoy-flags gubflags-0)) (logior! (-> self water flags) (water-flags touch-water)) - (let* ((gp-0 *target*) - (s3-0 (if (type? gp-0 process-focusable) - gp-0 - ) - ) - ) + (let ((s3-0 (the-as target (as-type *target* process-focusable)))) (cond (s3-0 (let ((s4-0 (new 'stack-no-clear 'vector))) @@ -453,14 +443,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))) @@ -517,7 +503,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)) @@ -553,7 +539,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)) @@ -586,12 +572,7 @@ (ja-channel-push! 1 (seconds 0.075)) (let ((f30-0 (rnd-float-range self 0.8 1.2))) (new 'stack-no-clear 'vector) - (let* ((gp-0 (handle->process (-> self focus handle))) - (a0-6 (if (type? gp-0 process-focusable) - gp-0 - ) - ) - ) + (let ((a0-6 (the-as process (as-type (handle->process (-> self focus handle)) process-focusable)))) (if (and a0-6 (focus-test? (the-as process-focusable a0-6) board)) (set! f30-0 (* 2.0 f30-0)) ) @@ -676,12 +657,7 @@ (set! (-> self warning-interval) (seconds 0.1)) ) (else - (let* ((gp-0 (handle->process (-> self focus handle))) - (v1-6 (if (type? gp-0 process-focusable) - gp-0 - ) - ) - ) + (let ((v1-6 (the-as process (as-type (handle->process (-> self focus handle)) process-focusable)))) (cond ((focus-test? (the-as process-focusable v1-6) board) (set! (-> self warning-interval) (seconds 0.5)) @@ -777,13 +753,9 @@ ) ) ) - (let ((gp-0 *target*)) - (if (if (type? gp-0 process-focusable) - gp-0 - ) - (go-virtual attack) - ) - ) + (if (the-as target (as-type *target* process-focusable)) + (go-virtual attack) + ) ) ) :code sleep-code @@ -800,12 +772,7 @@ ) ) ) - (let* ((s5-0 (handle->process (-> self focus handle))) - (gp-0 (if (type? s5-0 process-focusable) - s5-0 - ) - ) - ) + (let ((gp-0 (the-as process (as-type (handle->process (-> self focus handle)) process-focusable)))) (if (and gp-0 (focus-test? (the-as process-focusable gp-0) dead)) (go-virtual victory) ) @@ -816,12 +783,7 @@ ) :code (behavior () (dotimes (gp-0 4) - (let* ((s5-0 *target*) - (a1-1 (if (type? s5-0 process-focusable) - s5-0 - ) - ) - ) + (let ((a1-1 (the-as target (as-type *target* process-focusable)))) (if a1-1 (gun-buoy-method-183 self a1-1) ) @@ -886,12 +848,7 @@ - looks at the target and handles attacking @TODO Not extremely well understood yet" (-> this root) - (let* ((s4-0 *target*) - (s5-0 (if (type? s4-0 process-focusable) - s4-0 - ) - ) - ) + (let ((s5-0 (the-as target (as-type *target* process-focusable)))) (cond (s5-0 (let* ((s2-1 (vector-normalize-copy! @@ -985,22 +942,18 @@ (-> this fact) (let ((v1-10 (or (not (and (-> this next-state) (= (-> this next-state name) 'dormant-aware))) - (let ((s2-0 arg0)) - (cond - ((if (type? s2-0 target) - s2-0 - ) - (let ((v1-12 arg0)) - (and v1-12 - (or (focus-test? v1-12 on-water under-water) - (= (-> (the-as collide-shape-moving (-> v1-12 root)) ground-pat material) (pat-material waterbottom)) - ) - ) - ) + (cond + ((the-as process-focusable (as-type arg0 target)) + (let ((v1-12 arg0)) + (and v1-12 + (or (focus-test? v1-12 on-water under-water) + (= (-> (the-as collide-shape-moving (-> v1-12 root)) ground-pat material) (pat-material waterbottom)) + ) + ) ) - (else - (< f30-0 (+ 16384.0 f28-0)) - ) + ) + (else + (< f30-0 (+ 16384.0 f28-0)) ) ) ) @@ -1009,10 +962,7 @@ (and v1-10 (begin (set! f30-1 (-> this enemy-info notice-nav-radius)) - (set! v1-19 (if (type? arg0 target) - arg0 - ) - ) + (set! v1-19 (the-as process-focusable (as-type arg0 target))) v1-19 ) (and (and v1-19 @@ -1020,11 +970,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/goal_src/jak2/levels/common/entities/spydroid.gc b/goal_src/jak2/levels/common/entities/spydroid.gc index 587970db7e..862ba681f9 100644 --- a/goal_src/jak2/levels/common/entities/spydroid.gc +++ b/goal_src/jak2/levels/common/entities/spydroid.gc @@ -721,86 +721,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) + ) ) ) ) @@ -1016,11 +1024,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/goal_src/jak2/levels/common/race/race-hud.gc b/goal_src/jak2/levels/common/race/race-hud.gc index db869f81a8..2ca8f83b82 100644 --- a/goal_src/jak2/levels/common/race/race-hud.gc +++ b/goal_src/jak2/levels/common/race/race-hud.gc @@ -8,13 +8,9 @@ ;; DECOMP BEGINS (defmethod draw ((this hud-race-timer)) - (set-hud-piece-position! - (the-as hud-sprite (-> this sprites)) - 0 - (the int (+ 20.0 (* -100.0 (-> this offset)))) - ) + (set-hud-piece-position! (-> this sprites 0) 0 (the int (+ 20.0 (* -100.0 (-> this offset))))) (format (clear (-> this strings 0 text)) "~2,'0D:" (-> this values 0 current)) - (set-as-offset-from! (the-as hud-sprite (-> this strings 0 pos)) (the-as vector4w (-> this sprites)) 60 5) + (set-as-offset-from! (the-as hud-sprite (-> this strings 0 pos)) (-> this sprites 0 pos) 60 5) (format (clear (-> this strings 1 text)) "~2,'0D:" (-> this values 1 current)) (set-as-offset-from! (the-as hud-sprite (-> this strings 1 pos)) @@ -29,7 +25,7 @@ 28 0 ) - (set-as-offset-from! (-> this sprites 1) (the-as vector4w (-> this sprites)) 128 0) + (set-as-offset-from! (-> this sprites 1) (-> this sprites 0 pos) 128 0) ((method-of-type hud draw) this) 0 (none) @@ -72,16 +68,12 @@ ) (defmethod draw ((this hud-race-lap-counter)) - (set-hud-piece-position! - (the-as hud-sprite (-> this sprites)) - 504 - (the int (+ 20.0 (* -100.0 (-> this offset)))) - ) + (set-hud-piece-position! (-> this sprites 0) 504 (the int (+ 20.0 (* -100.0 (-> this offset))))) (set! (-> this strings 0 scale) 0.55) (format (clear (-> this strings 0 text)) "~D/~D" (-> this values 0 current) (-> this values 1 current)) - (set-as-offset-from! (the-as hud-sprite (-> this strings 0 pos)) (the-as vector4w (-> this sprites)) -40 5) - (set-as-offset-from! (-> this sprites 1) (the-as vector4w (-> this sprites)) -20 0) - (set-as-offset-from! (-> this sprites 2) (the-as vector4w (-> this sprites 1)) -50 0) + (set-as-offset-from! (the-as hud-sprite (-> this strings 0 pos)) (-> this sprites 0 pos) -40 5) + (set-as-offset-from! (-> this sprites 1) (-> this sprites 0 pos) -20 0) + (set-as-offset-from! (-> this sprites 2) (-> this sprites 1 pos) -50 0) ((method-of-type hud draw) this) 0 (none) @@ -113,16 +105,12 @@ ) (defmethod draw ((this hud-race-turbo-counter)) - (set-hud-piece-position! - (the-as hud-sprite (-> this sprites)) - 224 - (the int (+ 25.0 (* -100.0 (-> this offset)))) - ) - (set-as-offset-from! (-> this sprites 1) (the-as vector4w (-> this sprites)) 0 0) - (set-as-offset-from! (-> this sprites 2) (the-as vector4w (-> this sprites 1)) 32 0) - (set-as-offset-from! (-> this sprites 3) (the-as vector4w (-> this sprites 1)) 32 0) - (set-as-offset-from! (-> this sprites 4) (the-as vector4w (-> this sprites 2)) 32 0) - (set-as-offset-from! (-> this sprites 5) (the-as vector4w (-> this sprites 2)) 32 0) + (set-hud-piece-position! (-> this sprites 0) 224 (the int (+ 25.0 (* -100.0 (-> this offset))))) + (set-as-offset-from! (-> this sprites 1) (-> this sprites 0 pos) 0 0) + (set-as-offset-from! (-> this sprites 2) (-> this sprites 1 pos) 32 0) + (set-as-offset-from! (-> this sprites 3) (-> this sprites 1 pos) 32 0) + (set-as-offset-from! (-> this sprites 4) (-> this sprites 2 pos) 32 0) + (set-as-offset-from! (-> this sprites 5) (-> this sprites 2 pos) 32 0) (let* ((v1-2 (-> this values 0 current)) (f0-3 (if (> v1-2 0) 1.0 @@ -178,18 +166,14 @@ (defmethod draw ((this hud-race-position)) (local-vars (s5-0 int)) - (set-hud-piece-position! - (the-as hud-sprite (-> this sprites)) - 24 - (the int (+ 324.0 (* 100.0 (-> this offset)))) - ) - (set-as-offset-from! (-> this sprites 1) (the-as vector4w (-> this sprites)) 0 0) - (set-as-offset-from! (-> this sprites 2) (the-as vector4w (-> this sprites)) 0 0) - (set-as-offset-from! (-> this sprites 3) (the-as vector4w (-> this sprites)) 0 0) - (set-as-offset-from! (-> this sprites 4) (the-as vector4w (-> this sprites)) 0 0) - (set-as-offset-from! (-> this sprites 5) (the-as vector4w (-> this sprites)) 0 0) - (set-as-offset-from! (-> this sprites 6) (the-as vector4w (-> this sprites)) 0 0) - (set-as-offset-from! (-> this sprites 7) (the-as vector4w (-> this sprites)) 0 0) + (set-hud-piece-position! (-> this sprites 0) 24 (the int (+ 324.0 (* 100.0 (-> this offset))))) + (set-as-offset-from! (-> this sprites 1) (-> this sprites 0 pos) 0 0) + (set-as-offset-from! (-> this sprites 2) (-> this sprites 0 pos) 0 0) + (set-as-offset-from! (-> this sprites 3) (-> this sprites 0 pos) 0 0) + (set-as-offset-from! (-> this sprites 4) (-> this sprites 0 pos) 0 0) + (set-as-offset-from! (-> this sprites 5) (-> this sprites 0 pos) 0 0) + (set-as-offset-from! (-> this sprites 6) (-> this sprites 0 pos) 0 0) + (set-as-offset-from! (-> this sprites 7) (-> this sprites 0 pos) 0 0) (let ((v1-2 (-> this values 0 current))) (dotimes (a0-9 16) (set! (-> this sprites a0-9 scale-x) (if (= a0-9 v1-2) @@ -223,7 +207,7 @@ ) (set-as-offset-from! (-> this sprites s5-0) - (the-as vector4w (-> this sprites v1-2)) + (-> this sprites v1-2 pos) (if (zero? v1-2) 28 52 @@ -285,13 +269,7 @@ ) (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))) ) @@ -311,60 +289,33 @@ (set! (-> this strings 0 scale) 0.0) (set! (-> s1-0 origin x) 45.0) (set! (-> s1-0 origin y) 20.0) - (let ((v1-15 s1-0)) - (set! (-> v1-15 width) (the float 422)) - ) - (let ((v1-16 s1-0)) - (set! (-> v1-16 height) (the float 80)) - ) + (set-width! s1-0 422) + (set-height! s1-0 80) (let ((a0-12 s1-0)) (set! (-> a0-12 color) (font-color red)) ) (let ((a0-13 s1-0)) (set! (-> a0-13 flags) (font-flags kerning middle middle-vert large)) ) - (let ((v1-19 s1-0)) - (set! (-> v1-19 scale) 1.0) - ) + (set-scale! s1-0 1.0) (cond ((zero? (-> s5-0 finish-count)) (set! s0-0 80) - (let ((v1-21 s1-0)) - (set! (-> v1-21 scale) 1.6) - ) - (when (text-language? german) ;; og:preserve-this text-language patch - (let ((v1-24 s1-0)) - (set! (-> v1-24 scale) 1.0) + (set-scale! s1-0 1.6) + ;; og:preserve-this text-language patch + (when (text-language? 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) - (let ((v1-27 s1-0)) - (set! (-> v1-27 scale) 1.6) - ) - (when (text-language? german) ;; og:preserve-this text-language patch - (let ((v1-30 s1-0)) - (set! (-> v1-30 scale) 1.0) + (set-scale! s1-0 1.6) + ;; og:preserve-this text-language patch + (if (text-language? 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)) ) ) ) @@ -374,16 +325,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)) @@ -404,15 +353,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/goal_src/jak2/levels/common/race/race-manager.gc b/goal_src/jak2/levels/common/race/race-manager.gc index 85a7713ed5..52bbf57a27 100644 --- a/goal_src/jak2/levels/common/race/race-manager.gc +++ b/goal_src/jak2/levels/common/race/race-manager.gc @@ -90,13 +90,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)) + ) ) ) ) @@ -256,13 +252,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 @@ -540,7 +534,7 @@ ) (cubic-curve-method-9 (-> this player-intro-curve) - (the-as vector (-> v1-27 vector)) + (-> v1-27 vector 0) (-> v1-27 vector 2) (-> v1-27 vector 1) (-> v1-27 trans) @@ -586,13 +580,11 @@ ) ) (((race-state-enum player-get-on)) - (let* ((f30-0 (* 0.0033333334 (the float (- (-> this current-time) (-> this countdown-start-time))))) - (s4-0 (handle->process (-> this racer-array (-> this i-player) racer))) - (s5-1 (if (type? s4-0 process-focusable) - s4-0 - ) - ) - ) + (let ((f30-0 (* 0.0033333334 (the float (- (-> this current-time) (-> this countdown-start-time))))) + (s5-1 + (the-as process (as-type (handle->process (-> this racer-array (-> this i-player) racer)) process-focusable)) + ) + ) (cond ((< f30-0 1.0) (when s5-1 @@ -615,12 +607,10 @@ ) ) (((race-state-enum player-set-pos)) - (let* ((s4-2 (handle->process (-> this racer-array (-> this i-player) racer))) - (s5-3 (if (type? s4-2 process-focusable) - s4-2 - ) - ) - ) + (let ((s5-3 + (the-as process (as-type (handle->process (-> this racer-array (-> this i-player) racer)) process-focusable)) + ) + ) (when s5-3 (cubic-curve-method-10 (-> this player-intro-curve) (-> (the-as process-focusable s5-3) root trans) 1.0) (vector-reset! (-> (the-as process-focusable s5-3) root transv)) @@ -777,9 +767,7 @@ ) (+! (-> s4-0 vector 0 y) 22528.0) (set! (-> this race-signal) - (process->handle - (race-signal-spawn s5-1 (the-as vector (-> s4-0 vector)) (the-as quaternion (-> s4-0 vector 1))) - ) + (process->handle (race-signal-spawn s5-1 (-> s4-0 vector 0) (the-as quaternion (-> s4-0 vector 1)))) ) ) ) @@ -955,14 +943,7 @@ ;; 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)) @@ -1050,15 +1031,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) @@ -1081,40 +1059,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~%") - ) ) ) ) @@ -1128,7 +1093,6 @@ ) (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)) @@ -1139,12 +1103,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)) @@ -1226,15 +1191,9 @@ (new 'stack 'font-context *font-default-matrix* 70 20 0.0 (font-color orange) (font-flags shadow kerning)) ) ) - (let ((v1-4 gp-1)) - (set! (-> v1-4 scale) 0.7) - ) - (let ((v1-5 gp-1)) - (set! (-> v1-5 width) (the float 225)) - ) - (let ((v1-6 gp-1)) - (set! (-> v1-6 height) (the float 70)) - ) + (set-scale! gp-1 0.7) + (set-width! gp-1 225) + (set-height! gp-1 70) (set! (-> gp-1 origin x) (the float (- 256 (the int (/ (-> gp-1 width) 2))))) (set! (-> gp-1 origin y) 320.0) (set! (-> gp-1 flags) (font-flags shadow kerning middle middle-vert large)) @@ -1254,15 +1213,9 @@ (new 'stack 'font-context *font-default-matrix* 70 20 0.0 (font-color orange) (font-flags shadow kerning)) ) ) - (let ((v1-4 gp-1)) - (set! (-> v1-4 scale) 0.7) - ) - (let ((v1-5 gp-1)) - (set! (-> v1-5 width) (the float 240)) - ) - (let ((v1-6 gp-1)) - (set! (-> v1-6 height) (the float 35)) - ) + (set-scale! gp-1 0.7) + (set-width! gp-1 240) + (set-height! gp-1 35) (set! (-> gp-1 origin x) (the float (- 256 (the int (/ (-> gp-1 width) 2))))) (set! (-> gp-1 origin y) 320.0) (set! (-> gp-1 flags) (font-flags shadow kerning middle middle-vert large)) diff --git a/goal_src/jak2/levels/common/race/vehicle-racer.gc b/goal_src/jak2/levels/common/race/vehicle-racer.gc index 9ae11b540d..6eebfbc185 100644 --- a/goal_src/jak2/levels/common/race/vehicle-racer.gc +++ b/goal_src/jak2/levels/common/race/vehicle-racer.gc @@ -194,12 +194,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))) @@ -530,7 +525,7 @@ (set! (-> s3-0 1 vector 1 x) 819200.0) (quaternion-copy! (the-as quaternion (-> s3-0 1)) (-> s5-0 path-sample quat)) (vector-float*! (-> s3-0 0 vector 2) (-> s5-0 lin-velocity) f28-0) - (vector-! (-> s3-0 0 trans) (the-as vector (-> s5-0 path-sample)) (-> s4-0 state position)) + (vector-! (-> s3-0 0 trans) (-> s5-0 path-sample pos) (-> s4-0 state position)) (.lvf vf1 (&-> (-> s3-0 0 trans) quad)) (.add.w.vf.x vf2 vf0 vf0) (.mul.vf vf1 vf1 vf1) @@ -538,12 +533,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))) @@ -561,9 +551,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) @@ -701,12 +689,10 @@ (let ((f0-19 (+ (-> s5-0 path-t) (* 1.875 (/ 1.0 (-> s4-0 3 vector 0 z)) (-> s4-0 3 vector 0 y))))) (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) (the-as vector (-> s5-0 path-sample)) (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))) - ) + (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-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) @@ -716,16 +702,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))) @@ -793,35 +772,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 @@ -831,8 +799,8 @@ (defmethod vehicle-racer-method-152 ((this vehicle-racer)) (let ((s5-0 (new 'stack-no-clear 'matrix3))) (set! (-> s5-0 vector 0 quad) (-> this rbody state position quad)) - (set! (-> this camera-dist2) (vector-vector-distance-squared (the-as vector (-> s5-0 vector)) (camera-pos))) - (set! (-> this player-dist2) (vector-vector-distance-squared (the-as vector (-> s5-0 vector)) (target-pos 0))) + (set! (-> this camera-dist2) (vector-vector-distance-squared (-> s5-0 vector 0) (camera-pos))) + (set! (-> this player-dist2) (vector-vector-distance-squared (-> s5-0 vector 0) (target-pos 0))) ) (if (time-elapsed? (-> this shortcut-time) (seconds 5)) (set! (-> this shortcut-speed-factor) 0.0) @@ -849,8 +817,8 @@ (defmethod vehicle-racer-method-155 ((this vehicle-racer)) (let ((s5-0 (new 'stack-no-clear 'matrix3))) (set! (-> s5-0 vector 0 quad) (-> this rbody state position quad)) - (set! (-> this camera-dist2) (vector-vector-distance-squared (the-as vector (-> s5-0 vector)) (camera-pos))) - (set! (-> this player-dist2) (vector-vector-distance-squared (the-as vector (-> s5-0 vector)) (target-pos 0))) + (set! (-> this camera-dist2) (vector-vector-distance-squared (-> s5-0 vector 0) (camera-pos))) + (set! (-> this player-dist2) (vector-vector-distance-squared (-> s5-0 vector 0) (target-pos 0))) ) (set! (-> this shortcut-speed-factor) 0.0) (vehicle-racer-method-154 this) diff --git a/goal_src/jak2/levels/consite/consite-scenes.gc b/goal_src/jak2/levels/consite/consite-scenes.gc index a6498f1b09..3f759e4b65 100644 --- a/goal_src/jak2/levels/consite/consite-scenes.gc +++ b/goal_src/jak2/levels/consite/consite-scenes.gc @@ -635,11 +635,6 @@ (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)) ) @@ -703,36 +698,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/goal_src/jak2/levels/demo/demo-obs.gc b/goal_src/jak2/levels/demo/demo-obs.gc index 3a9ed12df5..b9225daa56 100644 --- a/goal_src/jak2/levels/demo/demo-obs.gc +++ b/goal_src/jak2/levels/demo/demo-obs.gc @@ -65,9 +65,9 @@ ;; 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 @@ -81,11 +81,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))) @@ -483,7 +483,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) @@ -523,24 +522,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)) + ) ) - (let ((v1-25 sv-112)) - (set! (-> v1-25 width) (the float 384)) - ) - (let ((v1-26 sv-112)) - (set! (-> v1-26 height) (the float 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/goal_src/jak2/levels/dig/dig-digger.gc b/goal_src/jak2/levels/dig/dig-digger.gc index e47eb3222a..0f17b463db 100644 --- a/goal_src/jak2/levels/dig/dig-digger.gc +++ b/goal_src/jak2/levels/dig/dig-digger.gc @@ -864,7 +864,6 @@ ) (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)) @@ -887,55 +886,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)) ) ) ) @@ -1254,16 +1253,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)) @@ -1358,7 +1353,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) @@ -1461,8 +1455,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/goal_src/jak2/levels/dig/dig-obs.gc b/goal_src/jak2/levels/dig/dig-obs.gc index 7155ee3e32..cfd87ac604 100644 --- a/goal_src/jak2/levels/dig/dig-obs.gc +++ b/goal_src/jak2/levels/dig/dig-obs.gc @@ -656,7 +656,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)))) @@ -685,8 +684,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/goal_src/jak2/levels/dig/dig3-obs.gc b/goal_src/jak2/levels/dig/dig3-obs.gc index 30bd584c6d..9ca5ce4091 100644 --- a/goal_src/jak2/levels/dig/dig3-obs.gc +++ b/goal_src/jak2/levels/dig/dig3-obs.gc @@ -320,7 +320,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)) @@ -349,8 +348,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/goal_src/jak2/levels/drill/drill-obs.gc b/goal_src/jak2/levels/drill/drill-obs.gc index 1c0ae96ca2..8cbe385d84 100644 --- a/goal_src/jak2/levels/drill/drill-obs.gc +++ b/goal_src/jak2/levels/drill/drill-obs.gc @@ -355,7 +355,6 @@ ;; 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)) @@ -367,28 +366,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)) @@ -546,7 +546,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) @@ -554,15 +553,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)) + ) ) ) ) @@ -865,12 +865,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))) @@ -1440,7 +1437,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)) @@ -1452,8 +1448,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/goal_src/jak2/levels/drill/drill-obs2.gc b/goal_src/jak2/levels/drill/drill-obs2.gc index 2fb422262c..ef84fc43ad 100644 --- a/goal_src/jak2/levels/drill/drill-obs2.gc +++ b/goal_src/jak2/levels/drill/drill-obs2.gc @@ -775,14 +775,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/goal_src/jak2/levels/drill/drill-spool.gc b/goal_src/jak2/levels/drill/drill-spool.gc index e50b7b9bb6..ca885f379f 100644 --- a/goal_src/jak2/levels/drill/drill-spool.gc +++ b/goal_src/jak2/levels/drill/drill-spool.gc @@ -803,41 +803,7 @@ (format (clear *temp-string*) "~S-end" (-> self art-name)) (let ((gp-1 (s4-0 gp-0 *temp-string* art-joint-anim))) (when (not arg0) - (let ((s5-1 (get-process *default-dead-pool* part-tracker #x4000))) - (when s5-1 - (let ((t9-5 (method-of-type part-tracker activate))) - (t9-5 - (the-as part-tracker s5-1) - *entity-pool* - (symbol->string (-> part-tracker symbol)) - (the-as pointer #x70004000) - ) - ) - (let ((t9-6 run-function-in-process) - (a0-7 s5-1) - (a1-5 part-tracker-init) - (a2-7 (-> *part-group-id-table* 421)) - (a3-1 0) - (t0-0 #f) - (t1-0 #f) - (t2-0 #f) - (t3-0 *launch-matrix*) - ) - (set! (-> t3-0 trans quad) (-> self root trans quad)) - ((the-as (function object object object object object object object object none) t9-6) - a0-7 - a1-5 - a2-7 - a3-1 - t0-0 - t1-0 - t2-0 - t3-0 - ) - ) - (-> s5-1 ppointer) - ) - ) + (part-tracker-spawn :to *entity-pool* :group group-drill-wall-explode :mat-joint (-> self root trans)) (sound-play "egg-wall-break" :position (-> self root trans)) ;; og:preserve-this added cast (ja-play-spooled-anim (-> self anim) (ja-group) (the-as art-joint-anim gp-1) (the-as (function process-drawable symbol) false-func)) @@ -863,7 +829,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) @@ -919,8 +884,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)) @@ -1135,7 +1101,6 @@ - collision information - loading the skeleton group / bones - sounds" - (local-vars (sv-16 res-tag) (sv-32 res-tag)) ;; og:preserve-this increased from 512 (stack-size-set! (-> this main-thread) 2048) (logior! (-> this mask) (process-mask collectable)) @@ -1173,18 +1138,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/goal_src/jak2/levels/forest/fish.gc b/goal_src/jak2/levels/forest/fish.gc index 5cc98f6183..cde1d49e98 100644 --- a/goal_src/jak2/levels/forest/fish.gc +++ b/goal_src/jak2/levels/forest/fish.gc @@ -107,26 +107,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) @@ -145,290 +125,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 @@ -450,11 +428,11 @@ ;; WARN: Return type mismatch object vs none. (defmethod init-from-entity! ((this fish-manager) (arg0 entity-actor)) "Typically the method that does the initial setup on the process, potentially using the [[entity-actor]] provided as part of that. -This commonly includes things such as: -- stack size -- collision information -- loading the skeleton group / bones -- sounds" + This commonly includes things such as: + - stack size + - collision information + - loading the skeleton group / bones + - sounds" (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) diff --git a/goal_src/jak2/levels/forest/pegasus.gc b/goal_src/jak2/levels/forest/pegasus.gc index 53547336a5..0f54c2b367 100644 --- a/goal_src/jak2/levels/forest/pegasus.gc +++ b/goal_src/jak2/levels/forest/pegasus.gc @@ -148,12 +148,10 @@ (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 + ) ) (defmethod track-how-long-aimed-at! ((this pegasus)) @@ -170,13 +168,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)) + ) ) ) ) @@ -369,7 +363,7 @@ (matrix->quaternion (-> self root quat) rotation-matrix) (set! (-> self run-blend-interp) (acos (vector-dot flee-direction-vec (-> self facing)))) (set! (-> self run-blend-interp) (* 0.0002746582 (-> self run-blend-interp))) - (if (< (vector-dot (-> self facing) (the-as vector (-> rotation-matrix vector))) 0.0) + (if (< (vector-dot (-> self facing) (-> rotation-matrix vector 0)) 0.0) (set! (-> self run-blend-interp) (- (-> self run-blend-interp))) ) (set! (-> self facing quad) (-> flee-direction-vec quad)) @@ -1264,7 +1258,6 @@ (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))) @@ -1291,11 +1284,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))) @@ -1379,23 +1372,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/goal_src/jak2/levels/forest/predator.gc b/goal_src/jak2/levels/forest/predator.gc index 5f8aa359d7..77e93e8969 100644 --- a/goal_src/jak2/levels/forest/predator.gc +++ b/goal_src/jak2/levels/forest/predator.gc @@ -9,9 +9,9 @@ (defmethod draw ((this hud-predator)) (set-hud-piece-position! (-> this sprites 1) (the int (+ 480.0 (* 130.0 (-> this offset)))) 205) - (set-as-offset-from! (the-as hud-sprite (-> this sprites)) (the-as vector4w (-> this sprites 1)) -44 0) + (set-as-offset-from! (-> this sprites 0) (-> this sprites 1 pos) -44 0) (format (clear (-> this strings 0 text)) "~D" (-> this values 0 current)) - (set-as-offset-from! (the-as hud-sprite (-> this strings 0 pos)) (the-as vector4w (-> this sprites 1)) -45 45) + (set-as-offset-from! (the-as hud-sprite (-> this strings 0 pos)) (-> this sprites 1 pos) -45 45) ((method-of-type hud draw) this) 0 (none) @@ -46,14 +46,10 @@ ) (defmethod draw ((this hud-pegasus)) - (set-hud-piece-position! - (the-as hud-sprite (-> this sprites)) - (the int (+ 472.0 (* 130.0 (-> this offset)))) - 190 - ) + (set-hud-piece-position! (-> this sprites 0) (the int (+ 472.0 (* 130.0 (-> this offset)))) 190) (set! (-> this sprites 0 flags) (the-as uint 4)) (format (clear (-> this strings 0 text)) "~D" (-> this values 0 current)) - (set-as-offset-from! (the-as hud-sprite (-> this strings 0 pos)) (the-as vector4w (-> this sprites)) -26 35) + (set-as-offset-from! (the-as hud-sprite (-> this strings 0 pos)) (-> this sprites 0 pos) -26 35) ((method-of-type hud draw) this) 0 (none) @@ -644,18 +640,14 @@ #t ) (else - (let ((s4-1 (-> s5-0 best-other-tri collide-ptr))) - (when (and (if (type? s4-1 collide-shape-prim) - s4-1 - ) - (< (vector-dot - (-> s5-0 best-other-tri normal) - (vector-! (new 'stack-no-clear 'vector) arg2 (the-as vector (-> s5-0 best-other-tri))) - ) - 0.0 + (when (and (the-as basic (as-type (-> s5-0 best-other-tri collide-ptr) collide-shape-prim)) + (< (vector-dot + (-> s5-0 best-other-tri normal) + (vector-! (new 'stack-no-clear 'vector) arg2 (the-as vector (-> s5-0 best-other-tri))) ) - ) - ) + 0.0 + ) + ) ) ) ) @@ -664,7 +656,6 @@ ) (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) @@ -696,23 +687,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))) @@ -736,11 +726,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)) @@ -1600,7 +1586,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) @@ -1620,8 +1605,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)) @@ -1695,17 +1681,15 @@ (set! (-> s2-1 entity) (-> this actor-group 1 data s5-2 actor)) (set! (-> s2-1 directed?) #f) (set! (-> s2-1 no-initial-move-to-ground?) #f) - (let* ((s1-2 (ppointer->process (process-spawn predator :init enemy-init-by-other this s2-1 :to this))) - (s2-2 (if (type? s1-2 process-focusable) - s1-2 - ) - ) - (s3-2 (entity-nav-mesh-by-aid (the-as actor-id (-> s3-1 nav-mesh-id)))) - (v1-66 (if (type? s3-2 entity-nav-mesh) - s3-2 - ) - ) - ) + (let ((s2-2 + (the-as process (as-type + (ppointer->process (process-spawn predator :init enemy-init-by-other this s2-1 :to this)) + process-focusable + ) + ) + ) + (v1-66 (as-type (entity-nav-mesh-by-aid (the-as actor-id (-> s3-1 nav-mesh-id))) entity-nav-mesh)) + ) (set! (-> this predator-h (-> this predator-count)) (process->handle s2-2)) (+! (-> this predator-count) 1) (when v1-66 diff --git a/goal_src/jak2/levels/fortress/dump/fordumpa-obs.gc b/goal_src/jak2/levels/fortress/dump/fordumpa-obs.gc index d8c85a80ef..4cd5bc4f23 100644 --- a/goal_src/jak2/levels/fortress/dump/fordumpa-obs.gc +++ b/goal_src/jak2/levels/fortress/dump/fordumpa-obs.gc @@ -189,7 +189,6 @@ - collision information - loading the skeleton group / bones - sounds" - (local-vars (sv-16 res-tag)) ;; og:preserve-this added (stack-size-set! (-> this top-thread) 512) (let ((s4-0 (new 'process 'collide-shape this (collide-list-enum usually-hit-by-player)))) @@ -217,8 +216,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/goal_src/jak2/levels/fortress/dump/fordumpb-obs.gc b/goal_src/jak2/levels/fortress/dump/fordumpb-obs.gc index d5b7de92e4..014afc9309 100644 --- a/goal_src/jak2/levels/fortress/dump/fordumpb-obs.gc +++ b/goal_src/jak2/levels/fortress/dump/fordumpb-obs.gc @@ -52,11 +52,11 @@ ;; WARN: Return type mismatch object vs none. (defmethod init-from-entity! ((this fort-plat-orbit) (arg0 entity-actor)) "Typically the method that does the initial setup on the process, potentially using the [[entity-actor]] provided as part of that. -This commonly includes things such as: -- stack size -- collision information -- loading the skeleton group / bones -- sounds" + This commonly includes things such as: + - stack size + - collision information + - loading the skeleton group / bones + - sounds" (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) @@ -305,12 +305,11 @@ This commonly includes things such as: ;; WARN: Return type mismatch object vs none. (defmethod init-from-entity! ((this fort-plat-shuttle) (arg0 entity-actor)) "Typically the method that does the initial setup on the process, potentially using the [[entity-actor]] provided as part of that. -This commonly includes things such as: -- stack size -- collision information -- loading the skeleton group / bones -- sounds" - (local-vars (sv-64 int)) + This commonly includes things such as: + - stack size + - collision information + - loading the skeleton group / bones + - sounds" (set! (-> this root) (new 'process 'trsqv)) (process-drawable-from-entity! this arg0) (initialize-skeleton @@ -324,8 +323,9 @@ This commonly includes things such as: (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) @@ -419,7 +419,7 @@ This commonly includes things such as: (defmethod set-and-get-ambient-sound! ((this fort-conveyor)) "So long as [[actor-option::16]] is not set, fetch the [[ambient-sound]] for the [[conveyor]] -and return it as well. Otherwise, set it to `0`" + and return it as well. Otherwise, set it to `0`" (let* ((s5-0 (get-point-in-path! (-> this path) (new 'stack-no-clear 'vector) 0.0 'interp)) (v1-2 (get-point-in-path! (-> this path) (new 'stack-no-clear 'vector) 1.0 'interp)) (a3-3 (vector+! (new 'stack-no-clear 'vector) s5-0 v1-2)) diff --git a/goal_src/jak2/levels/fortress/dump/fort-robotank-turret.gc b/goal_src/jak2/levels/fortress/dump/fort-robotank-turret.gc index be8604ab9b..1a112e8173 100644 --- a/goal_src/jak2/levels/fortress/dump/fort-robotank-turret.gc +++ b/goal_src/jak2/levels/fortress/dump/fort-robotank-turret.gc @@ -735,7 +735,6 @@ ;; 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)) ) @@ -751,13 +750,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)) @@ -803,13 +796,9 @@ ) ) (vector+float*! s4-0 (-> s3-0 start-pos) (-> s3-0 move-dist) f28-0) - (let* ((s3-1 (-> s3-0 best-other-tri collide-ptr)) - (s2-0 (if (type? s3-1 collide-shape-prim) - (the-as collide-shape-prim s3-1) - ) - ) - (s3-2 (new 'stack-no-clear 'vector)) - ) + (let ((s2-0 (as-type (-> s3-0 best-other-tri collide-ptr) collide-shape-prim)) + (s3-2 (new 'stack-no-clear 'vector)) + ) (set! (-> s3-2 quad) (-> s4-0 quad)) (vector+float*! s3-2 s3-2 (-> (math-camera-matrix) vector 2) -2048.0) (cond @@ -842,12 +831,7 @@ ) (defbehavior turret-post fort-robotank-turret () - (let* ((s5-0 *target*) - (gp-0 (if (type? s5-0 process-focusable) - s5-0 - ) - ) - ) + (let ((gp-0 (the-as target (as-type *target* process-focusable)))) (cond ((and (logtest? (-> self flags) (robotank-turret-flags rotflags-0)) gp-0) (send-event (handle->process (-> self reticle)) 'on) @@ -862,7 +846,7 @@ (s4-0 (vector<-cspace! (new 'stack-no-clear 'vector) (-> self node-list data (-> self gun-joint-l 0)))) ) (let ((v1-31 (vector<-cspace! (new 'stack-no-clear 'vector) (-> self node-list data (-> self gun-joint-r 0))))) - (vector-! s5-2 (-> self aim-pos-2) (the-as vector (-> self aim-pos))) + (vector-! s5-2 (-> self aim-pos-2) (-> self aim-pos 0)) (vector-float*! s5-2 s5-2 (* 0.8 (-> self clock frames-per-second))) (set! (-> s5-2 y) 0.0) (vector+! s5-2 (-> self aim-pos-2) s5-2) @@ -1116,16 +1100,12 @@ (if (logtest? (-> self flags) (robotank-turret-flags rotflags-4)) (set-time! (-> self gun-timer)) ) - (let ((gp-0 *target*)) - (if (and (if (type? gp-0 process-focusable) - gp-0 - ) - (or (not (logtest? (-> self flags) (robotank-turret-flags rotflags-9))) (check-los? (-> self los) 0)) - (time-elapsed? (-> self gun-timer) (seconds 1)) - ) - (go-virtual fire) - ) - ) + (if (and (the-as target (as-type *target* process-focusable)) + (or (not (logtest? (-> self flags) (robotank-turret-flags rotflags-9))) (check-los? (-> self los) 0)) + (time-elapsed? (-> self gun-timer) (seconds 1)) + ) + (go-virtual fire) + ) ) :code (behavior () (until #f @@ -1145,12 +1125,7 @@ :event robotank-turret-handler :enter (behavior () (logior! (-> self flags) (robotank-turret-flags rotflags-8)) - (let* ((gp-0 *target*) - (a0-1 (if (type? gp-0 process-focusable) - gp-0 - ) - ) - ) + (let ((a0-1 (the-as target (as-type *target* process-focusable)))) (when a0-1 (set! (-> self aim-pos 0 quad) (-> (get-trans a0-1 0) quad)) (set! (-> self aim-pos-2 quad) (-> self aim-pos 0 quad)) @@ -1159,20 +1134,15 @@ ) ) :trans (behavior () - (let ((gp-0 *target*)) - (when (or (not (if (type? gp-0 process-focusable) - gp-0 - ) - ) - (and (logtest? (-> self flags) (robotank-turret-flags rotflags-9)) - (not (logtest? (-> self flags) (robotank-turret-flags rotflags-3))) - (skip-check-los? (-> self los) 0) - ) - (logtest? (-> self flags) (robotank-turret-flags rotflags-4)) - ) - (logclear! (-> self flags) (robotank-turret-flags rotflags-8)) - (go-virtual ready) - ) + (when (or (not (the-as target (as-type *target* process-focusable))) + (and (logtest? (-> self flags) (robotank-turret-flags rotflags-9)) + (not (logtest? (-> self flags) (robotank-turret-flags rotflags-3))) + (skip-check-los? (-> self los) 0) + ) + (logtest? (-> self flags) (robotank-turret-flags rotflags-4)) + ) + (logclear! (-> self flags) (robotank-turret-flags rotflags-8)) + (go-virtual ready) ) ) :code (behavior () diff --git a/goal_src/jak2/levels/fortress/dump/fort-robotank.gc b/goal_src/jak2/levels/fortress/dump/fort-robotank.gc index 45ed8f6dc6..b30dd41820 100644 --- a/goal_src/jak2/levels/fortress/dump/fort-robotank.gc +++ b/goal_src/jak2/levels/fortress/dump/fort-robotank.gc @@ -527,11 +527,6 @@ ) (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)))))) @@ -539,18 +534,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/goal_src/jak2/levels/fortress/prison/prison-obs.gc b/goal_src/jak2/levels/fortress/prison/prison-obs.gc index e3adf0bcd5..beae308715 100644 --- a/goal_src/jak2/levels/fortress/prison/prison-obs.gc +++ b/goal_src/jak2/levels/fortress/prison/prison-obs.gc @@ -55,7 +55,6 @@ (define *prsn-chair-shackle-lightning-joints* (new 'static 'boxed-array :type int32 4 5 6 7)) (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*)) @@ -71,7 +70,7 @@ (let ((v1-7 (rand-vu-int-range-exclude 0 (+ (-> *prsn-chair-shackle-lightning-joints* length) -1) (-> s4-0 x)))) (when s1-0 (set! (-> s4-0 x) v1-7) - (vector<-cspace! (the-as vector (-> gp-1 vector)) (-> self node-list data 13)) + (vector<-cspace! (-> gp-1 vector 0) (-> self node-list data 13)) (vector<-cspace! (-> gp-1 vector 1) (-> self node-list data (-> s2-0 s3-1))) (vector<-cspace! (-> gp-1 vector 2) (-> self node-list data (+ (-> s2-0 s3-1) 1))) (vector<-cspace! (-> gp-1 trans) (-> (the-as process-drawable s5-0) node-list data 8)) @@ -101,38 +100,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 ) ) ) @@ -150,51 +128,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) + ) ) ) ) @@ -250,11 +228,11 @@ ;; WARN: Return type mismatch object vs none. (defmethod init-from-entity! ((this prsn-hang-cell) (arg0 entity-actor)) "Typically the method that does the initial setup on the process, potentially using the [[entity-actor]] provided as part of that. -This commonly includes things such as: -- stack size -- collision information -- loading the skeleton group / bones -- sounds" + This commonly includes things such as: + - stack size + - collision information + - loading the skeleton group / bones + - sounds" (set! (-> this root) (new 'process 'trsqv)) (process-drawable-from-entity! this arg0) (initialize-skeleton @@ -399,11 +377,11 @@ This commonly includes things such as: ;; WARN: Return type mismatch object vs none. (defmethod init-from-entity! ((this prsn-cell-door) (arg0 entity-actor)) "Typically the method that does the initial setup on the process, potentially using the [[entity-actor]] provided as part of that. -This commonly includes things such as: -- stack size -- collision information -- loading the skeleton group / bones -- sounds" + This commonly includes things such as: + - stack size + - collision information + - loading the skeleton group / bones + - sounds" (let ((s4-0 (new 'process 'collide-shape this (collide-list-enum 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)) @@ -466,11 +444,11 @@ This commonly includes things such as: ;; WARN: Return type mismatch object vs none. (defmethod init-from-entity! ((this prsn-vent-fan) (arg0 entity-actor)) "Typically the method that does the initial setup on the process, potentially using the [[entity-actor]] provided as part of that. -This commonly includes things such as: -- stack size -- collision information -- loading the skeleton group / bones -- sounds" + This commonly includes things such as: + - stack size + - collision information + - loading the skeleton group / bones + - sounds" (set! (-> this root) (new 'process 'trsqv)) (process-drawable-from-entity! this arg0) (initialize-skeleton @@ -512,11 +490,11 @@ This commonly includes things such as: ;; WARN: Return type mismatch object vs none. (defmethod init-from-entity! ((this prsn-torture) (arg0 entity-actor)) "Typically the method that does the initial setup on the process, potentially using the [[entity-actor]] provided as part of that. -This commonly includes things such as: -- stack size -- collision information -- loading the skeleton group / bones -- sounds" + This commonly includes things such as: + - stack size + - collision information + - loading the skeleton group / bones + - sounds" (let ((s4-0 (new 'process 'collide-shape this (collide-list-enum usually-hit-by-player)))) (set! (-> s4-0 penetrated-by) (penetrate)) (let ((s3-0 (new 'process 'collide-shape-prim-group s4-0 (the-as uint 9) 0))) diff --git a/goal_src/jak2/levels/fortress/rescue/forresca-obs.gc b/goal_src/jak2/levels/fortress/rescue/forresca-obs.gc index c077453825..84af2e6cf1 100644 --- a/goal_src/jak2/levels/fortress/rescue/forresca-obs.gc +++ b/goal_src/jak2/levels/fortress/rescue/forresca-obs.gc @@ -220,12 +220,14 @@ (let ((a0-0 *target*)) (when (and a0-0 (< 81920.0 (vector-vector-distance (get-trans a0-0 0) (-> self root trans)))) (set! (-> self quality-enabled?) #f) - (suspend-for (seconds 0.5)) + (suspend-for (seconds 0.5) + ) (hide-hud-quick #f) (set-setting! 'entity-name "camera-243" 0.0 0) (set-setting! 'process-mask 'set 0.0 (process-mask movie enemy)) (process-grab? *target* #f) - (suspend-for (seconds 2)) + (suspend-for (seconds 2) + ) ) ) (go-virtual shutdown) @@ -318,7 +320,8 @@ ) :code (behavior () (until (-> self all-gone?) - (suspend-for (seconds 0.5)) + (suspend-for (seconds 0.5) + ) ) (set-setting! 'interp-time 'abs 0.0 0) (remove-setting! 'entity-name) @@ -368,13 +371,13 @@ (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/goal_src/jak2/levels/fortress/rescue/forrescb-obs.gc b/goal_src/jak2/levels/fortress/rescue/forrescb-obs.gc index 02972ffff4..f8b91eee54 100644 --- a/goal_src/jak2/levels/fortress/rescue/forrescb-obs.gc +++ b/goal_src/jak2/levels/fortress/rescue/forrescb-obs.gc @@ -187,12 +187,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) @@ -217,11 +211,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))) @@ -286,47 +280,19 @@ (set! (-> v1-54 action-mask) (collide-action solid semi-solid)) ) (when (>= (probe-using-line-sphere *collide-cache* s3-2) 0.0) - (let* ((s2-2 (-> s3-2 best-other-tri collide-ptr)) - (s3-3 (if (type? s2-2 collide-shape-prim-sphere) - (the-as collide-shape-prim-sphere s2-2) - ) - ) - ) + (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 @@ -525,13 +491,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/goal_src/jak2/levels/gungame/gun-dummy.gc b/goal_src/jak2/levels/gungame/gun-dummy.gc index 299305e8a1..ec78036b79 100644 --- a/goal_src/jak2/levels/gungame/gun-dummy.gc +++ b/goal_src/jak2/levels/gungame/gun-dummy.gc @@ -2061,7 +2061,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/goal_src/jak2/levels/gungame/gungame-obs.gc b/goal_src/jak2/levels/gungame/gungame-obs.gc index b685547588..d43b1da1cb 100644 --- a/goal_src/jak2/levels/gungame/gungame-obs.gc +++ b/goal_src/jak2/levels/gungame/gungame-obs.gc @@ -221,15 +221,9 @@ ) ) (set! (-> s5-1 flags) (font-flags shadow kerning middle-vert large)) - (let ((v1-4 s5-1)) - (set! (-> v1-4 width) (the float 440)) - ) - (let ((v1-5 s5-1)) - (set! (-> v1-5 height) (the float 80)) - ) - (let ((v1-6 s5-1)) - (set! (-> v1-6 scale) 0.7) - ) + (set-width! s5-1 440) + (set-height! s5-1 80) + (set-scale! s5-1 0.7) (let ((s4-0 print-game-text)) (format (clear *temp-string*) (lookup-text! *common-text* arg0 #f)) (s4-0 *temp-string* s5-1 #f 44 (bucket-id progress)) @@ -1885,27 +1879,13 @@ ) (defmethod training-manager-method-26 ((this training-manager)) - (local-vars (s3-0 object)) (let ((gp-0 0)) (dotimes (s4-0 (-> *entrance-gungame-crates-pos* length)) (if (and (handle->process (-> this entrance-crates s4-0)) - (begin - (let* ((s3-1 #t) - (s2-0 (-> this entrance-crates s4-0 process 0)) - (v1-11 (the-as focus-status (logand (-> (if (type? s2-0 process-focusable) - (the-as process-focusable s2-0) - ) - focus-status - ) - (focus-status dead) - ) - ) - ) - ) - (cmove-#f-nonzero s3-0 v1-11 s3-1) - ) - s3-0 - ) + (not (logtest? (-> (as-type (-> this entrance-crates s4-0 process 0) process-focusable) focus-status) + (focus-status dead) + ) + ) ) (+! gp-0 1) ) @@ -1957,7 +1937,7 @@ ) (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)) @@ -1980,17 +1960,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)) @@ -2009,11 +1992,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)) ) ) ) @@ -2055,12 +2034,10 @@ (training-manager-method-29 this s4-0) (set! (-> s3-0 pickup-type) (-> arg0 s2-0 ammo)) (set! (-> s3-0 pickup-spawn-amount) (the float (-> arg0 s2-0 num))) - (let* ((s0-0 (ppointer->process (process-spawn crate #f s4-0 'wood s3-0 :to *entity-pool*))) - (s1-1 (if (type? s0-0 process-focusable) - (the-as process-focusable s0-0) - ) - ) - ) + (let ((s1-1 + (as-type (ppointer->process (process-spawn crate #f s4-0 'wood s3-0 :to *entity-pool*)) process-focusable) + ) + ) (quaternion-vector-angle! (-> s1-1 root quat) *up-vector* (+ -4551.1113 (-> arg0 s2-0 pos w))) (set! (-> this course-crates s2-0) (process->handle s1-1)) ) @@ -2145,10 +2122,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/goal_src/jak2/levels/hiphog/whack.gc b/goal_src/jak2/levels/hiphog/whack.gc index a84eea36a5..f019b6fdcb 100644 --- a/goal_src/jak2/levels/hiphog/whack.gc +++ b/goal_src/jak2/levels/hiphog/whack.gc @@ -2139,14 +2139,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 @@ -2167,50 +2159,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/goal_src/jak2/levels/intro/intro-scenes.gc b/goal_src/jak2/levels/intro/intro-scenes.gc index 28623c942a..fba2c6ce9e 100644 --- a/goal_src/jak2/levels/intro/intro-scenes.gc +++ b/goal_src/jak2/levels/intro/intro-scenes.gc @@ -3480,43 +3480,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/goal_src/jak2/levels/mountain/mountain-obs.gc b/goal_src/jak2/levels/mountain/mountain-obs.gc index 7b7b2d6c31..721b279614 100644 --- a/goal_src/jak2/levels/mountain/mountain-obs.gc +++ b/goal_src/jak2/levels/mountain/mountain-obs.gc @@ -409,7 +409,6 @@ ) (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) @@ -424,92 +423,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) ) ) ) @@ -694,7 +690,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) @@ -760,14 +755,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)))) ) ) ) @@ -998,19 +988,6 @@ ) (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) @@ -1041,25 +1018,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))) + ) ) ) ) @@ -1098,61 +1074,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))) @@ -1165,31 +1146,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) @@ -2206,7 +2181,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))) @@ -2221,53 +2195,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) ) ) ) @@ -2280,7 +2258,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)) @@ -2348,19 +2325,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/goal_src/jak2/levels/mountain/mountain-scenes.gc b/goal_src/jak2/levels/mountain/mountain-scenes.gc index e6f8111b0a..81d7e112bb 100644 --- a/goal_src/jak2/levels/mountain/mountain-scenes.gc +++ b/goal_src/jak2/levels/mountain/mountain-scenes.gc @@ -3071,7 +3071,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)) @@ -3086,23 +3085,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)) ) @@ -3151,7 +3145,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)) @@ -3184,23 +3177,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)) ) @@ -3249,7 +3237,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)) @@ -3289,23 +3276,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/goal_src/jak2/levels/mountain/rhino.gc b/goal_src/jak2/levels/mountain/rhino.gc index db1fbc8853..ac749c568b 100644 --- a/goal_src/jak2/levels/mountain/rhino.gc +++ b/goal_src/jak2/levels/mountain/rhino.gc @@ -364,20 +364,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) @@ -453,78 +439,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/goal_src/jak2/levels/nest/boss/metalkor-extras.gc b/goal_src/jak2/levels/nest/boss/metalkor-extras.gc index 7192813e06..141c16d577 100644 --- a/goal_src/jak2/levels/nest/boss/metalkor-extras.gc +++ b/goal_src/jak2/levels/nest/boss/metalkor-extras.gc @@ -129,40 +129,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) @@ -171,9 +165,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) @@ -289,11 +281,6 @@ (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)) @@ -358,37 +345,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") @@ -509,7 +476,6 @@ ) (defbehavior metalkor-update-ik metalkor-legs () - (local-vars (sv-736 vector)) (rlet ((acc :class vf) (vf0 :class vf) (vf4 :class vf) @@ -612,22 +578,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) @@ -1156,11 +1115,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) @@ -2091,49 +2046,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/goal_src/jak2/levels/nest/boss/metalkor-setup.gc b/goal_src/jak2/levels/nest/boss/metalkor-setup.gc index 476ac0ba28..59cb003782 100644 --- a/goal_src/jak2/levels/nest/boss/metalkor-setup.gc +++ b/goal_src/jak2/levels/nest/boss/metalkor-setup.gc @@ -837,87 +837,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)) - ) - ;; og:preserve-this inlined vector-dot - ; (.mula.s f1-0 f4-0) - ; (.madda.s f2-0 f5-0) - ; (.madd.s f1-1 f3-0 f6-0) - (set! f1-1 (+ (* f1-0 f4-0) (* f2-0 f5-0) (* 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) ) @@ -1467,7 +1446,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) @@ -1557,8 +1535,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/goal_src/jak2/levels/nest/boss/metalkor-states.gc b/goal_src/jak2/levels/nest/boss/metalkor-states.gc index 98558437a5..67bf739ed0 100644 --- a/goal_src/jak2/levels/nest/boss/metalkor-states.gc +++ b/goal_src/jak2/levels/nest/boss/metalkor-states.gc @@ -203,9 +203,9 @@ ;; WARN: Check prologue - tricky store of r0 (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) @@ -256,12 +256,7 @@ ) ) (when (nonzero? (-> self neck)) - (let* ((gp-0 *target*) - (a0-20 (if (type? gp-0 process-focusable) - gp-0 - ) - ) - ) + (let ((a0-20 (the-as target (as-type *target* process-focusable)))) (if a0-20 (target-set! (-> self neck) (get-trans a0-20 2)) ) @@ -503,7 +498,7 @@ ) (attack-info-method-9 arg0 s1-1 arg1 self) (vector-flatten! (-> s1-1 trans) (-> s1-1 trans) (-> s2-1 vector 1)) - (let ((f30-2 (fmax -1.0 (fmin 1.0 (+ f30-1 (vector-dot (-> s1-1 trans) (the-as vector (-> s2-1 vector)))))))) + (let ((f30-2 (fmax -1.0 (fmin 1.0 (+ f30-1 (vector-dot (-> s1-1 trans) (-> s2-1 vector 0))))))) (set! f30-2 (cond ((>= f30-2 0.0) (ja :chan 1 :group! arg3 :num! min) @@ -663,39 +658,28 @@ (if (logtest? (attack-mask damage) (-> (the-as attack-info s5-2) mask)) (set! f28-0 (-> (the-as attack-info s5-2) damage)) ) - (let* ((s4-1 arg0) - (f0-4 (cond - ((if (type? s4-1 gun-blue-shot) - s4-1 - ) - (if (= (-> self stage) 3) - (* 0.0012 f28-0) - (* 0.0024 f28-0) - ) - ) - (else - (let ((s4-2 arg0)) - (cond - ((if (type? s4-2 gun-dark-shot) - s4-2 - ) - (if (= (-> self stage) 3) - (* 0.003 f28-0) - (* 0.006 f28-0) - ) - ) - ((= (-> self stage) 3) - (/ f28-0 250) - ) - (else - (/ f28-0 125) - ) - ) + (let ((f0-4 (cond + ((the-as process (as-type arg0 gun-blue-shot)) + (if (= (-> self stage) 3) + (* 0.0012 f28-0) + (* 0.0024 f28-0) ) - ) ) - ) - ) + ((the-as process (as-type arg0 gun-dark-shot)) + (if (= (-> self stage) 3) + (* 0.003 f28-0) + (* 0.006 f28-0) + ) + ) + ((= (-> self stage) 3) + (/ f28-0 250) + ) + (else + (/ f28-0 125) + ) + ) + ) + ) (if (and (logtest? (attack-mask penetrate-using) (-> (the-as attack-info s5-2) mask)) (logtest? (penetrate dark-bomb) (-> (the-as attack-info s5-2) penetrate-using)) ) @@ -794,19 +778,14 @@ (-> self root) (the-as uint 1) ) - (let* ((s4-3 arg0) - (gp-5 (if (type? s4-3 process-focusable) - s4-3 - ) - ) - ) + (let ((gp-5 (the-as process (as-type arg0 process-focusable)))) (when gp-5 (let ((s3-0 (quaternion->matrix (new 'stack-no-clear 'matrix) (-> self root quat))) (s4-4 (new 'stack-no-clear 'vector)) ) (if (>= (metalkor-ja-float-group? (the-as art-joint-anim metalkor-attack-sweep-left-ja)) 0) - (vector+! s4-4 (-> s3-0 vector 2) (the-as vector (-> s3-0 vector))) - (vector-! s4-4 (-> s3-0 vector 2) (the-as vector (-> s3-0 vector))) + (vector+! s4-4 (-> s3-0 vector 2) (-> s3-0 vector 0)) + (vector-! s4-4 (-> s3-0 vector 2) (-> s3-0 vector 0)) ) (set! (-> s4-4 y) 0.0) (vector-normalize! s4-4 32768.0) @@ -938,7 +917,7 @@ (matrix*! gp-0 s5-0 s4-0) (matrix-remove-z-rot gp-0 (new 'static 'vector :y -1.0)) (set! (-> self last-rotation) (acos (vector-dot (-> s5-0 vector 2) (-> gp-0 vector 2)))) - (if (< (vector-dot (-> gp-0 vector 2) (the-as vector (-> s5-0 vector))) 0.0) + (if (< (vector-dot (-> gp-0 vector 2) (-> s5-0 vector 0)) 0.0) (set! (-> self last-rotation) (- (-> self last-rotation))) ) (cond @@ -1198,7 +1177,7 @@ ) (let ((f28-0 (ja-aframe-num 0))) (set! (-> self target-angle) f26-0) - (if (< 0.0 (vector-dot s4-0 (the-as vector (-> gp-0 vector)))) + (if (< 0.0 (vector-dot s4-0 (-> gp-0 vector 0))) (set! f26-0 (- f26-0)) ) (let ((v1-12 (ja-group))) @@ -1515,10 +1494,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 +1638,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 +1654,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) ) ) ) @@ -1937,7 +1905,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) @@ -1954,120 +1922,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)) @@ -2141,7 +2102,7 @@ ) (vector-flatten! gp-1 gp-1 (-> s5-0 vector 1)) (cond - ((< (vector-dot gp-1 (the-as vector (-> s5-0 vector))) 0.0) + ((< (vector-dot gp-1 (-> s5-0 vector 0)) 0.0) (metalkor-ja-float (the-as art-joint-anim metalkor-attack-sweep-right-ja) 1.0 1.0 4.0) (metalkor-set-deadly self #t 2) ) @@ -2222,9 +2183,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) @@ -2439,7 +2398,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) @@ -2461,8 +2419,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) @@ -2719,10 +2678,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/goal_src/jak2/levels/nest/boss/nestb-scenes.gc b/goal_src/jak2/levels/nest/boss/nestb-scenes.gc index f164c091e0..354764242f 100644 --- a/goal_src/jak2/levels/nest/boss/nestb-scenes.gc +++ b/goal_src/jak2/levels/nest/boss/nestb-scenes.gc @@ -431,11 +431,6 @@ ) (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)) ) @@ -499,36 +494,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/goal_src/jak2/levels/nest/flying-spider.gc b/goal_src/jak2/levels/nest/flying-spider.gc index e590ee2fe6..c2d8e3de49 100644 --- a/goal_src/jak2/levels/nest/flying-spider.gc +++ b/goal_src/jak2/levels/nest/flying-spider.gc @@ -530,7 +530,7 @@ (defmethod general-event-handler ((this flying-spider) (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" + @TODO - unsure if there is a pattern for the events and this should have a more specific name" (case arg2 (('hit 'hit-knocked) (logclear! (-> this mask) (process-mask actor-pause)) @@ -557,11 +557,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) ) @@ -597,9 +593,9 @@ (defmethod common-post ((this flying-spider)) "Does a lot of various things relating to interacting with the target -- tracks when the enemy was last drawn -- looks at the target and handles attacking -@TODO Not extremely well understood yet" + - tracks when the enemy was last drawn + - looks at the target and handles attacking + @TODO Not extremely well understood yet" ((method-of-type nav-enemy common-post) this) (none) ) @@ -629,8 +625,8 @@ (vector-reset! s5-1) (dotimes (s4-1 (-> *collide-cache* num-tris)) (let* ((v1-16 (-> *collide-cache* tris s4-1)) - (s2-1 (vector-! (new 'stack-no-clear 'vector) (-> v1-16 vertex 1) (the-as vector (-> v1-16 vertex)))) - (s1-1 (vector-! (new 'stack-no-clear 'vector) (-> v1-16 vertex 2) (the-as vector (-> v1-16 vertex)))) + (s2-1 (vector-! (new 'stack-no-clear 'vector) (-> v1-16 vertex 1) (-> v1-16 vertex 0))) + (s1-1 (vector-! (new 'stack-no-clear 'vector) (-> v1-16 vertex 2) (-> v1-16 vertex 0))) (s3-0 (new 'stack-no-clear 'vector)) ) (vector-normalize! s2-1 1.0) @@ -694,7 +690,7 @@ (defmethod look-at-target! ((this flying-spider) (arg0 enemy-flag)) "Logic for looking at the target that is locked on, sets some flags and adjusts the neck to look at the target if available -@param flag Reacts to [[enemy-flag::death-start]] and [[enemy-flag::enable-on-active]], see implementation for details" + @param flag Reacts to [[enemy-flag::death-start]] and [[enemy-flag::enable-on-active]], see implementation for details" 0 (none) ) @@ -702,7 +698,7 @@ ;; WARN: Return type mismatch int vs penetrate. (defmethod get-penetrate-info ((this flying-spider)) "@returns the allowed way(s) this enemy can take damage -@see [[penetrate]] and [[penetrated-by-all&hit-points->penetrated-by]]" + @see [[penetrate]] and [[penetrated-by-all&hit-points->penetrated-by]]" (the-as penetrate 0) ) diff --git a/goal_src/jak2/levels/nest/mammoth.gc b/goal_src/jak2/levels/nest/mammoth.gc index ab1c0a00b6..be444c2764 100644 --- a/goal_src/jak2/levels/nest/mammoth.gc +++ b/goal_src/jak2/levels/nest/mammoth.gc @@ -229,8 +229,8 @@ ;; WARN: Return type mismatch object vs none. (defbehavior mammoth-walk-check-end mammoth () - (let ((a1-1 (vector-! (new 'stack-no-clear 'vector) (-> self move-pos 1) (the-as vector (-> self move-pos)))) - (gp-1 (vector-! (new 'stack-no-clear 'vector) (-> self root trans) (the-as vector (-> self move-pos)))) + (let ((a1-1 (vector-! (new 'stack-no-clear 'vector) (-> self move-pos 1) (-> self move-pos 0))) + (gp-1 (vector-! (new 'stack-no-clear 'vector) (-> self root trans) (-> self move-pos 0))) ) (if (< (vector-length a1-1) (vector-dot gp-1 (vector-normalize-copy! (new 'stack-no-clear 'vector) a1-1 1.0))) (go-virtual turning) @@ -267,17 +267,12 @@ ) (defbehavior set-nav-destination mammoth () - (let ((s5-1 (vector-! (new 'stack-no-clear 'vector) (-> self move-pos 1) (the-as vector (-> self move-pos)))) + (let ((s5-1 (vector-! (new 'stack-no-clear 'vector) (-> self move-pos 1) (-> self move-pos 0))) (s4-0 (new 'stack-no-clear 'vector)) (gp-0 (new 'stack-no-clear 'vector)) ) (vector-normalize! s5-1 65536.0) - (vector-line-distance-point! - (-> self root trans) - (the-as vector (-> self move-pos)) - (-> self move-pos 1) - s4-0 - ) + (vector-line-distance-point! (-> self root trans) (-> self move-pos 0) (-> self move-pos 1) s4-0) (vector+! gp-0 s4-0 s5-1) (cloest-point-on-mesh (-> self nav) gp-0 gp-0 (the-as nav-poly #f)) (set! (-> self travel-dest quad) (-> gp-0 quad)) @@ -683,7 +678,7 @@ (defmethod general-event-handler ((this mammoth) (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" + @TODO - unsure if there is a pattern for the events and this should have a more specific name" (case arg2 (('hit) (logclear! (-> this mask) (process-mask actor-pause)) @@ -816,8 +811,8 @@ (vector-reset! s4-1) (dotimes (s3-1 (-> *collide-cache* num-tris)) (let* ((v1-15 (-> *collide-cache* tris s3-1)) - (s1-1 (vector-! (new 'stack-no-clear 'vector) (-> v1-15 vertex 1) (the-as vector (-> v1-15 vertex)))) - (s0-1 (vector-! (new 'stack-no-clear 'vector) (-> v1-15 vertex 2) (the-as vector (-> v1-15 vertex)))) + (s1-1 (vector-! (new 'stack-no-clear 'vector) (-> v1-15 vertex 1) (-> v1-15 vertex 0))) + (s0-1 (vector-! (new 'stack-no-clear 'vector) (-> v1-15 vertex 2) (-> v1-15 vertex 0))) (s2-2 (new 'stack-no-clear 'vector)) ) (vector-normalize! s1-1 1.0) @@ -871,7 +866,7 @@ ) ) (if (and (logtest? (-> this foot-flags) 1) (logtest? (-> this foot-flags) 2)) - (s0-0 s5-0 s1-0 (the-as vector (-> this foot-pos)) (-> this foot-pos 1)) + (s0-0 s5-0 s1-0 (-> this foot-pos 0) (-> this foot-pos 1)) ) (if (and (logtest? (-> this foot-flags) 2) (logtest? (-> this foot-flags) 4)) (s0-0 s4-0 s1-0 (-> this foot-pos 1) (-> this foot-pos 2)) @@ -880,7 +875,7 @@ (s0-0 s4-0 s1-0 (-> this foot-pos 2) (-> this foot-pos 3)) ) (if (and (logtest? (-> this foot-flags) 8) (logtest? (-> this foot-flags) 1)) - (s0-0 s4-0 s1-0 (-> this foot-pos 3) (the-as vector (-> this foot-pos))) + (s0-0 s4-0 s1-0 (-> this foot-pos 3) (-> this foot-pos 0)) ) ) (vector+! s5-0 s5-0 s4-0) @@ -1072,7 +1067,6 @@ ) (defbehavior mammoth-update-ik mammoth () - (local-vars (sv-688 vector)) (rlet ((acc :class vf) (vf0 :class vf) (vf4 :class vf) @@ -1091,11 +1085,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) @@ -1123,7 +1115,7 @@ (set! (-> a0-6 y) 14336.0) (set! (-> a0-6 z) 10240.0) (set! (-> a0-6 w) 1.0) - (vector-! (the-as vector a1-2) v1-7 a0-6) + (vector-! (-> a1-2 min) v1-7 a0-6) ) (let ((a1-4 (-> gp-0 bbox max)) (v1-8 s0-0) @@ -1157,11 +1149,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)) @@ -1257,7 +1245,7 @@ (set! (-> a0-4 y) 16384.0) (set! (-> a0-4 z) 16384.0) (set! (-> a0-4 w) 1.0) - (vector-! (the-as vector a1-5) v1-13 a0-4) + (vector-! (-> a1-5 min) v1-13 a0-4) ) (let ((a1-7 (-> s2-0 bbox max)) (v1-14 s4-0) @@ -1333,10 +1321,9 @@ (defmethod common-post ((this mammoth)) "Does a lot of various things relating to interacting with the target -- 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)) + - tracks when the enemy was last drawn + - looks at the target and handles attacking + @TODO Not extremely well understood yet" (let ((t9-0 (method-of-type nav-enemy common-post))) (t9-0 this) ) @@ -1430,41 +1417,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) @@ -1485,13 +1447,13 @@ #f ) -(defmethod relocate ((this mammoth) (arg0 int)) +(defmethod relocate ((this mammoth) (offset int)) (dotimes (v1-0 4) (if (nonzero? (-> this joint-ik v1-0)) - (&+! (-> this joint-ik v1-0) arg0) + (&+! (-> this joint-ik v1-0) offset) ) ) - (call-parent-method this arg0) + (call-parent-method this offset) ) (defmethod init-enemy-collision! ((this mammoth)) diff --git a/goal_src/jak2/levels/nest/mantis.gc b/goal_src/jak2/levels/nest/mantis.gc index 319d093ad9..b43462c232 100644 --- a/goal_src/jak2/levels/nest/mantis.gc +++ b/goal_src/jak2/levels/nest/mantis.gc @@ -1180,11 +1180,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/goal_src/jak2/levels/palace/boss/squid-extras.gc b/goal_src/jak2/levels/palace/boss/squid-extras.gc index 66ebb67987..110bbadd1c 100644 --- a/goal_src/jak2/levels/palace/boss/squid-extras.gc +++ b/goal_src/jak2/levels/palace/boss/squid-extras.gc @@ -153,7 +153,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) @@ -389,11 +389,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/goal_src/jak2/levels/palace/boss/squid-setup.gc b/goal_src/jak2/levels/palace/boss/squid-setup.gc index 26ffa2b94d..8ab5b552a2 100644 --- a/goal_src/jak2/levels/palace/boss/squid-setup.gc +++ b/goal_src/jak2/levels/palace/boss/squid-setup.gc @@ -615,40 +615,7 @@ ) (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) @@ -690,368 +657,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 ) ) @@ -1238,89 +1207,27 @@ ;; 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)) ) ) ) @@ -1329,7 +1236,6 @@ ) (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)))) @@ -1343,8 +1249,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)) @@ -1883,17 +1790,6 @@ ) (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) @@ -1906,27 +1802,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)) @@ -1945,47 +1841,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) @@ -1996,29 +1884,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) @@ -2026,26 +1914,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)) ) ) ) @@ -2296,13 +2184,7 @@ ;; 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")) @@ -2315,9 +2197,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) @@ -2561,33 +2441,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/goal_src/jak2/levels/palace/boss/squid-states.gc b/goal_src/jak2/levels/palace/boss/squid-states.gc index 50848822d9..570865517c 100644 --- a/goal_src/jak2/levels/palace/boss/squid-states.gc +++ b/goal_src/jak2/levels/palace/boss/squid-states.gc @@ -251,9 +251,9 @@ ;; WARN: Check prologue - tricky store of r0 ;; 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)) @@ -527,20 +527,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) @@ -558,109 +544,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)) ) ) ) @@ -980,11 +888,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) ) @@ -1656,18 +1560,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/goal_src/jak2/levels/palace/cable/palcab-obs.gc b/goal_src/jak2/levels/palace/cable/palcab-obs.gc index c40ce6c1b3..792c9164aa 100644 --- a/goal_src/jak2/levels/palace/cable/palcab-obs.gc +++ b/goal_src/jak2/levels/palace/cable/palcab-obs.gc @@ -110,7 +110,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))) @@ -136,16 +135,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) + ) ) ) ) @@ -736,7 +737,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/goal_src/jak2/levels/ruins/pillar-collapse.gc b/goal_src/jak2/levels/ruins/pillar-collapse.gc index e812934e45..3d12bf707c 100644 --- a/goal_src/jak2/levels/ruins/pillar-collapse.gc +++ b/goal_src/jak2/levels/ruins/pillar-collapse.gc @@ -161,11 +161,7 @@ (case message (('touch 'attack) (let* ((s5-0 (-> block param 0)) - (s4-0 proc) - (gp-0 (if (type? s4-0 process-focusable) - s4-0 - ) - ) + (gp-0 (the-as process (as-type proc process-focusable))) (a1-4 (if s5-0 ((method-of-type touching-shapes-entry prims-touching?) (the-as touching-shapes-entry s5-0) @@ -235,7 +231,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) @@ -294,28 +289,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/goal_src/jak2/levels/ruins/rapid-gunner.gc b/goal_src/jak2/levels/ruins/rapid-gunner.gc index f6472df568..b120b7b806 100644 --- a/goal_src/jak2/levels/ruins/rapid-gunner.gc +++ b/goal_src/jak2/levels/ruins/rapid-gunner.gc @@ -630,12 +630,7 @@ (set! (-> v1-28 target-speed) 0.0) ) 0 - (let* ((gp-1 (handle->process (-> self focus handle))) - (a0-14 (if (type? gp-1 process-focusable) - gp-1 - ) - ) - ) + (let ((a0-14 (the-as process (as-type (handle->process (-> self focus handle)) process-focusable)))) (when a0-14 (let ((v1-34 (get-trans (the-as process-focusable a0-14) 3))) (set! (-> self target-next-pos quad) (-> v1-34 quad)) @@ -1420,7 +1415,6 @@ (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) @@ -1463,8 +1457,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/goal_src/jak2/levels/ruins/ruins-obs.gc b/goal_src/jak2/levels/ruins/ruins-obs.gc index a7ac681771..fa10dd95a2 100644 --- a/goal_src/jak2/levels/ruins/ruins-obs.gc +++ b/goal_src/jak2/levels/ruins/ruins-obs.gc @@ -148,13 +148,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 ) @@ -178,11 +174,11 @@ ;; WARN: Return type mismatch object vs none. (defmethod init-from-entity! ((this beam) (arg0 entity-actor)) "Typically the method that does the initial setup on the process, potentially using the [[entity-actor]] provided as part of that. -This commonly includes things such as: -- stack size -- collision information -- loading the skeleton group / bones -- sounds" + This commonly includes things such as: + - stack size + - collision information + - loading the skeleton group / bones + - sounds" (set! (-> this root) (new 'process 'trsqv)) (process-drawable-from-entity! this arg0) (initialize-skeleton @@ -216,8 +212,8 @@ This commonly includes things such as: (defmethod start-bouncing! ((this ruins-bridge)) "Sets `bouncing` to [[#t]] and sets up the clock to periodically bounce -and translate the platform via the `smush` -@see [[smush-control]]" + and translate the platform via the `smush` + @see [[smush-control]]" (logclear! (-> this mask) (process-mask sleep)) (logclear! (-> this mask) (process-mask sleep-code)) 0 @@ -277,11 +273,11 @@ and translate the platform via the `smush` ;; WARN: Return type mismatch object vs none. (defmethod init-from-entity! ((this ruins-bridge) (arg0 entity-actor)) "Typically the method that does the initial setup on the process, potentially using the [[entity-actor]] provided as part of that. -This commonly includes things such as: -- stack size -- collision information -- loading the skeleton group / bones -- sounds" + This commonly includes things such as: + - stack size + - collision information + - loading the skeleton group / bones + - sounds" (stack-size-set! (-> this main-thread) 512) (let ((s4-0 (new 'process 'collide-shape-moving this (collide-list-enum hit-by-player)))) (set! (-> s4-0 dynam) (copy *standard-dynamics* 'process)) @@ -406,8 +402,8 @@ This commonly includes things such as: (defmethod start-bouncing! ((this ruins-drop-plat)) "Sets `bouncing` to [[#t]] and sets up the clock to periodically bounce -and translate the platform via the `smush` -@see [[smush-control]]" + and translate the platform via the `smush` + @see [[smush-control]]" (activate! (-> this smush) -1.0 60 150 1.0 1.0 (-> self clock)) (set-time! (-> this bounce-time)) (set! (-> this bouncing) #t) @@ -498,11 +494,11 @@ and translate the platform via the `smush` ;; WARN: Return type mismatch object vs none. (defmethod init-from-entity! ((this ruins-drop-plat) (arg0 entity-actor)) "Typically the method that does the initial setup on the process, potentially using the [[entity-actor]] provided as part of that. -This commonly includes things such as: -- stack size -- collision information -- loading the skeleton group / bones -- sounds" + This commonly includes things such as: + - stack size + - collision information + - loading the skeleton group / bones + - sounds" (stack-size-set! (-> this main-thread) 512) (let ((s4-0 (new 'process 'collide-shape-moving this (collide-list-enum hit-by-player)))) (set! (-> s4-0 dynam) (copy *standard-dynamics* 'process)) diff --git a/goal_src/jak2/levels/sewer/hosehead-fake.gc b/goal_src/jak2/levels/sewer/hosehead-fake.gc index 568452f7b3..151d5d10a9 100644 --- a/goal_src/jak2/levels/sewer/hosehead-fake.gc +++ b/goal_src/jak2/levels/sewer/hosehead-fake.gc @@ -250,11 +250,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/goal_src/jak2/levels/sewer/hosehead.gc b/goal_src/jak2/levels/sewer/hosehead.gc index 298796deac..e084574660 100644 --- a/goal_src/jak2/levels/sewer/hosehead.gc +++ b/goal_src/jak2/levels/sewer/hosehead.gc @@ -698,12 +698,7 @@ (let ((f0-7 (fill-and-probe-using-line-sphere *collide-cache* s3-0))) (when (>= f0-7 0.0) (vector-float*! s5-0 s5-0 f0-7) - (let* ((s2-2 (-> s3-0 best-other-tri collide-ptr)) - (s3-1 (if (type? s2-2 collide-shape-prim) - s2-2 - ) - ) - ) + (let ((s3-1 (the-as basic (as-type (-> s3-0 best-other-tri collide-ptr) collide-shape-prim)))) (when s3-1 (if (logtest? (-> (the-as collide-shape-prim s3-1) prim-core collide-as) (collide-spec enemy)) (go-hostile this) @@ -1115,14 +1110,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)) ) ) ) @@ -1156,14 +1147,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)) ) ) ) @@ -1181,16 +1168,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) + ) ) ) ) @@ -1393,7 +1379,6 @@ ;; 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) @@ -1443,18 +1428,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))) @@ -1465,12 +1453,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)) ) @@ -1491,7 +1479,6 @@ :virtual #t :event enemy-event-handler :enter (behavior () - (local-vars (sv-688 vector)) (rlet ((acc :class vf) (vf0 :class vf) (vf4 :class vf) @@ -1545,28 +1532,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)) @@ -1950,9 +1938,8 @@ ) (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)) @@ -2030,7 +2017,7 @@ (set! (-> a1-0 y) 14336.0) (set! (-> a1-0 z) 14336.0) (set! (-> a1-0 w) 1.0) - (vector-! (the-as vector v1-0) a0-2 a1-0) + (vector-! (-> v1-0 min) a0-2 a1-0) ) (let ((v1-2 (-> s5-0 bbox max)) (a0-4 (-> this root trans)) @@ -2196,7 +2183,6 @@ (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 @@ -2204,8 +2190,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)) @@ -2260,8 +2247,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/goal_src/jak2/levels/sewer/sewer-obs.gc b/goal_src/jak2/levels/sewer/sewer-obs.gc index 1431a2da6e..818a563bf4 100644 --- a/goal_src/jak2/levels/sewer/sewer-obs.gc +++ b/goal_src/jak2/levels/sewer/sewer-obs.gc @@ -72,12 +72,7 @@ :event (behavior ((proc process) (argc int) (message symbol) (block event-message-block)) (case message (('touch 'attack) - (let* ((_proc proc) - (hit-proc (if (type? _proc process-focusable) - (the-as process-focusable _proc) - ) - ) - ) + (let ((hit-proc (as-type proc process-focusable))) (when hit-proc (let ((hit-direction (vector-! (new 'stack-no-clear 'vector) (-> hit-proc root trans) (-> self root trans))) (v1-5 (vector-x-quaternion! (new 'stack-no-clear 'vector) (-> self root quat))) @@ -116,11 +111,11 @@ ;; WARN: Return type mismatch object vs none. (defmethod init-from-entity! ((this sew-single-blade) (arg0 entity-actor)) "Typically the method that does the initial setup on the process, potentially using the [[entity-actor]] provided as part of that. -This commonly includes things such as: -- stack size -- collision information -- loading the skeleton group / bones -- sounds" + This commonly includes things such as: + - stack size + - collision information + - loading the skeleton group / bones + - sounds" (logior! (-> this mask) (process-mask ambient)) (let ((cshape (new 'process 'collide-shape-moving this (collide-list-enum usually-hit-by-player)))) (set! (-> cshape dynam) (copy *standard-dynamics* 'process)) @@ -216,12 +211,7 @@ This commonly includes things such as: :event (behavior ((proc process) (argc int) (message symbol) (block event-message-block)) (case message (('touch 'attack) - (let* ((_proc proc) - (hit-proc (if (type? _proc process-focusable) - _proc - ) - ) - ) + (let ((hit-proc (the-as process (as-type proc process-focusable)))) (if hit-proc (send-event hit-proc @@ -299,11 +289,11 @@ This commonly includes things such as: ;; WARN: Return type mismatch object vs none. (defmethod init-from-entity! ((this sew-tri-blade) (entity entity-actor)) "Typically the method that does the initial setup on the process, potentially using the [[entity-actor]] provided as part of that. -This commonly includes things such as: -- stack size -- collision information -- loading the skeleton group / bones -- sounds" + This commonly includes things such as: + - stack size + - collision information + - loading the skeleton group / bones + - sounds" (logior! (-> this mask) (process-mask ambient)) (let ((cshape (new 'process 'collide-shape-moving this (collide-list-enum usually-hit-by-player)))) (set! (-> cshape dynam) (copy *standard-dynamics* 'process)) @@ -397,12 +387,7 @@ This commonly includes things such as: :event (behavior ((proc process) (argc int) (message symbol) (block event-message-block)) (case message (('touch 'attack) - (let* ((s5-0 proc) - (a0-2 (if (type? s5-0 process-focusable) - s5-0 - ) - ) - ) + (let ((a0-2 (the-as process (as-type proc process-focusable)))) (if a0-2 (send-event a0-2 @@ -434,11 +419,11 @@ This commonly includes things such as: ;; WARN: Return type mismatch object vs none. (defmethod init-from-entity! ((this sew-arm-blade) (entity entity-actor)) "Typically the method that does the initial setup on the process, potentially using the [[entity-actor]] provided as part of that. -This commonly includes things such as: -- stack size -- collision information -- loading the skeleton group / bones -- sounds" + This commonly includes things such as: + - stack size + - collision information + - loading the skeleton group / bones + - sounds" (logior! (-> this mask) (process-mask ambient)) (let ((cshape (new 'process 'collide-shape-moving this (collide-list-enum usually-hit-by-player)))) (set! (-> cshape dynam) (copy *standard-dynamics* 'process)) @@ -505,12 +490,7 @@ This commonly includes things such as: :event (behavior ((proc process) (argc int) (message symbol) (block event-message-block)) (case message (('touch 'attack) - (let* ((_proc proc) - (hit-proc (if (type? _proc process-focusable) - (the-as process-focusable _proc) - ) - ) - ) + (let ((hit-proc (as-type proc process-focusable))) (when hit-proc (let ((hit-direction (vector-! (new 'stack-no-clear 'vector) (-> hit-proc root trans) (-> self root trans))) (v1-5 (vector-z-quaternion! (new 'stack-no-clear 'vector) (-> self root quat))) @@ -549,11 +529,11 @@ This commonly includes things such as: ;; WARN: Return type mismatch object vs none. (defmethod init-from-entity! ((this sew-multi-blade) (entity entity-actor)) "Typically the method that does the initial setup on the process, potentially using the [[entity-actor]] provided as part of that. -This commonly includes things such as: -- stack size -- collision information -- loading the skeleton group / bones -- sounds" + This commonly includes things such as: + - stack size + - collision information + - loading the skeleton group / bones + - sounds" (logior! (-> this mask) (process-mask ambient)) (let ((cshape (new 'process 'collide-shape-moving this (collide-list-enum usually-hit-by-player)))) (set! (-> cshape dynam) (copy *standard-dynamics* 'process)) @@ -622,12 +602,7 @@ This commonly includes things such as: :event (behavior ((proc process) (argc int) (message symbol) (block event-message-block)) (case message (('touch 'attack) - (let* ((_proc proc) - (hit-proc (if (type? _proc process-focusable) - (the-as process-focusable _proc) - ) - ) - ) + (let ((hit-proc (as-type proc process-focusable))) (when hit-proc (let ((hit-direction (vector-! (new 'stack-no-clear 'vector) (-> hit-proc root trans) (-> self root-overide trans))) (v1-5 (vector-z-quaternion! (new 'stack-no-clear 'vector) (-> self root-overide quat))) @@ -693,11 +668,11 @@ This commonly includes things such as: ;; WARN: Return type mismatch object vs none. (defmethod init-from-entity! ((this sew-twist-blade) (entity entity-actor)) "Typically the method that does the initial setup on the process, potentially using the [[entity-actor]] provided as part of that. -This commonly includes things such as: -- stack size -- collision information -- loading the skeleton group / bones -- sounds" + This commonly includes things such as: + - stack size + - collision information + - loading the skeleton group / bones + - sounds" (logior! (-> this mask) (process-mask ambient)) (let ((cshape (new 'process 'collide-shape-moving this (collide-list-enum usually-hit-by-player)))) (set! (-> cshape dynam) (copy *standard-dynamics* 'process)) @@ -792,13 +767,9 @@ This commonly includes things such as: (go-virtual pressed) ) (('touch 'attack) - (let* ((gp-0 (-> block param 0)) - (_proc proc) - (target-proc (if (type? _proc target) - _proc - ) - ) - ) + (let ((gp-0 (-> block param 0)) + (target-proc (the-as object (as-type proc target))) + ) (when (and gp-0 target-proc) (broadcast-to-actors self 'cue-chase) (go-virtual pressed) @@ -877,7 +848,7 @@ This commonly includes things such as: ;; WARN: Return type mismatch object vs none. (defmethod broadcast-to-actors ((this sew-light-switch) (event-type symbol)) "Broadcast event to all associated [[entity]]s via the `actor-group`s -@param `event-type` the symbol to broadcast" + @param `event-type` the symbol to broadcast" (with-pp (dotimes (group-idx (-> this actor-group-count)) (let ((group (-> this actor-group group-idx))) @@ -910,12 +881,11 @@ This commonly includes things such as: ;; WARN: Return type mismatch object vs none. (defmethod init-from-entity! ((this sew-light-switch) (entity entity-actor)) "Typically the method that does the initial setup on the process, potentially using the [[entity-actor]] provided as part of that. -This commonly includes things such as: -- stack size -- collision information -- loading the skeleton group / bones -- sounds" - (local-vars (tag res-tag)) + This commonly includes things such as: + - stack size + - collision information + - loading the skeleton group / bones + - sounds" (init-switch-collision! this) (process-drawable-from-entity! this entity) (initialize-skeleton @@ -924,8 +894,9 @@ This commonly includes things such as: (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)) @@ -974,12 +945,7 @@ This commonly includes things such as: #f ) :post (behavior () - (let* ((target *target*) - (target-proc (if (type? target process-focusable) - target - ) - ) - ) + (let ((target-proc (the-as target (as-type *target* process-focusable)))) (when target-proc (get-trans target-proc 0) (let ((switch-pressed? #f) @@ -1019,8 +985,8 @@ This commonly includes things such as: (defmethod press! ((this sew-light-control) (switched-on? symbol) (should-turret-flash? symbol)) "Turns the lights on (or off) -@param switched-on? Should the sewer lights be turned on or off? -@param should-turret-flash? Should the turret have it's `flash` set as well" + @param switched-on? Should the sewer lights be turned on or off? + @param should-turret-flash? Should the turret have it's `flash` set as well" (set-sewer-lights-flag! switched-on?) (if should-turret-flash? (set-sewer-turret-flash!) @@ -1030,8 +996,8 @@ This commonly includes things such as: ;; WARN: Return type mismatch object vs none. (defbehavior sew-light-control-init-by-other sew-light-control ((switch entity-actor) (turret entity-actor)) "Creates a [[sew-light-control]] given two entities for the turret and switch itself -@param switch The entity for the switch -@param turret The entity for the turret" + @param switch The entity for the switch + @param turret The entity for the turret" (process-entity-set! self switch) (set! (-> *game-info* controller 0) (process->handle self)) (set! (-> self switch-ent) switch) @@ -1043,8 +1009,8 @@ This commonly includes things such as: (defun sewer-startup () "Basic house-keeping for starting the sewer area: -- sets up the bigmap -- spawns the first switch and turret" + - sets up the bigmap + - spawns the first switch and turret" (cond ((task-node-closed? (game-task-node sewer-board-introduction)) (set! (-> sewer bigmap-id) (bigmap-id sewer-with-board-area)) diff --git a/goal_src/jak2/levels/sewer/sewer-obs2.gc b/goal_src/jak2/levels/sewer/sewer-obs2.gc index 63d77162ec..61a6b00167 100644 --- a/goal_src/jak2/levels/sewer/sewer-obs2.gc +++ b/goal_src/jak2/levels/sewer/sewer-obs2.gc @@ -316,7 +316,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) @@ -348,13 +347,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) @@ -662,7 +663,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)) @@ -699,23 +699,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/goal_src/jak2/levels/sewer/sewer-scenes.gc b/goal_src/jak2/levels/sewer/sewer-scenes.gc index d0fa48170a..df20e3eabe 100644 --- a/goal_src/jak2/levels/sewer/sewer-scenes.gc +++ b/goal_src/jak2/levels/sewer/sewer-scenes.gc @@ -1206,13 +1206,9 @@ ) (defmethod draw ((this hud-gunturret)) - (set-hud-piece-position! - (the-as hud-sprite (-> this sprites)) - (the int (+ 457.0 (* 130.0 (-> this offset)))) - 205 - ) + (set-hud-piece-position! (-> this sprites 0) (the int (+ 457.0 (* 130.0 (-> this offset)))) 205) (format (clear (-> this strings 0 text)) "~D" (-> this values 0 current)) - (set-as-offset-from! (the-as hud-sprite (-> this strings 0 pos)) (the-as vector4w (-> this sprites)) -20 24) + (set-as-offset-from! (the-as hud-sprite (-> this strings 0 pos)) (-> this sprites 0 pos) -20 24) ((method-of-type hud draw) this) 0 (none) @@ -1278,7 +1274,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) @@ -1289,45 +1284,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/goal_src/jak2/levels/stadium/skate/skatea-obs.gc b/goal_src/jak2/levels/stadium/skate/skatea-obs.gc index b639293024..c4107bc0f3 100644 --- a/goal_src/jak2/levels/stadium/skate/skatea-obs.gc +++ b/goal_src/jak2/levels/stadium/skate/skatea-obs.gc @@ -1057,7 +1057,8 @@ ) ) ) - (suspend-for (seconds 1)) + (suspend-for (seconds 1) + ) (send-event (handle->process gp-3) 'die) ) ) @@ -1261,7 +1262,8 @@ ) ) ) - (suspend-for (seconds 1)) + (suspend-for (seconds 1) + ) (send-event (handle->process gp-2) 'die) ) ) @@ -1294,9 +1296,9 @@ - sounds" ;; og:preserve-this added (stack-size-set! (-> this main-thread) 1024) - (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/goal_src/jak2/levels/stadium/stadium-obs.gc b/goal_src/jak2/levels/stadium/stadium-obs.gc index f44a9dce1d..d184af7f4f 100644 --- a/goal_src/jak2/levels/stadium/stadium-obs.gc +++ b/goal_src/jak2/levels/stadium/stadium-obs.gc @@ -179,7 +179,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)) @@ -194,23 +193,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)) ) @@ -392,7 +386,6 @@ ) (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)) ) @@ -436,15 +429,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) @@ -466,48 +460,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))) - ) - ) ) ) ) @@ -2246,14 +2232,6 @@ (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) @@ -2269,36 +2247,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 @@ -2312,94 +2272,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/goal_src/jak2/levels/strip/chaincrate.gc b/goal_src/jak2/levels/strip/chaincrate.gc index 6f5d924322..394fb27b6a 100644 --- a/goal_src/jak2/levels/strip/chaincrate.gc +++ b/goal_src/jak2/levels/strip/chaincrate.gc @@ -322,7 +322,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)) @@ -330,8 +329,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/goal_src/jak2/levels/strip/strip-obs.gc b/goal_src/jak2/levels/strip/strip-obs.gc index 9347a2051a..dac3d728f9 100644 --- a/goal_src/jak2/levels/strip/strip-obs.gc +++ b/goal_src/jak2/levels/strip/strip-obs.gc @@ -144,7 +144,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*) @@ -157,8 +156,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)) @@ -225,7 +225,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) @@ -270,8 +269,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)) @@ -1333,7 +1333,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*))) @@ -1347,73 +1346,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)) diff --git a/goal_src/jak2/levels/title/title-obs.gc b/goal_src/jak2/levels/title/title-obs.gc index 2dab189256..8aea4ec291 100644 --- a/goal_src/jak2/levels/title/title-obs.gc +++ b/goal_src/jak2/levels/title/title-obs.gc @@ -70,50 +70,50 @@ ;; 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) @@ -496,7 +496,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 @@ -520,30 +519,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)) + ) ) - (let ((v1-35 sv-112)) - (set! (-> v1-35 width) (the float 384)) - ) - (let ((v1-36 sv-112)) - (set! (-> v1-36 height) (the float 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/goal_src/jak2/levels/tomb/tomb-obs.gc b/goal_src/jak2/levels/tomb/tomb-obs.gc index 96e1a52b93..11b869544d 100644 --- a/goal_src/jak2/levels/tomb/tomb-obs.gc +++ b/goal_src/jak2/levels/tomb/tomb-obs.gc @@ -245,7 +245,6 @@ ;; 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)) @@ -260,29 +259,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)) @@ -345,9 +344,9 @@ ) (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)) @@ -370,9 +369,9 @@ ) (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)) @@ -651,14 +650,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))) @@ -696,10 +695,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)) @@ -1088,11 +1087,11 @@ ;; WARN: Return type mismatch object vs none. (defmethod init-from-entity! ((this tomb-boss-door) (arg0 entity-actor)) "Typically the method that does the initial setup on the process, potentially using the [[entity-actor]] provided as part of that. -This commonly includes things such as: -- stack size -- collision information -- loading the skeleton group / bones -- sounds" + This commonly includes things such as: + - stack size + - collision information + - loading the skeleton group / bones + - sounds" ;; og:preserve-this added (stack-size-set! (-> this main-thread) 1024) (let ((s5-0 (new 'process 'collide-shape this (collide-list-enum usually-hit-by-player)))) @@ -1185,11 +1184,11 @@ This commonly includes things such as: ;; WARN: Return type mismatch object vs none. (defmethod init-from-entity! ((this tomb-wing-door) (arg0 entity-actor)) "Typically the method that does the initial setup on the process, potentially using the [[entity-actor]] provided as part of that. -This commonly includes things such as: -- stack size -- collision information -- loading the skeleton group / bones -- sounds" + This commonly includes things such as: + - stack size + - collision information + - loading the skeleton group / bones + - sounds" ;; og:preserve-this added (stack-size-set! (-> this main-thread) 1024) (let ((s5-0 (new 'process 'collide-shape this (collide-list-enum usually-hit-by-player)))) @@ -1721,7 +1720,6 @@ This commonly includes things such as: (set-time! (-> self state-time)) ) :code (behavior () - (local-vars (sv-96 vector)) (rlet ((acc :class vf) (vf0 :class vf) (vf4 :class vf) @@ -1745,8 +1743,8 @@ This commonly includes things such as: (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))) @@ -1783,7 +1781,6 @@ This commonly includes things such as: (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) @@ -1823,23 +1820,24 @@ This commonly includes things such as: (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/goal_src/jak2/levels/tomb/tomb-water.gc b/goal_src/jak2/levels/tomb/tomb-water.gc index 6b40af5525..eb0f168528 100644 --- a/goal_src/jak2/levels/tomb/tomb-water.gc +++ b/goal_src/jak2/levels/tomb/tomb-water.gc @@ -309,7 +309,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)) @@ -355,8 +354,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)) @@ -855,14 +855,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)) @@ -870,62 +862,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)) + ) + ) ) ) ) @@ -1012,13 +988,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))) @@ -1979,7 +1955,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))) @@ -2025,8 +2000,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)) @@ -2039,8 +2015,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/goal_src/jak2/levels/tomb/widow-baron.gc b/goal_src/jak2/levels/tomb/widow-baron.gc index 8b6fafd4de..8cb5b4501c 100644 --- a/goal_src/jak2/levels/tomb/widow-baron.gc +++ b/goal_src/jak2/levels/tomb/widow-baron.gc @@ -921,7 +921,7 @@ ) (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)))) @@ -931,43 +931,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/goal_src/jak2/levels/tomb/widow-extras.gc b/goal_src/jak2/levels/tomb/widow-extras.gc index 0a640bb9cf..b4c31dd9dc 100644 --- a/goal_src/jak2/levels/tomb/widow-extras.gc +++ b/goal_src/jak2/levels/tomb/widow-extras.gc @@ -551,30 +551,11 @@ ;; ERROR: Stack slot load at 48 mismatch: defined as size 4, got size 16 ;; ERROR: Stack slot load at 64 mismatch: defined as size 4, got size 16 (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 @@ -617,9 +598,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) @@ -808,11 +787,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/goal_src/jak2/levels/tomb/widow-more-extras.gc b/goal_src/jak2/levels/tomb/widow-more-extras.gc index 64ddffbb68..19e32bbf62 100644 --- a/goal_src/jak2/levels/tomb/widow-more-extras.gc +++ b/goal_src/jak2/levels/tomb/widow-more-extras.gc @@ -128,7 +128,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)))) @@ -150,8 +149,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) ) @@ -176,9 +175,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/goal_src/jak2/levels/under/centipede.gc b/goal_src/jak2/levels/under/centipede.gc index 14efdf2719..ccfed8e86a 100644 --- a/goal_src/jak2/levels/under/centipede.gc +++ b/goal_src/jak2/levels/under/centipede.gc @@ -173,7 +173,7 @@ (defmethod general-event-handler ((this centipede) (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" + @TODO - unsure if there is a pattern for the events and this should have a more specific name" (case arg2 (('under-break-floor) (go (method-of-object this thru-grating)) @@ -185,17 +185,18 @@ ) ;; WARN: Return type mismatch nav-enemy vs centipede. -(defmethod relocate ((this centipede) (arg0 int)) +(defmethod relocate ((this centipede) (offset int)) (if (nonzero? (-> this bobbing)) - (&+! (-> this bobbing) arg0) + (&+! (-> this bobbing) offset) ) (if (nonzero? (-> this legs-sound)) - (&+! (-> this legs-sound) arg0) + (&+! (-> this legs-sound) offset) ) - (the-as centipede ((method-of-type nav-enemy relocate) this arg0)) + (the-as centipede ((method-of-type nav-enemy relocate) this offset)) ) (defmethod deactivate ((this centipede)) + "Make a process dead, clean it up, remove it from the active pool, and return to dead pool." (when (-> this set-camera-mode?) (set! (-> this set-camera-mode?) #f) (remove-setting-by-arg0 *setting-control* 'mode-name) @@ -509,10 +510,10 @@ (defmethod in-aggro-range? ((this centipede) (arg0 process-focusable) (arg1 vector)) "Should the enemy activate. -- if `activate-distance` is `0.0`, always true -- otherwise, check if the provided process is close enough -@param proc The process used to distance check -@returns true/false" + - if `activate-distance` is `0.0`, always true + - otherwise, check if the provided process is close enough + @param proc The process used to distance check + @returns true/false" (when arg0 (if (not arg1) (set! arg1 (get-trans arg0 0)) @@ -524,10 +525,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) ) ) @@ -554,9 +553,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))) ) ) @@ -611,9 +609,9 @@ (defmethod common-post ((this centipede)) "Does a lot of various things relating to interacting with the target -- tracks when the enemy was last drawn -- looks at the target and handles attacking -@TODO Not extremely well understood yet" + - tracks when the enemy was last drawn + - looks at the target and handles attacking + @TODO Not extremely well understood yet" (let ((t9-0 (method-of-type nav-enemy common-post))) (t9-0 this) ) @@ -656,11 +654,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)) + ) ) ) ) @@ -1109,7 +1105,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/goal_src/jak2/levels/under/jellyfish.gc b/goal_src/jak2/levels/under/jellyfish.gc index 6d3858e5c7..984680e253 100644 --- a/goal_src/jak2/levels/under/jellyfish.gc +++ b/goal_src/jak2/levels/under/jellyfish.gc @@ -100,11 +100,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) @@ -913,7 +909,6 @@ ) (defmethod jellyfish-method-162 ((this jellyfish)) - (local-vars (sv-624 int)) (rlet ((acc :class vf) (vf0 :class vf) (vf1 :class vf) @@ -937,8 +932,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) @@ -975,7 +970,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/goal_src/jak2/levels/under/sig5-course.gc b/goal_src/jak2/levels/under/sig5-course.gc index b73d4b7f44..e6a3b023aa 100644 --- a/goal_src/jak2/levels/under/sig5-course.gc +++ b/goal_src/jak2/levels/under/sig5-course.gc @@ -102,7 +102,7 @@ (defmethod general-event-handler ((this sig-under) (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" + @TODO - unsure if there is a pattern for the events and this should have a more specific name" (with-pp (case arg2 (('set-task) @@ -158,10 +158,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) @@ -217,14 +214,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)) ) ) ) @@ -258,14 +251,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)) ) ) ) @@ -308,7 +297,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))) ) ) ) @@ -318,10 +307,10 @@ :virtual #t :event enemy-event-handler :enter (behavior () - (move-to-point! (-> self root) (the-as vector (-> self sig5-course spots 0))) + (move-to-point! (-> self root) (-> self sig5-course spots 0 center)) (quaternion-identity! (-> self root quat)) (let ((gp-0 (new 'stack-no-clear 'vector))) - (vector-! gp-0 (the-as vector (-> self sig5-course spots 1)) (-> self root trans)) + (vector-! gp-0 (-> self sig5-course spots 1 center) (-> self root trans)) (vector-normalize! gp-0 1.0) (set-heading-vec! (-> self root) gp-0) ) @@ -823,7 +812,7 @@ (s5-1 (-> v1-7 8)) ) (let ((v1-8 (-> v1-7 9))) - (vector-! (the-as vector (-> arg0 test-plane)) (the-as vector v1-8) (the-as vector s5-1)) + (vector-! (the-as vector (-> arg0 test-plane)) (-> v1-8 center) (-> s5-1 center)) ) (set! (-> arg0 test-plane y) 0.0) (vector-normalize! (-> arg0 test-plane) 1.0) @@ -898,7 +887,7 @@ :on-set (lambda ((arg0 sig-under)) (logior! (-> arg0 enemy-flags) (enemy-flag vulnerable vulnerable-backup)) (reset-warn-time! arg0) - (move-to-point! (-> arg0 root) (the-as vector (-> arg0 sig5-course spots 10))) + (move-to-point! (-> arg0 root) (-> arg0 sig5-course spots 10 center)) (set-vector! (-> arg0 root quat) 0.0 0.5874 0.0 0.8092) (play-speech arg0 8) (play-speech arg0 9) @@ -960,7 +949,7 @@ :skip-to -1 :on-set (lambda ((arg0 sig-under)) (let ((a1-0 (-> arg0 sig5-course spots))) - (vector-! (the-as vector (-> arg0 test-plane)) (the-as vector (-> a1-0 13)) (the-as vector (-> a1-0 12))) + (vector-! (the-as vector (-> arg0 test-plane)) (-> a1-0 13 center) (-> a1-0 12 center)) ) (vector-normalize! (-> arg0 test-plane) 1.0) (let ((v1-4 (get-task-by-type (-> arg0 ai-ctrl) sigt-wait-spot arg0))) @@ -1306,7 +1295,7 @@ (logior! (-> arg1 waypoint-bits) (waypoint-bits wabits-0)) (process-release? arg1) (sig-under-method-260 arg1) - (move-to-point! (-> arg1 root) (the-as vector (-> arg1 sig5-course spots 20))) + (move-to-point! (-> arg1 root) (-> arg1 sig5-course spots 20 center)) #f ) ((not (logtest? (-> arg1 waypoint-bits) (waypoint-bits wabits-1))) @@ -1347,7 +1336,7 @@ (s5-0 (-> v1-1 24)) ) (let ((v1-2 (-> v1-1 25))) - (vector-! (the-as vector (-> arg0 test-plane)) (the-as vector v1-2) (the-as vector s5-0)) + (vector-! (the-as vector (-> arg0 test-plane)) (-> v1-2 center) (-> s5-0 center)) ) (set! (-> arg0 test-plane y) 0.0) (vector-normalize! (-> arg0 test-plane) 1.0) @@ -1393,11 +1382,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) (the-as vector (-> arg1 sig5-course spots 24))) - ) - ) + (>= (square 81920.0) (vector-vector-xz-distance-squared (target-pos 0) (-> arg1 sig5-course spots 24 center))) ) (set! v1-14 #t) (goto cfg-21) @@ -1517,9 +1502,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/goal_src/jak2/levels/under/under-laser.gc b/goal_src/jak2/levels/under/under-laser.gc index 24a5779422..54b28a4677 100644 --- a/goal_src/jak2/levels/under/under-laser.gc +++ b/goal_src/jak2/levels/under/under-laser.gc @@ -238,12 +238,7 @@ (set! (-> v1-2 action-mask) (collide-action solid)) ) (when (>= (fill-and-probe-using-line-sphere *collide-cache* s5-0) 0.0) - (let* ((s4-0 (-> s5-0 best-other-tri collide-ptr)) - (s5-1 (if (type? s4-0 collide-shape-prim-sphere) - s4-0 - ) - ) - ) + (let ((s5-1 (the-as basic (as-type (-> s5-0 best-other-tri collide-ptr) collide-shape-prim-sphere)))) (when s5-1 (let ((s4-1 (new 'stack-no-clear 'vector))) (vector-rotate-around-y! s4-1 (-> this slave-trans-offset) (if (logtest? (-> this info options) 1) @@ -350,22 +345,21 @@ ) ;; WARN: Return type mismatch process-drawable vs under-laser. -(defmethod relocate ((this under-laser) (arg0 int)) +(defmethod relocate ((this under-laser) (offset int)) (if (nonzero? (-> this lightning)) - (&+! (-> this lightning) arg0) + (&+! (-> this lightning) offset) ) - (the-as under-laser ((method-of-type process-drawable relocate) this arg0)) + (the-as under-laser ((method-of-type process-drawable relocate) this offset)) ) ;; WARN: Return type mismatch object vs none. (defmethod init-from-entity! ((this under-laser) (arg0 entity-actor)) "Typically the method that does the initial setup on the process, potentially using the [[entity-actor]] provided as part of that. -This commonly includes things such as: -- stack size -- collision information -- loading the skeleton group / bones -- sounds" - (local-vars (sv-64 res-tag)) + This commonly includes things such as: + - stack size + - collision information + - loading the skeleton group / bones + - sounds" (set! (-> this root) (the-as collide-shape-moving (new 'process 'trsqv))) (process-drawable-from-entity! this arg0) (logclear! (-> this mask) (process-mask actor-pause)) @@ -398,8 +392,9 @@ This commonly includes things such as: (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/goal_src/jak2/levels/under/under-obs.gc b/goal_src/jak2/levels/under/under-obs.gc index 1b70c29f25..e7d13b1beb 100644 --- a/goal_src/jak2/levels/under/under-obs.gc +++ b/goal_src/jak2/levels/under/under-obs.gc @@ -337,9 +337,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") @@ -590,7 +588,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)) @@ -611,8 +608,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)) @@ -1293,10 +1291,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/goal_src/jak2/levels/under/under-shoot-block.gc b/goal_src/jak2/levels/under/under-shoot-block.gc index 4240f8eacf..3e9a330c6b 100644 --- a/goal_src/jak2/levels/under/under-shoot-block.gc +++ b/goal_src/jak2/levels/under/under-shoot-block.gc @@ -1905,17 +1905,6 @@ ;; 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)) @@ -1951,16 +1940,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) ) @@ -1977,16 +1969,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) ) @@ -2000,16 +1995,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) ) @@ -2057,7 +2055,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) @@ -2077,14 +2074,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) ) @@ -2196,15 +2195,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/goal_src/jak2/levels/under/under-sig-obs.gc b/goal_src/jak2/levels/under/under-sig-obs.gc index 9170f834b2..145c180b29 100644 --- a/goal_src/jak2/levels/under/under-sig-obs.gc +++ b/goal_src/jak2/levels/under/under-sig-obs.gc @@ -165,19 +165,9 @@ (let ((s5-0 (the-as object (-> block param 1)))) (when (!= (-> (the-as attack-info s5-0) id) (-> self incoming-attack-id)) (set! (-> self incoming-attack-id) (-> (the-as attack-info s5-0) id)) - (let* ((gp-0 proc) - (s4-0 (if (type? gp-0 process-drawable) - gp-0 - ) - ) - ) + (let ((s4-0 (the-as process (as-type proc process-drawable)))) (when s4-0 - (let* ((s3-0 (-> (the-as process-drawable s4-0) root)) - (gp-1 (if (type? (the-as collide-shape s3-0) collide-shape) - s3-0 - ) - ) - ) + (let ((gp-1 (the-as trsqv (as-type (-> (the-as process-drawable s4-0) root) collide-shape)))) (when gp-1 (when (logtest? (-> (the-as collide-shape gp-1) root-prim prim-core collide-as) (collide-spec projectile)) (when (zero? (-> self state-flip)) @@ -239,12 +229,7 @@ ) ) (vector-reset! (-> self root transv)) - (let* ((gp-2 proc) - (a0-11 (if (type? (the-as process-focusable gp-2) process-focusable) - gp-2 - ) - ) - ) + (let ((a0-11 (the-as process (as-type proc process-focusable)))) (when a0-11 (vector-! (-> self root transv) (-> self root trans) (get-trans (the-as process-focusable a0-11) 0)) (set! (-> self root transv y) 0.0) @@ -505,7 +490,8 @@ ) (suspend) (ja-channel-set! 0) - (suspend-for (seconds 1)) + (suspend-for (seconds 1) + ) (send-event self 'death-end) (while (-> self child) (suspend) @@ -621,7 +607,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)) @@ -652,8 +637,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)) @@ -739,7 +725,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))) @@ -782,8 +767,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)) @@ -868,7 +854,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)) @@ -904,8 +889,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))) @@ -1015,7 +1001,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 @@ -1025,8 +1010,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/goal_src/jak2/levels/under/underb-master.gc b/goal_src/jak2/levels/under/underb-master.gc index bc4ea597ad..f1ebebdce1 100644 --- a/goal_src/jak2/levels/under/underb-master.gc +++ b/goal_src/jak2/levels/under/underb-master.gc @@ -1046,7 +1046,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)) @@ -1061,8 +1060,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)) diff --git a/goal_src/jak3/engine/ai/enemy.gc b/goal_src/jak3/engine/ai/enemy.gc index 0a44bc3906..9a9ef0cdb5 100644 --- a/goal_src/jak3/engine/ai/enemy.gc +++ b/goal_src/jak3/engine/ai/enemy.gc @@ -1048,7 +1048,6 @@ (defmethod setup-enemy! ((this enemy) (arg0 enemy-info)) "Initialize the enemy by setting all the enemy-specific fields." - (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!)) @@ -1109,8 +1108,9 @@ ) (reset-to-collide-spec (-> this focus) (the-as collide-spec cspec)) ) - (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))) + ) (cond ((and v1-47 (nonzero? (-> sv-16 elt-count))) (set! (-> this actor-group) v1-47) @@ -1612,7 +1612,7 @@ (defmethod event-handler ((this enemy) (proc process) (argc int) (msg symbol) (block event-message-block)) "Commmon handler for events." - (local-vars (s5-6 rgbaf) (sv-640 event-message-block) (sv-656 process) (sv-672 event-message-block)) + (local-vars (s5-6 rgbaf)) (cond ((= msg 'go-gun-dark-2-stretch) (go-gun-dark-2-stretch this) @@ -1673,23 +1673,14 @@ ) ) ((= msg 'attack-no-avoid) - (let* ((s2-0 (-> block param 1)) - (s3-4 this) - (s1-0 (method-of-object s3-4 handle-incoming-attack!)) - (s0-0 proc) - ) - (set! sv-640 block) - (let ((a3-3 (get-penetrate-using-from-attack-event (the-as process-drawable proc) block)) - (t1-0 (-> block param 0)) - ) - (s1-0 - s3-4 - (the-as process-drawable s0-0) - sv-640 - a3-3 - (the-as attack-info s2-0) - (the-as touching-shapes-entry t1-0) - ) + (let ((s2-0 (-> block param 1))) + (handle-incoming-attack! + this + (the-as process-drawable proc) + block + (get-penetrate-using-from-attack-event (the-as process-drawable proc) block) + (the-as attack-info s2-0) + (the-as touching-shapes-entry (-> block param 0)) ) ) (damage-enemy-from-attack! this proc block) @@ -1701,23 +1692,13 @@ ((and (logtest? (-> this enemy-flags) (enemy-flag vulnerable)) (not (logtest? (-> this focus-status) (focus-status grabbed))) ) - (let* ((s1-1 this) - (s0-1 (method-of-object s1-1 handle-incoming-attack!)) - ) - (set! sv-656 proc) - (set! sv-672 block) - (let ((a3-4 (get-penetrate-using-from-attack-event (the-as process-drawable proc) block)) - (t1-1 (-> block param 0)) - ) - (s0-1 - s1-1 - (the-as process-drawable sv-656) - sv-672 - a3-4 - (the-as attack-info s2-1) - (the-as touching-shapes-entry t1-1) - ) - ) + (handle-incoming-attack! + this + (the-as process-drawable proc) + block + (get-penetrate-using-from-attack-event (the-as process-drawable proc) block) + (the-as attack-info s2-1) + (the-as touching-shapes-entry (-> block param 0)) ) (send-event (ppointer->process (-> this parent)) 'child-hit) (let ((f0-1 0.0)) @@ -2633,13 +2614,8 @@ (format 0 "Intensity ~f (handle ~d)~%" f30-4 (process->handle this)) ) (else - (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) - ) - (set! f30-4 (* (- f0-26 (/ f1-3 (* f2-3 f2-3))) (rnd-float-range this 0.8 1.0))) + (let ((f1-2 (vector-vector-xz-distance-squared (target-pos 0) (-> this root trans)))) + (set! f30-4 (* (- 1.0 (/ (fmin f1-2 (square 61440.0)) (square 61440.0))) (rnd-float-range this 0.8 1.0))) ) ) ) @@ -2681,11 +2657,7 @@ ) (((knocked-type blue-shot)) (let* ((f1-5 (vector-vector-xz-distance-squared (target-pos 0) (-> this root trans))) - (f0-36 1.0) - (f2-6 122880.0) - (f1-6 (fmin f1-5 (* f2-6 f2-6))) - (f2-9 122880.0) - (f30-7 (* (- f0-36 (/ 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 @@ -2802,12 +2774,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/goal_src/jak3/engine/anim/joint-exploder.gc b/goal_src/jak3/engine/anim/joint-exploder.gc index 519b198592..698054a5dc 100644 --- a/goal_src/jak3/engine/anim/joint-exploder.gc +++ b/goal_src/jak3/engine/anim/joint-exploder.gc @@ -254,15 +254,6 @@ For example, geyser rock dummies, or the jak 1 zoomer." ;; WARN: Return type mismatch object vs joint-exploder-list. (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 ((s4-0 (the-as object #f))) (let ((v1-0 1)) (until (= v1-0 (+ (-> this tuning max-probes) 1)) @@ -286,22 +277,23 @@ For example, geyser rock dummies, or the jak 1 zoomer." ) ) (set! (-> arg0 bbox-valid?) #f) - (let ((s2-0 (-> this joints))) - (set! sv-32 (-> arg0 head)) - (let ((s1-0 0) - (s0-0 0) - ) - (let ((v1-8 arg1)) - (cond - ((zero? v1-8) - (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-8 arg1)) + (cond + ((zero? v1-8) + (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 (the-as joint-exploder-list s4-0) sv-32) - (set! sv-32 sv-16) + (let ((sv-16 (remove-joint-from-list this arg0 sv-32))) + (add-joint-to-list this (the-as joint-exploder-list s4-0) sv-32) + (set! sv-32 sv-16) + ) (update-bbox-for-joint this (the-as joint-exploder-list s4-0) sv-48) (+! s0-0 1) ) @@ -314,15 +306,17 @@ For example, geyser rock dummies, or the jak 1 zoomer." ) ) ) - ((= v1-8 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-8 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 (the-as joint-exploder-list s4-0) sv-32) - (set! sv-32 sv-64) + (let ((sv-64 (remove-joint-from-list this arg0 sv-32))) + (add-joint-to-list this (the-as joint-exploder-list s4-0) sv-32) + (set! sv-32 sv-64) + ) (update-bbox-for-joint this (the-as joint-exploder-list s4-0) sv-80) (+! s0-0 1) ) @@ -335,15 +329,17 @@ For example, geyser rock dummies, or the jak 1 zoomer." ) ) ) - ((= v1-8 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-8 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 (the-as joint-exploder-list s4-0) sv-32) - (set! sv-32 sv-96) + (let ((sv-96 (remove-joint-from-list this arg0 sv-32))) + (add-joint-to-list this (the-as joint-exploder-list s4-0) sv-32) + (set! sv-32 sv-96) + ) (update-bbox-for-joint this (the-as joint-exploder-list s4-0) sv-112) (+! s0-0 1) ) @@ -356,19 +352,19 @@ For example, geyser rock dummies, or the jak 1 zoomer." ) ) ) - ) - ) - (cond - ((zero? s0-0) - (final-adjust this arg0 arg1) - ) - ((zero? s1-0) - (if (not (-> (the-as joint-exploder-list s4-0) probeless?)) - (final-adjust this (the-as joint-exploder-list s4-0) arg1) - ) ) ) ) + (cond + ((zero? s0-0) + (final-adjust this arg0 arg1) + ) + ((zero? s1-0) + (if (not (-> (the-as joint-exploder-list s4-0) probeless?)) + (final-adjust this (the-as joint-exploder-list s4-0) arg1) + ) + ) + ) ) (the-as joint-exploder-list s4-0) ) @@ -376,14 +372,13 @@ For example, geyser rock dummies, or the jak 1 zoomer." ;; 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?)) ) (vector-copy! (-> s1-0 min) (-> arg0 bbox min)) @@ -405,11 +400,13 @@ For example, geyser rock dummies, or the jak 1 zoomer." ) (set! s2-0 (cond (v1-8 - (set! sv-48 (remove-joint-from-list this arg0 s2-0)) - (set! sv-64 (-> this lists data)) - (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 data)) + ) + (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)) (vector-copy! (-> arg0 bbox max) (-> s1-0 max)) diff --git a/goal_src/jak3/engine/anim/joint-mod.gc b/goal_src/jak3/engine/anim/joint-mod.gc index 48a706331c..6006cb943d 100644 --- a/goal_src/jak3/engine/anim/joint-mod.gc +++ b/goal_src/jak3/engine/anim/joint-mod.gc @@ -21,16 +21,6 @@ (defbehavior joint-mod-ik-callback process ((arg0 cspace) (arg1 transformq)) "Inverse kinematics joint mod callback. Despite the arm-related names, can be used on legs too." - (local-vars - (sv-352 vector) - (sv-356 vector) - (sv-360 vector) - (sv-364 vector) - (sv-368 quaternion) - (sv-372 quaternion) - (sv-768 matrix) - (sv-784 vector) - ) (rlet ((vf0 :class vf) (vf4 :class vf) (vf5 :class vf) @@ -70,161 +60,163 @@ ) (matrix-copy! (-> gp-0 shoulder-matrix-no-ik) s5-0) (matrix-copy! (-> gp-0 elbow-matrix-no-ik) s4-1) - (let ((s2-0 (new 'stack-no-clear 'vector))) - (set! sv-784 (new 'stack-no-clear 'vector)) - (let ((s0-0 (new 'stack-no-clear 'vector)) - (s1-0 (new 'stack-no-clear 'vector)) - (s3-1 (new 'stack-no-clear 'vector)) - ) - 0.0 - 0.0 - (vector-copy! s2-0 (-> s5-0 trans)) - (vector-copy! sv-784 (-> s4-1 trans)) - (vector+*! s0-0 sv-784 (-> s4-1 uvec) (-> gp-0 hand-dist)) - (if (-> gp-0 callback) - ((-> gp-0 callback) gp-0 s5-0 s4-1 s0-0) - ) - (vector-copy! s1-0 (-> gp-0 handle-pos)) - (let ((f30-0 (vector-vector-distance s2-0 sv-784)) - (f0-12 (vector-vector-distance sv-784 s0-0)) - ) - (set! sv-768 (new 'stack-no-clear 'matrix)) - (let ((v1-32 s1-0) - (a0-19 s2-0) - ) - (.lvf vf4 (&-> v1-32 quad)) - (.lvf vf5 (&-> a0-19 quad)) - ) - (.mov.vf.w vf6 vf0) - (.sub.vf.xyz vf6 vf4 vf5) - (.svf (&-> sv-768 rvec quad) vf6) - (vector-length (-> sv-768 rvec)) - (+ -4.096 f0-12 f30-0) - (let ((f0-15 (+ 4.096 (fabs (- f30-0 f0-12))))) - (cond - ((< f0-15 f0-15) - (vector-normalize! (-> sv-768 rvec) f0-15) - (let ((v1-39 s1-0)) - (let ((a0-21 s2-0)) - (.mov.vf.w vf6 vf0) - (.lvf vf4 (&-> a0-21 quad)) - ) - (.lvf vf5 (&-> sv-768 rvec quad)) - (.add.vf.xyz vf6 vf4 vf5) - (.svf (&-> v1-39 quad) vf6) - ) - ) - ((< f0-15 f0-15) - (vector-normalize! (-> sv-768 rvec) f0-15) - (vector+! s1-0 s2-0 (-> sv-768 rvec)) - ) - ) - ) + (let ((s2-0 (new 'stack-no-clear 'vector)) + (sv-784 (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)) ) - (set! sv-352 (vector-! (new 'stack-no-clear 'vector) sv-784 s2-0)) - (let ((v1-44 (new 'stack-no-clear 'vector))) - (.lvf vf4 (&-> s0-0 quad)) - (.lvf vf5 (&-> sv-784 quad)) - (.mov.vf.w vf6 vf0) - (.sub.vf.xyz vf6 vf4 vf5) - (.svf (&-> v1-44 quad) vf6) - (set! sv-356 v1-44) + 0.0 + 0.0 + (vector-copy! s2-0 (-> s5-0 trans)) + (vector-copy! sv-784 (-> s4-1 trans)) + (vector+*! s0-0 sv-784 (-> s4-1 uvec) (-> gp-0 hand-dist)) + (if (-> gp-0 callback) + ((-> gp-0 callback) gp-0 s5-0 s4-1 s0-0) ) - (set! sv-360 (vector-! (new 'stack-no-clear 'vector) s0-0 s2-0)) - (set! sv-364 (vector-! (new 'stack-no-clear 'vector) s1-0 s2-0)) - (set! sv-368 (new 'stack-no-clear 'quaternion)) - (set! sv-372 (new 'stack-no-clear 'quaternion)) - (let ((f26-0 (vector-length sv-352)) - (f24-0 (vector-length sv-356)) - (f30-1 (vector-length sv-364)) + (vector-copy! s1-0 (-> gp-0 handle-pos)) + (let ((f30-0 (vector-vector-distance s2-0 sv-784)) + (f0-12 (vector-vector-distance sv-784 s0-0)) + (sv-768 (new 'stack-no-clear 'matrix)) + ) + (let ((v1-32 s1-0) + (a0-19 s2-0) ) - (let* ((s2-1 (new 'stack-no-clear 'vector)) - (f28-0 (vector-vector-angle-safe sv-352 sv-356)) - (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)) + (.lvf vf4 (&-> v1-32 quad)) + (.lvf vf5 (&-> a0-19 quad)) + ) + (.mov.vf.w vf6 vf0) + (.sub.vf.xyz vf6 vf4 vf5) + (.svf (&-> sv-768 rvec quad) vf6) + (vector-length (-> sv-768 rvec)) + (+ -4.096 f0-12 f30-0) + (let ((f0-15 (+ 4.096 (fabs (- f30-0 f0-12))))) + (cond + ((< f0-15 f0-15) + (vector-normalize! (-> sv-768 rvec) f0-15) + (let ((v1-39 s1-0)) + (let ((a0-21 s2-0)) + (.mov.vf.w vf6 vf0) + (.lvf vf4 (&-> a0-21 quad)) ) - (cond - ((= f28-0 0.0) - (set! (-> s2-1 quad) (-> (&-> s4-1 quad (-> gp-0 elbow-rotation-axis)) 0)) - (when (logtest? (-> gp-0 flags) (joint-mod-ik-flags elbow-rot-neg)) - (vector-negate! s2-1 s2-1) - (set! f26-1 (- f26-1)) - ) - (set! (-> s3-1 quad) (-> (&-> s4-1 quad (-> gp-0 elbow-pole-vector-axis)) 0)) - (if (logtest? (-> gp-0 flags) (joint-mod-ik-flags elbow-trans-neg)) - (vector-negate! s3-1 s3-1) - ) + (.lvf vf5 (&-> sv-768 rvec quad)) + (.add.vf.xyz vf6 vf4 vf5) + (.svf (&-> v1-39 quad) vf6) ) - (else - (vector-cross! s2-1 sv-352 sv-356) - (vector-! - s3-1 - sv-352 - (vector-float*! - (new 'stack-no-clear 'vector) - sv-360 - (/ (vector-dot sv-360 sv-352) (vector-dot sv-360 sv-360)) - ) - ) - ) - ) - (vector-normalize! s3-1 1.0) - (vector-normalize! s2-1 1.0) - (quaternion-vector-angle! sv-368 s2-1 (- f26-1 f28-0)) - ) - (vector-orient-by-quat! sv-356 sv-356 sv-368) - (vector+! sv-360 sv-352 sv-356) - (quaternion-from-two-vectors! - sv-372 - (vector-normalize-copy! (new 'stack-no-clear 'vector) sv-360 1.0) - (vector-normalize-copy! (new 'stack-no-clear 'vector) sv-364 1.0) - ) - (vector-orient-by-quat! sv-352 sv-352 sv-372) - (let ((f0-25 (fabs (vector-dot - (vector-normalize-copy! (new 'stack-no-clear 'vector) sv-352 1.0) - (vector-normalize-copy! (new 'stack-no-clear 'vector) sv-364 1.0) - ) - ) - ) - ) - (if (< 0.98 f0-25) - (vector-orient-by-quat! sv-352 s3-1 sv-372) - ) - ) - (let ((s2-4 (new 'stack-no-clear 'vector)) - (s1-2 (new 'stack-no-clear 'quaternion)) - ) - (new 'stack-no-clear 'matrix) - (* f30-1 f30-1) - (let ((s0-2 (new 'stack-no-clear 'quaternion))) - (vector-flatten! s2-4 sv-352 sv-364) - (vector-flatten! (-> s1-2 vec) s3-1 sv-364) - (vector-normalize! s2-4 1.0) - (vector-normalize! (-> s1-2 vec) 1.0) - (quaternion-from-two-vectors! s0-2 s2-4 (-> s1-2 vec)) - (quaternion*! sv-372 s0-2 sv-372) - ) + ) + ((< f0-15 f0-15) + (vector-normalize! (-> sv-768 rvec) f0-15) + (vector+! s1-0 s2-0 (-> sv-768 rvec)) + ) ) ) ) - ) - (quaternion-pseudo-slerp! sv-368 *unity-quaternion* sv-368 (-> gp-0 blend)) - (quaternion-pseudo-slerp! sv-372 *unity-quaternion* sv-372 (-> gp-0 blend)) - (let ((a2-19 (quaternion->matrix (new 'stack-no-clear 'matrix) sv-368)) - (gp-1 (new 'stack-no-clear 'matrix)) + (let ((sv-352 (vector-! (new 'stack-no-clear 'vector) sv-784 s2-0)) + (v1-44 (new 'stack-no-clear 'vector)) + ) + (.lvf vf4 (&-> s0-0 quad)) + (.lvf vf5 (&-> sv-784 quad)) + (.mov.vf.w vf6 vf0) + (.sub.vf.xyz vf6 vf4 vf5) + (.svf (&-> v1-44 quad) vf6) + (let ((sv-356 v1-44) + (sv-360 (vector-! (new 'stack-no-clear 'vector) s0-0 s2-0)) + (sv-364 (vector-! (new 'stack-no-clear 'vector) s1-0 s2-0)) + (sv-368 (new 'stack-no-clear 'quaternion)) + (sv-372 (new 'stack-no-clear 'quaternion)) + ) + (let ((f26-0 (vector-length sv-352)) + (f24-0 (vector-length sv-356)) + (f30-1 (vector-length sv-364)) + ) + (let* ((s2-1 (new 'stack-no-clear 'vector)) + (f28-0 (vector-vector-angle-safe sv-352 sv-356)) + (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)) + ) + (cond + ((= f28-0 0.0) + (set! (-> s2-1 quad) (-> (&-> s4-1 quad (-> gp-0 elbow-rotation-axis)) 0)) + (when (logtest? (-> gp-0 flags) (joint-mod-ik-flags elbow-rot-neg)) + (vector-negate! s2-1 s2-1) + (set! f26-1 (- f26-1)) + ) + (set! (-> s3-1 quad) (-> (&-> s4-1 quad (-> gp-0 elbow-pole-vector-axis)) 0)) + (if (logtest? (-> gp-0 flags) (joint-mod-ik-flags elbow-trans-neg)) + (vector-negate! s3-1 s3-1) + ) + ) + (else + (vector-cross! s2-1 sv-352 sv-356) + (vector-! + s3-1 + sv-352 + (vector-float*! + (new 'stack-no-clear 'vector) + sv-360 + (/ (vector-dot sv-360 sv-352) (vector-dot sv-360 sv-360)) + ) + ) + ) + ) + (vector-normalize! s3-1 1.0) + (vector-normalize! s2-1 1.0) + (quaternion-vector-angle! sv-368 s2-1 (- f26-1 f28-0)) + ) + (vector-orient-by-quat! sv-356 sv-356 sv-368) + (vector+! sv-360 sv-352 sv-356) + (quaternion-from-two-vectors! + sv-372 + (vector-normalize-copy! (new 'stack-no-clear 'vector) sv-360 1.0) + (vector-normalize-copy! (new 'stack-no-clear 'vector) sv-364 1.0) + ) + (vector-orient-by-quat! sv-352 sv-352 sv-372) + (let ((f0-25 (fabs (vector-dot + (vector-normalize-copy! (new 'stack-no-clear 'vector) sv-352 1.0) + (vector-normalize-copy! (new 'stack-no-clear 'vector) sv-364 1.0) + ) + ) + ) + ) + (if (< 0.98 f0-25) + (vector-orient-by-quat! sv-352 s3-1 sv-372) + ) + ) + (let ((s2-4 (new 'stack-no-clear 'vector)) + (s1-2 (new 'stack-no-clear 'quaternion)) + ) + (new 'stack-no-clear 'matrix) + (square f30-1) + (let ((s0-2 (new 'stack-no-clear 'quaternion))) + (vector-flatten! s2-4 sv-352 sv-364) + (vector-flatten! (-> s1-2 vec) s3-1 sv-364) + (vector-normalize! s2-4 1.0) + (vector-normalize! (-> s1-2 vec) 1.0) + (quaternion-from-two-vectors! s0-2 s2-4 (-> s1-2 vec)) + (quaternion*! sv-372 s0-2 sv-372) + ) + ) + ) + (quaternion-pseudo-slerp! sv-368 *unity-quaternion* sv-368 (-> gp-0 blend)) + (quaternion-pseudo-slerp! sv-372 *unity-quaternion* sv-372 (-> gp-0 blend)) + (let ((a2-19 (quaternion->matrix (new 'stack-no-clear 'matrix) sv-368)) + (gp-1 (new 'stack-no-clear 'matrix)) + ) + (set! (-> gp-1 rvec quad) (-> s4-1 trans quad)) + (matrix*! s4-1 s4-1 a2-19) + (vector-copy! (-> s4-1 trans) (-> gp-1 rvec)) + ) + (let ((s3-2 (quaternion->matrix (new 'stack-no-clear 'matrix) sv-372)) + (a2-20 (matrix-4x4-inverse! (new 'stack-no-clear 'matrix) s5-0)) + (gp-2 (new 'stack-no-clear 'matrix)) + ) + (set! (-> gp-2 rvec quad) (-> s5-0 trans quad)) + (matrix*! s4-1 s4-1 a2-20) + (matrix*! s5-0 s5-0 s3-2) + (vector-copy! (-> s5-0 trans) (-> gp-2 rvec)) + ) ) - (set! (-> gp-1 rvec quad) (-> s4-1 trans quad)) - (matrix*! s4-1 s4-1 a2-19) - (vector-copy! (-> s4-1 trans) (-> gp-1 rvec)) - ) - (let ((s3-2 (quaternion->matrix (new 'stack-no-clear 'matrix) sv-372)) - (a2-20 (matrix-4x4-inverse! (new 'stack-no-clear 'matrix) s5-0)) - (gp-2 (new 'stack-no-clear 'matrix)) - ) - (set! (-> gp-2 rvec quad) (-> s5-0 trans quad)) - (matrix*! s4-1 s4-1 a2-20) - (matrix*! s5-0 s5-0 s3-2) - (vector-copy! (-> s5-0 trans) (-> gp-2 rvec)) + ) ) (matrix*! s4-1 s4-1 s5-0) ) @@ -270,149 +262,145 @@ (defbehavior real-joint-mod-gun-look-at-handler process ((arg0 cspace) (arg1 transformq)) "Joint mod callback for pointing the gun (implementation)." - (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 uvec)) + (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 uvec)) - (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) ) @@ -701,100 +689,95 @@ (defbehavior joint-mod-look-at-handler process ((arg0 cspace) (arg1 transformq)) "Callback for look-at joint mod." - (local-vars - (sv-144 matrix) - (sv-148 quaternion) - (sv-152 vector) - (sv-156 vector) - (sv-160 (pointer uint128)) - (sv-164 symbol) - ) (let ((gp-0 (the-as joint-mod (-> arg0 param1)))) (cspace<-parented-transformq-joint! arg0 arg1) - (let ((s3-0 (-> arg0 bone transform))) - (set! sv-144 (new 'stack-no-clear 'matrix)) - (set! sv-148 (new 'stack-no-clear 'quaternion)) - (set! sv-152 (new 'stack-no-clear 'vector)) - (set! sv-156 (new 'stack-no-clear 'vector)) - (set! sv-160 (&-> gp-0 process node-list data (-> gp-0 base-joint) bone transform quad (-> gp-0 base-nose))) - (set! sv-164 - (< (vector-dot (-> s3-0 rvec) (vector-cross! (new 'stack-no-clear 'vector) (-> s3-0 uvec) (-> s3-0 fvec))) - 0.0 - ) - ) - (vector-normalize-copy! (-> sv-144 rvec) (the-as vector (&-> s3-0 quad (-> gp-0 ear))) (if sv-164 - -1.0 - 1.0 - ) - ) - (vector-normalize-copy! (-> sv-144 uvec) (the-as vector (&-> s3-0 quad (-> gp-0 up))) 1.0) - (vector-normalize-copy! (-> sv-144 fvec) (the-as vector (&-> s3-0 quad (-> gp-0 nose))) 1.0) - ) - (vector-reset! (-> sv-144 trans)) - (matrix->quaternion sv-148 sv-144) - (vector-normalize! (vector-! sv-152 (-> gp-0 target) (-> arg0 bone transform trans)) 1.0) - (vector-inv-orient-by-quat! sv-156 sv-152 sv-148) - (let ((f30-0 (vector-y-angle sv-156)) - (f0-2 (if (= (-> gp-0 base-joint) (+ (-> arg0 joint number) 1)) - 0.0 - (deg-diff (vector-y-angle (-> sv-144 fvec)) (vector-y-angle (the-as vector sv-160))) - ) - ) + (let ((s3-0 (-> arg0 bone transform)) + (sv-144 (new 'stack-no-clear 'matrix)) + (sv-148 (new 'stack-no-clear 'quaternion)) + (sv-152 (new 'stack-no-clear 'vector)) + (sv-156 (new 'stack-no-clear 'vector)) ) - (if (< (-> gp-0 ignore-angle) (fabs f30-0)) - (set! f30-0 0.0) - ) - (let ((f30-1 - (fmax - (fmin (* f30-0 (-> gp-0 blend) (-> gp-0 flex-blend)) (+ (-> gp-0 twist-max y) (* f0-2 (-> gp-0 flex-blend)))) - (+ (- (-> gp-0 twist-max y)) (* f0-2 (-> gp-0 flex-blend))) - ) - ) - ) - (when (and (-> gp-0 shutting-down?) (< (fabs (- (-> gp-0 twist y) f30-1)) 18.204445)) - (if (and (= (-> gp-0 scale x) 1.0) (= (-> gp-0 scale y) 1.0) (= (-> gp-0 scale z) 1.0)) - (mode-set! gp-0 (joint-mod-mode reset)) - (mode-set! gp-0 (joint-mod-mode rotate2)) - ) - ) - (set! (-> gp-0 twist y) - (deg-seek - (-> gp-0 twist y) - f30-1 - (* (fabs (deg-diff f30-1 (-> gp-0 twist y))) (-> gp-0 twist-speed-y) (-> self clock time-adjust-ratio)) - ) - ) - ) - ) - (let ((f0-21 (if sv-164 - (- (-> gp-0 twist y)) - (-> gp-0 twist y) - ) + (let ((sv-160 (&-> gp-0 process node-list data (-> gp-0 base-joint) bone transform quad (-> gp-0 base-nose))) + (sv-164 + (< (vector-dot (-> s3-0 rvec) (vector-cross! (new 'stack-no-clear 'vector) (-> s3-0 uvec) (-> s3-0 fvec))) + 0.0 ) - (a1-18 (new-stack-vector0)) + ) + ) + (vector-normalize-copy! (-> sv-144 rvec) (the-as vector (&-> s3-0 quad (-> gp-0 ear))) (if sv-164 + -1.0 + 1.0 + ) + ) + (vector-normalize-copy! (-> sv-144 uvec) (the-as vector (&-> s3-0 quad (-> gp-0 up))) 1.0) + (vector-normalize-copy! (-> sv-144 fvec) (the-as vector (&-> s3-0 quad (-> gp-0 nose))) 1.0) + (vector-reset! (-> sv-144 trans)) + (matrix->quaternion sv-148 sv-144) + (vector-normalize! (vector-! sv-152 (-> gp-0 target) (-> arg0 bone transform trans)) 1.0) + (vector-inv-orient-by-quat! sv-156 sv-152 sv-148) + (let ((f30-0 (vector-y-angle sv-156)) + (f0-2 (if (= (-> gp-0 base-joint) (+ (-> arg0 joint number) 1)) + 0.0 + (deg-diff (vector-y-angle (-> sv-144 fvec)) (vector-y-angle (the-as vector sv-160))) + ) + ) + ) + (if (< (-> gp-0 ignore-angle) (fabs f30-0)) + (set! f30-0 0.0) + ) + (let ((f30-1 + (fmax + (fmin (* f30-0 (-> gp-0 blend) (-> gp-0 flex-blend)) (+ (-> gp-0 twist-max y) (* f0-2 (-> gp-0 flex-blend)))) + (+ (- (-> gp-0 twist-max y)) (* f0-2 (-> gp-0 flex-blend))) + ) + ) + ) + (when (and (-> gp-0 shutting-down?) (< (fabs (- (-> gp-0 twist y) f30-1)) 18.204445)) + (if (and (= (-> gp-0 scale x) 1.0) (= (-> gp-0 scale y) 1.0) (= (-> gp-0 scale z) 1.0)) + (mode-set! gp-0 (joint-mod-mode reset)) + (mode-set! gp-0 (joint-mod-mode rotate2)) + ) + ) + (set! (-> gp-0 twist y) + (deg-seek + (-> gp-0 twist y) + f30-1 + (* (fabs (deg-diff f30-1 (-> gp-0 twist y))) (-> gp-0 twist-speed-y) (-> self clock time-adjust-ratio)) + ) + ) + ) + ) + (let ((f0-21 (if sv-164 + (- (-> gp-0 twist y)) + (-> gp-0 twist y) + ) + ) + (a1-18 (new-stack-vector0)) + ) + (set! (-> a1-18 data (-> gp-0 up)) 1.0) + (let ((a2-7 (quaternion-vector-angle! (new-stack-quaternion0) a1-18 f0-21))) + (quaternion-normalize! (quaternion*! (-> arg1 quat) (-> arg1 quat) a2-7)) + ) ) - (set! (-> a1-18 data (-> gp-0 up)) 1.0) - (let ((a2-7 (quaternion-vector-angle! (new-stack-quaternion0) a1-18 f0-21))) - (quaternion-normalize! (quaternion*! (-> arg1 quat) (-> arg1 quat) a2-7)) ) - ) - (let ((f0-27 - (fmax - (fmin (* (- (vector-x-angle sv-156)) (-> gp-0 blend) (-> gp-0 flex-blend)) (-> gp-0 twist-max x)) - (- (-> gp-0 twist-max x)) + (let ((f0-27 + (fmax + (fmin (* (- (vector-x-angle sv-156)) (-> gp-0 blend) (-> gp-0 flex-blend)) (-> gp-0 twist-max x)) + (- (-> gp-0 twist-max x)) + ) ) ) - ) - (if (< (vector-dot sv-156 *z-vector*) 0.1) - (set! f0-27 0.0) - ) - (set! (-> gp-0 twist x) - (deg-seek - (-> gp-0 twist x) - f0-27 - (* (fabs (deg-diff f0-27 (-> gp-0 twist x))) (-> gp-0 twist-speed-x) (-> self clock time-adjust-ratio)) - ) + (if (< (vector-dot sv-156 *z-vector*) 0.1) + (set! f0-27 0.0) ) + (set! (-> gp-0 twist x) + (deg-seek + (-> gp-0 twist x) + f0-27 + (* (fabs (deg-diff f0-27 (-> gp-0 twist x))) (-> gp-0 twist-speed-x) (-> self clock time-adjust-ratio)) + ) + ) + ) ) (let ((a1-22 (new-stack-vector0))) (set! (-> a1-22 data (-> gp-0 ear)) 1.0) @@ -825,75 +808,76 @@ ) (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 uvec) - 1.0 - ) + (let ((sv-48 (vector-normalize-copy! + (new 'stack-no-clear 'vector) + (-> gp-0 process node-list data 0 bone transform uvec) + 1.0 + ) + ) + (sv-52 (vector-normalize! (the-as vector (&-> s5-0 quad (-> 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! (the-as vector (&-> s5-0 quad (-> 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) + (-> gp-0 process node-list data 0 bone transform rvec) + 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) - (-> gp-0 process node-list data 0 bone transform rvec) - 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 @@ -1326,13 +1310,9 @@ (matrix-transpose! s4-1 s4-1) (set-vector! (-> s4-1 trans) 0.0 0.0 0.0 1.0) (vector-matrix*! s2-0 s1-0 s4-1) - (let* ((t9-11 asin) - (f0-9 (-> s2-0 x)) - (f0-11 (* f0-9 f0-9)) - (f1-0 (-> s2-0 y)) - (f26-0 (t9-11 (sqrtf (+ f0-11 (* f1-0 f1-0))))) - (f28-0 (atan (-> s2-0 y) (-> s2-0 x))) - ) + (let ((f26-0 (asin (sqrtf (+ (square (-> s2-0 x)) (square (-> s2-0 y)))))) + (f28-0 (atan (-> s2-0 y) (-> s2-0 x))) + ) (if (< (-> s2-0 z) 0.0) (set! f26-0 (- 32768.0 f26-0)) ) @@ -1363,11 +1343,9 @@ ) ) ) - (let* ((f0-39 (sin f28-0)) - (f24-0 (* f0-39 f0-39)) - (f0-41 (cos f28-0)) - (f0-43 (* f0-41 f0-41)) - ) + (let ((f24-0 (square (sin f28-0))) + (f0-43 (square (cos f28-0))) + ) 32768.0 (let ((f0-45 (cond ((< 16384.0 f28-0) @@ -1392,13 +1370,7 @@ ) (let ((f26-1 (cos f26-0))) (set-vector! s2-0 (cos f28-0) (sin f28-0) 0.0 1.0) - (let ((t9-18 vector-normalize!) - (a0-24 s2-0) - (f0-53 1.0) - (f1-22 f26-1) - ) - (t9-18 a0-24 (sqrtf (- f0-53 (* f1-22 f1-22)))) - ) + (vector-normalize! s2-0 (sqrtf (- 1.0 (square f26-1)))) (set! (-> s2-0 z) f26-1) ) ) diff --git a/goal_src/jak3/engine/anim/joint.gc b/goal_src/jak3/engine/anim/joint.gc index 6cf9d3e85e..c842f14af3 100644 --- a/goal_src/jak3/engine/anim/joint.gc +++ b/goal_src/jak3/engine/anim/joint.gc @@ -1083,7 +1083,7 @@ (dotimes (s2-0 (-> this length)) (if (and (-> this data s2-0) (= (-> this data s2-0 type) arg1) - (or (name= arg0 (-> this data s2-0 name)) (string-charp= arg0 (&-> (-> this data s2-0 name) data s3-0))) + (or (name= arg0 (-> this data s2-0 name)) (string-charp= arg0 (&-> this data s2-0 name data s3-0))) ) (return (the-as basic (-> this data s2-0))) ) @@ -1110,7 +1110,7 @@ (dotimes (s2-0 (-> this length)) (if (and (-> this data s2-0) (= (-> this data s2-0 type) arg1) - (or (name= arg0 (-> this data s2-0 name)) (string-charp= arg0 (&-> (-> this data s2-0 name) data s3-0))) + (or (name= arg0 (-> this data s2-0 name)) (string-charp= arg0 (&-> this data s2-0 name data s3-0))) ) (return s2-0) ) @@ -1365,7 +1365,6 @@ this ) -;; WARN: Return type mismatch symbol vs none. (defun joint-control-cleanup ((jc joint-control) (heap kheap) (ja art-joint-anim)) "Remove all animations that are stored on the given heap and return those slots to a safe default." (let ((v1-0 (-> heap base)) @@ -1478,84 +1477,76 @@ ) "Map animation from parent to child using the given animation mapping. This is used to animate daxter based on the animation of jak." - (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 ) ;; NOTE: this function is not used with the new decompressor, but it's interesting to read. @@ -1866,18 +1857,8 @@ ) ((and (= mode 'no-push) (= v1-3 (joint-control-command stack))) (set! (-> mat-stack top) (the matrix (&- (-> mat-stack top) (the-as uint s1-0)))) - (let* ((v1-9 (the matrix (&- (-> mat-stack top) (the-as uint s1-0)))) - (a3-1 (-> mat-stack top)) - (a0-8 (-> a3-1 rvec quad)) - (a1-6 (-> a3-1 uvec quad)) - (a2-2 (-> a3-1 fvec quad)) - (a3-2 (-> a3-1 trans quad)) - ) - (set! (-> v1-9 rvec quad) a0-8) - (set! (-> v1-9 uvec quad) a1-6) - (set! (-> v1-9 fvec quad) a2-2) - (set! (-> v1-9 trans quad) a3-2) - ) + ;; og:preserve-this + (matrix-copy! (the matrix (&- (-> mat-stack top) (the-as uint s1-0))) (-> mat-stack top)) ) ((and (= mode 'no-push) (= v1-3 (joint-control-command float))) ) diff --git a/goal_src/jak3/engine/camera/cam-combiner.gc b/goal_src/jak3/engine/camera/cam-combiner.gc index 8daffee272..7cc00e0b39 100644 --- a/goal_src/jak3/engine/camera/cam-combiner.gc +++ b/goal_src/jak3/engine/camera/cam-combiner.gc @@ -8,9 +8,8 @@ ;; DECOMP BEGINS (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)) ) @@ -400,30 +399,22 @@ ) (defbehavior cam-combiner-init camera-combiner () + (local-vars (v1-6 matrix)) (stack-size-set! (-> self main-thread) 512) (vector-reset! (-> self trans)) (matrix-identity! (-> self inv-camera-rot)) - (cond - (*math-camera* - (set! (-> self fov) (-> *math-camera* fov)) - (set! (-> self trans quad) (-> *math-camera* trans quad)) - (let* ((v1-6 (-> self inv-camera-rot)) - (a3-0 (-> *math-camera* inv-camera-rot)) - (a0-6 (-> a3-0 rvec quad)) - (a1-1 (-> a3-0 uvec quad)) - (a2-0 (-> a3-0 fvec quad)) - (a3-1 (-> a3-0 trans quad)) - ) - (set! (-> v1-6 rvec quad) a0-6) - (set! (-> v1-6 uvec quad) a1-1) - (set! (-> v1-6 fvec quad) a2-0) - (set! (-> v1-6 trans quad) a3-1) + (set! v1-6 (cond + (*math-camera* + (set! (-> self fov) (-> *math-camera* fov)) + (vector-copy! (-> self trans) (-> *math-camera* trans)) + (matrix-copy! (-> self inv-camera-rot) (-> *math-camera* inv-camera-rot)) + ) + (else + (set! (-> self fov) 11650.845) + v1-6 + ) + ) ) - ) - (else - (set! (-> self fov) 11650.845) - ) - ) (set! (-> self interp-val) 1.0) (set! (-> self interp-step) 0.125) (set! (-> self tracking-status) (the-as uint 0)) diff --git a/goal_src/jak3/engine/camera/cam-layout.gc b/goal_src/jak3/engine/camera/cam-layout.gc index 713fd6c1d3..703633034a 100644 --- a/goal_src/jak3/engine/camera/cam-layout.gc +++ b/goal_src/jak3/engine/camera/cam-layout.gc @@ -194,35 +194,21 @@ ;; 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 float) - (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) @@ -238,121 +224,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 (the-as float 0.0)) - (set! sv-168 0) - (set! sv-176 (new-stack-vector0)) - (vector-copy! sv-160 sv-240) - (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) - (vector-copy! sv-176 (-> s3-0 sv-288)) - (set! sv-164 (the-as float 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 sv-164)) - (set! sv-164 f0-8) - (set! sv-168 (+ sv-168 1)) - ) - ) - (else - (vector+float*! sv-160 sv-160 sv-208 f0-8) - (vector-copy! sv-176 (-> s3-0 sv-288)) - (set! sv-168 (+ sv-168 1)) - (if (< (fabs f0-8) (fabs sv-164)) - (set! sv-164 (- sv-164 f0-8)) - (set! sv-164 (the-as float 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 (the-as float 0.0)) + (sv-168 0) + ) + (let ((sv-176 (new-stack-vector0))) + (vector-copy! sv-160 sv-240) + (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) + (vector-copy! sv-176 (-> s3-0 sv-288)) + (set! sv-164 (the-as float 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 sv-164)) + (set! sv-164 f0-8) + (+! sv-168 1) + ) + ) + (else + (vector+float*! sv-160 sv-160 sv-208 f0-8) + (vector-copy! sv-176 (-> s3-0 sv-288)) + (+! sv-168 1) + (set! sv-164 (cond + ((< (fabs f0-8) (fabs sv-164)) + (set! sv-164 (- sv-164 f0-8)) + sv-164 + ) + (else + (the-as float 0.0) + ) + ) + ) + ) + ) + ) + ) + (+! sv-288 1) + ) + ) ) + (cond + ((zero? sv-168) + ) + ((= sv-164 0.0) + ) + (else + (dotimes (v1-87 (the-as int (-> sv-16 elt-count))) + (when (and (!= v1-87 s1-0) (!= v1-87 sv-272)) + (if (< 4096.0 (- (vector-dot sv-160 (-> s3-0 v1-87)) (-> s3-0 v1-87 w))) + (goto cfg-47) + ) + ) + ) + (vector+float*! sv-240 sv-160 sv-208 sv-164) + (cond + ((>= *volume-point-current* 999) + (format 0 "ERROR : camera editing out of volume points~%") + ) + (else + (vector-copy! (-> *volume-point* data *volume-point-current*) sv-160) + (vector-copy! (-> *volume-point* data (+ *volume-point-current* 1)) sv-240) + (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) - ) - ((= sv-164 0.0) - ) - (else - (dotimes (v1-87 (the-as int (-> sv-16 elt-count))) - (when (and (!= v1-87 s1-0) (!= v1-87 sv-272)) - (if (< 4096.0 (- (vector-dot sv-160 (-> s3-0 v1-87)) (-> s3-0 v1-87 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 + (vector-copy! (-> *volume-normal* data *volume-normal-current*) s0-0) + (vector-copy! (-> *volume-normal* data (+ *volume-normal-current* 1)) (-> s3-0 s1-0)) + (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 sv-164) - (cond - ((>= *volume-point-current* 999) - (format 0 "ERROR : camera editing out of volume points~%") - ) - (else - (vector-copy! (-> *volume-point* data *volume-point-current*) sv-160) - (vector-copy! (-> *volume-point* data (+ *volume-point-current* 1)) sv-240) - (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 - (vector-copy! (-> *volume-normal* data *volume-normal-current*) s0-0) - (vector-copy! (-> *volume-normal* data (+ *volume-normal-current* 1)) (-> s3-0 s1-0)) - (set! *volume-normal-current* (+ *volume-normal-current* 2)) - (set! (-> s2-0 normal-count) (+ (-> s2-0 normal-count) 2)) - ) - ) ) ) ) @@ -824,7 +826,7 @@ ) (defbehavior clmf-pos-rot cam-layout ((arg0 symbol) (arg1 symbol)) - (local-vars (s2-0 structure) (s3-1 structure) (sv-192 matrix)) + (local-vars (s2-0 structure) (s3-1 structure)) (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)) @@ -882,35 +884,35 @@ ) ) ) - (let ((s1-1 (new 'stack-no-clear 'matrix))) - (set! sv-192 (new 'stack-no-clear 'matrix)) - (let ((s0-1 (new 'stack-no-clear 'quaternion))) - (if (not s3-1) - (return #f) - ) - (clmf-input s5-0 s4-0 0) - (vector+float*! (the-as vector s3-1) (the-as vector 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 s0-1 sv-192) - (quaternion-inverse! (the-as quaternion s2-0) (the-as quaternion (-> self cam-entity connect))) - (quaternion*! (the-as quaternion s2-0) 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 'quaternion)) + ) + (if (not s3-1) + (return #f) + ) + (clmf-input s5-0 s4-0 0) + (vector+float*! (the-as vector s3-1) (the-as vector 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 s0-1 sv-192) + (quaternion-inverse! (the-as quaternion s2-0) (the-as quaternion (-> self cam-entity connect))) + (quaternion*! (the-as quaternion s2-0) s0-1 (the-as quaternion s2-0)) + (quaternion-normalize! (the-as quaternion s2-0)) ) ) ) @@ -2270,10 +2272,10 @@ ) (defbehavior clmf-cam-string cam-layout ((arg0 string) (arg1 symbol)) - (local-vars (sv-16 res-tag)) (format arg0 ":") - (set! sv-16 (new 'static 'res-tag)) - (let ((s5-1 (res-lump-data (-> self cam-entity) arg1 pointer :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (s5-1 (res-lump-data (-> self cam-entity) arg1 pointer :tag-ptr (& sv-16))) + ) (when s5-1 (dotimes (s4-0 (the-as int (-> sv-16 elt-count))) (format arg0 " ~S" (-> (the-as (pointer uint32) (&+ s5-1 (* s4-0 4))))) diff --git a/goal_src/jak3/engine/camera/cam-master.gc b/goal_src/jak3/engine/camera/cam-master.gc index a65e759331..56fc984d49 100644 --- a/goal_src/jak3/engine/camera/cam-master.gc +++ b/goal_src/jak3/engine/camera/cam-master.gc @@ -359,16 +359,7 @@ ) (defbehavior master-choose-entity camera-master ((arg0 cam-setting-data)) - (local-vars - (r0-0 uint128) - (v1-44 uint128) - (sv-96 int) - (sv-112 process) - (sv-128 entity) - (sv-144 string) - (sv-160 string) - (sv-176 uint) - ) + (local-vars (r0-0 uint128) (v1-44 uint128)) (let ((s5-0 (entity-by-name (-> arg0 entity-name)))) (set! (-> arg0 real-entity-name) #f) (when s5-0 @@ -385,8 +376,9 @@ (format 0 "ERROR : camera entity '~S' didn't produce a state~%" (res-lump-struct s5-0 'name structure)) ) ) - (set! sv-96 0) - (let ((s4-1 (res-lump-data s5-0 'alternates pointer :tag-ptr (the-as (pointer res-tag) (& sv-96))))) + (let* ((sv-96 0) + (s4-1 (res-lump-data s5-0 'alternates pointer :tag-ptr (the-as (pointer res-tag) (& sv-96)))) + ) (when s4-1 (let ((s3-1 (process-spawn camera-slave @@ -410,69 +402,67 @@ ) (< s2-1 (shr (* (the-as int v1-44) 2) 49)) ) - (set! sv-128 (entity-by-name (the-as string (-> (the-as (pointer uint32) (&+ s4-1 (* s2-1 4))))))) - (cond - (sv-128 - (let ((s1-2 (cam-state-from-entity sv-128))) - (cond - (s1-2 - (set! sv-112 (get-process *camera-dead-pool* camera-slave #x4000 1)) - (let ((s0-0 (when sv-112 - (let ((t9-14 (method-of-type camera-slave activate))) - (t9-14 (the-as camera-slave sv-112) *camera* "camera-slave" (the-as pointer #x70004000)) - ) - (run-now-in-process sv-112 cam-slave-init s1-2 sv-128) - (-> sv-112 ppointer) - ) - ) - ) - (cond - (s0-0 - (setup-slave-for-hopefull (the-as camera-slave (ppointer->process s0-0))) - (cond - ((master-is-hopeful-better? - (the-as camera-slave (ppointer->process s3-1)) - (the-as camera-slave (ppointer->process s0-0)) - ) - (if s3-1 - (deactivate (-> s3-1 0)) - ) - (set! s3-1 (the-as (pointer camera-slave) s0-0)) - (set! (-> arg0 real-entity-name) (the-as string (-> (the-as (pointer uint32) (&+ s4-1 (* s2-1 4)))))) - (set! (-> arg0 cam-mode) (the-as symbol s1-2)) + (let ((sv-128 (entity-by-name (the-as string (-> (the-as (pointer uint32) (&+ s4-1 (* s2-1 4)))))))) + (cond + (sv-128 + (let ((s1-2 (cam-state-from-entity sv-128))) + (cond + (s1-2 + (let* ((sv-112 (get-process *camera-dead-pool* camera-slave #x4000 1)) + (s0-0 (when sv-112 + ((method-of-type camera-slave activate) + (the-as camera-slave sv-112) + *camera* + "camera-slave" + (the-as pointer #x70004000) + ) + (run-now-in-process sv-112 cam-slave-init s1-2 sv-128) + (-> sv-112 ppointer) + ) + ) ) - (else - (deactivate (-> s0-0 0)) + (cond + (s0-0 + (setup-slave-for-hopefull (the-as camera-slave (ppointer->process s0-0))) + (cond + ((master-is-hopeful-better? + (the-as camera-slave (ppointer->process s3-1)) + (the-as camera-slave (ppointer->process s0-0)) + ) + (if s3-1 + (deactivate (-> s3-1 0)) + ) + (set! s3-1 (the-as (pointer camera-slave) s0-0)) + (set! (-> arg0 real-entity-name) (the-as string (-> (the-as (pointer uint32) (&+ s4-1 (* s2-1 4)))))) + (set! (-> arg0 cam-mode) (the-as symbol s1-2)) + ) + (else + (deactivate (-> s0-0 0)) + ) ) ) - ) - (else - (format 0 "ERROR : alternate region activate failed~%") + (else + (format 0 "ERROR : alternate region activate failed~%") + ) ) ) ) - ) - (else - (let ((s1-5 format) - (s0-1 0) - ) - (set! sv-144 "ERROR : alternate camera region '~S' didn't produce a state~%") - (let ((a2-10 (res-lump-struct sv-128 'name structure))) - (s1-5 s0-1 sv-144 a2-10) + (else + (format + 0 + "ERROR : alternate camera region '~S' didn't produce a state~%" + (res-lump-struct sv-128 'name structure) ) ) ) ) ) - ) - (else - (let ((s1-7 format) - (s0-2 0) - ) - (set! sv-160 "ERROR : alternate '~S' not found for '~S'~%") - (set! sv-176 (-> (the-as (pointer uint32) (&+ s4-1 (* s2-1 4))))) - (let ((a3-10 (res-lump-struct s5-0 'name structure))) - (s1-7 s0-2 sv-160 sv-176 a3-10) + (else + (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/goal_src/jak3/engine/camera/cam-states.gc b/goal_src/jak3/engine/camera/cam-states.gc index 08d7983ede..81b3cb3228 100644 --- a/goal_src/jak3/engine/camera/cam-states.gc +++ b/goal_src/jak3/engine/camera/cam-states.gc @@ -1544,86 +1544,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 'inline-array 'vector 4))) - (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 sv-208 z) 0.0) - ) - (else - (vector-! sv-160 sv-144 (-> arg0 0 vertex sv-208)) - (set! (-> s5-0 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 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 sv-208 x)) - ) - ) - (if (< f28-0 0.0) - (set! (-> s5-0 sv-208 y) (- (vector-length sv-192))) - (set! (-> s5-0 sv-208 y) (vector-length sv-192)) - ) - ) - (set! (-> s5-0 sv-208 x) (- sv-128 (-> s5-0 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) (-> s5-0 s4-1)) - ) - #f - ) - ((< (-> s5-0 3 y) 0.0) - (dotimes (s4-2 4) - (when (>= (-> s5-0 3 y) (-> s5-0 s4-2 y)) - (set! (-> s5-0 s4-2 y) (- (-> s5-0 s4-2 y))) - (dist-info-append (-> gp-0 ccw) (-> s5-0 s4-2)) - ) - ) - #f - ) - (else - (dotimes (s4-3 4) - (if (>= (-> s5-0 s4-3 y) (-> s5-0 3 y)) - (dist-info-append (-> gp-0 cw) (-> s5-0 s4-3)) - ) - ) - #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 'inline-array 'vector 4)) + (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 sv-208 z) 0.0) + ) + (else + (vector-! sv-160 sv-144 (-> arg0 0 vertex sv-208)) + (set! (-> s5-0 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 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 sv-208 x)) + ) + ) + (if (< f28-0 0.0) + (set! (-> s5-0 sv-208 y) (- (vector-length sv-192))) + (set! (-> s5-0 sv-208 y) (vector-length sv-192)) + ) + ) + (set! (-> s5-0 sv-208 x) (- sv-128 (-> s5-0 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) (-> s5-0 s4-1)) + ) + #f + ) + ((< (-> s5-0 3 y) 0.0) + (dotimes (s4-2 4) + (when (>= (-> s5-0 3 y) (-> s5-0 s4-2 y)) + (set! (-> s5-0 s4-2 y) (- (-> s5-0 s4-2 y))) + (dist-info-append (-> gp-0 ccw) (-> s5-0 s4-2)) + ) + ) + #f + ) + (else + (dotimes (s4-3 4) + (if (>= (-> s5-0 s4-3 y) (-> s5-0 3 y)) + (dist-info-append (-> gp-0 cw) (-> s5-0 s4-3)) + ) + ) + #f ) ) ) @@ -1834,153 +1831,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)) ) - (vector-copy! (-> s1-0 start-pos) arg0) - (vector-copy! (-> s1-0 move-dist) arg1) - (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)) - ) - ;; og:preserve-this vector-dot - ; (.mula.s f2-0 f5-0) - ; (.madda.s f3-0 f6-0) - ; (.madd.s f2-1 f4-0 f7-0) - (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* - (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) + (vector-copy! (-> s1-0 start-pos) arg0) + (vector-copy! (-> s1-0 move-dist) arg1) + (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)) ) ) ) @@ -2057,13 +2030,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) ) ) @@ -2589,153 +2562,143 @@ ) ) ) - (s4-0 (new 'stack-no-clear 'matrix)) + (s4-0 (new-stack-matrix0)) + (gp-3 (new-stack-vector0)) + (s5-3 (new-stack-vector0)) ) - (set! (-> s4-0 rvec quad) (the-as uint128 0)) - (set! (-> s4-0 uvec quad) (the-as uint128 0)) - (set! (-> s4-0 fvec quad) (the-as uint128 0)) - (set! (-> s4-0 trans quad) (the-as uint128 0)) - (let ((gp-3 (new-stack-vector0)) - (s5-3 (new-stack-vector0)) - ) ;; og:preserve-this ;; (if (-> *camera* settings flip-horizontal) ;; (set! f30-2 (- f30-2)) ;; ) - (if (or (logtest? (cam-slave-options-u32 BLOCK_RIGHT_STICK) (-> self options)) - (logtest? (-> *camera* settings master-options) (cam-master-options BLOCK_RIGHT_STICK)) + (if (or (logtest? (cam-slave-options-u32 BLOCK_RIGHT_STICK) (-> self options)) + (logtest? (-> *camera* settings master-options) (cam-master-options BLOCK_RIGHT_STICK)) + ) + (set! f30-2 0.0) + ) + (if (-> *setting-control* user-default camera-stick-dir) + (set! f30-2 (- f30-2)) + ) + (if (-> self have-phony-joystick) + (set! f30-2 (* 21845.334 (-> self phony-joystick-x) (seconds-per-frame))) + ) + (when (or (logtest? (cam-slave-options-u32 ALLOW_SHIFT_BUTTONS) (-> self options)) + (logtest? (-> *camera* settings master-options) (cam-master-options USE_L1_R1)) ) - (set! f30-2 0.0) - ) - (if (-> *setting-control* user-default camera-stick-dir) - (set! f30-2 (- f30-2)) - ) - (if (-> self have-phony-joystick) - (set! f30-2 (* 21845.334 (-> self phony-joystick-x) (seconds-per-frame))) - ) - (when (or (logtest? (cam-slave-options-u32 ALLOW_SHIFT_BUTTONS) (-> self options)) - (logtest? (-> *camera* settings master-options) (cam-master-options USE_L1_R1)) + (when (logtest? (-> *camera* settings master-options) (cam-master-options READ_BUTTONS)) + (if (cpad-hold? (-> *CAMERA-bank* joypad) r1) + (+! f30-2 (+ (* 10922.667 (seconds-per-frame)) + (analog-input + (the-as int (-> *cpad-list* cpads (-> *CAMERA-bank* joypad) abutton (abutton-idx r1))) ;; og:preserve-this abutton indexing + 0.0 + 32.0 + 230.0 + (* 21845.334 (seconds-per-frame)) + ) + ) ) - (when (logtest? (-> *camera* settings master-options) (cam-master-options READ_BUTTONS)) - (if (cpad-hold? (-> *CAMERA-bank* joypad) r1) - (+! f30-2 (+ (* 10922.667 (seconds-per-frame)) - (analog-input - (the-as int (-> *cpad-list* cpads (-> *CAMERA-bank* joypad) abutton (abutton-idx r1))) ;; og:preserve-this abutton indexing - 0.0 - 32.0 - 230.0 - (* 21845.334 (seconds-per-frame)) - ) + ) + ) + (when (logtest? (-> *camera* settings master-options) (cam-master-options READ_BUTTONS)) + (if (cpad-hold? (-> *CAMERA-bank* joypad) l1) + (set! f30-2 (- f30-2 (+ (* 10922.667 (seconds-per-frame)) + (analog-input + (the-as int (-> *cpad-list* cpads (-> *CAMERA-bank* joypad) abutton (abutton-idx l1))) ;; og:preserve-this abutton indexing + 0.0 + 32.0 + 230.0 + (* 21845.334 (seconds-per-frame)) + ) + ) ) ) - ) - ) - (when (logtest? (-> *camera* settings master-options) (cam-master-options READ_BUTTONS)) - (if (cpad-hold? (-> *CAMERA-bank* joypad) l1) - (set! f30-2 (- f30-2 (+ (* 10922.667 (seconds-per-frame)) - (analog-input - (the-as int (-> *cpad-list* cpads (-> *CAMERA-bank* joypad) abutton (abutton-idx l1))) ;; og:preserve-this abutton indexing - 0.0 - 32.0 - 230.0 - (* 21845.334 (seconds-per-frame)) - ) - ) - ) - ) - ) - ) - ) - (cond - ((and (= (-> self los-state) (slave-los-state ccw)) (< 0.0 f30-2)) - (let ((f0-82 - (fmax (-> self string-min-val z) (fmin (-> self string-max-val z) (vector-length (-> self view-flat)))) - ) - ) - (set! f30-2 (* 21845.334 (+ 0.1 (/ (-> self string-min-val z) f0-82)) (seconds-per-frame))) - ) - ) - ((and (= (-> self los-state) (slave-los-state cw)) (< f30-2 0.0)) - (let ((f0-88 - (fmax (-> self string-min-val z) (fmin (-> self string-max-val z) (vector-length (-> self view-flat)))) - ) - ) - (set! f30-2 (* -21845.334 (+ 0.1 (/ (-> self string-min-val z) f0-88)) (seconds-per-frame))) - ) - ) - ) - (cond - ((!= f30-2 0.0) - (logior! (-> self options) (cam-slave-options-u32 PLAYER_MOVING_CAMERA)) - (matrix-axis-angle! s4-0 (-> *camera* local-down) f30-2) - (vector-matrix*! (-> self view-flat) (-> self view-flat) s4-0) - (set! (-> self butt-timer) 0) - (set! (-> self butt-seek) #f) - (when (logtest? (cam-slave-options-u32 HAVE_BUTT_HANDLE) (-> self options)) - (kill-persister *setting-control* (the-as engine-pers 'butt-handle) 'butt-handle) - (logclear! (-> self options) (cam-slave-options-u32 HAVE_BUTT_HANDLE)) - ) - ) - ((or (logtest? (-> self options) (cam-slave-options-u32 BUTT_CAM)) - (let ((s3-0 (handle->process (-> *camera* settings butt-handle)))) - (if (type? s3-0 process-drawable) - s3-0 - ) - ) - ) - (vector-normalize-copy! gp-3 (-> self view-flat) 1.0) - (let ((v1-303 (handle->process (-> *camera* settings butt-handle)))) - (cond - (v1-303 - (logior! (-> self options) (cam-slave-options-u32 HAVE_BUTT_HANDLE)) - (let* ((s3-1 (quaternion->matrix (new 'stack-no-clear 'matrix) (-> (the-as process-drawable v1-303) root quat))) - (a2-18 (matrix-axis-angle! - (new 'stack-no-clear 'matrix) - (-> s3-1 uvec) - (+ 32768.0 (-> *camera* settings butt-angle)) - ) - ) - ) - (vector-matrix*! s5-3 (-> s3-1 fvec) a2-18) - ) - (vector-flatten! s5-3 s5-3 (-> *camera* local-down)) - ) - ((< (- (current-time) (-> self butt-timer)) 0) - (vector-flatten! s5-3 (-> self butt-vector) (-> *camera* local-down)) - ) - (else - (vector-flatten! s5-3 (-> *camera* tgt-rot-mat fvec) (-> *camera* local-down)) - ) - ) - ) - (vector-normalize! s5-3 -1.0) - (when (and (logtest? (cam-slave-options-u32 HAVE_BUTT_HANDLE) (-> self options)) - (< (cos 910.2222) (vector-dot gp-3 s5-3)) - ) - (kill-persister *setting-control* (the-as engine-pers 'butt-handle) 'butt-handle) - (logclear! (-> self options) (cam-slave-options-u32 HAVE_BUTT_HANDLE)) - ) - (matrix-from-two-vectors-max-angle! s4-0 gp-3 s5-3 546.13336) - (vector-matrix*! (-> self view-flat) (-> self view-flat) s4-0) - ) - (else - (logclear! (-> self options) (cam-slave-options-u32 HAVE_BUTT_HANDLE)) - ) - ) - (when (logtest? (-> *camera* settings slave-options) (cam-slave-options BIKE_MODE)) - (vector-normalize-copy! gp-3 (-> self view-flat) 1.0) - (vector-flatten! s5-3 (-> *camera* tgt-rot-mat fvec) (-> *camera* local-down)) - (vector-normalize! s5-3 -1.0) - (let ((f0-97 (acos (vector-dot s5-3 gp-3)))) - (when (and (< (-> self max-angle-offset) f0-97) (< f0-97 32585.955)) - (matrix-from-two-vectors-max-angle! - s4-0 - gp-3 - s5-3 - (fmin 546.13336 (* 0.5 (- f0-97 (-> self max-angle-offset)))) - ) - (vector-matrix*! (-> self view-flat) (-> self view-flat) s4-0) ) + ) + ) + (cond + ((and (= (-> self los-state) (slave-los-state ccw)) (< 0.0 f30-2)) + (let ((f0-82 + (fmax (-> self string-min-val z) (fmin (-> self string-max-val z) (vector-length (-> self view-flat)))) + ) + ) + (set! f30-2 (* 21845.334 (+ 0.1 (/ (-> self string-min-val z) f0-82)) (seconds-per-frame))) + ) + ) + ((and (= (-> self los-state) (slave-los-state cw)) (< f30-2 0.0)) + (let ((f0-88 + (fmax (-> self string-min-val z) (fmin (-> self string-max-val z) (vector-length (-> self view-flat)))) + ) + ) + (set! f30-2 (* -21845.334 (+ 0.1 (/ (-> self string-min-val z) f0-88)) (seconds-per-frame))) + ) + ) + ) + (cond + ((!= f30-2 0.0) + (logior! (-> self options) (cam-slave-options-u32 PLAYER_MOVING_CAMERA)) + (matrix-axis-angle! s4-0 (-> *camera* local-down) f30-2) + (vector-matrix*! (-> self view-flat) (-> self view-flat) s4-0) + (set! (-> self butt-timer) 0) + (set! (-> self butt-seek) #f) + (when (logtest? (cam-slave-options-u32 HAVE_BUTT_HANDLE) (-> self options)) + (kill-persister *setting-control* (the-as engine-pers 'butt-handle) 'butt-handle) + (logclear! (-> self options) (cam-slave-options-u32 HAVE_BUTT_HANDLE)) + ) + ) + ((or (logtest? (-> self options) (cam-slave-options-u32 BUTT_CAM)) + (as-type (handle->process (-> *camera* settings butt-handle)) process-drawable) + ) + (vector-normalize-copy! gp-3 (-> self view-flat) 1.0) + (let ((v1-303 (handle->process (-> *camera* settings butt-handle)))) + (cond + (v1-303 + (logior! (-> self options) (cam-slave-options-u32 HAVE_BUTT_HANDLE)) + (let* ((s3-1 (quaternion->matrix (new 'stack-no-clear 'matrix) (-> (the-as process-drawable v1-303) root quat))) + (a2-18 (matrix-axis-angle! + (new 'stack-no-clear 'matrix) + (-> s3-1 uvec) + (+ 32768.0 (-> *camera* settings butt-angle)) + ) + ) + ) + (vector-matrix*! s5-3 (-> s3-1 fvec) a2-18) + ) + (vector-flatten! s5-3 s5-3 (-> *camera* local-down)) + ) + ((< (- (current-time) (-> self butt-timer)) 0) + (vector-flatten! s5-3 (-> self butt-vector) (-> *camera* local-down)) + ) + (else + (vector-flatten! s5-3 (-> *camera* tgt-rot-mat fvec) (-> *camera* local-down)) + ) + ) + ) + (vector-normalize! s5-3 -1.0) + (when (and (logtest? (cam-slave-options-u32 HAVE_BUTT_HANDLE) (-> self options)) + (< (cos 910.2222) (vector-dot gp-3 s5-3)) + ) + (kill-persister *setting-control* (the-as engine-pers 'butt-handle) 'butt-handle) + (logclear! (-> self options) (cam-slave-options-u32 HAVE_BUTT_HANDLE)) + ) + (matrix-from-two-vectors-max-angle! s4-0 gp-3 s5-3 546.13336) + (vector-matrix*! (-> self view-flat) (-> self view-flat) s4-0) + ) + (else + (logclear! (-> self options) (cam-slave-options-u32 HAVE_BUTT_HANDLE)) + ) + ) + (when (logtest? (-> *camera* settings slave-options) (cam-slave-options BIKE_MODE)) + (vector-normalize-copy! gp-3 (-> self view-flat) 1.0) + (vector-flatten! s5-3 (-> *camera* tgt-rot-mat fvec) (-> *camera* local-down)) + (vector-normalize! s5-3 -1.0) + (let ((f0-97 (acos (vector-dot s5-3 gp-3)))) + (when (and (< (-> self max-angle-offset) f0-97) (< f0-97 32585.955)) + (matrix-from-two-vectors-max-angle! + s4-0 + gp-3 + s5-3 + (fmin 546.13336 (* 0.5 (- f0-97 (-> self max-angle-offset)))) + ) + (vector-matrix*! (-> self view-flat) (-> self view-flat) s4-0) ) ) ) diff --git a/goal_src/jak3/engine/camera/cam-update.gc b/goal_src/jak3/engine/camera/cam-update.gc index afa9542252..889d708ffd 100644 --- a/goal_src/jak3/engine/camera/cam-update.gc +++ b/goal_src/jak3/engine/camera/cam-update.gc @@ -27,7 +27,6 @@ ) (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))) @@ -66,22 +65,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-9 (-> arg3 trans quad))) - (set! (-> sv-240 quad) v1-9) - ) - (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)) + (vector-copy! sv-240 (-> arg3 trans)) + (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/goal_src/jak3/engine/camera/camera.gc b/goal_src/jak3/engine/camera/camera.gc index 9ef06d6bfa..d131c1a8eb 100644 --- a/goal_src/jak3/engine/camera/camera.gc +++ b/goal_src/jak3/engine/camera/camera.gc @@ -314,9 +314,7 @@ ) (defun fourth-power ((arg0 float)) - (let ((f0-2 (* arg0 arg0))) - (* f0-2 f0-2) - ) + (square (square arg0)) ) (defun third-power ((arg0 float)) @@ -332,19 +330,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))))) ) ) ) @@ -383,59 +372,57 @@ (define *cam-res-string* (new 'global 'string 64 (the-as string #f))) (defmethod cam-index-method-9 ((this cam-index) (arg0 symbol) (arg1 entity) (arg2 vector) (arg3 curve)) - (local-vars (sv-32 (function _varargs_ object)) (sv-48 (function _varargs_ object))) - (let* ((s2-0 cam-slave-get-flags) - (s0-0 arg1) - (v1-0 arg0) - (a1-1 - (cond - ((= v1-0 'focalpull) - 'focalpull-flags - ) - ((= v1-0 'campoints) - 'campoints-flags - ) - (else - (set! sv-32 format) - (let ((a0-4 (clear *cam-res-string*)) - (a1-2 "~S-flags") - (a2-1 arg0) - ) - (sv-32 a0-4 a1-2 a2-1) + (let ((s2-0 cam-slave-get-flags) + (s0-0 arg1) + (v1-0 arg0) + ) + (set! (-> this flags) + (the-as + cam-index-options + (s2-0 + s0-0 + (cond + ((= v1-0 'focalpull) + 'focalpull-flags ) - (format 0 "WARNING: cam-index-init is using string->symbol to build symbol ~A at runtime.~%" *cam-res-string*) - (string->symbol *cam-res-string*) - ) - ) - ) - ) - (set! (-> this flags) (the-as cam-index-options (s2-0 s0-0 a1-1))) + ((= v1-0 'campoints) + 'campoints-flags + ) + (else + (format (clear *cam-res-string*) "~S-flags" arg0) + (format 0 "WARNING: cam-index-init is using string->symbol to build symbol ~A at runtime.~%" *cam-res-string*) + (string->symbol *cam-res-string*) + ) + ) + ) + ) + ) ) (let* ((s2-1 (res-lump-data arg1 arg0 pointer)) (s0-1 (method-of-type res-lump get-property-struct)) (v1-4 arg0) - (a1-5 - (cond - ((= v1-4 'focalpull) - 'focalpull-offset - ) - ((= v1-4 'campoints) - 'campoints-offset - ) - (else - (set! sv-48 format) - (let ((a0-12 (clear *cam-res-string*)) - (a1-6 "~S-offset") - ) - (sv-48 a0-12 a1-6 arg0) - ) - (format 0 "WARNING: cam-index-init is using string->symbol to build symbol ~A at runtime.~%" *cam-res-string*) - (string->symbol *cam-res-string*) - ) - ) - ) (v0-10 - (s0-1 arg1 a1-5 'interp -1000000000.0 (the-as structure #f) (the-as (pointer res-tag) #f) *res-static-buf*) + (s0-1 + arg1 + (cond + ((= v1-4 'focalpull) + 'focalpull-offset + ) + ((= v1-4 'campoints) + 'campoints-offset + ) + (else + (format (clear *cam-res-string*) "~S-offset" arg0) + (format 0 "WARNING: cam-index-init is using string->symbol to build symbol ~A at runtime.~%" *cam-res-string*) + (string->symbol *cam-res-string*) + ) + ) + 'interp + -1000000000.0 + (the-as structure #f) + (the-as (pointer res-tag) #f) + *res-static-buf* + ) ) ) (cond @@ -1214,7 +1201,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 @@ -1245,11 +1231,13 @@ (vector-flatten! s0-0 s0-0 (-> *camera* local-down)) (vector-normalize! s0-0 1.0) (vector-float*! s2-0 (-> *camera* tgt-face-mat fvec) 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)) ) @@ -1267,10 +1255,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) ) @@ -1318,10 +1303,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)) ) ) ) @@ -1478,7 +1463,6 @@ ;; WARN: Return type mismatch int vs vector. (defun vector-into-frustum-nosmooth! ((arg0 matrix) (arg1 vector) (arg2 float)) - (local-vars (sv-112 vector) (sv-128 vector) (sv-144 vector) (sv-160 vector) (sv-176 vector)) (rlet ((vf0 :class vf) (vf1 :class vf) (vf2 :class vf) @@ -1499,17 +1483,19 @@ (vector-flatten! s3-0 s3-0 (-> arg0 uvec)) (vector-normalize! s3-0 1.0) (let ((f28-0 (vector-dot s3-0 (-> arg0 rvec)))) - (set! sv-128 s2-0) - (set! sv-112 (-> arg0 rvec)) - (let ((f0-7 (* 0.8 (tan (/ arg2 2))))) - (.lvf vf1 (&-> sv-112 quad)) - (let ((v1-11 f0-7)) - (.mov vf2 v1-11) + (let ((sv-128 s2-0)) + (let ((sv-112 (-> arg0 rvec)) + (f0-7 (* 0.8 (tan (/ arg2 2)))) + ) + (.lvf vf1 (&-> sv-112 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 fvec)) (vector-normalize! s2-0 f26-0) (vector--float*! s2-0 s2-0 (-> arg0 rvec) 6144.0) @@ -1532,17 +1518,19 @@ (vector-flatten! s3-0 s3-0 (-> arg0 rvec)) (vector-normalize! s3-0 1.0) (let ((f28-1 (vector-dot s3-0 (-> arg0 uvec)))) - (set! sv-160 s2-0) - (set! sv-144 (-> arg0 uvec)) - (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 uvec)) + (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 fvec)) (vector-normalize! s2-0 1.0) (let ((f0-18 (vector-dot s2-0 (-> arg0 uvec)))) @@ -1558,12 +1546,7 @@ (vector-flatten! s3-0 s3-0 (-> arg0 rvec)) (vector-normalize! s3-0 1.0) (let ((f28-2 (vector-dot s3-0 (-> arg0 uvec)))) - (let ((s0-1 s2-0)) - (set! sv-176 (-> arg0 uvec)) - (let ((f0-26 (* 0.525 (tan (/ arg2 2))))) - (vector-float*! s0-1 sv-176 f0-26) - ) - ) + (vector-float*! s2-0 (-> arg0 uvec) (* 0.525 (tan (/ arg2 2)))) (vector+! s2-0 s2-0 (-> arg0 fvec)) (vector-normalize! s2-0 1.0) (let ((f0-28 (vector-dot s2-0 (-> arg0 uvec)))) @@ -1603,15 +1586,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 (v1-60 matrix) (f0-9 float)) (rlet ((vf0 :class vf) (vf4 :class vf) (vf5 :class vf) @@ -1627,22 +1602,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*! @@ -1662,49 +1638,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)) - ) - ;; og:preserve-this vector-dot - ; (.mula.s f0-8 f3-0) - ; (.madda.s f1-1 f4-0) - ; (.madd.s f0-9 f2-0 f5-0) - (set! f0-9 (vector-dot v1-25 sv-224)) - ) - (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) ) ) ) @@ -1717,31 +1679,17 @@ (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) - ) - (cond - (arg4 - (slave-matrix-blend-2 (-> arg0 inv-mat) arg2 s0-0 s1-0) - ) - (else - (let* ((v1-60 (-> arg0 inv-mat)) - (a3-2 s1-0) - (a0-34 (-> a3-2 rvec quad)) - (a1-19 (-> a3-2 uvec quad)) - (a2-7 (-> a3-2 fvec quad)) - (a3-3 (-> a3-2 trans quad)) - ) - (set! (-> v1-60 rvec quad) a0-34) - (set! (-> v1-60 uvec quad) a1-19) - (set! (-> v1-60 fvec quad) a2-7) - (set! (-> v1-60 trans quad) a3-3) + (vector-into-frustum-nosmooth! s1-0 arg1 (lerp-clamp arg3 (/ arg3 4) (-> arg0 underwater-blend value))) + (set! v1-60 (cond + (arg4 + (slave-matrix-blend-2 (-> arg0 inv-mat) arg2 s0-0 s1-0) + v1-60 + ) + (else + (matrix-copy! (-> arg0 inv-mat) s1-0) + ) + ) ) - ) - ) ) (mat-remove-z-rot (-> arg0 inv-mat) (-> *camera* local-down)) (cond @@ -1778,99 +1726,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 rvec quad) (the-as uint128 0)) - (set! (-> sv-176 uvec quad) (the-as uint128 0)) - (set! (-> sv-176 fvec quad) (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 rvec quad) (the-as uint128 0)) + (set! (-> sv-176 uvec quad) (the-as uint128 0)) + (set! (-> sv-176 fvec quad) (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 + (vector-copy! s0-0 arg1) + (vector-copy! sv-160 arg2) + (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 - (vector-copy! s0-0 arg1) - (vector-copy! sv-160 arg2) - (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)) - ) - ;; og:preserve-this vector-dot - ; (.mula.s f0-9 f3-0) - ; (.madda.s f1-2 f4-0) - ; (.madd.s f0-10 f2-0 f5-0) - (set! f0-10 (vector-dot v1-22 sv-160)) - ) - (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))) @@ -1884,10 +1804,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 @@ -1919,18 +1840,7 @@ ) ) (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)) - ) - ;; og:preserve-this vector-dot - ; (.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))) @@ -1938,14 +1848,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/goal_src/jak3/engine/collide/collide-cache.gc b/goal_src/jak3/engine/collide/collide-cache.gc index 07244352c2..84d1e2fffd 100644 --- a/goal_src/jak3/engine/collide/collide-cache.gc +++ b/goal_src/jak3/engine/collide/collide-cache.gc @@ -667,14 +667,12 @@ ) (vector+float*! (-> s3-0 rvec) (-> arg0 start-pos) (-> arg0 move-dist) f0-6) ) - (let ((f0-7 (vector-vector-distance-squared (-> s3-0 rvec) (-> 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 rvec) (-> 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)) ) ) ) @@ -703,14 +701,12 @@ ) (vector+float*! (-> s3-0 rvec) (-> arg0 start-pos) (-> arg0 move-dist) f0-11) ) - (let ((f0-12 (vector-vector-distance-squared (-> s3-0 rvec) (-> 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 rvec) (-> 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/goal_src/jak3/engine/collide/collide-edge-grab.gc b/goal_src/jak3/engine/collide/collide-edge-grab.gc index 95296bc5f2..f8fa8720ea 100644 --- a/goal_src/jak3/engine/collide/collide-edge-grab.gc +++ b/goal_src/jak3/engine/collide/collide-edge-grab.gc @@ -132,7 +132,6 @@ ;; 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) @@ -152,19 +151,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)) @@ -526,7 +527,6 @@ ) (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)) @@ -563,13 +563,7 @@ (s1-0 #t) (s0-0 577) ) - (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/goal_src/jak3/engine/collide/collide-shape-rider.gc b/goal_src/jak3/engine/collide/collide-shape-rider.gc index d25d4e9a5f..29b681aada 100644 --- a/goal_src/jak3/engine/collide/collide-shape-rider.gc +++ b/goal_src/jak3/engine/collide/collide-shape-rider.gc @@ -188,14 +188,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)) ) ) ) @@ -229,14 +225,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/goal_src/jak3/engine/collide/collide-shape.gc b/goal_src/jak3/engine/collide/collide-shape.gc index 53e6684095..6fb964cca8 100644 --- a/goal_src/jak3/engine/collide/collide-shape.gc +++ b/goal_src/jak3/engine/collide/collide-shape.gc @@ -260,7 +260,6 @@ (vf4 :class vf) (vf5 :class vf) (vf6 :class vf) - (vf7 :class vf) ) (init-vf0-vector) (let ((v1-0 (-> arg0 prim-core prim-type))) @@ -553,7 +552,6 @@ ) (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))))) @@ -593,51 +591,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))) + ) + (vector-copy! arg1 (-> s1-0 best-other-tri intersect)) + (+! 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))) - ) - (vector-copy! arg1 (-> s1-0 best-other-tri intersect)) - (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)) ) ) ) @@ -916,73 +913,73 @@ ) (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))) - ) - (vector-copy! sv-48 (-> arg1 best-other-tri normal)) - (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))) + ) + (vector-copy! sv-48 (-> arg1 best-other-tri normal)) + (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) + ) ) ) + (vector-copy! sv-52 sv-48) + (if (= (-> arg1 best-dist) 0.0) + (move-by-vector! arg0 (vector-normalize-copy! (new-stack-vector0) sv-52 6.0)) + ) + (vector-copy! (-> arg0 poly-normal) (-> arg1 best-other-tri normal)) + (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 best-other-prim) + (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)) + (vector-copy! (-> arg0 local-normal) sv-52) + ) + ) + (when (and (not sv-96) (>= (-> arg0 coverage) 0.9)) + (logior! sv-56 (collide-status on-ground)) + (vector-copy! (-> arg0 ground-poly-normal) (-> arg0 poly-normal)) + (when (!= (-> arg0 poly-pat mode) (pat-mode wall)) + (set! (-> arg0 ground-pat) (-> arg0 poly-pat)) + (set! (-> arg0 ground-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)) - ) - (vector-copy! (-> arg0 poly-normal) (-> arg1 best-other-tri normal)) - (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 best-other-prim) - (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))) - (vector-copy! (-> arg0 local-normal) sv-52) - ) - ) - (when (and (not sv-96) (>= (-> arg0 coverage) 0.9)) - (set! sv-56 (logior sv-56 (collide-status on-ground))) - (vector-copy! (-> arg0 ground-poly-normal) (-> arg0 poly-normal)) - (when (!= (-> arg0 poly-pat mode) (pat-mode wall)) - (set! (-> arg0 ground-pat) (-> arg0 poly-pat)) - (set! (-> arg0 ground-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) ) @@ -1040,7 +1037,6 @@ ) (defmethod step-collision! ((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)) ) @@ -1052,10 +1048,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 (>= (-> s0-0 prim-core prim-type) 0) (collide-with-collide-cache-prim-mesh s1-1 s5-0 s0-0) @@ -1716,22 +1712,23 @@ ) (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) + ) (set! (-> s1-0 count) (min 1023 (+ (-> s1-0 count) 1))) (+! (-> s1-0 depth) 1) (set! (-> s1-0 max-depth) (max (-> s1-0 max-depth) (-> s1-0 depth))) @@ -2085,6 +2082,7 @@ (.add.mul.y.vf acc vf3 vf1 acc) (.add.mul.z.vf.xyz vf1 vf4 vf1 acc) + ;; og:preserve-this ;; this check is added in the PC port. It's added for the same reason as the modification ;; to vector<-cspace!. On the first frame of a process-drawable being alive, the bones will often be zero ;; on PS2, this would have a potentially harmless result of setting this bone to 0, putting the collision geometry at 0. @@ -2373,14 +2371,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)) ) ) ) @@ -2414,14 +2408,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)) ) ) ) @@ -2554,11 +2544,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) @@ -2595,11 +2581,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) @@ -2904,7 +2886,6 @@ ) (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) @@ -2912,63 +2893,60 @@ ) (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 (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 collide-shape (-> (the-as process-drawable gp-0) root)) arg1) (when (logtest? (-> sv-160 prim-core action) (collide-action no-standon)) - (let ((v1-12 (touching-prims-entry-method-9 s0-0 (new 'stack-no-clear 'vector)))) - (set! sv-176 (new 'stack-no-clear 'vector)) + (let ((v1-12 (touching-prims-entry-method-9 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))) - (vector-copy! s2-1 (-> (the-as process-focusable gp-0) root transv)) - (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) - (vector-copy! s2-1 (vector-z-quaternion! s2-1 (-> (the-as process-focusable gp-0) root quat))) - ) - (vector-xz-normalize! s2-1 (fmax f30-0 arg4)) - ) - (set! (-> s2-1 y) arg3) - (send-event - gp-0 - 'shove - arg1 - (static-attack-info :mask (vehicle-impulse-factor) ((id (new-attack-id)) - (damage 2.0) - (vehicle-damage-factor 1.0) - (vehicle-impulse-factor 1.0) - (vector s2-1) - (angle 'jump) - ) - ) + (.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))) + (vector-copy! s2-1 (-> (the-as process-focusable gp-0) root transv)) + (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) + (vector-copy! s2-1 (vector-z-quaternion! s2-1 (-> (the-as process-focusable gp-0) root quat))) + ) + (vector-xz-normalize! s2-1 (fmax f30-0 arg4)) + ) + (set! (-> s2-1 y) arg3) + (send-event + gp-0 + 'shove + arg1 + (static-attack-info :mask (vehicle-impulse-factor) ((id (new-attack-id)) + (damage 2.0) + (vehicle-damage-factor 1.0) + (vehicle-impulse-factor 1.0) + (vector s2-1) + (angle 'jump) + ) + ) + ) ) + (return #t) ) - (return #t) ) ) - (set! s0-0 (-> s0-0 next)) ) + (set! s0-0 (-> s0-0 next)) ) ) ) diff --git a/goal_src/jak3/engine/collide/find-nearest.gc b/goal_src/jak3/engine/collide/find-nearest.gc index 9e4ec2176c..921f6306e2 100644 --- a/goal_src/jak3/engine/collide/find-nearest.gc +++ b/goal_src/jak3/engine/collide/find-nearest.gc @@ -46,15 +46,7 @@ (arg6 vector) (arg7 float) ) - (local-vars - (f0-12 float) - (sv-704 (function float float float)) - (sv-720 float) - (sv-736 vector) - (sv-752 vector) - (sv-768 (function float float float)) - (sv-784 float) - ) + (local-vars (f0-12 float)) (with-pp (rlet ((acc :class vf) (vf0 :class vf) @@ -102,45 +94,31 @@ (let* ((s2-1 (get-trans (the-as process-focusable s3-0) 3)) (f30-0 (- (vector-vector-distance (-> gp-0 point) s2-1) (-> s2-1 w))) ) - (when (#if PC_PORT (and (nonzero? (-> s0-0 root-prim prim-core collide-as)) (or (not (-> *pc-settings* fix-projectile-focus)) (logtest? (collide-action solid semi-solid) (-> s0-0 root-prim prim-core action)))) - (nonzero? (-> s0-0 root-prim prim-core collide-as))) + ;; og:preserve-this + (when (#if PC_PORT (and (nonzero? (-> s0-0 root-prim prim-core collide-as)) (or (not (-> *pc-settings* fix-projectile-focus)) (logtest? (collide-action solid semi-solid) (-> s0-0 root-prim prim-core action)))) + (nonzero? (-> s0-0 root-prim prim-core collide-as))) (let ((s0-1 (search-info-flag))) 0.0 - (set! sv-736 (vector-normalize! (vector-! (new 'stack-no-clear 'vector) s2-1 (-> gp-0 point)) 1.0)) - (let ((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-6 (vector-y-angle sv-736))) - (fabs (sv-704 sv-720 a1-6)) + (let* ((sv-736 (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)) + (fabs (deg-diff (vector-y-angle (-> gp-0 rot-base)) (vector-y-angle sv-736))) + ) + ((logtest? (-> gp-0 mask) (search-info-flag prefer-angle)) + (- -9999.0 (vector-dot sv-736 (-> gp-0 rot-base))) + ) + ((logtest? (search-info-flag prefer-center) (-> gp-0 mask)) + (* f30-0 (fmax 0.01 (- 1.0 (vector-dot sv-736 (-> gp-0 rot-base))))) + ) + (else + f30-0 ) ) - ((logtest? (-> gp-0 mask) (search-info-flag prefer-angle)) - (- -9999.0 (vector-dot sv-736 (-> gp-0 rot-base))) - ) - ((logtest? (search-info-flag prefer-center) (-> gp-0 mask)) - (* f30-0 (fmax 0.01 (- 1.0 (vector-dot sv-736 (-> gp-0 rot-base))))) - ) - (else - f30-0 - ) - ) - ) - ) + ) + ) (cond ((logtest? (-> gp-0 mask) (search-info-flag cull-angle-simple)) - (let* ((v1-41 (-> gp-0 rot-base)) - ; (f0-11 (-> sv-736 x)) - ; (f1-6 (-> sv-736 y)) - ; (f2-2 (-> sv-736 z)) - ; (f3-0 (-> v1-41 x)) - ; (f4-0 (-> v1-41 y)) - ; (f5-0 (-> v1-41 z)) - ) - ;; og:preserve-this - ; (.mula.s f0-11 f3-0) - ; (.madda.s f1-6 f4-0) - ; (.madd.s f0-12 f2-2 f5-0) + (let* ((v1-41 (-> gp-0 rot-base))) (set! f0-12 (vector-dot sv-736 v1-41)) ) (if (< f0-12 (cos (-> gp-0 rot-range))) @@ -150,8 +128,9 @@ ((logtest? (-> gp-0 mask) (search-info-flag cull-angle)) (cond ((< (-> gp-0 rot-range) 14563.556) - (let ((f26-1 (vector-dot (vector-! (new 'stack-no-clear 'vector) s2-1 (-> gp-0 point)) (-> gp-0 rot-base)))) - (set! sv-752 (new 'stack-no-clear 'vector)) + (let ((f26-1 (vector-dot (vector-! (new 'stack-no-clear 'vector) s2-1 (-> gp-0 point)) (-> gp-0 rot-base))) + (sv-752 (new 'stack-no-clear 'vector)) + ) (let ((v1-53 (-> gp-0 point)) (a0-27 (-> gp-0 rot-base)) (f0-17 f26-1) @@ -166,14 +145,9 @@ (.mul.x.vf acc vf2 vf3) (.add.mul.w.vf.xyz vf4 vf1 vf0 acc) (.svf (&-> sv-752 quad) vf4) - (let ((f26-2 (* f26-1 (tan (-> gp-0 rot-range)))) - (t9-10 vector-vector-distance) - (a1-8 s2-1) - ) - (if (< f26-2 (- (t9-10 sv-752 a1-8) (-> s2-1 w))) - (goto cfg-104) - ) - ) + (if (< (* f26-1 (tan (-> gp-0 rot-range))) (- (vector-vector-distance sv-752 s2-1) (-> s2-1 w))) + (goto cfg-104) + ) ) ) (else @@ -184,15 +158,9 @@ ) ) ((logtest? (-> gp-0 mask) (search-info-flag cull-xz)) - (let ((f26-4 (-> gp-0 rot-range))) - (set! sv-768 deg-diff) - (set! sv-784 (vector-y-angle (-> gp-0 rot-base))) - (let ((a1-9 (vector-y-angle sv-736))) - (if (< f26-4 (fabs (sv-768 sv-784 a1-9))) - (goto cfg-104) - ) + (if (< (-> gp-0 rot-range) (fabs (deg-diff (vector-y-angle (-> gp-0 rot-base)) (vector-y-angle sv-736)))) + (goto cfg-104) ) - ) ) ) (when (logtest? (-> gp-0 mask) (search-info-flag back-point)) diff --git a/goal_src/jak3/engine/collide/los-control.gc b/goal_src/jak3/engine/collide/los-control.gc index d0286c9f5a..78be4c50d7 100644 --- a/goal_src/jak3/engine/collide/los-control.gc +++ b/goal_src/jak3/engine/collide/los-control.gc @@ -31,7 +31,7 @@ ) (defmethod los-control-method-9 ((this los-control) (arg0 process-focusable) (arg1 vector) (arg2 float) (arg3 float)) - (local-vars (a0-22 int) (a0-24 int) (sv-592 vector)) + (local-vars (a0-22 int) (a0-24 int)) (rlet ((vf0 :class vf) (vf4 :class vf) (vf5 :class vf) @@ -66,35 +66,34 @@ (set! arg0 (as-type (handle->process (-> this dst-proc)) process-focusable)) ) (when (or (the-as process arg0) arg1) - (set! sv-592 (new 'stack-no-clear 'vector)) - (let ((v1-24 (-> (get-trans (the-as process-focusable s1-0) 10) quad))) - (set! (-> sv-592 quad) v1-24) - ) - (let ((s0-2 (new 'stack-no-clear 'collide-query))) - (if (not arg1) - (set! arg1 (get-trans arg0 3)) - ) - (vector-copy! (-> s0-2 start-pos) sv-592) - (set! (-> s0-2 ignore-process0) s1-0) - (set! (-> s0-2 ignore-process1) (the-as process arg0)) - (set! (-> s0-2 ignore-pat) (-> (the-as process-focusable s1-0) root pat-ignore-mask)) - (set! (-> s0-2 action-mask) (collide-action solid semi-solid)) - (let ((s2-1 (new 'stack-no-clear 'vector))) - (.lvf vf4 (&-> arg1 quad)) - (.lvf vf5 (&-> sv-592 quad)) - (.mov.vf.w vf6 vf0) - (.sub.vf.xyz vf6 vf4 vf5) - (.svf (&-> s2-1 quad) vf6) - (let ((f30-0 (vector-length s2-1))) - (let ((f0-0 (los-control-method-13 this s0-2 s2-1 -2 arg3))) - (if (< f0-0 f30-0) - (vector-normalize! s2-1 f0-0) + (let ((sv-592 (new 'stack-no-clear 'vector))) + (vector-copy! sv-592 (get-trans (the-as process-focusable s1-0) 10)) + (let ((s0-2 (new 'stack-no-clear 'collide-query))) + (if (not arg1) + (set! arg1 (get-trans arg0 3)) + ) + (vector-copy! (-> s0-2 start-pos) sv-592) + (set! (-> s0-2 ignore-process0) s1-0) + (set! (-> s0-2 ignore-process1) (the-as process arg0)) + (set! (-> s0-2 ignore-pat) (-> (the-as process-focusable s1-0) root pat-ignore-mask)) + (set! (-> s0-2 action-mask) (collide-action solid semi-solid)) + (let ((s2-1 (new 'stack-no-clear 'vector))) + (.lvf vf4 (&-> arg1 quad)) + (.lvf vf5 (&-> sv-592 quad)) + (.mov.vf.w vf6 vf0) + (.sub.vf.xyz vf6 vf4 vf5) + (.svf (&-> s2-1 quad) vf6) + (let ((f30-0 (vector-length s2-1))) + (let ((f0-0 (los-control-method-13 this s0-2 s2-1 -2 arg3))) + (if (< f0-0 f30-0) + (vector-normalize! s2-1 f0-0) + ) + ) + (if (< (los-control-method-13 this s0-2 s2-1 1 arg2) f30-0) + (set-time! (-> this last-lost-los)) + (set-time! (-> this last-gained-los)) ) ) - (if (< (los-control-method-13 this s0-2 s2-1 1 arg2) f30-0) - (set-time! (-> this last-lost-los)) - (set-time! (-> this last-gained-los)) - ) ) ) ) diff --git a/goal_src/jak3/engine/common-obs/airlock.gc b/goal_src/jak3/engine/common-obs/airlock.gc index dcb4ba2df9..e26e7b97f0 100644 --- a/goal_src/jak3/engine/common-obs/airlock.gc +++ b/goal_src/jak3/engine/common-obs/airlock.gc @@ -112,7 +112,6 @@ ) (defmethod init-airlock! ((this com-airlock)) - (local-vars (sv-16 res-tag) (sv-32 res-tag)) (process-entity-status! this (entity-perm-status subtask-complete) #f) (set! (-> this open?) #f) (process-drawable-from-entity! this (-> this entity)) @@ -149,8 +148,9 @@ ) (set! (-> this open-distance 0) 143360.0) (set! (-> this open-distance 1) 143360.0) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-21 (res-lump-data (-> this entity) 'distance (pointer float) :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-21 (res-lump-data (-> this entity) 'distance (pointer float) :tag-ptr (& sv-16))) + ) (when v1-21 (if (>= (-> sv-16 elt-count) (the-as uint 1)) (set! (-> this open-distance 0) (-> v1-21 0)) @@ -162,8 +162,9 @@ ) (set! (-> this active-distance 0) (+ 143360.0 (-> this open-distance 0))) (set! (-> this active-distance 1) (+ 143360.0 (-> this open-distance 1))) - (set! sv-32 (new 'static 'res-tag)) - (let ((v1-25 (res-lump-data (-> this entity) 'idle-distance (pointer float) :tag-ptr (& sv-32)))) + (let* ((sv-32 (new 'static 'res-tag)) + (v1-25 (res-lump-data (-> this entity) 'idle-distance (pointer float) :tag-ptr (& sv-32))) + ) (when v1-25 (if (>= (-> sv-32 elt-count) (the-as uint 1)) (set! (-> this active-distance 0) (-> v1-25 0)) diff --git a/goal_src/jak3/engine/common-obs/basebutton.gc b/goal_src/jak3/engine/common-obs/basebutton.gc index b053437783..17d243457f 100644 --- a/goal_src/jak3/engine/common-obs/basebutton.gc +++ b/goal_src/jak3/engine/common-obs/basebutton.gc @@ -388,7 +388,6 @@ (defmethod init-from-entity! ((this basebutton) (arg0 entity-actor)) "Set up a newly created process from the entity that created it." - (local-vars (sv-16 res-tag)) (init! 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))) @@ -403,11 +402,12 @@ (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 actor-group) :tag-ptr (& sv-16))) + ) (cond ((and v1-15 (nonzero? (-> sv-16 elt-count))) - (set! (-> this actor-group) (the-as (pointer actor-group) v1-15)) + (set! (-> this actor-group) v1-15) (set! (-> this actor-group-count) (the-as int (-> sv-16 elt-count))) ) (else diff --git a/goal_src/jak3/engine/common-obs/blocking-plane.gc b/goal_src/jak3/engine/common-obs/blocking-plane.gc index 2d1f6447cb..e23646423a 100644 --- a/goal_src/jak3/engine/common-obs/blocking-plane.gc +++ b/goal_src/jak3/engine/common-obs/blocking-plane.gc @@ -164,16 +164,12 @@ (vector-cross! (-> s1-0 fvec) (-> s1-0 rvec) (-> s1-0 uvec)) (vector-normalize! (-> s1-0 fvec) 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 (/ arg1 2))) - (set! (-> v1-20 z) 0.0) - (let ((f0-17 0.5) - (f1-7 (* f30-1 f30-1)) - (f2-2 arg1) - ) - (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 (/ arg1 2)) + 0.0 + (* 0.5 (sqrtf (+ (square f30-1) (square arg1)))) ) ) ) diff --git a/goal_src/jak3/engine/common-obs/collectables.gc b/goal_src/jak3/engine/common-obs/collectables.gc index 5ab4ee6807..13d6c1b20b 100644 --- a/goal_src/jak3/engine/common-obs/collectables.gc +++ b/goal_src/jak3/engine/common-obs/collectables.gc @@ -2684,118 +2684,116 @@ ) (defun pickup-ammo-set! ((arg0 fact-info) (arg1 (pointer pickup-type)) (arg2 (pointer float)) (arg3 int)) - (local-vars (v0-5 number) (sv-16 float)) + (local-vars (v0-5 number)) (let ((s2-0 (-> *game-info* features))) 0.0 - (let ((f22-0 0.0) - (f26-0 0.0) - (f28-0 0.0) - (f30-0 0.0) - ) - (set! sv-16 (the-as float (if (logtest? s2-0 (game-feature gun-yellow-1 gun-yellow-2 gun-yellow-3)) + (let* ((f22-0 0.0) + (f26-0 0.0) + (f28-0 0.0) + (f30-0 0.0) + (sv-16 (the-as float (if (logtest? s2-0 (game-feature gun-yellow-1 gun-yellow-2 gun-yellow-3)) (get-max-ammo-for-gun *game-info* (pickup-type ammo-yellow)) 0.0 ) ) - ) - (let* ((f20-0 (if (logtest? s2-0 (game-feature gun-red-1 gun-red-2 gun-red-3)) - (get-max-ammo-for-gun *game-info* (pickup-type ammo-red)) - 0.0 - ) - ) - (f24-0 (if (logtest? s2-0 (game-feature gun-blue-1 gun-blue-2 gun-blue-3)) - (get-max-ammo-for-gun *game-info* (pickup-type ammo-blue)) - 0.0 - ) - ) - (f0-2 (if (logtest? (game-feature gun-dark-1 gun-dark-2 gun-dark-3) s2-0) - (get-max-ammo-for-gun *game-info* (pickup-type ammo-dark)) - 0.0 - ) - ) - (f4-0 (if (logtest? s2-0 (game-feature gun-yellow-1 gun-yellow-2 gun-yellow-3)) - (-> *game-info* gun-ammo 0) - 0.0 - ) - ) - (f1-2 (if (logtest? s2-0 (game-feature gun-red-1 gun-red-2 gun-red-3)) - (-> *game-info* gun-ammo 1) - 0.0 - ) - ) - (f2-1 (if (logtest? s2-0 (game-feature gun-blue-1 gun-blue-2 gun-blue-3)) - (-> *game-info* gun-ammo 2) - 0.0 - ) - ) - (f3-1 (if (logtest? (game-feature gun-dark-1 gun-dark-2 gun-dark-3) s2-0) - (-> *game-info* gun-ammo 3) - 0.0 - ) - ) - (f22-1 (+ f22-0 (- sv-16 f4-0))) - ) - (if (< 0.0 sv-16) - (set! f22-1 (/ f22-1 sv-16)) - ) - (let ((f1-4 (+ f26-0 (- f20-0 f1-2)))) - (if (< 0.0 f20-0) - (set! f1-4 (/ f1-4 f20-0)) - ) - (let ((f2-3 (+ f28-0 (- f24-0 f2-1)))) - (if (< 0.0 f24-0) - (set! f2-3 (/ f2-3 f24-0)) - ) - (let ((f3-3 (+ f30-0 (- f0-2 f3-1)))) - (if (< 0.0 f0-2) - (set! f3-3 (/ f3-3 f0-2)) ) - (let ((f26-1 (+ f22-1 f1-4 f2-3 f3-3))) - (when (= f26-1 0.0) - (set! f22-1 1.0) - (set! f26-1 1.0) + (f20-0 (if (logtest? s2-0 (game-feature gun-red-1 gun-red-2 gun-red-3)) + (get-max-ammo-for-gun *game-info* (pickup-type ammo-red)) + 0.0 + ) ) - (cond - ((!= f26-1 0.0) - (let* ((f24-1 (+ f1-4 f22-1)) - (f28-1 (+ f2-3 f24-1)) - (f30-1 (+ f3-3 f28-1)) - (v1-39 (/ (the-as int (rand-uint31-gen *random-generator*)) 256)) - (v1-40 (the-as number (logior #x3f800000 v1-39))) - (f0-10 (* (+ -1.0 (the-as float v1-40)) f26-1)) - ) - (set! v0-5 (cond - ((and (>= f22-1 f0-10) (logtest? s2-0 (game-feature gun-yellow-1 gun-yellow-2 gun-yellow-3))) - (set! v0-5 15) - (set! (-> arg1 0) (the-as pickup-type v0-5)) - v0-5 - ) - ((and (>= f24-1 f0-10) (logtest? s2-0 (game-feature gun-red-1 gun-red-2 gun-red-3))) - (set! (-> arg1 0) (pickup-type ammo-red)) - (if (>= 1 (mod (the-as int (rand-uint31-gen *random-generator*)) 3)) - (set! (-> arg2 0) (/ (-> arg2 0) 2)) - ) - ) - ((and (>= f28-1 f0-10) (logtest? s2-0 (game-feature gun-blue-1 gun-blue-2 gun-blue-3))) - (set! v0-5 17) - (set! (-> arg1 0) (the-as pickup-type v0-5)) - v0-5 - ) - ((and (>= f30-1 f0-10) (logtest? (game-feature gun-dark-1 gun-dark-2 gun-dark-3) s2-0)) - (set! (-> arg1 0) (pickup-type ammo-dark)) - (set! (-> arg2 0) (the float (the int (fmax 1.0 (/ (-> arg2 0) 15))))) - ) - (else - (pickup-dark-set! arg0 arg1 arg2 arg3) - ) - ) - ) + (f24-0 (if (logtest? s2-0 (game-feature gun-blue-1 gun-blue-2 gun-blue-3)) + (get-max-ammo-for-gun *game-info* (pickup-type ammo-blue)) + 0.0 + ) + ) + (f0-2 (if (logtest? (game-feature gun-dark-1 gun-dark-2 gun-dark-3) s2-0) + (get-max-ammo-for-gun *game-info* (pickup-type ammo-dark)) + 0.0 ) + ) + (f4-0 (if (logtest? s2-0 (game-feature gun-yellow-1 gun-yellow-2 gun-yellow-3)) + (-> *game-info* gun-ammo 0) + 0.0 + ) + ) + (f1-2 (if (logtest? s2-0 (game-feature gun-red-1 gun-red-2 gun-red-3)) + (-> *game-info* gun-ammo 1) + 0.0 + ) + ) + (f2-1 (if (logtest? s2-0 (game-feature gun-blue-1 gun-blue-2 gun-blue-3)) + (-> *game-info* gun-ammo 2) + 0.0 + ) + ) + (f3-1 (if (logtest? (game-feature gun-dark-1 gun-dark-2 gun-dark-3) s2-0) + (-> *game-info* gun-ammo 3) + 0.0 + ) + ) + (f22-1 (+ f22-0 (- sv-16 f4-0))) + ) + (if (< 0.0 sv-16) + (set! f22-1 (/ f22-1 sv-16)) + ) + (let ((f1-4 (+ f26-0 (- f20-0 f1-2)))) + (if (< 0.0 f20-0) + (set! f1-4 (/ f1-4 f20-0)) + ) + (let ((f2-3 (+ f28-0 (- f24-0 f2-1)))) + (if (< 0.0 f24-0) + (set! f2-3 (/ f2-3 f24-0)) + ) + (let ((f3-3 (+ f30-0 (- f0-2 f3-1)))) + (if (< 0.0 f0-2) + (set! f3-3 (/ f3-3 f0-2)) + ) + (let ((f26-1 (+ f22-1 f1-4 f2-3 f3-3))) + (when (= f26-1 0.0) + (set! f22-1 1.0) + (set! f26-1 1.0) + ) + (cond + ((!= f26-1 0.0) + (let* ((f24-1 (+ f1-4 f22-1)) + (f28-1 (+ f2-3 f24-1)) + (f30-1 (+ f3-3 f28-1)) + (v1-39 (/ (the-as int (rand-uint31-gen *random-generator*)) 256)) + (v1-40 (the-as number (logior #x3f800000 v1-39))) + (f0-10 (* (+ -1.0 (the-as float v1-40)) f26-1)) + ) + (set! v0-5 (cond + ((and (>= f22-1 f0-10) (logtest? s2-0 (game-feature gun-yellow-1 gun-yellow-2 gun-yellow-3))) + (set! v0-5 15) + (set! (-> arg1 0) (the-as pickup-type v0-5)) + v0-5 + ) + ((and (>= f24-1 f0-10) (logtest? s2-0 (game-feature gun-red-1 gun-red-2 gun-red-3))) + (set! (-> arg1 0) (pickup-type ammo-red)) + (if (>= 1 (mod (the-as int (rand-uint31-gen *random-generator*)) 3)) + (set! (-> arg2 0) (/ (-> arg2 0) 2)) + ) + ) + ((and (>= f28-1 f0-10) (logtest? s2-0 (game-feature gun-blue-1 gun-blue-2 gun-blue-3))) + (set! v0-5 17) + (set! (-> arg1 0) (the-as pickup-type v0-5)) + v0-5 + ) + ((and (>= f30-1 f0-10) (logtest? (game-feature gun-dark-1 gun-dark-2 gun-dark-3) s2-0)) + (set! (-> arg1 0) (pickup-type ammo-dark)) + (set! (-> arg2 0) (the float (the int (fmax 1.0 (/ (-> arg2 0) 15))))) + ) + (else + (pickup-dark-set! arg0 arg1 arg2 arg3) + ) + ) + ) ) - (else - (set! (-> arg1 0) (pickup-type none)) - 0 - ) + ) + (else + (set! (-> arg1 0) (pickup-type none)) + 0 ) ) ) @@ -2808,90 +2806,91 @@ ) (defmethod drop-pickup ((this fact-info) (arg0 symbol) (arg1 process-tree) (arg2 fact-info) (arg3 int) (arg4 symbol)) - (local-vars (sv-16 pickup-type) (sv-20 float)) - (set! sv-16 (-> this pickup-type)) - (set! sv-20 (-> this pickup-amount)) - (if (not arg4) - (set! sv-20 (fmin 10.0 sv-20)) - ) - (cond - ((= sv-16 (pickup-type ammo-random)) - (pickup-ammo-set! this (& sv-16) (& sv-20) arg3) - ) - ((= sv-16 (pickup-type eco-pill-random)) - (if (rand-vu-percent? 0.1) - (pickup-light-set! this (& sv-16) (& sv-20) arg3) - (pickup-dark-set! this (& sv-16) (& sv-20) arg3) - ) - ) - ((= sv-16 (pickup-type light-random)) - (cond - ((rand-vu-percent? 0.1) - (pickup-light-set! this (& sv-16) (& sv-20) arg3) + (let ((sv-16 (-> this pickup-type)) + (sv-20 (-> this pickup-amount)) ) - (else - (set! sv-16 (pickup-type none)) - 0 - ) + (if (not arg4) + (set! sv-20 (fmin 10.0 sv-20)) + ) + (cond + ((= sv-16 (pickup-type ammo-random)) + (pickup-ammo-set! this (& sv-16) (& sv-20) arg3) ) - ) - ((= sv-16 (pickup-type ammo-light-random)) - (let ((v1-17 (rand-vu-int-count 100))) + ((= sv-16 (pickup-type eco-pill-random)) + (if (rand-vu-percent? 0.1) + (pickup-light-set! this (& sv-16) (& sv-20) arg3) + (pickup-dark-set! this (& sv-16) (& sv-20) arg3) + ) + ) + ((= sv-16 (pickup-type light-random)) (cond - ((< v1-17 10) + ((rand-vu-percent? 0.1) (pickup-light-set! this (& sv-16) (& sv-20) arg3) ) - ((< v1-17 50) - (pickup-ammo-set! this (& sv-16) (& sv-20) arg3) - ) (else (set! sv-16 (pickup-type none)) 0 ) ) ) - ) - ((= sv-16 (pickup-type ammo-dark-light-random)) - (let ((v1-23 (rand-vu-int-count 100))) - (cond - ((< v1-23 10) - (pickup-light-set! this (& sv-16) (& sv-20) arg3) - ) - ((< v1-23 55) - (pickup-ammo-set! this (& sv-16) (& sv-20) arg3) - ) - (else - (pickup-dark-set! this (& sv-16) (& sv-20) arg3) + ((= sv-16 (pickup-type ammo-light-random)) + (let ((v1-17 (rand-vu-int-count 100))) + (cond + ((< v1-17 10) + (pickup-light-set! this (& sv-16) (& sv-20) arg3) + ) + ((< v1-17 50) + (pickup-ammo-set! this (& sv-16) (& sv-20) arg3) + ) + (else + (set! sv-16 (pickup-type none)) + 0 + ) ) ) ) - ) - ) - (if (= sv-16 (pickup-type none)) - (return (the-as (pointer process) #f)) - ) - (let ((s3-1 (new 'stack-no-clear 'collide-query))) - (vector-copy! (-> s3-1 start-pos) (-> (the-as process-drawable (-> this process)) root trans)) - (set-vector! (-> s3-1 move-dist) 0.0 -81920.0 0.0 1.0) - (+! (-> s3-1 start-pos y) 12288.0) - (let ((v1-33 s3-1)) - (set! (-> v1-33 radius) 40.96) - (set! (-> v1-33 collide-with) (collide-spec backgnd hit-by-others-list pusher)) - (set! (-> v1-33 ignore-process0) #f) - (set! (-> v1-33 ignore-process1) #f) - (set! (-> v1-33 ignore-pat) - (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) + ((= sv-16 (pickup-type ammo-dark-light-random)) + (let ((v1-23 (rand-vu-int-count 100))) + (cond + ((< v1-23 10) + (pickup-light-set! this (& sv-16) (& sv-20) arg3) ) - (set! (-> v1-33 action-mask) (collide-action solid)) + ((< v1-23 55) + (pickup-ammo-set! this (& sv-16) (& sv-20) arg3) + ) + (else + (pickup-dark-set! this (& sv-16) (& sv-20) arg3) + ) + ) + ) + ) ) - (if (>= (fill-and-probe-using-line-sphere *collide-cache* s3-1) 0.0) - (vector-copy! (-> s3-1 start-pos) (-> s3-1 best-other-tri intersect)) - (vector-copy! (-> s3-1 start-pos) (-> (the-as process-drawable (-> this process)) root trans)) + (if (= sv-16 (pickup-type none)) + (return (the-as (pointer process) #f)) ) - (if (= sv-16 (pickup-type fuel-cell)) - (+! (-> s3-1 start-pos y) 6144.0) + (let ((s3-1 (new 'stack-no-clear 'collide-query))) + (vector-copy! (-> s3-1 start-pos) (-> (the-as process-drawable (-> this process)) root trans)) + (set-vector! (-> s3-1 move-dist) 0.0 -81920.0 0.0 1.0) + (+! (-> s3-1 start-pos y) 12288.0) + (let ((v1-33 s3-1)) + (set! (-> v1-33 radius) 40.96) + (set! (-> v1-33 collide-with) (collide-spec backgnd hit-by-others-list pusher)) + (set! (-> v1-33 ignore-process0) #f) + (set! (-> v1-33 ignore-process1) #f) + (set! (-> v1-33 ignore-pat) + (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) + ) + (set! (-> v1-33 action-mask) (collide-action solid)) ) - (birth-pickup-at-point (-> s3-1 start-pos) sv-16 sv-20 arg0 arg1 this) + (if (>= (fill-and-probe-using-line-sphere *collide-cache* s3-1) 0.0) + (vector-copy! (-> s3-1 start-pos) (-> s3-1 best-other-tri intersect)) + (vector-copy! (-> s3-1 start-pos) (-> (the-as process-drawable (-> this process)) root trans)) + ) + (if (= sv-16 (pickup-type fuel-cell)) + (+! (-> s3-1 start-pos y) 6144.0) + ) + (birth-pickup-at-point (-> s3-1 start-pos) sv-16 sv-20 arg0 arg1 this) + ) ) ) diff --git a/goal_src/jak3/engine/common-obs/debris.gc b/goal_src/jak3/engine/common-obs/debris.gc index c1655d75d6..1e8ff7bf11 100644 --- a/goal_src/jak3/engine/common-obs/debris.gc +++ b/goal_src/jak3/engine/common-obs/debris.gc @@ -149,10 +149,6 @@ ) (defmethod do-collision ((this debris-group) (idx int)) - (local-vars - (sv-80 (function sound-name sound-id int int int sound-group object sound-id :behavior process-drawable)) - (name sound-name) - ) (let* ((debris-box (-> this boxes idx)) (box-num (-> debris-box num)) (box-start (-> debris-box start)) @@ -225,19 +221,9 @@ (f30-0 (sqrtf (+ (* (-> v1-38 x) (-> v1-38 x)) (* (-> v1-38 z) (-> v1-38 z))))) ) (let ((f28-0 (vector-length (-> s1-0 transv)))) - (when (< (-> s1-0 transv y) -61440.0) - (set! sv-80 sound-play-by-name) - (set! name (-> s1-0 params sound-hit)) - (let ((a1-14 (new-sound-id)) - (a2-5 1024) - (a3-6 0) - (t0-4 0) - (t1-0 0) - (t2-0 (-> s1-0 root)) - ) - (sv-80 name a1-14 a2-5 a3-6 t0-4 (the-as sound-group t1-0) t2-0) + (if (< (-> s1-0 transv y) -61440.0) + (sound-play-by-name (-> s1-0 params sound-hit) (new-sound-id) 1024 0 0 (sound-group) (-> s1-0 root)) ) - ) (vector-reflect! (-> s1-0 transv) (-> s1-0 transv) (-> cquery best-other-tri normal)) (vector-reflect! (-> s1-0 rot-axis) (-> s1-0 rot-axis) (-> cquery best-other-tri normal)) (set! (-> s1-0 rot-angle) f28-0) @@ -386,7 +372,6 @@ ) (defbehavior debris-group-init-by-other debris-group ((tuning debris-tuning) (params debris-static-params) (pdraw process-drawable)) - (local-vars (tuning-scale vector) (debris-scale vector) (sv-80 vector) (sv-96 vector) (sv-112 vector)) (rlet ((vf0 :class vf) (vf4 :class vf) (vf5 :class vf) @@ -413,27 +398,27 @@ (vector-matrix*! (-> debris root trans) (-> params joints i offset) joint-transform) ) ) - (set! debris-scale (-> debris root scale)) - (let ((s0-1 (-> debris root scale))) - (set! tuning-scale (new 'stack-no-clear 'vector)) - (set! (-> tuning-scale x) (rand-vu-float-range (-> tuning scale-rand-lo) (-> tuning scale-rand-hi))) - (set! (-> tuning-scale y) (rand-vu-float-range (-> tuning scale-rand-lo) (-> tuning scale-rand-hi))) - (set! (-> tuning-scale z) (rand-vu-float-range (-> tuning scale-rand-lo) (-> tuning scale-rand-hi))) - (set! (-> tuning-scale w) 1.0) - (.lvf vf4 (&-> s0-1 quad)) + (let ((debris-scale (-> debris root scale))) + (let ((s0-1 (-> debris root scale)) + (tuning-scale (new 'stack-no-clear 'vector)) + ) + (set! (-> tuning-scale x) (rand-vu-float-range (-> tuning scale-rand-lo) (-> tuning scale-rand-hi))) + (set! (-> tuning-scale y) (rand-vu-float-range (-> tuning scale-rand-lo) (-> tuning scale-rand-hi))) + (set! (-> tuning-scale z) (rand-vu-float-range (-> tuning scale-rand-lo) (-> tuning scale-rand-hi))) + (set! (-> tuning-scale w) 1.0) + (.lvf vf4 (&-> s0-1 quad)) + (.lvf vf5 (&-> tuning-scale quad)) + ) + (.add.x.vf.w vf6 vf0 vf0) + (.mul.vf.xyz vf6 vf4 vf5) + (.svf (&-> debris-scale quad) vf6) ) - (.lvf vf5 (&-> tuning-scale quad)) - (.add.x.vf.w vf6 vf0 vf0) - (.mul.vf.xyz vf6 vf4 vf5) - (.svf (&-> debris-scale quad) vf6) (case (-> tuning explosion) ((1) (vector-! (-> debris transv) (-> debris root trans) (-> tuning fountain-rand-transv-lo)) - (let ((s0-2 vector-normalize!)) - (set! sv-80 (-> debris transv)) - (let ((a1-17 (rand-vu-float-range (-> tuning fountain-rand-transv-hi x) (-> tuning fountain-rand-transv-hi y)))) - (s0-2 sv-80 a1-17) - ) + (vector-normalize! + (-> debris transv) + (rand-vu-float-range (-> tuning fountain-rand-transv-hi x) (-> tuning fountain-rand-transv-hi y)) ) (+! (-> debris transv y) (rand-vu-float-range (-> tuning fountain-rand-transv-hi z) (-> tuning fountain-rand-transv-hi w)) @@ -441,14 +426,16 @@ (set! (-> debris transv w) 1.0) ) (else - (set! sv-96 (-> tuning fountain-rand-transv-lo)) - (set! sv-112 (-> tuning fountain-rand-transv-hi)) - (set-vector! - (-> debris transv) - (rand-vu-float-range (-> sv-96 x) (-> sv-112 x)) - (rand-vu-float-range (-> sv-96 y) (-> sv-112 y)) - (rand-vu-float-range (-> sv-96 z) (-> sv-112 z)) - 1.0 + (let ((sv-96 (-> tuning fountain-rand-transv-lo)) + (sv-112 (-> tuning fountain-rand-transv-hi)) + ) + (set-vector! + (-> debris transv) + (rand-vu-float-range (-> sv-96 x) (-> sv-112 x)) + (rand-vu-float-range (-> sv-96 y) (-> sv-112 y)) + (rand-vu-float-range (-> sv-96 z) (-> sv-112 z)) + 1.0 + ) ) ) ) diff --git a/goal_src/jak3/engine/common-obs/elevator.gc b/goal_src/jak3/engine/common-obs/elevator.gc index 2f5c89b890..14905263b3 100644 --- a/goal_src/jak3/engine/common-obs/elevator.gc +++ b/goal_src/jak3/engine/common-obs/elevator.gc @@ -199,7 +199,7 @@ (let* ((f0-0 arg1) (f4-0 (- 1.0 arg1)) (f3-0 (/ f0-0 (- 1.0 f4-0))) - (f2-1 (* f0-0 f0-0)) + (f2-1 (square f0-0)) (f1-6 (+ (* 2.0 f0-0 (- f4-0 f0-0)) f2-1)) (f1-7 (+ (* (- 1.0 f4-0) (- 1.0 f4-0) f3-0) f1-6)) ) @@ -211,9 +211,7 @@ (+ (* 2.0 f0-0 (- arg0 f0-0)) f2-1) ) (else - (let ((f0-7 (- 1.0 arg0))) - (- f1-7 (* f0-7 f0-7 f3-0)) - ) + (- f1-7 (* (square (- 1.0 arg0)) f3-0)) ) ) f1-7 @@ -361,27 +359,24 @@ ) (defmethod find-closest-point-in-path! ((this elevator) (arg0 vector) (arg1 (pointer float)) (arg2 symbol) (arg3 symbol)) - (local-vars (sv-32 vector)) (let ((s1-0 (-> this params)) (f28-0 0.0) (f30-0 -1.0) ) (dotimes (s0-0 (-> this path curve num-cverts)) - (set! sv-32 (get-point-in-path! (-> this path) (new 'stack-no-clear 'vector) (the float s0-0) 'interp)) - (when (and (or (not arg2) (< (vector-vector-xz-distance sv-32 arg0) (-> s1-0 xz-threshold))) - (or (not arg3) - (< (fabs (- (-> sv-32 y) (-> arg0 y))) (-> s1-0 y-threshold)) - (and (= s0-0 (the int (-> this bottom-top 0))) (< (-> arg0 y) (-> sv-32 y))) - (and (= s0-0 (the int (-> this bottom-top 1))) (< (-> sv-32 y) (-> arg0 y))) - ) - ) - (let* ((t9-2 vector-vector-distance) - (a1-3 arg0) - (f0-12 (t9-2 sv-32 a1-3)) - ) - (when (or (= f30-0 -1.0) (< f0-12 f28-0)) - (set! f28-0 f0-12) - (set! f30-0 (the float s0-0)) + (let ((sv-32 (get-point-in-path! (-> this path) (new 'stack-no-clear 'vector) (the float s0-0) 'interp))) + (when (and (or (not arg2) (< (vector-vector-xz-distance sv-32 arg0) (-> s1-0 xz-threshold))) + (or (not arg3) + (< (fabs (- (-> sv-32 y) (-> arg0 y))) (-> s1-0 y-threshold)) + (and (= s0-0 (the int (-> this bottom-top 0))) (< (-> arg0 y) (-> sv-32 y))) + (and (= s0-0 (the int (-> this bottom-top 1))) (< (-> sv-32 y) (-> arg0 y))) + ) + ) + (let ((f0-12 (vector-vector-distance sv-32 arg0))) + (when (or (= f30-0 -1.0) (< f0-12 f28-0)) + (set! f28-0 f0-12) + (set! f30-0 (the float s0-0)) + ) ) ) ) @@ -404,7 +399,6 @@ ) (defmethod elevator-method-48 ((this elevator)) - (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) @@ -412,12 +406,13 @@ ) ) ) - (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)) - (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)) + (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)) + ) ) ) ) @@ -439,13 +434,13 @@ ;; WARN: Return type mismatch vector vs none. (defbehavior teleport-check elevator () - (local-vars (sv-16 float)) (when (and *target* (logtest? (-> self params flags) (elevator-flags teleport)) (focus-test? *target* teleporting)) - (set! sv-16 (the-as float 0.0)) - (when (find-closest-point-in-path! self (target-pos 0) (& sv-16) #f #t) - (set! (-> self move-pos 0) sv-16) - (set! (-> self move-pos 1) sv-16) - (get-point-in-path! (-> self path) (-> self basetrans) sv-16 'interp) + (let ((sv-16 (the-as float 0.0))) + (when (find-closest-point-in-path! self (target-pos 0) (& sv-16) #f #t) + (set! (-> self move-pos 0) sv-16) + (set! (-> self move-pos 1) sv-16) + (get-point-in-path! (-> self path) (-> self basetrans) sv-16 'interp) + ) ) ) (none) @@ -840,7 +835,6 @@ ;; WARN: Return type mismatch none vs object. (defmethod init-from-entity! ((this elevator) (arg0 entity-actor)) "Set up a newly created process from the entity that created it." - (local-vars (sv-32 float) (sv-36 path-control) (sv-40 target)) (stack-size-set! (-> this main-thread) 1024) (set! (-> this sound-running-loop) #f) (set! (-> this sound-arrived) #f) @@ -904,19 +898,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 teleport)) - (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 teleport)) + (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/goal_src/jak3/engine/common-obs/enemy-states.gc b/goal_src/jak3/engine/common-obs/enemy-states.gc index 55cbee7bce..6d9bab1d88 100644 --- a/goal_src/jak3/engine/common-obs/enemy-states.gc +++ b/goal_src/jak3/engine/common-obs/enemy-states.gc @@ -586,9 +586,7 @@ (when (or (not (-> self draw)) (and (or (not v1-2) (!= (-> v1-2 type) target)) (or (not (logtest? (-> self draw status) (draw-control-status on-screen))) - (let ((f0-1 450560.0)) - (< (* f0-1 f0-1) (vector-vector-xz-distance-squared (-> self root trans) (math-camera-pos))) - ) + (< (square 450560.0) (vector-vector-xz-distance-squared (-> self root trans) (math-camera-pos))) ) ) ) @@ -1301,7 +1299,7 @@ (defstate gun-dark-2-stretch (enemy) :virtual #t :event (behavior ((proc process) (argc int) (message symbol) (block event-message-block)) - (local-vars (v0-4 object) (sv-112 event-message-block) (sv-128 event-message-block)) + (local-vars (v0-4 object)) (case message (('attack) (let* ((s5-0 (the-as object (-> block param 1))) @@ -1312,23 +1310,13 @@ ((= v1-1 'gravity-end) (set! (-> self root transv quad) (the-as uint128 0)) (gun-dark-2-ragdoll-start self) - (let* ((s4-1 self) - (s1-0 (method-of-object s4-1 handle-incoming-attack!)) - (s0-0 proc) - ) - (set! sv-112 block) - (let ((a3-1 (get-penetrate-using-from-attack-event (the-as process-drawable proc) block)) - (t1-0 #f) - ) - (s1-0 - s4-1 - (the-as process-drawable s0-0) - sv-112 - a3-1 - (the-as attack-info s5-0) - (the-as touching-shapes-entry t1-0) - ) - ) + (handle-incoming-attack! + self + (the-as process-drawable proc) + block + (get-penetrate-using-from-attack-event (the-as process-drawable proc) block) + (the-as attack-info s5-0) + (the-as touching-shapes-entry #f) ) (damage-enemy-from-attack! self proc block) (set! (-> self incoming penetrate-using) (penetrate vehicle)) @@ -1350,24 +1338,13 @@ ) (else (when (!= (-> (the-as attack-info s5-0) id) (-> self incoming attack-id)) - (let* ((s2-1 self) - (s1-1 (method-of-object s2-1 handle-incoming-attack!)) - (s0-1 proc) - ) - (set! sv-128 block) - (let ((a3-2 (get-penetrate-using-from-attack-event (the-as process-drawable proc) block)) - (t0-1 (the-as uint s5-0)) - (t1-1 (-> block param 0)) - ) - (s1-1 - s2-1 - (the-as process-drawable s0-1) - sv-128 - a3-2 - (the-as attack-info t0-1) - (the-as touching-shapes-entry t1-1) - ) - ) + (handle-incoming-attack! + self + (the-as process-drawable proc) + block + (get-penetrate-using-from-attack-event (the-as process-drawable proc) block) + (the-as attack-info s5-0) + (the-as touching-shapes-entry (-> block param 0)) ) (knocked-handler self s4-0) (let ((gp-1 (-> self child))) diff --git a/goal_src/jak3/engine/common-obs/generic-obs.gc b/goal_src/jak3/engine/common-obs/generic-obs.gc index 2e1df965ff..d97159841c 100644 --- a/goal_src/jak3/engine/common-obs/generic-obs.gc +++ b/goal_src/jak3/engine/common-obs/generic-obs.gc @@ -84,10 +84,10 @@ ;; 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)) ) @@ -1975,7 +1975,6 @@ (defmethod init-from-entity! ((this part-spawner) (arg0 entity-actor)) "Set up a newly created process from the entity that created it." - (local-vars (sv-16 string)) (stack-size-set! (-> this main-thread) 64) (logior! (-> this mask) (process-mask ambient)) (+! (-> this clock ref-count) -1) @@ -2015,52 +2014,53 @@ ) ) ) - (set! sv-16 "#f") - (set! (-> this mode) (entity-lookup-part-group arg0 (& sv-16) 'art-name)) - (when (-> this mode) - (let ((s5-1 (-> this mode 0))) - (when (and (nonzero? s5-1) (= (-> s5-1 type) sparticle-launch-group)) - (cond - ((logtest? (-> s5-1 flags) (sp-group-flag sp8)) - (countdown (v1-60 (-> s5-1 length)) - (let* ((a0-34 (-> s5-1 launcher v1-60)) - (a2-12 (-> *part-id-table* (-> a0-34 launcher))) - ) - (when (nonzero? a2-12) - (let ((a1-22 (-> this level part-engine))) - (when (and a1-22 (< (-> a1-22 length) (-> a1-22 allocated-length))) - (let ((a3-14 (-> a1-22 data (-> a1-22 length)))) - (set! (-> a3-14 next1) (the-as connectable a2-12)) - (set! (-> a3-14 prev1) (the-as connectable (-> a0-34 hour-mask))) - (set! (-> (the-as vector (&-> a3-14 param0)) quad) (-> this root trans quad)) - (set! (-> a3-14 param3) (the-as int (-> a0-34 fade-after))) + (let ((sv-16 "#f")) + (set! (-> this mode) (entity-lookup-part-group arg0 (& sv-16) 'art-name)) + (when (-> this mode) + (let ((s5-1 (-> this mode 0))) + (when (and (nonzero? s5-1) (= (-> s5-1 type) sparticle-launch-group)) + (cond + ((logtest? (-> s5-1 flags) (sp-group-flag sp8)) + (countdown (v1-60 (-> s5-1 length)) + (let* ((a0-34 (-> s5-1 launcher v1-60)) + (a2-12 (-> *part-id-table* (-> a0-34 launcher))) + ) + (when (nonzero? a2-12) + (let ((a1-22 (-> this level part-engine))) + (when (and a1-22 (< (-> a1-22 length) (-> a1-22 allocated-length))) + (let ((a3-14 (-> a1-22 data (-> a1-22 length)))) + (set! (-> a3-14 next1) (the-as connectable a2-12)) + (set! (-> a3-14 prev1) (the-as connectable (-> a0-34 hour-mask))) + (set! (-> (the-as vector (&-> a3-14 param0)) quad) (-> this root trans quad)) + (set! (-> a3-14 param3) (the-as int (-> a0-34 fade-after))) + ) + (+! (-> a1-22 length) 1) ) - (+! (-> a1-22 length) 1) ) ) ) ) + (process-entity-status! this (entity-perm-status dead) #t) + (deactivate this) ) - (process-entity-status! this (entity-perm-status dead) #t) - (deactivate this) - ) - ((logtest? (-> s5-1 flags) (sp-group-flag sp9)) - (process-entity-status! this (entity-perm-status dead) #t) - (deactivate this) - ) - (else - (set! (-> this part) (create-launch-control s5-1 this)) - (when (logtest? (-> s5-1 flags) (sp-group-flag sp10)) - (process-entity-status! this (entity-perm-status subtask-complete) #t) - (set! (-> this enable) #f) + ((logtest? (-> s5-1 flags) (sp-group-flag sp9)) + (process-entity-status! this (entity-perm-status dead) #t) + (deactivate this) + ) + (else + (set! (-> this part) (create-launch-control s5-1 this)) + (when (logtest? (-> s5-1 flags) (sp-group-flag sp10)) + (process-entity-status! this (entity-perm-status subtask-complete) #t) + (set! (-> this enable) #f) + ) + (go (method-of-object this active)) ) - (go (method-of-object this active)) ) ) ) ) + (go process-drawable-art-error sv-16) ) - (go process-drawable-art-error sv-16) ) (deftype launcher (process-drawable) @@ -3479,10 +3479,10 @@ (defmethod init-from-entity! ((this part-controller) (arg0 entity-actor)) "Set up a newly created process from the entity that created it." - (local-vars (sv-16 res-tag) (sv-32 string)) (stack-size-set! (-> this main-thread) 32) - (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)) @@ -3522,10 +3522,11 @@ (set! (-> this particle-launchers length) 0) (dotimes (s4-0 (min 1 (-> this actor-group-count))) (dotimes (s3-0 (-> this actor-group s4-0 length)) - (set! sv-32 "#f") - (set! (-> this particle-launchers (-> this particle-launchers length)) - (entity-lookup-part-group (-> this actor-group s4-0 data s3-0 actor) (& sv-32) 'art-name) - ) + (let ((sv-32 "#f")) + (set! (-> this particle-launchers (-> this particle-launchers length)) + (entity-lookup-part-group (-> this actor-group s4-0 data s3-0 actor) (& sv-32) 'art-name) + ) + ) (+! (-> this particle-launchers length) 1) ) ) diff --git a/goal_src/jak3/engine/common-obs/water-anim.gc b/goal_src/jak3/engine/common-obs/water-anim.gc index 315f506f38..b90b7d2459 100644 --- a/goal_src/jak3/engine/common-obs/water-anim.gc +++ b/goal_src/jak3/engine/common-obs/water-anim.gc @@ -287,14 +287,14 @@ ;; WARN: Return type mismatch quaternion vs none. (defmethod set-offset-and-look! ((this water-anim)) - (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 wanim-look :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)) @@ -347,7 +347,6 @@ ;; WARN: Return type mismatch water-flag vs none. (defmethod water-anim-init! ((this 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 @@ -371,19 +370,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/goal_src/jak3/engine/common-obs/water-flow.gc b/goal_src/jak3/engine/common-obs/water-flow.gc index b4e8fa9e6a..f1202436ee 100644 --- a/goal_src/jak3/engine/common-obs/water-flow.gc +++ b/goal_src/jak3/engine/common-obs/water-flow.gc @@ -75,7 +75,7 @@ ) (defmethod flow-control-method-13 ((this flow-control) (arg0 water-info) (arg1 vector)) - (local-vars (v0-7 symbol) (sv-192 vector) (sv-208 vector) (sv-224 flow-section)) + (local-vars (v0-7 symbol)) (let ((s5-0 (new 'stack-no-clear 'vector))) (vector-copy! s5-0 arg1) (set! (-> s5-0 w) 1.0) @@ -94,63 +94,51 @@ (f0-9 (- (-> v1-10 y) (* (-> s3-0 pull-dir y) f0-7))) ) (when (and (>= f0-9 -41984.0) (>= 41779.2 f0-9)) - (let ((a0-11 (new 'stack-no-clear 'vector))) - (set! sv-192 (new 'stack-no-clear 'vector)) - (let* ((f30-0 (ray-plane-equation-intersect a0-11 s5-0 (-> s3-0 pull-dir) (the-as vector a3-0))) - (t9-1 ray-plane-equation-intersect) - (a1-5 s5-0) - (a2-4 (-> s3-0 pull-dir)) - (a3-1 (-> s3-0 trailing)) - (f0-10 (t9-1 sv-192 a1-5 a2-4 a3-1)) - ) - (vector+*! (new 'stack-no-clear 'vector) (-> s3-0 start) (-> s3-0 pull-dir) 12288.0) - 0 - (let ((f0-12 (/ f30-0 (- f30-0 f0-10)))) - (set! sv-208 (new 'stack-no-clear 'vector)) - (displacement-between-two-points-normalized! (-> this path) sv-208 (+ (the float (if (= s4-0 (+ s2-0 -1)) - (+ s4-0 -1) - s4-0 - ) - ) - f0-12 - ) - ) + (let* ((a0-11 (new 'stack-no-clear 'vector)) + (sv-192 (new 'stack-no-clear 'vector)) + (f30-0 (ray-plane-equation-intersect a0-11 s5-0 (-> s3-0 pull-dir) (the-as vector a3-0))) + (f0-10 (ray-plane-equation-intersect sv-192 s5-0 (-> s3-0 pull-dir) (-> s3-0 trailing))) + ) + (vector+*! (new 'stack-no-clear 'vector) (-> s3-0 start) (-> s3-0 pull-dir) 12288.0) + 0 + (let ((f0-12 (/ f30-0 (- f30-0 f0-10))) + (sv-208 (new 'stack-no-clear 'vector)) + ) + (displacement-between-two-points-normalized! (-> this path) sv-208 (+ (the float (if (= s4-0 (+ s2-0 -1)) + (+ s4-0 -1) + s4-0 + ) + ) + f0-12 + ) + ) + (let ((v1-22 (new 'stack-no-clear 'vector))) + (vector-float*! v1-22 sv-208 (* (-> s3-0 speed) (seconds-per-frame))) + (vector+*! (new 'stack-no-clear 'vector) s5-0 v1-22 2048.0) ) ) ) - (let ((v1-22 (new 'stack-no-clear 'vector))) - (let ((a0-15 v1-22) - (f0-15 (* (-> s3-0 speed) (seconds-per-frame))) - ) - (vector-float*! a0-15 sv-208 f0-15) - ) - (vector+*! (new 'stack-no-clear 'vector) s5-0 v1-22 2048.0) - ) 0 - (let ((s0-1 (-> s3-0 start))) - (set! sv-224 (-> s1-0 data (if (= s4-0 (+ s2-0 -1)) - (+ s4-0 -1) - (+ s4-0 1) - ) - ) + (let ((s0-1 (-> s3-0 start)) + (sv-224 (-> s1-0 data (if (= s4-0 (+ s2-0 -1)) + (+ s4-0 -1) + (+ s4-0 1) + ) + ) + ) + (s4-1 (new 'stack-no-clear 'vector)) + ) + (let ((s2-1 (new 'stack-no-clear 'vector)) + (s1-1 (new 'stack-no-clear 'vector)) ) - (let ((s4-1 (new 'stack-no-clear 'vector))) - (let ((s2-1 (new 'stack-no-clear 'vector)) - (s1-1 (new 'stack-no-clear 'vector)) - ) - (vector-copy! s2-1 (-> s3-0 pull-dir)) - (vector-normalize! s2-1 1.0) - (vector-cross! s1-1 s2-1 *y-vector*) - (vector-normalize! s1-1 1.0) - (vector-cross! (-> arg0 normal) s2-1 s1-1) - ) - (let ((t9-5 vector-segment-distance-point!) - (a3-2 s4-1) - ) - (t9-5 s5-0 s0-1 (-> sv-224 start) a3-2) - ) - (set! (-> arg0 trans y) (-> s4-1 y)) + (vector-copy! s2-1 (-> s3-0 pull-dir)) + (vector-normalize! s2-1 1.0) + (vector-cross! s1-1 s2-1 *y-vector*) + (vector-normalize! s1-1 1.0) + (vector-cross! (-> arg0 normal) s2-1 s1-1) ) + (vector-segment-distance-point! s5-0 s0-1 (-> sv-224 start) s4-1) + (set! (-> arg0 trans y) (-> s4-1 y)) ) (if (< (-> arg0 normal y) 0.0) (vector-negate! (-> arg0 normal) (-> arg0 normal)) @@ -263,14 +251,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)) ) ) ) @@ -305,14 +289,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) (-> this collide-bounds r))) - ) - (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) (-> this collide-bounds 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)) ) ) ) @@ -363,7 +343,6 @@ ) (defmethod setup ((this flow-control) (arg0 (pointer float)) (arg1 int)) - (local-vars (sv-32 int) (sv-48 flow-section) (sv-64 int) (sv-80 flow-section)) (let* ((s5-0 (-> this path)) (s4-0 (-> s5-0 curve num-cverts)) (s3-0 (new 'stack-no-clear 'vector)) @@ -373,42 +352,45 @@ (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) - (set! sv-32 (+ s4-0 -1)) - (set! sv-48 (the-as flow-section #f)) - (set! sv-64 0) - (while (< sv-64 sv-32) - (set! sv-80 (-> s0-0 data sv-64)) - (let ((f0-0 1.0)) - (if (< sv-64 arg1) - (set! f0-0 (-> arg0 sv-64)) - ) - (if arg0 - (set! (-> sv-80 speed) (* f0-0 (-> this speed))) - (set! (-> sv-80 speed) (-> this speed)) - ) - ) - (vector-copy! (-> sv-80 start) s3-0) - (get-point-in-path! s5-0 s3-0 (the float (+ sv-64 1)) 'interp) - (vector+! (the-as vector (-> this collide-bounds)) (the-as vector (-> this collide-bounds)) s3-0) - (vector-! (-> sv-80 pull-dir) s3-0 (-> sv-80 start)) - (vector-normalize! (-> sv-80 pull-dir) 1.0) - (set! (-> sv-80 trailing quad) (-> sv-80 pull-dir quad)) - (set! (-> sv-80 trailing y) 0.0) - (vector-normalize! (-> sv-80 trailing) 1.0) - (set-vector! (-> sv-80 radial-dir) (- (-> sv-80 trailing z)) 0.0 (-> sv-80 trailing x) 1.0) - (set! (-> sv-80 trailing w) (- (vector-dot s3-0 (the-as vector (-> sv-80 trailing))))) - (when sv-48 - (vector+! - (the-as vector (-> sv-48 trailing)) - (the-as vector (-> sv-48 trailing)) - (the-as vector (-> sv-80 trailing)) + (let ((sv-32 (+ s4-0 -1)) + (sv-48 (the-as flow-section #f)) + (sv-64 0) ) - (vector-normalize! (-> sv-48 trailing) 1.0) - (set! (-> sv-48 trailing w) (- (vector-dot (-> sv-80 start) (the-as vector (-> sv-48 trailing))))) + (while (< sv-64 sv-32) + (let ((sv-80 (-> s0-0 data sv-64))) + (let ((f0-0 1.0)) + (if (< sv-64 arg1) + (set! f0-0 (-> arg0 sv-64)) + ) + (if arg0 + (set! (-> sv-80 speed) (* f0-0 (-> this speed))) + (set! (-> sv-80 speed) (-> this speed)) + ) + ) + (vector-copy! (-> sv-80 start) s3-0) + (get-point-in-path! s5-0 s3-0 (the float (+ sv-64 1)) 'interp) + (vector+! (the-as vector (-> this collide-bounds)) (the-as vector (-> this collide-bounds)) s3-0) + (vector-! (-> sv-80 pull-dir) s3-0 (-> sv-80 start)) + (vector-normalize! (-> sv-80 pull-dir) 1.0) + (set! (-> sv-80 trailing quad) (-> sv-80 pull-dir quad)) + (set! (-> sv-80 trailing y) 0.0) + (vector-normalize! (-> sv-80 trailing) 1.0) + (set-vector! (-> sv-80 radial-dir) (- (-> sv-80 trailing z)) 0.0 (-> sv-80 trailing x) 1.0) + (set! (-> sv-80 trailing w) (- (vector-dot s3-0 (the-as vector (-> sv-80 trailing))))) + (when sv-48 + (vector+! + (the-as vector (-> sv-48 trailing)) + (the-as vector (-> sv-48 trailing)) + (the-as vector (-> sv-80 trailing)) + ) + (vector-normalize! (-> sv-48 trailing) 1.0) + (set! (-> sv-48 trailing w) (- (vector-dot (-> sv-80 start) (the-as vector (-> sv-48 trailing))))) + ) + (set! sv-48 sv-80) + ) + sv-48 + (+! sv-64 1) ) - (set! sv-48 sv-80) - sv-48 - (set! sv-64 (+ sv-64 1)) ) ) (let ((s2-1 (-> this sections data))) @@ -437,7 +419,6 @@ ) (defmethod new flow-control ((allocation symbol) (type-to-make type) (arg0 process-drawable) (arg1 res-lump)) - (local-vars (sv-16 res-tag)) (if (not arg1) (set! arg1 (-> arg0 entity)) ) @@ -453,8 +434,9 @@ ) (set! (-> gp-0 speed) (res-lump-float arg1 'speed :default 12288.0)) (set! (-> gp-0 belt-radius) (res-lump-float arg1 'extra-radius :default 16384.0)) - (set! sv-16 (new 'static 'res-tag)) - (let ((a1-6 (res-lump-data arg1 'scale-factor pointer :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (a1-6 (res-lump-data arg1 'scale-factor pointer :tag-ptr (& sv-16))) + ) (setup gp-0 (the-as (pointer float) a1-6) (the-as int (-> sv-16 elt-count))) ) ) diff --git a/goal_src/jak3/engine/common-obs/water.gc b/goal_src/jak3/engine/common-obs/water.gc index ad84274aff..dee53ceb34 100644 --- a/goal_src/jak3/engine/common-obs/water.gc +++ b/goal_src/jak3/engine/common-obs/water.gc @@ -221,7 +221,6 @@ ) (defmethod water-control-method-10 ((this water-control)) - (local-vars (sv-336 (function vector vector vector vector)) (sv-352 vector)) (with-pp (let ((s4-0 (-> this flags)) (s5-0 (new 'stack-no-clear 'water-info)) @@ -334,16 +333,14 @@ (f30-0 (sqrtf (+ (* (-> v1-102 x) (-> v1-102 x)) (* (-> v1-102 z) (-> v1-102 z))))) (s2-0 (new 'stack-no-clear 'matrix)) ) - (let ((s1-0 forward-up->inv-matrix) - (s0-0 s2-0) - ) - (set! sv-336 vector-flatten!) - (set! sv-352 (-> s2-0 fvec)) - (let ((a1-11 (vector-z-quaternion! (-> s2-0 fvec) (-> this process control quat))) - (a2-2 (-> s5-0 normal)) - ) - (s1-0 s0-0 (sv-336 sv-352 a1-11 a2-2) (-> s5-0 normal)) + (forward-up->inv-matrix + s2-0 + (vector-flatten! + (-> s2-0 fvec) + (vector-z-quaternion! (-> s2-0 fvec) (-> this process control quat)) + (-> s5-0 normal) ) + (-> s5-0 normal) ) (vector-copy! (-> s2-0 trans) s3-0) (set! (-> *part-id-table* 762 init-specs 1 initial-valuef) (* 0.000004150391 f30-0)) @@ -747,7 +744,6 @@ ) (defmethod spawn-ripples ((this water-control) (arg0 float) (arg1 vector) (arg2 int) (arg3 vector) (arg4 symbol)) - (local-vars (sv-112 vector)) (when (and (logtest? (water-flag part-splash) (-> this flags)) (logtest? (water-flag part-water) (-> this flags)) (cond @@ -755,12 +751,7 @@ (= (-> this process type) target) ) ((< 100 (-> *sp-particle-system-3d* num-alloc 0)) - (let ((s2-0 vector-vector-distance)) - (set! sv-112 arg1) - (let ((a1-1 (camera-pos))) - (< (s2-0 sv-112 a1-1) 81920.0) - ) - ) + (< (vector-vector-distance arg1 (camera-pos)) 81920.0) ) (else #t @@ -809,7 +800,6 @@ (arg3 collide-action) (arg4 process-drawable) ) - (local-vars (sv-256 process)) (when (and (-> arg0 prim) (= (-> arg0 prim region) (-> arg1 region))) (set! arg0 arg0) (goto cfg-96) @@ -849,14 +839,13 @@ ) ) (('water-anim) - (set! sv-256 (command-get-process - (-> (the-as pair (-> (the-as pair (-> (the-as pair s1-0) cdr)) cdr)) car) - (the-as process #f) - ) - ) - (let ((s0-0 (if (type? sv-256 process-drawable) - sv-256 + (let ((s0-0 (as-type + (command-get-process + (-> (the-as pair (-> (the-as pair (-> (the-as pair s1-0) cdr)) cdr)) car) + (the-as process #f) ) + process-drawable + ) ) ) (cond @@ -1053,7 +1042,7 @@ ;; ERROR: Unsupported inline assembly instruction kind - [movz v1, v1, a0] (defmethod water-info-init! ((this collide-shape) (arg0 water-info) (arg1 collide-action)) - (local-vars (v1-4 int) (a0-3 int) (sv-80 int)) + (local-vars (v1-4 int) (a0-3 int)) (let ((s4-0 (new 'stack-no-clear 'water-info))) (when (find-water-1 (the-as water-sphere (-> this root-prim prim-core)) arg0 s4-0) (let ((s3-0 (new 'static 'inline-array water-sphere 30 @@ -1091,8 +1080,9 @@ ) (s2-0 0) ) - (let ((s0-0 (-> this root-prim))) - (set! sv-80 30) + (let ((s0-0 (-> this root-prim)) + (sv-80 30) + ) (let ((a0-2 sv-80) (v1-3 (-> this total-prims)) ) @@ -1104,7 +1094,7 @@ (format *stdcon* "find-water exceeded FIND_WATER_MAX_PRIMS ~D/~D~%" (-> this total-prims) 30) ) (while (nonzero? sv-80) - (set! sv-80 (+ sv-80 -1)) + (+! sv-80 -1) (when (and (nonzero? (-> s0-0 prim-core prim-type)) (logtest? (-> s0-0 prim-core action) arg1) (nonzero? (-> s0-0 prim-core collide-with)) diff --git a/goal_src/jak3/engine/debug/collision-editor.gc b/goal_src/jak3/engine/debug/collision-editor.gc index f59be64d36..fdf8d8614e 100644 --- a/goal_src/jak3/engine/debug/collision-editor.gc +++ b/goal_src/jak3/engine/debug/collision-editor.gc @@ -143,7 +143,6 @@ ;; ERROR: Stack slot load at 272 mismatch: defined as size 4, got size 16 ;; ERROR: Stack slot load at 288 mismatch: defined as size 4, got size 16 (defun print-default-collision () - (local-vars (sv-224 matrix) (sv-240 symbol) (sv-256 string) (sv-272 float) (sv-288 float)) (let ((gp-0 (process-spawn collision-editor-default-proc :name "collision-editor-default-proc"))) (when gp-0 (when (and (nonzero? (-> (the-as process-drawable (-> gp-0 0)) draw)) @@ -278,32 +277,30 @@ (vector-float*! s3-0 s3-0 0.5) (vector<-cspace! s1-0 (-> (the-as process-drawable (-> gp-0 0)) node-list data (-> s0-0 transform-index))) (vector-! s1-0 s3-0 s1-0) - (set! sv-224 (new 'stack-no-clear 'matrix)) - (let* ((a0-34 (-> (the-as process-drawable (-> gp-0 0)) node-list data (-> s0-0 transform-index) bone transform)) - (a2-11 (-> a0-34 rvec quad)) - (a1-36 (-> a0-34 uvec quad)) - (v1-53 (-> a0-34 fvec quad)) - (a0-35 (-> a0-34 trans quad)) - ) - (set! (-> sv-224 rvec quad) a2-11) - (set! (-> sv-224 uvec quad) a1-36) - (set! (-> sv-224 fvec quad) v1-53) - (set! (-> sv-224 trans quad) a0-35) - ) - (vector-reset! (-> sv-224 trans)) - (matrix-transpose! sv-224 sv-224) - (vector-matrix*! s1-0 s1-0 sv-224) - (let ((s0-1 format)) - (set! sv-240 #t) - (set! sv-256 " :sphere ((meters ~M) (meters ~M) (meters ~M) (meters ~M))~%") - (set! sv-272 (-> s1-0 x)) - (set! sv-288 (-> s1-0 y)) - (let ((s1-1 (-> s1-0 z)) - (t1-1 (* 1.0001 (vector-vector-distance s3-0 s2-0))) - ) - (set! t0-0 s1-1) - (s0-1 sv-240 sv-256 sv-272 sv-288 t0-0 t1-1) + (let ((sv-224 (new 'stack-no-clear 'matrix))) + (let* ((a0-34 (-> (the-as process-drawable (-> gp-0 0)) node-list data (-> s0-0 transform-index) bone transform)) + (a2-11 (-> a0-34 rvec quad)) + (a1-36 (-> a0-34 uvec quad)) + (v1-53 (-> a0-34 fvec quad)) + (a0-35 (-> a0-34 trans quad)) + ) + (set! (-> sv-224 rvec quad) a2-11) + (set! (-> sv-224 uvec quad) a1-36) + (set! (-> sv-224 fvec quad) v1-53) + (set! (-> sv-224 trans quad) a0-35) ) + (vector-reset! (-> sv-224 trans)) + (matrix-transpose! sv-224 sv-224) + (vector-matrix*! s1-0 s1-0 sv-224) + ) + (let ((s0-1 format) + (sv-240 #t) + (sv-256 " :sphere ((meters ~M) (meters ~M) (meters ~M) (meters ~M))~%") + (sv-272 (-> s1-0 x)) + (sv-288 (-> s1-0 y)) + ) + (set! t0-0 (-> s1-0 z)) + (s0-1 sv-240 sv-256 sv-272 sv-288 t0-0 (* 1.0001 (vector-vector-distance s3-0 s2-0))) ) ) ) diff --git a/goal_src/jak3/engine/debug/debug-sphere.gc b/goal_src/jak3/engine/debug/debug-sphere.gc index c639f2951b..a58eaf6285 100644 --- a/goal_src/jak3/engine/debug/debug-sphere.gc +++ b/goal_src/jak3/engine/debug/debug-sphere.gc @@ -9,7 +9,6 @@ (defun make-debug-sphere-table ((arg0 vector-array) (arg1 float) (arg2 float)) "Create a table of lines on a sphere." - (local-vars (sv-80 vector) (sv-96 vector) (sv-112 int)) (let ((s2-0 (new-stack-vector0)) (f30-0 1.0) (s5-0 0) @@ -19,27 +18,29 @@ (let ((f28-0 (* f30-0 (sin (* (the float s1-0) (/ 32768.0 arg2))))) (f26-0 (* f30-0 (sin (* (the float (+ s1-0 1)) (/ 32768.0 arg2))))) (s0-0 (new-stack-vector0)) + (sv-80 (new 'stack-no-clear 'vector)) ) - (set! sv-80 (new 'stack-no-clear 'vector)) (set! (-> sv-80 quad) (the-as uint128 0)) - (set! sv-96 (new 'stack-no-clear 'vector)) - (set! (-> sv-96 quad) (the-as uint128 0)) - (set! (-> s0-0 y) (+ (-> s2-0 y) (* (cos (* (the float s1-0) (/ 32768.0 arg2))) f30-0))) - (set! (-> sv-80 y) (-> s0-0 y)) - (set! (-> sv-96 y) (+ (-> s2-0 y) (* (cos (* (the float (+ s1-0 1)) (/ 32768.0 arg2))) f30-0))) - (set! sv-112 0) - (while (< sv-112 (the int arg1)) - (set! (-> s0-0 x) (+ (-> s2-0 x) (* (cos (* (the float sv-112) (/ 65536.0 arg1))) f28-0))) - (set! (-> s0-0 z) (+ (-> s2-0 z) (* (sin (* (the float sv-112) (/ 65536.0 arg1))) f28-0))) - (set! (-> sv-80 x) (+ (-> s2-0 x) (* (cos (* (the float (+ sv-112 1)) (/ 65536.0 arg1))) f28-0))) - (set! (-> sv-80 z) (+ (-> s2-0 z) (* (sin (* (the float (+ sv-112 1)) (/ 65536.0 arg1))) f28-0))) - (set! (-> sv-96 x) (+ (-> s2-0 x) (* (cos (* (the float sv-112) (/ 65536.0 arg1))) f26-0))) - (set! (-> sv-96 z) (+ (-> s2-0 z) (* (sin (* (the float sv-112) (/ 65536.0 arg1))) f26-0))) - (vector-copy! (-> arg0 data s5-0) s0-0) - (vector-copy! (-> arg0 data (+ s5-0 1)) sv-80) - (vector-copy! (-> arg0 data (+ s5-0 2)) sv-96) - (+! s5-0 3) - (set! sv-112 (+ sv-112 1)) + (let ((sv-96 (new 'stack-no-clear 'vector))) + (set! (-> sv-96 quad) (the-as uint128 0)) + (set! (-> s0-0 y) (+ (-> s2-0 y) (* (cos (* (the float s1-0) (/ 32768.0 arg2))) f30-0))) + (set! (-> sv-80 y) (-> s0-0 y)) + (set! (-> sv-96 y) (+ (-> s2-0 y) (* (cos (* (the float (+ s1-0 1)) (/ 32768.0 arg2))) f30-0))) + (let ((sv-112 0)) + (while (< sv-112 (the int arg1)) + (set! (-> s0-0 x) (+ (-> s2-0 x) (* (cos (* (the float sv-112) (/ 65536.0 arg1))) f28-0))) + (set! (-> s0-0 z) (+ (-> s2-0 z) (* (sin (* (the float sv-112) (/ 65536.0 arg1))) f28-0))) + (set! (-> sv-80 x) (+ (-> s2-0 x) (* (cos (* (the float (+ sv-112 1)) (/ 65536.0 arg1))) f28-0))) + (set! (-> sv-80 z) (+ (-> s2-0 z) (* (sin (* (the float (+ sv-112 1)) (/ 65536.0 arg1))) f28-0))) + (set! (-> sv-96 x) (+ (-> s2-0 x) (* (cos (* (the float sv-112) (/ 65536.0 arg1))) f26-0))) + (set! (-> sv-96 z) (+ (-> s2-0 z) (* (sin (* (the float sv-112) (/ 65536.0 arg1))) f26-0))) + (vector-copy! (-> arg0 data s5-0) s0-0) + (vector-copy! (-> arg0 data (+ s5-0 1)) sv-80) + (vector-copy! (-> arg0 data (+ s5-0 2)) sv-96) + (+! s5-0 3) + (+! sv-112 1) + ) + ) ) ) ) @@ -54,7 +55,6 @@ ) (defun add-debug-sphere-from-table ((arg0 bucket-id) (arg1 vector) (arg2 meters) (arg3 rgba) (arg4 int)) "Draw a sphere out of debug lines, using the precomputed table of lines." - (local-vars (sv-32 vector-array) (sv-36 vector)) (rlet ((vf1 :class vf) (vf2 :class vf) (vf3 :class vf) @@ -66,12 +66,12 @@ (make-debug-sphere-table (new 'debug 'vector-array (* (* 3 arg4) arg4)) (the float arg4) (the float arg4)) ) ) - (set! sv-32 (-> *debug-sphere-table* arg4)) - (set! sv-36 (the-as vector (new-stack-vector0))) - (let ((s2-1 (new-stack-vector0)) - (s1-1 (new-stack-vector0)) - (s0-0 (the-as object (-> sv-32 data))) - ) + (let* ((sv-32 (-> *debug-sphere-table* arg4)) + (sv-36 (the-as vector (new-stack-vector0))) + (s2-1 (new-stack-vector0)) + (s1-1 (new-stack-vector0)) + (s0-0 (the-as object (-> sv-32 data))) + ) (.lvf vf1 (&-> arg1 quad)) (.mov vf2 arg2) (countdown (s4-1 (/ (-> sv-32 length) 3)) diff --git a/goal_src/jak3/engine/debug/debug.gc b/goal_src/jak3/engine/debug/debug.gc index a8feb5b849..815f215ab2 100644 --- a/goal_src/jak3/engine/debug/debug.gc +++ b/goal_src/jak3/engine/debug/debug.gc @@ -163,9 +163,8 @@ ;; WARN: Return type mismatch pointer vs symbol. (defun-debug internal-draw-debug-line ((bucket bucket-id) (p0 vector) (p1 vector) (color rgba) (mode symbol) (color2 rgba)) "Implementation of line drawing DMA." - (local-vars (sv-112 vector) (sv-128 vector) (sv-144 vector)) - (set! sv-112 p1) - (let ((s1-0 color) + (let ((sv-112 p1) + (s1-0 color) (s2-0 mode) (s5-0 color2) ) @@ -186,9 +185,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)) (the-as symbol (when (debug-line-clip? sv-128 sv-144 p0 sv-112) @@ -351,10 +350,9 @@ (defun-debug add-debug-flat-triangle ((enable symbol) (bucket bucket-id) (p0 vector) (p1 vector) (p2 vector) (color rgba)) "Draw a shaded triangle." - (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 (or enable *display-capture-mode*)) @@ -955,73 +953,61 @@ (defun-debug add-debug-line-sphere ((enable symbol) (bucket bucket-id) (base vector) (dir vector) (rad float) (color rgba)) "Draw a capsule as a cylinder." - (local-vars - (sv-16 bucket-id) - (sv-24 vector) - (sv-28 vector) - (sv-32 float) - (sv-36 rgba) - (sv-112 matrix) - (sv-116 float) - ) (b! (not enable) cfg-8 :delay (nop!)) - (set! sv-16 bucket) - (set! sv-24 base) - (set! sv-28 dir) - (set! sv-32 rad) - (set! sv-36 color) - (set! sv-112 (new 'stack-no-clear 'matrix)) - (set! sv-116 (vector-length sv-28)) - (let ((gp-0 (new 'stack-no-clear 'vector)) - (s5-0 (new 'stack-no-clear 'vector)) - ) - (vector-normalize-copy! gp-0 sv-28 1.0) - (vector-reset! s5-0) - (let* ((f0-2 (-> gp-0 y)) - (f0-4 (* f0-2 f0-2)) - (f1-0 (-> gp-0 z)) - ) - (if (< f0-4 (* f1-0 f1-0)) + (let* ((sv-16 bucket) + (sv-24 base) + (sv-28 dir) + (sv-32 rad) + (sv-36 color) + (sv-112 (new 'stack-no-clear 'matrix)) + (sv-116 (vector-length sv-28)) + ) + (let ((gp-0 (new 'stack-no-clear 'vector)) + (s5-0 (new 'stack-no-clear 'vector)) + ) + (vector-normalize-copy! gp-0 sv-28 1.0) + (vector-reset! s5-0) + (if (< (square (-> gp-0 y)) (square (-> gp-0 z))) (set! (-> s5-0 y) -1.0) (set! (-> s5-0 z) -1.0) ) + (forward-down->inv-matrix sv-112 gp-0 s5-0) ) - (forward-down->inv-matrix sv-112 gp-0 s5-0) - ) - (vector-copy! (-> sv-112 trans) sv-24) - (set! (-> sv-112 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) + (vector-copy! (-> sv-112 trans) sv-24) + (set! (-> sv-112 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) (* sv-32 (-> s5-1 2 y))) - (set! (-> s1-0 y) (* sv-32 (-> gp-1 2 y))) - (vector-matrix*! s3-0 s1-0 sv-112) - (dotimes (s0-0 10) - (vector-copy! s4-0 s3-0) - (set! (-> s1-0 x) (* sv-32 (-> (&-> s5-1 0 data s0-0) 0))) - (set! (-> s1-0 y) (* sv-32 (-> (&-> gp-1 0 data s0-0) 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) (* sv-32 (-> s5-1 2 y))) + (set! (-> s1-0 y) (* sv-32 (-> gp-1 2 y))) (vector-matrix*! s3-0 s1-0 sv-112) - (add-debug-line #t sv-16 s4-0 s3-0 sv-36 #f (the-as rgba -1)) - (vector+float*! s2-0 s3-0 (-> sv-112 fvec) sv-116) - (add-debug-line #t sv-16 s3-0 s2-0 sv-36 #f (the-as rgba -1)) - (vector+float*! s4-0 s4-0 (-> sv-112 fvec) sv-116) - (add-debug-line #t sv-16 s4-0 s2-0 sv-36 #f (the-as rgba -1)) + (dotimes (s0-0 10) + (vector-copy! s4-0 s3-0) + (set! (-> s1-0 x) (* sv-32 (-> (&-> s5-1 0 data s0-0) 0))) + (set! (-> s1-0 y) (* sv-32 (-> (&-> gp-1 0 data s0-0) 0))) + (vector-matrix*! s3-0 s1-0 sv-112) + (add-debug-line #t sv-16 s4-0 s3-0 sv-36 #f (the-as rgba -1)) + (vector+float*! s2-0 s3-0 (-> sv-112 fvec) sv-116) + (add-debug-line #t sv-16 s3-0 s2-0 sv-36 #f (the-as rgba -1)) + (vector+float*! s4-0 s4-0 (-> sv-112 fvec) sv-116) + (add-debug-line #t sv-16 s4-0 s2-0 sv-36 #f (the-as rgba -1)) + ) ) ) (label cfg-8) @@ -1031,7 +1017,6 @@ (defun-debug add-debug-circle ((enable symbol) (bucket bucket-id) (origin vector) (radius float) (color rgba) (mat matrix)) "Draw a circle." - (local-vars (sv-48 int) (sv-64 vector) (sv-80 vector)) "note: you may pass #f for orientation" (if (not (or enable *display-capture-mode*)) (return #f) @@ -1039,20 +1024,22 @@ (let ((f30-0 0.0) (s1-0 (new-stack-vector0)) (s0-0 (new-stack-vector0)) + (sv-48 0) ) - (set! sv-48 0) (while (< sv-48 12) - (set! sv-64 s1-0) - (set! (-> sv-64 x) (* radius (cos f30-0))) - (set! (-> sv-64 y) 0.0) - (set! (-> sv-64 z) (* radius (sin f30-0))) - (set! (-> sv-64 w) 1.0) + (let ((sv-64 s1-0)) + (set! (-> sv-64 x) (* radius (cos f30-0))) + (set! (-> sv-64 y) 0.0) + (set! (-> sv-64 z) (* radius (sin f30-0))) + (set! (-> sv-64 w) 1.0) + ) (set! f30-0 (+ 5461.3335 f30-0)) - (set! sv-80 s0-0) - (set! (-> sv-80 x) (* radius (cos f30-0))) - (set! (-> sv-80 y) 0.0) - (set! (-> sv-80 z) (* radius (sin f30-0))) - (set! (-> sv-80 w) 1.0) + (let ((sv-80 s0-0)) + (set! (-> sv-80 x) (* radius (cos f30-0))) + (set! (-> sv-80 y) 0.0) + (set! (-> sv-80 z) (* radius (sin f30-0))) + (set! (-> sv-80 w) 1.0) + ) (when mat (vector-matrix*! s1-0 s1-0 mat) (vector-matrix*! s0-0 s0-0 mat) @@ -1060,7 +1047,7 @@ (vector+! s1-0 s1-0 origin) (vector+! s0-0 s0-0 origin) (add-debug-line #t bucket s1-0 s0-0 color #f (the-as rgba -1)) - (set! sv-48 (+ sv-48 1)) + (+! sv-48 1) ) ) #f @@ -1117,9 +1104,8 @@ ;; ERROR: Stack slot load at 32 mismatch: defined as size 4, got size 16 ;; ERROR: Stack slot load at 32 mismatch: defined as size 4, got size 16 (defun-debug add-debug-yrot-vector ((arg0 symbol) (arg1 bucket-id) (arg2 vector) (arg3 float) (arg4 float) (arg5 rgba)) - (local-vars (sv-32 float)) - (set! sv-32 arg3) - (let ((s0-0 arg4) + (let ((sv-32 arg3) + (s0-0 arg4) (s3-0 arg5) ) (if (not (or arg0 *display-capture-mode*)) @@ -1143,44 +1129,48 @@ (arg7 matrix) ) "note: you may pass #f for orientation" - (local-vars (sv-48 vector) (sv-64 vector) (sv-80 int) (sv-96 vector) (sv-112 vector)) (if (not (or arg0 *display-capture-mode*)) (return #f) ) - (let ((f30-0 arg3)) - (set! sv-48 (new 'stack-no-clear 'vector)) + (let ((f30-0 arg3) + (sv-48 (new 'stack-no-clear 'vector)) + ) (set! (-> sv-48 quad) (the-as uint128 0)) - (set! sv-64 (new 'stack-no-clear 'vector)) - (set! (-> sv-64 quad) (the-as uint128 0)) - (set! sv-80 0) - (while (< sv-80 12) - (set! sv-96 sv-48) - (set! (-> sv-96 x) (* arg5 (sin f30-0))) - (set! (-> sv-96 y) 0.0) - (set! (-> sv-96 z) (* arg5 (cos f30-0))) - (set! (-> sv-96 w) 1.0) - (+! f30-0 (the float (/ (the int (- arg4 arg3)) 12))) - (set! sv-112 sv-64) - (set! (-> sv-112 x) (* arg5 (sin f30-0))) - (set! (-> sv-112 y) 0.0) - (set! (-> sv-112 z) (* arg5 (cos f30-0))) - (set! (-> sv-112 w) 1.0) - (when arg7 - (vector-matrix*! sv-48 sv-48 arg7) - (vector-matrix*! sv-64 sv-64 arg7) + (let ((sv-64 (new 'stack-no-clear 'vector))) + (set! (-> sv-64 quad) (the-as uint128 0)) + (let ((sv-80 0)) + (while (< sv-80 12) + (let ((sv-96 sv-48)) + (set! (-> sv-96 x) (* arg5 (sin f30-0))) + (set! (-> sv-96 y) 0.0) + (set! (-> sv-96 z) (* arg5 (cos f30-0))) + (set! (-> sv-96 w) 1.0) + ) + (+! f30-0 (the float (/ (the int (- arg4 arg3)) 12))) + (let ((sv-112 sv-64)) + (set! (-> sv-112 x) (* arg5 (sin f30-0))) + (set! (-> sv-112 y) 0.0) + (set! (-> sv-112 z) (* arg5 (cos f30-0))) + (set! (-> sv-112 w) 1.0) + ) + (when arg7 + (vector-matrix*! sv-48 sv-48 arg7) + (vector-matrix*! sv-64 sv-64 arg7) + ) + (vector+! sv-48 sv-48 arg2) + (vector+! sv-64 sv-64 arg2) + (add-debug-line #t arg1 sv-48 sv-64 arg6 #f (the-as rgba -1)) + (cond + ((zero? sv-80) + (add-debug-line #t arg1 sv-48 arg2 arg6 #f (the-as rgba -1)) + ) + ((= sv-80 11) + (add-debug-line #t arg1 sv-64 arg2 arg6 #f (the-as rgba -1)) + ) + ) + (+! sv-80 1) + ) ) - (vector+! sv-48 sv-48 arg2) - (vector+! sv-64 sv-64 arg2) - (add-debug-line #t arg1 sv-48 sv-64 arg6 #f (the-as rgba -1)) - (cond - ((zero? sv-80) - (add-debug-line #t arg1 sv-48 arg2 arg6 #f (the-as rgba -1)) - ) - ((= sv-80 11) - (add-debug-line #t arg1 sv-64 arg2 arg6 #f (the-as rgba -1)) - ) - ) - (set! sv-80 (+ sv-80 1)) ) ) #f @@ -1194,21 +1184,23 @@ (arg5 int) (arg6 rgba) ) - (local-vars (sv-48 vector) (sv-64 int) (sv-80 int)) (if (not (or arg0 *display-capture-mode*)) (return #f) ) - (let ((s0-0 (new-stack-vector0))) - (set! sv-48 (new 'stack-no-clear 'vector)) + (let ((s0-0 (new-stack-vector0)) + (sv-48 (new 'stack-no-clear 'vector)) + ) (set! (-> sv-48 quad) (the-as uint128 0)) - (set! sv-64 (* arg3 4)) - (curve-evaluate! sv-48 (-> arg4 0) arg2 arg3 arg4 arg5) - (set! sv-80 0) - (while (< sv-80 sv-64) - (vector-copy! s0-0 sv-48) - (curve-evaluate! sv-48 (/ (the float (+ sv-80 1)) (the float sv-64)) arg2 arg3 arg4 arg5) - (add-debug-line #t arg1 s0-0 sv-48 arg6 #f (the-as rgba -1)) - (set! sv-80 (+ sv-80 1)) + (let ((sv-64 (* arg3 4))) + (curve-evaluate! sv-48 (-> arg4 0) arg2 arg3 arg4 arg5) + (let ((sv-80 0)) + (while (< sv-80 sv-64) + (vector-copy! s0-0 sv-48) + (curve-evaluate! sv-48 (/ (the float (+ sv-80 1)) (the float sv-64)) arg2 arg3 arg4 arg5) + (add-debug-line #t arg1 s0-0 sv-48 arg6 #f (the-as rgba -1)) + (+! sv-80 1) + ) + ) ) ) #f @@ -1222,48 +1214,26 @@ ) (defun-debug add-debug-points ((arg0 symbol) (arg1 bucket-id) (arg2 (inline-array vector)) (arg3 int) (arg4 rgba) (arg5 float) (arg6 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)) - (sv-96 vector) - ) (when (and arg0 (not *display-capture-mode*)) (dotimes (s0-0 arg3) - (set! sv-96 (new 'stack-no-clear 'vector)) - (set! (-> sv-96 quad) (the-as uint128 0)) - (vector-copy! sv-96 (-> arg2 s0-0)) - (if (!= arg5 0.0) - (set! (-> sv-96 y) arg5) + (let ((sv-96 (new 'stack-no-clear 'vector))) + (set! (-> sv-96 quad) (the-as uint128 0)) + (vector-copy! sv-96 (-> arg2 s0-0)) + (if (!= arg5 0.0) + (set! (-> sv-96 y) arg5) + ) + (let ((sv-32 add-debug-text-3d) + (sv-48 #t) + (sv-64 arg1) + ) + (format (clear *temp-string*) "~d" s0-0) + (sv-32 sv-48 sv-64 *temp-string* sv-96 (font-color white) (the-as vector2h #f)) ) - (set! sv-32 add-debug-text-3d) - (set! sv-48 #t) - (set! sv-64 arg1) - (set! sv-80 format) - (let ((a0-5 (clear *temp-string*)) - (a1-1 "~d") - (a2-1 s0-0) - ) - (sv-80 a0-5 a1-1 a2-1) - ) - (let ((a2-2 *temp-string*) - (a3-1 sv-96) - (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 arg1) - (a3-2 (if (= s0-0 arg6) - (the-as uint #x80ffffff) - (the-as uint arg4) - ) - ) - ) - (t9-3 a0-7 a1-3 sv-96 (the-as rgba a3-2)) + (add-debug-x #t arg1 sv-96 (if (= s0-0 arg6) + (new 'static 'rgba :r #xff :g #xff :b #xff :a #x80) + (the-as rgba arg4) + ) + ) ) ) ) @@ -1271,10 +1241,9 @@ ) (defun-debug debug-percent-bar ((arg0 symbol) (arg1 bucket-id) (arg2 int) (arg3 int) (arg4 float) (arg5 rgba) (arg6 int) (arg7 int)) - (local-vars (sv-16 int) (sv-32 float)) - (set! sv-16 arg3) - (set! sv-32 arg4) - (let ((s3-0 arg5) + (let ((sv-16 arg3) + (sv-32 arg4) + (s3-0 arg5) (s1-0 arg6) (s2-0 arg7) ) @@ -1660,9 +1629,9 @@ ;; WARN: Function add-debug-bound has a return type of none, but the expression builder found a return statement. (defun-debug add-debug-bound ((arg0 bucket-id) (arg1 (inline-array vector)) (arg2 int) (arg3 rgba) (arg4 rgba) (arg5 int)) - (local-vars (sv-16 dma-packet) (sv-32 rgba) (sv-48 int) (sv-64 int) (sv-80 int)) - (set! sv-32 arg4) - (let ((s1-0 arg5)) + (let ((sv-32 arg4) + (s1-0 arg5) + ) (if (< arg2 3) (return 0) ) @@ -1674,22 +1643,16 @@ (test-1 (new 'static 'gs-test :zte #x1 :ztst (gs-ztest greater-equal))) (alpha-1 (new 'static 'gs-alpha :b #x1 :d #x1)) ) - (set! sv-16 (the-as dma-packet (-> s2-0 base))) - (&+! (-> s2-0 base) 16) - (add-boundary-shader (new 'static 'texture-id :index #x3 :page #x1) s2-0) - (let ((t9-1 add-debug-bound-internal) - (a0-9 s2-0) - (a1-13 arg1) - (a2-1 arg2) - (t1-1 s1-0) - ) - (t9-1 a0-9 a1-13 a2-1 arg3 sv-32 t1-1) - ) - (close-sky-buffer s2-0) - (let ((v1-16 (/ (+ (- -16 (the-as int sv-16)) (the-as int (-> s2-0 base))) 16))) - (set! (-> sv-16 dma) (new 'static 'dma-tag :id (dma-tag-id cnt) :qwc v1-16)) - (set! (-> 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-16)) + (let ((sv-16 (the-as dma-packet (-> s2-0 base)))) + (&+! (-> s2-0 base) 16) + (add-boundary-shader (new 'static 'texture-id :index #x3 :page #x1) s2-0) + (add-debug-bound-internal s2-0 arg1 arg2 arg3 sv-32 s1-0) + (close-sky-buffer s2-0) + (let ((v1-16 (/ (+ (- -16 (the-as int sv-16)) (the-as int (-> s2-0 base))) 16))) + (set! (-> sv-16 dma) (new 'static 'dma-tag :id (dma-tag-id cnt) :qwc v1-16)) + (set! (-> 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-16)) + ) ) (dma-buffer-add-gs-set s2-0 (zbuf-1 (new 'static 'gs-zbuf :zbp #x130 :psm (gs-psm ct24))) @@ -1706,21 +1669,22 @@ (add-debug-line #t arg0 (-> arg1 0) (-> arg1 1) (the-as rgba s1-1) #f (the-as rgba -1)) (add-debug-line #t arg0 (-> arg1 0) (-> arg1 2) (the-as rgba s1-1) #f (the-as rgba -1)) (add-debug-line #t arg0 (-> arg1 (+ arg2 -1)) (-> arg1 (+ arg2 -2)) (the-as rgba s1-1) #f (the-as rgba -1)) - (set! sv-48 0) - (while (< sv-48 s0-1) - (let* ((a2-5 (+ (* sv-48 2) 1)) - (v1-31 (+ a2-5 2)) - ) - (set! sv-64 (+ a2-5 1)) - (set! sv-80 (+ sv-64 2)) - (if (< sv-64 arg2) - (add-debug-line #t arg0 (-> arg1 a2-5) (-> arg1 v1-31) (the-as rgba s1-1) #f (the-as rgba -1)) - ) - ) - (if (< sv-80 arg2) - (add-debug-line #t arg0 (-> arg1 sv-64) (-> arg1 sv-80) (the-as rgba s1-1) #f (the-as rgba -1)) + (let ((sv-48 0)) + (while (< sv-48 s0-1) + (let* ((a2-5 (+ (* sv-48 2) 1)) + (v1-31 (+ a2-5 2)) + (sv-64 (+ a2-5 1)) + (sv-80 (+ sv-64 2)) + ) + (if (< sv-64 arg2) + (add-debug-line #t arg0 (-> arg1 a2-5) (-> arg1 v1-31) (the-as rgba s1-1) #f (the-as rgba -1)) + ) + (if (< sv-80 arg2) + (add-debug-line #t arg0 (-> arg1 sv-64) (-> arg1 sv-80) (the-as rgba s1-1) #f (the-as rgba -1)) + ) ) - (set! sv-48 (+ sv-48 1)) + (+! sv-48 1) + ) ) ) ) diff --git a/goal_src/jak3/engine/debug/default-menu.gc b/goal_src/jak3/engine/debug/default-menu.gc index 717a763236..3b0ca1a64a 100644 --- a/goal_src/jak3/engine/debug/default-menu.gc +++ b/goal_src/jak3/engine/debug/default-menu.gc @@ -764,7 +764,6 @@ ;; WARN: Return type mismatch number vs object. (defun dm-debug-actor-lod-dist ((arg0 int) (arg1 debug-menu-msg) (arg2 float)) - (local-vars (sv-16 res-tag)) (when (= arg1 (debug-menu-msg press)) (when (and *debug-actor* (>= (-> (the-as process-drawable *debug-actor*) draw lod-set max-lod) (/ arg0 8))) (let ((a0-4 (&+ (-> (the-as process-drawable *debug-actor*) draw jgeo extra data-base) (* (/ arg0 8) 4)))) @@ -775,22 +774,21 @@ ) (cond (*debug-actor* - (let ((f30-0 0.00024414062)) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-21 (res-lump-data - (-> (the-as process-drawable *debug-actor*) draw jgeo extra) - 'lod-dist - (pointer float) - :tag-ptr (& sv-16) - ) - ) - ) - (* f30-0 (if (and v1-21 (< (/ arg0 8) (the-as int (-> sv-16 elt-count)))) - (-> v1-21 (/ arg0 8)) - 0.0 - ) + (let* ((f30-0 0.00024414062) + (sv-16 (new 'static 'res-tag)) + (v1-21 (res-lump-data + (-> (the-as process-drawable *debug-actor*) draw jgeo extra) + 'lod-dist + (pointer float) + :tag-ptr (& sv-16) + ) + ) ) - ) + (* f30-0 (if (and v1-21 (< (/ arg0 8) (the-as int (-> sv-16 elt-count)))) + (-> v1-21 (/ arg0 8)) + 0.0 + ) + ) ) ) (else @@ -2721,22 +2719,6 @@ ) (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) - (sv-208 symbol) - (sv-224 type) - ) (let ((s4-0 *level-load-list*) (s5-0 '()) ) @@ -2748,34 +2730,21 @@ (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)) - ) + ;; og:preserve-this cons -> dcons + (set! s5-0 (dcons + (dcons 'flag (dcons + (-> (the-as continue-point v1-2) name) + (dcons (-> (the-as continue-point v1-2) name) (dcons 'dm-current-continue '())) + ) + ) + s5-0 + ) + ) ) - ) ) (set! s3-0 (cdr s3-0)) ) @@ -2789,99 +2758,40 @@ ) (let ((a2-6 (car s4-1))) (while (not (null? s4-1)) - (set! s5-1 (cons a2-6 s5-1)) + ;; og:preserve-this cons -> dcons + (set! s5-1 (dcons a2-6 s5-1)) (set! s4-1 (cdr s4-1)) (set! a2-6 (car s4-1)) ) ) - (let ((s4-2 (method-of-type pair new)) - (s3-1 'global) - (s2-1 pair) - (s1-1 'menu) - (s0-1 (method-of-type pair new)) - ) - (set! sv-208 'global) - (set! sv-224 pair) - (let ((a2-7 (symbol->string-debug arg1)) - (a3-6 s5-1) - ) - (s4-2 s3-1 s2-1 s1-1 (s0-1 sv-208 sv-224 a2-7 a3-6)) - ) - ) + ;; og:preserve-this cons -> dcons + (dcons 'menu (dcons (symbol->string-debug arg1) s5-1)) ) ) ) (defun debug-menu-make-task-sub-menu ((arg0 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 int) - (sv-208 symbol) - (sv-224 type) - ) (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 + ;; og:preserve-this cons -> dcons + (dcons (dcons 'flag (dcons (-> v1-4 name) (dcons (* s3-0 8) (dcons 'dm-task-menu-pick-func '())))) gp-0) + ) ) - ) ) ) ) ) - (let ((s4-1 (method-of-type pair new)) - (s3-1 'global) - (s2-1 pair) - (s1-1 'menu) - (s0-1 (method-of-type pair new)) - ) - (set! sv-208 'global) - (set! sv-224 pair) - (let ((a2-5 (symbol->string-debug arg0)) - (a3-5 gp-0) - ) - (s4-1 s3-1 s2-1 s1-1 (s0-1 sv-208 sv-224 a2-5 a3-5)) - ) - ) + ;; og:preserve-this cons -> dcons + (dcons 'menu (dcons (symbol->string-debug arg0) gp-0)) ) ) (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)) ) @@ -2907,14 +2817,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)) @@ -2981,43 +2886,7 @@ ) (defun debug-menu-make-play-menu ((arg0 debug-menu-context)) - (local-vars - (sv-16 type) - (sv-32 (function symbol type object object pair)) - (sv-48 symbol) - (sv-64 type) - (sv-80 symbol) - (sv-96 (function symbol type object object pair)) - (sv-112 symbol) - (sv-128 type) - (sv-144 string) - (sv-160 (function symbol type object object pair)) - (sv-176 symbol) - (sv-192 type) - (sv-208 symbol) - (sv-224 type) - (sv-240 (function symbol type object object pair)) - (sv-256 symbol) - (sv-272 type) - (sv-288 symbol) - (sv-304 (function symbol type object object pair)) - (sv-320 symbol) - (sv-336 type) - (sv-352 (function symbol type object object pair)) - (sv-368 symbol) - (sv-384 type) - (sv-400 int) - (sv-416 type) - (sv-432 symbol) - (sv-448 (function symbol type object object pair)) - (sv-464 symbol) - (sv-480 type) - (sv-496 string) - (sv-512 (function symbol type object object pair)) - (sv-528 symbol) - (sv-544 type) - (sv-560 symbol) - ) + (local-vars (sv-144 string)) (let ((s5-0 '())) (let ((s2-0 #x200000)) (countdown (s4-0 (-> *game-info* play-list length)) @@ -3029,98 +2898,63 @@ ) (when (!= s1-0 s2-0) (let ((s2-1 (method-of-type pair new)) - (s0-0 'global) + ;; og:preserve-this cons -> dcons + (s0-0 'debug) + (sv-16 pair) + (sv-32 (method-of-type pair new)) + ;; og:preserve-this cons -> dcons + (sv-48 'debug) + (sv-64 pair) + (sv-80 'function) + (sv-96 (method-of-type pair new)) + ;; og:preserve-this cons -> dcons + (sv-112 'debug) + (sv-128 pair) ) - (set! sv-16 pair) - (set! sv-32 (method-of-type pair new)) - (set! sv-48 'global) - (set! sv-64 pair) - (set! sv-80 'function) - (set! sv-96 (method-of-type pair new)) - (set! sv-112 'global) - (set! sv-128 pair) - (cond - ((logtest? (game-task-node-flag act3) s1-0) - (set! sv-144 "=== Burning Bush ===") - ) - ((logtest? (game-task-node-flag act2) s1-0) - (set! sv-144 "====== ACT 3 ======") - ) - ((logtest? (game-task-node-flag act1) s1-0) - (set! sv-144 "====== ACT 2 ======") - ) - (else - (set! sv-144 "======= END =======") - ) - ) - (set! sv-160 (method-of-type pair new)) - (set! sv-176 'global) - (set! sv-192 pair) - (set! sv-208 (the-as symbol #f)) - (let* ((a3-1 (cons 'nothing '())) - (a3-2 (sv-160 sv-176 sv-192 sv-208 a3-1)) - (a3-3 (sv-96 sv-112 sv-128 sv-144 a3-2)) - (a2-4 (sv-32 sv-48 sv-64 sv-80 a3-3)) - ) - (set! s5-0 (s2-1 s0-0 sv-16 a2-4 s5-0)) - ) + (set! sv-144 (cond + ((logtest? (game-task-node-flag act3) s1-0) + (set! sv-144 "=== Burning Bush ===") + sv-144 + ) + ((logtest? (game-task-node-flag act2) s1-0) + (set! sv-144 "====== ACT 3 ======") + sv-144 + ) + ((logtest? (game-task-node-flag act1) s1-0) + (set! sv-144 "====== ACT 2 ======") + sv-144 + ) + (else + "======= END =======" + ) + ) + ) + (set! s5-0 + (s2-1 + s0-0 + sv-16 + ;; og:preserve-this cons -> dcons + (sv-32 sv-48 sv-64 sv-80 (sv-96 sv-112 sv-128 sv-144 (dcons (the-as symbol #f) (dcons 'nothing '())))) + s5-0 + ) + ) ) (set! s2-0 (the-as int s1-0)) ) ) - (let ((s1-1 (method-of-type pair new)) - (s0-1 'global) - ) - (set! sv-224 pair) - (set! sv-240 (method-of-type pair new)) - (set! sv-256 'global) - (set! sv-272 pair) - (set! sv-288 'function) - (set! sv-304 (method-of-type pair new)) - (set! sv-320 'global) - (set! sv-336 pair) - (let ((s3-1 (-> s3-0 name))) - (set! sv-352 (method-of-type pair new)) - (set! sv-368 'global) - (set! sv-384 pair) - (set! sv-400 (* s4-0 8)) - (let* ((a3-6 (cons 'dm-play-task '())) - (a3-7 (sv-352 sv-368 sv-384 sv-400 a3-6)) - (a3-8 (sv-304 sv-320 sv-336 s3-1 a3-7)) - (a2-9 (sv-240 sv-256 sv-272 sv-288 a3-8)) - (a3-9 s5-0) - ) - (set! s5-0 (s1-1 s0-1 sv-224 a2-9 a3-9)) - ) - ) - ) + ;; og:preserve-this cons -> dcons + (set! s5-0 (dcons (dcons 'function (dcons (-> s3-0 name) (dcons (* s4-0 8) (dcons 'dm-play-task '())))) s5-0)) ) ) ) ) - (let ((s4-1 (method-of-type pair new)) - (s3-2 'global) - (s2-2 pair) - (s1-2 (method-of-type pair new)) - (s0-2 'global) + (let ((a3-15 + ;; og:preserve-this cons -> dcons + (dcons (dcons 'function (dcons "====== ACT 1 ======" (dcons (the-as symbol #f) (dcons 'nothing '())))) s5-0) + ) ) - (set! sv-416 pair) - (set! sv-432 'function) - (set! sv-448 (method-of-type pair new)) - (set! sv-464 'global) - (set! sv-480 pair) - (set! sv-496 "====== ACT 1 ======") - (set! sv-512 (method-of-type pair new)) - (set! sv-528 'global) - (set! sv-544 pair) - (set! sv-560 (the-as symbol #f)) - (let* ((a3-11 (cons 'nothing '())) - (a3-12 (sv-512 sv-528 sv-544 sv-560 a3-11)) - (a3-13 (sv-448 sv-464 sv-480 sv-496 a3-12)) - (a3-15 (s4-1 s3-2 s2-2 (s1-2 s0-2 sv-416 sv-432 a3-13) s5-0)) - ) - (debug-menu-make-from-template arg0 (cons 'menu (cons "Play" a3-15))) - ) + ;; og:preserve-this cons -> dcons + (debug-menu-make-from-template arg0 (dcons 'menu (dcons "Play" a3-15))) ) ) ) @@ -3191,7 +3025,6 @@ ) (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 @@ -3233,6 +3066,7 @@ ) ) (function "Target Stop" #f ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float)) (stop 'debug))) + ;; og:preserve-this ;; (menu ;; "Anim Tester" ;; (int-var "Speed" anim-speed dm-subdiv-int 10 10 #t -300 1000) @@ -3964,14 +3798,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/goal_src/jak3/engine/debug/editable-player.gc b/goal_src/jak3/engine/debug/editable-player.gc index 07cc4b4d71..e536ee4881 100644 --- a/goal_src/jak3/engine/debug/editable-player.gc +++ b/goal_src/jak3/engine/debug/editable-player.gc @@ -213,31 +213,32 @@ ) (defun update-manipulator-position ((arg0 editable-array) (arg1 manipulator)) - (local-vars (sv-32 vector) (sv-40 int) (sv-48 euler-angles)) - (set! sv-32 (new-stack-vector0)) - (set! sv-40 0) - (set! sv-48 (the-as euler-angles #f)) - (let* ((s4-0 (-> arg0 length)) - (s3-0 0) - (s2-0 (-> arg0 data s3-0)) - ) - (while (< s3-0 s4-0) - (when (and s2-0 (logtest? (-> s2-0 flags) (editable-flag selected))) - (set! sv-48 (the-as euler-angles (get-null-vec s2-0))) - (vector+! sv-32 sv-32 (editable-method-15 s2-0)) - (set! sv-40 (+ sv-40 1)) - (if (not (-> arg0 region-lock?)) - (set! (-> arg0 region) (-> s2-0 region)) - ) + (let ((sv-32 (new-stack-vector0)) + (sv-40 0) + (sv-48 (the-as euler-angles #f)) + ) + (let* ((s4-0 (-> arg0 length)) + (s3-0 0) + (s2-0 (-> arg0 data s3-0)) + ) + (while (< s3-0 s4-0) + (when (and s2-0 (logtest? (-> s2-0 flags) (editable-flag selected))) + (set! sv-48 (the-as euler-angles (get-null-vec s2-0))) + (vector+! sv-32 sv-32 (editable-method-15 s2-0)) + (+! sv-40 1) + (if (not (-> arg0 region-lock?)) + (set! (-> arg0 region) (-> s2-0 region)) + ) + ) + (+! s3-0 1) + (set! s2-0 (-> arg0 data s3-0)) ) - (+! s3-0 1) - (set! s2-0 (-> arg0 data s3-0)) ) - ) - (when (nonzero? sv-40) - (vector-float*! (-> arg1 position) sv-32 (/ 1.0 (the float sv-40))) - (set! (-> arg1 angles quad) (-> sv-48 quad)) - (eul->matrix (-> arg1 mat) sv-48) + (when (nonzero? sv-40) + (vector-float*! (-> arg1 position) sv-32 (/ 1.0 (the float sv-40))) + (set! (-> arg1 angles quad) (-> sv-48 quad)) + (eul->matrix (-> arg1 mat) sv-48) + ) ) ) @@ -700,277 +701,270 @@ ) (defun execute-mouse-move ((arg0 editable-array) (arg1 editable-command) (arg2 mouse-info) (arg3 manipulator)) - (local-vars - (v0-2 object) - (sv-128 (function vector vector float vector)) - (sv-144 vector) - (sv-160 vector) - (sv-176 vector) - (sv-192 vector) - ) + (local-vars (v0-2 object)) (rlet ((vf0 :class vf) (vf4 :class vf) (vf5 :class vf) (vf6 :class vf) ) (init-vf0-vector) - (set! v0-2 (cond - ((= arg1 (editable-command camera-tumble)) - (set-setting! 'mouse-input 'abs #t 0) - (let ((s5-1 (new-stack-vector0)) - (f30-0 0.0) - ) - (let* ((s4-1 (-> arg0 length)) - (s3-0 0) - (a0-2 (-> arg0 data s3-0)) - ) - (while (< s3-0 s4-1) - (when (and a0-2 (logtest? (-> a0-2 flags) (editable-flag selected))) - (vector+! s5-1 s5-1 (editable-method-15 a0-2)) - (set! f30-0 (+ 1.0 f30-0)) - ) - (+! s3-0 1) - (set! a0-2 (-> arg0 data s3-0)) - ) + (set! v0-2 + (cond + ((= arg1 (editable-command camera-tumble)) + (set-setting! 'mouse-input 'abs #t 0) + (let ((s5-1 (new-stack-vector0)) + (f30-0 0.0) + ) + (let* ((s4-1 (-> arg0 length)) + (s3-0 0) + (a0-2 (-> arg0 data s3-0)) ) - (cond - ((= f30-0 0.0) - (remove-setting! 'mouse-tumble-point) - ) - (else - (vector-float/! s5-1 s5-1 f30-0) - (set-setting! 'mouse-tumble-point 'abs s5-1 0) - ) - ) - ) - ) - ((= arg1 (editable-command camera-xy)) - (set-setting! 'mouse-input 'abs #t 0) - ) - ((= arg1 (editable-command camera-xz)) - (set-setting! 'mouse-input 'abs #t 0) - ) - ((= arg1 (editable-command drag-move)) - (let* ((s4-2 (-> arg0 length)) - (s3-1 0) - (a0-8 (-> arg0 data s3-1)) - ) - (while (< s3-1 s4-2) - (if (and a0-8 (logtest? (-> a0-8 flags) (editable-flag selected))) - (editable-method-17 a0-8 (-> arg3 speed) (editable-flag no-update)) - ) - (+! s3-1 1) - (set! a0-8 (-> arg0 data s3-1)) - ) - ) - (let* ((s5-2 (-> arg0 length)) - (s4-3 0) - (a0-9 (-> arg0 data s4-3)) - ) - (while (< s4-3 s5-2) - (if (and a0-9 (logtest? (-> a0-9 flags) (editable-flag selected))) - (editable-method-30 a0-9 (editable-flag)) - ) - (+! s4-3 1) - (set! a0-9 (-> arg0 data s4-3)) - ) - ) - (cleanup-selection arg0) - ) - ((= arg1 (editable-command snap-rotate)) - (let* ((s4-4 (-> arg0 length)) - (s3-2 0) - (a0-11 (-> arg0 data s3-2)) - ) - (while (< s3-2 s4-4) - (if (and a0-11 (logtest? (-> a0-11 flags) (editable-flag selected))) - (editable-method-35 a0-11 (-> *editable* 0 mouse-normal)) - ) - (+! s3-2 1) - (set! a0-11 (-> arg0 data s3-2)) - ) - ) - (let* ((s4-5 (-> arg0 length)) - (s3-3 0) - (a0-12 (-> arg0 data s3-3)) - ) - (while (< s3-3 s4-5) - (if (and a0-12 (logtest? (-> a0-12 flags) (editable-flag selected))) - (editable-method-30 a0-12 (editable-flag)) - ) - (+! s3-3 1) - (set! a0-12 (-> arg0 data s3-3)) - ) - ) - (cleanup-selection arg0) - (update-manipulator-position arg0 arg3) - ) - ((= arg1 (editable-command drag-rotate)) - (let ((v1-70 0)) - (let* ((a0-15 (-> arg0 length)) - (a1-22 0) - (a3-5 (-> arg0 data a1-22)) - ) - (while (< a1-22 a0-15) - (if (and a3-5 (logtest? (-> a3-5 flags) (editable-flag selected))) - (+! v1-70 1) - ) - (+! a1-22 1) - (set! a3-5 (-> arg0 data a1-22)) - ) - ) - (cond - ((= v1-70 1) - (let* ((s4-6 (-> arg0 length)) - (s3-4 0) - (a0-19 (-> arg0 data s3-4)) - ) - (while (< s3-4 s4-6) - (if (and a0-19 (logtest? (-> a0-19 flags) (editable-flag selected))) - (get-null-vec2 a0-19 (-> arg3 angles)) - ) - (+! s3-4 1) - (set! a0-19 (-> arg0 data s3-4)) - ) - ) - ) - (else - (let* ((s3-5 (-> arg0 length)) - (s2-1 0) - (s1-2 (-> arg0 data s2-1)) - ) - (while (< s2-1 s3-5) - (when (and s1-2 (logtest? (-> s1-2 flags) (editable-flag selected))) - (let ((s0-0 (new 'stack-no-clear 'vector))) - (set! sv-176 (new 'stack-no-clear 'vector)) - (set! sv-128 vector-rotate-around-y!) - (set! sv-144 (new 'stack-no-clear 'vector)) - (set! sv-160 (new 'stack-no-clear 'vector)) - (let ((v1-92 (editable-method-15 s1-2)) - (a0-23 (-> arg3 position)) - ) - (.lvf vf4 (&-> v1-92 quad)) - (.lvf vf5 (&-> a0-23 quad)) - ) - (.mov.vf.w vf6 vf0) - (.sub.vf.xyz vf6 vf4 vf5) - (.svf (&-> sv-160 quad) vf6) - (let* ((a2-16 (* 182.04445 (- (-> arg2 posx) (-> arg2 pos 1 x)))) - (v0-11 (sv-128 sv-144 sv-160 a2-16)) - (v1-95 (-> arg3 position)) - ) - (.mov.vf.w vf6 vf0) - (.lvf vf4 (&-> v0-11 quad)) - (.lvf vf5 (&-> v1-95 quad)) - ) - (.add.vf.xyz vf6 vf4 vf5) - (.svf (&-> sv-176 quad) vf6) - (let* ((v1-98 (editable-method-15 s1-2)) - (s0-1 (vector-! s0-0 sv-176 v1-98)) - ) - (editable-method-17 s1-2 s0-1 (editable-flag no-update)) - ) - ) - ) - (+! s2-1 1) - (set! s1-2 (-> arg0 data s2-1)) - ) - ) - (let* ((s5-3 (-> arg0 length)) - (s4-7 0) - (a0-28 (-> arg0 data s4-7)) - ) - (while (< s4-7 s5-3) - (if (and a0-28 (logtest? (-> a0-28 flags) (editable-flag selected))) - (editable-method-30 a0-28 (editable-flag)) - ) - (+! s4-7 1) - (set! a0-28 (-> arg0 data s4-7)) - ) - ) - ) - ) - ) - (cleanup-selection arg0) - ) - ((= arg1 (editable-command drag-scale)) - (let* ((s3-6 (-> arg0 length)) - (s2-2 0) - (s1-3 (-> arg0 data s2-2)) - ) - (while (< s2-2 s3-6) - (when (and s1-3 (logtest? (-> s1-3 flags) (editable-flag selected))) - (let ((s0-2 (new 'stack-no-clear 'vector))) - (set! sv-192 (new 'stack-no-clear 'vector)) - (let ((v1-125 (editable-method-15 s1-3)) - (a0-33 (-> arg3 position)) - ) - (.lvf vf4 (&-> v1-125 quad)) - (.lvf vf5 (&-> a0-33 quad)) - ) - (.mov.vf.w vf6 vf0) - (.sub.vf.xyz vf6 vf4 vf5) - (.svf (&-> sv-192 quad) vf6) - (let* ((f0-5 (* 0.01 (- (-> arg2 posx) (-> arg2 pos 1 x)))) - (s0-3 (vector-float*! s0-2 sv-192 f0-5)) - ) - (case (-> arg3 action) - (((manipulator-action ma1)) - (set! (-> s0-3 y) 0.0) - (set! (-> s0-3 z) 0.0) - ) - (((manipulator-action ma2)) - (set! (-> s0-3 x) 0.0) - (set! (-> s0-3 z) 0.0) - ) - (((manipulator-action ma3)) - (set! (-> s0-3 x) 0.0) - (set! (-> s0-3 y) 0.0) - ) - (((manipulator-action ma4)) - (set! (-> s0-3 z) 0.0) - ) - (((manipulator-action ma5)) - (set! (-> s0-3 y) 0.0) - ) - (((manipulator-action ma6)) - (set! (-> s0-3 x) 0.0) - ) - (((manipulator-action ma7)) - ) - (else - (set! (-> s0-3 x) 0.0) - (set! (-> s0-3 y) 0.0) - (set! (-> s0-3 z) 0.0) - ) - ) - (editable-method-17 s1-3 s0-3 (editable-flag no-update)) - ) - ) - ) - (+! s2-2 1) - (set! s1-3 (-> arg0 data s2-2)) - ) - ) - (let* ((s5-4 (-> arg0 length)) - (s4-8 0) - (a0-42 (-> arg0 data s4-8)) - ) - (while (< s4-8 s5-4) - (if (and a0-42 (logtest? (-> a0-42 flags) (editable-flag selected))) - (editable-method-30 a0-42 (editable-flag)) - ) - (+! s4-8 1) - (set! a0-42 (-> arg0 data s4-8)) - ) - ) - (cleanup-selection arg0) - ) - (else - (return #f) - v0-2 + (while (< s3-0 s4-1) + (when (and a0-2 (logtest? (-> a0-2 flags) (editable-flag selected))) + (vector+! s5-1 s5-1 (editable-method-15 a0-2)) + (set! f30-0 (+ 1.0 f30-0)) + ) + (+! s3-0 1) + (set! a0-2 (-> arg0 data s3-0)) ) ) + (cond + ((= f30-0 0.0) + (remove-setting! 'mouse-tumble-point) + ) + (else + (vector-float/! s5-1 s5-1 f30-0) + (set-setting! 'mouse-tumble-point 'abs s5-1 0) + ) + ) + ) + ) + ((= arg1 (editable-command camera-xy)) + (set-setting! 'mouse-input 'abs #t 0) + ) + ((= arg1 (editable-command camera-xz)) + (set-setting! 'mouse-input 'abs #t 0) + ) + ((= arg1 (editable-command drag-move)) + (let* ((s4-2 (-> arg0 length)) + (s3-1 0) + (a0-8 (-> arg0 data s3-1)) + ) + (while (< s3-1 s4-2) + (if (and a0-8 (logtest? (-> a0-8 flags) (editable-flag selected))) + (editable-method-17 a0-8 (-> arg3 speed) (editable-flag no-update)) + ) + (+! s3-1 1) + (set! a0-8 (-> arg0 data s3-1)) + ) + ) + (let* ((s5-2 (-> arg0 length)) + (s4-3 0) + (a0-9 (-> arg0 data s4-3)) + ) + (while (< s4-3 s5-2) + (if (and a0-9 (logtest? (-> a0-9 flags) (editable-flag selected))) + (editable-method-30 a0-9 (editable-flag)) + ) + (+! s4-3 1) + (set! a0-9 (-> arg0 data s4-3)) + ) + ) + (cleanup-selection arg0) + ) + ((= arg1 (editable-command snap-rotate)) + (let* ((s4-4 (-> arg0 length)) + (s3-2 0) + (a0-11 (-> arg0 data s3-2)) + ) + (while (< s3-2 s4-4) + (if (and a0-11 (logtest? (-> a0-11 flags) (editable-flag selected))) + (editable-method-35 a0-11 (-> *editable* 0 mouse-normal)) + ) + (+! s3-2 1) + (set! a0-11 (-> arg0 data s3-2)) + ) + ) + (let* ((s4-5 (-> arg0 length)) + (s3-3 0) + (a0-12 (-> arg0 data s3-3)) + ) + (while (< s3-3 s4-5) + (if (and a0-12 (logtest? (-> a0-12 flags) (editable-flag selected))) + (editable-method-30 a0-12 (editable-flag)) + ) + (+! s3-3 1) + (set! a0-12 (-> arg0 data s3-3)) + ) + ) + (cleanup-selection arg0) + (update-manipulator-position arg0 arg3) + ) + ((= arg1 (editable-command drag-rotate)) + (let ((v1-70 0)) + (let* ((a0-15 (-> arg0 length)) + (a1-22 0) + (a3-5 (-> arg0 data a1-22)) + ) + (while (< a1-22 a0-15) + (if (and a3-5 (logtest? (-> a3-5 flags) (editable-flag selected))) + (+! v1-70 1) + ) + (+! a1-22 1) + (set! a3-5 (-> arg0 data a1-22)) + ) + ) + (cond + ((= v1-70 1) + (let* ((s4-6 (-> arg0 length)) + (s3-4 0) + (a0-19 (-> arg0 data s3-4)) + ) + (while (< s3-4 s4-6) + (if (and a0-19 (logtest? (-> a0-19 flags) (editable-flag selected))) + (get-null-vec2 a0-19 (-> arg3 angles)) + ) + (+! s3-4 1) + (set! a0-19 (-> arg0 data s3-4)) + ) + ) + ) + (else + (let* ((s3-5 (-> arg0 length)) + (s2-1 0) + (s1-2 (-> arg0 data s2-1)) + ) + (while (< s2-1 s3-5) + (when (and s1-2 (logtest? (-> s1-2 flags) (editable-flag selected))) + (let ((s0-0 (new 'stack-no-clear 'vector)) + (sv-176 (new 'stack-no-clear 'vector)) + ) + (let ((sv-128 vector-rotate-around-y!) + (sv-144 (new 'stack-no-clear 'vector)) + (sv-160 (new 'stack-no-clear 'vector)) + ) + (let ((v1-92 (editable-method-15 s1-2)) + (a0-23 (-> arg3 position)) + ) + (.lvf vf4 (&-> v1-92 quad)) + (.lvf vf5 (&-> a0-23 quad)) + ) + (.mov.vf.w vf6 vf0) + (.sub.vf.xyz vf6 vf4 vf5) + (.svf (&-> sv-160 quad) vf6) + (let ((v0-11 (sv-128 sv-144 sv-160 (* 182.04445 (- (-> arg2 posx) (-> arg2 pos 1 x))))) + (v1-95 (-> arg3 position)) + ) + (.mov.vf.w vf6 vf0) + (.lvf vf4 (&-> v0-11 quad)) + (.lvf vf5 (&-> v1-95 quad)) + ) + ) + (.add.vf.xyz vf6 vf4 vf5) + (.svf (&-> sv-176 quad) vf6) + (let ((s0-1 (vector-! s0-0 sv-176 (editable-method-15 s1-2)))) + (editable-method-17 s1-2 s0-1 (editable-flag no-update)) + ) + ) + ) + (+! s2-1 1) + (set! s1-2 (-> arg0 data s2-1)) + ) + ) + (let* ((s5-3 (-> arg0 length)) + (s4-7 0) + (a0-28 (-> arg0 data s4-7)) + ) + (while (< s4-7 s5-3) + (if (and a0-28 (logtest? (-> a0-28 flags) (editable-flag selected))) + (editable-method-30 a0-28 (editable-flag)) + ) + (+! s4-7 1) + (set! a0-28 (-> arg0 data s4-7)) + ) + ) + ) + ) + ) + (cleanup-selection arg0) + ) + ((= arg1 (editable-command drag-scale)) + (let* ((s3-6 (-> arg0 length)) + (s2-2 0) + (s1-3 (-> arg0 data s2-2)) + ) + (while (< s2-2 s3-6) + (when (and s1-3 (logtest? (-> s1-3 flags) (editable-flag selected))) + (let ((s0-2 (new 'stack-no-clear 'vector)) + (sv-192 (new 'stack-no-clear 'vector)) + ) + (let ((v1-125 (editable-method-15 s1-3)) + (a0-33 (-> arg3 position)) + ) + (.lvf vf4 (&-> v1-125 quad)) + (.lvf vf5 (&-> a0-33 quad)) + ) + (.mov.vf.w vf6 vf0) + (.sub.vf.xyz vf6 vf4 vf5) + (.svf (&-> sv-192 quad) vf6) + (let ((s0-3 (vector-float*! s0-2 sv-192 (* 0.01 (- (-> arg2 posx) (-> arg2 pos 1 x)))))) + (case (-> arg3 action) + (((manipulator-action ma1)) + (set! (-> s0-3 y) 0.0) + (set! (-> s0-3 z) 0.0) + ) + (((manipulator-action ma2)) + (set! (-> s0-3 x) 0.0) + (set! (-> s0-3 z) 0.0) + ) + (((manipulator-action ma3)) + (set! (-> s0-3 x) 0.0) + (set! (-> s0-3 y) 0.0) + ) + (((manipulator-action ma4)) + (set! (-> s0-3 z) 0.0) + ) + (((manipulator-action ma5)) + (set! (-> s0-3 y) 0.0) + ) + (((manipulator-action ma6)) + (set! (-> s0-3 x) 0.0) + ) + (((manipulator-action ma7)) + ) + (else + (set! (-> s0-3 x) 0.0) + (set! (-> s0-3 y) 0.0) + (set! (-> s0-3 z) 0.0) + ) + ) + (editable-method-17 s1-3 s0-3 (editable-flag no-update)) + ) + ) + ) + (+! s2-2 1) + (set! s1-3 (-> arg0 data s2-2)) + ) + ) + (let* ((s5-4 (-> arg0 length)) + (s4-8 0) + (a0-42 (-> arg0 data s4-8)) + ) + (while (< s4-8 s5-4) + (if (and a0-42 (logtest? (-> a0-42 flags) (editable-flag selected))) + (editable-method-30 a0-42 (editable-flag)) + ) + (+! s4-8 1) + (set! a0-42 (-> arg0 data s4-8)) + ) + ) + (cleanup-selection arg0) + ) + (else + (return #f) + v0-2 + ) + ) ) #t ) diff --git a/goal_src/jak3/engine/debug/editable.gc b/goal_src/jak3/engine/debug/editable.gc index 4549a43b5e..67a75cb0e0 100644 --- a/goal_src/jak3/engine/debug/editable.gc +++ b/goal_src/jak3/engine/debug/editable.gc @@ -65,7 +65,6 @@ ) (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)) @@ -86,28 +85,10 @@ (clear s5-0) (format s5-0 "delete from region_point where region_face_id in (") (dotimes (s2-0 (-> s3-0 length)) - (cond - ((zero? s2-0) - (let ((s1-0 format) - (s0-0 s5-0) - ) - (set! sv-16 "~D") - (let ((a2-4 (string->int (the-as string (-> s3-0 sql-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 (the-as string (-> s3-0 sql-data s2-0))))) - (s1-1 s0-1 sv-32 a2-5) - ) - ) + (if (zero? s2-0) + (format s5-0 "~D" (string->int (the-as string (-> s3-0 sql-data s2-0)))) + (format s5-0 ",~D" (string->int (the-as string (-> s3-0 sql-data s2-0)))) ) - ) ) (format s5-0 ")") (let ((a2-6 (sql-query s5-0))) @@ -321,52 +302,52 @@ ) (defmethod print-region-info ((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 (the-as rgba (new 'static 'rgba :r #xff :g #xff :a #x80))) - (let ((s3-0 add-debug-text-3d) - (s2-0 #t) - (s1-0 577) - ) - (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 577) - ) - (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 (the-as rgba (new 'static 'rgba :r #xff :g #xff :a #x80))) + (let ((s3-0 add-debug-text-3d) + (s2-0 #t) + (s1-0 577) ) - (+! (-> 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 577) - ) - (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 577) + ) + (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 577) - ) - (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 577) + ) + (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 577) + ) + (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) ) ) ) @@ -577,10 +558,10 @@ ) (defmethod editable-method-22 ((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 (editable-method-15 this))) + (let ((sv-48 (new 'stack-no-clear 'vector)) + (sv-52 (new 'stack-no-clear 'vector)) + (s4-0 (editable-method-15 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) @@ -743,26 +724,26 @@ ) (defmethod get-level-offset ((this editable) (arg0 editable-array)) - (local-vars (sv-16 sql-result)) (when (!= (-> this region level) (-> arg0 level)) - (let ((gp-0 (new 'static 'vector))) - (let ((s3-0 sql-query)) - (format - (clear *temp-string*) - "select translate_x,translate_y,translate_z from level_info where name='~S'" - (-> this region level) + (let ((gp-0 (new 'static 'vector)) + (s3-0 sql-query) ) - (set! sv-16 (s3-0 *temp-string*)) + (format + (clear *temp-string*) + "select translate_x,translate_y,translate_z from level_info where name='~S'" + (-> this region level) ) - (when (= (-> sv-16 content-type) 'select) - (set-vector! - gp-0 - (* 4096.0 (string->float (the-as string (-> sv-16 sql-data 0)))) - (* 4096.0 (string->float (the-as string (-> sv-16 sql-data 1)))) - (* 4096.0 (string->float (the-as string (-> sv-16 sql-data 2)))) - 1.0 + (let ((sv-16 (s3-0 *temp-string*))) + (when (= (-> sv-16 content-type) 'select) + (set-vector! + gp-0 + (* 4096.0 (string->float (the-as string (-> sv-16 sql-data 0)))) + (* 4096.0 (string->float (the-as string (-> sv-16 sql-data 1)))) + (* 4096.0 (string->float (the-as string (-> sv-16 sql-data 2)))) + 1.0 + ) + (return gp-0) ) - (return gp-0) ) ) ) @@ -1898,15 +1879,14 @@ ) (defmethod editable-method-14 ((this editable-face) (arg0 vector) (arg1 vector)) - (local-vars (sv-560 editable-face) (sv-576 vector)) - (set! sv-560 this) - (let ((s3-0 arg0) - (s4-0 arg1) - (s2-0 (new 'stack-no-clear 'vector)) - (s5-0 (editable-face-method-37 sv-560 (new 'stack-no-clear 'vector))) - (s1-0 (new 'stack-no-clear 'vector)) - (gp-0 (new 'stack-no-clear 'inline-array 'vector 4)) - ) + (let* ((sv-560 this) + (s3-0 arg0) + (s4-0 arg1) + (s2-0 (new 'stack-no-clear 'vector)) + (s5-0 (editable-face-method-37 sv-560 (new 'stack-no-clear 'vector))) + (s1-0 (new 'stack-no-clear 'vector)) + (gp-0 (new 'stack-no-clear 'inline-array 'vector 4)) + ) (dotimes (v1-1 4) (set! (-> gp-0 v1-1 quad) (the-as uint128 0)) ) @@ -1980,23 +1960,19 @@ (let ((s3-2 (editable-face-method-36 sv-560 s0-1))) 0 (let ((s2-1 (vector-negate! (new 'stack-no-clear 'vector) s5-0))) - (set! sv-576 (new 'stack-no-clear 'vector)) - (let ((f30-0 0.0) - (t9-10 (method-of-object sv-560 editable-face-method-37)) - (a1-10 (new 'stack-no-clear 'vector)) - ) - (when (< f30-0 (vector-dot - (t9-10 sv-560 a1-10) - (vector-! (new 'stack-no-clear 'vector) (-> *math-camera* trans) (-> s0-1 0)) - ) + (let ((sv-576 (new 'stack-no-clear 'vector))) + (when (< 0.0 (vector-dot + (editable-face-method-37 sv-560 (new 'stack-no-clear 'vector)) + (vector-! (new 'stack-no-clear 'vector) (-> *math-camera* trans) (-> s0-1 0)) + ) ) (vector-copy! s2-1 s5-0) #t ) + (vector-copy! sv-576 (-> s0-1 2)) + (vector-copy! (-> s0-1 2) (-> s0-1 3)) + (vector-copy! (-> s0-1 3) sv-576) ) - (vector-copy! sv-576 (-> s0-1 2)) - (vector-copy! (-> s0-1 2) (-> s0-1 3)) - (vector-copy! (-> s0-1 3) sv-576) (dotimes (v1-40 4) (vector-! (-> s4-2 v1-40) (-> s0-1 v1-40) s1-0) (vector+*! (-> s4-2 v1-40) (-> s4-2 v1-40) s5-0 (- (vector-dot s5-0 (-> s4-2 v1-40)))) @@ -2071,18 +2047,6 @@ ;; WARN: Function (method 31 editable-face) has a return type of none, but the expression builder found a return statement. (defmethod editable-method-31 ((this editable-face) (arg0 editable-flag)) - (local-vars - (sv-208 (inline-array vector)) - (sv-216 int) - (sv-288 (array editable-point)) - (sv-292 int) - (sv-296 int) - (sv-368 matrix) - (sv-372 editable-point) - (sv-376 number) - (sv-380 symbol) - (sv-400 float) - ) (if (or (logtest? arg0 (editable-flag no-update)) (logtest? (-> this flags) (editable-flag mark))) (return #f) ) @@ -2108,22 +2072,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))) - (vector-copy! (-> sv-208 sv-216) (editable-method-15 (-> this vertex s2-2))) - (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))) + (vector-copy! (-> sv-208 sv-216) (editable-method-15 (-> this vertex s2-2))) + (+! sv-216 1) + ) + ) + (dotimes (s2-3 s4-0) + (when (logtest? (-> this vertex s2-3 flags) (editable-flag selected)) + (vector-copy! (-> sv-208 sv-216) (editable-method-15 (-> this vertex s2-3))) + (+! 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)) - (vector-copy! (-> sv-208 sv-216) (editable-method-15 (-> this vertex s2-3))) - (set! sv-216 (+ sv-216 1)) - ) - ) - (normal-of-plane (-> this normal) (-> sv-208 0) (-> sv-208 1) (-> sv-208 2)) (vector-copy! (-> this center) (editable-method-15 this)) ) ) @@ -2149,69 +2115,70 @@ ) ) ) - (set! sv-288 - (the-as - (array editable-point) - ((method-of-type array new) - (the-as symbol (new 'stack-no-clear 'array 'editable-point 6)) - array - editable-point - 6 - ) - ) + (let ((sv-288 (the-as (array editable-point) ((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-37 this (-> this normal)) - (dotimes (v1-85 sv-292) - (set! (-> 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 0.0) - (set! sv-380 #t) - (vector-normalize! - (vector-! (-> sv-368 fvec) (editable-method-15 this) (editable-method-15 (-> this vertex 0))) - 1.0 - ) - (vector-normalize! (editable-face-method-37 this (-> sv-368 uvec)) 1.0) - (vector-normalize! (vector-cross! (-> sv-368 rvec) (-> sv-368 fvec) (-> sv-368 uvec)) 1.0) - (vector-copy! (-> sv-368 trans) (editable-method-15 (-> this vertex 0))) - (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 (-> sv-288 s5-4) - (let* ((a1-27 (editable-method-15 (-> 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-37 this (-> this normal)) + (dotimes (v1-85 sv-292) + (set! (-> sv-288 v1-85) (-> this vertex (+ v1-85 1))) + ) + (let ((sv-368 (new-stack-matrix0)) + (sv-372 (the-as editable-point #f)) + (sv-376 0.0) + (sv-380 #t) ) - (cond - (sv-380 - (when (or (not sv-372) (< (the-as float sv-376) sv-400)) - (set! sv-372 (-> sv-288 s5-4)) - (set! sv-376 sv-400) - ) - ) - (else - (when (or (not sv-372) (< sv-400 (the-as float sv-376))) - (set! sv-372 (-> sv-288 s5-4)) - (set! sv-376 sv-400) + (vector-normalize! + (vector-! (-> sv-368 fvec) (editable-method-15 this) (editable-method-15 (-> this vertex 0))) + 1.0 + ) + (vector-normalize! (editable-face-method-37 this (-> sv-368 uvec)) 1.0) + (vector-normalize! (vector-cross! (-> sv-368 rvec) (-> sv-368 fvec) (-> sv-368 uvec)) 1.0) + (vector-copy! (-> sv-368 trans) (editable-method-15 (-> this vertex 0))) + (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 (-> sv-288 s5-4) + (let* ((a1-27 (editable-method-15 (-> 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) (< (the-as float sv-376) sv-400)) + (set! sv-372 (-> sv-288 s5-4)) + (set! sv-376 sv-400) + ) + ) + (else + (when (or (not sv-372) (< sv-400 (the-as float sv-376))) + (set! sv-372 (-> sv-288 s5-4)) + (set! sv-376 sv-400) + ) + ) + ) ) ) ) + (set! (-> this vertex sv-296) sv-372) + (dotimes (v1-131 sv-292) + (if (= sv-372 (-> sv-288 v1-131)) + (set! (-> sv-288 v1-131) #f) + ) + ) + (+! sv-296 1) + (set! sv-380 (not sv-380)) ) ) - (set! (-> this vertex sv-296) sv-372) - (dotimes (v1-131 sv-292) - (if (= sv-372 (-> sv-288 v1-131)) - (set! (-> sv-288 v1-131) #f) - ) - ) - (set! sv-296 (+ sv-296 1)) - (set! sv-380 (not sv-380)) ) (if (< (vector-dot (-> this normal) (editable-face-method-37 this (new 'stack-no-clear 'vector))) 0.0) (logxor! (-> this flags) (editable-flag orient)) @@ -2226,45 +2193,45 @@ ) (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-36 this gp-0)) - (when (>= sv-112 3) - (let ((s1-0 (editable-face-method-37 this (new 'stack-no-clear 'vector)))) - (add-debug-vector - #t - (bucket-id debug-no-zbuf1) - (editable-method-15 this) - s1-0 - (meters 2) - (the-as rgba (new 'static 'rgba :r #xff :g #xff :a #x80)) + (let ((sv-112 (editable-face-method-36 this gp-0))) + (when (>= sv-112 3) + (let ((s1-0 (editable-face-method-37 this (new 'stack-no-clear 'vector)))) + (add-debug-vector + #t + (bucket-id debug-no-zbuf1) + (editable-method-15 this) + s1-0 + (meters 2) + (the-as rgba (new 'static 'rgba :r #xff :g #xff :a #x80)) + ) ) - ) - (let ((t1-1 (if (logtest? (-> this flags) (editable-flag selected)) - 1 - 0 - ) - ) - ) - (if (or (= t1-1 1) (not (-> *editable-work* hide))) - (add-debug-bound - (bucket-id debug) - gp-0 - sv-112 - (if (logtest? (-> this flags) (editable-flag orient)) - (new 'static 'rgba :r #x80 :a #x40) - (new 'static 'rgba :r #x80 :g #x80 :a #x40) - ) - (if (not (logtest? (-> this flags) (editable-flag orient))) - (new 'static 'rgba :r #x80 :a #x40) - (new 'static 'rgba :r #x80 :g #x80 :a #x40) - ) - t1-1 + (let ((t1-1 (if (logtest? (-> this flags) (editable-flag selected)) + 1 + 0 + ) + ) ) - ) + (if (or (= t1-1 1) (not (-> *editable-work* hide))) + (add-debug-bound + (bucket-id debug) + gp-0 + sv-112 + (if (logtest? (-> this flags) (editable-flag orient)) + (new 'static 'rgba :r #x80 :a #x40) + (new 'static 'rgba :r #x80 :g #x80 :a #x40) + ) + (if (not (logtest? (-> this flags) (editable-flag orient))) + (new 'static 'rgba :r #x80 :a #x40) + (new 'static 'rgba :r #x80 :g #x80 :a #x40) + ) + t1-1 + ) + ) + ) ) ) ) @@ -2701,97 +2668,97 @@ ) (defun load-editable-lights ((arg0 editable-array)) - (local-vars (sv-16 sql-result)) (let ((s5-0 sql-query)) (format (clear *temp-string*) "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,shadow_ambi,shadow_dir_0,shadow_dir_1,shadow_dir_2,shadow_dir_3 from light where level_name='~S'" (-> arg0 level) ) - (set! sv-16 (s5-0 *temp-string*)) - ) - (format #t "sql: read light ~D~%" (/ (-> sv-16 length) 16)) - (if (!= (-> sv-16 content-type) 'select) - (return #f) - ) - (let ((s5-1 0)) - (while (< s5-1 (-> sv-16 length)) - (let ((s3-0 (get-length arg0))) - (when (>= s3-0 0) - (let ((s4-1 (new 'stack-no-clear 'vector))) - (set! (-> s4-1 x) (* 4096.0 (string->float (the-as string (-> sv-16 sql-data (+ s5-1 2)))))) - (set! (-> s4-1 y) (* 4096.0 (string->float (the-as string (-> sv-16 sql-data (+ s5-1 3)))))) - (set! (-> s4-1 z) (* 4096.0 (string->float (the-as string (-> sv-16 sql-data (+ s5-1 4)))))) - (set! (-> s4-1 w) 1.0) - (vector+! s4-1 s4-1 (-> arg0 level-offset)) - (let ((s4-2 (new 'debug 'editable-light s4-1 2048.0 *editable-light-region*))) - (set! (-> arg0 data s3-0) s4-2) - (set! (-> s4-2 id) (the-as uint (string->int (the-as string (-> sv-16 sql-data s5-1))))) - (set! (-> s4-2 name) (the-as string (-> sv-16 sql-data (+ s5-1 1)))) - (set! (-> s4-2 radius) (* 4096.0 (string->float (the-as string (-> sv-16 sql-data (+ s5-1 5)))))) - (set-vector! - (-> s4-2 direction) - (string->float (the-as string (-> sv-16 sql-data (+ s5-1 6)))) - (string->float (the-as string (-> sv-16 sql-data (+ s5-1 7)))) - (string->float (the-as string (-> sv-16 sql-data (+ s5-1 8)))) - 1.0 - ) - (set-vector! - (-> s4-2 color) - (string->float (the-as string (-> sv-16 sql-data (+ s5-1 9)))) - (string->float (the-as string (-> sv-16 sql-data (+ s5-1 10)))) - (string->float (the-as string (-> sv-16 sql-data (+ s5-1 11)))) - (string->float (the-as string (-> sv-16 sql-data (+ s5-1 12)))) - ) - (if (or (= (-> s4-2 color w) -2.0) - (and (= (-> s4-2 direction x) 0.0) (= (-> s4-2 direction y) 0.0) (= (-> s4-2 direction z) 0.0)) + (let ((sv-16 (s5-0 *temp-string*))) + (format #t "sql: read light ~D~%" (/ (-> sv-16 length) 16)) + (if (!= (-> sv-16 content-type) 'select) + (return #f) + ) + (let ((s5-1 0)) + (while (< s5-1 (-> sv-16 length)) + (let ((s3-0 (get-length arg0))) + (when (>= s3-0 0) + (let ((s4-1 (new 'stack-no-clear 'vector))) + (set! (-> s4-1 x) (* 4096.0 (string->float (the-as string (-> sv-16 sql-data (+ s5-1 2)))))) + (set! (-> s4-1 y) (* 4096.0 (string->float (the-as string (-> sv-16 sql-data (+ s5-1 3)))))) + (set! (-> s4-1 z) (* 4096.0 (string->float (the-as string (-> sv-16 sql-data (+ s5-1 4)))))) + (set! (-> s4-1 w) 1.0) + (vector+! s4-1 s4-1 (-> arg0 level-offset)) + (let ((s4-2 (new 'debug 'editable-light s4-1 2048.0 *editable-light-region*))) + (set! (-> arg0 data s3-0) s4-2) + (set! (-> s4-2 id) (the-as uint (string->int (the-as string (-> sv-16 sql-data s5-1))))) + (set! (-> s4-2 name) (the-as string (-> sv-16 sql-data (+ s5-1 1)))) + (set! (-> s4-2 radius) (* 4096.0 (string->float (the-as string (-> sv-16 sql-data (+ s5-1 5)))))) + (set-vector! + (-> s4-2 direction) + (string->float (the-as string (-> sv-16 sql-data (+ s5-1 6)))) + (string->float (the-as string (-> sv-16 sql-data (+ s5-1 7)))) + (string->float (the-as string (-> sv-16 sql-data (+ s5-1 8)))) + 1.0 + ) + (set-vector! + (-> s4-2 color) + (string->float (the-as string (-> sv-16 sql-data (+ s5-1 9)))) + (string->float (the-as string (-> sv-16 sql-data (+ s5-1 10)))) + (string->float (the-as string (-> sv-16 sql-data (+ s5-1 11)))) + (string->float (the-as string (-> sv-16 sql-data (+ s5-1 12)))) + ) + (if (or (= (-> s4-2 color w) -2.0) + (and (= (-> s4-2 direction x) 0.0) (= (-> s4-2 direction y) 0.0) (= (-> s4-2 direction z) 0.0)) + ) + (set! (-> s4-2 direction w) 0.0) ) - (set! (-> s4-2 direction w) 0.0) - ) - (set! (-> s4-2 decay-start) (string->float (the-as string (-> sv-16 sql-data (+ s5-1 13))))) - (set! (-> s4-2 ambient-point-ratio) (string->float (the-as string (-> sv-16 sql-data (+ s5-1 14))))) - (set! (-> s4-2 brightness) (string->float (the-as string (-> sv-16 sql-data (+ s5-1 15))))) - (set! (-> s4-2 shadow-ambi) - (* 0.0625 (the float (string->int (the-as string (-> sv-16 sql-data (+ s5-1 16)))))) - ) - (set! (-> s4-2 shadow-dir0) - (* 0.0625 (the float (string->int (the-as string (-> sv-16 sql-data (+ s5-1 17)))))) - ) - (set! (-> s4-2 shadow-dir1) - (* 0.0625 (the float (string->int (the-as string (-> sv-16 sql-data (+ s5-1 18)))))) - ) - (set! (-> s4-2 shadow-dir2) - (* 0.0625 (the float (string->int (the-as string (-> sv-16 sql-data (+ s5-1 19)))))) - ) - (set! (-> s4-2 shadow-dir3) - (* 0.0625 (the float (string->int (the-as string (-> sv-16 sql-data (+ s5-1 20)))))) - ) - (let ((a0-51 0) - (v1-92 0) - ) - (let ((a1-5 (-> s4-2 shadows))) - (dotimes (a2-3 5) - (when (!= (-> a1-5 a2-3) 1.0) - (set! a0-51 (logior a0-51 (ash 1 a2-3))) - (set! v1-92 (logior v1-92 (ash (logand (the int (* 16.0 (-> a1-5 a2-3))) 15) (* a2-3 4)))) - ) - ) - ) - (set! (-> s4-2 direction x) - (the-as - float - (logior (logand (the-as uint (-> s4-2 direction x)) (the-as uint #xffffffff00ffffff)) (shr (shl a0-51 56) 32)) + (set! (-> s4-2 decay-start) (string->float (the-as string (-> sv-16 sql-data (+ s5-1 13))))) + (set! (-> s4-2 ambient-point-ratio) (string->float (the-as string (-> sv-16 sql-data (+ s5-1 14))))) + (set! (-> s4-2 brightness) (string->float (the-as string (-> sv-16 sql-data (+ s5-1 15))))) + (set! (-> s4-2 shadow-ambi) + (* 0.0625 (the float (string->int (the-as string (-> sv-16 sql-data (+ s5-1 16)))))) + ) + (set! (-> s4-2 shadow-dir0) + (* 0.0625 (the float (string->int (the-as string (-> sv-16 sql-data (+ s5-1 17)))))) + ) + (set! (-> s4-2 shadow-dir1) + (* 0.0625 (the float (string->int (the-as string (-> sv-16 sql-data (+ s5-1 18)))))) + ) + (set! (-> s4-2 shadow-dir2) + (* 0.0625 (the float (string->int (the-as string (-> sv-16 sql-data (+ s5-1 19)))))) + ) + (set! (-> s4-2 shadow-dir3) + (* 0.0625 (the float (string->int (the-as string (-> sv-16 sql-data (+ s5-1 20)))))) + ) + (let ((a0-51 0) + (v1-92 0) + ) + (let ((a1-5 (-> s4-2 shadows))) + (dotimes (a2-3 5) + (when (!= (-> a1-5 a2-3) 1.0) + (set! a0-51 (logior a0-51 (ash 1 a2-3))) + (set! v1-92 (logior v1-92 (ash (logand (the int (* 16.0 (-> a1-5 a2-3))) 15) (* a2-3 4)))) + ) ) ) - (set! (-> s4-2 direction x) - (the-as float (logior (logand (the-as int (-> s4-2 direction x)) -16777216) (shr (shl v1-92 40) 40))) - ) + (set! (-> s4-2 direction x) + (the-as + float + (logior (logand (the-as uint (-> s4-2 direction x)) (the-as uint #xffffffff00ffffff)) (shr (shl a0-51 56) 32)) + ) + ) + (set! (-> s4-2 direction x) + (the-as float (logior (logand (the-as int (-> s4-2 direction x)) -16777216) (shr (shl v1-92 40) 40))) + ) + ) + ) ) ) ) + (+! s5-1 21) ) ) - (+! s5-1 21) ) ) (set! (-> *editable-light-region* changed) #f) @@ -2799,34 +2766,6 @@ ) (defmethod editable-array-method-13 ((this editable-array) (arg0 symbol)) - (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 number) - (sv-44 number) - (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 object) - (sv-176 vector) - (sv-180 editable) - (sv-184 int) - (sv-192 int) - (sv-200 editable-point) - (sv-208 int) - (sv-216 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)) @@ -2840,17 +2779,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 content-type) 'select) (>= (-> sv-16 length) 3)) - (set-vector! - (-> this level-offset) - (* 4096.0 (string->float (the-as string (-> sv-16 sql-data 0)))) - (* 4096.0 (string->float (the-as string (-> sv-16 sql-data 1)))) - (* 4096.0 (string->float (the-as string (-> sv-16 sql-data 2)))) - 1.0 + (let ((sv-16 (s4-0 *temp-string*))) + (when (and (= (-> sv-16 content-type) 'select) (>= (-> sv-16 length) 3)) + (set-vector! + (-> this level-offset) + (* 4096.0 (string->float (the-as string (-> sv-16 sql-data 0)))) + (* 4096.0 (string->float (the-as string (-> sv-16 sql-data 1)))) + (* 4096.0 (string->float (the-as string (-> sv-16 sql-data 2)))) + 1.0 + ) + (set! (-> this level-info-id) (the-as uint (string->int (the-as string (-> sv-16 sql-data 3))))) + ) ) - (set! (-> this level-info-id) (the-as uint (string->int (the-as string (-> sv-16 sql-data 3))))) ) (let ((s4-2 sql-query)) (format @@ -2858,234 +2798,256 @@ "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 content-type) 'select) - (return #f) - ) - (format #t "sql: read region ~D~%" (/ (-> sv-20 length) 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 content-type) 'select) - (return #f) - ) - (format #t "sql: read face ~D~%" (/ (-> sv-24 length) 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 content-type) 'select) - (return #f) - ) - (format #t "sql: read point ~D~%" (/ (-> sv-28 length) 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 content-type) 'select) - (return #f) - ) - (format #t "sql: read sphere ~D~%" (/ (-> sv-32 length) 5)) - (let ((s4-6 0)) - (while (< s4-6 (-> sv-20 length)) - (set! sv-36 (new 'debug 'editable-region)) - (set! sv-40 4095996000.0) - (set! sv-44 -4095996000.0) - (set! (-> sv-36 id) (the-as uint (string->int (the-as string (-> sv-20 sql-data s4-6))))) - (set! (-> sv-36 level) (the-as string (string->symbol (the-as string (-> sv-20 sql-data (+ s4-6 1)))))) - (set! (-> sv-36 tree) (string->symbol (the-as string (-> sv-20 sql-data (+ s4-6 2))))) - (set! (-> sv-36 on-enter) (the-as pair (if (string= (the-as string (-> sv-20 sql-data (+ s4-6 3))) "") - #f - (-> sv-20 sql-data (+ s4-6 3)) - ) - ) - ) - (set! (-> sv-36 on-exit) (the-as pair (if (string= (the-as string (-> sv-20 sql-data (+ s4-6 4))) "") - #f - (-> sv-20 sql-data (+ s4-6 4)) - ) - ) - ) - (set! (-> sv-36 on-inside) (the-as pair (if (string= (the-as string (-> sv-20 sql-data (+ s4-6 5))) "") - #f - (-> sv-20 sql-data (+ s4-6 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 content-type) 'select) + (return #f) ) - ) - (let ((s3-5 0)) - (while (< s3-5 (-> sv-32 length)) - (when (= (-> sv-36 id) (string->int (the-as string (-> sv-32 sql-data s3-5)))) - (let ((s2-0 (get-length this))) - (when (>= s2-0 0) - (let ((s1-1 (new 'stack-no-clear 'vector))) - (set! (-> s1-1 x) (string->float (the-as string (-> sv-32 sql-data (+ s3-5 1))))) - (set! (-> s1-1 y) (string->float (the-as string (-> sv-32 sql-data (+ s3-5 2))))) - (set! (-> s1-1 z) (string->float (the-as string (-> sv-32 sql-data (+ s3-5 3))))) - (set! (-> s1-1 w) 1.0) - (vector+! s1-1 s1-1 (-> this level-offset)) - (let ((s1-2 (new 'debug 'editable-sphere s1-1 2048.0 sv-36))) - (set! (-> s1-2 radius) (string->float (the-as string (-> sv-32 sql-data (+ s3-5 4))))) - (set! (-> this data s2-0) s1-2) + (format #t "sql: read region ~D~%" (/ (-> sv-20 length) 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 content-type) 'select) + (return #f) + ) + (format #t "sql: read face ~D~%" (/ (-> sv-24 length) 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 content-type) 'select) + (return #f) + ) + (format #t "sql: read point ~D~%" (/ (-> sv-28 length) 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 content-type) 'select) + (return #f) + ) + (format #t "sql: read sphere ~D~%" (/ (-> sv-32 length) 5)) + (let ((s4-6 0)) + (while (< s4-6 (-> sv-20 length)) + (let ((sv-36 (new 'debug 'editable-region))) + (let ((sv-40 4095996000.0) + (sv-44 -4095996000.0) + ) + (set! (-> sv-36 id) (the-as uint (string->int (the-as string (-> sv-20 sql-data s4-6))))) + (set! (-> sv-36 level) (the-as string (string->symbol (the-as string (-> sv-20 sql-data (+ s4-6 1)))))) + (set! (-> sv-36 tree) (string->symbol (the-as string (-> sv-20 sql-data (+ s4-6 2))))) + (set! (-> sv-36 on-enter) (the-as pair (if (string= (the-as string (-> sv-20 sql-data (+ s4-6 3))) "") + #f + (-> sv-20 sql-data (+ s4-6 3)) + ) + ) + ) + (set! (-> sv-36 on-exit) (the-as pair (if (string= (the-as string (-> sv-20 sql-data (+ s4-6 4))) "") + #f + (-> sv-20 sql-data (+ s4-6 4)) + ) + ) + ) + (set! (-> sv-36 on-inside) (the-as pair (if (string= (the-as string (-> sv-20 sql-data (+ s4-6 5))) "") + #f + (-> sv-20 sql-data (+ s4-6 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 ((s3-5 0)) + (while (< s3-5 (-> sv-32 length)) + (when (= (-> sv-36 id) (string->int (the-as string (-> sv-32 sql-data s3-5)))) + (let ((s2-0 (get-length this))) + (when (>= s2-0 0) + (let ((s1-1 (new 'stack-no-clear 'vector))) + (set! (-> s1-1 x) (string->float (the-as string (-> sv-32 sql-data (+ s3-5 1))))) + (set! (-> s1-1 y) (string->float (the-as string (-> sv-32 sql-data (+ s3-5 2))))) + (set! (-> s1-1 z) (string->float (the-as string (-> sv-32 sql-data (+ s3-5 3))))) + (set! (-> s1-1 w) 1.0) + (vector+! s1-1 s1-1 (-> this level-offset)) + (let ((s1-2 (new 'debug 'editable-sphere s1-1 2048.0 sv-36))) + (set! (-> s1-2 radius) (string->float (the-as string (-> sv-32 sql-data (+ s3-5 4))))) + (set! (-> this data s2-0) s1-2) + ) + ) + ) + ) + ) + (+! s3-5 5) + ) + ) + (let ((sv-64 0)) + (while (< sv-64 (-> sv-24 length)) + (when (= (-> sv-36 id) (string->int (the-as string (-> sv-24 sql-data sv-64)))) + (cond + ((string= (the-as string (-> sv-24 sql-data (+ sv-64 2))) "plane") + (let ((sv-72 (get-length this)) + (sv-80 (new 'debug 'editable-plane sv-36)) + (sv-84 (the-as string (-> sv-24 sql-data (+ sv-64 1)))) + ) + (when (>= sv-72 0) + (set! (-> this data sv-72) sv-80) + (set! (-> sv-80 radius) (string->float (the-as string (-> sv-24 sql-data (+ sv-64 4))))) + (countdown (s3-6 (/ (-> sv-28 length) 5)) + (when (string= (the-as string (-> (the-as sql-result (+ (* 20 s3-6) (the-as int sv-28))) sql-data 0)) sv-84) + (let ((s2-1 (new 'stack-no-clear 'vector))) + (set! (-> s2-1 x) (string->float (the-as string (-> sv-28 sql-data (+ (* 5 s3-6) 2))))) + (set! (-> s2-1 y) (string->float (the-as string (-> sv-28 sql-data (+ (* 5 s3-6) 3))))) + (set! (-> s2-1 z) (string->float (the-as string (-> sv-28 sql-data (+ (* 5 s3-6) 4))))) + (set! (-> s2-1 w) 1.0) + (let ((sv-112 s2-1)) + (vector+! sv-112 sv-112 (-> this level-offset)) + (let ((sv-120 (get-length this))) + (when (>= sv-120 0) + (let ((sv-128 (new 'debug 'editable-point sv-112 sv-36))) + (let ((sv-136 (string->int (the-as string (-> sv-28 sql-data (+ (* 5 s3-6) 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-30 sv-80 (editable-flag no-plane-snap)) + (editable-method-31 sv-80 (editable-flag no-plane-snap)) + ) + ) + ) + ((string= (the-as string (-> sv-24 sql-data (+ sv-64 2))) "face") + (let ((sv-144 (get-length this)) + (sv-152 (new 'debug 'editable-face sv-36)) + (sv-156 (-> sv-24 sql-data (+ sv-64 1))) + ) + (when (>= sv-144 0) + (set! (-> this data sv-144) sv-152) + (if (string= (the-as string (-> sv-24 sql-data (+ sv-64 3))) "orient") + (logior! (-> sv-152 flags) (editable-flag orient)) + ) + (let ((s3-7 (/ (-> sv-28 length) 5))) + (while (begin (label cfg-78) (nonzero? s3-7)) + (+! s3-7 -1) + (when (string= + (the-as string (-> (the-as sql-result (+ (* 20 s3-7) (the-as int sv-28))) sql-data 0)) + (the-as string sv-156) + ) + (let ((s2-2 (new 'stack-no-clear 'vector))) + (set! (-> s2-2 x) (string->float (the-as string (-> sv-28 sql-data (+ (* 5 s3-7) 2))))) + (set! (-> s2-2 y) (string->float (the-as string (-> sv-28 sql-data (+ (* 5 s3-7) 3))))) + (set! (-> s2-2 z) (string->float (the-as string (-> sv-28 sql-data (+ (* 5 s3-7) 4))))) + (set! (-> s2-2 w) 1.0) + (let ((sv-176 s2-2)) + (vector+! sv-176 sv-176 (-> this level-offset)) + (let* ((s2-3 (-> this length)) + (s1-3 0) + (s0-0 (-> this data s1-3)) + ) + (while (< s1-3 s2-3) + (when (and s0-0 (= (-> s0-0 region) sv-36) (type? s0-0 editable-point)) + (when (vector= (the-as vector (&+ s0-0 28)) sv-176) + (let ((sv-180 s0-0)) + (let ((sv-184 (string->int (the-as string (-> sv-28 sql-data (+ (* 5 s3-7) 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) + ) + ) + (+! s1-3 1) + (set! s0-0 (-> this data s1-3)) + ) + ) + (if (< (-> sv-176 y) (the-as float sv-40)) + (set! sv-40 (-> sv-176 y)) + ) + (if (< (the-as float sv-44) (-> sv-176 y)) + (set! sv-44 (-> sv-176 y)) + ) + (let ((sv-192 (get-length this))) + (when (>= sv-192 0) + (let ((sv-200 (new 'debug 'editable-point sv-176 sv-36))) + (let ((sv-208 (string->int (the-as string (-> sv-28 sql-data (+ (* 5 s3-7) 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-30 sv-152 (editable-flag no-plane-snap)) + (editable-method-31 sv-152 (editable-flag no-plane-snap)) + ) + ) + ) + ) + ) + (+! sv-64 5) + ) + ) + (let* ((v1-291 (-> this length)) + (a0-158 0) + (a1-57 (-> this data a0-158)) + ) + (while (< a0-158 v1-291) + (when (and a1-57 (= (-> a1-57 region) sv-36) (= (-> a1-57 type) editable-point)) + (let ((a2-29 (&+ a1-57 28))) + (if (= (the-as float (-> a2-29 name)) (the-as float sv-40)) + (logior! (-> a1-57 flags) (editable-flag bot-set)) + ) + (if (= (the-as float (-> a2-29 name)) (the-as float 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) + ) + (+! s4-6 6) + ) ) ) ) ) ) - (+! s3-5 5) ) ) - (set! sv-64 0) - (while (< sv-64 (-> sv-24 length)) - (when (= (-> sv-36 id) (string->int (the-as string (-> sv-24 sql-data sv-64)))) - (cond - ((string= (the-as string (-> sv-24 sql-data (+ sv-64 2))) "plane") - (set! sv-72 (get-length this)) - (set! sv-80 (new 'debug 'editable-plane sv-36)) - (set! sv-84 (the-as string (-> sv-24 sql-data (+ sv-64 1)))) - (when (>= sv-72 0) - (set! (-> this data sv-72) sv-80) - (set! (-> sv-80 radius) (string->float (the-as string (-> sv-24 sql-data (+ sv-64 4))))) - (countdown (s3-6 (/ (-> sv-28 length) 5)) - (when (string= (the-as string (-> (the-as sql-result (+ (* 20 s3-6) (the-as int sv-28))) sql-data 0)) sv-84) - (let ((s2-1 (new 'stack-no-clear 'vector))) - (set! (-> s2-1 x) (string->float (the-as string (-> sv-28 sql-data (+ (* 5 s3-6) 2))))) - (set! (-> s2-1 y) (string->float (the-as string (-> sv-28 sql-data (+ (* 5 s3-6) 3))))) - (set! (-> s2-1 z) (string->float (the-as string (-> sv-28 sql-data (+ (* 5 s3-6) 4))))) - (set! (-> s2-1 w) 1.0) - (set! sv-112 s2-1) - ) - (vector+! sv-112 sv-112 (-> this level-offset)) - (set! sv-120 (get-length this)) - (when (>= sv-120 0) - (set! sv-128 (new 'debug 'editable-point sv-112 sv-36)) - (set! sv-136 (string->int (the-as string (-> sv-28 sql-data (+ (* 5 s3-6) 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-30 sv-80 (editable-flag no-plane-snap)) - (editable-method-31 sv-80 (editable-flag no-plane-snap)) - ) - ) - ((string= (the-as string (-> sv-24 sql-data (+ sv-64 2))) "face") - (set! sv-144 (get-length this)) - (set! sv-152 (new 'debug 'editable-face sv-36)) - (set! sv-156 (-> sv-24 sql-data (+ sv-64 1))) - (when (>= sv-144 0) - (set! (-> this data sv-144) sv-152) - (if (string= (the-as string (-> sv-24 sql-data (+ sv-64 3))) "orient") - (logior! (-> sv-152 flags) (editable-flag orient)) - ) - (let ((s3-7 (/ (-> sv-28 length) 5))) - (while (begin (label cfg-78) (nonzero? s3-7)) - (+! s3-7 -1) - (when (string= - (the-as string (-> (the-as sql-result (+ (* 20 s3-7) (the-as int sv-28))) sql-data 0)) - (the-as string sv-156) - ) - (let ((s2-2 (new 'stack-no-clear 'vector))) - (set! (-> s2-2 x) (string->float (the-as string (-> sv-28 sql-data (+ (* 5 s3-7) 2))))) - (set! (-> s2-2 y) (string->float (the-as string (-> sv-28 sql-data (+ (* 5 s3-7) 3))))) - (set! (-> s2-2 z) (string->float (the-as string (-> sv-28 sql-data (+ (* 5 s3-7) 4))))) - (set! (-> s2-2 w) 1.0) - (set! sv-176 s2-2) - ) - (vector+! sv-176 sv-176 (-> this level-offset)) - (let* ((s2-3 (-> this length)) - (s1-3 0) - (s0-0 (-> this data s1-3)) - ) - (while (< s1-3 s2-3) - (when (and s0-0 (= (-> s0-0 region) sv-36) (type? s0-0 editable-point)) - (when (vector= (the-as vector (&+ s0-0 28)) sv-176) - (set! sv-180 s0-0) - (set! sv-184 (string->int (the-as string (-> sv-28 sql-data (+ (* 5 s3-7) 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) - ) - ) - (+! s1-3 1) - (set! s0-0 (-> this data s1-3)) - ) - ) - (if (< (-> sv-176 y) (the-as float sv-40)) - (set! sv-40 (-> sv-176 y)) - ) - (if (< (the-as float sv-44) (-> sv-176 y)) - (set! sv-44 (-> sv-176 y)) - ) - (set! sv-192 (get-length this)) - (when (>= sv-192 0) - (set! sv-200 (new 'debug 'editable-point sv-176 sv-36)) - (set! sv-208 (string->int (the-as string (-> sv-28 sql-data (+ (* 5 s3-7) 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-30 sv-152 (editable-flag no-plane-snap)) - (editable-method-31 sv-152 (editable-flag no-plane-snap)) - ) - ) - ) - ) - (set! sv-64 (+ sv-64 5)) - ) - (let* ((v1-291 (-> this length)) - (a0-158 0) - (a1-57 (-> this data a0-158)) - ) - (while (< a0-158 v1-291) - (when (and a1-57 (= (-> a1-57 region) sv-36) (= (-> a1-57 type) editable-point)) - (let ((a2-29 (&+ a1-57 28))) - (if (= (the-as float (-> a2-29 name)) (the-as float sv-40)) - (logior! (-> a1-57 flags) (editable-flag bot-set)) - ) - (if (= (the-as float (-> a2-29 name)) (the-as float 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) - (+! s4-6 6) ) ) (let ((s4-7 sql-query)) @@ -3094,26 +3056,27 @@ "select x,y,z from sample_point where level_info_id='~D' and source='manual'" (-> this level-info-id) ) - (set! sv-216 (s4-7 *temp-string*)) - ) - (if (!= (-> sv-216 content-type) 'select) - (return #f) - ) - (let ((s4-8 0)) - (while (< s4-8 (-> sv-216 length)) - (let ((s3-9 (get-length this))) - (when (>= s3-9 0) - (let ((s2-4 (new 'stack-no-clear 'vector))) - (set! (-> s2-4 x) (* 4096.0 (string->float (the-as string (-> sv-216 sql-data s4-8))))) - (set! (-> s2-4 y) (* 4096.0 (string->float (the-as string (-> sv-216 sql-data (+ s4-8 1)))))) - (set! (-> s2-4 z) (* 4096.0 (string->float (the-as string (-> sv-216 sql-data (+ s4-8 2)))))) - (set! (-> s2-4 w) 1.0) - (vector+! s2-4 s2-4 (-> this level-offset)) - (set! (-> this data s3-9) (new 'debug 'editable-sample s2-4 *editable-sample-region*)) + (let ((sv-216 (s4-7 *temp-string*))) + (if (!= (-> sv-216 content-type) 'select) + (return #f) + ) + (let ((s4-8 0)) + (while (< s4-8 (-> sv-216 length)) + (let ((s3-9 (get-length this))) + (when (>= s3-9 0) + (let ((s2-4 (new 'stack-no-clear 'vector))) + (set! (-> s2-4 x) (* 4096.0 (string->float (the-as string (-> sv-216 sql-data s4-8))))) + (set! (-> s2-4 y) (* 4096.0 (string->float (the-as string (-> sv-216 sql-data (+ s4-8 1)))))) + (set! (-> s2-4 z) (* 4096.0 (string->float (the-as string (-> sv-216 sql-data (+ s4-8 2)))))) + (set! (-> s2-4 w) 1.0) + (vector+! s2-4 s2-4 (-> this level-offset)) + (set! (-> this data s3-9) (new 'debug 'editable-sample s2-4 *editable-sample-region*)) + ) + ) ) + (+! s4-8 3) ) ) - (+! s4-8 3) ) ) (set! (-> *editable-sample-region* changed) #f) @@ -3124,57 +3087,57 @@ ) (defmethod editable-array-method-19 ((this editable-array) (arg0 string)) - (local-vars (sv-16 sql-result)) (let ((s4-0 sql-query)) (format (clear *temp-string*) "select entity_id,name,idx,position_x,position_y,position_z,rot_x,rot_y,rot_z from entity where level_id=~D and path like 'region-editor-%'" (-> this level-info-id) ) - (set! sv-16 (s4-0 *temp-string*)) - ) - (format #t "sql: read entity ~D~%" (/ (-> sv-16 length) 9)) - (if (!= (-> sv-16 content-type) 'select) - (return #f) - ) - (let ((s4-1 0)) - (while (< s4-1 (-> sv-16 length)) - (let ((s3-1 (get-length this))) - (when (>= s3-1 0) - (let ((s2-0 (new 'stack-no-clear 'vector))) - (set! (-> s2-0 x) (* 4096.0 (string->float (the-as string (-> sv-16 sql-data (+ s4-1 3)))))) - (set! (-> s2-0 y) (* 4096.0 (string->float (the-as string (-> sv-16 sql-data (+ s4-1 4)))))) - (set! (-> s2-0 z) (* 4096.0 (string->float (the-as string (-> sv-16 sql-data (+ s4-1 5)))))) - (set! (-> s2-0 w) 1.0) - (vector+! s2-0 s2-0 (-> this level-offset)) - (let ((s1-0 (new 'debug 'editable-region))) - (let ((v1-22 s1-0)) - (set! (-> v1-22 locked) #t) - (set! (-> v1-22 changed) #f) - (set! (-> v1-22 tree) 'entity) - (set! (-> v1-22 filter) (editable-filter entity)) - (set! (-> v1-22 level) arg0) - ) - (let ((s2-1 (new 'debug 'editable-entity s2-0 6144.0 s1-0))) - (logclear! (-> s2-1 flags) (editable-flag changed)) - (set! (-> s1-0 changed) #f) - (set! (-> this data s3-1) s2-1) - (set! (-> s2-1 id) (the-as uint (string->int (the-as string (-> sv-16 sql-data s4-1))))) - (copy-string<-string (-> s2-1 name) (the-as string (-> sv-16 sql-data (+ s4-1 1)))) - (set! (-> s2-1 idx) (string->int (the-as string (-> sv-16 sql-data (+ s4-1 2))))) - (set-eul! - (-> s2-1 angles) - (* 182.04445 (string->float (the-as string (-> sv-16 sql-data (+ s4-1 6))))) - (* 182.04445 (string->float (the-as string (-> sv-16 sql-data (+ s4-1 7))))) - (* 182.04445 (string->float (the-as string (-> sv-16 sql-data (+ s4-1 8))))) - 21 + (let ((sv-16 (s4-0 *temp-string*))) + (format #t "sql: read entity ~D~%" (/ (-> sv-16 length) 9)) + (if (!= (-> sv-16 content-type) 'select) + (return #f) + ) + (let ((s4-1 0)) + (while (< s4-1 (-> sv-16 length)) + (let ((s3-1 (get-length this))) + (when (>= s3-1 0) + (let ((s2-0 (new 'stack-no-clear 'vector))) + (set! (-> s2-0 x) (* 4096.0 (string->float (the-as string (-> sv-16 sql-data (+ s4-1 3)))))) + (set! (-> s2-0 y) (* 4096.0 (string->float (the-as string (-> sv-16 sql-data (+ s4-1 4)))))) + (set! (-> s2-0 z) (* 4096.0 (string->float (the-as string (-> sv-16 sql-data (+ s4-1 5)))))) + (set! (-> s2-0 w) 1.0) + (vector+! s2-0 s2-0 (-> this level-offset)) + (let ((s1-0 (new 'debug 'editable-region))) + (let ((v1-22 s1-0)) + (set! (-> v1-22 locked) #t) + (set! (-> v1-22 changed) #f) + (set! (-> v1-22 tree) 'entity) + (set! (-> v1-22 filter) (editable-filter entity)) + (set! (-> v1-22 level) arg0) + ) + (let ((s2-1 (new 'debug 'editable-entity s2-0 6144.0 s1-0))) + (logclear! (-> s2-1 flags) (editable-flag changed)) + (set! (-> s1-0 changed) #f) + (set! (-> this data s3-1) s2-1) + (set! (-> s2-1 id) (the-as uint (string->int (the-as string (-> sv-16 sql-data s4-1))))) + (copy-string<-string (-> s2-1 name) (the-as string (-> sv-16 sql-data (+ s4-1 1)))) + (set! (-> s2-1 idx) (string->int (the-as string (-> sv-16 sql-data (+ s4-1 2))))) + (set-eul! + (-> s2-1 angles) + (* 182.04445 (string->float (the-as string (-> sv-16 sql-data (+ s4-1 6))))) + (* 182.04445 (string->float (the-as string (-> sv-16 sql-data (+ s4-1 7))))) + (* 182.04445 (string->float (the-as string (-> sv-16 sql-data (+ s4-1 8))))) + 21 + ) + ) ) ) ) ) + (+! s4-1 9) ) ) - (+! s4-1 9) ) ) (set! (-> *editable-entity-region* changed) #f) diff --git a/goal_src/jak3/engine/debug/history.gc b/goal_src/jak3/engine/debug/history.gc index 94e3ec8f01..469ebfbdd2 100644 --- a/goal_src/jak3/engine/debug/history.gc +++ b/goal_src/jak3/engine/debug/history.gc @@ -243,150 +243,143 @@ ;; 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 (the-as int (-> 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 (the-as int (-> 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) - ) - ) + ) + ) + ) ) ) ) @@ -399,115 +392,116 @@ ;; 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 number)) - (set! sv-16 (the-as vector #f)) - (set! sv-20 (the-as vector #f)) - (set! sv-24 0) - (until #f - (let ((s5-0 (update-entries! arg0))) - (if (not s5-0) - (goto cfg-34) - ) - (when (logtest? (-> arg0 channel-mask) (ash 1 (the-as int (-> 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 0.0) + ) + (until #f + (let ((s5-0 (update-entries! arg0))) + (if (not s5-0) + (goto cfg-34) + ) + (when (logtest? (-> arg0 channel-mask) (ash 1 (the-as int (-> 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* (shr (shl (the-as int sv-24) 54) 61) 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 (-> 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* (shr (shl (the-as int sv-24) 54) 61) 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 (-> 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/goal_src/jak3/engine/debug/manipulator.gc b/goal_src/jak3/engine/debug/manipulator.gc index 7eb369c97d..877b64461d 100644 --- a/goal_src/jak3/engine/debug/manipulator.gc +++ b/goal_src/jak3/engine/debug/manipulator.gc @@ -60,17 +60,6 @@ ;; WARN: Return type mismatch symbol vs none. (defun draw-axis ((arg0 vector) (arg1 vector) (arg2 float) (arg3 float) (arg4 rgba)) - (local-vars - (sv-160 int) - (sv-176 (function symbol bucket-id vector vector vector rgba symbol)) - (sv-192 symbol) - (sv-208 int) - (sv-224 vector) - (sv-240 vector) - (sv-256 vector) - (sv-272 vector) - (sv-288 vector) - ) (rlet ((acc :class vf) (vf0 :class vf) (vf4 :class vf) @@ -93,67 +82,72 @@ ) (vector-cross! s1-0 s1-0 arg1) (vector-normalize! s1-0 1.0) - (let ((s0-1 (vector+*! (new 'stack-no-clear 'vector) arg0 arg1 arg2))) - (set! sv-160 0) + (let ((s0-1 (vector+*! (new 'stack-no-clear 'vector) arg0 arg1 arg2)) + (sv-160 0) + ) (while (< sv-160 8) - (set! sv-176 add-debug-flat-triangle) - (set! sv-192 #t) - (set! sv-208 584) - (set! sv-224 (new 'stack-no-clear 'vector)) - (let ((v1-16 s0-1)) - (let ((a0-9 arg1)) - (let ((a1-10 arg3)) - (.mov vf7 a1-10) + (let ((sv-176 add-debug-flat-triangle) + (sv-192 #t) + (sv-208 584) + (sv-224 (new 'stack-no-clear 'vector)) ) - (.lvf vf5 (&-> a0-9 quad)) + (let ((v1-16 s0-1)) + (let ((a0-9 arg1)) + (let ((a1-10 arg3)) + (.mov vf7 a1-10) + ) + (.lvf vf5 (&-> a0-9 quad)) + ) + (.lvf vf4 (&-> v1-16 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-224 quad) vf6) - (set! sv-256 (new 'stack-no-clear 'vector)) - (set! sv-240 s0-1) - (let* ((a2-3 - (quaternion-vector-angle! (new 'stack-no-clear 'quaternion) arg1 (* 182.04445 (the float (* 45 sv-160)))) - ) - (v1-22 (vector-orient-by-quat! (new 'stack-no-clear 'vector) s1-0 a2-3)) - ) - (let ((a0-13 (/ arg3 4))) - (.mov vf7 a0-13) - ) - (.lvf vf5 (&-> v1-22 quad)) - ) - (.lvf vf4 (&-> sv-240 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-256 quad) vf6) - (set! sv-288 (new 'stack-no-clear 'vector)) - (set! sv-272 s0-1) - (let* ((a2-7 (quaternion-vector-angle! - (new 'stack-no-clear 'quaternion) - arg1 - (* 182.04445 (the float (* 45 (+ sv-160 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 (&-> sv-224 quad) vf6) + (let ((sv-256 (new 'stack-no-clear 'vector))) + (let ((sv-240 s0-1)) + (let* ((a2-3 + (quaternion-vector-angle! (new 'stack-no-clear 'quaternion) arg1 (* 182.04445 (the float (* 45 sv-160)))) ) + (v1-22 (vector-orient-by-quat! (new 'stack-no-clear 'vector) s1-0 a2-3)) ) - (v1-29 (vector-orient-by-quat! (new 'stack-no-clear 'vector) s1-0 a2-7)) - ) - (let ((a0-17 (/ arg3 4))) - (.mov vf7 a0-17) + (let ((a0-13 (/ arg3 4))) + (.mov vf7 a0-13) + ) + (.lvf vf5 (&-> v1-22 quad)) + ) + (.lvf vf4 (&-> sv-240 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-256 quad) vf6) + (let ((sv-288 (new 'stack-no-clear 'vector))) + (let ((sv-272 s0-1)) + (let* ((a2-7 (quaternion-vector-angle! + (new 'stack-no-clear 'quaternion) + arg1 + (* 182.04445 (the float (* 45 (+ sv-160 1)))) + ) + ) + (v1-29 (vector-orient-by-quat! (new 'stack-no-clear 'vector) s1-0 a2-7)) + ) + (let ((a0-17 (/ arg3 4))) + (.mov vf7 a0-17) + ) + (.lvf vf5 (&-> v1-29 quad)) + ) + (.lvf vf4 (&-> sv-272 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-288 quad) vf6) + (sv-176 sv-192 (the-as bucket-id sv-208) sv-224 sv-256 sv-288 arg4) + ) ) - (.lvf vf5 (&-> v1-29 quad)) ) - (.lvf vf4 (&-> sv-272 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-288 quad) vf6) - (let ((t1-0 arg4)) - (sv-176 sv-192 (the-as bucket-id sv-208) sv-224 sv-256 sv-288 t1-0) - ) - (set! sv-160 (+ sv-160 1)) + (+! sv-160 1) ) ) ) @@ -169,9 +163,10 @@ ) (defmethod manipulator-method-10 ((this manipulator) (arg0 vector) (arg1 vector)) - (local-vars (v1-11 symbol) (sv-160 symbol) (sv-176 vector)) - (set! sv-176 arg1) - (let ((s4-0 (-> this position))) + (local-vars (v1-11 symbol)) + (let ((sv-176 arg1) + (s4-0 (-> this position)) + ) 0.0 (let* ((v0-0 (vector-normalize! (vector-! (new 'stack-no-clear 'vector) (-> *math-camera* trans) (-> this position)) 1.0) @@ -180,106 +175,104 @@ (s2-0 (< (fabs (vector-dot v0-0 (-> this mat uvec))) 0.9)) ) (b! (< (fabs (vector-dot v0-0 (-> this mat fvec))) 0.9) cfg-6 :delay (set! v1-11 #t)) - (set! sv-160 v1-11) - (set! sv-160 #f) - (label cfg-6) - (let ((f28-0 (the-as float #x7f800000)) - (f30-1 (* 0.15 (vector-vector-distance (-> *math-camera* trans) s4-0))) - ) - (set! (-> this action) (manipulator-action ma0)) - (let ((s1-0 (new 'stack-no-clear 'vector))) - 0.0 - (let* ((s0-0 (new 'stack-no-clear 'vector)) - (v1-16 arg0) - (s0-1 (vector-! s0-0 sv-176 v1-16)) - ) - (let ((f0-14 (ray-sphere-intersect arg0 s0-1 s4-0 (/ f30-1 5)))) - (when (and (< 0.0 f0-14) (>= f28-0 f0-14)) - (set! f28-0 f0-14) - (set! (-> this action) (manipulator-action ma7)) - ) + (let ((sv-160 v1-11)) + (set! sv-160 #f) + (label cfg-6) + (let ((f28-0 (the-as float #x7f800000)) + (f30-1 (* 0.15 (vector-vector-distance (-> *math-camera* trans) s4-0))) ) - (when (= (-> this action) (manipulator-action ma0)) - (when (and s3-0 s2-0) - (let ((f0-18 (ray-sphere-intersect - arg0 - s0-1 - (vector+*! - (new 'stack-no-clear 'vector) - s4-0 - (vector+! (new 'stack-no-clear 'vector) (-> this mat rvec) (-> this mat uvec)) - f30-1 + (set! (-> this action) (manipulator-action ma0)) + (let ((s1-0 (new 'stack-no-clear 'vector))) + 0.0 + (let ((s0-1 (vector-! (new 'stack-no-clear 'vector) sv-176 arg0))) + (let ((f0-14 (ray-sphere-intersect arg0 s0-1 s4-0 (/ f30-1 5)))) + (when (and (< 0.0 f0-14) (>= f28-0 f0-14)) + (set! f28-0 f0-14) + (set! (-> this action) (manipulator-action ma7)) + ) + ) + (when (= (-> this action) (manipulator-action ma0)) + (when (and s3-0 s2-0) + (let ((f0-18 (ray-sphere-intersect + arg0 + s0-1 + (vector+*! + (new 'stack-no-clear 'vector) + s4-0 + (vector+! (new 'stack-no-clear 'vector) (-> this mat rvec) (-> this mat uvec)) + f30-1 + ) + (* 0.3 f30-1) ) - (* 0.3 f30-1) ) - ) + ) + (when (and (< 0.0 f0-18) (>= f28-0 f0-18)) + (set! f28-0 f0-18) + (set! (-> this action) (manipulator-action ma4)) ) - (when (and (< 0.0 f0-18) (>= f28-0 f0-18)) - (set! f28-0 f0-18) - (set! (-> this action) (manipulator-action ma4)) ) ) - ) - (when (and s3-0 sv-160) - (let ((f0-22 (ray-sphere-intersect - arg0 - s0-1 - (vector+*! - (new 'stack-no-clear 'vector) - s4-0 - (vector+! (new 'stack-no-clear 'vector) (-> this mat rvec) (-> this mat fvec)) - f30-1 + (when (and s3-0 sv-160) + (let ((f0-22 (ray-sphere-intersect + arg0 + s0-1 + (vector+*! + (new 'stack-no-clear 'vector) + s4-0 + (vector+! (new 'stack-no-clear 'vector) (-> this mat rvec) (-> this mat fvec)) + f30-1 + ) + (* 0.3 f30-1) ) - (* 0.3 f30-1) ) - ) + ) + (when (and (< 0.0 f0-22) (>= f28-0 f0-22)) + (set! f28-0 f0-22) + (set! (-> this action) (manipulator-action ma5)) ) - (when (and (< 0.0 f0-22) (>= f28-0 f0-22)) - (set! f28-0 f0-22) - (set! (-> this action) (manipulator-action ma5)) ) ) - ) - (when (and s2-0 sv-160) - (let ((f0-26 (ray-sphere-intersect - arg0 - s0-1 - (vector+*! - (new 'stack-no-clear 'vector) - s4-0 - (vector+! (new 'stack-no-clear 'vector) (-> this mat uvec) (-> this mat fvec)) - f30-1 + (when (and s2-0 sv-160) + (let ((f0-26 (ray-sphere-intersect + arg0 + s0-1 + (vector+*! + (new 'stack-no-clear 'vector) + s4-0 + (vector+! (new 'stack-no-clear 'vector) (-> this mat uvec) (-> this mat fvec)) + f30-1 + ) + (* 0.3 f30-1) ) - (* 0.3 f30-1) ) - ) + ) + (when (and (< 0.0 f0-26) (>= f28-0 f0-26)) + (set! f28-0 f0-26) + (set! (-> this action) (manipulator-action ma6)) ) - (when (and (< 0.0 f0-26) (>= f28-0 f0-26)) - (set! f28-0 f0-26) - (set! (-> this action) (manipulator-action ma6)) ) ) - ) - (when s3-0 - (let ((f0-31 (ray-cylinder-intersect arg0 s0-1 s4-0 (-> this mat rvec) (/ f30-1 10) (* 1.3 f30-1) s1-0))) - (when (and (< 0.0 f0-31) (>= f28-0 f0-31)) - (set! f28-0 f0-31) - (set! (-> this action) (manipulator-action ma1)) + (when s3-0 + (let ((f0-31 (ray-cylinder-intersect arg0 s0-1 s4-0 (-> this mat rvec) (/ f30-1 10) (* 1.3 f30-1) s1-0))) + (when (and (< 0.0 f0-31) (>= f28-0 f0-31)) + (set! f28-0 f0-31) + (set! (-> this action) (manipulator-action ma1)) + ) ) ) - ) - (when s2-0 - (let ((f0-36 (ray-cylinder-intersect arg0 s0-1 s4-0 (-> this mat uvec) (/ f30-1 10) (* 1.3 f30-1) s1-0))) - (if (and (< 0.0 f0-36) (>= f28-0 f0-36)) - (set! (-> this action) (manipulator-action ma2)) - ) + (when s2-0 + (let ((f0-36 (ray-cylinder-intersect arg0 s0-1 s4-0 (-> this mat uvec) (/ f30-1 10) (* 1.3 f30-1) s1-0))) + (if (and (< 0.0 f0-36) (>= f28-0 f0-36)) + (set! (-> this action) (manipulator-action ma2)) + ) + ) ) - ) - (when sv-160 - (let ((f0-41 (ray-cylinder-intersect arg0 s0-1 s4-0 (-> this mat fvec) (/ f30-1 10) (* 1.3 f30-1) s1-0))) - (if (and (< 0.0 f0-41) (>= f0-41 f0-41)) - (set! (-> this action) (manipulator-action ma3)) - ) + (when sv-160 + (let ((f0-41 (ray-cylinder-intersect arg0 s0-1 s4-0 (-> this mat fvec) (/ f30-1 10) (* 1.3 f30-1) s1-0))) + (if (and (< 0.0 f0-41) (>= f0-41 f0-41)) + (set! (-> this action) (manipulator-action ma3)) + ) + ) ) ) ) @@ -293,7 +286,7 @@ ) (defmethod manipulator-method-11 ((this manipulator)) - (local-vars (sv-240 rgba) (sv-256 vector) (sv-272 vector)) + (local-vars (sv-240 rgba)) (format *stdcon* "~M ~M ~M~%" (-> this position x) (-> this position y) (-> this position z)) (let ((s5-0 (-> this position))) 0.0 @@ -330,10 +323,16 @@ (s0-0 (new 'stack-no-clear 'vector)) ) (let ((f28-0 0.1)) - (if (= (-> this action) (manipulator-action ma7)) - (set! sv-240 *color-yellow*) - (set! sv-240 *color-light-blue*) - ) + (set! sv-240 (cond + ((= (-> this action) (manipulator-action ma7)) + (set! sv-240 *color-yellow*) + sv-240 + ) + (else + *color-light-blue* + ) + ) + ) (vector+*! s1-0 s5-0 @@ -355,44 +354,37 @@ (vector-copy! s1-0 s0-0) (vector+*! s0-0 s0-0 (-> *math-camera* inv-camera-rot rvec) (* 2.0 f30-1 f28-0)) ) - (let ((t9-9 add-debug-line) - (a0-31 #t) - (a1-20 577) - (t1-3 #f) - (t2-3 -1) - ) - (t9-9 a0-31 (the-as bucket-id a1-20) s1-0 s0-0 sv-240 t1-3 (the-as rgba t2-3)) - ) + (add-debug-line #t (bucket-id debug-no-zbuf1) s1-0 s0-0 sv-240 #f (the-as rgba -1)) ) (let ((s1-1 (new 'stack-no-clear 'vector))) (when (and s3-0 s2-0) (vector+*! s1-1 s5-0 (vector+! (new 'stack-no-clear 'vector) (-> this mat fvec) (-> this mat uvec)) f30-1) - (let ((s0-1 draw-axis)) - (set! sv-256 s1-1) - (let ((a1-24 (vector-negate! (new 'stack-no-clear 'vector) (-> this mat uvec))) - (a2-15 (* 0.15 f30-1)) - (a3-11 (* 0.15 f30-1)) - (t0-11 (if (= (-> this action) (manipulator-action ma6)) - *color-yellow* - *color-green* - ) - ) + (let ((s0-1 draw-axis) + (sv-256 s1-1) + ) + (s0-1 + sv-256 + (vector-negate! (new 'stack-no-clear 'vector) (-> this mat uvec)) + (* 0.15 f30-1) + (* 0.15 f30-1) + (if (= (-> this action) (manipulator-action ma6)) + *color-yellow* + *color-green* ) - (s0-1 sv-256 a1-24 a2-15 a3-11 t0-11) ) ) - (let ((s0-2 draw-axis)) - (set! sv-272 s1-1) - (let ((a1-26 (vector-negate! (new 'stack-no-clear 'vector) (-> this mat fvec))) - (a2-16 (* 0.15 f30-1)) - (a3-12 (* 0.15 f30-1)) - (t0-12 (if (= (-> this action) (manipulator-action ma6)) - *color-yellow* - *color-blue* - ) - ) + (let ((s0-2 draw-axis) + (sv-272 s1-1) + ) + (s0-2 + sv-272 + (vector-negate! (new 'stack-no-clear 'vector) (-> this mat fvec)) + (* 0.15 f30-1) + (* 0.15 f30-1) + (if (= (-> this action) (manipulator-action ma6)) + *color-yellow* + *color-blue* ) - (s0-2 sv-272 a1-26 a2-16 a3-12 t0-12) ) ) ) diff --git a/goal_src/jak3/engine/debug/memory-usage.gc b/goal_src/jak3/engine/debug/memory-usage.gc index 57b603b9f7..0a6229bbfa 100644 --- a/goal_src/jak3/engine/debug/memory-usage.gc +++ b/goal_src/jak3/engine/debug/memory-usage.gc @@ -271,7 +271,6 @@ (define *max-dma* 0) (defmethod print-mem-usage ((this memory-usage-block) (arg0 level) (arg1 object)) - (local-vars (sv-16 object) (sv-32 string) (sv-48 symbol)) (let ((s3-0 (&- (-> arg0 heap current) (the-as uint (-> arg0 heap base))))) (let ((v1-2 (+ (-> this data 62 total) (-> this data 63 total)))) (< #x10000 v1-2) @@ -349,220 +348,219 @@ (if (< (- s1-0 (the-as int (shl (-> arg0 info buffer-size) 10))) s3-0) (format arg1 "~3L") ) - (let ((s0-0 format)) - (set! sv-16 arg1) - (set! sv-32 "~0K~10,'-S--~5,'-DK-of-~5,'-DK--~5,'-DK-of-~5,'-DK--") - (set! sv-48 (-> arg0 name)) - (let* ((s3-1 (sar s3-0 10)) - (s4-1 (- (sar s1-0 10) (the-as int (-> arg0 info buffer-size)))) - (s1-1 (sar (memory-used *nk-dead-pool*) 10)) - (t2-0 (sar (memory-total *nk-dead-pool*) 10)) - (t0-0 s4-1) - (t1-0 s1-1) - ) - (s0-0 sv-16 sv-32 sv-48 s3-1 t0-0 t1-0 t2-0) - (format arg1 "~5,'-DK/~5,'-DK--~%" (shr s2-0 10) (sar *max-dma* 10)) - (when *stats-memory-short* - (let ((s3-2 (if (cpad-hold? 1 l3) - #t - arg1 - ) - ) - (s4-2 format) - (s2-1 "heap-~5,'-DK/~5,'-DK----~D---~D/~D~%") - (s1-2 (sar (memory-used *nk-dead-pool*) 10)) - (s0-1 (sar (memory-total *nk-dead-pool*) 10)) - ) - (set! t0-0 (the-as int (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-1 s1-2 s0-1 (the-as uint t0-0) (the-as uint t1-0) (the-as uint t2-0)) - ) + (let* ((s0-0 format) + (sv-16 arg1) + (sv-32 "~0K~10,'-S--~5,'-DK-of-~5,'-DK--~5,'-DK-of-~5,'-DK--") + (sv-48 (-> arg0 name)) + (s3-1 (sar s3-0 10)) + (s4-1 (- (sar s1-0 10) (the-as int (-> arg0 info buffer-size)))) + (s1-1 (sar (memory-used *nk-dead-pool*) 10)) + (t2-0 (sar (memory-total *nk-dead-pool*) 10)) + (t0-0 s4-1) + (t1-0 s1-1) + ) + (s0-0 sv-16 sv-32 sv-48 s3-1 t0-0 t1-0 t2-0) + (format arg1 "~5,'-DK/~5,'-DK--~%" (shr s2-0 10) (sar *max-dma* 10)) + (when *stats-memory-short* + (let ((s3-2 (if (cpad-hold? 1 l3) + #t + arg1 + ) + ) + (s4-2 format) + (s2-1 "heap-~5,'-DK/~5,'-DK----~D---~D/~D~%") + (s1-2 (sar (memory-used *nk-dead-pool*) 10)) + (s0-1 (sar (memory-total *nk-dead-pool*) 10)) + ) + (set! t0-0 (the-as int (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-1 s1-2 s0-1 (the-as uint t0-0) (the-as uint t1-0) (the-as uint t2-0)) ) - (when (not *stats-memory-short*) - (set! (-> *dma-mem-usage* data 88 total) - (* (dma-buffer-length (-> *display* frames (-> *display* last-screen) debug-buf)) 16) + ) + (when (not *stats-memory-short*) + (set! (-> *dma-mem-usage* data 88 total) + (* (dma-buffer-length (-> *display* frames (-> *display* last-screen) debug-buf)) 16) + ) + (let ((t9-11 format) + (a0-47 arg1) + (a1-28 " bsp ~192H~5DK ~280Hdebug~456H~5DK~%") + (a2-12 (sar (+ (-> this data 59 total) (-> this data 60 total) (-> this data 61 total)) 10)) + (a3-5 (sar (-> *dma-mem-usage* data 88 total) 10)) + ) + (t9-11 a0-47 a1-28 a2-12 a3-5 (the-as none t0-0) (the-as none t1-0) (the-as none t2-0)) + (format + arg1 + " bsp-leaf-vis ~192H~5DK~%" + (sar (+ (-> this data 62 total) (-> this data 63 total)) 10) + (the-as none a3-5) + ) + (format arg1 " level-code ~192H~5DK~%" (sar (-> this data 66 total) 10) (the-as none a3-5)) + ) + (format + arg1 + " 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 + arg1 + " 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 89 total) 10) + ) + (format + arg1 + " 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 + arg1 + " 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 + arg1 + " shrub-instance ~192H~5DK ~280Hshrubbery~456H~5DK~%" + (sar (-> this data 34 total) 10) + (sar (-> *dma-mem-usage* data 27 total) 10) + ) + (format + arg1 + " hfragment ~192H~5DK ~280Hhfragment~456H~5DK~%" + (sar (-> this data 43 total) 10) + (sar (-> *dma-mem-usage* data 43 total) 10) + (the-as none t0-0) + (the-as none t1-0) + (the-as none t2-0) + ) + (format + arg1 + " collision ~192H~5DK ~280Htie-generic~456H~5DK~%" + (sar + (+ (-> 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) + (-> this data 58 total) + ) + 10 + ) + (sar (-> *dma-mem-usage* data 17 total) 10) + ) + (format + arg1 + " 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 74 total) + (-> this data 75 total) + (-> this data 76 total) + (-> this data 77 total) + (-> this data 79 total) + (-> this data 82 total) + (-> this data 81 total) + (-> this data 112 total) + ) + 10 + ) + (sar (-> *dma-mem-usage* data 35 total) 10) + ) + (format + arg1 + " pris-anim ~192H~5DK ~280Hpris-generic~456H~5DK~%" + (sar + (+ (-> this data 68 total) + (-> this data 69 total) + (-> this data 70 total) + (-> this data 71 total) + (-> this data 72 total) + (-> this data 78 total) + (-> this data 80 total) + (-> this data 73 total) + ) + 10 + ) + (sar (-> *dma-mem-usage* data 90 total) 10) + ) + (format + arg1 + " textures ~192H~5DK ~280Htextures~456H~5DK~%" + (sar (-> this data 83 total) 10) + (sar (-> *dma-mem-usage* data 83 total) 10) + ) + (format arg1 " entity ~192H~5DK~%" (sar + (+ (-> this data 67 total) + (-> this data 44 total) + (-> this data 45 total) + (-> this data 46 total) + (-> this data 50 total) + (-> this data 49 total) + (-> this data 47 total) + (-> this data 48 total) + ) + 10 + ) ) - (let ((t9-11 format) - (a0-47 arg1) - (a1-28 " bsp ~192H~5DK ~280Hdebug~456H~5DK~%") - (a2-12 (sar (+ (-> this data 59 total) (-> this data 60 total) (-> this data 61 total)) 10)) - (a3-5 (sar (-> *dma-mem-usage* data 88 total) 10)) - ) - (t9-11 a0-47 a1-28 a2-12 a3-5 (the-as none t0-0) (the-as none t1-0) (the-as none t2-0)) - (format - arg1 - " bsp-leaf-vis ~192H~5DK~%" - (sar (+ (-> this data 62 total) (-> this data 63 total)) 10) - (the-as none a3-5) - ) - (format arg1 " level-code ~192H~5DK~%" (sar (-> this data 66 total) 10) (the-as none a3-5)) - ) - (format - arg1 - " 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 - arg1 - " 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 89 total) 10) - ) - (format - arg1 - " 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 - arg1 - " 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 - arg1 - " shrub-instance ~192H~5DK ~280Hshrubbery~456H~5DK~%" - (sar (-> this data 34 total) 10) - (sar (-> *dma-mem-usage* data 27 total) 10) - ) - (format - arg1 - " hfragment ~192H~5DK ~280Hhfragment~456H~5DK~%" - (sar (-> this data 43 total) 10) - (sar (-> *dma-mem-usage* data 43 total) 10) - (the-as none t0-0) - (the-as none t1-0) - (the-as none t2-0) - ) - (format - arg1 - " collision ~192H~5DK ~280Htie-generic~456H~5DK~%" - (sar - (+ (-> 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) - (-> this data 58 total) - ) - 10 - ) - (sar (-> *dma-mem-usage* data 17 total) 10) - ) - (format - arg1 - " 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 74 total) - (-> this data 75 total) - (-> this data 76 total) - (-> this data 77 total) - (-> this data 79 total) - (-> this data 82 total) - (-> this data 81 total) - (-> this data 112 total) - ) - 10 - ) - (sar (-> *dma-mem-usage* data 35 total) 10) - ) - (format - arg1 - " pris-anim ~192H~5DK ~280Hpris-generic~456H~5DK~%" - (sar - (+ (-> this data 68 total) - (-> this data 69 total) - (-> this data 70 total) - (-> this data 71 total) - (-> this data 72 total) - (-> this data 78 total) - (-> this data 80 total) - (-> this data 73 total) - ) - 10 - ) - (sar (-> *dma-mem-usage* data 90 total) 10) - ) - (format - arg1 - " textures ~192H~5DK ~280Htextures~456H~5DK~%" - (sar (-> this data 83 total) 10) - (sar (-> *dma-mem-usage* data 83 total) 10) - ) - (format arg1 " entity ~192H~5DK~%" (sar - (+ (-> this data 67 total) - (-> this data 44 total) - (-> this data 45 total) - (-> this data 46 total) - (-> this data 50 total) - (-> this data 49 total) - (-> this data 47 total) - (-> this data 48 total) - ) - 10 - ) - ) - (format - arg1 - " misc ~192H~5DK ~280Hsprite~456H~5DK~%" - (sar - (+ (-> this data 0 total) - (-> this data 64 total) - (-> this data 65 total) - (-> this data 84 total) - (-> this data 85 total) - ) - 10 - ) - (sar (-> *dma-mem-usage* data 86 total) 10) + (format + arg1 + " misc ~192H~5DK ~280Hsprite~456H~5DK~%" + (sar + (+ (-> this data 0 total) + (-> this data 64 total) + (-> this data 65 total) + (-> this data 84 total) + (-> this data 85 total) + ) + 10 ) + (sar (-> *dma-mem-usage* data 86 total) 10) ) ) ) diff --git a/goal_src/jak3/engine/debug/menu.gc b/goal_src/jak3/engine/debug/menu.gc index ccaba9c5f2..6c0877a9db 100644 --- a/goal_src/jak3/engine/debug/menu.gc +++ b/goal_src/jak3/engine/debug/menu.gc @@ -470,7 +470,8 @@ (debug-menu-context-send-msg gp-0 (debug-menu-msg deactivate) (debug-menu-dest activation)) ) (set! (-> arg1 parent) arg0) - (set! (-> arg0 items) (the-as pair (append! (-> arg0 items) (cons arg1 '())))) + ;; og:preserve-this cons -> dcons + (set! (-> arg0 items) (the-as pair (append! (-> arg0 items) (dcons arg1 '())))) (debug-menu-rebuild arg0) (if s4-0 (debug-menu-context-send-msg gp-0 (debug-menu-msg activate) (debug-menu-dest activation)) @@ -523,18 +524,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) @@ -609,79 +599,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 ) @@ -908,7 +863,6 @@ ) (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)) @@ -954,23 +908,25 @@ ) ) (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)) - (set-context! *font-work* (-> arg0 context font)) - (draw-string ">" sv-16 (-> arg0 context font)) - (let ((a3-3 (-> sv-16 base))) - (when (!= sv-32 a3-3) - (let ((v1-35 (the-as object (-> sv-16 base)))) - (set! (-> (the-as dma-packet v1-35) dma) (new 'static 'dma-tag :id (dma-tag-id next))) - (set! (-> (the-as dma-packet v1-35) vif0) (new 'static 'vif-tag)) - (set! (-> (the-as dma-packet v1-35) vif1) (new 'static 'vif-tag)) - (set! (-> sv-16 base) (&+ (the-as pointer v1-35) 16)) - ) - (dma-bucket-insert-tag - (-> *display* frames (-> *display* on-screen) bucket-group) - (bucket-id debug-menu) - sv-32 - (the-as (pointer dma-tag) a3-3) + (let* ((sv-16 (-> *display* frames (-> *display* on-screen) debug-buf)) + (sv-32 (-> sv-16 base)) + ) + (set-context! *font-work* (-> arg0 context font)) + (draw-string ">" sv-16 (-> arg0 context font)) + (let ((a3-3 (-> sv-16 base))) + (when (!= sv-32 a3-3) + (let ((v1-35 (the-as object (-> sv-16 base)))) + (set! (-> (the-as dma-packet v1-35) dma) (new 'static 'dma-tag :id (dma-tag-id next))) + (set! (-> (the-as dma-packet v1-35) vif0) (new 'static 'vif-tag)) + (set! (-> (the-as dma-packet v1-35) vif1) (new 'static 'vif-tag)) + (set! (-> sv-16 base) (&+ (the-as pointer v1-35) 16)) + ) + (dma-bucket-insert-tag + (-> *display* frames (-> *display* on-screen) bucket-group) + (bucket-id debug-menu) + sv-32 + (the-as (pointer dma-tag) a3-3) + ) ) ) ) diff --git a/goal_src/jak3/engine/debug/nav-mesh-editor.gc b/goal_src/jak3/engine/debug/nav-mesh-editor.gc index 507a524a55..749b19abf7 100644 --- a/goal_src/jak3/engine/debug/nav-mesh-editor.gc +++ b/goal_src/jak3/engine/debug/nav-mesh-editor.gc @@ -11,7 +11,6 @@ (declare-file (debug)) (defun snap-level-navmesh ((arg0 vector) (arg1 vector)) - (local-vars (sv-96 nav-poly) (sv-112 vector) (sv-128 int)) (dotimes (s4-0 (-> *level* length)) (let ((v1-3 (-> *level* level s4-0))) (when (= (-> v1-3 status) 'active) @@ -25,22 +24,24 @@ (let ((s1-1 (-> v1-8 nav-mesh))) (new 'stack-no-clear 'vector) (dotimes (s0-0 (the-as int (-> s1-1 poly-count))) - (set! sv-96 (-> s1-1 poly-array s0-0)) - (set! sv-112 (new 'stack-no-clear 'vector)) - (set! sv-128 0) - (while (< sv-128 (the-as int (-> sv-96 vertex-count))) - (when (transform-point-vector! - sv-112 - (vector+! (new 'stack-no-clear 'vector) (the-as vector (-> s1-1 bounds)) (-> sv-96 vertex sv-128)) - ) - (when (and (< (fabs (- (-> arg0 x) (+ -2048.0 (-> sv-112 x)))) 8.0) - (< (fabs (- (-> arg0 y) (+ -2048.0 (-> sv-112 y)))) 8.0) - ) - (vector+! arg1 (the-as vector (-> s1-1 bounds)) (-> sv-96 vertex sv-128)) - (return #t) + (let ((sv-96 (-> s1-1 poly-array s0-0)) + (sv-112 (new 'stack-no-clear 'vector)) + (sv-128 0) ) + (while (< sv-128 (the-as int (-> sv-96 vertex-count))) + (when (transform-point-vector! + sv-112 + (vector+! (new 'stack-no-clear 'vector) (the-as vector (-> s1-1 bounds)) (-> sv-96 vertex sv-128)) + ) + (when (and (< (fabs (- (-> arg0 x) (+ -2048.0 (-> sv-112 x)))) 8.0) + (< (fabs (- (-> arg0 y) (+ -2048.0 (-> sv-112 y)))) 8.0) + ) + (vector+! arg1 (the-as vector (-> s1-1 bounds)) (-> sv-96 vertex sv-128)) + (return #t) + ) + ) + (+! sv-128 1) ) - (set! sv-128 (+ sv-128 1)) ) ) ) @@ -2361,7 +2362,7 @@ ;; WARN: Return type mismatch int vs object. (defmethod nav-mesh-editable-method-17 ((this nav-mesh-editable)) ;; og:preserve-this added v1-13 and v1-17 - (local-vars (sv-16 symbol) (sv-32 int) (sv-48 vector) (v1-13 symbol) (v1-17 symbol)) + (local-vars (v1-13 symbol) (v1-17 symbol)) (let ((s5-0 0)) (let ((s4-0 0)) (b! #t cfg-33 :delay (nop!)) @@ -2374,37 +2375,40 @@ ) (b! #t cfg-28 :delay (nop!)) (label cfg-2) - (set! sv-16 (the-as symbol #f)) - (set! sv-48 (-> this verts data (-> s3-0 index data s1-0))) - (b! (not #t) cfg-25 :delay (nop!)) - (let ((v1-10 (or (= s0-0 -1) - (< 204.8 (vector-vector-distance (-> *clean-vertex-array* (-> *clean-index-array* s0-0)) sv-48)) - ) - ) + (let ((sv-16 (the-as symbol #f)) + (sv-48 (-> this verts data (-> s3-0 index data s1-0))) ) - (b! (not v1-10) cfg-13 :likely-delay (set! v1-13 v1-10)) - ) - (let ((a0-10 (!= s1-0 (+ (-> s3-0 index length) -1)))) - (b! a0-10 cfg-13 :likely-delay (set! v1-17 a0-10)) - ) - (< 204.8 (vector-vector-distance (-> *clean-vertex-array* (-> *clean-index-array* 0)) sv-48)) - (label cfg-13) - (set! sv-32 0) - (while (< sv-32 s5-0) - (when (and (not sv-16) (< (vector-vector-distance (-> *clean-vertex-array* sv-32) sv-48) 204.8)) - (set! sv-16 #t) - (set! s0-0 sv-32) - (set! (-> *clean-index-array* s2-0) sv-32) - (+! s2-0 1) + (b! (not #t) cfg-25 :delay (nop!)) + (let ((v1-10 (or (= s0-0 -1) + (< 204.8 (vector-vector-distance (-> *clean-vertex-array* (-> *clean-index-array* s0-0)) sv-48)) + ) + ) + ) + (b! (not v1-10) cfg-13 :likely-delay (set! v1-13 v1-10)) + ) + (let ((a0-10 (!= s1-0 (+ (-> s3-0 index length) -1)))) + (b! a0-10 cfg-13 :likely-delay (set! v1-17 a0-10)) + ) + (< 204.8 (vector-vector-distance (-> *clean-vertex-array* (-> *clean-index-array* 0)) sv-48)) + (label cfg-13) + (let ((sv-32 0)) + (while (< sv-32 s5-0) + (when (and (not sv-16) (< (vector-vector-distance (-> *clean-vertex-array* sv-32) sv-48) 204.8)) + (set! sv-16 #t) + (set! s0-0 sv-32) + (set! (-> *clean-index-array* s2-0) sv-32) + (+! s2-0 1) + ) + (+! sv-32 1) + ) + ) + (when (not sv-16) + (vector-copy! (-> *clean-vertex-array* s5-0) sv-48) + (set! s0-0 s5-0) + (set! (-> *clean-index-array* s2-0) s5-0) + (+! s2-0 1) + (+! s5-0 1) ) - (set! sv-32 (+ sv-32 1)) - ) - (when (not sv-16) - (vector-copy! (-> *clean-vertex-array* s5-0) sv-48) - (set! s0-0 s5-0) - (set! (-> *clean-index-array* s2-0) s5-0) - (+! s2-0 1) - (+! s5-0 1) ) (b! #t cfg-27 :delay (nop!)) (label cfg-25) @@ -3087,16 +3091,9 @@ (defun segments-intersect ((arg0 vector) (arg1 vector) (arg2 vector) (arg3 vector)) (let* ((v1-1 (vector-! (new 'stack-no-clear 'vector) arg2 arg0)) (f0-2 (- (* (-> arg1 x) (-> arg3 z)) (* (-> arg1 z) (-> arg3 x)))) - (f1-3 f0-2) - (f1-5 (* f1-3 f1-3)) - (f2-1 (-> arg1 x)) - (f2-3 (* f2-1 f2-1)) - (f3-0 (-> arg1 z)) - (f2-4 (+ f2-3 (* f3-0 f3-0))) - (f3-3 (-> arg3 x)) - (f3-5 (* f3-3 f3-3)) - (f4-0 (-> arg3 z)) - (f3-6 (+ f3-5 (* f4-0 f4-0))) + (f1-5 (square f0-2)) + (f2-4 (+ (square (-> arg1 x)) (square (-> arg1 z)))) + (f3-6 (+ (square (-> arg3 x)) (square (-> arg3 z)))) ) (when (< (* (/ f3-6 10000) f2-4) f1-5) (let ((f1-9 (/ (- (* (-> v1-1 x) (-> arg3 z)) (* (-> v1-1 z) (-> arg3 x))) f0-2))) @@ -3692,26 +3689,6 @@ ;; WARN: Function (method 10 nav-mesh-poly) has a return type of none, but the expression builder found a return statement. (defmethod nav-mesh-poly-method-10 ((this nav-mesh-poly) (arg0 nav-mesh-editable)) - (local-vars - (sv-288 int) - (sv-304 int) - (sv-320 int) - (sv-336 int) - (sv-352 int) - (sv-368 vector) - (sv-384 vector) - (sv-400 vector) - (sv-416 int) - (sv-432 int) - (sv-448 int) - (sv-464 int) - (sv-480 int) - (sv-496 int) - (sv-512 vector) - (sv-528 vector) - (sv-544 vector) - (sv-560 vector) - ) (rlet ((vf0 :class vf) (vf4 :class vf) (vf5 :class vf) @@ -3729,226 +3706,240 @@ (set! (-> s4-0 v1-2 index) (the-as uint (-> this index data v1-2))) ) (while (< 3 s1-0) - (set! sv-288 0) - (set! sv-304 1) - (set! sv-320 2) - (let ((s0-0 0)) - (set! sv-336 -1) - -1 - (let ((f30-0 0.0)) - (set! sv-352 0) - (while (< sv-352 s1-0) - (set! (-> s4-0 sv-304 ear?) #f) - (when (is-diagonal s1-0 s4-0 s3-0 sv-288 sv-304 sv-320) - 1.0 - (new 'stack-no-clear 'vector) - (set! sv-400 (new 'stack-no-clear 'vector)) - (let ((v1-25 (-> s3-0 data (-> s4-0 sv-288 index))) - (a0-11 (-> s3-0 data (-> s4-0 sv-304 index))) - ) - (.lvf vf4 (&-> v1-25 quad)) - (.lvf vf5 (&-> a0-11 quad)) - ) - (.mov.vf.w vf6 vf0) - (.sub.vf.xyz vf6 vf4 vf5) - (.svf (&-> sv-400 quad) vf6) - (set! sv-368 (new 'stack-no-clear 'vector)) - (let ((v1-34 (-> s3-0 data (-> s4-0 sv-304 index))) - (a0-18 (-> s3-0 data (-> s4-0 sv-320 index))) - ) - (.lvf vf4 (&-> v1-34 quad)) - (.lvf vf5 (&-> a0-18 quad)) - ) - (.mov.vf.w vf6 vf0) - (.sub.vf.xyz vf6 vf4 vf5) - (.svf (&-> sv-368 quad) vf6) - (set! sv-384 (new 'stack-no-clear 'vector)) - (let ((v1-43 (-> s3-0 data (-> s4-0 sv-320 index))) - (a0-25 (-> s3-0 data (-> s4-0 sv-288 index))) - ) - (.lvf vf4 (&-> v1-43 quad)) - (.lvf vf5 (&-> a0-25 quad)) - ) - (.mov.vf.w vf6 vf0) - (.sub.vf.xyz vf6 vf4 vf5) - (.svf (&-> sv-384 quad) vf6) - 0.0 - 0.0 - (let* ((f28-0 (vector-vector-angle-safe sv-400 sv-368)) - (t9-2 vector-vector-angle-safe) - (a1-6 sv-384) - (f0-5 (* f28-0 (t9-2 sv-368 a1-6) (vector-vector-angle-safe sv-384 sv-400))) - ) - (set! (-> s4-0 sv-304 ear?) #t) - (when (or (= sv-336 -1) (< f30-0 f0-5)) - (set! sv-336 sv-304) - (set! f30-0 f0-5) - ) - ) - ) - (set! sv-288 (mod (+ sv-288 1) s1-0)) - (set! sv-304 (mod (+ sv-304 1) s1-0)) - (set! sv-320 (mod (+ sv-320 1) s1-0)) - (set! sv-352 (+ sv-352 1)) + (let ((sv-288 0) + (sv-304 1) + (sv-320 2) + (s0-0 0) ) - ) - (set! sv-416 0) - (set! sv-432 1) - (set! sv-448 2) - (set! sv-464 -1) - (let ((f30-1 0.0)) - (set! sv-480 3) - (set! sv-496 0) - (while (< sv-496 s1-0) - (when (and (-> s4-0 sv-432 ear?) - (-> s4-0 sv-448 ear?) - (is-diagonal s1-0 s4-0 s3-0 sv-480 sv-416 sv-432) - (is-diagonal s1-0 s4-0 s3-0 sv-448 sv-480 sv-416) - ) - 1.0 - (set! sv-560 (new 'stack-no-clear 'vector)) - (let ((v1-90 (-> s3-0 data (-> s4-0 sv-416 index))) - (a0-41 (-> s3-0 data (-> s4-0 sv-432 index))) - ) - (.lvf vf4 (&-> v1-90 quad)) - (.lvf vf5 (&-> a0-41 quad)) - ) - (.mov.vf.w vf6 vf0) - (.sub.vf.xyz vf6 vf4 vf5) - (.svf (&-> sv-560 quad) vf6) - (set! sv-512 (new 'stack-no-clear 'vector)) - (let ((v1-99 (-> s3-0 data (-> s4-0 sv-432 index))) - (a0-48 (-> s3-0 data (-> s4-0 sv-448 index))) - ) - (.lvf vf4 (&-> v1-99 quad)) - (.lvf vf5 (&-> a0-48 quad)) - ) - (.mov.vf.w vf6 vf0) - (.sub.vf.xyz vf6 vf4 vf5) - (.svf (&-> sv-512 quad) vf6) - (set! sv-528 (new 'stack-no-clear 'vector)) - (let ((v1-108 (-> s3-0 data (-> s4-0 sv-448 index))) - (a0-55 (-> s3-0 data (-> s4-0 sv-480 index))) - ) - (.lvf vf4 (&-> v1-108 quad)) - (.lvf vf5 (&-> a0-55 quad)) - ) - (.mov.vf.w vf6 vf0) - (.sub.vf.xyz vf6 vf4 vf5) - (.svf (&-> sv-528 quad) vf6) - (set! sv-544 (new 'stack-no-clear 'vector)) - (let ((v1-117 (-> s3-0 data (-> s4-0 sv-480 index))) - (a0-62 (-> s3-0 data (-> s4-0 sv-416 index))) - ) - (.lvf vf4 (&-> v1-117 quad)) - (.lvf vf5 (&-> a0-62 quad)) - ) - (.mov.vf.w vf6 vf0) - (.sub.vf.xyz vf6 vf4 vf5) - (.svf (&-> sv-544 quad) vf6) - 0.0 - 0.0 - (let* ((f28-2 (vector-vector-angle-safe sv-560 sv-512)) - (t9-7 vector-vector-angle-safe) - (a1-11 sv-528) - (f28-3 (* f28-2 (t9-7 sv-512 a1-11))) - (t9-8 vector-vector-angle-safe) - (a1-12 sv-544) - (f0-12 (* f28-3 (t9-8 sv-528 a1-12) (vector-vector-angle-safe sv-544 sv-560))) - ) - (when (or (= sv-464 -1) (< f30-1 f0-12)) - (set! sv-336 sv-432) - (set! sv-464 sv-448) - (set! f30-1 f0-12) - ) - ) - ) - (set! sv-416 (mod (+ sv-416 1) s1-0)) - (set! sv-432 (mod (+ sv-432 1) s1-0)) - (set! sv-448 (mod (+ sv-448 1) s1-0)) - (set! sv-480 (mod (+ sv-480 1) s1-0)) - (set! sv-496 (+ sv-496 1)) - ) - ) - (when (= sv-336 -1) - (format *stdcon* "cannot find any ear~%") - (return #f) - ) - (let ((a0-70 0) - (a1-15 1) - (a2-3 2) - (a3-3 3) - ) - (dotimes (v1-146 s1-0) - (cond - ((= a1-15 sv-336) - (cond - ((!= sv-464 -1) - (let ((t0-9 (-> arg0 quads data (-> arg0 quads length))) - (t1-6 (vector-cross! - (new 'stack-no-clear 'vector) - (vector-! - (new 'stack-no-clear 'vector) - (-> s3-0 data (-> s4-0 a0-70 index)) - (-> s3-0 data (-> s4-0 a1-15 index)) - ) - (vector-! - (new 'stack-no-clear 'vector) - (-> s3-0 data (-> s4-0 a2-3 index)) - (-> s3-0 data (-> s4-0 a1-15 index)) - ) - ) - ) + (let ((sv-336 -1)) + -1 + (let ((f30-0 0.0)) + (let ((sv-352 0)) + (while (< sv-352 s1-0) + (set! (-> s4-0 sv-304 ear?) #f) + (when (is-diagonal s1-0 s4-0 s3-0 sv-288 sv-304 sv-320) + 1.0 + (new 'stack-no-clear 'vector) + (let ((sv-400 (new 'stack-no-clear 'vector))) + (let ((v1-25 (-> s3-0 data (-> s4-0 sv-288 index))) + (a0-11 (-> s3-0 data (-> s4-0 sv-304 index))) + ) + (.lvf vf4 (&-> v1-25 quad)) + (.lvf vf5 (&-> a0-11 quad)) + ) + (.mov.vf.w vf6 vf0) + (.sub.vf.xyz vf6 vf4 vf5) + (.svf (&-> sv-400 quad) vf6) + (let ((sv-368 (new 'stack-no-clear 'vector))) + (let ((v1-34 (-> s3-0 data (-> s4-0 sv-304 index))) + (a0-18 (-> s3-0 data (-> s4-0 sv-320 index))) + ) + (.lvf vf4 (&-> v1-34 quad)) + (.lvf vf5 (&-> a0-18 quad)) + ) + (.mov.vf.w vf6 vf0) + (.sub.vf.xyz vf6 vf4 vf5) + (.svf (&-> sv-368 quad) vf6) + (let ((sv-384 (new 'stack-no-clear 'vector))) + (let ((v1-43 (-> s3-0 data (-> s4-0 sv-320 index))) + (a0-25 (-> s3-0 data (-> s4-0 sv-288 index))) + ) + (.lvf vf4 (&-> v1-43 quad)) + (.lvf vf5 (&-> a0-25 quad)) + ) + (.mov.vf.w vf6 vf0) + (.sub.vf.xyz vf6 vf4 vf5) + (.svf (&-> sv-384 quad) vf6) + 0.0 + 0.0 + (let ((f0-5 (* (vector-vector-angle-safe sv-400 sv-368) + (vector-vector-angle-safe sv-368 sv-384) + (vector-vector-angle-safe sv-384 sv-400) + ) + ) + ) + (set! (-> s4-0 sv-304 ear?) #t) + (when (or (= sv-336 -1) (< f30-0 f0-5)) + (set! sv-336 sv-304) + (set! f30-0 f0-5) + ) + ) ) - (when (< 0.01 (vector-length t1-6)) - (set! (-> t0-9 indices 0) (-> s4-0 a0-70 index)) - (set! (-> t0-9 indices 1) (-> s4-0 a1-15 index)) - (set! (-> t0-9 indices 2) (-> s4-0 a2-3 index)) - (set! (-> t0-9 indices 3) (-> s4-0 a3-3 index)) - (set! (-> t0-9 poly) (-> this poly-id)) - (+! (-> arg0 quads length) 1) ) ) ) - (else - (let ((t0-17 (-> arg0 tris data (-> arg0 tris length))) - (t1-25 (vector-cross! - (new 'stack-no-clear 'vector) - (vector-! + (set! sv-288 (mod (+ sv-288 1) s1-0)) + (set! sv-304 (mod (+ sv-304 1) s1-0)) + (set! sv-320 (mod (+ sv-320 1) s1-0)) + (+! sv-352 1) + ) + ) + ) + (let ((sv-416 0) + (sv-432 1) + (sv-448 2) + (sv-464 -1) + ) + (let ((f30-1 0.0)) + (let ((sv-480 3) + (sv-496 0) + ) + (while (< sv-496 s1-0) + (when (and (-> s4-0 sv-432 ear?) + (-> s4-0 sv-448 ear?) + (is-diagonal s1-0 s4-0 s3-0 sv-480 sv-416 sv-432) + (is-diagonal s1-0 s4-0 s3-0 sv-448 sv-480 sv-416) + ) + 1.0 + (let ((sv-560 (new 'stack-no-clear 'vector))) + (let ((v1-90 (-> s3-0 data (-> s4-0 sv-416 index))) + (a0-41 (-> s3-0 data (-> s4-0 sv-432 index))) + ) + (.lvf vf4 (&-> v1-90 quad)) + (.lvf vf5 (&-> a0-41 quad)) + ) + (.mov.vf.w vf6 vf0) + (.sub.vf.xyz vf6 vf4 vf5) + (.svf (&-> sv-560 quad) vf6) + (let ((sv-512 (new 'stack-no-clear 'vector))) + (let ((v1-99 (-> s3-0 data (-> s4-0 sv-432 index))) + (a0-48 (-> s3-0 data (-> s4-0 sv-448 index))) + ) + (.lvf vf4 (&-> v1-99 quad)) + (.lvf vf5 (&-> a0-48 quad)) + ) + (.mov.vf.w vf6 vf0) + (.sub.vf.xyz vf6 vf4 vf5) + (.svf (&-> sv-512 quad) vf6) + (let ((sv-528 (new 'stack-no-clear 'vector))) + (let ((v1-108 (-> s3-0 data (-> s4-0 sv-448 index))) + (a0-55 (-> s3-0 data (-> s4-0 sv-480 index))) + ) + (.lvf vf4 (&-> v1-108 quad)) + (.lvf vf5 (&-> a0-55 quad)) + ) + (.mov.vf.w vf6 vf0) + (.sub.vf.xyz vf6 vf4 vf5) + (.svf (&-> sv-528 quad) vf6) + (let ((sv-544 (new 'stack-no-clear 'vector))) + (let ((v1-117 (-> s3-0 data (-> s4-0 sv-480 index))) + (a0-62 (-> s3-0 data (-> s4-0 sv-416 index))) + ) + (.lvf vf4 (&-> v1-117 quad)) + (.lvf vf5 (&-> a0-62 quad)) + ) + (.mov.vf.w vf6 vf0) + (.sub.vf.xyz vf6 vf4 vf5) + (.svf (&-> sv-544 quad) vf6) + 0.0 + 0.0 + (let ((f0-12 (* (vector-vector-angle-safe sv-560 sv-512) + (vector-vector-angle-safe sv-512 sv-528) + (vector-vector-angle-safe sv-528 sv-544) + (vector-vector-angle-safe sv-544 sv-560) + ) + ) + ) + (when (or (= sv-464 -1) (< f30-1 f0-12)) + (set! sv-336 sv-432) + (set! sv-464 sv-448) + (set! f30-1 f0-12) + ) + ) + ) + ) + ) + ) + ) + (set! sv-416 (mod (+ sv-416 1) s1-0)) + (set! sv-432 (mod (+ sv-432 1) s1-0)) + (set! sv-448 (mod (+ sv-448 1) s1-0)) + (set! sv-480 (mod (+ sv-480 1) s1-0)) + (+! sv-496 1) + ) + ) + ) + (when (= sv-336 -1) + (format *stdcon* "cannot find any ear~%") + (return #f) + ) + (let ((a0-70 0) + (a1-15 1) + (a2-3 2) + (a3-3 3) + ) + (dotimes (v1-146 s1-0) + (cond + ((= a1-15 sv-336) + (cond + ((!= sv-464 -1) + (let ((t0-9 (-> arg0 quads data (-> arg0 quads length))) + (t1-6 (vector-cross! (new 'stack-no-clear 'vector) - (-> s3-0 data (-> s4-0 a0-70 index)) - (-> s3-0 data (-> s4-0 a1-15 index)) - ) - (vector-! - (new 'stack-no-clear 'vector) - (-> s3-0 data (-> s4-0 a2-3 index)) - (-> s3-0 data (-> s4-0 a1-15 index)) + (vector-! + (new 'stack-no-clear 'vector) + (-> s3-0 data (-> s4-0 a0-70 index)) + (-> s3-0 data (-> s4-0 a1-15 index)) + ) + (vector-! + (new 'stack-no-clear 'vector) + (-> s3-0 data (-> s4-0 a2-3 index)) + (-> s3-0 data (-> s4-0 a1-15 index)) + ) ) ) - ) + ) + (when (< 0.01 (vector-length t1-6)) + (set! (-> t0-9 indices 0) (-> s4-0 a0-70 index)) + (set! (-> t0-9 indices 1) (-> s4-0 a1-15 index)) + (set! (-> t0-9 indices 2) (-> s4-0 a2-3 index)) + (set! (-> t0-9 indices 3) (-> s4-0 a3-3 index)) + (set! (-> t0-9 poly) (-> this poly-id)) + (+! (-> arg0 quads length) 1) + ) + ) + ) + (else + (let ((t0-17 (-> arg0 tris data (-> arg0 tris length))) + (t1-25 (vector-cross! + (new 'stack-no-clear 'vector) + (vector-! + (new 'stack-no-clear 'vector) + (-> s3-0 data (-> s4-0 a0-70 index)) + (-> s3-0 data (-> s4-0 a1-15 index)) + ) + (vector-! + (new 'stack-no-clear 'vector) + (-> s3-0 data (-> s4-0 a2-3 index)) + (-> s3-0 data (-> s4-0 a1-15 index)) + ) + ) + ) + ) + (when (< 0.01 (vector-length t1-25)) + (set! (-> t0-17 indices 0) (-> s4-0 a0-70 index)) + (set! (-> t0-17 indices 1) (-> s4-0 a1-15 index)) + (set! (-> t0-17 indices 2) (-> s4-0 a2-3 index)) + (set! (-> t0-17 poly) (-> this poly-id)) + (+! (-> arg0 tris length) 1) + ) ) - (when (< 0.01 (vector-length t1-25)) - (set! (-> t0-17 indices 0) (-> s4-0 a0-70 index)) - (set! (-> t0-17 indices 1) (-> s4-0 a1-15 index)) - (set! (-> t0-17 indices 2) (-> s4-0 a2-3 index)) - (set! (-> t0-17 poly) (-> this poly-id)) - (+! (-> arg0 tris length) 1) ) ) ) - ) - ) - ((= a1-15 sv-464) - ) - (else - (set! (-> s2-0 s0-0 index) (-> s4-0 a1-15 index)) - (+! s0-0 1) + ((= a1-15 sv-464) + ) + (else + (set! (-> s2-0 s0-0 index) (-> s4-0 a1-15 index)) + (+! s0-0 1) + ) + ) + (set! a0-70 (mod (+ a0-70 1) s1-0)) + (set! a1-15 (mod (+ a1-15 1) s1-0)) + (set! a2-3 (mod (+ a2-3 1) s1-0)) + (set! a3-3 (mod (+ a3-3 1) s1-0)) ) ) - (set! a0-70 (mod (+ a0-70 1) s1-0)) - (set! a1-15 (mod (+ a1-15 1) s1-0)) - (set! a2-3 (mod (+ a2-3 1) s1-0)) - (set! a3-3 (mod (+ a3-3 1) s1-0)) ) ) (set! s1-0 s0-0) diff --git a/goal_src/jak3/engine/debug/nav/mysql-nav-graph.gc b/goal_src/jak3/engine/debug/nav/mysql-nav-graph.gc index 1e84935919..8ca3358364 100644 --- a/goal_src/jak3/engine/debug/nav/mysql-nav-graph.gc +++ b/goal_src/jak3/engine/debug/nav/mysql-nav-graph.gc @@ -787,7 +787,6 @@ ;; WARN: new jak 2 until loop case, check carefully ;; WARN: new jak 2 until loop case, check carefully (defmethod init-from-sql! ((this mysql-nav-graph) (arg0 symbol) (arg1 string)) - (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) @@ -843,41 +842,42 @@ (set! (-> s0-1 angle) (* 182.04445 (string->float (the-as string (-> s2-1 sql-data (+ s1-0 5)))))) (set! (-> s0-1 radius) (* 4096.0 (string->float (the-as string (-> s2-1 sql-data (+ s1-0 6)))))) (set! (-> s0-1 nav_node_flag) (nav-node-flag)) - (set! sv-16 (new 'global 'string 0 (the-as string (-> s2-1 sql-data (+ s1-0 7))))) - (copy-string<-string sv-16 (the-as string (-> s2-1 sql-data (+ s1-0 7)))) - (until #f - (cond - ((string-prefix= "blocker" sv-16) - (logior! (-> s0-1 nav_node_flag) (nav-node-flag blocker)) - ) - ((string-prefix= "pov" sv-16) - (logior! (-> s0-1 nav_node_flag) (nav-node-flag pov)) - ) - ((string-prefix= "visited" sv-16) - (logior! (-> s0-1 nav_node_flag) (nav-node-flag visited)) - ) - ((string-prefix= "blocked" sv-16) - (logior! (-> s0-1 nav_node_flag) (nav-node-flag blocked)) - ) - ((string-prefix= "pedestrian" sv-16) - (logior! (-> s0-1 nav_node_flag) (nav-node-flag pedestrian)) - ) - ((string-prefix= "selected" sv-16) - (logior! (-> s0-1 nav_node_flag) (nav-node-flag selected)) - ) - ((string-prefix= "hidden" sv-16) - (logior! (-> s0-1 nav_node_flag) (nav-node-flag hidden)) - ) - (else - #t - (goto cfg-33) - ) - ) - (let ((a1-22 (string-skip-to-char (-> sv-16 data) (the-as uint 44)))) - (if (= (-> a1-22 0) 44) - (set! a1-22 (&-> a1-22 1)) + (let ((sv-16 (new 'global 'string 0 (the-as string (-> s2-1 sql-data (+ s1-0 7)))))) + (copy-string<-string sv-16 (the-as string (-> s2-1 sql-data (+ s1-0 7)))) + (until #f + (cond + ((string-prefix= "blocker" sv-16) + (logior! (-> s0-1 nav_node_flag) (nav-node-flag blocker)) + ) + ((string-prefix= "pov" sv-16) + (logior! (-> s0-1 nav_node_flag) (nav-node-flag pov)) + ) + ((string-prefix= "visited" sv-16) + (logior! (-> s0-1 nav_node_flag) (nav-node-flag visited)) + ) + ((string-prefix= "blocked" sv-16) + (logior! (-> s0-1 nav_node_flag) (nav-node-flag blocked)) + ) + ((string-prefix= "pedestrian" sv-16) + (logior! (-> s0-1 nav_node_flag) (nav-node-flag pedestrian)) + ) + ((string-prefix= "selected" sv-16) + (logior! (-> s0-1 nav_node_flag) (nav-node-flag selected)) + ) + ((string-prefix= "hidden" sv-16) + (logior! (-> s0-1 nav_node_flag) (nav-node-flag hidden)) + ) + (else + #t + (goto cfg-33) ) - (string-suck-up! sv-16 a1-22) + ) + (let ((a1-22 (string-skip-to-char (-> sv-16 data) (the-as uint 44)))) + (if (= (-> a1-22 0) 44) + (set! a1-22 (&-> a1-22 1)) + ) + (string-suck-up! sv-16 a1-22) + ) ) ) #f @@ -921,149 +921,149 @@ (let ((s2-2 0)) (while (< s2-2 (-> s3-3 length)) (when (= (string->int (the-as string (-> s3-3 sql-data (+ s2-2 12)))) (-> this nav_graph_id)) - (let ((s0-2 (string->int (the-as string (-> s3-3 sql-data (+ s2-2 1)))))) - (set! sv-32 (string->int (the-as string (-> s3-3 sql-data (+ s2-2 2))))) - (set! sv-48 (indexof-nav-node this s0-2)) - (set! sv-64 (indexof-nav-node this sv-32)) - (let ((s1-2 (-> this edge-array data (-> this edge-array length)))) - (when (and (!= sv-48 -1) (!= sv-64 -1)) - (set! (-> s1-2 nav_graph_id) (-> this nav_graph_id)) - (set! (-> s1-2 nav_edge_id) (the-as uint (string->int (the-as string (-> s3-3 sql-data s2-2))))) - (set! (-> s1-2 nav_node_id_1) (the-as uint s0-2)) - (set! (-> s1-2 nav_node_id_2) (the-as uint sv-32)) - (set! (-> s1-2 mysql-save-flag) (mysql-save-flag)) - (set! (-> s1-2 runtime-id) (the-as uint (-> this edge-array length))) - (set! (-> s1-2 runtime-node-id-1) sv-48) - (set! (-> s1-2 runtime-node-id-2) sv-64) - (let ((s0-3 (-> s3-3 sql-data (+ s2-2 3)))) - (cond - ((string= "default" (the-as string s0-3)) - (set! (-> s1-2 directionality) (nav-directionality default)) - 0 - ) - ((string= "directed" (the-as string s0-3)) - (set! (-> s1-2 directionality) (nav-directionality directed)) - ) - ((string= "bi_directional" (the-as string s0-3)) - (set! (-> s1-2 directionality) (nav-directionality bi_directional)) - ) - ) + (let* ((s0-2 (string->int (the-as string (-> s3-3 sql-data (+ s2-2 1))))) + (sv-32 (string->int (the-as string (-> s3-3 sql-data (+ s2-2 2))))) + (sv-48 (indexof-nav-node this s0-2)) + (sv-64 (indexof-nav-node this sv-32)) + (s1-2 (-> this edge-array data (-> this edge-array length))) + ) + (when (and (!= sv-48 -1) (!= sv-64 -1)) + (set! (-> s1-2 nav_graph_id) (-> this nav_graph_id)) + (set! (-> s1-2 nav_edge_id) (the-as uint (string->int (the-as string (-> s3-3 sql-data s2-2))))) + (set! (-> s1-2 nav_node_id_1) (the-as uint s0-2)) + (set! (-> s1-2 nav_node_id_2) (the-as uint sv-32)) + (set! (-> s1-2 mysql-save-flag) (mysql-save-flag)) + (set! (-> s1-2 runtime-id) (the-as uint (-> this edge-array length))) + (set! (-> s1-2 runtime-node-id-1) sv-48) + (set! (-> s1-2 runtime-node-id-2) sv-64) + (let ((s0-3 (-> s3-3 sql-data (+ s2-2 3)))) + (cond + ((string= "default" (the-as string s0-3)) + (set! (-> s1-2 directionality) (nav-directionality default)) + 0 + ) + ((string= "directed" (the-as string s0-3)) + (set! (-> s1-2 directionality) (nav-directionality directed)) + ) + ((string= "bi_directional" (the-as string s0-3)) + (set! (-> s1-2 directionality) (nav-directionality bi_directional)) + ) ) - (set! (-> s1-2 speed_limit) (* 4096.0 (string->float (the-as string (-> s3-3 sql-data (+ s2-2 4)))))) - (set! (-> s1-2 density) (string->float (the-as string (-> s3-3 sql-data (+ s2-2 5))))) - (set! (-> s1-2 traffic_edge_flag) 0) - (let ((s0-4 (new 'global 'string 0 (the-as string (-> s3-3 sql-data (+ s2-2 6)))))) - (copy-string<-string s0-4 (the-as string (-> s3-3 sql-data (+ s2-2 6)))) - (until #f - (cond - ((string-prefix= "pedestrian" s0-4) - (logior! (-> s1-2 traffic_edge_flag) 1) - ) - (else - #t - (goto cfg-64) - ) - ) - (let ((a1-38 (string-skip-to-char (-> s0-4 data) (the-as uint 44)))) - (if (= (-> a1-38 0) 44) - (set! a1-38 (&-> a1-38 1)) - ) - (string-suck-up! s0-4 a1-38) - ) - ) - ) - #f - (label cfg-64) - (set! (-> s1-2 nav_clock_mask) (nav-clock-mask)) - (let ((s0-5 (new 'global 'string 0 (the-as string (-> s3-3 sql-data (+ s2-2 7)))))) - (copy-string<-string s0-5 (the-as string (-> s3-3 sql-data (+ s2-2 7)))) - (until #f - (cond - ((string-prefix= "phase-1a" s0-5) - (logior! (-> s1-2 nav_clock_mask) (nav-clock-mask phase-1a)) - ) - ((string-prefix= "phase-1" s0-5) - (logior! (-> s1-2 nav_clock_mask) (nav-clock-mask phase-1)) - ) - ((string-prefix= "phase-2a" s0-5) - (logior! (-> s1-2 nav_clock_mask) (nav-clock-mask phase-2a)) - ) - ((string-prefix= "phase-2" s0-5) - (logior! (-> s1-2 nav_clock_mask) (nav-clock-mask phase-2)) - ) - ((string-prefix= "phase-3a" s0-5) - (logior! (-> s1-2 nav_clock_mask) (nav-clock-mask phase-3a)) - ) - ((string-prefix= "phase-3" s0-5) - (logior! (-> s1-2 nav_clock_mask) (nav-clock-mask phase-3)) - ) - ((string-prefix= "phase-4a" s0-5) - (logior! (-> s1-2 nav_clock_mask) (nav-clock-mask phase-4a)) - ) - ((string-prefix= "phase-4" s0-5) - (logior! (-> s1-2 nav_clock_mask) (nav-clock-mask phase-4)) - ) - (else - #t - (goto cfg-86) - ) - ) - (let ((a1-50 (string-skip-to-char (-> s0-5 data) (the-as uint 44)))) - (if (= (-> a1-50 0) 44) - (set! a1-50 (&-> a1-50 1)) - ) - (string-suck-up! s0-5 a1-50) - ) - ) - ) - #f - (label cfg-86) - (set! (-> s1-2 nav_territory_type) (the-as uint (string->int (the-as string (-> s3-3 sql-data (+ s2-2 8)))))) - (set! (-> s1-2 exclusive_data) (the-as uint (string->int (the-as string (-> s3-3 sql-data (+ s2-2 9)))))) - (set! (-> s1-2 width) (* 4096.0 (string->float (the-as string (-> s3-3 sql-data (+ s2-2 10)))))) - (set! (-> s1-2 minimap_edge_flag) (nav-minimap-edge-flag)) - (let ((s0-6 (new 'global 'string 0 (the-as string (-> s3-3 sql-data (+ s2-2 11)))))) - (copy-string<-string s0-6 (the-as string (-> s3-3 sql-data (+ s2-2 11)))) - (until #f - (cond - ((string-prefix= "blocker" s0-6) - (logior! (-> s1-2 minimap_edge_flag) (nav-minimap-edge-flag blocker)) - ) - ((string-prefix= "one-way" s0-6) - (logior! (-> s1-2 minimap_edge_flag) (nav-minimap-edge-flag one-way)) - ) - ((string-prefix= "pass-port-mh" s0-6) - (logior! (-> s1-2 minimap_edge_flag) (nav-minimap-edge-flag pass-port-mh)) - ) - ((string-prefix= "pass-port-inda" s0-6) - (logior! (-> s1-2 minimap_edge_flag) (nav-minimap-edge-flag pass-port-inda)) - ) - ((string-prefix= "pass-inda-indb" s0-6) - (logior! (-> s1-2 minimap_edge_flag) (nav-minimap-edge-flag pass-inda-indb)) - ) - ((string-prefix= "pass-indb-sluma" s0-6) - (logior! (-> s1-2 minimap_edge_flag) (nav-minimap-edge-flag pass-indb-sluma)) - ) - ((string-prefix= "pass-slumb-genb" s0-6) - (logior! (-> s1-2 minimap_edge_flag) (nav-minimap-edge-flag pass-slumb-genb)) - ) - (else - #t - (goto cfg-106) - ) - ) - (let ((a1-61 (string-skip-to-char (-> s0-6 data) (the-as uint 44)))) - (if (= (-> a1-61 0) 44) - (set! a1-61 (&-> a1-61 1)) - ) - (string-suck-up! s0-6 a1-61) - ) - ) - ) - #f - (label cfg-106) - (+! (-> this edge-array length) 1) ) + (set! (-> s1-2 speed_limit) (* 4096.0 (string->float (the-as string (-> s3-3 sql-data (+ s2-2 4)))))) + (set! (-> s1-2 density) (string->float (the-as string (-> s3-3 sql-data (+ s2-2 5))))) + (set! (-> s1-2 traffic_edge_flag) 0) + (let ((s0-4 (new 'global 'string 0 (the-as string (-> s3-3 sql-data (+ s2-2 6)))))) + (copy-string<-string s0-4 (the-as string (-> s3-3 sql-data (+ s2-2 6)))) + (until #f + (cond + ((string-prefix= "pedestrian" s0-4) + (logior! (-> s1-2 traffic_edge_flag) 1) + ) + (else + #t + (goto cfg-64) + ) + ) + (let ((a1-38 (string-skip-to-char (-> s0-4 data) (the-as uint 44)))) + (if (= (-> a1-38 0) 44) + (set! a1-38 (&-> a1-38 1)) + ) + (string-suck-up! s0-4 a1-38) + ) + ) + ) + #f + (label cfg-64) + (set! (-> s1-2 nav_clock_mask) (nav-clock-mask)) + (let ((s0-5 (new 'global 'string 0 (the-as string (-> s3-3 sql-data (+ s2-2 7)))))) + (copy-string<-string s0-5 (the-as string (-> s3-3 sql-data (+ s2-2 7)))) + (until #f + (cond + ((string-prefix= "phase-1a" s0-5) + (logior! (-> s1-2 nav_clock_mask) (nav-clock-mask phase-1a)) + ) + ((string-prefix= "phase-1" s0-5) + (logior! (-> s1-2 nav_clock_mask) (nav-clock-mask phase-1)) + ) + ((string-prefix= "phase-2a" s0-5) + (logior! (-> s1-2 nav_clock_mask) (nav-clock-mask phase-2a)) + ) + ((string-prefix= "phase-2" s0-5) + (logior! (-> s1-2 nav_clock_mask) (nav-clock-mask phase-2)) + ) + ((string-prefix= "phase-3a" s0-5) + (logior! (-> s1-2 nav_clock_mask) (nav-clock-mask phase-3a)) + ) + ((string-prefix= "phase-3" s0-5) + (logior! (-> s1-2 nav_clock_mask) (nav-clock-mask phase-3)) + ) + ((string-prefix= "phase-4a" s0-5) + (logior! (-> s1-2 nav_clock_mask) (nav-clock-mask phase-4a)) + ) + ((string-prefix= "phase-4" s0-5) + (logior! (-> s1-2 nav_clock_mask) (nav-clock-mask phase-4)) + ) + (else + #t + (goto cfg-86) + ) + ) + (let ((a1-50 (string-skip-to-char (-> s0-5 data) (the-as uint 44)))) + (if (= (-> a1-50 0) 44) + (set! a1-50 (&-> a1-50 1)) + ) + (string-suck-up! s0-5 a1-50) + ) + ) + ) + #f + (label cfg-86) + (set! (-> s1-2 nav_territory_type) (the-as uint (string->int (the-as string (-> s3-3 sql-data (+ s2-2 8)))))) + (set! (-> s1-2 exclusive_data) (the-as uint (string->int (the-as string (-> s3-3 sql-data (+ s2-2 9)))))) + (set! (-> s1-2 width) (* 4096.0 (string->float (the-as string (-> s3-3 sql-data (+ s2-2 10)))))) + (set! (-> s1-2 minimap_edge_flag) (nav-minimap-edge-flag)) + (let ((s0-6 (new 'global 'string 0 (the-as string (-> s3-3 sql-data (+ s2-2 11)))))) + (copy-string<-string s0-6 (the-as string (-> s3-3 sql-data (+ s2-2 11)))) + (until #f + (cond + ((string-prefix= "blocker" s0-6) + (logior! (-> s1-2 minimap_edge_flag) (nav-minimap-edge-flag blocker)) + ) + ((string-prefix= "one-way" s0-6) + (logior! (-> s1-2 minimap_edge_flag) (nav-minimap-edge-flag one-way)) + ) + ((string-prefix= "pass-port-mh" s0-6) + (logior! (-> s1-2 minimap_edge_flag) (nav-minimap-edge-flag pass-port-mh)) + ) + ((string-prefix= "pass-port-inda" s0-6) + (logior! (-> s1-2 minimap_edge_flag) (nav-minimap-edge-flag pass-port-inda)) + ) + ((string-prefix= "pass-inda-indb" s0-6) + (logior! (-> s1-2 minimap_edge_flag) (nav-minimap-edge-flag pass-inda-indb)) + ) + ((string-prefix= "pass-indb-sluma" s0-6) + (logior! (-> s1-2 minimap_edge_flag) (nav-minimap-edge-flag pass-indb-sluma)) + ) + ((string-prefix= "pass-slumb-genb" s0-6) + (logior! (-> s1-2 minimap_edge_flag) (nav-minimap-edge-flag pass-slumb-genb)) + ) + (else + #t + (goto cfg-106) + ) + ) + (let ((a1-61 (string-skip-to-char (-> s0-6 data) (the-as uint 44)))) + (if (= (-> a1-61 0) 44) + (set! a1-61 (&-> a1-61 1)) + ) + (string-suck-up! s0-6 a1-61) + ) + ) + ) + #f + (label cfg-106) + (+! (-> this edge-array length) 1) ) ) ) diff --git a/goal_src/jak3/engine/debug/nav/nav-graph-editor.gc b/goal_src/jak3/engine/debug/nav/nav-graph-editor.gc index 9fcb17c0f1..c1deab7405 100644 --- a/goal_src/jak3/engine/debug/nav/nav-graph-editor.gc +++ b/goal_src/jak3/engine/debug/nav/nav-graph-editor.gc @@ -427,16 +427,6 @@ ) (defmethod nav-graph-editor-method-29 ((this nav-graph-editor)) - (local-vars - (sv-224 int) - (sv-240 (function _varargs_ object)) - (sv-256 mysql-nav-node) - (sv-272 vector) - (sv-288 vector) - (sv-304 symbol) - (sv-320 int) - (sv-336 (function _varargs_ object)) - ) (rlet ((vf0 :class vf) (vf4 :class vf) (vf5 :class vf) @@ -458,11 +448,7 @@ (set! (-> s1-0 w) (-> s2-0 radius)) ) (set! (-> s2-0 cam-dist) (vector-vector-distance-squared s3-0 (camera-pos))) - (let ((f0-2 (-> s2-0 cam-dist)) - (f1-0 (-> this clipping-dist)) - ) - (set! (-> s2-0 visible) (< f0-2 (* 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)))) ) @@ -513,48 +499,46 @@ (add-debug-x #t (bucket-id debug) s3-0 *color-red*) (let ((s1-2 add-debug-text-3d) (s0-1 #t) + (sv-224 583) ) - (set! sv-224 583) - (set! sv-240 format) - (let ((a0-18 (clear *temp-string*)) - (a1-6 "~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-29 (-> s2-0 level_name)) ) - (sv-240 a0-18 a1-6 a2-6) - ) - (let* ((a2-7 *temp-string*) - (a3-2 s3-0) - (v1-29 (-> s2-0 level_name)) - (t0-1 (cond - ((= v1-29 'ctyport) - 3 - ) - ((= v1-29 'ctyinda) - 4 - ) - ((= v1-29 'ctyindb) - 5 - ) - ((= v1-29 'ctypal) - 6 - ) - ((= v1-29 'ctysluma) - 7 - ) - ((= v1-29 'ctyslumb) - 8 - ) - ((= v1-29 'ctyslumc) - 9 - ) - (else - 1 - ) - ) - ) - (t1-0 #f) + (s1-2 + s0-1 + (the-as bucket-id sv-224) + a2-7 + a3-2 + (cond + ((= v1-29 'ctyport) + (font-color red) ) - (s1-2 s0-1 (the-as bucket-id sv-224) a2-7 a3-2 (the-as font-color t0-1) (the-as vector2h t1-0)) + ((= v1-29 'ctyinda) + (font-color orange) + ) + ((= v1-29 'ctyindb) + (font-color yellow) + ) + ((= v1-29 'ctypal) + (font-color green) + ) + ((= v1-29 'ctysluma) + (font-color blue) + ) + ((= v1-29 'ctyslumb) + (font-color cyan) + ) + ((= v1-29 'ctyslumc) + (font-color pink) + ) + (else + (font-color white) + ) + ) + (the-as vector2h #f) + ) ) ) (let ((s1-3 (new 'stack-no-clear 'vector))) @@ -575,10 +559,11 @@ (dotimes (s4-1 (-> s5-0 edge-array length)) (let ((s3-1 (-> s5-0 edge-array data s4-1))) (when (not (logtest? (-> s3-1 mysql-save-flag) (mysql-save-flag delete))) - (let ((s1-4 (-> s5-0 node-array data (-> s3-1 runtime-node-id-1)))) - (set! sv-256 (-> s5-0 node-array data (-> s3-1 runtime-node-id-2))) - (set! sv-272 (new 'stack-no-clear 'vector)) - (set! sv-288 (new 'stack-no-clear 'vector)) + (let ((s1-4 (-> s5-0 node-array data (-> s3-1 runtime-node-id-1))) + (sv-256 (-> s5-0 node-array data (-> s3-1 runtime-node-id-2))) + (sv-272 (new 'stack-no-clear 'vector)) + (sv-288 (new 'stack-no-clear 'vector)) + ) (new 'stack-no-clear 'vector) (let ((s2-1 (new 'stack-no-clear 'vector)) (s0-3 (new 'stack-no-clear 'vector)) @@ -591,10 +576,8 @@ (or (-> s1-4 visible) (-> sv-256 visible)) ) (vector-! sv-272 s0-3 s2-1) - (let* ((f0-11 (vector-length sv-272)) - (f1-5 (fmax (* 0.75 f0-11) (+ -8192.0 f0-11))) - ) - (vector-float*! sv-272 sv-272 (/ f1-5 f0-11)) + (let ((f0-11 (vector-length sv-272))) + (vector-float*! sv-272 sv-272 (/ (fmax (* 0.75 f0-11) (+ -8192.0 f0-11)) f0-11)) ) (let ((v1-64 sv-288)) (let ((a0-40 s2-1)) @@ -626,22 +609,18 @@ #f *color-white* ) - (let ((s1-5 add-debug-text-3d)) - (set! sv-304 #t) - (set! sv-320 577) - (set! sv-336 format) - (let ((a0-48 (clear *temp-string*)) - (a1-18 "~d") - (a2-12 (-> s3-1 nav_territory_type)) - ) - (sv-336 a0-48 a1-18 a2-12) - ) - (let ((a2-13 *temp-string*) - (a3-7 (vector-float*! (new 'stack-no-clear 'vector) (vector+! (new 'stack-no-clear 'vector) s2-1 s0-3) 0.5)) - (t0-5 3) - (t1-4 #f) - ) - (s1-5 sv-304 (the-as bucket-id sv-320) a2-13 a3-7 (the-as font-color t0-5) (the-as vector2h t1-4)) + (let ((s1-5 add-debug-text-3d) + (sv-304 #t) + (sv-320 577) + ) + (format (clear *temp-string*) "~d" (-> s3-1 nav_territory_type)) + (s1-5 + sv-304 + (the-as bucket-id sv-320) + *temp-string* + (vector-float*! (new 'stack-no-clear 'vector) (vector+! (new 'stack-no-clear 'vector) s2-1 s0-3) 0.5) + (font-color red) + (the-as vector2h #f) ) ) ) @@ -1056,7 +1035,6 @@ ) (defmethod nav-graph-editor-method-49 ((this nav-graph-editor)) - (local-vars (sv-80 mysql-nav-node) (sv-96 vector)) (set! (-> this closest-edge) -1) (set! (-> this dist-closest-edge) 0.0) (let ((s5-0 (-> this nav-graph))) @@ -1066,11 +1044,12 @@ (when (and (not (logtest? (-> s3-0 mysql-save-flag) (mysql-save-flag delete))) (not (logtest? (-> s3-0 minimap_edge_flag) (nav-minimap-edge-flag blocker))) ) - (let ((s2-0 (-> s5-0 node-array data (-> s3-0 runtime-node-id-1)))) - (set! sv-80 (-> s5-0 node-array data (-> s3-0 runtime-node-id-2))) + (let ((s2-0 (-> s5-0 node-array data (-> s3-0 runtime-node-id-1))) + (sv-80 (-> s5-0 node-array data (-> s3-0 runtime-node-id-2))) + ) (new 'stack-no-clear 'vector) - (set! sv-96 (new 'stack-no-clear 'vector)) - (let ((s0-0 (new 'stack-no-clear 'vector)) + (let ((sv-96 (new 'stack-no-clear 'vector)) + (s0-0 (new 'stack-no-clear 'vector)) (s1-0 (new 'stack-no-clear 'vector)) ) (get-node-draw-position s0-0 s2-0) @@ -1096,14 +1075,6 @@ ) (defmethod nav-graph-editor-method-47 ((this nav-graph-editor)) - (local-vars - (sv-160 mysql-nav-node) - (sv-176 mysql-nav-node) - (sv-192 vector) - (sv-208 vector) - (sv-224 vector) - (sv-240 vector) - ) (rlet ((vf0 :class vf) (vf4 :class vf) (vf5 :class vf) @@ -1114,62 +1085,59 @@ (dotimes (s4-0 (-> s5-0 edge-array length)) (let ((s1-0 (-> s5-0 edge-array data s4-0))) (when (not (logtest? (-> s1-0 mysql-save-flag) (mysql-save-flag delete))) - (set! sv-160 (-> s5-0 node-array data (-> s1-0 runtime-node-id-1))) - (set! sv-176 (-> s5-0 node-array data (-> s1-0 runtime-node-id-2))) - (let ((s2-0 (new 'stack-no-clear 'vector)) + (let ((sv-160 (-> s5-0 node-array data (-> s1-0 runtime-node-id-1))) + (sv-176 (-> s5-0 node-array data (-> s1-0 runtime-node-id-2))) + (s2-0 (new 'stack-no-clear 'vector)) (s3-0 (new 'stack-no-clear 'vector)) + (sv-192 (new 'stack-no-clear 'vector)) + (s0-0 (new 'stack-no-clear 'vector)) ) - (set! sv-192 (new 'stack-no-clear 'vector)) - (let ((s0-0 (new 'stack-no-clear 'vector))) - (get-node-draw-position sv-192 sv-160) - (get-node-draw-position s0-0 sv-176) - (when (and (>= (-> s1-0 runtime-node-id-1) 0) - (>= (-> s1-0 runtime-node-id-2) 0) - (or (-> sv-160 visible) (-> sv-176 visible)) - ) - (vector-! s2-0 s0-0 sv-192) - (let ((s1-1 (new 'stack-no-clear 'vector))) - (vector-copy! s1-1 sv-192) - (set! sv-208 (new 'stack-no-clear 'vector)) - (let ((v1-26 (-> s0-0 quad))) - (set! (-> sv-208 quad) v1-26) - ) + (get-node-draw-position sv-192 sv-160) + (get-node-draw-position s0-0 sv-176) + (when (and (>= (-> s1-0 runtime-node-id-1) 0) + (>= (-> s1-0 runtime-node-id-2) 0) + (or (-> sv-160 visible) (-> sv-176 visible)) + ) + (vector-! s2-0 s0-0 sv-192) + (let ((s1-1 (new 'stack-no-clear 'vector))) + (vector-copy! s1-1 sv-192) + (let ((sv-208 (new 'stack-no-clear 'vector))) + (vector-copy! sv-208 s0-0) (let ((v0-2 (vector-normalize-copy! (new 'stack-no-clear 'vector) s2-0 4915.2))) (vector+! s1-1 s1-1 v0-2) (vector-! sv-208 sv-208 v0-2) ) - (let ((a1-8 s2-0) - (v1-29 s1-1) - ) - (vector-! a1-8 sv-208 v1-29) - ) - (let ((f30-0 0.0) - (s0-1 ray-cylinder-intersect) - ) - (set! sv-224 (-> this mouse-pos)) - (set! sv-240 (new 'stack-no-clear 'vector)) - (let ((v1-32 (-> this mouse-hit-pick)) - (a0-17 (-> this mouse-pos)) - ) - (.lvf vf4 (&-> v1-32 quad)) - (.lvf vf5 (&-> a0-17 quad)) + (vector-! s2-0 sv-208 s1-1) + ) + (let ((f30-0 0.0) + (s0-1 ray-cylinder-intersect) + (sv-224 (-> this mouse-pos)) + (sv-240 (new 'stack-no-clear 'vector)) ) - (.mov.vf.w vf6 vf0) - (.sub.vf.xyz vf6 vf4 vf5) - (.svf (&-> sv-240 quad) vf6) - (let ((a3-0 (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-224 sv-240 s1-1 a3-0 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) - ) - ) + (let ((v1-32 (-> this mouse-hit-pick)) + (a0-17 (-> this mouse-pos)) + ) + (.lvf vf4 (&-> v1-32 quad)) + (.lvf vf5 (&-> a0-17 quad)) + ) + (.mov.vf.w vf6 vf0) + (.sub.vf.xyz vf6 vf4 vf5) + (.svf (&-> sv-240 quad) vf6) + (when (< f30-0 (s0-1 + sv-224 + sv-240 + s1-1 + (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) ) ) ) @@ -2268,27 +2236,31 @@ (go-virtual create) ) +;; WARN: Return type mismatch (pointer process) vs (pointer nav-graph-editor). (defun run-nav-graph-editor ((arg0 symbol) (arg1 symbol)) - (when (not *nav-graph-editor*) - (let ((s4-0 (process-spawn - nav-graph-editor - arg0 - (if arg1 - arg1 - 'unknown - ) - :name "nav-graph-editor" + (the-as + (pointer nav-graph-editor) + (when (not *nav-graph-editor*) + (let ((s4-0 (process-spawn + nav-graph-editor + arg0 + (if arg1 + arg1 + 'unknown + ) + :name "nav-graph-editor" + ) ) + ) + (when arg1 + (let ((v1-4 *nav-graph-editor*)) + (if v1-4 + (nav-graph-editor-method-66 (-> v1-4 0) arg0 (the-as string arg1)) ) + ) ) - (when arg1 - (let ((v1-4 *nav-graph-editor*)) - (if v1-4 - (nav-graph-editor-method-66 (-> v1-4 0) arg0 (the-as string arg1)) - ) - ) + s4-0 ) - s4-0 ) ) ) @@ -2411,16 +2383,6 @@ ) (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) @@ -2441,52 +2403,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)) @@ -2538,7 +2502,6 @@ ) (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* ((v1-0 *nav-graph-editor*) (s5-0 (-> (the-as nav-graph-editor (if v1-0 (the-as nav-graph-editor (-> v1-0 0 self)) @@ -2564,32 +2527,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-37 (-> 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-37 (-> 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/goal_src/jak3/engine/debug/viewer.gc b/goal_src/jak3/engine/debug/viewer.gc index 164ebb533a..1e053eb5f6 100644 --- a/goal_src/jak3/engine/debug/viewer.gc +++ b/goal_src/jak3/engine/debug/viewer.gc @@ -224,31 +224,24 @@ ) (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 1)) - (when sv-48 - (let ((t9-2 (method-of-type viewer activate))) - (t9-2 (the-as viewer sv-48) arg4 "viewer" (the-as pointer #x70004000)) - ) - (let ((t9-3 run-function-in-process) - (a0-7 sv-48) - (a1-4 init-viewer-for-other) - (a2-4 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 1))) + (when sv-48 + ((method-of-type viewer activate) (the-as viewer sv-48) arg4 "viewer" (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-4 sv-64 t0-1) + ) ) - (-> sv-48 ppointer) + (+! sv-32 1) ) - (set! sv-32 (+ sv-32 1)) ) ) #f diff --git a/goal_src/jak3/engine/dma/dma-buffer.gc b/goal_src/jak3/engine/dma/dma-buffer.gc index 40c198c863..930181534c 100644 --- a/goal_src/jak3/engine/dma/dma-buffer.gc +++ b/goal_src/jak3/engine/dma/dma-buffer.gc @@ -431,7 +431,8 @@ ;; The first 4 bytes of a vu-function object's data are discarded because they aren't aligned. (let ((func-ptr (the-as pointer (&-> vu-func data 4))) - (qlen (-> vu-func qlength)) ;; number of quadwords + ;; og:preserve-this we rely on the vu functions being empty on pc + (qlen (#if PC_PORT 0 (-> vu-func qlength))) ;; number of quadwords (origin (-> vu-func origin)) ;; destination address in VU instruction memory. ) ;; loop until whole program is transferred. diff --git a/goal_src/jak3/engine/dma/dma-disasm.gc b/goal_src/jak3/engine/dma/dma-disasm.gc index 5cc0352591..ec7924ba5b 100644 --- a/goal_src/jak3/engine/dma/dma-disasm.gc +++ b/goal_src/jak3/engine/dma/dma-disasm.gc @@ -300,136 +300,139 @@ (defun disasm-vif-tag ((tag (pointer vif-tag)) (count int) (format-dest symbol) (details? 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 uint)) (let ((gp-0 0)) (while (< gp-0 (* count 4)) (let ((s0-0 4)) (let ((s1-0 (-> tag 0))) (format format-dest " #x~X:" tag) (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 format-dest " (~s :irq ~D)~%" (-> *vif-disasm-table* v1-0 string1) (-> s1-0 irq)) - ) - ((= a0-12 1) - (format - format-dest - " (~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 format-dest " (~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 format-dest - " (~s :irq ~D :wl ~D :cl ~D)~%" + " (~s :irq ~D :~s #x~X)~%" (-> *vif-disasm-table* v1-0 string1) (-> s1-0 irq) - (shr (shl t1-1 48) 56) - (shr (shl t1-1 56) 56) + (-> *vif-disasm-table* v1-0 string2) + (-> s1-0 imm) ) ) - ) - ((= a0-12 3) - (set! s0-0 8) - (format - format-dest - " (~s :irq ~D :~s #x~X)~%" - (-> *vif-disasm-table* v1-0 string1) - (-> s1-0 irq) - (-> *vif-disasm-table* v1-0 string2) - (-> tag 1) - ) - ) - ((= a0-12 4) - (set! s0-0 20) - (format - format-dest - " (~s :irq ~D :~s " - (-> *vif-disasm-table* v1-0 string1) - (-> s1-0 irq) - (-> *vif-disasm-table* v1-0 string2) - ) - (format format-dest "#x~X #x~X #x~X #x~X)~%" (-> tag 1) (-> tag 2) (-> tag 3) (-> tag 4)) - ) - ((= a0-12 5) - (format - format-dest - " (~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 - format-dest - " (~s :irq ~D :qwc #x~D)~%" - (-> *vif-disasm-table* v1-0 string1) - (-> s1-0 irq) - (-> s1-0 imm) - ) - (set! sv-32 (&-> tag 1)) - (set! sv-48 0) - (while (< sv-48 (the-as int (-> s1-0 imm))) - (format - format-dest - " #x~X: #x~8x #x~8x #x~8x #x~8x~%" - (+ (+ (* sv-48 16) 4) (the-as int tag)) - (-> 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 (-> s1-0 imm)) - (format - format-dest - " (~s :irq ~D :num ~D :addr #x~X " - (-> *vif-disasm-table* v1-0 string1) - (-> s1-0 irq) - (-> s1-0 num) - (shr (shl sv-64 54) 54) - ) - (format - format-dest - ":msk ~D :flg ~D :usn ~D [skip ~d])~%" - (-> s1-0 msk) - (shr (shl sv-64 48) 63) - (shr (shl sv-64 49) 63) - (the-as uint s0-0) - ) - (if details? - (disasm-vif-details + ((= a0-12 2) + (let ((t1-1 (-> s1-0 imm))) + (format format-dest - (the-as (pointer uint8) tag) - (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 t1-1 48) 56) + (shr (shl t1-1 56) 56) ) ) - ) - ((= a0-12 8) - (format format-dest " (*unknown* vif-tag #x~X)~%" (-> s1-0 cmd)) - ) + ) + ((= a0-12 3) + (set! s0-0 8) + (format + format-dest + " (~s :irq ~D :~s #x~X)~%" + (-> *vif-disasm-table* v1-0 string1) + (-> s1-0 irq) + (-> *vif-disasm-table* v1-0 string2) + (-> tag 1) + ) + ) + ((= a0-12 4) + (set! s0-0 20) + (format + format-dest + " (~s :irq ~D :~s " + (-> *vif-disasm-table* v1-0 string1) + (-> s1-0 irq) + (-> *vif-disasm-table* v1-0 string2) + ) + (format format-dest "#x~X #x~X #x~X #x~X)~%" (-> tag 1) (-> tag 2) (-> tag 3) (-> tag 4)) + ) + ((= a0-12 5) + (format + format-dest + " (~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 + format-dest + " (~s :irq ~D :qwc #x~D)~%" + (-> *vif-disasm-table* v1-0 string1) + (-> s1-0 irq) + (-> s1-0 imm) + ) + (let ((sv-32 (&-> tag 1)) + (sv-48 0) + ) + (while (< sv-48 (the-as int (-> s1-0 imm))) + (format + format-dest + " #x~X: #x~8x #x~8x #x~8x #x~8x~%" + (+ (+ (* sv-48 16) 4) (the-as int tag)) + (-> 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 (-> s1-0 imm))) + (format + format-dest + " (~s :irq ~D :num ~D :addr #x~X " + (-> *vif-disasm-table* v1-0 string1) + (-> s1-0 irq) + (-> s1-0 num) + (shr (shl sv-64 54) 54) + ) + (format + format-dest + ":msk ~D :flg ~D :usn ~D [skip ~d])~%" + (-> s1-0 msk) + (shr (shl sv-64 48) 63) + (shr (shl sv-64 49) 63) + (the-as uint s0-0) + ) + ) + (if details? + (disasm-vif-details + format-dest + (the-as (pointer uint8) tag) + (logand sv-16 (vif-cmd cmd-mask)) + (the-as int (-> s1-0 num)) + ) + ) + ) + ((= a0-12 8) + (format format-dest " (*unknown* vif-tag #x~X)~%" (-> s1-0 cmd)) + ) + ) ) + (set! v1-0 (-> *vif-disasm-table* length)) ) - (set! v1-0 (-> *vif-disasm-table* length)) ) ) ) @@ -508,17 +511,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 object) - (sv-48 int) - (sv-64 object) - (sv-80 object) - (sv-96 int) - (sv-112 dma-tag) - ) - (set! sv-32 data) - (let ((s2-0 mode) + (let ((sv-32 data) + (s2-0 mode) (s3-0 verbose) (gp-0 stream) (s1-0 expected-size) @@ -530,188 +524,190 @@ (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") - ) - (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 (-> (the-as dma-packet 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) + (let ((sv-16 (the-as uint 0)) + (sv-48 0) + (sv-64 (the-as dma-packet 0)) + (sv-80 (the-as dma-packet 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") ) - (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) + (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 (-> (the-as dma-packet 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) + (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 - ((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 (the-as (pointer vif-tag) (&-> (the-as (pointer uint64) sv-32) 1)) 2 gp-0 (= s2-0 'details)) + (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 (the-as (pointer vif-tag) (&-> (the-as (pointer uint64) sv-32) 1)) 2 gp-0 (= s2-0 'details)) + ) ) + (disasm-vif-tag + (the-as (pointer vif-tag) (+ (the-as int sv-16) v0-10)) + (the-as int (- (* (the-as uint sv-48) 4) (the-as uint (/ v0-10 4)))) + gp-0 + (= s2-0 'details) ) - (disasm-vif-tag - (the-as (pointer vif-tag) (+ (the-as int sv-16) v0-10)) - (the-as int (- (* sv-48 4) (the-as uint (/ v0-10 4)))) - gp-0 - (= s2-0 'details) ) ) - ) - (set! sv-32 (&-> (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 uint sv-32) (* (+ sv-48 1) 16))) - (the-as int 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 (-> sv-112 addr)) - (the-as uint 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 (-> sv-112 addr)) - (set! sv-96 (+ sv-96 1)) - (cond - ((zero? sv-96) - (set! sv-64 (&+ (the-as (pointer uint64) sv-16) sv-48)) - (the-as (pointer uint64) sv-64) - ) - (else - (set! sv-80 (&+ (the-as (pointer uint64) 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 sv-64) - sv-32 - ) - ((= v1-123 1) - (set! sv-32 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 uint (&-> (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 uint (&-> (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 uint (&-> (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 dma-packet (&+ (the-as (pointer uint64) sv-16) (the-as uint sv-48)))) + sv-64 + ) + (else + (set! sv-80 (the-as dma-packet (&+ (the-as (pointer uint64) sv-16) (the-as uint sv-48)))) + 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 uint (&-> (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 sv-64) + sv-32 + ) + ((= v1-123 1) + (set! sv-32 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 uint (&-> (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/goal_src/jak3/engine/entity/actor-link-h.gc b/goal_src/jak3/engine/entity/actor-link-h.gc index 10dd7a8f40..cf88633c92 100644 --- a/goal_src/jak3/engine/entity/actor-link-h.gc +++ b/goal_src/jak3/engine/entity/actor-link-h.gc @@ -10,9 +10,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)))) @@ -29,12 +29,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 + ) + ) ) (deftype actor-link-info (basic) diff --git a/goal_src/jak3/engine/entity/entity.gc b/goal_src/jak3/engine/entity/entity.gc index 5798c61834..47e337d9fa 100644 --- a/goal_src/jak3/engine/entity/entity.gc +++ b/goal_src/jak3/engine/entity/entity.gc @@ -767,24 +767,24 @@ ) (defmethod update-vis-volumes ((this level-group)) - (local-vars (sv-16 (inline-array vector)) (sv-20 vector) (sv-24 vector) (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 (inline-array vector))) - (set! sv-20 (-> sv-16 0)) - (set! sv-24 (-> sv-16 1)) - (set! sv-28 (as-type (-> s2-0 extra process) process-drawable)) - ) - (when sv-28 - (update-actor-vis-box (the-as process-drawable sv-28) sv-20 sv-24) - (let ((s2-2 (-> sv-28 child))) - (while s2-2 - (update-actor-vis-box (the-as process-drawable (as-type (-> s2-2 0) process-drawable)) sv-20 sv-24) - (set! s2-2 (-> s2-2 0 brother)) + (let* ((s2-0 (-> s4-0 data s3-0 entity)) + (sv-16 (res-lump-data s2-0 'visvol (inline-array vector))) + (sv-20 (-> sv-16 0)) + (sv-24 (-> sv-16 1)) + (sv-28 (as-type (-> s2-0 extra process) process-drawable)) + ) + (when sv-28 + (update-actor-vis-box (the-as process-drawable sv-28) sv-20 sv-24) + (let ((s2-2 (-> sv-28 child))) + (while s2-2 + (update-actor-vis-box (the-as process-drawable (as-type (-> s2-2 0) process-drawable)) sv-20 sv-24) + (set! s2-2 (-> s2-2 0 brother)) + ) ) ) ) @@ -810,17 +810,17 @@ ;; WARN: Return type mismatch symbol vs object. (defun expand-bounding-box-from-nav-meshes ((arg0 entity) (arg1 vector) (arg2 vector)) - (local-vars (sv-16 res-tag)) - (set! sv-16 (new 'static 'res-tag)) - (res-lump-data arg0 'nav-mesh-actor pointer :tag-ptr (& sv-16)) - (dotimes (s3-0 (the-as int (-> sv-16 elt-count))) - (let ((a0-3 (nav-mesh-from-res-tag arg0 'nav-mesh-actor s3-0))) - (when a0-3 - (let ((s2-0 (new 'stack-no-clear 'vector)) - (s1-0 (new 'stack-no-clear 'vector)) - ) - (compute-bounding-box-from-vertices a0-3 s2-0 s1-0) - (expand-bounding-box arg1 arg2 s2-0 s1-0) + (let ((sv-16 (new 'static 'res-tag))) + (res-lump-data arg0 'nav-mesh-actor pointer :tag-ptr (& sv-16)) + (dotimes (s3-0 (the-as int (-> sv-16 elt-count))) + (let ((a0-3 (nav-mesh-from-res-tag arg0 'nav-mesh-actor s3-0))) + (when a0-3 + (let ((s2-0 (new 'stack-no-clear 'vector)) + (s1-0 (new 'stack-no-clear 'vector)) + ) + (compute-bounding-box-from-vertices a0-3 s2-0 s1-0) + (expand-bounding-box arg1 arg2 s2-0 s1-0) + ) ) ) ) @@ -829,80 +829,74 @@ ) (defmethod level-group-method-24 ((this level-group)) - (local-vars - (sv-16 (inline-array vector)) - (sv-20 vector) - (sv-24 vector) - (sv-28 float) - (sv-32 float) - (sv-36 vector) - (sv-40 entity) - (sv-48 res-tag) - ) (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 (inline-array vector))) - (set! sv-20 (-> sv-16 0)) - (set! sv-24 (-> sv-16 1)) - (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 ((v1-17 (entity-actor-lookup s2-0 'nav-mesh-actor 0))) - (if v1-17 - (set! sv-40 v1-17) + (let* ((s2-0 (-> s4-0 data s3-0 entity)) + (sv-16 (res-lump-data s2-0 'visvol (inline-array vector))) + (sv-20 (-> sv-16 0)) + (sv-24 (-> sv-16 1)) + (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 ((enemy-option (res-lump-value sv-40 'enemy-options enemy-option :time -1000000000.0))) - (cond - ((logtest? (enemy-option spawner) (the-as uint128 enemy-option)) - (vector-copy! sv-20 sv-36) - (vector-copy! sv-24 sv-36) - (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)) - (vector-copy! sv-20 sv-36) - (vector-copy! sv-24 sv-36) - (set! sv-48 (new 'static 'res-tag)) - (let ((v1-29 (res-lump-data sv-40 'actor-groups (pointer actor-group) :tag-ptr (& sv-48)))) - (when (and v1-29 (nonzero? (-> sv-48 elt-count))) - (let* ((s2-2 (-> v1-29 0)) - (s1-1 (-> s2-2 length)) + (let ((v1-17 (entity-actor-lookup s2-0 'nav-mesh-actor 0))) + (if v1-17 + (set! sv-40 v1-17) + ) + ) + (cond + ((type? sv-40 entity-actor) + (let ((enemy-option (res-lump-value sv-40 'enemy-options enemy-option :time -1000000000.0))) + (cond + ((logtest? (enemy-option spawner) (the-as uint128 enemy-option)) + (vector-copy! sv-20 sv-36) + (vector-copy! sv-24 sv-36) + (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)) + (vector-copy! sv-20 sv-36) + (vector-copy! sv-24 sv-36) + (let* ((sv-48 (new 'static 'res-tag)) + (v1-29 (res-lump-data sv-40 'actor-groups (pointer actor-group) :tag-ptr (& sv-48))) ) - (dotimes (s0-0 s1-1) - (let ((a0-26 (-> s2-2 data s0-0 actor))) - (expand-bounding-box-from-nav-meshes a0-26 sv-20 sv-24) + (when (and v1-29 (nonzero? (-> sv-48 elt-count))) + (let* ((s2-2 (-> v1-29 0)) + (s1-1 (-> s2-2 length)) + ) + (dotimes (s0-0 s1-1) + (let ((a0-26 (-> s2-2 data s0-0 actor))) + (expand-bounding-box-from-nav-meshes a0-26 sv-20 sv-24) + ) + ) ) ) ) ) - ) - ) - (else - (expand-bounding-box-from-nav-meshes sv-40 sv-20 sv-24) + (else + (expand-bounding-box-from-nav-meshes sv-40 sv-20 sv-24) + ) + ) ) ) - ) - ) - (else - (vector-copy! sv-20 sv-36) - (vector-copy! sv-24 sv-36) + (else + (vector-copy! sv-20 sv-36) + (vector-copy! sv-24 sv-36) + ) + ) ) + (+! (-> 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) ) ) ) @@ -913,17 +907,6 @@ ) (defmethod print-volume-sizes ((this level-group)) - (local-vars - (sv-16 (inline-array vector)) - (sv-20 float) - (sv-24 vector) - (sv-28 type) - (sv-32 vector) - (sv-36 vector) - (sv-48 int) - (sv-64 entity) - (sv-80 string) - ) (let ((s5-0 0)) (dotimes (v1-0 (-> this length)) (let ((a0-4 (-> this level v1-0))) @@ -941,16 +924,19 @@ (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 string)) - (when (and (or (not s4-0) (string>? sv-80 s4-0)) (or (not s2-0) (string s0-0 data sv-48 entity)) + (sv-80 (res-lump-struct sv-64 'name string)) + ) + (when (and (or (not s4-0) (string>? sv-80 s4-0)) (or (not s2-0) (string (the-as entity-actor s3-0) extra trans)) - (set! sv-28 (if (type? s3-0 entity-actor) - (-> (the-as entity-actor s3-0) etype) - (the-as type #f) - ) + (let ((sv-16 (res-lump-data s3-0 'visvol (inline-array vector))) + (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 (-> sv-16 0)) - (set! sv-36 (-> sv-16 1)) - (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? s3-0 entity-actor) + (-> (the-as entity-actor s3-0) etype) + (the-as type #f) + ) + ) + ) + ) + (let ((sv-32 (-> sv-16 0)) + (sv-36 (-> sv-16 1)) + ) + (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)) + ) + ) ) ) ) @@ -1067,7 +1059,6 @@ ) (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 process-drawable arg0) root)) @@ -1104,81 +1095,83 @@ (-> (the-as process-drawable arg0) root trans) (new 'static 'rgba :r #x80 :g #xff :b #x80 :a #x80) ) - (set! sv-16 (-> arg0 entity)) - (cond - ((and sv-16 (= (-> sv-16 extra process) 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 :y 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 577) + (let ((sv-16 (-> arg0 entity))) + (cond + ((and sv-16 (= (-> sv-16 extra process) 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 :y 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 577) + ) + (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 :y 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 :y 24) ) ) - ) - (let ((a0-23 (res-lump-struct sv-16 'art-name string))) - (if (and a0-23 (logtest? (the-as int a0-23) 1)) - (add-debug-text-3d - #t - (bucket-id debug-no-zbuf1) - (symbol->string-debug (the-as symbol a0-23)) - (-> (the-as process-drawable arg0) root trans) - (font-color white) - (new 'static 'vector2h :y 24) - ) - ) - ) - (when *display-actor-vis* - (let ((v1-56 (res-lump-data sv-16 'visvol (inline-array vector))) - (a1-14 (-> sv-16 extra vis-id)) - ) - (if v1-56 - (add-debug-box + (let ((a0-23 (res-lump-struct sv-16 'art-name string))) + (if (and a0-23 (logtest? (the-as int a0-23) 1)) + (add-debug-text-3d #t (bucket-id debug-no-zbuf1) - (-> v1-56 0) - (-> v1-56 1) - (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-debug (the-as symbol a0-23)) + (-> (the-as process-drawable arg0) root trans) + (font-color white) + (new 'static 'vector2h :y 24) ) ) ) + (when *display-actor-vis* + (let ((v1-56 (res-lump-data sv-16 'visvol (inline-array vector))) + (a1-14 (-> sv-16 extra vis-id)) + ) + (if v1-56 + (add-debug-box + #t + (bucket-id debug-no-zbuf1) + (-> v1-56 0) + (-> v1-56 1) + (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-4 add-debug-text-3d) - (s4-4 #t) - (s3-4 577) + (else + (let ((s5-4 add-debug-text-3d) + (s4-4 #t) + (s3-4 577) + ) + (format (clear *temp-string*) "pid ~d" (-> arg0 pid)) + (s5-4 + s4-4 + (the-as bucket-id s3-4) + *temp-string* + (-> (the-as process-drawable arg0) root trans) + (font-color green) + (new 'static 'vector2h :y 8) ) - (format (clear *temp-string*) "pid ~d" (-> arg0 pid)) - (s5-4 - s4-4 - (the-as bucket-id s3-4) - *temp-string* - (-> (the-as process-drawable arg0) root trans) - (font-color green) - (new 'static 'vector2h :y 8) ) ) ) @@ -1200,17 +1193,6 @@ ) (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)) @@ -1229,44 +1211,46 @@ ) (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-21 (-> this level s5-2))) - (when (= (-> v1-21 status) 'active) - (let ((s4-1 (-> v1-21 bsp level entity))) - (dotimes (s3-1 (-> s4-1 length)) - (let ((s2-0 (-> s4-1 data s3-1 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) - ) - ) - (when (< (vector-vector-distance (math-camera-pos) sv-20) 491520.0) - (let ((s1-1 add-debug-text-3d) - (s0-0 #t) - ) - (set! sv-32 577) - (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 :y 8)) + (else + (dotimes (s5-2 (-> this length)) + (let ((v1-21 (-> this level s5-2))) + (when (= (-> v1-21 status) 'active) + (let ((s4-1 (-> v1-21 bsp level entity))) + (dotimes (s3-1 (-> s4-1 length)) + (let* ((s2-0 (-> s4-1 data s3-1 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) + ) + ) + (when (< (vector-vector-distance (math-camera-pos) sv-20) 491520.0) + (let ((s1-1 add-debug-text-3d) + (s0-0 #t) + (sv-32 577) ) - (s1-1 s0-0 (the-as bucket-id sv-32) (the-as string a2-4) a3-2 (the-as font-color t0-1) t1-1) + (s1-1 + 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 :y 8) + ) ) ) ) @@ -1292,18 +1276,22 @@ (a1-16 (-> s0-1 extra vis-id)) ) (when (and v0-9 (or (= s5-3 #t) (= s5-3 'box))) - (set! sv-48 add-debug-box) - (set! sv-64 #t) - (set! sv-80 577) - (set! sv-96 (&+ v0-9 0)) - (set! sv-112 (&+ v0-9 16)) - (let ((t0-3 (if (is-object-visible? s3-2 a1-16) - (the-as uint #x80808000) - (the-as uint #x80800080) - ) - ) + (let ((sv-48 add-debug-box) + (sv-64 #t) + (sv-80 577) + (sv-96 (&+ v0-9 0)) + (sv-112 (&+ v0-9 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-2 a1-16) + (new 'static 'rgba :g #x80 :b #x80 :a #x80) + (new 'static 'rgba :r #x80 :b #x80 :a #x80) + ) + ) ) ) ) @@ -1543,20 +1531,20 @@ (while (< s2-4 s3-6) ;; og:preserve-this pc port note: added this name and water check (let ((tree-name (-> s1-4 name))) - (when (or (!= tree-name 'water) (not *debug-region-hide-water*)) - (set! *debug-region-tree-name* tree-name) - - (let ((s0-4 (-> s1-4 data2 (+ (-> s1-4 length) -1) length))) - (set! sv-128 0) - (let ((a0-128 (the-as object (+ (+ (* sv-128 32) 32) (the-as int (-> s1-4 data2 (+ (-> s1-4 length) -1))))))) - (while (< sv-128 s0-4) - (debug-draw-region (the-as drawable-region-prim a0-128) 0) - (set! sv-128 (+ sv-128 1)) - (set! a0-128 (+ (+ (* sv-128 32) 32) (the-as int (-> s1-4 data2 (+ (-> s1-4 length) -1))))) + (when (or (!= tree-name 'water) (not *debug-region-hide-water*)) + (set! *debug-region-tree-name* tree-name) + (let* ((s0-4 (-> s1-4 data2 (+ (-> s1-4 length) -1) length)) + (sv-128 0) + (a0-128 (the-as object (+ (+ (* sv-128 32) 32) (the-as int (-> s1-4 data2 (+ (-> s1-4 length) -1)))))) + ) + (while (< sv-128 s0-4) + (debug-draw-region (the-as drawable-region-prim a0-128) 0) + (+! sv-128 1) + (set! a0-128 (+ (+ (* sv-128 32) 32) (the-as int (-> s1-4 data2 (+ (-> s1-4 length) -1))))) + ) ) ) ) - )) (+! s2-4 1) (set! s1-4 (-> s4-8 bsp region-trees s2-4)) ) @@ -1650,7 +1638,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-75 int) (s5-0 int) (sv-16 int)) + (local-vars (v1-75 int) (s5-0 int)) (.mfc0 s5-0 Count) (let ((a2-0 (if (nonzero? (-> this actors)) (-> this actors length) @@ -1699,13 +1687,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) (the-as entity-actor (entity-by-aid (-> s0-0 data sv-16 id)))) ) - (set! sv-16 (+ sv-16 1)) + (+! sv-16 1) ) ) ) @@ -2118,15 +2107,6 @@ ;; ERROR: Stack slot load at 96 mismatch: defined as size 4, got size 16 ;; 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) @@ -2161,174 +2141,176 @@ ) ) (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-53 (-> s4-2 data s2-0))) - (cond - ((and (logtest? (-> v1-53 kill-mask) (task-mask special)) (not (logtest? (-> v1-53 kill-mask) sv-32))) - (when (not (or (-> v1-53 process) (logtest? (-> v1-53 perm status) (entity-perm-status bit-0 dead)))) - (birth! (-> v1-53 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-53 process) - (not (logtest? (-> v1-53 perm status) (entity-perm-status no-kill))) - (not (logtest? (-> v1-53 process mask) (process-mask no-kill))) + (dotimes (s2-0 s3-1) + (let ((v1-53 (-> s4-2 data s2-0))) + (cond + ((and (logtest? (-> v1-53 kill-mask) (task-mask special)) (not (logtest? (-> v1-53 kill-mask) sv-32))) + (when (not (or (-> v1-53 process) (logtest? (-> v1-53 perm status) (entity-perm-status bit-0 dead)))) + (birth! (-> v1-53 entity)) + (+! sv-24 1) + (if (>= sv-24 (-> *ACTOR-bank* birth-max)) + (return #f) ) - (kill! (-> v1-53 entity)) - ) - ) - ) - ) - ) - ) - ) - ((= (-> s4-1 display?) 'actor) - (let* ((s4-3 (-> s4-1 entity)) - (s3-2 (-> s4-3 length)) - ) - (dotimes (s2-1 s3-2) - (let ((v1-66 (-> s4-3 data s2-1))) - (cond - ((not (logtest? (-> v1-66 kill-mask) sv-32)) - (when (not (or (-> v1-66 process) (logtest? (-> v1-66 perm status) (entity-perm-status bit-0 dead)))) - (birth! (-> v1-66 entity)) - (set! sv-24 (+ sv-24 1)) - (if (>= sv-24 (-> *ACTOR-bank* birth-max)) - (return #f) ) - ) - ) - (else - (if (and (-> v1-66 process) - (not (logtest? (-> v1-66 perm status) (entity-perm-status no-kill))) - (not (logtest? (-> v1-66 process mask) (process-mask no-kill))) - ) - (kill! (-> v1-66 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 - ;; og:preserve-this entity blacklist - ((and (#if PC_PORT (or (with-pc (and (not (-> *pc-settings* ps2-actor-vis?)) - ;; ban specific entities - ; (not (let ((name (res-lump-struct (-> sv-48 entity) 'name string))) - ; (nmember name '("fort-entry-gate-11" - ; "fort-elec-gate-11" - ; "fort-elec-gate-12" - ; "com-airlock-outer-13" - ; "com-airlock-inner-41" - ; "under-lift-4" - ; "under-locking-1" - ; "under-locking-2")))) - )) - (is-object-visible? s4-1 (-> sv-48 vis-id))) - (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))) - ;; og:preserve-this PC port note: added this extra check to fix level types being used after deload because of bad entity placement - (#if PC_PORT - (or (not (type-type? (-> sv-48 entity type) entity-actor)) (and (valid? (-> (the-as entity-actor (-> sv-48 entity)) etype) type "entity-type-check etype" #f *stdcon*) - (valid? (-> (the-as entity-actor (-> sv-48 entity)) etype symbol) symbol "entity-type-check symbol" #f *stdcon*) - (valid? (-> (the-as entity-actor (-> sv-48 entity)) etype symbol value) type "entity-type-check value" #f *stdcon*) - (= (-> (the-as entity-actor (-> sv-48 entity)) etype) (-> (the-as entity-actor (-> sv-48 entity)) etype symbol value)) - )) - #f) - ) - (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 (and *debug-segment* (not *display-capture-mode*)) - (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-53 process) + (not (logtest? (-> v1-53 perm status) (entity-perm-status no-kill))) + (not (logtest? (-> v1-53 process mask) (process-mask no-kill))) + ) + (kill! (-> v1-53 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-66 (-> s4-3 data s2-1))) + (cond + ((not (logtest? (-> v1-66 kill-mask) sv-32)) + (when (not (or (-> v1-66 process) (logtest? (-> v1-66 perm status) (entity-perm-status bit-0 dead)))) + (birth! (-> v1-66 entity)) + (+! sv-24 1) + (if (>= sv-24 (-> *ACTOR-bank* birth-max)) + (return #f) + ) + ) ) + (else + (if (and (-> v1-66 process) + (not (logtest? (-> v1-66 perm status) (entity-perm-status no-kill))) + (not (logtest? (-> v1-66 process mask) (process-mask no-kill))) + ) + (kill! (-> v1-66 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 + ;; og:preserve-this entity blacklist + ((and (#if PC_PORT (or (with-pc (and (not (-> *pc-settings* ps2-actor-vis?)) + ;; ban specific entities + ; (not (let ((name (res-lump-struct (-> sv-48 entity) 'name string))) + ; (nmember name '("fort-entry-gate-11" + ; "fort-elec-gate-11" + ; "fort-elec-gate-12" + ; "com-airlock-outer-13" + ; "com-airlock-inner-41" + ; "under-lift-4" + ; "under-locking-1" + ; "under-locking-2")))) + )) + (is-object-visible? s4-1 (-> sv-48 vis-id))) + (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))) + ;; og:preserve-this PC port note: added this extra check to fix level types being used after deload because of bad entity placement + (#if PC_PORT + (or (not (type-type? (-> sv-48 entity type) entity-actor)) (and (valid? (-> (the-as entity-actor (-> sv-48 entity)) etype) type "entity-type-check etype" #f *stdcon*) + (valid? (-> (the-as entity-actor (-> sv-48 entity)) etype symbol) symbol "entity-type-check symbol" #f *stdcon*) + (valid? (-> (the-as entity-actor (-> sv-48 entity)) etype symbol value) type "entity-type-check value" #f *stdcon*) + (= (-> (the-as entity-actor (-> sv-48 entity)) etype) (-> (the-as entity-actor (-> sv-48 entity)) etype symbol value)) + )) + #f) + ) + (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 (and *debug-segment* (not *display-capture-mode*)) + (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) - ) ) ) ) @@ -2462,15 +2444,6 @@ ) (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))) @@ -2479,14 +2452,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)) ) ) ) @@ -2494,14 +2461,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)) ) ) ) @@ -2509,14 +2470,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)) ) ) ) @@ -2524,14 +2479,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/goal_src/jak3/engine/entity/res.gc b/goal_src/jak3/engine/entity/res.gc index 75d2c4af9b..2c4afac3ed 100644 --- a/goal_src/jak3/engine/entity/res.gc +++ b/goal_src/jak3/engine/entity/res.gc @@ -175,8 +175,8 @@ This is updated from the entity system used in Crash 2, which had most of these (set! (-> v0-0 allocated-length) arg0) (set! (-> v0-0 data-size) arg1) (set! (-> v0-0 length) 0) - (set! (-> v0-0 data-base) (&-> (-> v0-0 tag) arg0)) - (set! (-> v0-0 data-top) (&-> (-> v0-0 tag) arg0)) + (set! (-> v0-0 data-base) (&-> v0-0 tag arg0)) + (set! (-> v0-0 data-top) (&-> v0-0 tag arg0)) v0-0 ) ) @@ -277,7 +277,7 @@ This is updated from the entity system used in Crash 2, which had most of these (goto cfg-60) ) (let ((a3-14 t0-1) - (t0-4 (&-> (-> this tag) t0-1)) + (t0-4 (&-> this tag t0-1)) ) (while (not (or (>= a3-14 (-> this length)) (< (the-as int a2-1) (the-as int (-> t0-4 0 name))))) (cond @@ -848,9 +848,8 @@ This is updated from the entity system used in Crash 2, which had most of these (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)) @@ -860,20 +859,19 @@ This is updated from the entity system used in Crash 2, which had most of these (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))) @@ -886,18 +884,18 @@ This is updated from the entity system used in Crash 2, which had most of these ) (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))) @@ -912,7 +910,6 @@ This is updated from the entity system used in Crash 2, which had most of these ;; WARN: Return type mismatch int vs res-lump. (defmethod mem-usage ((this res-lump) (usage memory-usage-block) (flags int)) - (local-vars (sv-16 int)) (let ((s3-0 49) (s2-0 "res") ) @@ -972,12 +969,13 @@ This is updated from the entity system used in Crash 2, which had most of these (+! (-> 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/goal_src/jak3/engine/game/effect-control.gc b/goal_src/jak3/engine/game/effect-control.gc index 2d56ecccee..3f97c038fe 100644 --- a/goal_src/jak3/engine/game/effect-control.gc +++ b/goal_src/jak3/engine/game/effect-control.gc @@ -275,7 +275,6 @@ ;; 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 string) (arg1 float) (arg2 int)) - (local-vars (sv-288 res-lump)) (let* ((v1-2 (rtype-of arg0)) (s3-0 (cond ((= v1-2 symbol) @@ -455,17 +454,16 @@ (set! (-> v1-131 death-timer-org) (-> v1-131 death-timer)) (set! (-> v1-131 death-draw-overlap) (-> (the-as death-info s3-1) overlap)) ) - (when (-> (the-as death-info s3-1) sound) - (let* ((s2-3 this) - (s1-0 (method-of-object s2-3 play-effect-sound)) - (s0-0 (-> (the-as death-info s3-1) sound)) - ) - (set! sv-288 (-> this res)) - (let ((t1-5 (string->sound-name (-> (the-as death-info s3-1) sound)))) - (s1-0 s2-3 (the-as symbol s0-0) arg1 arg2 sv-288 t1-5) + (if (-> (the-as death-info s3-1) sound) + (play-effect-sound + this + (the-as symbol (-> (the-as death-info s3-1) sound)) + arg1 + arg2 + (-> this res) + (string->sound-name (-> (the-as death-info s3-1) sound)) ) ) - ) (send-event (-> this process) 'death-start (the-as death-info s3-1)) ) ) @@ -480,473 +478,440 @@ ) (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 symbol) - (sv-208 - (function sparticle-system sparticle-launcher matrix sparticle-launch-state sparticle-launch-control float none) - ) - (sv-224 sparticle-system) - (sv-240 vector) - (sv-256 matrix) - ) (let ((s1-0 (the-as sound-name #f))) (-> *display* frames (-> *display* last-screen) run-time) - (set! sv-192 arg0) - (cond - ((string= (the-as string sv-192) "effect-walk-step-left") - (set! s1-0 (sound-name-with-material "walk" arg4 "1")) - ) - ((string= (the-as string sv-192) "effect-run-step-left") - (set! s1-0 (sound-name-with-material "run" arg4 "1")) - ) - ((string= (the-as string sv-192) "effect-mech-step-left") - (set! s1-0 (sound-name-with-material "mwlk" arg4 "1")) - ) - ((string= (the-as string sv-192) "effect-walk-step-right") - (set! s1-0 (sound-name-with-material "walk" arg4 "2")) - ) - ((string= (the-as string sv-192) "effect-run-step-right") - (set! s1-0 (sound-name-with-material "run" arg4 "2")) - ) - ((string= (the-as string sv-192) "effect-mech-step-right") - (set! s1-0 (sound-name-with-material "mwlk" arg4 "2")) - ) - ((string= (the-as string sv-192) "effect-roll") - (set! s1-0 (sound-name-with-material "roll" arg4 "")) - ) - ((string= (the-as string sv-192) "effect-slide") - (set! s1-0 (sound-name-with-material "slide" arg4 "")) - ) - ((string= (the-as string sv-192) "effect-land") - (set! s1-0 (sound-name-with-material "land" arg4 "")) - ) - ((string= (the-as string sv-192) "effect-zoom-land") - (set! s1-0 (sound-name-with-material "zoom-land" arg4 "")) - ) - ((string= (the-as string sv-192) "effect-zoom-hit") - (set! s1-0 (sound-name-with-material "zoom-hit" arg4 "")) - ) - ((string= (the-as string sv-192) "effect-flut-land") - (set! s1-0 (sound-name-with-material "flut-land" arg4 "")) - ) - ((string= (the-as string sv-192) "effect-land-poof") - (do-effect - this - (-> (new 'static 'boxed-array :type string - "group-land-poof-unk" - "group-land-poof-ice" - "group-land-poof-qsd" - "group-land-poof-wtr" - "group-land-poof-tar" - "group-land-poof-san" - "group-land-poof-wod" - "group-land-poof-grs" - "group-land-poof-pmt" - "group-land-poof-snw" - "group-land-poof-dsn" - "group-land-poof-unk" - "group-land-poof-lav" - "group-land-poof-cwd" - "group-land-poof-grv" - "group-land-poof-drt" - "group-land-poof-mtl" - "group-land-poof-str" - "group-land-poof-pmt" - "group-land-poof-swm" - "group-land-poof-unk" - "group-land-poof-mtl" - "group-land-poof-neu" - "group-land-poof-stn" - "group-land-poof-cmt" - "group-land-poof-car" - "group-land-poof-gmt" - "group-land-poof-smt" - "group-land-poof-hwd" - "group-land-poof-sqi" - "group-land-poof-mhm" - "group-land-poof-for" - "group-land-poof-mhs" - "group-land-poof-dma" - ) - (-> arg4 material) - ) - arg1 - -1 + (let ((sv-192 arg0)) + (cond + ((string= (the-as string sv-192) "effect-walk-step-left") + (set! s1-0 (sound-name-with-material "walk" arg4 "1")) ) - ) - ((string= (the-as string sv-192) "effect-run-poof") - (do-effect - this - (-> (new 'static 'boxed-array :type string - "group-run-poof-unk" - "group-run-poof-ice" - "group-run-poof-qsd" - "group-run-poof-wtr" - "group-run-poof-tar" - "group-run-poof-san" - "group-run-poof-wod" - "group-run-poof-grs" - "group-run-poof-pmt" - "group-run-poof-snw" - "group-run-poof-dsn" - "group-run-poof-unk" - "group-run-poof-lav" - "group-run-poof-cwd" - "group-run-poof-grv" - "group-run-poof-drt" - "group-run-poof-mtl" - "group-run-poof-str" - "group-run-poof-pmt" - "group-run-poof-swm" - "group-run-poof-unk" - "group-run-poof-mtl" - "group-run-poof-neu" - "group-run-poof-stn" - "group-run-poof-cmt" - "group-run-poof-car" - "group-run-poof-gmt" - "group-run-poof-smt" - "group-run-poof-hwd" - "group-run-poof-sqi" - "group-run-poof-mhm" - "group-run-poof-for" - "group-run-poof-mhs" - "group-run-poof-dma" - ) - (-> arg4 material) - ) - arg1 - -1 + ((string= (the-as string sv-192) "effect-run-step-left") + (set! s1-0 (sound-name-with-material "run" arg4 "1")) ) - ) - ((string= (the-as string sv-192) "effect-just-footprint") - (do-effect - this - (-> (new 'static 'boxed-array :type string - "group-just-footprint-unk" - "group-just-footprint-ice" - "group-just-footprint-qsd" - "group-just-footprint-wtr" - "group-just-footprint-tar" - "group-just-footprint-san" - "group-just-footprint-wod" - "group-just-footprint-grs" - "group-just-footprint-pmt" - "group-just-footprint-snw" - "group-just-footprint-dsn" - "group-just-footprint-unk" - "group-just-footprint-lav" - "group-just-footprint-cwd" - "group-just-footprint-grv" - "group-just-footprint-drt" - "group-just-footprint-mtl" - "group-just-footprint-str" - "group-just-footprint-pmt" - "group-just-footprint-swm" - "group-just-footprint-unk" - "group-just-footprint-mtl" - "group-just-footprint-neu" - "group-just-footprint-stn" - "group-just-footprint-cmt" - "group-just-footprint-car" - "group-just-footprint-gmt" - "group-just-footprint-smt" - "group-just-footprint-hwd" - "group-just-footprint-sqi" - "group-just-footprint-mhm" - "group-just-footprint-for" - "group-just-footprint-mhs" - "group-just-footprint-dma" - ) - (-> arg4 material) - ) - arg1 - -1 + ((string= (the-as string sv-192) "effect-mech-step-left") + (set! s1-0 (sound-name-with-material "mwlk" arg4 "1")) ) - ) - ((string= (the-as string sv-192) "effect-just-poof") - (do-effect - this - (-> (new 'static 'boxed-array :type string - "group-just-poof-unk" - "group-just-poof-ice" - "group-just-poof-qsd" - "group-just-poof-wtr" - "group-just-poof-tar" - "group-just-poof-san" - "group-just-poof-wod" - "group-just-poof-grs" - "group-just-poof-pmt" - "group-just-poof-snw" - "group-just-poof-dsn" - "group-just-poof-unk" - "group-just-poof-lav" - "group-just-poof-cwd" - "group-just-poof-grv" - "group-just-poof-drt" - "group-just-poof-mtl" - "group-just-poof-str" - "group-just-poof-pmt" - "group-just-poof-swm" - "group-just-poof-unk" - "group-just-poof-mtl" - "group-just-poof-neu" - "group-just-poof-stn" - "group-just-poof-cmt" - "group-just-poof-car" - "group-just-poof-gmt" - "group-just-poof-smt" - "group-just-poof-hwd" - "group-just-poof-sqi" - "group-just-poof-mhm" - "group-just-poof-for" - "group-just-poof-mhs" - "group-just-poof-dma" - ) - (-> arg4 material) - ) - arg1 - -1 + ((string= (the-as string sv-192) "effect-walk-step-right") + (set! s1-0 (sound-name-with-material "walk" arg4 "2")) ) - ) - ((string= (the-as string sv-192) "effect-slide-poof") - (do-effect - this - (-> (new 'static 'boxed-array :type string - "group-slide-poof-unk" - "group-slide-poof-ice" - "group-slide-poof-qsd" - "group-slide-poof-wtr" - "group-slide-poof-tar" - "group-slide-poof-san" - "group-slide-poof-wod" - "group-slide-poof-grs" - "group-slide-poof-pmt" - "group-slide-poof-snw" - "group-slide-poof-dsn" - "group-slide-poof-unk" - "group-slide-poof-lav" - "group-slide-poof-cwd" - "group-slide-poof-grv" - "group-slide-poof-drt" - "group-slide-poof-mtl" - "group-slide-poof-str" - "group-slide-poof-pmt" - "group-slide-poof-swm" - "group-slide-poof-unk" - "group-slide-poof-mtl" - "group-slide-poof-neu" - "group-slide-poof-stn" - "group-slide-poof-cmt" - "group-slide-poof-car" - "group-slide-poof-gmt" - "group-slide-poof-smt" - "group-slide-poof-hwd" - "group-slide-poof-sqi" - "group-slide-poof-mhm" - "group-slide-poof-for" - "group-slide-poof-mhs" - "group-slide-poof-dma" - ) - (-> arg4 material) - ) - arg1 - -1 + ((string= (the-as string sv-192) "effect-run-step-right") + (set! s1-0 (sound-name-with-material "run" arg4 "2")) ) - ) - ((string= (the-as string sv-192) "effect-droppings") - (let ((s0-1 (-> *part-id-table* (-> (new 'static 'boxed-array :type uint32 - #x8e - #x2a9 - #x2aa - #x2ab - #x2ac - #x75 - #x8b - #x77 - #x2ad - #x79 - #x2ae - #x8e - #x2af - #x8d - #x2b0 - #x76 - #x2b1 - #x2b2 - #x2ad - #x2b3 - #x8e - #x2b1 - #x2b4 - #x8c - #x2b5 - #x2b6 - #x2b7 - #x2b8 - #x2b9 - #x2ba - #x2bb - #x78 - #x2bc - #x2bd - ) - (-> arg4 material) - ) - ) - ) - ) - (when (nonzero? s0-1) - (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-80 (-> (vector<-cspace! (new 'stack-no-clear 'vector) (-> this process node-list data arg2)) quad))) - (set! (-> sv-96 quad) v1-80) - ) - (let ((a3-6 #f) - (t0-1 #f) - (t1-1 1.0) + ((string= (the-as string sv-192) "effect-mech-step-right") + (set! s1-0 (sound-name-with-material "mwlk" arg4 "2")) + ) + ((string= (the-as string sv-192) "effect-roll") + (set! s1-0 (sound-name-with-material "roll" arg4 "")) + ) + ((string= (the-as string sv-192) "effect-slide") + (set! s1-0 (sound-name-with-material "slide" arg4 "")) + ) + ((string= (the-as string sv-192) "effect-land") + (set! s1-0 (sound-name-with-material "land" arg4 "")) + ) + ((string= (the-as string sv-192) "effect-zoom-land") + (set! s1-0 (sound-name-with-material "zoom-land" arg4 "")) + ) + ((string= (the-as string sv-192) "effect-zoom-hit") + (set! s1-0 (sound-name-with-material "zoom-hit" arg4 "")) + ) + ((string= (the-as string sv-192) "effect-flut-land") + (set! s1-0 (sound-name-with-material "flut-land" arg4 "")) + ) + ((string= (the-as string sv-192) "effect-land-poof") + (do-effect + this + (-> (new 'static 'boxed-array :type string + "group-land-poof-unk" + "group-land-poof-ice" + "group-land-poof-qsd" + "group-land-poof-wtr" + "group-land-poof-tar" + "group-land-poof-san" + "group-land-poof-wod" + "group-land-poof-grs" + "group-land-poof-pmt" + "group-land-poof-snw" + "group-land-poof-dsn" + "group-land-poof-unk" + "group-land-poof-lav" + "group-land-poof-cwd" + "group-land-poof-grv" + "group-land-poof-drt" + "group-land-poof-mtl" + "group-land-poof-str" + "group-land-poof-pmt" + "group-land-poof-swm" + "group-land-poof-unk" + "group-land-poof-mtl" + "group-land-poof-neu" + "group-land-poof-stn" + "group-land-poof-cmt" + "group-land-poof-car" + "group-land-poof-gmt" + "group-land-poof-smt" + "group-land-poof-hwd" + "group-land-poof-sqi" + "group-land-poof-mhm" + "group-land-poof-for" + "group-land-poof-mhs" + "group-land-poof-dma" ) - (sv-64 sv-80 s0-1 sv-112 (the-as sparticle-launch-state a3-6) (the-as sparticle-launch-control t0-1) t1-1) + (-> arg4 material) + ) + arg1 + -1 + ) + ) + ((string= (the-as string sv-192) "effect-run-poof") + (do-effect + this + (-> (new 'static 'boxed-array :type string + "group-run-poof-unk" + "group-run-poof-ice" + "group-run-poof-qsd" + "group-run-poof-wtr" + "group-run-poof-tar" + "group-run-poof-san" + "group-run-poof-wod" + "group-run-poof-grs" + "group-run-poof-pmt" + "group-run-poof-snw" + "group-run-poof-dsn" + "group-run-poof-unk" + "group-run-poof-lav" + "group-run-poof-cwd" + "group-run-poof-grv" + "group-run-poof-drt" + "group-run-poof-mtl" + "group-run-poof-str" + "group-run-poof-pmt" + "group-run-poof-swm" + "group-run-poof-unk" + "group-run-poof-mtl" + "group-run-poof-neu" + "group-run-poof-stn" + "group-run-poof-cmt" + "group-run-poof-car" + "group-run-poof-gmt" + "group-run-poof-smt" + "group-run-poof-hwd" + "group-run-poof-sqi" + "group-run-poof-mhm" + "group-run-poof-for" + "group-run-poof-mhs" + "group-run-poof-dma" + ) + (-> arg4 material) + ) + arg1 + -1 + ) + ) + ((string= (the-as string sv-192) "effect-just-footprint") + (do-effect + this + (-> (new 'static 'boxed-array :type string + "group-just-footprint-unk" + "group-just-footprint-ice" + "group-just-footprint-qsd" + "group-just-footprint-wtr" + "group-just-footprint-tar" + "group-just-footprint-san" + "group-just-footprint-wod" + "group-just-footprint-grs" + "group-just-footprint-pmt" + "group-just-footprint-snw" + "group-just-footprint-dsn" + "group-just-footprint-unk" + "group-just-footprint-lav" + "group-just-footprint-cwd" + "group-just-footprint-grv" + "group-just-footprint-drt" + "group-just-footprint-mtl" + "group-just-footprint-str" + "group-just-footprint-pmt" + "group-just-footprint-swm" + "group-just-footprint-unk" + "group-just-footprint-mtl" + "group-just-footprint-neu" + "group-just-footprint-stn" + "group-just-footprint-cmt" + "group-just-footprint-car" + "group-just-footprint-gmt" + "group-just-footprint-smt" + "group-just-footprint-hwd" + "group-just-footprint-sqi" + "group-just-footprint-mhm" + "group-just-footprint-for" + "group-just-footprint-mhs" + "group-just-footprint-dma" + ) + (-> arg4 material) + ) + arg1 + -1 + ) + ) + ((string= (the-as string sv-192) "effect-just-poof") + (do-effect + this + (-> (new 'static 'boxed-array :type string + "group-just-poof-unk" + "group-just-poof-ice" + "group-just-poof-qsd" + "group-just-poof-wtr" + "group-just-poof-tar" + "group-just-poof-san" + "group-just-poof-wod" + "group-just-poof-grs" + "group-just-poof-pmt" + "group-just-poof-snw" + "group-just-poof-dsn" + "group-just-poof-unk" + "group-just-poof-lav" + "group-just-poof-cwd" + "group-just-poof-grv" + "group-just-poof-drt" + "group-just-poof-mtl" + "group-just-poof-str" + "group-just-poof-pmt" + "group-just-poof-swm" + "group-just-poof-unk" + "group-just-poof-mtl" + "group-just-poof-neu" + "group-just-poof-stn" + "group-just-poof-cmt" + "group-just-poof-car" + "group-just-poof-gmt" + "group-just-poof-smt" + "group-just-poof-hwd" + "group-just-poof-sqi" + "group-just-poof-mhm" + "group-just-poof-for" + "group-just-poof-mhs" + "group-just-poof-dma" + ) + (-> arg4 material) + ) + arg1 + -1 + ) + ) + ((string= (the-as string sv-192) "effect-slide-poof") + (do-effect + this + (-> (new 'static 'boxed-array :type string + "group-slide-poof-unk" + "group-slide-poof-ice" + "group-slide-poof-qsd" + "group-slide-poof-wtr" + "group-slide-poof-tar" + "group-slide-poof-san" + "group-slide-poof-wod" + "group-slide-poof-grs" + "group-slide-poof-pmt" + "group-slide-poof-snw" + "group-slide-poof-dsn" + "group-slide-poof-unk" + "group-slide-poof-lav" + "group-slide-poof-cwd" + "group-slide-poof-grv" + "group-slide-poof-drt" + "group-slide-poof-mtl" + "group-slide-poof-str" + "group-slide-poof-pmt" + "group-slide-poof-swm" + "group-slide-poof-unk" + "group-slide-poof-mtl" + "group-slide-poof-neu" + "group-slide-poof-stn" + "group-slide-poof-cmt" + "group-slide-poof-car" + "group-slide-poof-gmt" + "group-slide-poof-smt" + "group-slide-poof-hwd" + "group-slide-poof-sqi" + "group-slide-poof-mhm" + "group-slide-poof-for" + "group-slide-poof-mhs" + "group-slide-poof-dma" + ) + (-> arg4 material) + ) + arg1 + -1 + ) + ) + ((string= (the-as string sv-192) "effect-droppings") + (let ((s0-1 (-> *part-id-table* (-> (new 'static 'boxed-array :type uint32 + #x8e + #x2a9 + #x2aa + #x2ab + #x2ac + #x75 + #x8b + #x77 + #x2ad + #x79 + #x2ae + #x8e + #x2af + #x8d + #x2b0 + #x76 + #x2b1 + #x2b2 + #x2ad + #x2b3 + #x8e + #x2b1 + #x2b4 + #x8c + #x2b5 + #x2b6 + #x2b7 + #x2b8 + #x2b9 + #x2ba + #x2bb + #x78 + #x2bc + #x2bd + ) + (-> arg4 material) + ) + ) + ) + ) + (when (nonzero? s0-1) + (let ((sv-64 sp-launch-particles-var) + (sv-80 *sp-particle-system-2d*) + (sv-112 *launch-matrix*) + ) + (vector-copy! + (-> sv-112 trans) + (vector<-cspace! (new 'stack-no-clear 'vector) (-> this process node-list data arg2)) + ) + (sv-64 sv-80 s0-1 sv-112 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0) + ) ) ) ) - ) - ((string= (the-as string sv-192) "effect-jump-droppings") - (let ((s0-2 (-> *part-id-table* (-> (new 'static 'boxed-array :type uint32 - #x2be - #x2bf - #x2c0 - #x2c1 - #x2c2 - #x86 - #x2c3 - #x89 - #x2c4 - #x88 - #x2c5 - #x2be - #x2c6 - #x2c7 - #x2c8 - #x87 - #x2c9 - #x2ca - #x2c4 - #x2cb - #x2be - #x2c9 - #x2cc - #x2cd - #x2ce - #x2cf - #x2d0 - #x2d1 - #x2d2 - #x2d3 - #x2d4 - #x8a - #x2d5 - #x2d6 + ((string= (the-as string sv-192) "effect-jump-droppings") + (let ((s0-2 (-> *part-id-table* (-> (new 'static 'boxed-array :type uint32 + #x2be + #x2bf + #x2c0 + #x2c1 + #x2c2 + #x86 + #x2c3 + #x89 + #x2c4 + #x88 + #x2c5 + #x2be + #x2c6 + #x2c7 + #x2c8 + #x87 + #x2c9 + #x2ca + #x2c4 + #x2cb + #x2be + #x2c9 + #x2cc + #x2cd + #x2ce + #x2cf + #x2d0 + #x2d1 + #x2d2 + #x2d3 + #x2d4 + #x8a + #x2d5 + #x2d6 + ) + (-> arg4 material) ) - (-> arg4 material) - ) - ) + ) + ) + ) + (when (nonzero? s0-2) + (let ((sv-128 sp-launch-particles-var) + (sv-144 *sp-particle-system-2d*) + (sv-176 *launch-matrix*) ) - ) - (when (nonzero? s0-2) - (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-97 (-> (vector<-cspace! (new 'stack-no-clear 'vector) (-> this process node-list data arg2)) quad))) - (set! (-> sv-160 quad) v1-97) - ) - (let ((a3-7 #f) - (t0-2 #f) - (t1-2 1.0) + (vector-copy! + (-> sv-176 trans) + (vector<-cspace! (new 'stack-no-clear 'vector) (-> this process node-list data arg2)) ) - (sv-128 sv-144 s0-2 sv-176 (the-as sparticle-launch-state a3-7) (the-as sparticle-launch-control t0-2) t1-2) + (sv-128 sv-144 s0-2 sv-176 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0) + ) ) ) ) - ) - ((let ((t9-40 string=) - (a1-45 "effect-board-poof") - ) - (t9-40 (the-as string sv-192) a1-45) - ) - (let ((s0-3 (-> *part-id-table* (-> (new 'static 'boxed-array :type uint32 - #x2d7 - #x2d8 - #x2d9 - #x2da - #x2db - #x2dc - #x2dd - #x2de - #x2df - #x2e0 - #x2e1 - #x2d7 - #x2e2 - #x2e3 - #x2e4 - #x2e5 - #x2e6 - #x2e7 - #x2df - #x2e8 - #x2d7 - #x2e6 - #x2e9 - #x2a2 - #x2ea - #x2eb - #x2ec - #x2ed - #x2ee - #x2ef - #x2f0 - #x2f1 - #x2f2 - #x2f3 + ((string= (the-as string sv-192) "effect-board-poof") + (let ((s0-3 (-> *part-id-table* (-> (new 'static 'boxed-array :type uint32 + #x2d7 + #x2d8 + #x2d9 + #x2da + #x2db + #x2dc + #x2dd + #x2de + #x2df + #x2e0 + #x2e1 + #x2d7 + #x2e2 + #x2e3 + #x2e4 + #x2e5 + #x2e6 + #x2e7 + #x2df + #x2e8 + #x2d7 + #x2e6 + #x2e9 + #x2a2 + #x2ea + #x2eb + #x2ec + #x2ed + #x2ee + #x2ef + #x2f0 + #x2f1 + #x2f2 + #x2f3 + ) + (-> arg4 material) ) - (-> arg4 material) - ) - ) + ) + ) + ) + (when (nonzero? s0-3) + (let ((sv-208 sp-launch-particles-var) + (sv-224 *sp-particle-system-2d*) + (sv-256 *launch-matrix*) ) - ) - (when (nonzero? s0-3) - (set! sv-208 sp-launch-particles-var) - (set! sv-224 *sp-particle-system-2d*) - (set! sv-256 *launch-matrix*) - (set! sv-240 (-> sv-256 trans)) - (let ((v1-114 (-> (vector<-cspace! (new 'stack-no-clear 'vector) (-> this process node-list data arg2)) quad))) - (set! (-> sv-240 quad) v1-114) - ) - (let ((a3-8 #f) - (t0-3 #f) - (t1-3 1.0) + (vector-copy! + (-> sv-256 trans) + (vector<-cspace! (new 'stack-no-clear 'vector) (-> this process node-list data arg2)) ) - (sv-208 sv-224 s0-3 sv-256 (the-as sparticle-launch-state a3-8) (the-as sparticle-launch-control t0-3) t1-3) + (sv-208 sv-224 s0-3 sv-256 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0) + ) ) ) ) - ) + ) ) (if s1-0 (play-effect-sound this arg0 arg1 arg2 arg3 s1-0) @@ -957,9 +922,8 @@ ) (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) @@ -971,15 +935,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 @@ -1004,22 +970,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 ~S (~S) frame ~F joint ~D " diff --git a/goal_src/jak3/engine/game/fact-h.gc b/goal_src/jak3/engine/game/fact-h.gc index 7436ff1391..0e5149645f 100644 --- a/goal_src/jak3/engine/game/fact-h.gc +++ b/goal_src/jak3/engine/game/fact-h.gc @@ -457,51 +457,53 @@ ;; 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) ) (defmethod pickup-collectable! ((this fact-info) (arg0 pickup-type) (arg1 float) (arg2 handle)) @@ -521,7 +523,6 @@ ) (defmethod new fact-info-enemy ((allocation symbol) (type-to-make type) (arg0 process) (arg1 (pointer float))) - (local-vars (sv-16 res-tag) (sv-32 res-tag)) (let ((gp-0 (the-as fact-info-enemy @@ -539,8 +540,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)) @@ -563,8 +565,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/goal_src/jak3/engine/game/game-info.gc b/goal_src/jak3/engine/game/game-info.gc index 4563f51cd3..00d11f9e15 100644 --- a/goal_src/jak3/engine/game/game-info.gc +++ b/goal_src/jak3/engine/game/game-info.gc @@ -402,13 +402,6 @@ ) (defmethod initialize! ((this game-info) (mode symbol) (arg2 game-save) (continue-name string) (reset-spec resetter-spec)) - (local-vars - (sv-96 process) - (sv-112 process-tree) - (sv-128 cpu-thread) - (sv-144 (function symbol symbol continue-point game-save resetter-spec none :behavior process)) - (sv-160 symbol) - ) (when reset-spec (if (not continue-name) (set! continue-name (-> reset-spec continue)) @@ -646,57 +639,46 @@ (v1-149 (when s1-2 (let ((s0-1 (method-of-type process activate))) - (set! sv-96 s1-2) - (set! sv-112 *default-pool*) - (let ((a2-12 (symbol->string (-> process symbol))) - (a3-5 #x70004000) - (t9-30 s0-1) - ) - (t9-30 sv-96 sv-112 a2-12 (the-as pointer a3-5)) - ) + (s0-1 s1-2 *default-pool* (symbol->string (-> process symbol)) (the-as pointer #x70004000)) ) - (let ((s0-2 set-to-run)) - (set! sv-128 (-> s1-2 main-thread)) - (set! sv-144 (lambda :behavior process - ((arg0 symbol) (arg1 symbol) (arg2 continue-point) (arg3 game-save) (arg4 resetter-spec)) - (set! (-> self mask) (process-mask)) - (stop arg0) - (reset-actors arg1) - (open! (-> *game-info* sub-task-list (game-task-node city-start-start)) 'event) - (if (and arg4 (nonzero? (-> arg4 node))) - (task-node-open! (-> arg4 node) 'event) - ) - (set-continue! *game-info* arg2 #t) - (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) - ) - ) - (set! sv-160 (-> this mode)) - (let ((t0-4 (if (the-as basic continue-name) - (the-as basic continue-name) - (get-current-continue-forced this) + (let ((s0-2 set-to-run) + (sv-128 (-> s1-2 main-thread)) + (sv-144 (lambda :behavior process + ((arg0 symbol) (arg1 symbol) (arg2 continue-point) (arg3 game-save) (arg4 resetter-spec)) + (set! (-> self mask) (process-mask)) + (stop arg0) + (reset-actors arg1) + (open! (-> *game-info* sub-task-list (game-task-node city-start-start)) 'event) + (if (and arg4 (nonzero? (-> arg4 node))) + (task-node-open! (-> arg4 node) 'event) + ) + (set-continue! *game-info* arg2 #t) + (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) + ) ) - (t1-3 arg2) - (t2-0 reset-spec) - ) - ((the-as (function cpu-thread function symbol symbol continue-point game-save resetter-spec none) s0-2) - sv-128 - sv-144 - sv-160 - mode - (the-as continue-point t0-4) - t1-3 - t2-0 - ) - ) + (sv-160 (-> this mode)) + ) + ((the-as (function cpu-thread function symbol symbol continue-point game-save resetter-spec none) s0-2) + sv-128 + sv-144 + sv-160 + mode + (the-as continue-point (if (the-as basic continue-name) + (the-as basic continue-name) + (get-current-continue-forced this) + ) + ) + arg2 + reset-spec + ) ) (-> s1-2 ppointer) ) @@ -919,7 +901,6 @@ ) (defmethod pickup-collectable! ((this fact-info-target) (pickup pickup-type) (amount float) (pickup-handle handle)) - (local-vars (sv-112 vector) (sv-128 matrix)) (case pickup (((pickup-type health)) (cond @@ -1040,18 +1021,13 @@ (s2-3 sp-launch-particles-var) (s1-0 *sp-particle-system-2d*) (s0-0 (-> *part-id-table* 1)) + (sv-128 *launch-matrix*) ) - (set! sv-128 *launch-matrix*) - (set! sv-112 (-> sv-128 trans)) - (let ((v1-122 (-> (vector<-cspace! (new 'stack-no-clear 'vector) (-> this process node-list data v0-21)) quad))) - (set! (-> sv-112 quad) v1-122) - ) - (let ((a3-13 #f) - (t0-4 #f) - (t1-4 1.0) - ) - (s2-3 s1-0 s0-0 sv-128 (the-as sparticle-launch-state a3-13) (the-as sparticle-launch-control t0-4) t1-4) + (vector-copy! + (-> sv-128 trans) + (vector<-cspace! (new 'stack-no-clear 'vector) (-> this process node-list data v0-21)) ) + (s2-3 s1-0 s0-0 sv-128 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0) ) ) (sound-play "get-light-eco") @@ -1632,18 +1608,7 @@ ) (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:~%") @@ -1654,48 +1619,50 @@ ) (while (>= (the-as uint game-task-max) (the-as uint game-task)) (when (task-complete? this (the-as game-task game-task)) - (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 ((subtask (-> game-subtasks i))) - (when (= (-> subtask task) game-task) - (when (zero? sv-24) - (set! sv-24 (the-as int (-> subtask close-time))) - (set! sv-16 (the-as int (-> subtask close-time))) - ) - (when (logtest? (-> subtask flags) (game-task-node-flag closed)) - (set! sv-32 (the-as int (-> subtask close-time))) - (set! sv-40 (the-as int (-> subtask gem-count))) - (set! sv-48 (the-as int (-> subtask skill-count))) - ) - (set! sv-56 (+ sv-56 (-> subtask death-count))) - (if (logtest? (-> subtask 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 ((subtask (-> game-subtasks i))) + (when (= (-> subtask task) game-task) + (when (zero? sv-24) + (set! sv-24 (the-as int (-> subtask close-time))) + (set! sv-16 (the-as int (-> subtask close-time))) ) + (when (logtest? (-> subtask flags) (game-task-node-flag closed)) + (set! sv-32 (the-as int (-> subtask close-time))) + (set! sv-40 (the-as int (-> subtask gem-count))) + (set! sv-48 (the-as int (-> subtask skill-count))) + ) + (+! sv-56 (-> subtask death-count)) + (if (logtest? (-> subtask flags) (game-task-node-flag close-task)) + (goto cfg-19) + ) + ) ) ) ) ) - ) - (label cfg-19) - (if (nonzero? (-> this task-start-time game-task)) - (set! sv-24 (max sv-24 (-> this task-start-time game-task))) + (label cfg-19) + (if (nonzero? (-> this task-start-time game-task)) + (set! sv-24 (max sv-24 (-> this task-start-time game-task))) + ) + (format + #t + "~T~T~-32S ~6,,1f min ~6,,1f min ~3d ~3d ~3d~%" + (game-task->string (the-as game-task game-task)) + (* 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 game-task)) - (* 0.000055555556 (the float (- sv-24 sv-16))) - (* 0.000055555556 (the float (- sv-32 sv-24))) - sv-56 - sv-40 - sv-48 ) ) (+! game-task 1) @@ -1706,30 +1673,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") - ) - ((game-task-node-info-method-12 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 + ) + ((game-task-node-info-method-12 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/goal_src/jak3/engine/game/game-save.gc b/goal_src/jak3/engine/game/game-save.gc index b318aff2b3..84b0330ca5 100644 --- a/goal_src/jak3/engine/game/game-save.gc +++ b/goal_src/jak3/engine/game/game-save.gc @@ -114,6 +114,7 @@ ;; DECOMP BEGINS +;; og:preserve-this made non-debug (defun game-save-elt->string ((arg0 game-save-elt)) (case arg0 (((game-save-elt video-mode)) @@ -468,7 +469,6 @@ ) (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)) @@ -494,19 +494,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-4 (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-4 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))) @@ -518,31 +514,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-5 (-> (the-as (inline-array game-save-tag) s4-0) 1 user-uint16 s2-1)) - ) - (s1-1 s0-1 sv-32 a2-15 a3-5) - ) + (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-6 - (-> (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-6) - ) + (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/goal_src/jak3/engine/game/task/task-arrow.gc b/goal_src/jak3/engine/game/task/task-arrow.gc index 0d601f8f6c..be56eac341 100644 --- a/goal_src/jak3/engine/game/task/task-arrow.gc +++ b/goal_src/jak3/engine/game/task/task-arrow.gc @@ -153,18 +153,16 @@ (when (< (-> this rod-of-god-scale) 0.0) (set! (-> this rod-of-god-scale) 0.0) (set! (-> this moving) #f) - (let ((f0-26 81920.0)) - (cond - ((< (* f0-26 f0-26) (vector-vector-xz-distance-squared (-> this pos) (-> this root trans))) - (kill-callback (-> *minimap* engine) (-> this minimap)) - (vector-copy! (-> this root trans) (-> this pos)) - (if (not (logtest? (-> this flags) (task-arrow-flags taf5))) - (set! (-> this minimap) (add-icon! *minimap* this (-> this map-icon) (the-as int #f) (the-as vector #t) 0)) - ) - ) - (else - (vector-copy! (-> this root trans) (-> this pos)) - ) + (cond + ((< (square 81920.0) (vector-vector-xz-distance-squared (-> this pos) (-> this root trans))) + (kill-callback (-> *minimap* engine) (-> this minimap)) + (vector-copy! (-> this root trans) (-> this pos)) + (if (not (logtest? (-> this flags) (task-arrow-flags taf5))) + (set! (-> this minimap) (add-icon! *minimap* this (-> this map-icon) (the-as int #f) (the-as vector #t) 0)) + ) + ) + (else + (vector-copy! (-> this root trans) (-> this pos)) ) ) ) @@ -243,12 +241,10 @@ (if (logtest? (-> self flags) (task-arrow-flags taf3)) (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/goal_src/jak3/engine/game/task/task-control.gc b/goal_src/jak3/engine/game/task/task-control.gc index b82b3efb8e..fcb9eedf79 100644 --- a/goal_src/jak3/engine/game/task/task-control.gc +++ b/goal_src/jak3/engine/game/task/task-control.gc @@ -85,7 +85,7 @@ ) (defun update-task-masks ((arg0 symbol)) - (local-vars (a3-2 symbol) (sv-176 game-task-event)) + (local-vars (a3-2 symbol)) (if (= arg0 'none) (return 0) ) @@ -261,38 +261,39 @@ (let ((s0-0 (-> s1-0 when-open length))) (while (begin (label cfg-75) (nonzero? s0-0)) (+! s0-0 -1) - (set! sv-176 (-> s1-0 when-open s0-0)) - (case (-> sv-176 actor) - (((game-task-actor minimap)) - (if (not (minimap-class-node-method-9 (-> *minimap-class-list* (-> sv-176 icon)))) - (goto cfg-75) - ) - (let ((v1-89 (add-icon! *minimap* *dproc* (-> sv-176 icon) (the-as int (-> sv-176 icon)) (the-as vector #f) s2-0))) - (when v1-89 - (logior! (-> v1-89 flags) (minimap-flag task-graph)) - (cond - ((and (logtest? (minimap-flag ctywide) (-> v1-89 class flags)) - (logtest? (minimap-flag transport) (-> v1-89 class flags)) - ) - (let ((v1-91 (add-icon! *minimap* *dproc* (the-as uint 21) 21 (the-as vector #f) s2-0))) - (if v1-91 - (logior! (-> v1-91 flags) (minimap-flag task-graph)) - ) + (let ((sv-176 (-> s1-0 when-open s0-0))) + (case (-> sv-176 actor) + (((game-task-actor minimap)) + (if (not (minimap-class-node-method-9 (-> *minimap-class-list* (-> sv-176 icon)))) + (goto cfg-75) + ) + (let ((v1-89 (add-icon! *minimap* *dproc* (-> sv-176 icon) (the-as int (-> sv-176 icon)) (the-as vector #f) s2-0))) + (when v1-89 + (logior! (-> v1-89 flags) (minimap-flag task-graph)) + (cond + ((and (logtest? (minimap-flag ctywide) (-> v1-89 class flags)) + (logtest? (minimap-flag transport) (-> v1-89 class flags)) + ) + (let ((v1-91 (add-icon! *minimap* *dproc* (the-as uint 21) 21 (the-as vector #f) s2-0))) + (if v1-91 + (logior! (-> v1-91 flags) (minimap-flag task-graph)) + ) + ) ) - ) - ((and (logtest? (minimap-flag wasall waswide desert) (-> v1-89 class flags)) - (logtest? (minimap-flag transport) (-> v1-89 class flags)) - ) - (let ((v1-96 (add-icon! *minimap* *dproc* (the-as uint 18) 18 (the-as vector #f) s2-0))) - (if v1-96 - (logior! (-> v1-96 flags) (minimap-flag task-graph)) - ) + ((and (logtest? (minimap-flag wasall waswide desert) (-> v1-89 class flags)) + (logtest? (minimap-flag transport) (-> v1-89 class flags)) + ) + (let ((v1-96 (add-icon! *minimap* *dproc* (the-as uint 18) 18 (the-as vector #f) s2-0))) + (if v1-96 + (logior! (-> v1-96 flags) (minimap-flag task-graph)) + ) + ) ) - ) + ) ) ) ) - ) + ) ) ) ) diff --git a/goal_src/jak3/engine/geometry/geometry.gc b/goal_src/jak3/engine/geometry/geometry.gc index 92257f5544..9397e41970 100644 --- a/goal_src/jak3/engine/geometry/geometry.gc +++ b/goal_src/jak3/engine/geometry/geometry.gc @@ -279,11 +279,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))) ) ) @@ -299,7 +295,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)) ) ) ) @@ -539,9 +535,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) ) @@ -554,21 +548,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) ) - ) ) ) @@ -631,21 +614,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) ) - ) ) ) @@ -659,13 +631,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) ) ) ) @@ -772,7 +739,6 @@ (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) (vector-copy! arg0 arg1) @@ -786,15 +752,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) ) ) ) @@ -1461,9 +1423,8 @@ (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/goal_src/jak3/engine/geometry/path-h.gc b/goal_src/jak3/engine/geometry/path-h.gc index c0df5d2cde..14e272e4fe 100644 --- a/goal_src/jak3/engine/geometry/path-h.gc +++ b/goal_src/jak3/engine/geometry/path-h.gc @@ -80,9 +80,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) @@ -96,14 +96,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/goal_src/jak3/engine/geometry/path.gc b/goal_src/jak3/engine/geometry/path.gc index e5a28528cd..b225591878 100644 --- a/goal_src/jak3/engine/geometry/path.gc +++ b/goal_src/jak3/engine/geometry/path.gc @@ -337,90 +337,79 @@ ) (defmethod path-control-method-28 ((this path-control) (arg0 vector) (arg1 vector) (arg2 symbol)) - (local-vars - (sv-96 vector) - (sv-100 vector) - (sv-104 vector) - (sv-108 vector) - (sv-112 number) - (sv-116 vector) - (sv-120 symbol) - (sv-124 float) - ) - (set! sv-96 (new 'stack-no-clear 'vector)) - (set! sv-100 (new 'stack-no-clear 'vector)) - (set! sv-104 (new 'stack-no-clear 'vector)) - (set! sv-108 (new 'stack-no-clear 'vector)) - (set! sv-112 -1.0) - (set! sv-116 (new 'stack-no-clear 'vector)) - (set! sv-120 (the-as symbol #f)) - (set! sv-124 (the-as float -1.0)) - (get-point-in-path! this sv-96 0.0 'interp) - ;; og:preserve-this - (set! sv-112 (the-as float #x7f800000)) - (when (not arg2) - (set! sv-124 (path-control-method-22 this arg0)) - (get-point-in-path! this sv-108 sv-124 'interp) - (set! sv-112 (vector-vector-distance-squared sv-108 arg0)) - ) - (let ((s3-1 (new 'stack-no-clear 'vector))) - (vector+! s3-1 arg0 arg1) - (dotimes (s2-0 (+ (-> this curve num-cverts) -1)) - (get-point-in-path! this sv-100 (the float (+ s2-0 1)) 'interp) - (vector-! sv-104 sv-100 sv-96) - (let ((s0-0 #f)) - 0.0 - (let ((s1-0 (new 'stack-no-clear 'vector))) - (set! (-> s1-0 x) -1.0) - (set! (-> s1-0 y) -1.0) - (line-line-find-intersection-xz arg0 arg1 sv-96 sv-104 s1-0) - (when (>= (-> s1-0 x) 0.0) - (if (and (< 0.0 (-> s1-0 y)) (>= 1.0 (-> s1-0 y))) - (set! s0-0 #t) - ) - (vector+float*! sv-116 arg0 arg1 (-> s1-0 x)) - (cond - ((and s0-0 (not sv-120)) - (vector-copy! sv-108 sv-116) - (set! sv-112 (vector-vector-distance-squared sv-116 arg0)) - (set! sv-124 (lerp (the float s2-0) (the float (+ s2-0 1)) (-> s1-0 y))) - (set! sv-120 #t) - ) - ((and s0-0 sv-120) - (let ((f0-22 (vector-vector-distance-squared sv-116 arg0))) - (when (< f0-22 (the-as float sv-112)) - (vector-copy! sv-108 sv-116) - (set! sv-112 f0-22) - (set! sv-124 (lerp (the float s2-0) (the float (+ s2-0 1)) (-> s1-0 y))) - ) + (let ((sv-96 (new 'stack-no-clear 'vector)) + (sv-100 (new 'stack-no-clear 'vector)) + (sv-104 (new 'stack-no-clear 'vector)) + (sv-108 (new 'stack-no-clear 'vector)) + (sv-112 -1.0) + (sv-116 (new 'stack-no-clear 'vector)) + (sv-120 (the-as symbol #f)) + (sv-124 (the-as float -1.0)) + ) + (get-point-in-path! this sv-96 0.0 'interp) + ;; og:preserve-this + (set! sv-112 (the-as float #x7f800000)) + (when (not arg2) + (set! sv-124 (path-control-method-22 this arg0)) + (get-point-in-path! this sv-108 sv-124 'interp) + (set! sv-112 (vector-vector-distance-squared sv-108 arg0)) + ) + (let ((s3-1 (new 'stack-no-clear 'vector))) + (vector+! s3-1 arg0 arg1) + (dotimes (s2-0 (+ (-> this curve num-cverts) -1)) + (get-point-in-path! this sv-100 (the float (+ s2-0 1)) 'interp) + (vector-! sv-104 sv-100 sv-96) + (let ((s0-0 #f)) + 0.0 + (let ((s1-0 (new 'stack-no-clear 'vector))) + (set! (-> s1-0 x) -1.0) + (set! (-> s1-0 y) -1.0) + (line-line-find-intersection-xz arg0 arg1 sv-96 sv-104 s1-0) + (when (>= (-> s1-0 x) 0.0) + (if (and (< 0.0 (-> s1-0 y)) (>= 1.0 (-> s1-0 y))) + (set! s0-0 #t) + ) + (vector+float*! sv-116 arg0 arg1 (-> s1-0 x)) + (cond + ((and s0-0 (not sv-120)) + (vector-copy! sv-108 sv-116) + (set! sv-112 (vector-vector-distance-squared sv-116 arg0)) + (set! sv-124 (lerp (the float s2-0) (the float (+ s2-0 1)) (-> s1-0 y))) + (set! sv-120 #t) ) - ) - ((not (or s0-0 sv-120)) - (let ((s0-1 (new 'stack-no-clear 'vector)) - (a3-5 (new 'stack-no-clear 'vector)) - ) - (set! (-> s1-0 y) (fmax 0.0 (fmin 1.0 (-> s1-0 y)))) - (vector+float*! s0-1 sv-96 sv-104 (-> s1-0 y)) - (let* ((f0-32 (vector-segment-distance-point! s0-1 arg0 s3-1 a3-5)) - (f0-33 (* f0-32 f0-32)) - ) - (when (< f0-33 (the-as float sv-112)) - (vector-copy! sv-108 s0-1) - (set! sv-112 f0-33) + ((and s0-0 sv-120) + (let ((f0-22 (vector-vector-distance-squared sv-116 arg0))) + (when (< f0-22 (the-as float sv-112)) + (vector-copy! sv-108 sv-116) + (set! sv-112 f0-22) (set! sv-124 (lerp (the float s2-0) (the float (+ s2-0 1)) (-> s1-0 y))) ) ) ) - ) + ((not (or s0-0 sv-120)) + (let ((s0-1 (new 'stack-no-clear 'vector)) + (a3-5 (new 'stack-no-clear 'vector)) + ) + (set! (-> s1-0 y) (fmax 0.0 (fmin 1.0 (-> s1-0 y)))) + (vector+float*! s0-1 sv-96 sv-104 (-> s1-0 y)) + (let ((f0-33 (square (vector-segment-distance-point! s0-1 arg0 s3-1 a3-5)))) + (when (< f0-33 (the-as float sv-112)) + (vector-copy! sv-108 s0-1) + (set! sv-112 f0-33) + (set! sv-124 (lerp (the float s2-0) (the float (+ s2-0 1)) (-> s1-0 y))) + ) + ) + ) + ) + ) ) ) ) + (vector-copy! sv-96 sv-100) ) - (vector-copy! sv-96 sv-100) ) + (/ sv-124 (the float (+ (-> this curve num-cverts) -1))) ) - (set! sv-124 (/ sv-124 (the float (+ (-> this curve num-cverts) -1)))) - sv-124 ) (defmethod path-control-method-29 ((this path-control) (arg0 vector) (arg1 int) (arg2 float)) diff --git a/goal_src/jak3/engine/geometry/vol.gc b/goal_src/jak3/engine/geometry/vol.gc index 1cfbb42925..5b767393d9 100644 --- a/goal_src/jak3/engine/geometry/vol.gc +++ b/goal_src/jak3/engine/geometry/vol.gc @@ -19,140 +19,143 @@ ) (defmethod plane-volume-method-9 ((this plane-volume) (arg0 symbol) (arg1 vector-array) (arg2 vector-array)) - (local-vars - (sv-144 vector) - (sv-148 float) - (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 (the-as float 0.0)) - (set! sv-152 0) - (set! sv-160 (new-stack-vector0)) - (vector-copy! sv-144 sv-224) - (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) - (vector-copy! sv-160 (-> s2-0 sv-256)) - (set! sv-148 (the-as float 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 sv-148)) - (set! sv-148 f0-6) - (set! sv-152 (+ sv-152 1)) - ) - ) - (else - (vector+float*! sv-144 sv-144 sv-192 f0-6) - (vector-copy! sv-160 (-> s2-0 sv-256)) - (set! sv-152 (+ sv-152 1)) - (if (< (fabs f0-6) (fabs sv-148)) - (set! sv-148 (- sv-148 f0-6)) - (set! sv-148 (the-as float 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 (the-as float 0.0)) + (sv-152 0) + ) + (let ((sv-160 (new-stack-vector0))) + (vector-copy! sv-144 sv-224) + (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) + (vector-copy! sv-160 (-> s2-0 sv-256)) + (set! sv-148 (the-as float 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 sv-148)) + (set! sv-148 f0-6) + (+! sv-152 1) + ) + ) + (else + (vector+float*! sv-144 sv-144 sv-192 f0-6) + (vector-copy! sv-160 (-> s2-0 sv-256)) + (+! sv-152 1) + (set! sv-148 (cond + ((< (fabs f0-6) (fabs sv-148)) + (set! sv-148 (- sv-148 f0-6)) + sv-148 + ) + (else + (the-as float 0.0) + ) + ) + ) + ) + ) + ) + ) + (+! sv-256 1) + ) + ) ) + (cond + ((zero? sv-152) + ) + ((= sv-148 0.0) + ) + (else + (dotimes (v1-75 (-> this num-planes)) + (when (and (!= v1-75 s3-0) (!= v1-75 sv-240)) + (if (< 4096.0 (- (vector-dot sv-144 (the-as vector (-> s2-0 v1-75))) (-> s2-0 v1-75 w))) + (goto cfg-42) + ) + ) + ) + (vector+float*! sv-224 sv-144 sv-192 sv-148) + (cond + ((< (-> arg1 allocated-length) (+ (-> arg1 length) 2)) + (format 0 "ERROR : vol-control #x~X out of volume points~%" this) + ) + (else + (vector-copy! (-> arg1 data (-> arg1 length)) sv-144) + (vector-copy! (-> arg1 data (+ (-> arg1 length) 1)) sv-224) + (+! (-> 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) - ) - ((= sv-148 0.0) - ) - (else - (dotimes (v1-75 (-> this num-planes)) - (when (and (!= v1-75 s3-0) (!= v1-75 sv-240)) - (if (< 4096.0 (- (vector-dot sv-144 (the-as vector (-> s2-0 v1-75))) (-> s2-0 v1-75 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 + (vector-copy! (-> arg2 data (-> arg2 length)) s1-0) + (vector-copy! (-> arg2 data (+ (-> arg2 length) 1)) (-> s2-0 s3-0)) + (+! (-> arg2 length) 2) + (set! (-> this normal-count) (+ (-> this normal-count) 2)) ) - (vector+float*! sv-224 sv-144 sv-192 sv-148) - (cond - ((< (-> arg1 allocated-length) (+ (-> arg1 length) 2)) - (format 0 "ERROR : vol-control #x~X out of volume points~%" this) - ) - (else - (vector-copy! (-> arg1 data (-> arg1 length)) sv-144) - (vector-copy! (-> arg1 data (+ (-> arg1 length) 1)) sv-224) - (+! (-> 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 - (vector-copy! (-> arg2 data (-> arg2 length)) s1-0) - (vector-copy! (-> arg2 data (+ (-> arg2 length) 1)) (-> s2-0 s3-0)) - (+! (-> arg2 length) 2) - (set! (-> this normal-count) (+ (-> this normal-count) 2)) - ) - ) ) ) ) diff --git a/goal_src/jak3/engine/gfx/background/hfrag/hfrag.gc b/goal_src/jak3/engine/gfx/background/hfrag/hfrag.gc index 4c3518d6bb..f09eab6dc9 100644 --- a/goal_src/jak3/engine/gfx/background/hfrag/hfrag.gc +++ b/goal_src/jak3/engine/gfx/background/hfrag/hfrag.gc @@ -687,60 +687,52 @@ ) (defmethod add-tri-to-collide-cache ((this hfragment) (arg0 collide-cache) (arg1 collide-query) (arg2 int) (arg3 int) (arg4 int) (arg5 int)) - (local-vars - (sv-16 uint) - (sv-24 uint) - (sv-32 uint) - (sv-40 uint) - (sv-48 int) - (sv-56 int) - (sv-64 int) - (sv-72 int) - ) (let ((v1-0 (-> this verts)) (a0-2 (+ (* arg3 512) arg2)) (s2-0 (-> this pat-array 0)) ) (when (not (logtest? (-> arg1 ignore-pat) s2-0)) (when (nonzero? (-> (the-as hfrag-vertex (-> v1-0 a0-2)) packed-index bit11)) - (set! sv-16 (-> v1-0 a0-2 height)) - (set! sv-24 (-> v1-0 (+ a0-2 1) height)) - (set! sv-32 (-> v1-0 (+ a0-2 512) height)) - (set! sv-40 (-> v1-0 (+ a0-2 513) height)) - (set! sv-48 0) - (set! sv-56 0) - (set! sv-64 0) - (set! sv-72 0) - (if (< (the-as int sv-16) arg4) - (set! sv-48 1) - ) - (if (< arg5 (the-as int sv-16)) - (set! sv-48 (logior sv-48 2)) - ) - (if (< (the-as int sv-24) arg4) - (set! sv-56 1) - ) - (if (< arg5 (the-as int sv-24)) - (set! sv-56 (logior sv-56 2)) - ) - (if (< (the-as int sv-32) arg4) - (set! sv-64 1) - ) - (if (< arg5 (the-as int sv-32)) - (set! sv-64 (logior sv-64 2)) - ) - (if (< (the-as int sv-40) arg4) - (set! sv-72 1) - ) - (if (< arg5 (the-as int sv-40)) - (set! sv-72 (logior sv-72 2)) - ) - (if (not (logtest? (logand sv-48 sv-56) sv-64)) - (add-tri-a-xy-zzz-to-collide-cache this arg0 arg2 arg3 sv-16 sv-24 sv-32 s2-0) - ) - (if (not (logtest? (logand sv-56 sv-64) sv-72)) - (add-tri-b-xy-zzz-to-collide-cache this arg0 arg2 arg3 sv-24 sv-32 sv-40 s2-0) - ) + (let ((sv-16 (-> v1-0 a0-2 height)) + (sv-24 (-> v1-0 (+ a0-2 1) height)) + (sv-32 (-> v1-0 (+ a0-2 512) height)) + (sv-40 (-> v1-0 (+ a0-2 513) height)) + (sv-48 0) + (sv-56 0) + (sv-64 0) + (sv-72 0) + ) + (if (< (the-as int sv-16) arg4) + (set! sv-48 1) + ) + (if (< arg5 (the-as int sv-16)) + (logior! sv-48 2) + ) + (if (< (the-as int sv-24) arg4) + (set! sv-56 1) + ) + (if (< arg5 (the-as int sv-24)) + (logior! sv-56 2) + ) + (if (< (the-as int sv-32) arg4) + (set! sv-64 1) + ) + (if (< arg5 (the-as int sv-32)) + (logior! sv-64 2) + ) + (if (< (the-as int sv-40) arg4) + (set! sv-72 1) + ) + (if (< arg5 (the-as int sv-40)) + (logior! sv-72 2) + ) + (if (not (logtest? (logand sv-48 sv-56) sv-64)) + (add-tri-a-xy-zzz-to-collide-cache this arg0 arg2 arg3 sv-16 sv-24 sv-32 s2-0) + ) + (if (not (logtest? (logand sv-56 sv-64) sv-72)) + (add-tri-b-xy-zzz-to-collide-cache this arg0 arg2 arg3 sv-24 sv-32 sv-40 s2-0) + ) + ) ) ) ) @@ -749,30 +741,31 @@ ) (defmethod bounding-box-query ((this hfragment) (arg0 collide-cache) (arg1 collide-query)) - (local-vars (sv-16 int) (sv-24 int) (sv-32 int) (sv-40 int) (sv-48 int) (sv-56 int)) - (set! sv-16 (the int (* 0.000030517578 (- (-> arg1 bbox min x) (-> this start-corner x))))) - (set! sv-24 (the int (* 0.000030517578 (- (-> arg1 bbox min z) (-> this start-corner z))))) - (set! sv-32 (the int (* 0.000030517578 (- (-> arg1 bbox max x) (-> this start-corner x))))) - (set! sv-40 (the int (* 0.000030517578 (- (-> arg1 bbox max z) (-> this start-corner z))))) - (set! sv-48 (the int (/ (-> arg1 bbox min y) 8))) - (set! sv-56 (the int (/ (-> arg1 bbox max y) 8))) - (set! sv-16 (max 0 (min 511 sv-16))) - (set! sv-32 (max 0 (min 511 sv-32))) - (set! sv-24 (max 0 (min 511 sv-24))) - (set! sv-40 (max 0 (min 511 sv-40))) - (let ((s3-0 sv-24) - (s2-0 sv-40) + (let ((sv-16 (the int (* 0.000030517578 (- (-> arg1 bbox min x) (-> this start-corner x))))) + (sv-24 (the int (* 0.000030517578 (- (-> arg1 bbox min z) (-> this start-corner z))))) + (sv-32 (the int (* 0.000030517578 (- (-> arg1 bbox max x) (-> this start-corner x))))) + (sv-40 (the int (* 0.000030517578 (- (-> arg1 bbox max z) (-> this start-corner z))))) + (sv-48 (the int (/ (-> arg1 bbox min y) 8))) + (sv-56 (the int (/ (-> arg1 bbox max y) 8))) ) - (while (>= s2-0 s3-0) - (let ((s1-0 sv-16) - (s0-0 sv-32) - ) - (while (>= s0-0 s1-0) - (add-tri-to-collide-cache this arg0 arg1 s1-0 s3-0 sv-48 sv-56) - (+! s1-0 1) + (set! sv-16 (max 0 (min 511 sv-16))) + (set! sv-32 (max 0 (min 511 sv-32))) + (set! sv-24 (max 0 (min 511 sv-24))) + (set! sv-40 (max 0 (min 511 sv-40))) + (let ((s3-0 sv-24) + (s2-0 sv-40) ) + (while (>= s2-0 s3-0) + (let ((s1-0 sv-16) + (s0-0 sv-32) + ) + (while (>= s0-0 s1-0) + (add-tri-to-collide-cache this arg0 arg1 s1-0 s3-0 sv-48 sv-56) + (+! s1-0 1) + ) + ) + (+! s3-0 1) ) - (+! s3-0 1) ) ) 0 @@ -791,69 +784,58 @@ (a0-36 int) (s3-0 int) (s3-2 int) - (sv-64 vector) - (sv-68 vector) - (sv-72 vector) - (sv-76 float) - (sv-80 float) - (sv-128 int) - (sv-144 int) - (sv-160 int) - (sv-176 int) - (sv-192 int) - (sv-208 int) ) - (set! sv-64 (new 'stack-no-clear 'vector)) - (set! sv-68 (new 'stack-no-clear 'vector)) - (set! sv-72 (new 'stack-no-clear 'vector)) - (set! sv-76 (the-as float 0.000030517578)) - (set! sv-80 (/ (-> arg1 radius) (meters 8))) - (vector-! sv-64 (-> arg1 start-pos) (-> this start-corner)) - (vector-float*! sv-64 sv-64 sv-76) - (vector-float*! sv-72 (-> arg1 move-dist) sv-76) - (vector+! sv-68 sv-64 sv-72) - (cond - ((< (fabs (-> sv-72 z)) (fabs (-> sv-72 x))) - (when (< (-> sv-72 x) 0.0) - (let ((v1-15 (new 'stack-no-clear 'vector))) - (vector-copy! v1-15 sv-64) - (vector-copy! sv-64 sv-68) - (vector-copy! sv-68 v1-15) - ) - (vector-negate! sv-72 sv-72) - ) - (let* ((a0-9 (the int (- (-> sv-64 x) sv-80))) - (v1-20 (the int (+ (-> sv-68 x) sv-80))) - (f0-15 (fmax 1.0 (the float (- v1-20 a0-9)))) - (f30-0 (/ (-> sv-72 y) f0-15)) - (f28-0 (/ (-> sv-72 z) f0-15)) - (f26-0 (+ sv-80 (* 0.5 (fabs f30-0)))) - (f24-0 (+ sv-80 (* 0.5 (fabs f28-0)))) - ) - (cond - ((< a0-9 0) - (+! (-> sv-64 y) (* f30-0 (- (the float a0-9)))) - (+! (-> sv-64 z) (* f28-0 (- (the float a0-9)))) - (set! s3-0 0) - ) - (else - (set! s3-0 (min 511 a0-9)) + (let ((sv-64 (new 'stack-no-clear 'vector)) + (sv-68 (new 'stack-no-clear 'vector)) + (sv-72 (new 'stack-no-clear 'vector)) + (sv-76 (the-as float 0.000030517578)) + (sv-80 (/ (-> arg1 radius) (meters 8))) + ) + (vector-! sv-64 (-> arg1 start-pos) (-> this start-corner)) + (vector-float*! sv-64 sv-64 sv-76) + (vector-float*! sv-72 (-> arg1 move-dist) sv-76) + (vector+! sv-68 sv-64 sv-72) + (cond + ((< (fabs (-> sv-72 z)) (fabs (-> sv-72 x))) + (when (< (-> sv-72 x) 0.0) + (let ((v1-15 (new 'stack-no-clear 'vector))) + (vector-copy! v1-15 sv-64) + (vector-copy! sv-64 sv-68) + (vector-copy! sv-68 v1-15) ) + (vector-negate! sv-72 sv-72) ) - (let ((s2-1 (max 0 (min 511 v1-20))) - (s1-0 s3-0) + (let* ((a0-9 (the int (- (-> sv-64 x) sv-80))) + (v1-20 (the int (+ (-> sv-68 x) sv-80))) + (f0-15 (fmax 1.0 (the float (- v1-20 a0-9)))) + (f30-0 (/ (-> sv-72 y) f0-15)) + (f28-0 (/ (-> sv-72 z) f0-15)) + (f26-0 (+ sv-80 (* 0.5 (fabs f30-0)))) + (f24-0 (+ sv-80 (* 0.5 (fabs f28-0)))) + ) + (cond + ((< a0-9 0) + (+! (-> sv-64 y) (* f30-0 (- (the float a0-9)))) + (+! (-> sv-64 z) (* f28-0 (- (the float a0-9)))) + (set! s3-0 0) + ) + (else + (set! s3-0 (min 511 a0-9)) ) - (while (>= s2-1 s1-0) - (let* ((f0-23 (the float (- s1-0 s3-0))) - (f1-23 (+ (-> sv-64 y) (* f30-0 f0-23))) - (f0-25 (+ (-> sv-64 z) (* f28-0 f0-23))) - (s0-0 (the int (* 4096.0 (+ (- -0.5 f26-0) f1-23)))) - ) - (set! sv-128 (the int (* 4096.0 (+ 0.5 f26-0 f1-23)))) - (let ((a0-15 (the int (- f0-25 f24-0))) - (v1-29 (the int (+ f0-25 f24-0))) - ) - (set! sv-144 0) + ) + (let ((s2-1 (max 0 (min 511 v1-20))) + (s1-0 s3-0) + ) + (while (>= s2-1 s1-0) + (let* ((f0-23 (the float (- s1-0 s3-0))) + (f1-23 (+ (-> sv-64 y) (* f30-0 f0-23))) + (f0-25 (+ (-> sv-64 z) (* f28-0 f0-23))) + (s0-0 (the int (* 4096.0 (+ (- -0.5 f26-0) f1-23)))) + (sv-128 (the int (* 4096.0 (+ 0.5 f26-0 f1-23)))) + (a0-15 (the int (- f0-25 f24-0))) + (v1-29 (the int (+ f0-25 f24-0))) + (sv-144 0) + ) (let ((a2-1 sv-144) (a1-21 (min 511 a0-15)) ) @@ -861,66 +843,65 @@ (move-if-not-zero a0-17 a1-21 a0-16 a0-16) ) (set! sv-144 a0-17) - (set! sv-160 0) - (let ((a1-22 sv-160) - (a0-20 (min 511 v1-29)) - ) - (set-on-less-than v1-30 a1-22 a0-20) - (move-if-not-zero v1-31 a0-20 v1-30 v1-30) + (let ((sv-160 0)) + (let ((a1-22 sv-160) + (a0-20 (min 511 v1-29)) + ) + (set-on-less-than v1-30 a1-22 a0-20) + (move-if-not-zero v1-31 a0-20 v1-30 v1-30) + ) + (set! sv-160 v1-31) + (while (>= sv-160 sv-144) + (add-tri-to-collide-cache this arg0 arg1 s1-0 sv-144 s0-0 sv-128) + (+! sv-144 1) + ) ) ) - (set! sv-160 v1-31) - (while (>= sv-160 sv-144) - (add-tri-to-collide-cache this arg0 arg1 s1-0 sv-144 s0-0 sv-128) - (set! sv-144 (+ sv-144 1)) - ) + (+! s1-0 1) ) - (+! s1-0 1) ) ) ) - ) - (else - (when (< (-> sv-72 z) 0.0) - (let ((v1-42 (new 'stack-no-clear 'vector))) - (vector-copy! v1-42 sv-64) - (vector-copy! sv-64 sv-68) - (vector-copy! sv-68 v1-42) - ) - (vector-negate! sv-72 sv-72) - ) - (let* ((a0-27 (the int (- (-> sv-64 z) sv-80))) - (v1-47 (the int (+ (-> sv-68 z) sv-80))) - (f0-36 (fmax 1.0 (the float (- v1-47 a0-27)))) - (f30-1 (/ (-> sv-72 y) f0-36)) - (f28-1 (/ (-> sv-72 x) f0-36)) - (f26-1 (+ sv-80 (* 0.5 (fabs f30-1)))) - (f24-1 (+ sv-80 (* 0.5 (fabs f28-1)))) - ) - (cond - ((< a0-27 0) - (+! (-> sv-64 y) (* f30-1 (the float (- a0-27)))) - (+! (-> sv-64 x) (* f28-1 (the float (- a0-27)))) - (set! s3-2 0) - ) - (else - (set! s3-2 (min 511 a0-27)) + (else + (when (< (-> sv-72 z) 0.0) + (let ((v1-42 (new 'stack-no-clear 'vector))) + (vector-copy! v1-42 sv-64) + (vector-copy! sv-64 sv-68) + (vector-copy! sv-68 v1-42) ) + (vector-negate! sv-72 sv-72) ) - (let ((s2-3 (max 0 (min 511 v1-47))) - (s1-1 s3-2) + (let* ((a0-27 (the int (- (-> sv-64 z) sv-80))) + (v1-47 (the int (+ (-> sv-68 z) sv-80))) + (f0-36 (fmax 1.0 (the float (- v1-47 a0-27)))) + (f30-1 (/ (-> sv-72 y) f0-36)) + (f28-1 (/ (-> sv-72 x) f0-36)) + (f26-1 (+ sv-80 (* 0.5 (fabs f30-1)))) + (f24-1 (+ sv-80 (* 0.5 (fabs f28-1)))) + ) + (cond + ((< a0-27 0) + (+! (-> sv-64 y) (* f30-1 (the float (- a0-27)))) + (+! (-> sv-64 x) (* f28-1 (the float (- a0-27)))) + (set! s3-2 0) + ) + (else + (set! s3-2 (min 511 a0-27)) ) - (while (>= s2-3 s1-1) - (let* ((f0-44 (the float (- s1-1 s3-2))) - (f1-47 (+ (-> sv-64 y) (* f30-1 f0-44))) - (f0-46 (+ (-> sv-64 x) (* f28-1 f0-44))) - (s0-1 (the int (* 4096.0 (+ (- -0.5 f26-1) f1-47)))) - ) - (set! sv-176 (the int (* 4096.0 (+ 0.5 f26-1 f1-47)))) - (let ((a0-34 (the int (- f0-46 f24-1))) - (v1-56 (the int (+ f0-46 f24-1))) - ) - (set! sv-192 0) + ) + (let ((s2-3 (max 0 (min 511 v1-47))) + (s1-1 s3-2) + ) + (while (>= s2-3 s1-1) + (let* ((f0-44 (the float (- s1-1 s3-2))) + (f1-47 (+ (-> sv-64 y) (* f30-1 f0-44))) + (f0-46 (+ (-> sv-64 x) (* f28-1 f0-44))) + (s0-1 (the int (* 4096.0 (+ (- -0.5 f26-1) f1-47)))) + (sv-176 (the int (* 4096.0 (+ 0.5 f26-1 f1-47)))) + (a0-34 (the int (- f0-46 f24-1))) + (v1-56 (the int (+ f0-46 f24-1))) + (sv-192 0) + ) (let ((a2-3 sv-192) (a1-41 (min 511 a0-34)) ) @@ -928,21 +909,22 @@ (move-if-not-zero a0-36 a1-41 a0-35 a0-35) ) (set! sv-192 a0-36) - (set! sv-208 0) - (let ((a1-42 sv-208) - (a0-39 (min 511 v1-56)) - ) - (set-on-less-than v1-57 a1-42 a0-39) - (move-if-not-zero v1-58 a0-39 v1-57 v1-57) + (let ((sv-208 0)) + (let ((a1-42 sv-208) + (a0-39 (min 511 v1-56)) + ) + (set-on-less-than v1-57 a1-42 a0-39) + (move-if-not-zero v1-58 a0-39 v1-57 v1-57) + ) + (set! sv-208 v1-58) + (while (>= sv-208 sv-192) + (add-tri-to-collide-cache this arg0 arg1 sv-192 s1-1 s0-1 sv-176) + (+! sv-192 1) + ) ) ) - (set! sv-208 v1-58) - (while (>= sv-208 sv-192) - (add-tri-to-collide-cache this arg0 arg1 sv-192 s1-1 s0-1 sv-176) - (set! sv-192 (+ sv-192 1)) - ) + (+! s1-1 1) ) - (+! s1-1 1) ) ) ) diff --git a/goal_src/jak3/engine/gfx/foreground/ripple.gc b/goal_src/jak3/engine/gfx/foreground/ripple.gc index 7aa0caf123..a27d3c32b0 100644 --- a/goal_src/jak3/engine/gfx/foreground/ripple.gc +++ b/goal_src/jak3/engine/gfx/foreground/ripple.gc @@ -139,9 +139,9 @@ ) (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) ) @@ -175,20 +175,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/goal_src/jak3/engine/gfx/generic/lightning/lightning-new.gc b/goal_src/jak3/engine/gfx/generic/lightning/lightning-new.gc index c35012da7a..7d02939cd4 100644 --- a/goal_src/jak3/engine/gfx/generic/lightning/lightning-new.gc +++ b/goal_src/jak3/engine/gfx/generic/lightning/lightning-new.gc @@ -101,35 +101,37 @@ ) (defmethod lightning-bolt-method-21 ((this lightning-bolt) (arg0 int) (arg1 int) (arg2 float)) - (local-vars (sv-16 int) (sv-24 vector) (sv-28 vector) (sv-32 float)) (let ((v1-0 (-> this desired-points))) (when (< 1 (- arg1 arg0)) - (set! sv-16 (/ (+ arg0 arg1) 2)) - (set! sv-24 (-> v1-0 data arg0)) - (set! sv-28 (-> v1-0 data arg1)) - (set! sv-32 (the-as float 1.0)) - (set! sv-32 (-> sv-28 z)) - (let ((s2-0 (-> v1-0 data sv-16))) - (let* ((f30-0 (* 0.5 (+ (-> sv-24 x) (-> sv-28 x)))) - (f28-0 arg2) - (f26-0 -0.5) - (v1-6 (/ (the-as int (rand-uint31-gen *random-generator*)) 256)) - (v1-7 (the-as number (logior #x3f800000 v1-6))) - ) - (set! (-> s2-0 x) (+ f30-0 (* f28-0 (+ f26-0 (+ -1.0 (the-as float v1-7)))))) + (let ((sv-16 (/ (+ arg0 arg1) 2))) + (let ((sv-24 (-> v1-0 data arg0)) + (sv-28 (-> v1-0 data arg1)) + (sv-32 (the-as float 1.0)) + ) + (set! sv-32 (-> sv-28 z)) + (let ((s2-0 (-> v1-0 data sv-16))) + (let* ((f30-0 (* 0.5 (+ (-> sv-24 x) (-> sv-28 x)))) + (f28-0 arg2) + (f26-0 -0.5) + (v1-6 (/ (the-as int (rand-uint31-gen *random-generator*)) 256)) + (v1-7 (the-as number (logior #x3f800000 v1-6))) + ) + (set! (-> s2-0 x) (+ f30-0 (* f28-0 (+ f26-0 (+ -1.0 (the-as float v1-7)))))) + ) + (let* ((f30-1 (* 0.5 (+ (-> sv-24 y) (-> sv-28 y)))) + (f28-1 arg2) + (f26-1 -0.5) + (v1-14 (/ (the-as int (rand-uint31-gen *random-generator*)) 256)) + (v1-15 (the-as number (logior #x3f800000 v1-14))) + ) + (set! (-> s2-0 y) (+ f30-1 (* f28-1 (+ f26-1 (+ -1.0 (the-as float v1-15)))))) + ) + (set! (-> s2-0 z) (lerp (-> sv-24 z) sv-32 0.5)) + ) ) - (let* ((f30-1 (* 0.5 (+ (-> sv-24 y) (-> sv-28 y)))) - (f28-1 arg2) - (f26-1 -0.5) - (v1-14 (/ (the-as int (rand-uint31-gen *random-generator*)) 256)) - (v1-15 (the-as number (logior #x3f800000 v1-14))) - ) - (set! (-> s2-0 y) (+ f30-1 (* f28-1 (+ f26-1 (+ -1.0 (the-as float v1-15)))))) - ) - (set! (-> s2-0 z) (lerp (-> sv-24 z) sv-32 0.5)) + (lightning-bolt-method-21 this arg0 sv-16 (* arg2 (-> this fractal-reduction))) + (lightning-bolt-method-21 this sv-16 arg1 (* arg2 (-> this fractal-reduction))) ) - (lightning-bolt-method-21 this arg0 sv-16 (* arg2 (-> this fractal-reduction))) - (lightning-bolt-method-21 this sv-16 arg1 (* arg2 (-> this fractal-reduction))) ) ) 0 @@ -214,15 +216,6 @@ ;; WARN: Function (method 11 lightning-bolt) has a return type of none, but the expression builder found a return statement. (defmethod lightning-bolt-method-11 ((this lightning-bolt)) - (local-vars - (sv-16 time-frame) - (sv-24 float) - (sv-32 time-frame) - (sv-40 float) - (sv-64 vector) - (sv-68 float) - (sv-72 float) - ) (with-pp (case (-> this fade-mode) ((2) @@ -350,36 +343,40 @@ ) ) (else - (set! sv-16 (- (current-time) (- (current-time) (-> pp clock old-frame-counter)))) - (set! sv-24 (the-as float 0.0)) - (set! sv-32 (current-time)) - (set! sv-40 (the-as float 0.0)) - (set! sv-24 - (/ (the float (- sv-16 (-> this last-generate-time))) (the float (-> this inner-point-travel-time))) + (let ((sv-16 (- (current-time) (- (current-time) (-> pp clock old-frame-counter)))) + (sv-24 (the-as float 0.0)) + (sv-32 (current-time)) + (sv-40 (the-as float 0.0)) ) - (set! sv-40 - (/ (the float (- sv-32 (-> this last-generate-time))) (the float (-> this inner-point-travel-time))) - ) - (set! sv-24 (fmax 0.0 (fmin 1.0 sv-24))) - (set! sv-40 (fmax 0.0 (fmin 1.0 sv-40))) - (let ((f30-1 (- 1.0 sv-24))) - (dotimes (s2-1 s3-2) - (set! sv-64 (new 'stack-no-clear 'vector)) - (set! sv-68 (the-as float 0.0)) - (set! sv-72 (the-as float 0.0)) - (set-vector! - sv-64 - (- (-> this desired-points data (+ s2-1 s5-2) x) (-> this current-points data (+ s2-1 s5-2) x)) - (- (-> this desired-points data (+ s2-1 s5-2) y) (-> this current-points data (+ s2-1 s5-2) y)) - 0.0 - 1.0 - ) - (set! sv-68 (vector-normalize-ret-len! sv-64 1.0)) - (when (< 0.0 f30-1) - (set! sv-72 (/ sv-68 f30-1)) - (vector-float*! sv-64 sv-64 (* sv-72 (- sv-40 sv-24))) - (vector+! (-> this current-points data (+ s2-1 s5-2)) (-> this current-points data (+ s2-1 s5-2)) sv-64) - (set! (-> this current-points data (+ s2-1 s5-2) z) (-> this desired-points data (+ s2-1 s5-2) z)) + (set! sv-24 + (/ (the float (- sv-16 (-> this last-generate-time))) (the float (-> this inner-point-travel-time))) + ) + (set! sv-40 + (/ (the float (- sv-32 (-> this last-generate-time))) (the float (-> this inner-point-travel-time))) + ) + (set! sv-24 (fmax 0.0 (fmin 1.0 sv-24))) + (set! sv-40 (fmax 0.0 (fmin 1.0 sv-40))) + (let ((f30-1 (- 1.0 sv-24))) + (dotimes (s2-1 s3-2) + (let ((sv-64 (new 'stack-no-clear 'vector)) + (sv-68 (the-as float 0.0)) + ) + (let ((sv-72 (the-as float 0.0))) + ) + (set-vector! + sv-64 + (- (-> this desired-points data (+ s2-1 s5-2) x) (-> this current-points data (+ s2-1 s5-2) x)) + (- (-> this desired-points data (+ s2-1 s5-2) y) (-> this current-points data (+ s2-1 s5-2) y)) + 0.0 + 1.0 + ) + (set! sv-68 (vector-normalize-ret-len! sv-64 1.0)) + (when (< 0.0 f30-1) + (vector-float*! sv-64 sv-64 (* (/ sv-68 f30-1) (- sv-40 sv-24))) + (vector+! (-> this current-points data (+ s2-1 s5-2)) (-> this current-points data (+ s2-1 s5-2)) sv-64) + (set! (-> this current-points data (+ s2-1 s5-2) z) (-> this desired-points data (+ s2-1 s5-2) z)) + ) + ) ) ) ) @@ -482,131 +479,118 @@ ) (defun choose-nice-perp ((arg0 vector)) - (let* ((f0-0 (-> arg0 x)) - (f0-2 (* f0-0 f0-0)) - (f1-0 (-> arg0 z)) - ) - (if (< (+ f0-2 (* f1-0 f1-0)) 0.01) - *x-vector* - *up-vector* - ) - ) + (if (< (+ (square (-> arg0 x)) (square (-> arg0 z))) 0.01) + *x-vector* + *up-vector* + ) ) ;; WARN: Function (method 12 lightning-bolt) has a return type of none, but the expression builder found a return statement. (defmethod lightning-bolt-method-12 ((this lightning-bolt)) - (local-vars - (sv-48 int) - (sv-56 float) - (sv-60 vector) - (sv-64 matrix) - (sv-96 lightning-span) - (sv-100 lightning-span-internal) - (sv-104 vector) - (sv-224 matrix) - (sv-228 vector) - (sv-232 vector) - (sv-236 float) - (sv-240 vector) - (sv-244 float) - (sv-248 float) - (sv-256 int) - (sv-288 lightning-span) - (sv-292 lightning-span-internal) - (sv-296 vector) - (sv-416 matrix) - (sv-420 vector) - (sv-424 vector) - (sv-428 vector) - (sv-432 float) - ) (when (= (-> this fade-mode) 3) (set! (-> this strip1 num-verts) (the-as uint 0)) (set! (-> this strip2 num-verts) (the-as uint 0)) (return 0) ) - (set! sv-48 0) - (set! sv-56 (the-as float 0.0)) - (set! sv-60 (new 'stack-no-clear 'vector)) - (set! sv-64 (new 'stack-no-clear 'matrix)) - (lightning-bolt-method-22 this) - (set! (-> sv-60 x) 0.0) - (set! (-> sv-60 y) 0.0) - (dotimes (s5-0 (-> this num-active-spans)) - (set! sv-96 (-> this spans data s5-0)) - (set! sv-100 (-> this spans-internal data s5-0)) - (set! sv-104 (new 'stack-no-clear 'vector)) - (set! sv-224 (new 'stack-no-clear 'matrix)) - (set! sv-228 (new 'stack-no-clear 'vector)) - (set! sv-232 (new 'stack-no-clear 'vector)) - (set! sv-236 (the-as float 0.0)) - (set! sv-240 - (vector-! - (new 'stack-no-clear 'vector) - (-> this span-pts-start data (+ s5-0 1)) - (-> this span-pts-start data s5-0) + (let ((sv-48 0) + (sv-56 (the-as float 0.0)) + (sv-60 (new 'stack-no-clear 'vector)) + (sv-64 (new 'stack-no-clear 'matrix)) + ) + (lightning-bolt-method-22 this) + (set! (-> sv-60 x) 0.0) + (set! (-> sv-60 y) 0.0) + (dotimes (s5-0 (-> this num-active-spans)) + (let ((sv-96 (-> this spans data s5-0)) + (sv-100 (-> this spans-internal data s5-0)) + (sv-104 (new 'stack-no-clear 'vector)) ) + (let ((sv-224 (new 'stack-no-clear 'matrix)) + (sv-228 (new 'stack-no-clear 'vector)) + (sv-232 (new 'stack-no-clear 'vector)) + (sv-236 (the-as float 0.0)) + ) + (let ((sv-240 + (vector-! + (new 'stack-no-clear 'vector) + (-> this span-pts-start data (+ s5-0 1)) + (-> this span-pts-start data s5-0) + ) + ) + (sv-244 (the float (-> sv-100 index))) + ) + (vector-normalize! sv-240 1.0) + (set! sv-236 + (vector-vector-distance (-> this span-pts-start data s5-0) (-> this span-pts-start data (+ s5-0 1))) + ) + (matrix<-vector-yz2! sv-224 sv-240 (choose-nice-perp sv-240)) + (let ((f30-0 (-> sv-96 random-offset-size-start))) + (lightning-bolt-method-19 this sv-104 sv-48 (+ sv-48 1) sv-224 f30-0 sv-236) + (vector-copy! sv-232 (-> this current-points data sv-48)) + (set! (-> sv-232 x) (* (-> sv-232 x) f30-0)) + (set! (-> sv-232 y) (* (-> sv-232 y) f30-0)) + ) + (set! (-> sv-232 z) (- (-> sv-232 z) sv-244)) + (set! (-> sv-232 z) (* (-> sv-232 z) sv-236)) + (vector-rotate*! sv-228 sv-232 sv-224) + (vector+! sv-228 sv-228 (-> this span-pts-start data s5-0)) + (lightning-bolt-method-16 this sv-228 (vector-length sv-232) sv-56 sv-60 (the-as matrix sv-104)) + (let ((sv-248 (-> sv-96 inner-random-offset-size))) + (dotimes (s4-1 (-> sv-100 num-inner-points)) + (let ((sv-256 (+ sv-48 1 s4-1))) + (lightning-bolt-method-19 this sv-104 (+ sv-256 -1) sv-256 sv-224 sv-248 sv-236) + (vector-copy! sv-232 (-> this current-points data sv-256)) + ) + (set! (-> sv-232 x) (* (-> sv-232 x) sv-248)) + (set! (-> sv-232 y) (* (-> sv-232 y) sv-248)) + (set! (-> sv-232 z) (- (-> sv-232 z) sv-244)) + (set! (-> sv-232 z) (* (-> sv-232 z) sv-236)) + (vector-rotate*! sv-228 sv-232 sv-224) + (vector+! sv-228 sv-228 (-> this span-pts-start data s5-0)) + (lightning-bolt-method-16 this sv-228 (vector-length sv-232) sv-56 sv-60 (the-as matrix sv-104)) + ) + ) + ) + (+! sv-56 sv-236) ) - (set! sv-244 (the float (-> sv-100 index))) - (vector-normalize! sv-240 1.0) - (set! sv-236 - (vector-vector-distance (-> this span-pts-start data s5-0) (-> this span-pts-start data (+ s5-0 1))) + (set! sv-48 (+ (-> sv-100 num-inner-points) 1 sv-48)) + (set! (-> sv-64 rvec quad) (-> sv-104 quad)) + ) + ) + (let* ((s5-1 (-> this num-active-spans)) + (sv-288 (-> this spans data s5-1)) + (sv-292 (-> this spans-internal data s5-1)) + ) + (let ((sv-296 (new 'stack-no-clear 'vector))) + ) + (let ((sv-416 (new 'stack-no-clear 'matrix)) + (sv-420 (new 'stack-no-clear 'vector)) + ) + (let ((sv-424 (new 'stack-no-clear 'vector))) + (let ((sv-428 (vector-! + (new 'stack-no-clear 'vector) + (-> this span-pts-start data s5-1) + (-> this span-pts-start data (+ s5-1 -1)) + ) + ) + (sv-432 (the float (-> sv-292 index))) + ) + (vector-normalize! sv-428 1.0) + (matrix<-vector-yz2! sv-416 sv-428 (choose-nice-perp sv-428)) + (let ((f0-33 (-> sv-288 random-offset-size-start))) + (vector-copy! sv-424 (-> this current-points data sv-48)) + (set! (-> sv-424 x) (* (-> sv-424 x) f0-33)) + (set! (-> sv-424 y) (* (-> sv-424 y) f0-33)) + ) + (set! (-> sv-424 z) (- (-> sv-424 z) sv-432)) + ) + (vector-rotate*! sv-420 sv-424 sv-416) ) - (matrix<-vector-yz2! sv-224 sv-240 (choose-nice-perp sv-240)) - (let ((f30-0 (-> sv-96 random-offset-size-start))) - (lightning-bolt-method-19 this sv-104 sv-48 (+ sv-48 1) sv-224 f30-0 sv-236) - (vector-copy! sv-232 (-> this current-points data sv-48)) - (set! (-> sv-232 x) (* (-> sv-232 x) f30-0)) - (set! (-> sv-232 y) (* (-> sv-232 y) f30-0)) + (vector+! sv-420 sv-420 (-> this span-pts-start data s5-1)) + (lightning-bolt-method-16 this sv-420 0.0 sv-56 sv-60 sv-64) + ) ) - (set! (-> sv-232 z) (- (-> sv-232 z) sv-244)) - (set! (-> sv-232 z) (* (-> sv-232 z) sv-236)) - (vector-rotate*! sv-228 sv-232 sv-224) - (vector+! sv-228 sv-228 (-> this span-pts-start data s5-0)) - (lightning-bolt-method-16 this sv-228 (vector-length sv-232) sv-56 sv-60 (the-as matrix sv-104)) - (set! sv-248 (-> sv-96 inner-random-offset-size)) - (dotimes (s4-1 (-> sv-100 num-inner-points)) - (set! sv-256 (+ sv-48 1 s4-1)) - (lightning-bolt-method-19 this sv-104 (+ sv-256 -1) sv-256 sv-224 sv-248 sv-236) - (vector-copy! sv-232 (-> this current-points data sv-256)) - (set! (-> sv-232 x) (* (-> sv-232 x) sv-248)) - (set! (-> sv-232 y) (* (-> sv-232 y) sv-248)) - (set! (-> sv-232 z) (- (-> sv-232 z) sv-244)) - (set! (-> sv-232 z) (* (-> sv-232 z) sv-236)) - (vector-rotate*! sv-228 sv-232 sv-224) - (vector+! sv-228 sv-228 (-> this span-pts-start data s5-0)) - (lightning-bolt-method-16 this sv-228 (vector-length sv-232) sv-56 sv-60 (the-as matrix sv-104)) - ) - (set! sv-56 (+ sv-56 sv-236)) - (set! sv-48 (+ (-> sv-100 num-inner-points) 1 sv-48)) - (set! (-> sv-64 rvec quad) (-> sv-104 quad)) ) - (let ((s5-1 (-> this num-active-spans))) - (set! sv-288 (-> this spans data s5-1)) - (set! sv-292 (-> this spans-internal data s5-1)) - (set! sv-296 (new 'stack-no-clear 'vector)) - (set! sv-416 (new 'stack-no-clear 'matrix)) - (set! sv-420 (new 'stack-no-clear 'vector)) - (set! sv-424 (new 'stack-no-clear 'vector)) - (set! sv-428 (vector-! - (new 'stack-no-clear 'vector) - (-> this span-pts-start data s5-1) - (-> this span-pts-start data (+ s5-1 -1)) - ) - ) - (set! sv-432 (the float (-> sv-292 index))) - (vector-normalize! sv-428 1.0) - (matrix<-vector-yz2! sv-416 sv-428 (choose-nice-perp sv-428)) - (let ((f0-33 (-> sv-288 random-offset-size-start))) - (vector-copy! sv-424 (-> this current-points data sv-48)) - (set! (-> sv-424 x) (* (-> sv-424 x) f0-33)) - (set! (-> sv-424 y) (* (-> sv-424 y) f0-33)) - ) - (set! (-> sv-424 z) (- (-> sv-424 z) sv-432)) - (vector-rotate*! sv-420 sv-424 sv-416) - (vector+! sv-420 sv-420 (-> this span-pts-start data s5-1)) - ) - (lightning-bolt-method-16 this sv-420 0.0 sv-56 sv-60 sv-64) 0 (none) ) @@ -665,7 +649,6 @@ ) (defmethod lightning-bolt-method-16 ((this lightning-bolt) (arg0 vector) (arg1 float) (arg2 float) (arg3 vector) (arg4 matrix)) - (local-vars (sv-160 vector) (sv-164 vector) (sv-168 vector) (sv-172 vector) (sv-176 rgba)) 0.0 0.0 0.0 @@ -714,14 +697,13 @@ (let* ((a2-4 (-> (camera-matrix) uvec)) (v1-13 (matrix-f-u-compose (new 'stack-no-clear 'matrix) (-> arg4 rvec) a2-4)) (f26-1 6.0) + (sv-160 (vector+float*! (new 'stack-no-clear 'vector) arg0 (-> v1-13 rvec) (/ f22-0 2))) + (sv-164 (vector+float*! (new 'stack-no-clear 'vector) arg0 (-> v1-13 rvec) (/ f22-0 -2))) + (sv-168 (vector+float*! (new 'stack-no-clear 'vector) arg0 (-> v1-13 uvec) (/ f22-0 2))) + (sv-172 (vector+float*! (new 'stack-no-clear 'vector) arg0 (-> v1-13 uvec) (/ f22-0 -2))) + (sv-176 (the-as rgba (new 'stack-no-clear 'array 'rgba 1))) ) - (set! sv-160 (vector+float*! (new 'stack-no-clear 'vector) arg0 (-> v1-13 rvec) (/ f22-0 2))) - (set! sv-164 (vector+float*! (new 'stack-no-clear 'vector) arg0 (-> v1-13 rvec) (/ f22-0 -2))) - (set! sv-168 (vector+float*! (new 'stack-no-clear 'vector) arg0 (-> v1-13 uvec) (/ f22-0 2))) - (set! sv-172 (vector+float*! (new 'stack-no-clear 'vector) arg0 (-> v1-13 uvec) (/ f22-0 -2))) - (set! sv-176 (the-as rgba (new 'stack-no-clear 'array 'rgba 1))) - (set! sv-176 (-> this base-color)) - (set! sv-176 (copy-and-set-field sv-176 a (the int (* 128.0 f24-0)))) + (set! sv-176 (copy-and-set-field (-> this base-color) a (the int (* 128.0 f24-0)))) (when (< f28-1 (-> arg3 x)) (let ((s3-1 (new 'stack-no-clear 'vector)) (s4-1 (new 'stack-no-clear 'vector)) @@ -750,11 +732,11 @@ (lightning-bolt-method-18 this (-> this strip2) s4-1 sv-176 0.0 0.0) ) ) + (lightning-bolt-method-18 this (-> this strip1) sv-160 sv-176 0.0 f28-1) + (lightning-bolt-method-18 this (-> this strip1) sv-164 sv-176 1.0 f28-1) + (lightning-bolt-method-18 this (-> this strip2) sv-168 sv-176 1.0 f28-1) + (lightning-bolt-method-18 this (-> this strip2) sv-172 sv-176 0.0 f28-1) ) - (lightning-bolt-method-18 this (-> this strip1) sv-160 sv-176 0.0 f28-1) - (lightning-bolt-method-18 this (-> this strip1) sv-164 sv-176 1.0 f28-1) - (lightning-bolt-method-18 this (-> this strip2) sv-168 sv-176 1.0 f28-1) - (lightning-bolt-method-18 this (-> this strip2) sv-172 sv-176 0.0 f28-1) (set! (-> arg3 y) f30-0) (set! (-> arg3 x) f28-1) ) diff --git a/goal_src/jak3/engine/gfx/generic/lightning/lightning.gc b/goal_src/jak3/engine/gfx/generic/lightning/lightning.gc index 8e853a6e85..f2d6e1a238 100644 --- a/goal_src/jak3/engine/gfx/generic/lightning/lightning.gc +++ b/goal_src/jak3/engine/gfx/generic/lightning/lightning.gc @@ -36,12 +36,12 @@ ) (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) @@ -76,7 +76,6 @@ ) (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)))) @@ -87,29 +86,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) @@ -159,7 +159,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) @@ -168,78 +167,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) @@ -285,7 +289,7 @@ ) (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 @@ -294,8 +298,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)))) ) @@ -327,24 +331,16 @@ ) (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) 1)) + (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) 1)) - (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 lsf4)) (let ((f1-1 (vector-vector-distance (-> sv-24 data 0) (-> sv-24 data s4-0)))) @@ -417,22 +413,7 @@ ) (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) @@ -446,246 +427,260 @@ (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-24 (-> sv-20 sv-80))) - (set! (-> v1-24 tex x) 0) - (set! (-> v1-24 tex y) (* (/ 4096 s3-0) (/ sv-80 2))) - (set! (-> v1-24 tex z) 4096) - (set! (-> v1-24 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-33 (-> sv-20 sv-80))) - (set! (-> v1-33 tex x) 4096) - (set! (-> v1-33 tex y) (* (/ 4096 s3-0) (/ sv-80 2))) - (set! (-> v1-33 tex z) 4096) - (set! (-> v1-33 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-24 (-> sv-20 sv-80))) + (set! (-> v1-24 tex x) 0) + (set! (-> v1-24 tex y) (* (/ 4096 s3-0) (/ sv-80 2))) + (set! (-> v1-24 tex z) 4096) + (set! (-> v1-24 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-33 (-> sv-20 sv-80))) + (set! (-> v1-33 tex x) 4096) + (set! (-> v1-33 tex y) (* (/ 4096 s3-0) (/ sv-80 2))) + (set! (-> v1-33 tex z) 4096) + (set! (-> v1-33 tex w) 0) + ) + ) + ) + (+! sv-80 1) ) ) ) - (set! sv-80 (+ sv-80 1)) - ) - ) - ((logtest? (-> sv-24 flags) (lightning-spec-flags lsf1)) - (dotimes (v1-43 (* s3-0 2)) - (cond - ((not (logtest? v1-43 1)) - (let ((a0-26 (-> sv-20 v1-43))) - (set! (-> a0-26 tex x) 0) - (set! (-> a0-26 tex y) (* (/ 4096 s3-0) (/ v1-43 2))) - (set! (-> a0-26 tex z) 4096) - (set! (-> a0-26 tex w) 0) - ) - ) - (else - (let ((a0-30 (-> sv-20 v1-43))) - (set! (-> a0-30 tex x) 4096) - (set! (-> a0-30 tex y) (* (/ 4096 s3-0) (/ v1-43 2))) - (set! (-> a0-30 tex z) 4096) - (set! (-> a0-30 tex w) 0) + ((logtest? (-> sv-24 flags) (lightning-spec-flags lsf1)) + (dotimes (v1-43 (* s3-0 2)) + (cond + ((not (logtest? v1-43 1)) + (let ((a0-26 (-> sv-20 v1-43))) + (set! (-> a0-26 tex x) 0) + (set! (-> a0-26 tex y) (* (/ 4096 s3-0) (/ v1-43 2))) + (set! (-> a0-26 tex z) 4096) + (set! (-> a0-26 tex w) 0) + ) + ) + (else + (let ((a0-30 (-> sv-20 v1-43))) + (set! (-> a0-30 tex x) 4096) + (set! (-> a0-30 tex y) (* (/ 4096 s3-0) (/ v1-43 2))) + (set! (-> a0-30 tex z) 4096) + (set! (-> a0-30 tex w) 0) + ) + ) + ) + ) + (dotimes (v1-46 (* s2-0 2)) + (set! (-> sv-20 v1-46 clr x) (the-as int (-> arg1 state start-color r))) + (set! (-> sv-20 v1-46 clr y) (the-as int (-> arg1 state start-color g))) + (set! (-> sv-20 v1-46 clr z) (the-as int (-> arg1 state start-color b))) + (set! (-> sv-20 v1-46 clr w) (the-as int (-> arg1 state start-color a))) + ) + (dotimes (v1-49 2) + (let ((a0-45 (+ v1-49 (* 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-46 (* s2-0 2)) - (set! (-> sv-20 v1-46 clr x) (the-as int (-> arg1 state start-color r))) - (set! (-> sv-20 v1-46 clr y) (the-as int (-> arg1 state start-color g))) - (set! (-> sv-20 v1-46 clr z) (the-as int (-> arg1 state start-color b))) - (set! (-> sv-20 v1-46 clr w) (the-as int (-> arg1 state start-color a))) - ) - (dotimes (v1-49 2) - (let ((a0-45 (+ v1-49 (* 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-56 (* s3-0 2)) - (cond - ((not (logtest? v1-56 1)) - (let ((a0-52 (-> sv-20 v1-56))) - (set! (-> a0-52 tex x) 0) - (set! (-> a0-52 tex y) (* (/ 4096 s3-0) (/ v1-56 2))) - (set! (-> a0-52 tex z) 4096) - (set! (-> a0-52 tex w) 0) - ) - ) - (else - (let ((a0-56 (-> sv-20 v1-56))) - (set! (-> a0-56 tex x) 4096) - (set! (-> a0-56 tex y) (* (/ 4096 s3-0) (/ v1-56 2))) - (set! (-> a0-56 tex z) 4096) - (set! (-> a0-56 tex w) 0) + ((logtest? (-> sv-24 flags) (lightning-spec-flags lsf2)) + (dotimes (v1-56 (* s3-0 2)) + (cond + ((not (logtest? v1-56 1)) + (let ((a0-52 (-> sv-20 v1-56))) + (set! (-> a0-52 tex x) 0) + (set! (-> a0-52 tex y) (* (/ 4096 s3-0) (/ v1-56 2))) + (set! (-> a0-52 tex z) 4096) + (set! (-> a0-52 tex w) 0) + ) + ) + (else + (let ((a0-56 (-> sv-20 v1-56))) + (set! (-> a0-56 tex x) 4096) + (set! (-> a0-56 tex y) (* (/ 4096 s3-0) (/ v1-56 2))) + (set! (-> a0-56 tex z) 4096) + (set! (-> a0-56 tex w) 0) + ) + ) + ) + ) + (dotimes (v1-59 (* (+ s3-0 -2) 2)) + (let ((a0-58 (+ v1-59 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-62 2) + (let ((a0-63 v1-62)) + (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-65 2) + (let ((a0-67 (+ v1-65 (* 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-59 (* (+ s3-0 -2) 2)) - (let ((a0-58 (+ v1-59 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-62 2) - (let ((a0-63 v1-62)) - (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-65 2) - (let ((a0-67 (+ v1-65 (* 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-71 (-> sv-48 data)) - (a0-71 (the-as object (-> sv-20 0))) - (a1-82 (the-as object (-> sv-20 1))) ) - 1 - (.lvf vf1 (&-> s0-0 rvec quad)) - (.lvf vf2 (&-> s0-0 uvec quad)) - (.lvf vf3 (&-> s0-0 fvec quad)) - (.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 (&-> v1-71 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 uint128) a1-82) 6)) - (set! a0-71 (&-> (the-as (pointer uint128) a0-71) 6)) - (.add.x.vf vf9 vf8 vf0) - (set! v1-71 (the-as (inline-array vector) (-> v1-71 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-71 (-> sv-48 data)) + (a0-71 (the-as object (-> sv-20 0))) + (a1-82 (the-as object (-> sv-20 1))) + ) + 1 + (.lvf vf1 (&-> s0-0 rvec quad)) + (.lvf vf2 (&-> s0-0 uvec quad)) + (.lvf vf3 (&-> s0-0 fvec quad)) + (.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-81 arg0) - (a0-73 (the-as object (-> v1-81 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-81 base) (the-as pointer (the-as dma-packet (&+ (the-as dma-packet a0-73) 16)))) - ) - (set! sv-176 (the-as gcf-control (-> arg0 base))) - (matrix-copy! (-> sv-176 matrix) (-> sv-16 perspective)) - (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)) - (when sv-32 - (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-miptbp :tbp1 #x48 :tbw2 #x20)) - (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 (&-> v1-71 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 uint128) a1-82) 6)) + (set! a0-71 (&-> (the-as (pointer uint128) a0-71) 6)) + (.add.x.vf vf9 vf8 vf0) + (set! v1-71 (the-as (inline-array vector) (-> v1-71 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-81 arg0) + (a0-73 (the-as object (-> v1-81 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-81 base) (the-as pointer (the-as dma-packet (&+ (the-as dma-packet a0-73) 16)))) + ) + (let ((sv-176 (the-as gcf-control (-> arg0 base)))) + (matrix-copy! (-> sv-176 matrix) (-> sv-16 perspective)) + (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)) + (when sv-32 + (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-miptbp :tbp1 #x48 :tbw2 #x20)) + (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/goal_src/jak3/engine/gfx/ocean/ocean-mid.gc b/goal_src/jak3/engine/gfx/ocean/ocean-mid.gc index 59ee5910b4..5237ad4108 100644 --- a/goal_src/jak3/engine/gfx/ocean/ocean-mid.gc +++ b/goal_src/jak3/engine/gfx/ocean/ocean-mid.gc @@ -521,9 +521,8 @@ ;; 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) @@ -983,42 +982,44 @@ ) (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-for-ocean sv-36) ;; og:preserve-this - (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))) + ;; og:preserve-this + (when (sphere-cull-for-ocean 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) @@ -1031,7 +1032,7 @@ ) (defmethod draw-ocean-mid ((this ocean) (arg0 dma-buffer)) - (local-vars (v1-8 float) (v1-9 float) (sv-48 int)) + (local-vars (v1-8 float) (v1-9 float)) (rlet ((vf16 :class vf) (vf17 :class vf) (vf18 :class vf) @@ -1091,8 +1092,9 @@ ) (dotimes (s2-0 6) (dotimes (s1-0 6) - (let ((s0-0 (+ (* 6 s2-0) s1-0))) - (set! sv-48 (-> (the-as (pointer int16) (+ (* s0-0 2) (the-as int (-> this ocean-mid-indices)))))) + (let* ((s0-0 (+ (* 6 s2-0) s1-0)) + (sv-48 (-> (the-as (pointer int16) (+ (* s0-0 2) (the-as int (-> this ocean-mid-indices)))))) + ) (when (-> this all-on) (set! sv-48 0) sv-48 @@ -1106,15 +1108,7 @@ ((< sv-48 0) ) ((let ((f24-0 (- (vector-vector-distance s3-0 s4-0) (-> s3-0 r)))) - (let ((a0-16 this) - (t9-6 (method-of-type ocean ocean-mid-add-upload)) - (a1-9 arg0) - (a2-2 s2-0) - (a3-0 s1-0) - (t2-0 f24-0) - ) - (t9-6 a0-16 a1-9 a2-2 a3-0 sv-48 s0-0 t2-0) - ) + (ocean-mid-add-upload this arg0 s2-0 s1-0 sv-48 s0-0 f24-0) (< f24-0 786432.0) ) (ocean-mid-add-call this arg0 73) diff --git a/goal_src/jak3/engine/gfx/ocean/ocean-near.gc b/goal_src/jak3/engine/gfx/ocean/ocean-near.gc index 8582dced73..dd3e31c8ea 100644 --- a/goal_src/jak3/engine/gfx/ocean/ocean-near.gc +++ b/goal_src/jak3/engine/gfx/ocean/ocean-near.gc @@ -640,7 +640,6 @@ ) (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))) ) @@ -663,8 +662,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/goal_src/jak3/engine/gfx/ocean/ocean-texture.gc b/goal_src/jak3/engine/gfx/ocean/ocean-texture.gc index 3a60204313..a2e31bddea 100644 --- a/goal_src/jak3/engine/gfx/ocean/ocean-texture.gc +++ b/goal_src/jak3/engine/gfx/ocean/ocean-texture.gc @@ -609,7 +609,6 @@ ) (defmethod ocean-method-84 ((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)) @@ -623,9 +622,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) @@ -754,7 +754,6 @@ ) (defmethod ocean-method-87 ((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 @@ -808,34 +807,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-85)) - (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-85 this s0-0 sv-80 (-> s2-2 sun0-color) (-> s2-2 ambi-color)) (ocean-method-85 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-86)) - (a3-2 s4-1) - ) - (t9-5 a0-44 sv-96 sv-112 a3-2) + (ocean-method-86 this sv-96 sv-112 s4-1) ) ) ) diff --git a/goal_src/jak3/engine/gfx/ocean/ocean-transition.gc b/goal_src/jak3/engine/gfx/ocean/ocean-transition.gc index 6a3501c8d2..4427eec3de 100644 --- a/goal_src/jak3/engine/gfx/ocean/ocean-transition.gc +++ b/goal_src/jak3/engine/gfx/ocean/ocean-transition.gc @@ -486,21 +486,22 @@ ) (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 @@ -632,34 +633,36 @@ ) (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-for-ocean sv-36) ;; og:preserve-this - (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))) + ;; og:preserve-this + (when (sphere-cull-for-ocean 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) ) ) ) @@ -705,16 +708,6 @@ ) (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)) @@ -722,125 +715,132 @@ (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-for-ocean sv-36) ;; og:preserve-this - (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))) + ;; og:preserve-this + (if (sphere-cull-for-ocean 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/goal_src/jak3/engine/gfx/ocean/ocean.gc b/goal_src/jak3/engine/gfx/ocean/ocean.gc index 366fdb1bb7..1606d764e9 100644 --- a/goal_src/jak3/engine/gfx/ocean/ocean.gc +++ b/goal_src/jak3/engine/gfx/ocean/ocean.gc @@ -148,7 +148,6 @@ ) (defmethod ocean-method-60 ((this ocean) (arg0 dma-buffer)) - (local-vars (sv-48 float) (sv-52 vector) (sv-56 vector)) ;; og:preserve-this (let ((s4-0 (scratchpad-object (inline-array ocean-vertex)))) (let ((f0-0 (-> this start-corner z))) @@ -163,79 +162,81 @@ (set! (-> s4-0 1 pos w) 0.5) (set! (-> s4-0 2 pos w) 1.0) (set! (-> s4-0 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 (the-as (pointer int32) (-> 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! (-> s4-0 0 pos x) f0-8) - (set! (-> s4-0 1 pos x) f1-6) - (set! (-> s4-0 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 (the-as (pointer int32) (-> 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! (-> s4-0 0 pos x) f0-8) + (set! (-> s4-0 1 pos x) f1-6) + (set! (-> s4-0 2 pos x) f1-6) + ) + (set! (-> s4-0 3 pos x) f0-8) ) - (set! (-> s4-0 3 pos x) f0-8) - ) - (rgba-to-vector! this sv-56 (the-as (pointer int32) (&+ (-> s3-0 colors) (* (+ s1-0 1) 4)))) - (vector-copy! (-> s4-0 0 col) sv-52) - (vector-copy! (-> s4-0 1 col) sv-56) - (vector-copy! (-> s4-0 2 col) sv-56) - (vector-copy! (-> s4-0 3 col) sv-52) - (vector-copy! sv-52 sv-56) - (cond - ((render-ocean-quad s4-0 arg0) - (set! s2-0 #t) - ) - (else - (if s2-0 - (goto cfg-9) - ) + (rgba-to-vector! this sv-56 (the-as (pointer int32) (&+ (-> s3-0 colors) (* (+ s1-0 1) 4)))) + (vector-copy! (-> s4-0 0 col) sv-52) + (vector-copy! (-> s4-0 1 col) sv-56) + (vector-copy! (-> s4-0 2 col) sv-56) + (vector-copy! (-> s4-0 3 col) sv-52) + (vector-copy! sv-52 sv-56) + (cond + ((render-ocean-quad s4-0 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! (-> s4-0 0 pos z) f1-9) - (set! (-> s4-0 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! (-> s4-0 0 pos z) f1-9) + (set! (-> s4-0 1 pos z) f1-9) + ) + (set! (-> s4-0 2 pos z) f0-10) + (set! (-> s4-0 3 pos z) f0-10) ) - (set! (-> s4-0 2 pos z) f0-10) - (set! (-> s4-0 3 pos z) f0-10) - ) - (set! (-> s4-0 0 pos w) 0.0) - (set! (-> s4-0 1 pos w) 0.0) - (set! (-> s4-0 2 pos w) 0.5) - (set! (-> s4-0 3 pos w) 0.5) - (let ((s3-1 (-> this ocean-colors))) - (let ((s2-1 #f)) - (rgba-to-vector! this sv-52 (the-as (pointer int32) (-> 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! (-> s4-0 0 pos x) f0-17) - (set! (-> s4-0 1 pos x) f1-14) - (set! (-> s4-0 2 pos x) f1-14) + (set! (-> s4-0 0 pos w) 0.0) + (set! (-> s4-0 1 pos w) 0.0) + (set! (-> s4-0 2 pos w) 0.5) + (set! (-> s4-0 3 pos w) 0.5) + (let ((s3-1 (-> this ocean-colors))) + (let ((s2-1 #f)) + (rgba-to-vector! this sv-52 (the-as (pointer int32) (-> 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! (-> s4-0 0 pos x) f0-17) + (set! (-> s4-0 1 pos x) f1-14) + (set! (-> s4-0 2 pos x) f1-14) + ) + (set! (-> s4-0 3 pos x) f0-17) ) - (set! (-> s4-0 3 pos x) f0-17) - ) - (rgba-to-vector! this sv-56 (the-as (pointer int32) (&+ (-> s3-1 colors) (* (+ s1-1 1) 4)))) - (add-colors! this (-> s4-0 0 col) (-> s4-0 0)) - (add-colors! this (-> s4-0 1 col) (-> s4-0 1)) - (vector-copy! (-> s4-0 2 col) sv-56) - (vector-copy! (-> s4-0 3 col) sv-52) - (vector-copy! sv-52 sv-56) - (cond - ((render-ocean-quad s4-0 arg0) - (set! s2-1 #t) - ) - (else - (if s2-1 - (goto cfg-18) - ) + (rgba-to-vector! this sv-56 (the-as (pointer int32) (&+ (-> s3-1 colors) (* (+ s1-1 1) 4)))) + (add-colors! this (-> s4-0 0 col) (-> s4-0 0)) + (add-colors! this (-> s4-0 1 col) (-> s4-0 1)) + (vector-copy! (-> s4-0 2 col) sv-56) + (vector-copy! (-> s4-0 3 col) sv-52) + (vector-copy! sv-52 sv-56) + (cond + ((render-ocean-quad s4-0 arg0) + (set! s2-1 #t) + ) + (else + (if s2-1 + (goto cfg-18) + ) + ) ) ) ) @@ -248,7 +249,6 @@ ) (defmethod ocean-method-61 ((this ocean) (arg0 dma-buffer)) - (local-vars (sv-48 float) (sv-52 vector) (sv-56 vector)) ;; og:preserve-this (let ((s4-0 (scratchpad-object (inline-array ocean-vertex)))) (let* ((f0-1 (+ 18874368.0 (-> this start-corner z))) @@ -263,79 +263,81 @@ (set! (-> s4-0 1 pos w) 1.0) (set! (-> s4-0 2 pos w) 0.5) (set! (-> s4-0 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 (the-as (pointer int32) (&-> 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! (-> s4-0 0 pos x) f0-9) - (set! (-> s4-0 1 pos x) f1-7) - (set! (-> s4-0 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 (the-as (pointer int32) (&-> 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! (-> s4-0 0 pos x) f0-9) + (set! (-> s4-0 1 pos x) f1-7) + (set! (-> s4-0 2 pos x) f1-7) + ) + (set! (-> s4-0 3 pos x) f0-9) ) - (set! (-> s4-0 3 pos x) f0-9) - ) - (rgba-to-vector! this sv-56 (the-as (pointer int32) (&+ (-> s3-0 colors) (* (+ s1-0 2445) 4)))) - (vector-copy! (-> s4-0 0 col) sv-52) - (vector-copy! (-> s4-0 1 col) sv-56) - (vector-copy! (-> s4-0 2 col) sv-56) - (vector-copy! (-> s4-0 3 col) sv-52) - (vector-copy! sv-52 sv-56) - (cond - ((render-ocean-quad s4-0 arg0) - (set! s2-0 #t) - ) - (else - (if s2-0 - (goto cfg-9) - ) + (rgba-to-vector! this sv-56 (the-as (pointer int32) (&+ (-> s3-0 colors) (* (+ s1-0 2445) 4)))) + (vector-copy! (-> s4-0 0 col) sv-52) + (vector-copy! (-> s4-0 1 col) sv-56) + (vector-copy! (-> s4-0 2 col) sv-56) + (vector-copy! (-> s4-0 3 col) sv-52) + (vector-copy! sv-52 sv-56) + (cond + ((render-ocean-quad s4-0 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! (-> s4-0 0 pos z) f0-11) - (set! (-> s4-0 1 pos z) f0-11) - (set! (-> s4-0 2 pos z) f1-10) - (set! (-> s4-0 3 pos z) f1-10) - ) - (set! (-> s4-0 0 pos w) 0.5) - (set! (-> s4-0 1 pos w) 0.5) - (set! (-> s4-0 2 pos w) 0.0) - (set! (-> s4-0 3 pos w) 0.0) - (let ((s3-1 (-> this ocean-colors))) - (let ((s2-1 #f)) - (rgba-to-vector! this sv-52 (the-as (pointer int32) (&-> 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! (-> s4-0 0 pos x) f0-18) - (set! (-> s4-0 1 pos x) f1-15) - (set! (-> s4-0 2 pos x) f1-15) - ) - (set! (-> s4-0 3 pos x) f0-18) - ) - (rgba-to-vector! this sv-56 (the-as (pointer int32) (&+ (-> s3-1 colors) (* (+ s1-1 2445) 4)))) - (vector-copy! (-> s4-0 0 col) sv-52) - (vector-copy! (-> s4-0 1 col) sv-56) - (add-colors! this (-> s4-0 2 col) (-> s4-0 2)) - (add-colors! this (-> s4-0 3 col) (-> s4-0 3)) - (vector-copy! sv-52 sv-56) - (cond - ((render-ocean-quad s4-0 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! (-> s4-0 0 pos z) f0-11) + (set! (-> s4-0 1 pos z) f0-11) + (set! (-> s4-0 2 pos z) f1-10) + (set! (-> s4-0 3 pos z) f1-10) + ) + (set! (-> s4-0 0 pos w) 0.5) + (set! (-> s4-0 1 pos w) 0.5) + (set! (-> s4-0 2 pos w) 0.0) + (set! (-> s4-0 3 pos w) 0.0) + (let ((s3-1 (-> this ocean-colors))) + (let ((s2-1 #f)) + (rgba-to-vector! this sv-52 (the-as (pointer int32) (&-> 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! (-> s4-0 0 pos x) f0-18) + (set! (-> s4-0 1 pos x) f1-15) + (set! (-> s4-0 2 pos x) f1-15) + ) + (set! (-> s4-0 3 pos x) f0-18) + ) + (rgba-to-vector! this sv-56 (the-as (pointer int32) (&+ (-> s3-1 colors) (* (+ s1-1 2445) 4)))) + (vector-copy! (-> s4-0 0 col) sv-52) + (vector-copy! (-> s4-0 1 col) sv-56) + (add-colors! this (-> s4-0 2 col) (-> s4-0 2)) + (add-colors! this (-> s4-0 3 col) (-> s4-0 3)) + (vector-copy! sv-52 sv-56) + (cond + ((render-ocean-quad s4-0 arg0) + (set! s2-1 #t) + ) + (else + (if s2-1 + (goto cfg-18) + ) + ) ) ) ) @@ -348,7 +350,6 @@ ) (defmethod ocean-method-62 ((this ocean) (arg0 dma-buffer)) - (local-vars (sv-48 float) (sv-52 vector) (sv-56 vector)) ;; og:preserve-this (let ((s4-0 (scratchpad-object (inline-array ocean-vertex)))) (let* ((f0-0 (-> this start-corner x)) @@ -363,79 +364,81 @@ (set! (-> s4-0 1 pos w) 1.0) (set! (-> s4-0 2 pos w) 1.0) (set! (-> s4-0 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 (the-as (pointer int32) (-> 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! (-> s4-0 0 pos z) f0-8) - (set! (-> s4-0 1 pos z) f0-8) - (set! (-> s4-0 2 pos z) f1-6) - (set! (-> s4-0 3 pos z) f1-6) - ) - (rgba-to-vector! this sv-56 (the-as (pointer int32) (&+ (-> s3-0 colors) (* 208 (+ s1-0 1))))) - (vector-copy! (-> s4-0 0 col) sv-52) - (vector-copy! (-> s4-0 1 col) sv-52) - (vector-copy! (-> s4-0 2 col) sv-56) - (vector-copy! (-> s4-0 3 col) sv-56) - (vector-copy! sv-52 sv-56) - (cond - ((render-ocean-quad s4-0 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 (the-as (pointer int32) (-> 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! (-> s4-0 0 pos z) f0-8) + (set! (-> s4-0 1 pos z) f0-8) + (set! (-> s4-0 2 pos z) f1-6) + (set! (-> s4-0 3 pos z) f1-6) + ) + (rgba-to-vector! this sv-56 (the-as (pointer int32) (&+ (-> s3-0 colors) (* 208 (+ s1-0 1))))) + (vector-copy! (-> s4-0 0 col) sv-52) + (vector-copy! (-> s4-0 1 col) sv-52) + (vector-copy! (-> s4-0 2 col) sv-56) + (vector-copy! (-> s4-0 3 col) sv-56) + (vector-copy! sv-52 sv-56) + (cond + ((render-ocean-quad s4-0 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! (-> s4-0 0 pos x) f1-9) - (set! (-> s4-0 1 pos x) f0-10) - (set! (-> s4-0 2 pos x) f0-10) - (set! (-> s4-0 3 pos x) f1-9) - ) - (set! (-> s4-0 0 pos w) 0.0) - (set! (-> s4-0 1 pos w) 0.5) - (set! (-> s4-0 2 pos w) 0.5) - (set! (-> s4-0 3 pos w) 0.0) - (let ((s3-1 (-> this ocean-colors))) - (let ((s2-1 #f)) - (rgba-to-vector! this sv-52 (the-as (pointer int32) (-> 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! (-> s4-0 0 pos z) f0-17) - (set! (-> s4-0 1 pos z) f0-17) - (set! (-> s4-0 2 pos z) f1-14) - (set! (-> s4-0 3 pos z) f1-14) - ) - (rgba-to-vector! this sv-56 (the-as (pointer int32) (&+ (-> s3-1 colors) (* 208 (+ s1-1 1))))) - (add-colors! this (-> s4-0 0 col) (-> s4-0 0)) - (vector-copy! (-> s4-0 1 col) sv-52) - (vector-copy! (-> s4-0 2 col) sv-56) - (add-colors! this (-> s4-0 3 col) (-> s4-0 3)) - (vector-copy! sv-52 sv-56) - (cond - ((render-ocean-quad s4-0 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! (-> s4-0 0 pos x) f1-9) + (set! (-> s4-0 1 pos x) f0-10) + (set! (-> s4-0 2 pos x) f0-10) + (set! (-> s4-0 3 pos x) f1-9) + ) + (set! (-> s4-0 0 pos w) 0.0) + (set! (-> s4-0 1 pos w) 0.5) + (set! (-> s4-0 2 pos w) 0.5) + (set! (-> s4-0 3 pos w) 0.0) + (let ((s3-1 (-> this ocean-colors))) + (let ((s2-1 #f)) + (rgba-to-vector! this sv-52 (the-as (pointer int32) (-> 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! (-> s4-0 0 pos z) f0-17) + (set! (-> s4-0 1 pos z) f0-17) + (set! (-> s4-0 2 pos z) f1-14) + (set! (-> s4-0 3 pos z) f1-14) + ) + (rgba-to-vector! this sv-56 (the-as (pointer int32) (&+ (-> s3-1 colors) (* 208 (+ s1-1 1))))) + (add-colors! this (-> s4-0 0 col) (-> s4-0 0)) + (vector-copy! (-> s4-0 1 col) sv-52) + (vector-copy! (-> s4-0 2 col) sv-56) + (add-colors! this (-> s4-0 3 col) (-> s4-0 3)) + (vector-copy! sv-52 sv-56) + (cond + ((render-ocean-quad s4-0 arg0) + (set! s2-1 #t) + ) + (else + (if s2-1 + (goto cfg-18) + ) + ) ) ) ) @@ -448,7 +451,6 @@ ) (defmethod ocean-method-63 ((this ocean) (arg0 dma-buffer)) - (local-vars (sv-48 float) (sv-52 vector) (sv-56 vector)) ;; og:preserve-this (let ((s4-0 (scratchpad-object (inline-array ocean-vertex)))) (let ((f0-1 (+ 18874368.0 (-> this start-corner x)))) @@ -463,79 +465,81 @@ (set! (-> s4-0 1 pos w) 0.5) (set! (-> s4-0 2 pos w) 0.5) (set! (-> s4-0 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 (the-as (pointer int32) (&-> 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! (-> s4-0 0 pos z) f0-9) - (set! (-> s4-0 1 pos z) f0-9) - (set! (-> s4-0 2 pos z) f1-7) - (set! (-> s4-0 3 pos z) f1-7) - ) - (rgba-to-vector! this sv-56 (the-as (pointer int32) (&+ (-> s3-0 colors) (* (+ (* 52 (+ s1-0 1)) 47) 4)))) - (vector-copy! (-> s4-0 0 col) sv-52) - (vector-copy! (-> s4-0 1 col) sv-52) - (vector-copy! (-> s4-0 2 col) sv-56) - (vector-copy! (-> s4-0 3 col) sv-56) - (vector-copy! sv-52 sv-56) - (cond - ((render-ocean-quad s4-0 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 (the-as (pointer int32) (&-> 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! (-> s4-0 0 pos z) f0-9) + (set! (-> s4-0 1 pos z) f0-9) + (set! (-> s4-0 2 pos z) f1-7) + (set! (-> s4-0 3 pos z) f1-7) + ) + (rgba-to-vector! this sv-56 (the-as (pointer int32) (&+ (-> s3-0 colors) (* (+ (* 52 (+ s1-0 1)) 47) 4)))) + (vector-copy! (-> s4-0 0 col) sv-52) + (vector-copy! (-> s4-0 1 col) sv-52) + (vector-copy! (-> s4-0 2 col) sv-56) + (vector-copy! (-> s4-0 3 col) sv-56) + (vector-copy! sv-52 sv-56) + (cond + ((render-ocean-quad s4-0 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! (-> s4-0 0 pos x) f0-11) - (set! (-> s4-0 1 pos x) f1-10) - (set! (-> s4-0 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! (-> s4-0 0 pos x) f0-11) + (set! (-> s4-0 1 pos x) f1-10) + (set! (-> s4-0 2 pos x) f1-10) + ) + (set! (-> s4-0 3 pos x) f0-11) ) - (set! (-> s4-0 3 pos x) f0-11) - ) - (set! (-> s4-0 0 pos w) 0.5) - (set! (-> s4-0 1 pos w) 0.0) - (set! (-> s4-0 2 pos w) 0.0) - (set! (-> s4-0 3 pos w) 0.5) - (let ((s3-1 (-> this ocean-colors))) - (let ((s2-1 #f)) - (rgba-to-vector! this sv-52 (the-as (pointer int32) (&-> 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! (-> s4-0 0 pos z) f0-18) - (set! (-> s4-0 1 pos z) f0-18) - (set! (-> s4-0 2 pos z) f1-15) - (set! (-> s4-0 3 pos z) f1-15) - ) - (rgba-to-vector! this sv-56 (the-as (pointer int32) (&+ (-> s3-1 colors) (* (+ (* 52 (+ s1-1 1)) 47) 4)))) - (vector-copy! (-> s4-0 0 col) sv-52) - (add-colors! this (-> s4-0 1 col) (-> s4-0 1)) - (add-colors! this (-> s4-0 2 col) (-> s4-0 2)) - (vector-copy! (-> s4-0 3 col) sv-56) - (vector-copy! sv-52 sv-56) - (cond - ((render-ocean-quad s4-0 arg0) - (set! s2-1 #t) - ) - (else - (if s2-1 - (goto cfg-18) - ) + (set! (-> s4-0 0 pos w) 0.5) + (set! (-> s4-0 1 pos w) 0.0) + (set! (-> s4-0 2 pos w) 0.0) + (set! (-> s4-0 3 pos w) 0.5) + (let ((s3-1 (-> this ocean-colors))) + (let ((s2-1 #f)) + (rgba-to-vector! this sv-52 (the-as (pointer int32) (&-> 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! (-> s4-0 0 pos z) f0-18) + (set! (-> s4-0 1 pos z) f0-18) + (set! (-> s4-0 2 pos z) f1-15) + (set! (-> s4-0 3 pos z) f1-15) + ) + (rgba-to-vector! this sv-56 (the-as (pointer int32) (&+ (-> s3-1 colors) (* (+ (* 52 (+ s1-1 1)) 47) 4)))) + (vector-copy! (-> s4-0 0 col) sv-52) + (add-colors! this (-> s4-0 1 col) (-> s4-0 1)) + (add-colors! this (-> s4-0 2 col) (-> s4-0 2)) + (vector-copy! (-> s4-0 3 col) sv-56) + (vector-copy! sv-52 sv-56) + (cond + ((render-ocean-quad s4-0 arg0) + (set! s2-1 #t) + ) + (else + (if s2-1 + (goto cfg-18) + ) + ) ) ) ) diff --git a/goal_src/jak3/engine/gfx/sprite/particles/light-trails.gc b/goal_src/jak3/engine/gfx/sprite/particles/light-trails.gc index c1f703c126..133558bfb6 100644 --- a/goal_src/jak3/engine/gfx/sprite/particles/light-trails.gc +++ b/goal_src/jak3/engine/gfx/sprite/particles/light-trails.gc @@ -313,28 +313,6 @@ (defmethod build-prim-strip! ((this light-trail)) "Build the mesh for this light trail." - (local-vars - (sv-64 time-frame) - (sv-72 uint) - (sv-80 int) - (sv-88 float) - (sv-92 float) - (sv-96 float) - (sv-100 rgbaf) - (sv-104 vector) - (sv-128 vector) - (sv-132 vector) - (sv-136 float) - (sv-140 float) - (sv-144 float) - (sv-148 float) - (sv-152 float) - (sv-156 float) - (sv-192 float) - (sv-196 float) - (sv-200 vector) - (sv-204 vector) - ) (set! (-> *dist-cache-array* 0) 0.0) (set! *total-length* 0.0) (let ((s5-0 (new 'stack-no-clear 'array 'int32 4))) @@ -359,227 +337,229 @@ (+! s4-0 1) ) ) - (set! sv-64 (-> this appearance max-age)) - (set! sv-72 (- (-> this start-marker) (-> this end-marker))) - (set! sv-80 0) - (set! sv-88 (the-as float 0.0)) - (set! sv-92 (the-as float -100.0)) - (set! sv-96 (the-as float 0.0)) - (set! sv-100 (new 'stack-no-clear 'rgbaf)) - (set! sv-104 (new 'stack-no-clear 'vector)) - (if (= (-> this appearance uv-mode) 3) - (set! sv-92 (the-as float 100.0)) + (let ((sv-64 (-> this appearance max-age))) + (let ((sv-72 (- (-> this start-marker) (-> this end-marker)))) ) - (set! sv-128 (math-camera-pos)) - (set! sv-132 (new 'stack-no-clear 'vector)) - (set! (-> this strip num-verts) (the-as uint 0)) - (set! (-> this strip tex-id) (-> this appearance tex-id)) - (cond - ((not (-> this appearance zbuffer?)) - (set! (-> this strip adnops 0 cmds) (gs-reg64 test-1)) - (set! (-> this strip data0) (new 'static 'gs-test - :ate #x1 - :atst (gs-atest greater-equal) - :aref #x80 - :afail #x1 - :zte #x1 - :ztst (gs-ztest greater-equal) - ) + (let ((sv-80 0) + (sv-88 (the-as float 0.0)) + (sv-92 (the-as float -100.0)) + (sv-96 (the-as float 0.0)) + (sv-100 (new 'stack-no-clear 'rgbaf)) + (sv-104 (new 'stack-no-clear 'vector)) + ) + (if (= (-> this appearance uv-mode) 3) + (set! sv-92 (the-as float 100.0)) + ) + (let ((sv-128 (math-camera-pos)) + (sv-132 (new 'stack-no-clear 'vector)) + ) + (set! (-> this strip num-verts) (the-as uint 0)) + (set! (-> this strip tex-id) (-> this appearance tex-id)) + (cond + ((not (-> this appearance zbuffer?)) + (set! (-> this strip adnops 0 cmds) (gs-reg64 test-1)) + (set! (-> this strip data0) (new 'static 'gs-test + :ate #x1 + :atst (gs-atest greater-equal) + :aref #x80 + :afail #x1 + :zte #x1 + :ztst (gs-ztest greater-equal) + ) + ) ) - ) - (else - (set! (-> this strip adnops 0 cmds) (gs-reg64 hack)) - (set! (-> this strip data0) (new 'static 'gs-test)) - 0 - ) - ) - (let ((v1-34 (-> this appearance blend-mode))) - (cond - ((= v1-34 1) - (set! (-> this strip alpha) (new 'static 'gs-alpha :b #x2 :d #x1)) - ) - ((zero? v1-34) - (set! (-> this strip alpha) (new 'static 'gs-alpha :b #x1 :d #x1)) - ) - ((= v1-34 2) - (set! (-> this strip alpha) (new 'static 'gs-alpha :a #x2 :d #x1)) - ) - ) - ) - (when (-> this strip2) - (set! (-> this strip2 num-verts) (the-as uint 0)) - (set! (-> this strip2 tex-id) (-> this appearance tex-id)) - (cond - ((not (-> this appearance zbuffer?)) - (set! (-> this strip2 adnops 0 cmds) (gs-reg64 test-1)) - (set! (-> this strip2 data0) (new 'static 'gs-test - :ate #x1 - :atst (gs-atest greater-equal) - :aref #x80 - :afail #x1 - :zte #x1 - :ztst (gs-ztest greater-equal) - ) + (else + (set! (-> this strip adnops 0 cmds) (gs-reg64 hack)) + (set! (-> this strip data0) (new 'static 'gs-test)) + 0 + ) + ) + (let ((v1-34 (-> this appearance blend-mode))) + (cond + ((= v1-34 1) + (set! (-> this strip alpha) (new 'static 'gs-alpha :b #x2 :d #x1)) + ) + ((zero? v1-34) + (set! (-> this strip alpha) (new 'static 'gs-alpha :b #x1 :d #x1)) + ) + ((= v1-34 2) + (set! (-> this strip alpha) (new 'static 'gs-alpha :a #x2 :d #x1)) ) - ) - (else - (set! (-> this strip2 adnops 0 cmds) (gs-reg64 hack)) - (set! (-> this strip2 data0) (new 'static 'gs-test)) - 0 - ) - ) - (let ((v1-52 (-> this appearance blend-mode))) - (cond - ((= v1-52 1) - (set! (-> this strip2 alpha) (new 'static 'gs-alpha :b #x2 :d #x1)) - ) - ((zero? v1-52) - (set! (-> this strip2 alpha) (new 'static 'gs-alpha :b #x1 :d #x1)) - ) - ((= v1-52 2) - (set! (-> this strip2 alpha) (new 'static 'gs-alpha :a #x2 :d #x1)) - ) - ) - ) - ) - (countdown (s5-1 (-> s5-0 0)) - (let* ((s3-1 s5-1) - (s4-1 (the-as object (&+ (-> this crumb-array data) (* (the-as int (-> this crumb-size)) s3-1)))) - ) - (set! sv-136 - (/ (the float (+ (- (-> this start-marker) (-> (the-as light-trail-breadcrumb s4-1) birth-time)) sv-80)) - (the float sv-64) - ) ) - (when (or (< 1.0 sv-136) (< sv-136 0.0)) - ) - (when (and (>= 1.0 sv-136) (>= sv-136 0.0)) - (let* ((f30-1 (-> *dist-cache-array* s5-1)) - (f28-0 (- *total-length* f30-1)) - (f26-0 (- (-> this total-distance-traveled) f28-0)) - ) - (set! sv-140 (the-as float 1.0)) - (set! sv-144 (the-as float 1.0)) - (set! sv-148 (the-as float 1.0)) - (set! sv-152 (the-as float 0.0)) - (set! sv-156 (the-as float 0.0)) - (when (-> this appearance alpha-curve-1) - (set! sv-140 - (compute-trail-scaled-t - (-> this appearance alpha-1-mode) - sv-136 - f30-1 - f28-0 - f26-0 - (-> this appearance alpha-repeat-dist) - (the-as vector (&+ (the-as (pointer uint8) s4-1) 0)) - ) - ) - (set! sv-140 (evaluate (-> this appearance alpha-curve-1) sv-140 (loop-behavior use-default))) - ) - (when (-> this appearance alpha-curve-2) - (set! sv-144 - (compute-trail-scaled-t - (-> this appearance alpha-2-mode) - sv-136 - f30-1 - f28-0 - f26-0 - (-> this appearance alpha-repeat-dist) - (the-as vector (&+ (the-as (pointer uint8) s4-1) 0)) - ) - ) - (set! sv-144 (evaluate (-> this appearance alpha-curve-2) sv-144 (loop-behavior use-default))) - ) - (when (-> this appearance width-curve) - (set! sv-148 - (compute-trail-scaled-t - (-> this appearance width-mode) - sv-136 - f30-1 - f28-0 - f26-0 - (-> this appearance width-repeat-dist) - (the-as vector (&+ (the-as (pointer uint8) s4-1) 0)) - ) - ) - (set! sv-148 (evaluate (-> this appearance width-curve) sv-148 (loop-behavior use-default))) - ) - (set! sv-152 - (compute-trail-scaled-t - (-> this appearance uv-mode) - sv-136 - f30-1 - f28-0 - f26-0 - (-> this appearance uv-repeat-dist) - (the-as vector (&+ (the-as (pointer uint8) s4-1) 0)) - ) - ) - (when (or (< 1.0 sv-152) (< sv-152 0.0)) - (let ((f0-43 sv-152)) - (set! sv-152 (- f0-43 (the float (the int f0-43)))) + ) + (when (-> this strip2) + (set! (-> this strip2 num-verts) (the-as uint 0)) + (set! (-> this strip2 tex-id) (-> this appearance tex-id)) + (cond + ((not (-> this appearance zbuffer?)) + (set! (-> this strip2 adnops 0 cmds) (gs-reg64 test-1)) + (set! (-> this strip2 data0) (new 'static 'gs-test + :ate #x1 + :atst (gs-atest greater-equal) + :aref #x80 + :afail #x1 + :zte #x1 + :ztst (gs-ztest greater-equal) + ) + ) + ) + (else + (set! (-> this strip2 adnops 0 cmds) (gs-reg64 hack)) + (set! (-> this strip2 data0) (new 'static 'gs-test)) + 0 ) ) - (set! sv-192 (* sv-140 sv-144 (-> this appearance base-alpha))) - (set! sv-196 (* sv-148 (-> this appearance base-width))) - (set! sv-200 (new 'stack-no-clear 'vector)) - (set! sv-204 (new 'stack-no-clear 'vector)) - (when (-> this appearance color-curve) - (set! sv-156 - (compute-trail-scaled-t - (-> this appearance color-mode) - sv-136 - f30-1 - f28-0 - f26-0 - (-> this appearance color-repeat-dist) - (the-as vector (&+ (the-as (pointer uint8) s4-1) 0)) + (let ((v1-52 (-> this appearance blend-mode))) + (cond + ((= v1-52 1) + (set! (-> this strip2 alpha) (new 'static 'gs-alpha :b #x2 :d #x1)) + ) + ((zero? v1-52) + (set! (-> this strip2 alpha) (new 'static 'gs-alpha :b #x1 :d #x1)) + ) + ((= v1-52 2) + (set! (-> this strip2 alpha) (new 'static 'gs-alpha :a #x2 :d #x1)) + ) + ) + ) + ) + (countdown (s5-1 (-> s5-0 0)) + (let* ((s3-1 s5-1) + (s4-1 (the-as object (&+ (-> this crumb-array data) (* (the-as int (-> this crumb-size)) s3-1)))) + (sv-136 + (/ (the float (+ (- (-> this start-marker) (-> (the-as light-trail-breadcrumb s4-1) birth-time)) sv-80)) + (the float sv-64) + ) + ) + ) + (when (or (< 1.0 sv-136) (< sv-136 0.0)) + ) + (when (and (>= 1.0 sv-136) (>= sv-136 0.0)) + (let* ((f30-1 (-> *dist-cache-array* s5-1)) + (f28-0 (- *total-length* f30-1)) + (f26-0 (- (-> this total-distance-traveled) f28-0)) + (sv-140 (the-as float 1.0)) + (sv-144 (the-as float 1.0)) + (sv-148 (the-as float 1.0)) + (sv-152 (the-as float 0.0)) + (sv-156 (the-as float 0.0)) + ) + (when (-> this appearance alpha-curve-1) + (set! sv-140 (compute-trail-scaled-t + (-> this appearance alpha-1-mode) + sv-136 + f30-1 + f28-0 + f26-0 + (-> this appearance alpha-repeat-dist) + (the-as vector (&+ (the-as (pointer uint8) s4-1) 0)) + ) + ) + (set! sv-140 (evaluate (-> this appearance alpha-curve-1) sv-140 (loop-behavior use-default))) + ) + (when (-> this appearance alpha-curve-2) + (set! sv-144 (compute-trail-scaled-t + (-> this appearance alpha-2-mode) + sv-136 + f30-1 + f28-0 + f26-0 + (-> this appearance alpha-repeat-dist) + (the-as vector (&+ (the-as (pointer uint8) s4-1) 0)) + ) + ) + (set! sv-144 (evaluate (-> this appearance alpha-curve-2) sv-144 (loop-behavior use-default))) + ) + (when (-> this appearance width-curve) + (set! sv-148 (compute-trail-scaled-t + (-> this appearance width-mode) + sv-136 + f30-1 + f28-0 + f26-0 + (-> this appearance width-repeat-dist) + (the-as vector (&+ (the-as (pointer uint8) s4-1) 0)) + ) + ) + (set! sv-148 (evaluate (-> this appearance width-curve) sv-148 (loop-behavior use-default))) + ) + (set! sv-152 (compute-trail-scaled-t + (-> this appearance uv-mode) + sv-136 + f30-1 + f28-0 + f26-0 + (-> this appearance uv-repeat-dist) + (the-as vector (&+ (the-as (pointer uint8) s4-1) 0)) + ) + ) + (when (or (< 1.0 sv-152) (< sv-152 0.0)) + (let ((f0-43 sv-152)) + (set! sv-152 (- f0-43 (the float (the int f0-43)))) ) ) - (evaluate (-> this appearance color-curve) sv-156 (the-as rgbaf sv-200) (loop-behavior use-default)) - ) - ) - (set! (-> sv-200 w) (* (-> sv-200 w) sv-192)) - (calc-vertex-pos! this (the-as light-trail-breadcrumb s4-1) s3-1 sv-128 sv-204) - (when (or (and (= (-> this appearance uv-mode) 3) (< sv-92 sv-152)) - (and (!= (-> this appearance uv-mode) 3) (< sv-152 sv-92)) + (let ((sv-192 (* sv-140 sv-144 (-> this appearance base-alpha))) + (sv-196 (* sv-148 (-> this appearance base-width))) + (sv-200 (new 'stack-no-clear 'vector)) + (sv-204 (new 'stack-no-clear 'vector)) + ) + (when (-> this appearance color-curve) + (set! sv-156 + (compute-trail-scaled-t + (-> this appearance color-mode) + sv-136 + f30-1 + f28-0 + f26-0 + (-> this appearance color-repeat-dist) + (the-as vector (&+ (the-as (pointer uint8) s4-1) 0)) + ) + ) + (evaluate (-> this appearance color-curve) sv-156 (the-as rgbaf sv-200) (loop-behavior use-default)) + ) + (set! (-> sv-200 w) (* (-> sv-200 w) sv-192)) + (calc-vertex-pos! this (the-as light-trail-breadcrumb s4-1) s3-1 sv-128 sv-204) + (when (or (and (= (-> this appearance uv-mode) 3) (< sv-92 sv-152)) + (and (!= (-> this appearance uv-mode) 3) (< sv-152 sv-92)) + ) + (let ((s2-0 (new 'stack-no-clear 'inline-array 'vector 5))) + (set! (-> s2-0 3 z) (- sv-152)) + (set! (-> s2-0 3 w) (- sv-92 (-> s2-0 3 z))) + (set! (-> s2-0 4 x) (/ sv-92 (-> s2-0 3 w))) + (vector-lerp! (-> s2-0 0) sv-104 (the-as vector (&+ (the-as (pointer uint8) s4-1) 0)) (-> s2-0 4 x)) + (rgbaf-lerp! (the-as rgbaf (-> s2-0 2)) sv-100 (the-as rgbaf sv-200) (-> s2-0 4 x)) + (set! (-> s2-0 3 y) (lerp sv-96 sv-196 (-> s2-0 4 x))) + (vector-lerp! (-> s2-0 1) sv-132 sv-204 (-> s2-0 4 x)) + (set! (-> s2-0 3 x) (the-as float (rgba<-rgbaf (the-as rgba (-> s2-0 3 x)) (the-as rgbaf (-> s2-0 2))))) + (add-tri-pair-to-prim! this (-> s2-0 0) (the-as rgba (-> s2-0 3 x)) (-> s2-0 3 y) (-> s2-0 1) 0.0) + (add-tri-pair-to-prim! this (-> s2-0 0) (the-as rgba (-> s2-0 3 x)) (-> s2-0 3 y) (-> s2-0 1) 1.0) + ) + ) + (add-tri-pair-to-prim! + this + (the-as vector (&+ (the-as (pointer uint8) s4-1) 0)) + (rgba<-rgbaf (the-as rgba (new 'stack-no-clear 'rgbaf)) (the-as rgbaf sv-200)) + sv-196 + sv-204 + sv-152 + ) + (when (> s3-1 0) + (let ((v1-149 (&+ (-> this crumb-array data) (* (the-as int (-> this crumb-size)) (+ s3-1 -1))))) + (+! sv-88 + (vector-vector-distance (the-as vector (&+ (the-as (pointer uint8) s4-1) 0)) (the-as vector (&+ v1-149 0))) + ) + ) + ) + (set! sv-92 sv-152) + (vector-copy! sv-104 (the-as vector (&+ (the-as (pointer uint8) s4-1) 0))) + (set! sv-96 sv-196) + (set! (-> sv-100 quad) (-> sv-200 quad)) + (vector-copy! sv-132 sv-204) ) - (let ((s2-0 (new 'stack-no-clear 'inline-array 'vector 5))) - (set! (-> s2-0 3 z) (- sv-152)) - (set! (-> s2-0 3 w) (- sv-92 (-> s2-0 3 z))) - (set! (-> s2-0 4 x) (/ sv-92 (-> s2-0 3 w))) - (vector-lerp! (-> s2-0 0) sv-104 (the-as vector (&+ (the-as (pointer uint8) s4-1) 0)) (-> s2-0 4 x)) - (rgbaf-lerp! (the-as rgbaf (-> s2-0 2)) sv-100 (the-as rgbaf sv-200) (-> s2-0 4 x)) - (set! (-> s2-0 3 y) (lerp sv-96 sv-196 (-> s2-0 4 x))) - (vector-lerp! (-> s2-0 1) sv-132 sv-204 (-> s2-0 4 x)) - (set! (-> s2-0 3 x) (the-as float (rgba<-rgbaf (the-as rgba (-> s2-0 3 x)) (the-as rgbaf (-> s2-0 2))))) - (add-tri-pair-to-prim! this (-> s2-0 0) (the-as rgba (-> s2-0 3 x)) (-> s2-0 3 y) (-> s2-0 1) 0.0) - (add-tri-pair-to-prim! this (-> s2-0 0) (the-as rgba (-> s2-0 3 x)) (-> s2-0 3 y) (-> s2-0 1) 1.0) + ) + ) ) ) - (add-tri-pair-to-prim! - this - (the-as vector (&+ (the-as (pointer uint8) s4-1) 0)) - (rgba<-rgbaf (the-as rgba (new 'stack-no-clear 'rgbaf)) (the-as rgbaf sv-200)) - sv-196 - sv-204 - sv-152 - ) - (when (> s3-1 0) - (let ((v1-149 (&+ (-> this crumb-array data) (* (the-as int (-> this crumb-size)) (+ s3-1 -1))))) - (set! sv-88 - (+ sv-88 - (vector-vector-distance (the-as vector (&+ (the-as (pointer uint8) s4-1) 0)) (the-as vector (&+ v1-149 0))) - ) - ) - ) - ) - (set! sv-92 sv-152) - (vector-copy! sv-104 (the-as vector (&+ (the-as (pointer uint8) s4-1) 0))) - (set! sv-96 sv-196) - (set! (-> sv-100 quad) (-> sv-200 quad)) - (vector-copy! sv-132 sv-204) ) ) ) @@ -1168,7 +1148,7 @@ ) ) ) - (vector-cross! arg3 v1-0 (the-as vector (&+ arg0 16))) + (vector-cross! arg3 v1-0 (-> (&+ arg0 16) pos)) ) (none) ) diff --git a/goal_src/jak3/engine/gfx/sprite/sprite-distort.gc b/goal_src/jak3/engine/gfx/sprite/sprite-distort.gc index 9741ab0ed2..1bc60a85bb 100644 --- a/goal_src/jak3/engine/gfx/sprite/sprite-distort.gc +++ b/goal_src/jak3/engine/gfx/sprite/sprite-distort.gc @@ -151,15 +151,7 @@ ;; ERROR: Unsupported inline assembly instruction kind - [cfc2.i v1, Clipping] (defun sprite-draw-distorters ((arg0 dma-buffer)) "Generate DMA to draw all distort sprites." - (local-vars - (v1-15 float) - (v1-21 float) - (v1-26 int) - (v1-65 float) - (sv-16 sprite-vec-data-2d) - (sv-32 vector) - (sv-48 vector) - ) + (local-vars (v1-15 float) (v1-21 float) (v1-26 int) (v1-65 float)) (rlet ((acc :class vf) (Q :class vf) (vf0 :class vf) @@ -186,10 +178,11 @@ (dotimes (s1-0 s2-0) (let ((v1-5 (-> s3-0 data s1-0))) (when (= (-> v1-5 aux-type) (sprite-aux-type distort)) - (set! sv-16 (-> v1-5 vec-data)) - (let ((a0-3 (the-as object (-> arg0 base)))) - (set! sv-32 (the-as vector (&+ (the-as pointer a0-3) 16))) - (set! sv-48 (the-as vector (&+ (the-as pointer a0-3) 32))) + (let* ((sv-16 (-> v1-5 vec-data)) + (a0-3 (the-as object (-> arg0 base))) + (sv-32 (the-as vector (&+ (the-as pointer a0-3) 16))) + (sv-48 (the-as vector (&+ (the-as pointer a0-3) 32))) + ) (cond ((= (the-as int (-> sv-16 flag-rot-sy y)) 1) (.lvf vf3 (&-> *math-camera* sprite-2d rvec quad)) @@ -230,32 +223,32 @@ (set! (-> (the-as vector a0-3) w) 255.0) (set! (-> sv-32 x) (+ 0.0009765625 (* 0.001953125 (+ -1792.0 (-> (the-as vector a0-3) x))))) (set! (-> sv-32 y) (+ 0.0009765625 (* 0.001953125 (+ -1840.0 (-> (the-as vector a0-3) y))))) - ) - (set! (-> sv-32 z) 1.0) - (when (or (< (the-as int (-> sv-16 flag-rot-sy x)) 3) (< 11 (the-as int (-> sv-16 flag-rot-sy x)))) - (format 0 "Turns = ~D!!!~%" (-> sv-16 flag-rot-sy x)) - (set! (-> sv-16 flag-rot-sy x) (the-as float #xb)) - ) - (set! (-> sv-32 w) (-> sv-16 flag-rot-sy x)) - (let* ((f1-4 (- (-> *math-camera* perspective uvec y))) - (f2-4 (-> sv-32 y)) - (f4-0 (+ f2-4 (* (-> sv-48 x) f1-4))) - (f3-2 256.0) - (f0-9 (-> sv-48 x)) - ) - (if (< 416.0 f4-0) - (set! f3-2 (/ (- 416.0 f2-4) f1-4)) + (set! (-> sv-32 z) 1.0) + (when (or (< (-> sv-16 flag) 3) (< 11 (-> sv-16 flag))) + (format 0 "Turns = ~D!!!~%" (-> sv-16 flag)) + (set! (-> sv-16 flag) 11) + ) + (set! (-> sv-32 w) (the-as float (-> sv-16 flag))) + (let* ((f1-4 (- (-> *math-camera* perspective uvec y))) + (f2-4 (-> sv-32 y)) + (f4-0 (+ f2-4 (* (-> sv-48 x) f1-4))) + (f3-2 256.0) + (f0-9 (-> sv-48 x)) + ) + (if (< 416.0 f4-0) + (set! f3-2 (/ (- 416.0 f2-4) f1-4)) + ) + (if (< 128.0 f3-2) + (set! f3-2 128.0) + ) + (when (< f3-2 f0-9) + (let ((v1-63 (/ f3-2 f0-9))) + (.mov vf1 v1-63) + ) + (.mul.x.vf vf2 vf2 vf1) + (.svf (&-> sv-48 quad) vf2) + (.mov v1-65 vf2) ) - (if (< 128.0 f3-2) - (set! f3-2 128.0) - ) - (when (< f3-2 f0-9) - (let ((v1-63 (/ f3-2 f0-9))) - (.mov vf1 v1-63) - ) - (.mul.x.vf vf2 vf2 vf1) - (.svf (&-> sv-48 quad) vf2) - (.mov v1-65 vf2) ) ) (&+! (-> arg0 base) 48) diff --git a/goal_src/jak3/engine/gfx/sprite/sprite-glow.gc b/goal_src/jak3/engine/gfx/sprite/sprite-glow.gc index d319f63275..98bdc00edd 100644 --- a/goal_src/jak3/engine/gfx/sprite/sprite-glow.gc +++ b/goal_src/jak3/engine/gfx/sprite/sprite-glow.gc @@ -574,24 +574,26 @@ (defmethod draw-all-sprites! ((this simple-sprite-system) (arg0 dma-buffer)) "Submit all sprites to the sprite-glow renderer" - (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/goal_src/jak3/engine/gfx/sprite/sprite.gc b/goal_src/jak3/engine/gfx/sprite/sprite.gc index 4fad24d08e..9ee606449b 100644 --- a/goal_src/jak3/engine/gfx/sprite/sprite.gc +++ b/goal_src/jak3/engine/gfx/sprite/sprite.gc @@ -419,7 +419,7 @@ The glow and distort renderers will pull sprites from here." (set! (-> arg0 x) f0-0) (set! (-> arg0 y) f1-0) (set! (-> arg0 z) f2-0) - (set! (-> arg0 w) (sqrtf (- (- (- 1.0 (* f2-0 f2-0)) (* f1-0 f1-0)) (* f0-0 f0-0)))) + (set! (-> arg0 w) (sqrtf (- (- (- 1.0 (square f2-0)) (square f1-0)) (square f0-0)))) ) arg0 ) diff --git a/goal_src/jak3/engine/level/region.gc b/goal_src/jak3/engine/level/region.gc index 48a1fef95d..6fb86168d7 100644 --- a/goal_src/jak3/engine/level/region.gc +++ b/goal_src/jak3/engine/level/region.gc @@ -74,53 +74,55 @@ ) (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 (#if PC_PORT (region-enter-color #x80) (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 577) - ) - (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 577) - ) - (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 577) - ) - (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) + ;; og:preserve-this + (add-debug-x #t (bucket-id debug-no-zbuf1) sv-36 (#if PC_PORT (region-enter-color #x80) (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 577) + ) + (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 577) - ) - (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 577) + ) + (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 577) + ) + (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 577) + ) + (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) ) ) ) @@ -202,6 +204,7 @@ ) (defmethod debug-draw-region ((this drawable-region-sphere) (arg0 int)) + ;; og:preserve-this (#when PC_PORT (when (and *debug-region-hide-empty* (nonzero? (-> this region)) (not (or (-> this region on-enter) (-> this region on-exit) (-> this region on-inside)))) ;; no scripts to run means the region is "empty" so do not render (unless enabled) @@ -210,6 +213,7 @@ (t9-0 this arg0) ) (let ((a2-0 (-> this bsphere))) + ;; og:preserve-this (add-debug-sphere #t (bucket-id debug) a2-0 (-> this bsphere w) (#if PC_PORT (region-enter-color #x80) (new 'static 'rgba :r #xff :a #x80))) ) 0 @@ -241,6 +245,7 @@ ) (defmethod debug-draw-region ((this drawable-region-face) (arg0 int)) + ;; og:preserve-this (#when PC_PORT (when (and *debug-region-hide-empty* (nonzero? (-> this region)) (not (or (-> this region on-enter) (-> this region on-exit) (-> this region on-inside)))) ;; no scripts to run means the region is "empty" so do not render (unless enabled) @@ -250,6 +255,7 @@ (t9-0 this arg0) ) ) + ;; og:preserve-this (#cond (PC_PORT (when *debug-region-show-bsphere* @@ -272,7 +278,6 @@ ) (defmethod track-region ((this drawable-region-face) (arg0 region-prim-area)) - (local-vars (sv-48 vector) (sv-52 vector) (sv-56 (inline-array vector))) (-> this region) (let* ((s4-0 (-> this data)) (v1-1 (-> s4-0 normal)) @@ -281,34 +286,36 @@ ) (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 (-> s4-0 points)) - (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)) + (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 (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) - ) - (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) (-> (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 + (-> (the-as (inline-array vector) sv-56) 0) + (-> (the-as (inline-array vector) sv-56) 1) + (-> (the-as (inline-array vector) sv-56) 2) + ) + (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) + ) + (+! s2-0 1) + (set! sv-56 (the-as (inline-array vector) (-> (the-as (inline-array vector) sv-56) 1))) + ) ) ) (set! s3-0 s3-0) @@ -404,7 +411,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)) ;; og:preserve-this (sphere<-vector+r! (the-as sphere (-> (scratchpad-object region-prim-area) pos)) arg0 0.0) (dotimes (s5-0 (-> *level* length)) @@ -416,9 +422,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? @@ -429,7 +436,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))))) ) ) @@ -470,35 +477,34 @@ ) (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))) - ;; og:preserve-this - (set! (-> (scratchpad-object region-prim-area) region-prim-list num-items) 0) - (set! (-> (scratchpad-object region-prim-area) region-enter-count) 0) - (set! (-> (scratchpad-object region-prim-area) region-exit-count) 0) - (set! (-> (scratchpad-object region-prim-area) region-inside-count) 0) - (set! (-> (scratchpad-object region-prim-area) region-start-count) 0) - (sphere<-vector+r! (the-as sphere (-> (scratchpad-object region-prim-area) pos)) arg1 0.0) - (sphere<-vector+r! (the-as sphere (-> (scratchpad-object region-prim-area) exit-pos)) arg2 0.0) - (vector-! (-> (scratchpad-object region-prim-area) ray) arg2 arg1) - (vector-! (-> (scratchpad-object region-prim-area) exit-ray) 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) - ;; og:preserve-this - (collect-regions a0-14 (the-as sphere sv-32) 0 (-> (scratchpad-object region-prim-area) region-prim-list)) - ) - (+! s2-0 1) - (set! a0-14 (-> s4-1 s2-0)) + (let ((sv-32 (vector-average! (new 'stack-no-clear 'vector) arg1 arg2))) + ;; og:preserve-this + (set! (-> (scratchpad-object region-prim-area) region-prim-list num-items) 0) + (set! (-> (scratchpad-object region-prim-area) region-enter-count) 0) + (set! (-> (scratchpad-object region-prim-area) region-exit-count) 0) + (set! (-> (scratchpad-object region-prim-area) region-inside-count) 0) + (set! (-> (scratchpad-object region-prim-area) region-start-count) 0) + (sphere<-vector+r! (the-as sphere (-> (scratchpad-object region-prim-area) pos)) arg1 0.0) + (sphere<-vector+r! (the-as sphere (-> (scratchpad-object region-prim-area) exit-pos)) arg2 0.0) + (vector-! (-> (scratchpad-object region-prim-area) ray) arg2 arg1) + (vector-! (-> (scratchpad-object region-prim-area) exit-ray) 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) + ;; og:preserve-this + (collect-regions a0-14 (the-as sphere sv-32) 0 (-> (scratchpad-object region-prim-area) region-prim-list)) + ) + (+! s2-0 1) + (set! a0-14 (-> s4-1 s2-0)) + ) ) ) ) @@ -513,6 +519,7 @@ (the-as region-prim-area (-> (scratchpad-object region-prim-area) region-prim-list)) ) ) + ;; og:preserve-this (let ((gp-2 (-> (scratchpad-object region-prim-area) region-enter-count))) (while (begin (label cfg-22) (nonzero? gp-2)) (+! gp-2 -1) @@ -520,6 +527,7 @@ (s5-2 (-> a2-5 on-enter)) ) (when s5-2 + ;; og:preserve-this (countdown (v1-47 (-> (scratchpad-object region-prim-area) region-start-count)) (if (= a2-5 (-> (scratchpad-object region-prim-area) region-start-list v1-47)) (goto cfg-22) @@ -528,6 +536,7 @@ (script-eval s5-2 :key a2-5 + ;; og:preserve-this :vector (-> (scratchpad-object region-prim-area) region-enter-prim-list gp-2 bsphere) ) ) @@ -538,10 +547,12 @@ (let ((gp-3 (-> (scratchpad-object region-prim-area) region-exit-count))) (while (begin (label cfg-31) (nonzero? gp-3)) (+! gp-3 -1) + ;; og:preserve-this (let* ((a2-6 (-> (scratchpad-object region-prim-area) region-exit-list gp-3)) (s5-3 (-> a2-6 on-exit)) ) (when s5-3 + ;; og:preserve-this (countdown (v1-64 (-> (scratchpad-object region-prim-area) region-inside-count)) (if (= a2-6 (-> (scratchpad-object region-prim-area) region-inside-list v1-64)) (goto cfg-31) @@ -550,6 +561,7 @@ (script-eval s5-3 :key a2-6 + ;; og:preserve-this :vector (-> (scratchpad-object region-prim-area) region-exit-prim-list gp-3 bsphere) ) ) @@ -565,6 +577,7 @@ (script-eval s5-4 :key a2-7 + ;; og:preserve-this :vector (-> (scratchpad-object region-prim-area) region-inside-prim-list gp-4 bsphere) ) ) diff --git a/goal_src/jak3/engine/load/decomp.gc b/goal_src/jak3/engine/load/decomp.gc index c99650612c..78e0ac2a4f 100644 --- a/goal_src/jak3/engine/load/decomp.gc +++ b/goal_src/jak3/engine/load/decomp.gc @@ -247,7 +247,7 @@ (defmethod update-vis! ((this level) (arg0 level-vis-info) (arg1 uint) (arg2 (pointer uint8))) "Load/decompress precomputed visibility." - (local-vars (t0-3 uint128) (sv-16 int) (sv-32 (pointer int8))) + (local-vars (t0-3 uint128)) (let* ((a0-1 (-> arg0 from-bsp current-leaf-idx)) (v1-1 (-> arg0 current-vis-string)) (s3-0 (-> arg0 vis-string a0-1)) @@ -338,9 +338,10 @@ (set! (-> (the-as (pointer int128) (&+ s1-0 (* a0-23 16)))) (the int128 0)) ) ) - (set! sv-16 (-> this bsp extra-vis-list-length)) - (set! sv-32 (&+ s1-0 (- s4-1 sv-16))) - (let ((v1-45 (unpack-vis (-> this bsp drawable-trees) s1-0 (the-as (pointer int8) s3-1)))) + (let* ((sv-16 (-> this bsp extra-vis-list-length)) + (sv-32 (&+ s1-0 (- s4-1 sv-16))) + (v1-45 (unpack-vis (-> this bsp drawable-trees) s1-0 (the-as (pointer int8) s3-1))) + ) (dotimes (a0-25 sv-16) (let ((a1-9 (-> v1-45 0))) (set! v1-45 (&-> v1-45 1)) diff --git a/goal_src/jak3/engine/load/load-state.gc b/goal_src/jak3/engine/load/load-state.gc index 47b1cb8db5..f42ce62b63 100644 --- a/goal_src/jak3/engine/load/load-state.gc +++ b/goal_src/jak3/engine/load/load-state.gc @@ -166,7 +166,7 @@ ;; WARN: Return type mismatch pair vs object. (defun borrow-city-expansion ((arg0 pair)) - (local-vars (v1-12 type) (s2-2 int) (sv-16 pair) (sv-20 symbol) (sv-24 object)) + (local-vars (v1-12 type) (s2-2 int)) (let ((gp-0 *borrow-city-expansion-list*)) 0 (let ((s4-0 0)) @@ -203,37 +203,39 @@ (mark-permanent-holds gp-0) ) (dotimes (s4-1 (the-as int (-> *setting-control* user-current borrow-city-count))) - (set! sv-16 (-> *setting-control* user-current borrow-city s4-1)) - (let* ((s3-0 sv-16) + (let* ((sv-16 (-> *setting-control* user-current borrow-city s4-1)) + (s3-0 sv-16) (v1-20 (car s3-0)) ) (while (not (null? s3-0)) - (set! sv-20 (the-as symbol #f)) - (set! sv-24 v1-20) - (when sv-24 - (dotimes (s2-0 (/ s5-1 2)) - (when (= sv-24 (ref gp-0 (* s2-0 2))) - (set! sv-20 #t) - (if (= (ref gp-0 (+ (* s2-0 2) 1)) 'auto) - (set! (car (ref& gp-0 (+ (* s2-0 2) 1))) 'faction) - ) - 0 - (goto cfg-37) + (let ((sv-20 (the-as symbol #f)) + (sv-24 v1-20) ) - ) - (label cfg-37) - (when (not sv-20) - (dotimes (s2-1 (/ s5-1 2)) - (when (= (ref gp-0 (+ (* s2-1 2) 1)) 'auto) - (set! s2-2 s2-1) - (goto cfg-45) + (when sv-24 + (dotimes (s2-0 (/ s5-1 2)) + (when (= sv-24 (ref gp-0 (* s2-0 2))) + (set! sv-20 #t) + (if (= (ref gp-0 (+ (* s2-0 2) 1)) 'auto) + (set! (car (ref& gp-0 (+ (* s2-0 2) 1))) 'faction) + ) + 0 + (goto cfg-37) ) ) - (set! s2-2 -1) - (label cfg-45) - (when (> s2-2 0) - (set! (car (ref& gp-0 (* s2-2 2))) sv-24) - (set! (car (ref& gp-0 (+ (* s2-2 2) 1))) 'faction) + (label cfg-37) + (when (not sv-20) + (dotimes (s2-1 (/ s5-1 2)) + (when (= (ref gp-0 (+ (* s2-1 2) 1)) 'auto) + (set! s2-2 s2-1) + (goto cfg-45) + ) + ) + (set! s2-2 -1) + (label cfg-45) + (when (> s2-2 0) + (set! (car (ref& gp-0 (* s2-2 2))) sv-24) + (set! (car (ref& gp-0 (+ (* s2-2 2) 1))) 'faction) + ) ) ) ) @@ -349,7 +351,6 @@ ) (defmethod add-borrow-levels ((this load-state)) - (local-vars (sv-16 int)) (dotimes (s5-0 10) (let ((a0-1 (-> this want s5-0 name))) (when a0-1 @@ -364,25 +365,26 @@ ) ) ) - (set! sv-16 0) - (dotimes (s5-1 10) - (if (-> this want s5-1 name) - (add-want-level - (-> this want-exp) - (the-as (pointer int64) (& sv-16)) - (-> this want s5-1 name) - (-> this want s5-1 display?) - (-> this want s5-1 force-vis?) - (-> this want s5-1 force-inside?) + (let ((sv-16 0)) + (dotimes (s5-1 10) + (if (-> this want s5-1 name) + (add-want-level + (-> this want-exp) + (the-as (pointer int64) (& sv-16)) + (-> this want s5-1 name) + (-> this want s5-1 display?) + (-> this want s5-1 force-vis?) + (-> this want s5-1 force-inside?) + ) ) - ) - ) - (while (< sv-16 10) - (set! (-> this want-exp sv-16 name) #f) - (set! (-> this want-exp sv-16 display?) #f) - (set! (-> this want-exp sv-16 force-vis?) #f) - (set! (-> this want-exp sv-16 force-inside?) #f) - (set! sv-16 (+ sv-16 1)) + ) + (while (< sv-16 10) + (set! (-> this want-exp sv-16 name) #f) + (set! (-> this want-exp sv-16 display?) #f) + (set! (-> this want-exp sv-16 force-vis?) #f) + (set! (-> this want-exp sv-16 force-inside?) #f) + (+! sv-16 1) + ) ) (cond ((-> this update-callback) diff --git a/goal_src/jak3/engine/load/loader.gc b/goal_src/jak3/engine/load/loader.gc index da1613eeaa..f62c2167f1 100644 --- a/goal_src/jak3/engine/load/loader.gc +++ b/goal_src/jak3/engine/load/loader.gc @@ -794,7 +794,7 @@ (arg3 (function process-drawable symbol)) (arg4 spooler-flags) ) - (local-vars (v0-62 int) (sv-176 int)) + (local-vars (v0-62 int)) (let ((gp-0 (new 'stack 'spooler-block))) (let ((s5-0 gp-0)) (set! (-> s5-0 anim) arg0) @@ -1024,68 +1024,69 @@ (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-62) 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-139) - ) - (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-62) 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-139) + ) + (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)) + (if (and (logtest? (-> gp-0 flags) (spooler-flags blackout-on-stall)) (<= sv-176 0)) + (set-blackout-frames (seconds 0.05)) + ) + (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? (-> 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-62 (current-str-pos (-> gp-0 sid))) + (set! sv-176 v0-62) ) - (set! (-> gp-0 old-pos) sv-176) - (set-time! (-> gp-0 old-time)) - (if (and (logtest? (-> gp-0 flags) (spooler-flags blackout-on-stall)) (<= sv-176 0)) - (set-blackout-frames (seconds 0.05)) - ) - (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? (-> 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-62 (current-str-pos (-> gp-0 sid))) - (set! sv-176 v0-62) ) (set! (-> gp-0 part-audio-start) f28-0) ) @@ -1609,7 +1610,6 @@ ) (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))) @@ -1625,8 +1625,9 @@ ) (case a2-1 ((95) - (let ((s0-0 80)) - (set! sv-16 92) + (let ((s0-0 80) + (sv-16 92) + ) (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) @@ -1636,8 +1637,9 @@ ) ) ((79) - (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) @@ -1647,8 +1649,9 @@ ) ) ((47) - (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) @@ -1728,10 +1731,7 @@ (cond ((the-as gui-connection gp-0) (dotimes (s4-0 4) - (when (and (string-charp= - (-> (the-as gui-connection gp-0) name) - (the-as (pointer uint8) (-> *sound-iop-info* stream-name s4-0)) - ) + (when (and (string-charp= (-> (the-as gui-connection gp-0) name) (-> *sound-iop-info* stream-name s4-0 name)) (or (= (-> (the-as gui-connection gp-0) id) (-> *sound-iop-info* stream-id s4-0)) (zero? (-> *sound-iop-info* stream-id s4-0)) ) @@ -1835,44 +1835,46 @@ (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 (-> 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 (-> (the-as gui-connection s1-0) id))) - (or (= arg2 (gui-channel none)) (= arg2 (-> (the-as gui-connection s1-0) channel))) - (or (= sv-17 (gui-action none)) (= sv-17 (-> (the-as gui-connection s1-0) action))) - (or (not sv-20) (string= sv-20 (-> (the-as gui-connection s1-0) name))) - (or (not arg5) (arg5 (the-as gui-connection s1-0))) - (or (not arg6) (= arg6 (get-process (the-as gui-connection s1-0)))) - ) - (cond - ((and (= sv-16 (gui-action hide)) - (!= (-> this ids (-> (the-as gui-connection s1-0) channel)) (-> (the-as gui-connection s1-0) id)) - ) - (set! (-> (the-as gui-connection s1-0) action) (gui-action hidden)) - ) - ((and (= sv-16 (gui-action play)) (= (-> (the-as gui-connection s1-0) action) (gui-action playing))) - ) - (else - (set! (-> (the-as gui-connection s1-0) action) sv-16) - ;; og:preserve-this fixed naughty dog bug here. was 'play instead of (gui-action play) - (if (and (= sv-16 (gui-action play)) - (handle-command-list this (-> (the-as gui-connection s1-0) channel) (the-as gui-connection s1-0)) - ) - (channel-id-set! this (the-as gui-connection s1-0) (-> (the-as gui-connection s1-0) id)) - ) + (let ((sv-16 arg0) + (sv-17 arg3) + (sv-20 arg4) + ) + (let ((sv-24 arg5)) + ) + (let ((s1-0 (-> 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 (-> (the-as gui-connection s1-0) id))) + (or (= arg2 (gui-channel none)) (= arg2 (-> (the-as gui-connection s1-0) channel))) + (or (= sv-17 (gui-action none)) (= sv-17 (-> (the-as gui-connection s1-0) action))) + (or (not sv-20) (string= sv-20 (-> (the-as gui-connection s1-0) name))) + (or (not arg5) (arg5 (the-as gui-connection s1-0))) + (or (not arg6) (= arg6 (get-process (the-as gui-connection s1-0)))) + ) + (cond + ((and (= sv-16 (gui-action hide)) + (!= (-> this ids (-> (the-as gui-connection s1-0) channel)) (-> (the-as gui-connection s1-0) id)) + ) + (set! (-> (the-as gui-connection s1-0) action) (gui-action hidden)) + ) + ((and (= sv-16 (gui-action play)) (= (-> (the-as gui-connection s1-0) action) (gui-action playing))) + ) + (else + (set! (-> (the-as gui-connection s1-0) action) sv-16) + ;; og:preserve-this fixed naughty dog bug here. was 'play instead of (gui-action play) + (if (and (= sv-16 (gui-action play)) + (handle-command-list this (-> (the-as gui-connection s1-0) channel) (the-as gui-connection s1-0)) + ) + (channel-id-set! this (the-as gui-connection s1-0) (-> (the-as gui-connection s1-0) id)) + ) + ) ) ) + (set! s1-0 s0-0) + (-> this engine) + (set! s0-0 (-> s0-0 next0)) ) - (set! s1-0 s0-0) - (-> this engine) - (set! s0-0 (-> s0-0 next0)) ) ) ) @@ -1888,68 +1890,66 @@ (arg4 float) (arg5 time-frame) ) - (local-vars - (sv-16 int) - (sv-20 gui-connection) - (sv-32 connectable) - (sv-48 connectable) - (sv-64 connectable) - (sv-80 int) - ) - (set! sv-32 (the-as connectable #f)) - (set! sv-48 (-> this engine alive-list next0)) - (-> this engine) - (set! sv-64 (-> 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)) - (= ((method-of-type gui-connection get-process) (the-as connection sv-48)) arg0) - ) - (set! sv-32 sv-48) - (goto cfg-12) - ) - (set! sv-48 sv-64) - (-> this engine) - (set! sv-64 (-> 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 (add-connection (-> this engine) arg0 arg4 0 arg3 sv-16)) - (the-as connection sv-32) - ) - (the-as sound-id (cond - (sv-32 - (set! (-> (the-as gui-connection sv-32) priority) arg4) - (set! (-> (the-as gui-connection sv-32) channel) arg1) - (set! (-> (the-as gui-connection sv-32) action) arg2) - (set! (-> (the-as gui-connection sv-32) param2) (the-as int arg3)) - (set! (-> (the-as gui-connection sv-32) hold-time) arg5) - (set! (-> (the-as gui-connection sv-32) flags) (gui-connection-flags gcf0)) - (set! (-> (the-as gui-connection 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 connectable #f))) + (let ((sv-48 (-> this engine alive-list next0))) + (-> this engine) + (let ((sv-64 (-> 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)) + (= ((method-of-type gui-connection get-process) (the-as connection sv-48)) arg0) ) + (set! sv-32 sv-48) + (goto cfg-12) + ) + (set! sv-48 sv-64) + (-> this engine) + (set! sv-64 (-> 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 (add-connection (-> this engine) arg0 arg4 0 arg3 sv-16)) + ) + (the-as connection (the-as connection sv-32)) + ) + (the-as sound-id (cond + (sv-32 + (set! (-> (the-as gui-connection sv-32) priority) arg4) + (set! (-> (the-as gui-connection sv-32) channel) arg1) + (set! (-> (the-as gui-connection sv-32) action) arg2) + (set! (-> (the-as gui-connection sv-32) param2) (the-as int arg3)) + (set! (-> (the-as gui-connection sv-32) hold-time) arg5) + (set! (-> (the-as gui-connection sv-32) flags) (gui-connection-flags gcf0)) + (set! (-> (the-as gui-connection 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 + ) + ) + ) + ) ) (defmethod remove-process ((this gui-control) (arg0 process) (arg1 gui-channel)) @@ -1979,89 +1979,86 @@ (arg5 float) (arg6 sound-id) ) - (local-vars - (sv-16 gui-connection) - (sv-20 int) - (sv-24 gui-connection) - (sv-28 process) - (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) + (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) + ) + ) ) ) - ) - (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))) + (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) (-> (the-as process-drawable sv-28) root trans)) + -1.0 + ) + ) ) ) - (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)) - ) - ) + (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)) ) - (when (= arg5 -99.0) - (set! sv-28 (as-type arg0 process-drawable)) - (set! arg5 (if sv-28 - (vector-vector-distance (target-pos 0) (-> (the-as process-drawable sv-28) root trans)) - -1.0 - ) - ) + (else + 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 ) ) ) @@ -2277,25 +2274,24 @@ (channel-id-set! this arg0 (-> arg0 id)) (set! (-> this times 0) 0) (let ((v1-73 (shr (the-as int (-> arg0 channel)) 4))) - (set! v1-75 - (and (or (= v1-73 1) (= v1-73 2)) - (not (and (>= (the-as uint (-> arg0 channel)) (the-as uint 16)) - (>= (the-as uint 17) (the-as uint (-> arg0 channel))) + (set! v1-75 (and (or (= v1-73 1) (= v1-73 2)) + (not (and (>= (the-as uint (-> arg0 channel)) (the-as uint 16)) + (>= (the-as uint 17) (the-as uint (-> arg0 channel))) + ) + ) + (begin + (dotimes (s3-1 4) + (when (and (string-charp= (-> arg0 name) (-> *sound-iop-info* stream-name s3-1 name)) + (= (-> arg0 id) (-> *sound-iop-info* stream-id s3-1)) + (logtest? (-> *sound-iop-info* stream-status s3-1) (stream-status ss6)) + ) + (set! v1-75 #t) + (goto cfg-81) + ) ) - ) - (begin - (dotimes (s3-1 4) - (when (and (string-charp= (-> arg0 name) (the-as (pointer uint8) (-> *sound-iop-info* stream-name s3-1))) - (= (-> arg0 id) (-> *sound-iop-info* stream-id s3-1)) - (logtest? (-> *sound-iop-info* stream-status s3-1) (stream-status ss6)) - ) - (set! v1-75 #t) - (goto cfg-81) + #f + ) ) - ) - #f - ) - ) ) ) (label cfg-81) diff --git a/goal_src/jak3/engine/math/euler.gc b/goal_src/jak3/engine/math/euler.gc index 28af00e086..069fa2fbe7 100644 --- a/goal_src/jak3/engine/math/euler.gc +++ b/goal_src/jak3/engine/math/euler.gc @@ -110,11 +110,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 @@ -142,11 +143,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/goal_src/jak3/engine/math/math.gc b/goal_src/jak3/engine/math/math.gc index af929bc3ca..14caa63847 100644 --- a/goal_src/jak3/engine/math/math.gc +++ b/goal_src/jak3/engine/math/math.gc @@ -10,6 +10,9 @@ `(.lvf vf0 (new 'static 'vector :x 0.0 :y 0.0 :z 0.0 :w 1.0)) ) +(defmacro square (x) + `(* ,x ,x)) + (defmacro is-nan? (flt) `(and (< 0.0 ,flt) (< ,flt 0.0))) diff --git a/goal_src/jak3/engine/math/quaternion.gc b/goal_src/jak3/engine/math/quaternion.gc index 01c1ef9fa5..4ea00808f1 100644 --- a/goal_src/jak3/engine/math/quaternion.gc +++ b/goal_src/jak3/engine/math/quaternion.gc @@ -38,12 +38,9 @@ (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)) @@ -614,11 +611,7 @@ (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)))) ) (defun quaternion-log! ((arg0 quaternion) (arg1 quaternion)) @@ -701,9 +694,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)) ) @@ -777,10 +768,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/goal_src/jak3/engine/math/transformq.gc b/goal_src/jak3/engine/math/transformq.gc index e2a1715e75..911a940f3f 100644 --- a/goal_src/jak3/engine/math/transformq.gc +++ b/goal_src/jak3/engine/math/transformq.gc @@ -168,65 +168,47 @@ where an axis flips by 180 degrees. But now they use matrix-from-two-vectors-the-long-way-smooth to fix it! Good job. This additionally uses the fancy logic of matrix-from-two-vectors-smooth." - (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)) - ;; og:preserve-this inlined vector-dot - ; (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)) - ) - (set! f0-4 (vector-dot sv-256 v1-5)) - ; (.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/goal_src/jak3/engine/math/trigonometry.gc b/goal_src/jak3/engine/math/trigonometry.gc index eed82ca0eb..d940033e4c 100644 --- a/goal_src/jak3/engine/math/trigonometry.gc +++ b/goal_src/jak3/engine/math/trigonometry.gc @@ -60,7 +60,7 @@ normally. (defun deg- ((arg0 float) (arg1 float)) "Compute arg0-arg1, unwrapped, using rotation units. -Result should be in the range (-180, 180)" + Result should be in the range (-180, 180)" (the float (sar (- (shl (the int arg0) 48) (shl (the int arg1) 48)) 48)) ) @@ -206,7 +206,7 @@ Result should be in the range (-180, 180)" (let ((f2-0 (* 0.000095873795 (unwrap-angle arg0)))) 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)) @@ -268,9 +268,9 @@ Result should be in the range (-180, 180)" (defun vector-sin-rad! ((arg0 vector) (arg1 vector)) "Taylor series approximation of sine on all 4 elements in a vector. -Inputs should be in radians, in -pi to pi. -Somehow their coefficients are a little bit off. -Like the first coefficient, which should obviously be 1, is not quite 1." + Inputs should be in radians, in -pi to pi. + Somehow their coefficients are a little bit off. + Like the first coefficient, which should obviously be 1, is not quite 1." (rlet ((acc :class vf) (vf1 :class vf) (vf10 :class vf) @@ -344,7 +344,7 @@ Like the first coefficient, which should obviously be 1, is not quite 1." ;; ERROR: Bad vector register dependency: vf2 (defun vector-cos-rad! ((arg0 vector) (arg1 vector)) "Compute the cosine of all 4 vector elements. -Radians, with no wrapping. Uses taylor series with 4 coefficients." + Radians, with no wrapping. Uses taylor series with 4 coefficients." (rlet ((acc :class vf) (vf0 :class vf) (vf1 :class vf) @@ -378,8 +378,8 @@ Radians, with no wrapping. Uses taylor series with 4 coefficients." ;; ERROR: Bad vector register dependency: vf14 (defun vector-sincos-rad! ((arg0 vector) (arg1 vector) (arg2 vector)) "Compute the sine and cosine of each element of src, storing it in dst-sin and dst-cos. -This is more efficient than separate calls to sin and cos. -Inputs should be radians in -pi to pi." + This is more efficient than separate calls to sin and cos. + Inputs should be radians in -pi to pi." (rlet ((acc :class vf) (vf0 :class vf) (vf1 :class vf) @@ -862,7 +862,7 @@ Not sure why this really needs to be separate the from previous function..." (defun sign ((arg0 float)) "Similar to above, but returns 0 if input is 0. -But is more complicated." + But is more complicated." (cond ((< 0.0 arg0) 1.0 @@ -943,10 +943,7 @@ But is more complicated." 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) ) ) @@ -981,18 +978,14 @@ But is more complicated." "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/goal_src/jak3/engine/nav/nav-enemy.gc b/goal_src/jak3/engine/nav/nav-enemy.gc index 08ed979fd5..255538151c 100644 --- a/goal_src/jak3/engine/nav/nav-enemy.gc +++ b/goal_src/jak3/engine/nav/nav-enemy.gc @@ -172,9 +172,7 @@ ) (else (if (or (not (closest-point-on-mesh (-> this nav) s5-0 (-> gp-0 trans) (-> s3-0 current-poly))) - (let ((f0-0 32768.0)) - (< (* f0-0 f0-0) (vector-vector-xz-distance-squared s5-0 (-> gp-0 trans))) - ) + (< (square 32768.0) (vector-vector-xz-distance-squared s5-0 (-> gp-0 trans))) (< (- (-> gp-0 trans y) (-> s5-0 y)) -8192.0) ) (return #t) @@ -500,10 +498,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) ) ) @@ -639,7 +635,6 @@ ;; WARN: Return type mismatch int vs object. (defmethod setup-enemy! ((this nav-enemy) (arg0 nav-enemy-info)) - (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!)) @@ -743,8 +738,9 @@ ) (reset-to-collide-spec (-> this focus) (the-as collide-spec cspec)) ) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-104 (res-lump-data (-> this entity) 'actor-groups pointer :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-104 (res-lump-data (-> this entity) 'actor-groups pointer :tag-ptr (& sv-16))) + ) (cond ((and v1-104 (nonzero? (-> sv-16 elt-count))) (set! (-> this actor-group) (the-as (pointer actor-group) v1-104)) diff --git a/goal_src/jak3/engine/nav/nav-engine.gc b/goal_src/jak3/engine/nav/nav-engine.gc index 0db73a8524..6b38f37677 100644 --- a/goal_src/jak3/engine/nav/nav-engine.gc +++ b/goal_src/jak3/engine/nav/nav-engine.gc @@ -320,13 +320,12 @@ (defmethod-mips2c "(method 18 nav-engine)" 18 nav-engine) (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) @@ -356,28 +355,15 @@ (defmethod-mips2c "(method 21 nav-engine)" 21 nav-engine) (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) ) @@ -397,10 +383,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) ) @@ -429,15 +415,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)) diff --git a/goal_src/jak3/engine/nav/nav-mesh-h.gc b/goal_src/jak3/engine/nav/nav-mesh-h.gc index 7ae937514a..9482cad003 100644 --- a/goal_src/jak3/engine/nav/nav-mesh-h.gc +++ b/goal_src/jak3/engine/nav/nav-mesh-h.gc @@ -419,40 +419,41 @@ Based on the implementation of point-poly-intersection?, these should likely be (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 number)) - (set! sv-48 (new 'stack-no-clear 'vector)) - (set! sv-52 (new 'stack-no-clear 'vector)) - (set! sv-56 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 (the-as float sv-56)) - (set! sv-56 f0-1) - (vector-copy! sv-52 sv-48) - ) + (let ((sv-48 (new 'stack-no-clear 'vector)) + (sv-52 (new 'stack-no-clear 'vector)) + ) + (let* ((sv-56 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 (the-as float sv-56)) + (set! sv-56 f0-1) + (vector-copy! sv-52 sv-48) + ) + ) + (set! v1-3 s2-0) ) - (set! v1-3 s2-0) ) + (vector-copy! arg1 sv-52) ) - (vector-copy! arg1 sv-52) arg1 ) (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 number)) (cond ((point-in-poly? this arg0 arg2) (vector-copy! arg1 arg2) ) (else - (let ((s5-1 arg1)) - (set! sv-48 (new 'stack-no-clear 'vector)) - (set! sv-52 (new 'stack-no-clear 'vector)) - (set! sv-56 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 10000000000000000000000000000000000000.0) + (s2-0 (-> arg0 vertex-count)) (v1-6 (the-as int (+ s2-0 -1))) ) (dotimes (s1-0 (the-as int s2-0)) @@ -473,80 +474,71 @@ Based on the implementation of point-poly-intersection?, these should likely be ) (defmethod advance-ray-to-nearest-poly-edge-or-dest! ((this nav-mesh) (arg0 nav-ray)) - (local-vars - (sv-16 int) - (sv-24 nav-mesh-work) - (sv-28 nav-poly) - (sv-32 uint) - (sv-36 (pointer int8)) - (sv-40 (pointer int8)) - (sv-44 float) - (sv-48 float) - (sv-52 vector) - (sv-56 vector) - (sv-60 float) - (sv-64 float) - (sv-68 uint) - ) - (set! sv-16 -1) - (set! sv-24 (-> this work)) - (set! sv-28 (-> arg0 current-poly)) - (set! sv-32 (-> arg0 current-poly vertex-count)) - (set! sv-36 (-> this work vert0-table)) - (set! sv-40 (-> this work vert1-table)) - (set! sv-44 (- (-> arg0 dest-pos x) (-> arg0 current-pos x))) - (set! sv-48 (- (-> arg0 dest-pos z) (-> arg0 current-pos z))) - (dotimes (v1-9 (the-as int sv-32)) - (set! sv-52 (-> sv-28 vertex (-> sv-36 v1-9))) - (set! sv-56 (-> sv-28 vertex (-> sv-40 v1-9))) - (set! sv-60 (- (-> sv-52 z) (-> sv-56 z))) - (set! sv-64 (- (-> sv-56 x) (-> sv-52 x))) - (let ((f0-10 (+ (* sv-44 sv-60) (* sv-48 sv-64)))) - (when (< 0.0 f0-10) - (let ((f1-10 - (+ (* sv-60 (- (-> sv-52 x) (-> arg0 current-pos x))) (* sv-64 (- (-> sv-52 z) (-> arg0 current-pos z)))) + (let ((sv-16 -1)) + (let ((sv-24 (-> this work))) + ) + (let ((sv-28 (-> arg0 current-poly)) + (sv-32 (-> arg0 current-poly vertex-count)) + (sv-36 (-> this work vert0-table)) + (sv-40 (-> this work vert1-table)) + (sv-44 (- (-> arg0 dest-pos x) (-> arg0 current-pos x))) + (sv-48 (- (-> arg0 dest-pos z) (-> arg0 current-pos z))) + ) + (dotimes (v1-9 (the-as int sv-32)) + (let* ((sv-52 (-> sv-28 vertex (-> sv-36 v1-9))) + (sv-56 (-> sv-28 vertex (-> sv-40 v1-9))) + (sv-60 (- (-> sv-52 z) (-> sv-56 z))) + (sv-64 (- (-> sv-56 x) (-> sv-52 x))) + (f0-10 (+ (* sv-44 sv-60) (* sv-48 sv-64))) + ) + (when (< 0.0 f0-10) + (let ((f1-10 + (+ (* sv-60 (- (-> sv-52 x) (-> arg0 current-pos x))) (* sv-64 (- (-> sv-52 z) (-> arg0 current-pos z)))) + ) + ) + (when (< f1-10 f0-10) + (set! sv-16 v1-9) + (let ((f0-12 (fmax 0.0 (/ f1-10 f0-10)))) + (set! sv-44 (* sv-44 f0-12)) + (set! sv-48 (* sv-48 f0-12)) + ) ) ) - (when (< f1-10 f0-10) - (set! sv-16 v1-9) - (let ((f0-12 (fmax 0.0 (/ f1-10 f0-10)))) - (set! sv-44 (* sv-44 f0-12)) - (set! sv-48 (* sv-48 f0-12)) - ) ) ) ) - ) - ) - (let ((f0-16 (+ (* sv-44 (-> arg0 dir x)) (* sv-48 (-> arg0 dir z))))) - (+! (-> arg0 len) f0-16) - ) - 0 - (set! (-> arg0 next-poly) #f) - (cond - ((= sv-16 -1) - (vector-copy! (-> arg0 current-pos) (-> arg0 dest-pos)) - (set! (-> arg0 reached-dest) #t) - (set! (-> arg0 terminated) #t) - ) - (else - (+! (-> arg0 current-pos x) sv-44) - (+! (-> arg0 current-pos z) sv-48) - (set! sv-68 (-> sv-28 adj-poly sv-16)) - (if (!= sv-68 255) - (set! (-> arg0 next-poly) (-> this poly-array sv-68)) - ) + (let ((f0-16 (+ (* sv-44 (-> arg0 dir x)) (* sv-48 (-> arg0 dir z))))) + (+! (-> arg0 len) f0-16) + ) + 0 + (set! (-> arg0 next-poly) #f) (cond - ((and (-> arg0 next-poly) (not (logtest? (-> arg0 next-poly pat) (-> arg0 ignore)))) - (set! (-> arg0 current-poly) (-> arg0 next-poly)) + ((= sv-16 -1) + (vector-copy! (-> arg0 current-pos) (-> arg0 dest-pos)) + (set! (-> arg0 reached-dest) #t) + (set! (-> arg0 terminated) #t) ) (else - (set! (-> arg0 last-edge) sv-16) - (if (-> arg0 next-poly) - (set! (-> arg0 hit-gap) #t) - (set! (-> arg0 hit-boundary) #t) + (+! (-> arg0 current-pos x) sv-44) + (+! (-> arg0 current-pos z) sv-48) + (let ((sv-68 (-> sv-28 adj-poly sv-16))) + (if (!= sv-68 255) + (set! (-> arg0 next-poly) (-> this poly-array sv-68)) + ) + ) + (cond + ((and (-> arg0 next-poly) (not (logtest? (-> arg0 next-poly pat) (-> arg0 ignore)))) + (set! (-> arg0 current-poly) (-> arg0 next-poly)) + ) + (else + (set! (-> arg0 last-edge) sv-16) + (if (-> arg0 next-poly) + (set! (-> arg0 hit-gap) #t) + (set! (-> arg0 hit-boundary) #t) + ) + (set! (-> arg0 terminated) #t) ) - (set! (-> arg0 terminated) #t) + ) ) ) ) diff --git a/goal_src/jak3/engine/physics/chain-physics.gc b/goal_src/jak3/engine/physics/chain-physics.gc index 01669ccbd3..b38f3ade1b 100644 --- a/goal_src/jak3/engine/physics/chain-physics.gc +++ b/goal_src/jak3/engine/physics/chain-physics.gc @@ -72,26 +72,7 @@ ) (defmethod update ((this chain-physics) (arg0 process-drawable)) - (local-vars - (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 vector) - (sv-464 vector) - (sv-480 vector) - (sv-496 vector) - (sv-512 vector) - (sv-528 vector) - ) + (local-vars (f0-11 float)) (rlet ((acc :class vf) (vf0 :class vf) (vf1 :class vf) @@ -134,201 +115,206 @@ ) ) (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 num-joints) -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)) - (f0-13 (vector-length-squared a2-9)) - (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))) - ) - ) - (vector-copy! (-> sv-272 position) sv-528) - (if (-> sv-272 joint-mod) - (vector-copy! (-> sv-272 joint-mod trans) sv-528) - ) - (when (< s0-0 (the-as int (-> this num-joints))) - (vector-! (-> s4-0 uvec) sv-528 s3-0) - (vector-normalize! (-> s4-0 uvec) 1.0) + (vector-copy! sv-528 (-> sv-272 position)) + (set! (-> sv-272 joint-mod flex-blend) f30-0) (if (-> this negate-y) - (vector-negate! (-> s4-0 uvec) (-> s4-0 uvec)) + (vector-negate! s1-0 s1-0) ) - (vector-cross! (-> s4-0 rvec) (-> s4-0 uvec) s2-0) - (vector-normalize! (-> s4-0 rvec) 1.0) - (set! sv-496 (new 'stack-no-clear 'vector)) - (let ((v1-97 (-> sv-272 old-x)) - (a0-51 (-> s4-0 rvec)) + (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 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 uvec)) - (vector-normalize! sv-496 1.0) - (cond - ((< (vector-dot (-> s4-0 rvec) sv-496) (cos (-> this axial-slop))) - (vector-cross! sv-496 sv-496 (-> s4-0 rvec)) - (vector-cross! sv-496 (-> s4-0 rvec) sv-496) - (vector-normalize! sv-496 1.0) - (set! sv-464 (-> s4-0 rvec)) - (set! sv-448 (-> s4-0 rvec)) - (let ((f0-20 (cos (-> this axial-slop)))) - (.lvf vf1 (&-> sv-448 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 quad) vf1) - (set! sv-512 (-> s4-0 rvec)) - (set! sv-480 (-> s4-0 rvec)) - (let ((f0-22 (sin (-> this axial-slop)))) - (.lvf vf2 (&-> sv-496 quad)) - (.lvf vf1 (&-> sv-480 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 quad) vf4) - (vector-copy! (-> sv-272 old-x) (-> s4-0 rvec)) - ) - (else - (vector-copy! (-> s4-0 rvec) sv-496) - (vector-copy! (-> sv-272 old-x) (-> s4-0 rvec)) + (.lvf vf5 (&-> sv-288 quad)) + (.add.vf.xyz vf6 vf4 vf5) + (.svf (&-> v1-34 quad) vf6) ) ) - (vector-cross! (-> s4-0 fvec) (-> s4-0 rvec) (-> s4-0 uvec)) - (matrix->quaternion (-> sv-272 joint-mod quat) s4-0) - (vector-copy! s1-0 (-> s4-0 uvec)) - (vector-copy! s2-0 (-> s4-0 fvec)) - 0 + (when (< s0-0 (the-as int (+ (-> this num-joints) -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)) + (f0-13 (vector-length-squared a2-9)) + (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))) + ) + ) + (vector-copy! (-> sv-272 position) sv-528) + (if (-> sv-272 joint-mod) + (vector-copy! (-> sv-272 joint-mod trans) sv-528) + ) + (when (< s0-0 (the-as int (-> this num-joints))) + (vector-! (-> s4-0 uvec) sv-528 s3-0) + (vector-normalize! (-> s4-0 uvec) 1.0) + (if (-> this negate-y) + (vector-negate! (-> s4-0 uvec) (-> s4-0 uvec)) + ) + (vector-cross! (-> s4-0 rvec) (-> s4-0 uvec) s2-0) + (vector-normalize! (-> s4-0 rvec) 1.0) + (let ((sv-496 (new 'stack-no-clear 'vector))) + (let ((v1-97 (-> sv-272 old-x)) + (a0-51 (-> s4-0 rvec)) + ) + (.lvf vf1 (&-> v1-97 quad)) + (.lvf vf2 (&-> a0-51 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 uvec)) + (vector-normalize! sv-496 1.0) + (cond + ((< (vector-dot (-> s4-0 rvec) sv-496) (cos (-> this axial-slop))) + (vector-cross! sv-496 sv-496 (-> s4-0 rvec)) + (vector-cross! sv-496 (-> s4-0 rvec) sv-496) + (vector-normalize! sv-496 1.0) + (let ((sv-464 (-> s4-0 rvec))) + (let ((sv-448 (-> s4-0 rvec)) + (f0-20 (cos (-> this axial-slop))) + ) + (.lvf vf1 (&-> sv-448 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 quad) vf1) + ) + (let ((sv-512 (-> s4-0 rvec))) + (let ((sv-480 (-> s4-0 rvec)) + (f0-22 (sin (-> this axial-slop))) + ) + (.lvf vf2 (&-> sv-496 quad)) + (.lvf vf1 (&-> sv-480 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 quad) vf4) + ) + (vector-copy! (-> sv-272 old-x) (-> s4-0 rvec)) + ) + (else + (vector-copy! (-> s4-0 rvec) sv-496) + (vector-copy! (-> sv-272 old-x) (-> s4-0 rvec)) + ) + ) + ) + (vector-cross! (-> s4-0 fvec) (-> s4-0 rvec) (-> s4-0 uvec)) + (matrix->quaternion (-> sv-272 joint-mod quat) s4-0) + (vector-copy! s1-0 (-> s4-0 uvec)) + (vector-copy! s2-0 (-> s4-0 fvec)) + 0 + ) + (vector-copy! s3-0 sv-528) ) - (vector-copy! s3-0 sv-528) 0 ) ) diff --git a/goal_src/jak3/engine/physics/cloth.gc b/goal_src/jak3/engine/physics/cloth.gc index bae56545e3..2beeb96b13 100644 --- a/goal_src/jak3/engine/physics/cloth.gc +++ b/goal_src/jak3/engine/physics/cloth.gc @@ -83,30 +83,26 @@ ;; WARN: Return type mismatch cloth-flag vs none. (defmethod pre-physics-update ((this cloth-on-skeleton)) "Callback to update prior to running verlet integration. Can handle movement of the entire system in the world, for example" + (local-vars (v1-4 matrix)) (let ((s5-0 (new 'stack-no-clear 'matrix)) (s4-0 (handle->process (-> this owner))) ) (when s4-0 - (cond - ((< -1 (-> this base-transform-index)) - (let* ((v1-4 s5-0) - (a3-0 (-> (the-as process-focusable s4-0) node-list data (-> this base-transform-index) bone transform)) - (a0-8 (-> a3-0 rvec quad)) - (a1-3 (-> a3-0 uvec quad)) - (a2-0 (-> a3-0 fvec quad)) - (a3-1 (-> a3-0 trans quad)) + (set! v1-4 + (cond + ((< -1 (-> this base-transform-index)) + (matrix-copy! + s5-0 + (-> (the-as process-focusable s4-0) node-list data (-> this base-transform-index) bone transform) + ) + ) + (else + (quaternion->matrix s5-0 (-> (the-as process-focusable s4-0) root quat)) + (vector-copy! (-> s5-0 trans) (-> (the-as process-focusable s4-0) root trans)) + v1-4 ) - (set! (-> v1-4 rvec quad) a0-8) - (set! (-> v1-4 uvec quad) a1-3) - (set! (-> v1-4 fvec quad) a2-0) - (set! (-> v1-4 trans quad) a3-1) - ) - ) - (else - (quaternion->matrix s5-0 (-> (the-as process-focusable s4-0) root quat)) - (set! (-> s5-0 trans quad) (-> (the-as process-focusable s4-0) root trans quad)) - ) - ) + ) + ) (vector-normalize! (-> s5-0 fvec) 1.0) (vector-normalize! (-> s5-0 uvec) 1.0) (vector-normalize! (-> s5-0 rvec) 1.0) @@ -156,35 +152,31 @@ ;; WARN: Return type mismatch symbol vs none. (defmethod reset! ((this cloth-on-skeleton)) "Reset to stationary/default state." + (local-vars (v1-5 matrix)) (let ((s5-0 (new 'stack-no-clear 'matrix)) (s4-0 (handle->process (-> this owner))) ) (when s4-0 - (cond - ((< -1 (-> this base-transform-index)) - (let* ((v1-5 s5-0) - (a3-0 (-> (the-as process-focusable s4-0) node-list data (-> this base-transform-index) bone transform)) - (a0-8 (-> a3-0 rvec quad)) - (a1-3 (-> a3-0 uvec quad)) - (a2-0 (-> a3-0 fvec quad)) - (a3-1 (-> a3-0 trans quad)) + (set! v1-5 + (cond + ((< -1 (-> this base-transform-index)) + (matrix-copy! + s5-0 + (-> (the-as process-focusable s4-0) node-list data (-> this base-transform-index) bone transform) + ) + ) + (else + (quaternion->matrix s5-0 (-> (the-as process-focusable s4-0) root quat)) + (vector-copy! (-> s5-0 trans) (-> (the-as process-focusable s4-0) root trans)) + v1-5 ) - (set! (-> v1-5 rvec quad) a0-8) - (set! (-> v1-5 uvec quad) a1-3) - (set! (-> v1-5 fvec quad) a2-0) - (set! (-> v1-5 trans quad) a3-1) - ) - ) - (else - (quaternion->matrix s5-0 (-> (the-as process-focusable s4-0) root quat)) - (set! (-> s5-0 trans quad) (-> (the-as process-focusable s4-0) root trans quad)) - ) - ) + ) + ) (dotimes (s4-1 (-> this particles length)) - (vector-matrix*! (the-as vector (-> this particles data s4-1)) (the-as vector (-> this mesh mesh s4-1)) s5-0) + (vector-matrix*! (-> this particles data s4-1 pos) (-> this mesh mesh s4-1 pt) s5-0) (vector-float*! - (the-as vector (-> this particles data s4-1)) - (the-as vector (-> this particles data s4-1)) + (-> this particles data s4-1 pos) + (-> this particles data s4-1 pos) (/ 1.0 (-> this particles data s4-1 pos w)) ) (set! (-> this particles data s4-1 pos w) 1.0) @@ -284,11 +276,12 @@ (s2-0 583) ) (format (clear *temp-string*) "~d" s5-0) + ;; og:preserve-this added (add-debug-sphere #t (the-as bucket-id s2-0) - (-> this particles data s5-0 pos) - (meters 0.02) - (static-rgba #x80 0 #x80 #x80) - ) + (-> this particles data s5-0 pos) + (meters 0.02) + (static-rgba #x80 0 #x80 #x80) + ) (s4-0 s3-0 (the-as bucket-id s2-0) @@ -305,7 +298,6 @@ (defmethod initialize-cloth-system! ((this cloth-system) (arg0 cloth-params)) "Set up this cloth system with the given [[cloth-params]]." - (local-vars (sv-16 int) (sv-20 int) (sv-24 int) (sv-28 int)) (if (or (zero? (-> this mesh)) (< (-> this mesh length) 4)) (go process-drawable-art-error "cloth-mesh (art-cloth-geo)") ) @@ -345,16 +337,15 @@ (set! (-> this particles data v1-38 pos quad) (-> this mesh mesh v1-38 pt quad)) (set! (-> this particles data v1-38 mass-scale) 1.0) ) - (set! sv-16 (* (+ (-> this cloth-width) -1) (-> this cloth-height))) - (set! sv-20 (* (+ (-> this cloth-height) -1) (-> this cloth-width))) - (set! sv-24 (+ (* (+ (-> this cloth-width) -2) 2) 2)) - (let ((v1-52 (* sv-24 (+ (-> this cloth-height) -1))) - (s4-0 (* (+ (-> this cloth-width) -2) (-> this cloth-height))) - ) - (set! sv-28 (+ s4-0 (* (-> this cloth-width) (+ (-> this cloth-height) -2)))) + (let* ((sv-16 (* (+ (-> this cloth-width) -1) (-> this cloth-height))) + (sv-20 (* (+ (-> this cloth-height) -1) (-> this cloth-width))) + (v1-52 (* (+ (* (+ (-> this cloth-width) -2) 2) 2) (+ (-> this cloth-height) -1))) + (s4-0 (* (+ (-> this cloth-width) -2) (-> this cloth-height))) + (sv-28 (+ s4-0 (* (-> this cloth-width) (+ (-> this cloth-height) -2)))) + ) (when (logtest? (-> this flags) (cloth-flag wraps)) (+! s4-0 (* (-> this cloth-height) 2)) - (set! sv-28 (+ sv-28 (* (-> this cloth-height) 2))) + (+! sv-28 (* (-> this cloth-height) 2)) ) (set! sv-28 (max 0 sv-28)) (let ((s3-1 (max 0 v1-52))) @@ -656,7 +647,7 @@ ) ) (set! (-> s4-0 one-over-two-times-constraint-length) (/ 1.0 (* 2.0 f0-1))) - (set! (-> s4-0 constraint-length-sqd) (* f0-1 f0-1)) + (set! (-> s4-0 constraint-length-sqd) (square f0-1)) (set! (-> s4-0 constraint-length-half) (/ f0-1 2)) ) ) @@ -726,9 +717,7 @@ ) (when (< -1 (-> this base-transform-index)) (let ((s5-2 (-> (the-as process-focusable s5-1) node-list data 3 bone transform trans))) - (let ((f0-0 12288.0)) - (when (< (* f0-0 f0-0) (vector-vector-distance-squared (-> this last-owner-pos) s5-2)) - ) + (when (< (square 12288.0) (vector-vector-distance-squared (-> this last-owner-pos) s5-2)) ) (vector-copy! (-> this last-owner-pos) s5-2) ) @@ -870,6 +859,7 @@ (.add.mul.z.vf vf5 vf7 vf6 acc) (.mul.y.vf vf5 vf5 vf6) (.div.vf Q vf6 vf5 :fsf #b0 :ftf #b0) + ;; og:preserve-this (.lvf vf10 (&+ a2-8 32)) (.lvf vf11 (&+ a3-5 32)) (.max.x.vf.xyz vf10 vf0 vf10) @@ -904,7 +894,7 @@ (a3-4 (vector-! (new 'stack-no-clear 'vector) (-> a2-6 pos) (-> a1-5 pos))) ) 0.0 - (let ((f1-2 (* f0-1 f0-1))) + (let ((f1-2 (square f0-1))) 0.0 0.0 (let* ((f1-4 (/ (+ f1-2 (vector-dot a3-4 a3-4)) (* 2.0 f0-1))) @@ -938,143 +928,129 @@ ;; WARN: Return type mismatch symbol vs none. (defmethod cloth-system-method-23 ((this cloth-system)) - (local-vars - (sv-32 int) - (sv-40 int) - (sv-48 int) - (sv-56 int) - (sv-64 matrix) - (sv-68 verlet-particle) - (sv-72 verlet-particle) - (sv-76 verlet-particle) - (sv-80 verlet-particle) - (sv-144 vector) - (sv-148 vector) - (sv-152 float) - (sv-156 float) - (sv-160 vector) - (sv-164 float) - (sv-168 float) - (sv-208 vector) - (sv-212 float) - (sv-216 vector) - ) - (set! sv-32 0) - (set! sv-40 0) - (set! sv-48 0) - (set! sv-56 -1) - (set! sv-64 (new 'stack-no-clear 'matrix)) - (dotimes (s5-0 (+ (-> this cloth-height) -1)) - (dotimes (s4-0 (+ (-> this cloth-width) -1)) - (set! sv-68 (-> this particles data sv-32)) - (set! sv-72 (-> this particles data (+ sv-32 1))) - (set! sv-76 (-> this particles data (+ sv-32 (-> this cloth-width)))) - (set! sv-80 (-> this particles data (+ (-> this cloth-width) 1 sv-32))) - (set! sv-144 (vector-! (new 'stack-no-clear 'vector) (-> sv-80 pos) (-> sv-68 pos))) - (set! sv-148 (vector-! (new 'stack-no-clear 'vector) (-> sv-72 pos) (-> sv-76 pos))) - (set! sv-152 (the-as float 0.0)) - (set! sv-156 (the-as float 0.0)) - (set! sv-160 (new 'stack-no-clear 'vector)) - (set! sv-164 (the-as float 0.0)) - (vector-float*! sv-160 (-> sv-72 pos) (-> sv-72 mass-scale)) - (vector+float*! sv-160 sv-160 (-> sv-68 pos) (-> sv-68 mass-scale)) - (vector+float*! sv-160 sv-160 (-> sv-76 pos) (-> sv-76 mass-scale)) - (vector+float*! sv-160 sv-160 (-> sv-80 pos) (-> sv-80 mass-scale)) - (vector-float*! sv-160 sv-160 0.25) - (set! sv-40 0) - (set! sv-56 -1) - (set! (-> sv-64 rvec quad) (the-as uint128 0)) - (dotimes (s3-0 (-> this collision-constraints length)) - (when (!= s3-0 sv-56) - (let ((v1-39 (-> this collision-constraints data s3-0))) - (set! sv-164 (the-as float 204.8)) - (set! sv-168 (the-as float 0.0)) - (set! sv-168 (+ (-> v1-39 r) (the-as float sv-164))) - (set! sv-208 (vector-! (new 'stack-no-clear 'vector) sv-160 (the-as vector v1-39))) - ) - (set! sv-212 (the-as float 0.0)) - (set! sv-216 (new 'stack-no-clear 'vector)) - (set! sv-212 (vector-dot sv-208 sv-208)) - (when (< sv-212 (* sv-168 sv-168)) - (vector-normalize-copy! sv-216 sv-208 sv-168) - (vector-! sv-216 sv-216 sv-208) - (when (and (> sv-40 0) (< (vector-dot sv-216 (-> sv-64 rvec)) 0.0)) - ) - (vector+float*! (-> sv-68 pos) (-> sv-68 pos) sv-216 (-> sv-68 mass-scale)) - (vector+float*! (-> sv-72 pos) (-> sv-72 pos) sv-216 (-> sv-72 mass-scale)) - (vector+float*! (-> sv-76 pos) (-> sv-76 pos) sv-216 (-> sv-76 mass-scale)) - (vector+float*! (-> sv-80 pos) (-> sv-80 pos) sv-216 (-> sv-80 mass-scale)) - (vector+! sv-160 sv-160 sv-216) - (set! sv-40 (+ sv-40 1)) - ) - ) + (let ((sv-32 0) + (sv-40 0) + ) + (let ((sv-48 0)) + ) + (let ((sv-56 -1) + (sv-64 (new 'stack-no-clear 'matrix)) + ) + (dotimes (s5-0 (+ (-> this cloth-height) -1)) + (dotimes (s4-0 (+ (-> this cloth-width) -1)) + (let ((sv-68 (-> this particles data sv-32)) + (sv-72 (-> this particles data (+ sv-32 1))) + (sv-76 (-> this particles data (+ sv-32 (-> this cloth-width)))) + (sv-80 (-> this particles data (+ (-> this cloth-width) 1 sv-32))) + ) + (let ((sv-144 (vector-! (new 'stack-no-clear 'vector) (-> sv-80 pos) (-> sv-68 pos)))) + ) + (let ((sv-148 (vector-! (new 'stack-no-clear 'vector) (-> sv-72 pos) (-> sv-76 pos)))) + ) + (let ((sv-152 (the-as float 0.0))) + ) + (let ((sv-156 (the-as float 0.0))) + ) + (let ((sv-160 (new 'stack-no-clear 'vector)) + (sv-164 (the-as float 0.0)) + ) + (vector-float*! sv-160 (-> sv-72 pos) (-> sv-72 mass-scale)) + (vector+float*! sv-160 sv-160 (-> sv-68 pos) (-> sv-68 mass-scale)) + (vector+float*! sv-160 sv-160 (-> sv-76 pos) (-> sv-76 mass-scale)) + (vector+float*! sv-160 sv-160 (-> sv-80 pos) (-> sv-80 mass-scale)) + (vector-float*! sv-160 sv-160 0.25) + (set! sv-40 0) + (set! sv-56 -1) + (set! (-> sv-64 rvec quad) (the-as uint128 0)) + (dotimes (s3-0 (-> this collision-constraints length)) + (when (!= s3-0 sv-56) + (let ((v1-39 (-> this collision-constraints data s3-0))) + (set! sv-164 (the-as float 204.8)) + (let ((sv-168 (the-as float 0.0))) + (set! sv-168 (+ (-> v1-39 r) (the-as float sv-164))) + (let ((sv-208 (vector-! (new 'stack-no-clear 'vector) sv-160 (the-as vector v1-39)))) + (let ((sv-212 (the-as float 0.0))) + ) + (let ((sv-216 (new 'stack-no-clear 'vector))) + (when (< (vector-dot sv-208 sv-208) (* sv-168 sv-168)) + (vector-normalize-copy! sv-216 sv-208 sv-168) + (vector-! sv-216 sv-216 sv-208) + (when (and (> sv-40 0) (< (vector-dot sv-216 (-> sv-64 rvec)) 0.0)) + ) + (vector+float*! (-> sv-68 pos) (-> sv-68 pos) sv-216 (-> sv-68 mass-scale)) + (vector+float*! (-> sv-72 pos) (-> sv-72 pos) sv-216 (-> sv-72 mass-scale)) + (vector+float*! (-> sv-76 pos) (-> sv-76 pos) sv-216 (-> sv-76 mass-scale)) + (vector+float*! (-> sv-80 pos) (-> sv-80 pos) sv-216 (-> sv-80 mass-scale)) + (vector+! sv-160 sv-160 sv-216) + (+! sv-40 1) + ) + ) + ) + ) + ) + ) + ) + ) + ) + (+! sv-32 1) + ) + (+! sv-32 1) ) - (set! sv-32 (+ sv-32 1)) ) - (set! sv-32 (+ sv-32 1)) ) (none) ) ;; WARN: Return type mismatch symbol vs none. (defmethod cloth-system-method-22 ((this cloth-system)) - (local-vars - (sv-16 sphere) - (sv-24 int) - (sv-32 verlet-particle) - (sv-36 verlet-particle) - (sv-40 verlet-particle) - (sv-44 verlet-particle) - (sv-96 vector) - (sv-100 vector) - (sv-104 float) - (sv-108 float) - (sv-112 vector) - (sv-116 float) - (sv-120 float) - (sv-160 float) - (sv-164 float) - (sv-168 vector) - ) (dotimes (s5-0 (-> this collision-constraints length)) - (set! sv-16 (-> this collision-constraints data s5-0)) - (set! sv-24 0) - (dotimes (s4-0 (+ (-> this cloth-height) -1)) - (dotimes (s3-0 (+ (-> this cloth-width) -1)) - (set! sv-32 (-> this particles data sv-24)) - (set! sv-36 (-> this particles data (+ sv-24 1))) - (set! sv-40 (-> this particles data (+ sv-24 (-> this cloth-width)))) - (set! sv-44 (-> this particles data (+ (-> this cloth-width) 1 sv-24))) - (set! sv-96 (vector-! (new 'stack-no-clear 'vector) (-> sv-44 pos) (-> sv-32 pos))) - (set! sv-100 (vector-! (new 'stack-no-clear 'vector) (-> sv-36 pos) (-> sv-40 pos))) - (set! sv-104 (the-as float 0.0)) - (set! sv-108 (the-as float 0.0)) - (set! sv-112 (new 'stack-no-clear 'vector)) - (set! sv-116 (the-as float 0.0)) - (set! sv-104 (vector-length-squared sv-96)) - (set! sv-108 (vector-length-squared sv-100)) - (if (< sv-108 sv-104) - (vector+float*! sv-112 (-> sv-32 pos) sv-96 0.5) - (vector+float*! sv-112 (-> sv-40 pos) sv-100 0.5) - ) - (set! sv-116 (the-as float 0.0)) - (set! sv-120 (the-as float 0.0)) - (set! sv-120 (-> sv-16 r)) - (set! sv-160 (the-as float (vector-! (new 'stack-no-clear 'vector) sv-112 (the-as vector sv-16)))) - (set! sv-164 (the-as float 0.0)) - (set! sv-168 (new 'stack-no-clear 'vector)) - (set! sv-164 (vector-dot (the-as vector sv-160) (the-as vector sv-160))) - (when (< sv-164 (* sv-120 sv-120)) - (vector-normalize-copy! sv-168 (the-as vector sv-160) sv-120) - (vector-! sv-168 sv-168 (the-as vector sv-160)) - (vector+! (-> sv-32 pos) (-> sv-32 pos) sv-168) - (vector+! (-> sv-36 pos) (-> sv-36 pos) sv-168) - (vector+! (-> sv-40 pos) (-> sv-40 pos) sv-168) - (vector+! (-> sv-44 pos) (-> sv-44 pos) sv-168) + (let ((sv-16 (-> this collision-constraints data s5-0)) + (sv-24 0) ) - (set! sv-24 (+ sv-24 1)) + (dotimes (s4-0 (+ (-> this cloth-height) -1)) + (dotimes (s3-0 (+ (-> this cloth-width) -1)) + (let* ((sv-32 (-> this particles data sv-24)) + (sv-36 (-> this particles data (+ sv-24 1))) + (sv-40 (-> this particles data (+ sv-24 (-> this cloth-width)))) + (sv-44 (-> this particles data (+ (-> this cloth-width) 1 sv-24))) + (sv-96 (vector-! (new 'stack-no-clear 'vector) (-> sv-44 pos) (-> sv-32 pos))) + (sv-100 (vector-! (new 'stack-no-clear 'vector) (-> sv-36 pos) (-> sv-40 pos))) + (sv-104 (the-as float 0.0)) + ) + (let ((sv-108 (the-as float 0.0))) + ) + (let ((sv-112 (new 'stack-no-clear 'vector))) + (let ((sv-116 (the-as float 0.0))) + (set! sv-104 (vector-length-squared sv-96)) + (if (< (vector-length-squared sv-100) sv-104) + (vector+float*! sv-112 (-> sv-32 pos) sv-96 0.5) + (vector+float*! sv-112 (-> sv-40 pos) sv-100 0.5) + ) + (set! sv-116 (the-as float 0.0)) + ) + (let ((sv-120 (the-as float 0.0))) + (set! sv-120 (-> sv-16 r)) + (let ((sv-160 (the-as float (vector-! (new 'stack-no-clear 'vector) sv-112 (the-as vector sv-16))))) + (let ((sv-164 (the-as float 0.0))) + ) + (let ((sv-168 (new 'stack-no-clear 'vector))) + (when (< (vector-dot (the-as vector sv-160) (the-as vector sv-160)) (* sv-120 sv-120)) + (vector-normalize-copy! sv-168 (the-as vector sv-160) sv-120) + (vector-! sv-168 sv-168 (the-as vector sv-160)) + (vector+! (-> sv-32 pos) (-> sv-32 pos) sv-168) + (vector+! (-> sv-36 pos) (-> sv-36 pos) sv-168) + (vector+! (-> sv-40 pos) (-> sv-40 pos) sv-168) + (vector+! (-> sv-44 pos) (-> sv-44 pos) sv-168) + ) + ) + ) + ) + ) + ) + (+! sv-24 1) + ) + (+! sv-24 1) ) - (set! sv-24 (+ sv-24 1)) ) ) (none) @@ -1125,7 +1101,7 @@ (when (logtest? (-> this flags) (cloth-flag wraps)) (dotimes (v1-13 (-> this cloth-height)) (let ((a0-19 (-> this particles data (+ (* v1-13 (-> this cloth-width)) -1 (-> this cloth-width)))) - (a1-20 (the-as object (&-> (-> this particles) _data (* (* 48 (-> this cloth-width)) v1-13)))) + (a1-20 (the-as object (&-> this particles _data (* (* 48 (-> this cloth-width)) v1-13)))) ) (set! (-> a0-19 mass-scale) 0.0) (vector-copy! (-> a0-19 pos) (the-as vector (&-> (the-as vector a1-20) x))) @@ -1264,69 +1240,65 @@ ) (defmethod cloth-system-method-28 ((this cloth-system) (arg0 int) (arg1 int) (arg2 current-position-info)) - (local-vars - (sv-16 verlet-particle) - (sv-80 vector) - (sv-84 vector) - (sv-88 vector) - (sv-92 symbol) - (sv-112 vector) - ) (rlet ((vf0 :class vf) (vf4 :class vf) (vf5 :class vf) (vf6 :class vf) ) (init-vf0-vector) - (set! sv-16 (-> this particles data (+ arg0 (* arg1 (-> this cloth-width))))) - (set! sv-80 (vector-! - (new 'stack-no-clear 'vector) - (the-as vector (+ (the-as uint (-> this strip data 0 pos)) - (* (- (-> arg2 current-vert-index) (the-as uint (-> arg2 cross-index0))) 32) - ) - ) - (-> sv-16 pos) + (let* ((sv-16 (-> this particles data (+ arg0 (* arg1 (-> this cloth-width))))) + (sv-80 (vector-! + (new 'stack-no-clear 'vector) + (the-as vector (+ (the-as uint (-> this strip data 0 pos)) + (* (- (-> arg2 current-vert-index) (the-as uint (-> arg2 cross-index0))) 32) + ) + ) + (-> sv-16 pos) + ) ) - ) - (set! sv-84 (vector-! - (new 'stack-no-clear 'vector) - (the-as vector (+ (the-as uint (-> this strip data 0 pos)) - (* (- (-> arg2 current-vert-index) (the-as uint (-> arg2 cross-index1))) 32) - ) - ) - (-> sv-16 pos) + (sv-84 (vector-! + (new 'stack-no-clear 'vector) + (the-as vector (+ (the-as uint (-> this strip data 0 pos)) + (* (- (-> arg2 current-vert-index) (the-as uint (-> arg2 cross-index1))) 32) + ) + ) + (-> sv-16 pos) + ) ) - ) - (set! sv-88 (new 'stack-no-clear 'vector)) - (set! sv-92 (the-as symbol #f)) - (vector-cross! sv-88 sv-80 sv-84) - (let ((a0-10 (-> arg2 cross-index0))) - (set! (-> arg2 cross-index0) (-> arg2 cross-index1)) - (set! (-> arg2 cross-index1) a0-10) - ) - (let ((s2-0 sv-88) - (s0-0 sv-16) - (s1-0 (new 'stack-no-clear 'vector)) - ) - (set! sv-112 s1-0) - (let ((v0-0 (math-camera-pos))) - (.lvf vf4 (&-> s0-0 pos quad)) - (.lvf vf5 (&-> v0-0 quad)) + (sv-88 (new 'stack-no-clear 'vector)) + ) + (let ((sv-92 (the-as symbol #f))) ) - (.mov.vf.w vf6 vf0) - (.sub.vf.xyz vf6 vf4 vf5) - (.svf (&-> sv-112 quad) vf6) - (let ((v1-12 (< 0.0 (vector-dot s1-0 s2-0)))) - (when (!= v1-12 (-> arg2 face-normal-needs-flip?)) - (set! (-> arg2 face-normal-needs-flip?) (not (-> arg2 face-normal-needs-flip?))) - (cloth-system-method-30 - this - (the-as int (-> arg2 last-2-x-index)) - (the-as int (-> arg2 last-2-y-index)) - arg2 - 1 + (vector-cross! sv-88 sv-80 sv-84) + (let ((a0-10 (-> arg2 cross-index0))) + (set! (-> arg2 cross-index0) (-> arg2 cross-index1)) + (set! (-> arg2 cross-index1) a0-10) + ) + (let ((s2-0 sv-88) + (s0-0 sv-16) + (s1-0 (new 'stack-no-clear 'vector)) + ) + (let ((sv-112 s1-0)) + (let ((v0-0 (math-camera-pos))) + (.lvf vf4 (&-> s0-0 pos quad)) + (.lvf vf5 (&-> v0-0 quad)) + ) + (.mov.vf.w vf6 vf0) + (.sub.vf.xyz vf6 vf4 vf5) + (.svf (&-> sv-112 quad) vf6) + ) + (let ((v1-12 (< 0.0 (vector-dot s1-0 s2-0)))) + (when (!= v1-12 (-> arg2 face-normal-needs-flip?)) + (set! (-> arg2 face-normal-needs-flip?) (not (-> arg2 face-normal-needs-flip?))) + (cloth-system-method-30 + this + (the-as int (-> arg2 last-2-x-index)) + (the-as int (-> arg2 last-2-y-index)) + arg2 + 1 + ) + (cloth-system-method-30 this (the-as int (-> arg2 last-x-index)) (the-as int (-> arg2 last-y-index)) arg2 1) ) - (cloth-system-method-30 this (the-as int (-> arg2 last-x-index)) (the-as int (-> arg2 last-y-index)) arg2 1) ) ) ) @@ -1485,7 +1457,7 @@ ) (defmethod cloth-system-method-25 ((this cloth-system)) - (local-vars (v0-1 texture-id) (v0-4 texture-id) (a0-72 int) (a0-74 int) (sv-224 int)) + (local-vars (v0-1 texture-id) (v0-4 texture-id) (a0-72 int) (a0-74 int)) (cond ((and (not (logtest? (cloth-flag using-alt-tex) (-> this flags))) (and (>= (-> *game-info* skill-total) 600.0) (-> this params alt-tex-name)) @@ -1572,15 +1544,16 @@ (set-vector! (-> s5-0 scale) 128.0 128.0 128.0 128.0) (set-vector! (-> s5-0 clamp-col) 255.0 255.0 255.0 128.0) (dotimes (s0-0 (+ (-> this cloth-height) -1)) - (set! sv-224 0) - (while (< sv-224 (-> this cloth-width)) - (set! (-> s5-0 face-normal-needs-flip?) #f) - (cloth-system-method-29 this s4-0 s3-0 s5-0 0) - (cloth-system-method-31 this s5-0) - (cloth-system-method-29 this s4-0 (+ s3-0 s1-0) s5-0 0) - (cloth-system-method-31 this s5-0) - (+! s4-0 s2-0) - (set! sv-224 (+ sv-224 1)) + (let ((sv-224 0)) + (while (< sv-224 (-> this cloth-width)) + (set! (-> s5-0 face-normal-needs-flip?) #f) + (cloth-system-method-29 this s4-0 s3-0 s5-0 0) + (cloth-system-method-31 this s5-0) + (cloth-system-method-29 this s4-0 (+ s3-0 s1-0) s5-0 0) + (cloth-system-method-31 this s5-0) + (+! s4-0 s2-0) + (+! sv-224 1) + ) ) (set! (-> (the-as (pointer uint128) (+ (the-as uint (-> this strip data 0 pos)) (* (-> s5-0 current-vert-index) 32))) ) @@ -1735,13 +1708,13 @@ ) (defmethod cloth-system-method-24 ((this cloth-system)) - (local-vars (sv-16 int) (sv-24 int) (sv-32 int) (sv-40 int)) (cloth-system-method-26 this) - (set! sv-16 0) - (set! sv-24 1) - (set! sv-32 1) - (set! sv-40 -1) - (let ((s5-0 (new 'stack-no-clear 'current-position-info))) + (let ((sv-16 0) + (sv-24 1) + (sv-32 1) + (sv-40 -1) + (s5-0 (new 'stack-no-clear 'current-position-info)) + ) (set! (-> s5-0 current-vert-index) (the-as uint 0)) (set! (-> s5-0 last-x-index) (the-as uint -1)) (set! (-> s5-0 last-y-index) (the-as uint -1)) @@ -1764,14 +1737,14 @@ (cloth-system-method-30 this sv-16 (+ sv-24 sv-40) s5-0 0) (set! (-> s5-0 cross-index0) 2) (set! (-> s5-0 cross-index1) 1) - (set! sv-16 (+ sv-16 sv-32)) + (+! sv-16 sv-32) (let ((s3-1 1) (s2-1 (+ (-> this cloth-width) -1)) ) (while (>= s2-1 s3-1) (cloth-system-method-28 this sv-16 sv-24 s5-0) (cloth-system-method-28 this sv-16 (+ sv-24 sv-40) s5-0) - (set! sv-16 (+ sv-16 sv-32)) + (+! sv-16 sv-32) (+! s3-1 1) ) ) @@ -1790,9 +1763,9 @@ (+! (-> s5-0 current-vert-index) 1) (set! sv-32 (* -1 sv-32)) (set! sv-40 (* -1 sv-40)) - (set! sv-16 (+ sv-16 sv-32)) + (+! sv-16 sv-32) (if (< sv-40 0) - (set! sv-24 (+ sv-24 2)) + (+! sv-24 2) ) ) (set! (-> this strip num-verts) (-> s5-0 current-vert-index)) diff --git a/goal_src/jak3/engine/physics/ragdoll-edit.gc b/goal_src/jak3/engine/physics/ragdoll-edit.gc index 90543886ae..e9213f3e10 100644 --- a/goal_src/jak3/engine/physics/ragdoll-edit.gc +++ b/goal_src/jak3/engine/physics/ragdoll-edit.gc @@ -223,18 +223,6 @@ ;; WARN: Return type mismatch symbol vs none. (defmethod ragdoll-edit-info-method-16 ((this ragdoll-edit-info) (arg0 ragdoll) (arg1 process-drawable)) - (local-vars - (sv-4352 ragdoll-joint) - (sv-4368 matrix) - (sv-4384 vector) - (sv-4400 matrix) - (sv-4416 matrix) - (sv-4432 vector) - (sv-4448 quaternion) - (sv-4464 matrix) - (sv-4480 matrix) - (sv-4496 matrix) - ) (let ((s3-0 (new 'stack-no-clear 'inline-array 'matrix 60))) (dotimes (v1-0 60) (let ((a0-2 (-> s3-0 v1-0))) @@ -245,16 +233,16 @@ ) ) (dotimes (s2-0 (the-as int (-> arg0 num-joints))) - (let ((s0-0 (-> arg0 ragdoll-joints s2-0))) - (set! sv-4352 (get-parent-joint arg0 (the-as (inline-array ragdoll-joint) s0-0))) - (set! sv-4368 (-> s3-0 s2-0)) - (let ((s1-0 (new 'stack-no-clear 'matrix))) - (cond - (sv-4352 - (set! sv-4416 - (matrix-axis-angle! (new 'stack-no-clear 'matrix) (-> s0-0 pre-tform) (- (-> s0-0 pre-tform w))) - ) - (set! sv-4432 (new 'stack-no-clear 'vector)) + (let* ((s0-0 (-> arg0 ragdoll-joints s2-0)) + (sv-4352 (get-parent-joint arg0 (the-as (inline-array ragdoll-joint) s0-0))) + (sv-4368 (-> s3-0 s2-0)) + (s1-0 (new 'stack-no-clear 'matrix)) + ) + (cond + (sv-4352 + (let ((sv-4416 (matrix-axis-angle! (new 'stack-no-clear 'matrix) (-> s0-0 pre-tform) (- (-> s0-0 pre-tform w)))) + (sv-4432 (new 'stack-no-clear 'vector)) + ) (matrix-copy! s1-0 (-> s3-0 @@ -268,118 +256,112 @@ (when (and (-> this auto-setup-now) (ragdoll-edit-info-method-10 this arg0 (the-as ragdoll-joint (-> s0-0 joint-index))) ) - (set! sv-4384 (vector-normalize! (vector-! (new 'stack-no-clear 'vector) (-> s0-0 position) sv-4432) 1.0)) - (set! sv-4400 (new 'stack-no-clear 'matrix)) - (matrix*! sv-4416 sv-4416 s1-0) - (matrix-from-two-vectors! sv-4400 (-> sv-4416 uvec) sv-4384) - (matrix*! sv-4416 sv-4416 sv-4400) - (matrix-transpose! sv-4400 s1-0) - (matrix*! sv-4416 sv-4416 sv-4400) + (let ((sv-4384 (vector-normalize! (vector-! (new 'stack-no-clear 'vector) (-> s0-0 position) sv-4432) 1.0)) + (sv-4400 (new 'stack-no-clear 'matrix)) + ) + (matrix*! sv-4416 sv-4416 s1-0) + (matrix-from-two-vectors! sv-4400 (-> sv-4416 uvec) sv-4384) + (matrix*! sv-4416 sv-4416 sv-4400) + (matrix-transpose! sv-4400 s1-0) + (matrix*! sv-4416 sv-4416 sv-4400) + ) (matrix->axis-angle (-> s0-0 pre-tform) sv-4416) ) - (let ((t9-10 matrix*!) - (a0-21 s1-0) - (a2-8 s1-0) - ) - (t9-10 a0-21 sv-4416 a2-8) - ) + (matrix*! s1-0 sv-4416 s1-0) (vector-copy! (-> s1-0 trans) sv-4432) - (vector-! (-> sv-4368 uvec) (-> s0-0 position) (-> sv-4352 position)) - (vector-normalize! (-> sv-4368 uvec) 1.0) - (vector-flatten! (-> sv-4368 rvec) (-> s1-0 rvec) (-> sv-4368 uvec)) - (vector-normalize! (-> sv-4368 rvec) 1.0) - (vector-cross! (-> sv-4368 fvec) (-> sv-4368 rvec) (-> sv-4368 uvec)) - (vector-copy! (-> sv-4368 trans) (-> s0-0 position)) - (set! (-> sv-4368 rvec w) 0.0) - (set! (-> sv-4368 uvec w) 0.0) - (set! (-> sv-4368 fvec w) 0.0) - ) - ((= s0-0 (-> arg0 ragdoll-joints)) - (quaternion->matrix sv-4368 (-> s0-0 quat)) - (vector-copy! (-> sv-4368 trans) (-> s0-0 position)) - (quaternion->matrix s1-0 (-> arg1 root quat)) - (vector-copy! (-> s1-0 trans) (-> arg1 root trans)) - ) - (else - (matrix-copy! sv-4368 (-> arg1 node-list data (-> s0-0 joint-index) bone transform)) - (vector-copy! (-> sv-4368 trans) (-> s0-0 position)) - (matrix-copy! s1-0 sv-4368) - (vector<-cspace! (-> s1-0 trans) (-> arg1 node-list data (-> s0-0 parent-joint))) ) + (vector-! (-> sv-4368 uvec) (-> s0-0 position) (-> sv-4352 position)) + (vector-normalize! (-> sv-4368 uvec) 1.0) + (vector-flatten! (-> sv-4368 rvec) (-> s1-0 rvec) (-> sv-4368 uvec)) + (vector-normalize! (-> sv-4368 rvec) 1.0) + (vector-cross! (-> sv-4368 fvec) (-> sv-4368 rvec) (-> sv-4368 uvec)) + (vector-copy! (-> sv-4368 trans) (-> s0-0 position)) + (set! (-> sv-4368 rvec w) 0.0) + (set! (-> sv-4368 uvec w) 0.0) + (set! (-> sv-4368 fvec w) 0.0) ) - (when (and (-> this auto-setup-now) - (ragdoll-edit-info-method-10 this arg0 (the-as ragdoll-joint (-> s0-0 joint-index))) - ) - (set! sv-4464 (new 'stack-no-clear 'matrix)) - (set! sv-4480 (new 'stack-no-clear 'matrix)) + ((= s0-0 (-> arg0 ragdoll-joints)) + (quaternion->matrix sv-4368 (-> s0-0 quat)) + (vector-copy! (-> sv-4368 trans) (-> s0-0 position)) + (quaternion->matrix s1-0 (-> arg1 root quat)) + (vector-copy! (-> s1-0 trans) (-> arg1 root trans)) + ) + (else + (matrix-copy! sv-4368 (-> arg1 node-list data (-> s0-0 joint-index) bone transform)) + (vector-copy! (-> sv-4368 trans) (-> s0-0 position)) + (matrix-copy! s1-0 sv-4368) + (vector<-cspace! (-> s1-0 trans) (-> arg1 node-list data (-> s0-0 parent-joint))) + ) + ) + (when (and (-> this auto-setup-now) + (ragdoll-edit-info-method-10 this arg0 (the-as ragdoll-joint (-> s0-0 joint-index))) + ) + (let ((sv-4464 (new 'stack-no-clear 'matrix)) + (sv-4480 (new 'stack-no-clear 'matrix)) + ) (matrix-copy! sv-4464 sv-4368) (vector-reset! (-> sv-4464 trans)) (matrix-transpose! sv-4464 sv-4464) - (set! sv-4448 (matrix->quaternion - (new 'stack-no-clear 'quaternion) - (-> arg1 node-list data (-> s0-0 joint-index) bone transform) - ) + (let ((sv-4448 (matrix->quaternion + (new 'stack-no-clear 'quaternion) + (-> arg1 node-list data (-> s0-0 joint-index) bone transform) + ) + ) ) - (quaternion-normalize! sv-4448) - (quaternion->matrix sv-4480 sv-4448) + (quaternion-normalize! sv-4448) + (quaternion->matrix sv-4480 sv-4448) + ) (matrix*! sv-4480 sv-4480 sv-4464) (matrix->axis-angle (-> s0-0 geo-tform) sv-4480) ) - (case (-> this skel-visible) - ((1) - (add-debug-line - #t - (bucket-id debug-no-zbuf1) - (-> sv-4368 trans) - (-> s1-0 trans) - (new 'static 'rgba :r #xff :b #xff :a #x80) - #f - (the-as rgba -1) - ) - (when (or (not (logtest? (-> *display* real-frame-clock integral-frame-counter) 8)) - (zero? (-> this analog-func)) - (not (ragdoll-edit-info-method-10 this arg0 (the-as ragdoll-joint (-> s0-0 joint-index)))) - ) - (let ((f30-0 0.25)) - (if (and (nonzero? (-> this analog-func)) - (ragdoll-edit-info-method-10 this arg0 (the-as ragdoll-joint (-> s0-0 joint-index))) - ) - (set! f30-0 0.35) + ) + (case (-> this skel-visible) + ((1) + (add-debug-line + #t + (bucket-id debug-no-zbuf1) + (-> sv-4368 trans) + (-> s1-0 trans) + (new 'static 'rgba :r #xff :b #xff :a #x80) + #f + (the-as rgba -1) + ) + (when (or (not (logtest? (-> *display* real-frame-clock integral-frame-counter) 8)) + (zero? (-> this analog-func)) + (not (ragdoll-edit-info-method-10 this arg0 (the-as ragdoll-joint (-> s0-0 joint-index)))) ) - (add-debug-matrix #t (bucket-id debug-no-zbuf1) sv-4368 (* 4096.0 f30-0)) - ) - ) - (set! sv-4496 - (matrix-axis-angle! (new 'stack-no-clear 'matrix) (-> s0-0 geo-tform) (- (-> s0-0 geo-tform w))) + (let ((f30-0 0.25)) + (if (and (nonzero? (-> this analog-func)) + (ragdoll-edit-info-method-10 this arg0 (the-as ragdoll-joint (-> s0-0 joint-index))) + ) + (set! f30-0 0.35) ) - (matrix*! sv-4496 sv-4496 sv-4368) - (vector-copy! (-> sv-4496 trans) (-> (the-as matrix sv-4368) trans)) - (let ((t9-30 add-debug-matrix) - (a0-66 #t) - (a1-46 577) - (a3-10 #x4419999a) - ) - (t9-30 a0-66 (the-as bucket-id a1-46) sv-4496 (the-as meters a3-10)) - ) - (let ((a2-22 (quaternion->matrix (new 'stack-no-clear 'matrix) (-> s0-0 quat)))) - (vector-copy! (-> a2-22 trans) (-> (the-as matrix sv-4368) trans)) - (add-debug-matrix #t (bucket-id debug-no-zbuf1) a2-22 (meters 0.15)) - ) - (when (or (not (logtest? (-> *display* real-frame-clock integral-frame-counter) 8)) - (nonzero? (-> this analog-func)) - (not (ragdoll-edit-info-method-10 this arg0 (the-as ragdoll-joint (-> s0-0 joint-index)))) - ) - (let ((f30-1 0.25)) - (if (and (zero? (-> this analog-func)) - (ragdoll-edit-info-method-10 this arg0 (the-as ragdoll-joint (-> s0-0 joint-index))) - ) - (set! f30-1 0.35) - ) - (add-debug-matrix #t (bucket-id debug-no-zbuf1) s1-0 (* 4096.0 f30-1)) - ) + (add-debug-matrix #t (bucket-id debug-no-zbuf1) sv-4368 (* 4096.0 f30-0)) ) ) - ) + (let ((sv-4496 (matrix-axis-angle! (new 'stack-no-clear 'matrix) (-> s0-0 geo-tform) (- (-> s0-0 geo-tform w))))) + (matrix*! sv-4496 sv-4496 sv-4368) + (vector-copy! (-> sv-4496 trans) (-> (the-as matrix sv-4368) trans)) + (add-debug-matrix #t (bucket-id debug-no-zbuf1) sv-4496 (meters 0.15)) + ) + (let ((a2-22 (quaternion->matrix (new 'stack-no-clear 'matrix) (-> s0-0 quat)))) + (vector-copy! (-> a2-22 trans) (-> (the-as matrix sv-4368) trans)) + (add-debug-matrix #t (bucket-id debug-no-zbuf1) a2-22 (meters 0.15)) + ) + (when (or (not (logtest? (-> *display* real-frame-clock integral-frame-counter) 8)) + (nonzero? (-> this analog-func)) + (not (ragdoll-edit-info-method-10 this arg0 (the-as ragdoll-joint (-> s0-0 joint-index)))) + ) + (let ((f30-1 0.25)) + (if (and (zero? (-> this analog-func)) + (ragdoll-edit-info-method-10 this arg0 (the-as ragdoll-joint (-> s0-0 joint-index))) + ) + (set! f30-1 0.35) + ) + (add-debug-matrix #t (bucket-id debug-no-zbuf1) s1-0 (* 4096.0 f30-1)) + ) + ) + ) ) ) ) @@ -388,7 +370,6 @@ ) (defun show-maya-skeleton ((arg0 process-drawable) (arg1 int) (arg2 int)) - (local-vars (sv-96 symbol) (sv-112 int) (sv-128 (function _varargs_ object))) (when arg0 (dotimes (s3-0 (-> arg0 node-list length)) (let ((s2-0 (new 'stack-no-clear 'matrix)) @@ -398,28 +379,18 @@ (vector<-cspace! (-> s2-0 trans) (-> arg0 node-list data s3-0)) (when (or (= arg1 -1) (= arg1 s3-0)) (add-debug-matrix #t (bucket-id debug-no-zbuf1) s2-0 (the-as meters arg2)) - (let ((s0-0 add-debug-text-3d)) - (set! sv-96 #t) - (set! sv-112 577) - (set! sv-128 format) - (let ((a0-9 (clear *temp-string*)) - (a1-6 "~%~D ~S~%") - (a2-3 s3-0) - (a3-5 (if (-> arg0 node-list data s3-0 joint) - (-> arg0 node-list data s3-0 joint name) - "?" - ) - ) - ) - (sv-128 a0-9 a1-6 a2-3 a3-5) - ) - (let ((a2-4 *temp-string*) - (a3-6 (-> s2-0 trans)) - (t0-0 4) - (t1-0 #f) - ) - (s0-0 sv-96 (the-as bucket-id sv-112) a2-4 a3-6 (the-as font-color t0-0) (the-as vector2h t1-0)) + (let ((s0-0 add-debug-text-3d) + (sv-96 #t) + (sv-112 577) + ) + (let ((sv-128 format)) + (sv-128 (clear *temp-string*) "~%~D ~S~%" s3-0 (if (-> arg0 node-list data s3-0 joint) + (-> arg0 node-list data s3-0 joint name) + "?" + ) + ) ) + (s0-0 sv-96 (the-as bucket-id sv-112) *temp-string* (-> s2-0 trans) (font-color orange) (the-as vector2h #f)) ) ) (let ((a1-8 (-> arg0 node-list data s3-0 parent))) @@ -474,7 +445,7 @@ ) (defmethod ragdoll-edit-info-method-17 ((this ragdoll-edit-info) (arg0 ragdoll) (arg1 process-drawable)) - (local-vars (v0-23 object) (v0-32 object) (sv-848 matrix) (sv-864 matrix) (sv-880 matrix)) + (local-vars (v0-23 object) (v0-32 object)) (set! (-> this last-frame-dur) (- (current-time) (-> this last-frame))) (set-time! (-> this last-frame)) (when (cpad-pressed? 0 l2) @@ -1023,8 +994,9 @@ (set! (-> a1-72 y) f28-0) (set! (-> a1-72 z) f26-0) (set! (-> a1-72 w) 1.0) - (let ((s0-1 (t9-55 a0-105 a1-72))) - (set! sv-848 (new 'stack-no-clear 'matrix)) + (let ((s0-1 (t9-55 a0-105 a1-72)) + (sv-848 (new 'stack-no-clear 'matrix)) + ) (let ((a2-51 (new 'stack-no-clear 'vector))) (ragdoll-edit-info-method-14 this @@ -1037,15 +1009,10 @@ ) (matrix*! s1-1 sv-848 s1-1) (matrix*! s1-1 s0-1 s1-1) + (matrix-transpose! sv-848 sv-848) + (matrix*! s1-1 sv-848 s1-1) ) ) - (matrix-transpose! sv-848 sv-848) - (let ((t9-60 matrix*!) - (a0-110 s1-1) - (a2-54 s1-1) - ) - (t9-60 a0-110 sv-848 a2-54) - ) (matrix->axis-angle s2-4 s1-1) ) ) @@ -1061,36 +1028,28 @@ (set! (-> a1-80 y) f28-0) (set! (-> a1-80 z) f26-0) (set! (-> a1-80 w) 1.0) - (set! sv-864 (t9-63 a0-114 a1-80)) - ) - (set! sv-880 (new 'stack-no-clear 'matrix)) - (let ((a2-56 (new 'stack-no-clear 'vector))) - (ragdoll-edit-info-method-14 - this - sv-880 - a2-56 - (the-as (inline-array ragdoll-joint) (-> this child-stack s3-3)) - arg0 - arg1 + (let ((sv-864 (t9-63 a0-114 a1-80)) + (sv-880 (new 'stack-no-clear 'matrix)) + ) + (let ((a2-56 (new 'stack-no-clear 'vector))) + (ragdoll-edit-info-method-14 + this + sv-880 + a2-56 + (the-as (inline-array ragdoll-joint) (-> this child-stack s3-3)) + arg0 + arg1 + ) + ) + (let ((a2-58 (matrix-axis-angle! (new 'stack-no-clear 'matrix) (-> s2-3 pre-tform) (- (-> s2-3 pre-tform w))))) + (matrix*! sv-880 sv-880 a2-58) + ) + (matrix*! s0-2 sv-880 s0-2) + (matrix*! s0-2 sv-864 s0-2) + (matrix-transpose! sv-880 sv-880) + (matrix*! s0-2 sv-880 s0-2) ) ) - (let ((a2-58 (matrix-axis-angle! (new 'stack-no-clear 'matrix) (-> s2-3 pre-tform) (- (-> s2-3 pre-tform w))))) - (matrix*! sv-880 sv-880 a2-58) - ) - (matrix*! s0-2 sv-880 s0-2) - (let ((t9-68 matrix*!) - (a0-119 s0-2) - (a2-60 s0-2) - ) - (t9-68 a0-119 sv-864 a2-60) - ) - (matrix-transpose! sv-880 sv-880) - (let ((t9-70 matrix*!) - (a0-121 s0-2) - (a2-61 s0-2) - ) - (t9-70 a0-121 sv-880 a2-61) - ) (matrix->axis-angle s1-2 s0-2) ) ) diff --git a/goal_src/jak3/engine/physics/ragdoll.gc b/goal_src/jak3/engine/physics/ragdoll.gc index 2f7c2d9313..9fb7c10849 100644 --- a/goal_src/jak3/engine/physics/ragdoll.gc +++ b/goal_src/jak3/engine/physics/ragdoll.gc @@ -147,11 +147,9 @@ ) (set! f1-1 24576.0) ) - (let ((f2-0 f1-1)) - (if (< (* f2-0 f2-0) f0-6) - (vector-float*! arg0 arg0 (/ f1-1 (sqrtf f0-6))) - ) - ) + (if (< (square f1-1) f0-6) + (vector-float*! arg0 arg0 (/ f1-1 (sqrtf f0-6))) + ) ) (when (nonzero? (-> this rotate-adj-count)) (quaternion-slerp! (-> this rotate-vel) (-> this rotate-vel) (-> this rotate-adj) 0.5) @@ -291,12 +289,7 @@ (logclear! (-> s4-1 ragdoll-joint-flags) (ragdoll-joint-flag rjf0 rjf2)) (set! (-> s4-1 original-speed) 0.0) (vector-copy! arg0 (-> s4-1 position)) - (until (or (< 6 s1-1) (let ((f0-13 (vector-length-squared s3-2)) - (f1-4 409.6) - ) - (< f0-13 (* f1-4 f1-4)) - ) - ) + (until (or (< 6 s1-1) (< (vector-length-squared s3-2) (square 409.6))) (+! s1-1 1) (vector-copy! (-> s2-1 start-pos) arg0) (vector-copy! (-> s2-1 move-dist) s3-2) @@ -423,9 +416,8 @@ ) (defun ragdoll-matrix-interp ((arg0 matrix) (arg1 matrix) (arg2 matrix) (arg3 float)) - (local-vars (sv-208 matrix)) - (set! sv-208 arg1) - (let ((s5-0 arg2) + (let ((sv-208 arg1) + (s5-0 arg2) (s4-0 arg3) (s1-0 (new 'stack-no-clear 'matrix)) ) @@ -502,7 +494,7 @@ ) (defun ragdoll-joint-callback ((arg0 cspace) (arg1 transformq) (arg2 process-drawable) (arg3 ragdoll-proc)) - (local-vars (a2-10 matrix) (sv-240 int) (sv-256 quaternion) (sv-272 vector) (sv-288 matrix)) + (local-vars (a2-10 matrix)) (when *debug-segment* (let ((s2-0 (-> *display* frames (-> *display* on-screen) profile-array data 0)) (v1-7 'ragdoll-callback) @@ -510,9 +502,10 @@ ) (when (and *dproc* *debug-segment*) (let ((s0-0 (-> s2-0 data (-> s2-0 count)))) - (set! sv-240 (-> s2-0 base-time)) - (set! (-> s0-0 name) v1-7) - (set! (-> s0-0 start-time) (the-as int (- (timer-count (the-as timer-bank #x10000800)) (the-as uint sv-240)))) + (let ((sv-240 (-> s2-0 base-time))) + (set! (-> s0-0 name) v1-7) + (set! (-> s0-0 start-time) (the-as int (- (timer-count (the-as timer-bank #x10000800)) (the-as uint sv-240)))) + ) (set! (-> s0-0 depth) (the-as uint (-> s2-0 depth))) (set! (-> s0-0 color) s1-0) (set! (-> s2-0 segment (-> s2-0 depth)) s0-0) @@ -536,26 +529,29 @@ (cspace<-parented-transformq-joint! arg0 arg1) ) (let ((s2-1 (new 'stack-no-clear 'matrix))) - (set! sv-256 - (quaternion-vector-angle! (new 'stack-no-clear 'quaternion) (-> s1-1 geo-tform) (-> s1-1 geo-tform w)) + (let ((sv-256 + (quaternion-vector-angle! (new 'stack-no-clear 'quaternion) (-> s1-1 geo-tform) (-> s1-1 geo-tform w)) + ) ) - (quaternion-normalize! (quaternion*! sv-256 (-> s1-1 quat) sv-256)) - (quaternion->matrix s2-1 sv-256) + (quaternion-normalize! (quaternion*! sv-256 (-> s1-1 quat) sv-256)) + (quaternion->matrix s2-1 sv-256) + ) (when (logtest? (-> s3-1 ragdoll-flags) (ragdoll-flag rf10)) (let ((v1-40 (&+ s1-1 188))) (when (and (!= v1-40 (-> s3-1 ragdoll-joints (-> s3-1 num-joints))) (= (-> v1-40 parent-joint) -1)) - (let ((s0-3 (vector-! (new 'stack-no-clear 'vector) (-> v1-40 position) (-> s1-1 position)))) - (set! sv-272 (new 'stack-no-clear 'vector)) - (set! sv-288 (new 'stack-no-clear 'matrix)) + (let ((s0-3 (vector-! (new 'stack-no-clear 'vector) (-> v1-40 position) (-> s1-1 position))) + (sv-272 (new 'stack-no-clear 'vector)) + (sv-288 (new 'stack-no-clear 'matrix)) + ) (vector-flatten! sv-272 s0-3 (-> s2-1 rvec)) (vector-normalize! sv-272 1.0) (matrix-from-two-vectors! sv-288 (-> s2-1 uvec) sv-272) (matrix*! s2-1 s2-1 sv-288) (vector-flatten! sv-272 s0-3 (-> s2-1 fvec)) + (vector-normalize! sv-272 1.0) + (matrix-from-two-vectors! sv-288 (-> s2-1 uvec) sv-272) + (matrix*! s2-1 s2-1 sv-288) ) - (vector-normalize! sv-272 1.0) - (matrix-from-two-vectors! sv-288 (-> s2-1 uvec) sv-272) - (matrix*! s2-1 s2-1 sv-288) ) ) ) @@ -687,7 +683,6 @@ ;; WARN: Return type mismatch ragdoll-flag vs none. (defmethod ragdoll-method-10 ((this ragdoll) (arg0 process-drawable) (arg1 symbol) (arg2 vector) (arg3 symbol)) - (local-vars (sv-144 vector)) (with-pp (set! (-> this turn-off-start) 0) (logclear! (-> this ragdoll-flags) (ragdoll-flag rf2)) @@ -758,13 +753,14 @@ (cond ((logtest? (-> this ragdoll-flags) (ragdoll-flag rf5)) (logclear! (-> this ragdoll-flags) (ragdoll-flag rf5)) - (set! sv-144 (vector<-cspace! (new 'stack-no-clear 'vector) (-> arg0 node-list data (-> s1-0 joint-index)))) - (if (logtest? (-> this ragdoll-flags) (ragdoll-flag mirror)) - (vector-matrix*! sv-144 sv-144 (-> this mirror)) - ) - (vector-! (-> s1-0 velocity) sv-144 (-> s1-0 position)) - (vector-float*! (-> s1-0 velocity) (-> s1-0 velocity) (/ 1.0 (-> pp clock time-adjust-ratio))) - (vector-copy! (-> s1-0 position) sv-144) + (let ((sv-144 (vector<-cspace! (new 'stack-no-clear 'vector) (-> arg0 node-list data (-> s1-0 joint-index))))) + (if (logtest? (-> this ragdoll-flags) (ragdoll-flag mirror)) + (vector-matrix*! sv-144 sv-144 (-> this mirror)) + ) + (vector-! (-> s1-0 velocity) sv-144 (-> s1-0 position)) + (vector-float*! (-> s1-0 velocity) (-> s1-0 velocity) (/ 1.0 (-> pp clock time-adjust-ratio))) + (vector-copy! (-> s1-0 position) sv-144) + ) ) (else (vector<-cspace! (-> s1-0 position) (-> arg0 node-list data (-> s1-0 joint-index))) @@ -956,26 +952,7 @@ ) (defmethod ragdoll-method-15 ((this ragdoll) (arg0 process-drawable) (arg1 ragdoll-edit-info)) - (local-vars - (at-0 int) - (f0-14 float) - (sv-320 vector) - (sv-336 vector) - (sv-352 (function vector float vector)) - (sv-368 vector) - (sv-384 vector) - (sv-400 vector) - (sv-416 vector) - (sv-432 vector) - (sv-448 vector) - (sv-464 vector) - (sv-480 vector) - (sv-496 vector) - (sv-512 vector) - (sv-528 vector) - (sv-544 vector) - (sv-560 vector) - ) + (local-vars (at-0 int) (f0-14 float)) (with-pp (rlet ((acc :class vf) (vf0 :class vf) @@ -1059,251 +1036,245 @@ (new 'stack-no-clear 'vector) (dotimes (s1-1 (the-as int (-> this num-joints))) (let ((s0-1 (-> this ragdoll-joints s1-1))) - (set! sv-560 (new 'stack-no-clear 'vector)) - (let ((v1-74 (-> s0-1 position quad))) - (set! (-> sv-560 quad) v1-74) - ) - (if (and (logtest? (-> s0-1 ragdoll-joint-flags) (ragdoll-joint-flag rjf2)) - (not (logtest? (-> s0-1 ragdoll-joint-flags) (ragdoll-joint-flag rjf3))) - ) - (vector-float*! (-> s0-1 velocity) (-> s0-1 velocity) 0.1) - ) - (ragdoll-method-14 this arg0 s0-1 s1-1 s2-1) - (cond - ((or (zero? (the-as object arg1)) - (and (= (-> arg1 single-step) 1) (cpad-pressed? 0 r2)) - (zero? (-> arg1 single-step)) - ) - (when (or (zero? (the-as object arg1)) (-> arg1 gravity)) - (set! sv-320 (new 'stack-no-clear 'vector)) - (ragdoll-method-19 this sv-320 s1-1 arg0 s2-1) - (let ((v1-93 sv-560)) - (let ((a0-39 sv-560)) - (.mov.vf.w vf6 vf0) - (.lvf vf4 (&-> a0-39 quad)) - ) - (.lvf vf5 (&-> sv-320 quad)) - (.add.vf.xyz vf6 vf4 vf5) - (.svf (&-> v1-93 quad) vf6) - ) - ) - (when (and (< s1-1 (the-as int (+ (-> this num-joints) -1))) - (= (-> this ragdoll-joints (+ s1-1 1) parent-joint) -1) - ) - (set! sv-336 (new 'stack-no-clear 'vector)) - (reset-vec! this sv-336) - (let ((v1-104 sv-560)) - (let ((a0-45 sv-560)) - (.mov.vf.w vf6 vf0) - (.lvf vf4 (&-> a0-45 quad)) - ) - (.lvf vf5 (&-> sv-336 quad)) - (.add.vf.xyz vf6 vf4 vf5) - (.svf (&-> v1-104 quad) vf6) - ) - ) - (when (or (> s1-1 0) (!= (-> s0-1 parent-joint) -1)) - (ragdoll-method-21 this sv-560 (-> s2-1 trans) (-> s0-1 joint-length)) - (set! sv-432 (new 'stack-no-clear 'vector)) - (let ((v1-110 sv-560) - (a0-50 (-> s2-1 trans)) + (let ((sv-560 (new 'stack-no-clear 'vector))) + (vector-copy! sv-560 (-> s0-1 position)) + (if (and (logtest? (-> s0-1 ragdoll-joint-flags) (ragdoll-joint-flag rjf2)) + (not (logtest? (-> s0-1 ragdoll-joint-flags) (ragdoll-joint-flag rjf3))) ) - (.lvf vf4 (&-> v1-110 quad)) - (.lvf vf5 (&-> a0-50 quad)) - ) - (.mov.vf.w vf6 vf0) - (.sub.vf.xyz vf6 vf4 vf5) - (.svf (&-> sv-432 quad) vf6) - (let ((f30-2 (vector-normalize-ret-len! sv-432 1.0)) - (f26-0 (vector-dot sv-432 (-> s2-1 uvec))) - (f28-1 (get-max-angle-for-joint-idx this s1-1)) - ) - (when (< f26-0 (cos f28-1)) - (vector--float*! sv-432 sv-432 (-> s2-1 uvec) f26-0) - (set! sv-352 vector-normalize!) - (set! sv-368 sv-432) - (let ((a1-15 (sin f28-1))) - (sv-352 sv-368 a1-15) - ) - (set! sv-416 sv-432) - (set! sv-384 sv-432) - (set! sv-400 (-> s2-1 uvec)) - (let ((f0-9 (cos f28-1))) - (.lvf vf2 (&-> sv-400 quad)) - (.lvf vf1 (&-> sv-384 quad)) - (let ((v1-123 f0-9)) - (.mov vf3 v1-123) - ) - ) - (.add.x.vf.w vf4 vf0 vf0) - (.mul.x.vf acc vf2 vf3) - (.add.mul.w.vf.xyz vf4 vf1 vf0 acc) - (.svf (&-> sv-416 quad) vf4) - (vector+float*! sv-560 (-> s2-1 trans) sv-432 f30-2) - ) - ) - ) - (if (or (zero? (the-as object arg1)) (-> arg1 collision)) - (ragdoll-method-24 this sv-560 s1-1) - ) - (cond - ((or (> s1-1 0) (!= (-> s0-1 parent-joint) -1)) - (set! sv-448 (new 'stack-no-clear 'vector)) - (let ((v1-134 (-> s2-1 trans)) - (a0-63 sv-560) - ) - (.lvf vf4 (&-> v1-134 quad)) - (.lvf vf5 (&-> a0-63 quad)) - ) - (.mov.vf.w vf6 vf0) - (.sub.vf.xyz vf6 vf4 vf5) - (.svf (&-> sv-448 quad) vf6) - (vector-normalize-ret-len! sv-448 1.0) - (set! sv-464 (new 'stack-no-clear 'vector)) - (let ((v1-137 sv-560) - (a0-65 (-> s0-1 position)) - ) - (.lvf vf4 (&-> v1-137 quad)) - (.lvf vf5 (&-> a0-65 quad)) - ) - (.mov.vf.w vf6 vf0) - (.sub.vf.xyz vf6 vf4 vf5) - (.svf (&-> sv-464 quad) vf6) - (let ((f30-3 (vector-dot sv-448 sv-464))) - (vector--float*! sv-464 sv-464 sv-448 f30-3) - (cond - ((< f30-3 0.0) - (set! f0-14 (* f30-3 (-> this compress-vel-parallel))) - (vector-float*! sv-464 sv-464 (-> this compress-vel)) - ) - (else - (set! f0-14 (* f30-3 (-> this stretch-vel-parallel))) - (vector-float*! sv-464 sv-464 (-> this stretch-vel)) - ) - ) - ) - (vector+float*! sv-464 sv-464 sv-448 f0-14) - (vector+! sv-560 (-> s0-1 position) sv-464) - (let ((f0-16 (-> this momentum))) - (if (logtest? (-> s0-1 ragdoll-joint-flags) (ragdoll-joint-flag rjf2)) - (set! f0-16 0.1) - ) - (let ((t9-20 vector-lerp!) - (a0-72 (-> s0-1 velocity)) - (a1-23 (-> s0-1 velocity)) - (a3-6 f0-16) - ) - (t9-20 a0-72 a1-23 sv-464 a3-6) - ) - ) - (let* ((a2-12 (vector-! (new 'stack-no-clear 'vector) (-> s2-1 trans) sv-560)) - (f0-17 (vector-length-squared a2-12)) - (f1-6 (* (-> this maximum-stretch) (-> s0-1 joint-length))) - (f2-3 f1-6) - ) - (if (< (* f2-3 f2-3) f0-17) - (vector--float*! sv-560 (-> s2-1 trans) a2-12 (/ f1-6 (sqrtf f0-17))) - ) - ) + (vector-float*! (-> s0-1 velocity) (-> s0-1 velocity) 0.1) ) - (else - (let ((a2-14 (vector-! (new 'stack-no-clear 'vector) sv-560 (-> s0-1 position))) - (f0-20 (-> this momentum)) + (ragdoll-method-14 this arg0 s0-1 s1-1 s2-1) + (cond + ((or (zero? (the-as object arg1)) + (and (= (-> arg1 single-step) 1) (cpad-pressed? 0 r2)) + (zero? (-> arg1 single-step)) + ) + (when (or (zero? (the-as object arg1)) (-> arg1 gravity)) + (let ((sv-320 (new 'stack-no-clear 'vector))) + (ragdoll-method-19 this sv-320 s1-1 arg0 s2-1) + (let ((v1-93 sv-560)) + (let ((a0-39 sv-560)) + (.mov.vf.w vf6 vf0) + (.lvf vf4 (&-> a0-39 quad)) ) - (if (logtest? (-> s0-1 ragdoll-joint-flags) (ragdoll-joint-flag rjf2)) - (set! f0-20 0.1) - ) - (vector-lerp! (-> s0-1 velocity) (-> s0-1 velocity) a2-14 f0-20) + (.lvf vf5 (&-> sv-320 quad)) + (.add.vf.xyz vf6 vf4 vf5) + (.svf (&-> v1-93 quad) vf6) + ) ) ) - ) - (let ((f0-21 (vector-vector-distance-squared (-> s0-1 position) sv-560)) - (f1-7 40.96) + (when (and (< s1-1 (the-as int (+ (-> this num-joints) -1))) + (= (-> this ragdoll-joints (+ s1-1 1) parent-joint) -1) + ) + (let ((sv-336 (new 'stack-no-clear 'vector))) + (reset-vec! this sv-336) + (let ((v1-104 sv-560)) + (let ((a0-45 sv-560)) + (.mov.vf.w vf6 vf0) + (.lvf vf4 (&-> a0-45 quad)) + ) + (.lvf vf5 (&-> sv-336 quad)) + (.add.vf.xyz vf6 vf4 vf5) + (.svf (&-> v1-104 quad) vf6) + ) ) - (if (< f0-21 (* f1-7 f1-7)) + ) + (when (or (> s1-1 0) (!= (-> s0-1 parent-joint) -1)) + (ragdoll-method-21 this sv-560 (-> s2-1 trans) (-> s0-1 joint-length)) + (let ((sv-432 (new 'stack-no-clear 'vector))) + (let ((v1-110 sv-560) + (a0-50 (-> s2-1 trans)) + ) + (.lvf vf4 (&-> v1-110 quad)) + (.lvf vf5 (&-> a0-50 quad)) + ) + (.mov.vf.w vf6 vf0) + (.sub.vf.xyz vf6 vf4 vf5) + (.svf (&-> sv-432 quad) vf6) + (let ((f30-2 (vector-normalize-ret-len! sv-432 1.0)) + (f26-0 (vector-dot sv-432 (-> s2-1 uvec))) + (f28-1 (get-max-angle-for-joint-idx this s1-1)) + ) + (when (< f26-0 (cos f28-1)) + (vector--float*! sv-432 sv-432 (-> s2-1 uvec) f26-0) + (vector-normalize! sv-432 (sin f28-1)) + (let ((sv-416 sv-432)) + (let ((sv-384 sv-432) + (sv-400 (-> s2-1 uvec)) + (f0-9 (cos f28-1)) + ) + (.lvf vf2 (&-> sv-400 quad)) + (.lvf vf1 (&-> sv-384 quad)) + (let ((v1-123 f0-9)) + (.mov vf3 v1-123) + ) + ) + (.add.x.vf.w vf4 vf0 vf0) + (.mul.x.vf acc vf2 vf3) + (.add.mul.w.vf.xyz vf4 vf1 vf0 acc) + (.svf (&-> sv-416 quad) vf4) + ) + (vector+float*! sv-560 (-> s2-1 trans) sv-432 f30-2) + ) + ) + ) + ) + (if (or (zero? (the-as object arg1)) (-> arg1 collision)) + (ragdoll-method-24 this sv-560 s1-1) + ) + (cond + ((or (> s1-1 0) (!= (-> s0-1 parent-joint) -1)) + (let ((sv-448 (new 'stack-no-clear 'vector))) + (let ((a0-63 sv-560)) + (.lvf vf4 (&-> (-> s2-1 trans) quad)) + (.lvf vf5 (&-> a0-63 quad)) + ) + (.mov.vf.w vf6 vf0) + (.sub.vf.xyz vf6 vf4 vf5) + (.svf (&-> sv-448 quad) vf6) + (vector-normalize-ret-len! sv-448 1.0) + (let ((sv-464 (new 'stack-no-clear 'vector))) + (let ((v1-137 sv-560) + (a0-65 (-> s0-1 position)) + ) + (.lvf vf4 (&-> v1-137 quad)) + (.lvf vf5 (&-> a0-65 quad)) + ) + (.mov.vf.w vf6 vf0) + (.sub.vf.xyz vf6 vf4 vf5) + (.svf (&-> sv-464 quad) vf6) + (let ((f30-3 (vector-dot sv-448 sv-464))) + (vector--float*! sv-464 sv-464 sv-448 f30-3) + (cond + ((< f30-3 0.0) + (set! f0-14 (* f30-3 (-> this compress-vel-parallel))) + (vector-float*! sv-464 sv-464 (-> this compress-vel)) + ) + (else + (set! f0-14 (* f30-3 (-> this stretch-vel-parallel))) + (vector-float*! sv-464 sv-464 (-> this stretch-vel)) + ) + ) + ) + (vector+float*! sv-464 sv-464 sv-448 f0-14) + (vector+! sv-560 (-> s0-1 position) sv-464) + (let ((f0-16 (-> this momentum))) + (if (logtest? (-> s0-1 ragdoll-joint-flags) (ragdoll-joint-flag rjf2)) + (set! f0-16 0.1) + ) + (vector-lerp! (-> s0-1 velocity) (-> s0-1 velocity) sv-464 f0-16) + ) + ) + ) + (let* ((a2-12 (vector-! (new 'stack-no-clear 'vector) (-> s2-1 trans) sv-560)) + (f0-17 (vector-length-squared a2-12)) + (f1-6 (* (-> this maximum-stretch) (-> s0-1 joint-length))) + ) + (if (< (square f1-6) f0-17) + (vector--float*! sv-560 (-> s2-1 trans) a2-12 (/ f1-6 (sqrtf f0-17))) + ) + ) + ) + (else + (let ((a2-14 (vector-! (new 'stack-no-clear 'vector) sv-560 (-> s0-1 position))) + (f0-20 (-> this momentum)) + ) + (if (logtest? (-> s0-1 ragdoll-joint-flags) (ragdoll-joint-flag rjf2)) + (set! f0-20 0.1) + ) + (vector-lerp! (-> s0-1 velocity) (-> s0-1 velocity) a2-14 f0-20) + ) + ) + ) + (if (< (vector-vector-distance-squared (-> s0-1 position) sv-560) (square 40.96)) (+! (-> this stable-joints) 1) ) - ) - (when (and (zero? s1-1) (< (-> s0-1 parent-joint) 0) (logtest? (-> this ragdoll-flags) (ragdoll-flag rf7))) - (let ((v1-176 (-> arg0 root transv))) - (.lvf vf1 (&-> (vector-! (new 'stack-no-clear 'vector) sv-560 (-> s0-1 position)) quad)) - (let ((f0-22 (-> pp clock frames-per-second))) - (.mov at-0 f0-22) - ) - (.mov vf2 at-0) - (.mov.vf.w vf1 vf0) - (.mul.x.vf.xyz vf1 vf1 vf2) - (.svf (&-> v1-176 quad) vf1) - ) - ) - (vector-copy! (-> s0-1 position) sv-560) - (cond - ((or (> s1-1 0) (!= (-> s0-1 parent-joint) -1)) - (vector-! (-> s3-1 uvec) sv-560 (-> s2-1 trans)) - (vector-normalize! (-> s3-1 uvec) 1.0) - (vector-cross! (-> s3-1 rvec) (-> s3-1 uvec) (-> s2-1 fvec)) - (vector-normalize! (-> s3-1 rvec) 1.0) - (set! sv-528 (new 'stack-no-clear 'vector)) - (let ((v1-183 (-> s0-1 old-x)) - (a0-91 (-> s3-1 rvec)) - ) - (.lvf vf1 (&-> v1-183 quad)) - (.lvf vf2 (&-> a0-91 quad)) - ) - (.outer.product.a.vf acc vf1 vf2) - (.outer.product.b.vf vf3 vf2 vf1 acc) - (.svf (&-> sv-528 quad) vf3) - (vector-flatten! sv-528 (-> s0-1 old-x) (-> s3-1 uvec)) - (vector-normalize! sv-528 1.0) - (cond - ((and (< (-> s0-1 axial-slop) 65536.0) (< (vector-dot (-> s3-1 rvec) sv-528) (cos (-> s0-1 axial-slop)))) - (vector-cross! sv-528 sv-528 (-> s3-1 rvec)) - (vector-cross! sv-528 (-> s3-1 rvec) sv-528) - (vector-normalize! sv-528 1.0) - (set! sv-496 (-> s3-1 rvec)) - (set! sv-480 (-> s3-1 rvec)) - (let ((f0-28 (cos (-> s0-1 axial-slop)))) - (.lvf vf1 (&-> sv-480 quad)) - (let ((v1-195 f0-28)) - (.mov vf2 v1-195) - ) + (when (and (zero? s1-1) (< (-> s0-1 parent-joint) 0) (logtest? (-> this ragdoll-flags) (ragdoll-flag rf7))) + (let ((v1-176 (-> arg0 root transv))) + (.lvf vf1 (&-> (vector-! (new 'stack-no-clear 'vector) sv-560 (-> s0-1 position)) quad)) + (let ((f0-22 (-> pp clock frames-per-second))) + (.mov at-0 f0-22) ) - (.add.x.vf.w vf1 vf0 vf0) + (.mov vf2 at-0) + (.mov.vf.w vf1 vf0) (.mul.x.vf.xyz vf1 vf1 vf2) - (.svf (&-> sv-496 quad) vf1) - (set! sv-544 (-> s3-1 rvec)) - (set! sv-512 (-> s3-1 rvec)) - (let ((f0-30 (sin (-> s0-1 axial-slop)))) - (.lvf vf2 (&-> sv-528 quad)) - (.lvf vf1 (&-> sv-512 quad)) - (let ((v1-201 f0-30)) - (.mov vf3 v1-201) - ) - ) - (.add.x.vf.w vf4 vf0 vf0) - (.mul.x.vf acc vf2 vf3) - (.add.mul.w.vf.xyz vf4 vf1 vf0 acc) - (.svf (&-> sv-544 quad) vf4) - (vector-copy! (-> s0-1 old-x) (-> s3-1 rvec)) + (.svf (&-> v1-176 quad) vf1) ) - (else - (vector-copy! (-> s3-1 rvec) sv-528) - (vector-copy! (-> s0-1 old-x) (-> s3-1 rvec)) + ) + (vector-copy! (-> s0-1 position) sv-560) + (cond + ((or (> s1-1 0) (!= (-> s0-1 parent-joint) -1)) + (vector-! (-> s3-1 uvec) sv-560 (-> s2-1 trans)) + (vector-normalize! (-> s3-1 uvec) 1.0) + (vector-cross! (-> s3-1 rvec) (-> s3-1 uvec) (-> s2-1 fvec)) + (vector-normalize! (-> s3-1 rvec) 1.0) + (let ((sv-528 (new 'stack-no-clear 'vector))) + (let ((v1-183 (-> s0-1 old-x)) + (a0-91 (-> s3-1 rvec)) + ) + (.lvf vf1 (&-> v1-183 quad)) + (.lvf vf2 (&-> a0-91 quad)) + ) + (.outer.product.a.vf acc vf1 vf2) + (.outer.product.b.vf vf3 vf2 vf1 acc) + (.svf (&-> sv-528 quad) vf3) + (vector-flatten! sv-528 (-> s0-1 old-x) (-> s3-1 uvec)) + (vector-normalize! sv-528 1.0) + (cond + ((and (< (-> s0-1 axial-slop) 65536.0) (< (vector-dot (-> s3-1 rvec) sv-528) (cos (-> s0-1 axial-slop)))) + (vector-cross! sv-528 sv-528 (-> s3-1 rvec)) + (vector-cross! sv-528 (-> s3-1 rvec) sv-528) + (vector-normalize! sv-528 1.0) + (let ((sv-496 (-> s3-1 rvec))) + (let ((sv-480 (-> s3-1 rvec)) + (f0-28 (cos (-> s0-1 axial-slop))) + ) + (.lvf vf1 (&-> sv-480 quad)) + (let ((v1-195 f0-28)) + (.mov vf2 v1-195) + ) + ) + (.add.x.vf.w vf1 vf0 vf0) + (.mul.x.vf.xyz vf1 vf1 vf2) + (.svf (&-> sv-496 quad) vf1) + ) + (let ((sv-544 (-> s3-1 rvec))) + (let ((sv-512 (-> s3-1 rvec)) + (f0-30 (sin (-> s0-1 axial-slop))) + ) + (.lvf vf2 (&-> sv-528 quad)) + (.lvf vf1 (&-> sv-512 quad)) + (let ((v1-201 f0-30)) + (.mov vf3 v1-201) + ) + ) + (.add.x.vf.w vf4 vf0 vf0) + (.mul.x.vf acc vf2 vf3) + (.add.mul.w.vf.xyz vf4 vf1 vf0 acc) + (.svf (&-> sv-544 quad) vf4) + ) + (vector-copy! (-> s0-1 old-x) (-> s3-1 rvec)) + ) + (else + (vector-copy! (-> s3-1 rvec) sv-528) + (vector-copy! (-> s0-1 old-x) (-> s3-1 rvec)) + ) + ) ) + (vector-cross! (-> s3-1 fvec) (-> s3-1 rvec) (-> s3-1 uvec)) + (matrix->quaternion (-> s0-1 quat) s3-1) ) - (vector-cross! (-> s3-1 fvec) (-> s3-1 rvec) (-> s3-1 uvec)) - (matrix->quaternion (-> s0-1 quat) s3-1) - ) - (else - (quaternion->matrix s3-1 (-> s0-1 quat)) + (else + (quaternion->matrix s3-1 (-> s0-1 quat)) + ) ) ) - ) - (else - (quaternion->matrix s3-1 (-> s0-1 quat)) + (else + (quaternion->matrix s3-1 (-> s0-1 quat)) + ) ) + (vector-copy! (-> s3-1 trans) sv-560) ) - (vector-copy! (-> s3-1 trans) sv-560) (set! (-> s3-1 rvec w) 0.0) (set! (-> s3-1 uvec w) 0.0) (set! (-> s3-1 fvec w) 0.0) diff --git a/goal_src/jak3/engine/physics/rigid-body.gc b/goal_src/jak3/engine/physics/rigid-body.gc index 79b69aa06e..56abfc4cca 100644 --- a/goal_src/jak3/engine/physics/rigid-body.gc +++ b/goal_src/jak3/engine/physics/rigid-body.gc @@ -46,16 +46,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 rvec x) (* f0-4 (+ f1-3 (* f2-0 f2-0)))) - ) - (let ((f1-6 f28-0)) - (set! (-> this inertial-tensor uvec y) (* f0-4 (+ (* f1-6 f1-6) (* f26-0 f26-0)))) - ) - (set! (-> this inertial-tensor fvec z) (* f0-4 (+ (* f28-0 f28-0) (* f30-0 f30-0)))) + (set! (-> this inertial-tensor rvec x) (* f0-4 (+ (square f30-0) (square f26-0)))) + (set! (-> this inertial-tensor uvec y) (* f0-4 (+ (square f28-0) (square f26-0)))) + (set! (-> this inertial-tensor fvec z) (* f0-4 (+ (square f28-0) (square f30-0)))) ) ) (let ((f0-6 (-> this inertial-tensor rvec x))) @@ -170,10 +163,8 @@ (defmethod rigid-body-control-method-12 ((this rigid-body-control) (arg0 float)) (vector+*! (-> this lin-momentum) (-> this lin-momentum) (-> this force) arg0) (vector+*! (-> this ang-momentum) (-> this ang-momentum) (-> this torque) arg0) - (let* ((f0-3 (* 500000000.0 (-> this info mass))) - (f1-1 f0-3) - ) - (if (< (* f1-1 f1-1) (vector-length-squared (-> this ang-momentum))) + (let ((f0-3 (* 500000000.0 (-> this info mass)))) + (if (< (square f0-3) (vector-length-squared (-> this ang-momentum))) (vector-normalize! (-> this ang-momentum) f0-3) ) ) diff --git a/goal_src/jak3/engine/physics/trajectory.gc b/goal_src/jak3/engine/physics/trajectory.gc index 00803e2ae0..75500f3c41 100644 --- a/goal_src/jak3/engine/physics/trajectory.gc +++ b/goal_src/jak3/engine/physics/trajectory.gc @@ -45,10 +45,9 @@ ) (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))) @@ -79,13 +78,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)) @@ -96,9 +89,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/goal_src/jak3/engine/process-drawable/process-drawable.gc b/goal_src/jak3/engine/process-drawable/process-drawable.gc index 38e7919c21..da87368345 100644 --- a/goal_src/jak3/engine/process-drawable/process-drawable.gc +++ b/goal_src/jak3/engine/process-drawable/process-drawable.gc @@ -160,7 +160,6 @@ ) (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)) ) @@ -186,15 +185,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*) ) ) ) @@ -300,7 +296,6 @@ ) (defmethod setup-lods! ((this lod-set) (skelgroup skeleton-group) (ag art-group) (entity entity)) - (local-vars (sv-16 res-tag)) (let ((v1-0 (-> ag length)) (max-lod (-> skelgroup max-lod)) ) @@ -323,13 +318,13 @@ (set! (-> this lod max-lod dist) (res-lump-float entity 'vis-dist :default 4095996000.0)) ) ) - (let ((jgeo (-> ag data (-> skelgroup jgeo)))) - (set! sv-16 (new 'static 'res-tag)) - (let ((dist (res-lump-data (-> jgeo extra) 'lod-dist pointer :tag-ptr (& sv-16)))) - (when dist - (dotimes (a0-6 (the-as int (-> sv-16 elt-count))) - (set! (-> this lod a0-6 dist) (-> (the-as (pointer float) (&+ dist (* a0-6 4))))) - ) + (let* ((jgeo (-> ag data (-> skelgroup jgeo))) + (sv-16 (new 'static 'res-tag)) + (dist (res-lump-data (-> jgeo extra) 'lod-dist pointer :tag-ptr (& sv-16))) + ) + (when dist + (dotimes (a0-6 (the-as int (-> sv-16 elt-count))) + (set! (-> this lod a0-6 dist) (-> (the-as (pointer float) (&+ dist (* a0-6 4))))) ) ) ) @@ -591,12 +586,6 @@ ;; 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)) @@ -609,17 +598,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 577) - (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 577) + (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)) + ) ) ) ) @@ -730,11 +721,11 @@ ) ) :code (behavior ((arg0 string)) - (local-vars (sv-8 string)) - (set! sv-8 arg0) - (until #f - (process-drawable-error-print self sv-8) - (suspend) + (let ((sv-8 arg0)) + (until #f + (process-drawable-error-print self sv-8) + (suspend) + ) ) #f ) @@ -746,7 +737,7 @@ ) (defun skeleton-group->draw-control ((proc process-drawable) (skelgroup skeleton-group) (arg2 (pointer cspace-array))) - (local-vars (s1-0 art-group) (s2-0 draw-control) (sv-16 art-element) (sv-20 int)) + (local-vars (s1-0 art-group) (s2-0 draw-control)) (let ((s3-0 (if (= (-> skelgroup texture-level) 10) (-> *level* level-default) (-> proc level) @@ -782,61 +773,63 @@ (set! s2-0 (the-as draw-control #f)) (goto cfg-62) ) - (set! sv-16 (-> s1-0 data (-> skelgroup jgeo))) - (set! sv-20 (-> s1-0 length)) - (when (or (< (-> skelgroup jgeo) 0) (>= (-> skelgroup 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-62) - ) - (set! s2-0 (new 'process 'draw-control proc (the-as symbol sv-16))) - (let ((v1-35 s2-0)) - (set! (-> v1-35 status) (draw-control-status uninited)) - (set! (-> v1-35 art-group) s1-0) - (set! (-> v1-35 jgeo) (the-as art-joint-geo sv-16)) - (set! (-> v1-35 force-lod) -1) - (set! (-> v1-35 cur-lod) -1) - (set! (-> v1-35 shadow) #f) - (set! (-> v1-35 shadow-ctrl) #f) - (set! (-> v1-35 data-format) (draw-control-data-format merc)) - (set! (-> v1-35 color-mult quad) (-> (new 'static 'vector :x 1.0 :y 1.0 :z 1.0 :w 1.0) quad)) - (set! (-> v1-35 color-emissive quad) (-> (new 'static 'vector) quad)) - (set! (-> v1-35 longest-edge) (-> skelgroup longest-edge)) - (set! (-> v1-35 origin-joint-index) (the-as uint (-> skelgroup origin-joint-index))) - (set! (-> v1-35 shadow-joint-index) (the-as uint (-> skelgroup shadow-joint-index))) - ) - (vector-copy! (-> s2-0 bounds) (-> skelgroup bounds)) - (let ((v1-37 (-> skelgroup shadow))) - (when (and (> v1-37 0) (< v1-37 sv-20)) - (let ((s0-0 (-> s1-0 data v1-37))) - (if (and (not (logtest? (the-as int (res-lump-value (-> proc entity) 'options uint128 :time -1000000000.0)) 8192)) - s0-0 - (= (-> s0-0 type) shadow-geo) - ) - (set! (-> s2-0 shadow) (the-as shadow-geo s0-0)) + (let ((sv-16 (-> s1-0 data (-> skelgroup jgeo)))) + (let ((sv-20 (-> s1-0 length))) + (when (or (< (-> skelgroup jgeo) 0) (>= (-> skelgroup 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-62) + ) + (set! s2-0 (new 'process 'draw-control proc (the-as symbol sv-16))) + (let ((v1-35 s2-0)) + (set! (-> v1-35 status) (draw-control-status uninited)) + (set! (-> v1-35 art-group) s1-0) + (set! (-> v1-35 jgeo) (the-as art-joint-geo sv-16)) + (set! (-> v1-35 force-lod) -1) + (set! (-> v1-35 cur-lod) -1) + (set! (-> v1-35 shadow) #f) + (set! (-> v1-35 shadow-ctrl) #f) + (set! (-> v1-35 data-format) (draw-control-data-format merc)) + (set! (-> v1-35 color-mult quad) (-> (new 'static 'vector :x 1.0 :y 1.0 :z 1.0 :w 1.0) quad)) + (set! (-> v1-35 color-emissive quad) (-> (new 'static 'vector) quad)) + (set! (-> v1-35 longest-edge) (-> skelgroup longest-edge)) + (set! (-> v1-35 origin-joint-index) (the-as uint (-> skelgroup origin-joint-index))) + (set! (-> v1-35 shadow-joint-index) (the-as uint (-> skelgroup shadow-joint-index))) + ) + (vector-copy! (-> s2-0 bounds) (-> skelgroup bounds)) + (let ((v1-37 (-> skelgroup shadow))) + (when (and (> v1-37 0) (< v1-37 sv-20)) + (let ((s0-0 (-> s1-0 data v1-37))) + (if (and (not (logtest? (the-as int (res-lump-value (-> proc entity) 'options uint128 :time -1000000000.0)) 8192)) + s0-0 + (= (-> s0-0 type) shadow-geo) + ) + (set! (-> s2-0 shadow) (the-as shadow-geo s0-0)) + ) ) + ) ) ) - ) - (if (not (setup-lods! (-> s2-0 lod-set) skelgroup s1-0 (-> proc entity))) - (go process-drawable-art-error "mesh") - ) - (let ((v1-52 (res-lump-value (-> sv-16 extra) 'texture-bucket int :default (the-as uint128 1) :time -1000000000.0)) + (if (not (setup-lods! (-> s2-0 lod-set) skelgroup s1-0 (-> proc entity))) + (go process-drawable-art-error "mesh") ) - (case (if (= (-> skelgroup texture-level) 10) - 10 - (-> s3-0 index) - ) - ((10) - (set! v1-52 (-> skelgroup sort)) - ) + (let ((v1-52 (res-lump-value (-> sv-16 extra) 'texture-bucket int :default (the-as uint128 1) :time -1000000000.0)) + ) + (case (if (= (-> skelgroup texture-level) 10) + 10 + (-> s3-0 index) + ) + ((10) + (set! v1-52 (-> skelgroup sort)) + ) + ) + (set! (-> s2-0 default-texture-page) (the-as uint v1-52)) ) - (set! (-> s2-0 default-texture-page) (the-as uint v1-52)) + (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 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 (-> proc entity) 'shadow-mask uint :time -1000000000.0)) (set! (-> s2-0 shadow-values) (res-lump-value (-> proc entity) 'shadow-values uint :time -1000000000.0)) @@ -1096,14 +1089,15 @@ ) (defbehavior ja-linear-vel process-drawable ((chan int)) - (local-vars (s4-1 vector) (sv-16 res-tag)) + (local-vars (s4-1 vector)) (let* ((s4-0 (-> self skel root-channel chan)) (v1-2 (-> s4-0 frame-group)) ) (cond ((-> v1-2 extra) - (set! sv-16 (new 'static 'res-tag)) - (let ((gp-0 (res-lump-data (-> v1-2 extra) 'linear-vel pointer :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (gp-0 (res-lump-data (-> v1-2 extra) 'linear-vel pointer :tag-ptr (& sv-16))) + ) (cond (gp-0 (let* ((s5-0 (the int (the float (the int (-> s4-0 frame-num))))) diff --git a/goal_src/jak3/engine/scene/scene.gc b/goal_src/jak3/engine/scene/scene.gc index 48b04b13de..0730b59b0c 100644 --- a/goal_src/jak3/engine/scene/scene.gc +++ b/goal_src/jak3/engine/scene/scene.gc @@ -45,7 +45,7 @@ ) (defmethod setup-manipy-for-scene! ((this scene-actor) (arg0 scene-player)) - (local-vars (s4-0 (pointer process)) (sv-96 process)) + (local-vars (s4-0 (pointer process))) (let ((s2-0 (if (-> this level) (level-get *level* (-> this level)) (-> *level* level-default) @@ -92,26 +92,26 @@ ) ) ) - (set! sv-96 (get-process *default-dead-pool* manipy #x20000 0)) - (set! s4-0 (when sv-96 - (let ((t9-8 (method-of-type manipy activate))) - (t9-8 (the-as manipy sv-96) arg0 (-> this name) (the-as pointer #x70004000)) - ) - (run-now-in-process - sv-96 - manipy-init - (-> arg0 root trans) - s2-1 - s3-0 - #f - (if (and s1-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 #x20000 0))) + (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) + s2-1 + s3-0 + #f + (if (and s1-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) @@ -308,14 +308,8 @@ (v1-73 symbol) (v1-105 symbol) (sv-96 object) - (sv-112 object) (sv-128 object) - (sv-144 object) (sv-160 object) - (sv-176 object) - (sv-192 object) - (sv-208 object) - (sv-224 object) ) (dotimes (s3-0 (-> this scene actor length)) (let ((s2-0 (-> this scene actor s3-0))) @@ -346,8 +340,9 @@ ) (let ((s1-1 (handle->process (-> s2-0 process)))) (when (and s1-1 (nonzero? (-> (the-as process-drawable s1-1) draw))) - (let ((s0-1 (-> s2-0 scissor-frames))) - (set! sv-112 (car s0-1)) + (let* ((s0-1 (-> s2-0 scissor-frames)) + (sv-112 (car s0-1)) + ) (while (not (null? s0-1)) (when (and (pair? sv-112) (let ((a0-21 (car sv-112))) @@ -369,8 +364,9 @@ (logclear! (-> (the-as process-drawable s1-1) draw status) (draw-control-status force-vu1)) (logior! (-> (the-as process-drawable s1-1) draw status) (draw-control-status force-vu1)) ) - (let ((s0-2 (-> s2-0 shadow-frames))) - (set! sv-144 (car s0-2)) + (let* ((s0-2 (-> s2-0 shadow-frames)) + (sv-144 (car s0-2)) + ) (while (not (null? s0-2)) (when (and (pair? sv-144) (let ((a0-30 (car sv-144))) @@ -392,23 +388,22 @@ (send-event s1-1 'shadow #t) (send-event s1-1 'shadow #f) ) - (let ((s0-3 (-> s2-0 cloth-reset-frames))) - (set! sv-192 (car s0-3)) + (let* ((s0-3 (-> s2-0 cloth-reset-frames)) + (sv-192 (car s0-3)) + ) (while (not (null? s0-3)) (let ((v1-97 (cond ((pair? sv-192) - (let ((a0-38 (car sv-192))) - (set! sv-176 (car (cdr sv-192))) + (let ((a0-38 (car sv-192)) + (sv-176 (car (cdr sv-192))) + ) (and (or (= a0-38 'min) (>= arg0 (+ -1.0 (command-get-float a0-38 0.0)))) (or (= sv-176 'max) (< arg0 (+ 1.0 (command-get-float (car (cdr sv-192)) 0.0)))) ) ) ) (else - (let* ((t9-11 command-get-float) - (a1-18 0.0) - (f0-10 (t9-11 sv-192 a1-18)) - ) + (let ((f0-10 (command-get-float sv-192 0.0))) (and (< arg1 f0-10) (>= arg0 f0-10)) ) ) @@ -434,27 +429,25 @@ ) (while (not (null? s2-1)) (when (pair? s0-4) - (set! sv-224 (car s0-4)) - (let ((v1-121 (cond - ((pair? sv-224) - (let ((a0-44 (car sv-224))) - (set! sv-208 (car (cdr sv-224))) - (and (or (= a0-44 'min) (>= arg0 (command-get-float a0-44 0.0))) - (or (= sv-208 'max) (< arg0 (command-get-float (car (cdr sv-224)) 0.0))) + (let* ((sv-224 (car s0-4)) + (v1-121 (cond + ((pair? sv-224) + (let ((a0-44 (car sv-224)) + (sv-208 (car (cdr sv-224))) ) - ) - ) - (else - (let* ((t9-15 command-get-float) - (a1-23 0.0) - (f0-13 (t9-15 sv-224 a1-23)) + (and (or (= a0-44 'min) (>= arg0 (command-get-float a0-44 0.0))) + (or (= sv-208 'max) (< arg0 (command-get-float (car (cdr sv-224)) 0.0))) ) - (and (< arg1 f0-13) (>= arg0 f0-13)) ) ) - ) - ) - ) + (else + (let ((f0-13 (command-get-float sv-224 0.0))) + (and (< arg1 f0-13) (>= arg0 f0-13)) + ) + ) + ) + ) + ) (if v1-121 (process-drawable-cloth-command (the-as process-drawable s1-1) (cdr s0-4)) ) @@ -725,15 +718,13 @@ ;; 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 hud-draw-pris2) ) @@ -745,16 +736,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/goal_src/jak3/engine/sound/gsound.gc b/goal_src/jak3/engine/sound/gsound.gc index 4a157c51e3..caefcea39e 100644 --- a/goal_src/jak3/engine/sound/gsound.gc +++ b/goal_src/jak3/engine/sound/gsound.gc @@ -670,9 +670,9 @@ (defbehavior sound-play-by-name process-drawable ((name sound-name) (id sound-id) (vol int) (pitch int) (bend int) (group sound-group) (trans object)) "Send play rpc to play a sound!" - (local-vars (sv-16 sound-group)) - (set! sv-16 group) - (let ((s4-0 trans)) + (let ((sv-16 group) + (s4-0 trans) + ) (when *sound-player-enable* (let ((s5-0 (the-as sound-rpc-play (get-sound-buffer-entry)))) (set! (-> s5-0 command) (sound-command play)) @@ -829,115 +829,109 @@ (defmethod new ambient-sound ((allocation symbol) (type-to-make type) (spec basic) (trans vector) (lump-time float)) "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 (-> spec type) - ((entity-actor) - (let* ((a0-3 ((method-of-type res-lump get-property-struct) - (the-as res-lump spec) - 'effect-name - 'exact - lump-time - (the-as structure #f) - (the-as (pointer res-tag) #f) - *res-static-buf* - ) - ) - (v1-2 (when a0-3 - (case (rtype-of a0-3) - ((symbol) - (symbol->string (the-as symbol a0-3)) - ) - ((string) - a0-3 - ) - (else - "unknown" + (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 (-> spec type) + ((entity-actor) + (let* ((a0-3 ((method-of-type res-lump get-property-struct) + (the-as res-lump spec) + 'effect-name + 'exact + lump-time + (the-as structure #f) + (the-as (pointer res-tag) #f) + *res-static-buf* + ) + ) + (v1-2 (when a0-3 + (case (rtype-of a0-3) + ((symbol) + (symbol->string (the-as symbol a0-3)) + ) + ((string) + a0-3 + ) + (else + "unknown" + ) ) ) ) + ) + (when v1-2 + (set! sv-32 (string->sound-name (the-as string v1-2))) + (set! sv-48 (res-lump-data (the-as res-lump spec) 'cycle-speed (pointer float))) + (set! sv-16 *ambient-spec*) + (let* ((sv-64 (new 'static 'res-tag)) + (v1-9 ((method-of-type res-lump get-property-data) + (the-as res-lump spec) + 'effect-param + 'exact + lump-time + (the-as pointer #f) + (& sv-64) + *res-static-buf* + ) + ) ) - ) - (when v1-2 - (set! sv-32 (string->sound-name (the-as string v1-2))) - (set! sv-48 (res-lump-data (the-as res-lump spec) 'cycle-speed (pointer float))) - (set! sv-16 *ambient-spec*) - (set! sv-64 (new 'static 'res-tag)) - (let ((v1-9 ((method-of-type res-lump get-property-data) - (the-as res-lump spec) - 'effect-param - 'exact - lump-time - (the-as pointer #f) - (& sv-64) - *res-static-buf* - ) - ) + (when v1-9 + (set! sv-52 v1-9) + (set! sv-56 (the-as int (-> sv-64 elt-count))) ) - (when v1-9 - (set! sv-52 v1-9) - (set! sv-56 (the-as int (-> sv-64 elt-count))) ) ) ) ) - ) - ((sound-spec) - (set! sv-16 (the-as sound-spec spec)) - ) - ((string) - (set! sv-32 (string->sound-name (the-as string spec))) - ) - (else - (format 0 "ERROR: ambient sound was told to play an unknown ~A.~%" spec) + ((sound-spec) + (set! sv-16 (the-as sound-spec spec)) + ) + ((string) + (set! sv-32 (string->sound-name (the-as string spec))) + ) + (else + (format 0 "ERROR: ambient sound was told to play an unknown ~A.~%" spec) + ) ) - ) - (cond - ((or sv-16 (nonzero? sv-32)) - (let ((s5-1 (object-new allocation type-to-make (the-as int (-> type-to-make size))))) - (set! (-> s5-1 spec) sv-16) - (set! (-> s5-1 name) sv-32) - (set! (-> s5-1 playing-id) (new-sound-id)) - (set! (-> s5-1 params) (the-as (pointer float) sv-52)) - (set! (-> s5-1 param-count) sv-56) - (set! (-> s5-1 entity) #f) - (set! (-> s5-1 sound-count) 1) - (set! (-> s5-1 volume) 1024) - (set! (-> 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! (-> s5-1 volume) (-> (the-as sound-spec sv-16) volume)) - ) - (if (logtest? (-> (the-as sound-spec sv-16) mask) (sound-mask pitch)) - (set! (-> s5-1 pitch) (-> (the-as sound-spec sv-16) pitch-mod)) - ) - ) - (cond - (sv-48 - (set! (-> s5-1 time-base) (the-as time-frame (the int (* 300.0 (-> sv-48 0))))) - (set! (-> s5-1 time-random) (the-as time-frame (the int (* 300.0 (-> sv-48 1))))) + (cond + ((or sv-16 (nonzero? sv-32)) + (let ((s5-1 (object-new allocation type-to-make (the-as int (-> type-to-make size))))) + (set! (-> s5-1 spec) sv-16) + (set! (-> s5-1 name) sv-32) + (set! (-> s5-1 playing-id) (new-sound-id)) + (set! (-> s5-1 params) (the-as (pointer float) sv-52)) + (set! (-> s5-1 param-count) sv-56) + (set! (-> s5-1 entity) #f) + (set! (-> s5-1 sound-count) 1) + (set! (-> s5-1 volume) 1024) + (set! (-> 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! (-> s5-1 volume) (-> (the-as sound-spec sv-16) volume)) + ) + (if (logtest? (-> (the-as sound-spec sv-16) mask) (sound-mask pitch)) + (set! (-> s5-1 pitch) (-> (the-as sound-spec sv-16) pitch-mod)) + ) ) - (else - (set! (-> s5-1 time-base) -1) + (cond + (sv-48 + (set! (-> s5-1 time-base) (the-as time-frame (the int (* 300.0 (-> sv-48 0))))) + (set! (-> s5-1 time-random) (the-as time-frame (the int (* 300.0 (-> sv-48 1))))) + ) + (else + (set! (-> s5-1 time-base) -1) + ) ) + (vector-copy! (-> s5-1 trans) trans) + s5-1 ) - (vector-copy! (-> s5-1 trans) trans) - s5-1 ) - ) - (else - (the-as ambient-sound 0) + (else + (the-as ambient-sound 0) + ) ) ) ) diff --git a/goal_src/jak3/engine/sound/speech.gc b/goal_src/jak3/engine/sound/speech.gc index fc230c2c7e..321e7b4a17 100644 --- a/goal_src/jak3/engine/sound/speech.gc +++ b/goal_src/jak3/engine/sound/speech.gc @@ -260,11 +260,9 @@ (if (and (!= (-> this request handle) #f) (or (< (the-as time-frame (-> s5-1 request-timeout)) a0-8) (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)) + ) ) ) (reset-channel! this) @@ -436,14 +434,9 @@ (speech-channel-method-14 this arg1 1.0) (return 0) ) - (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 (-> s3-0 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 (-> s3-0 priority))))) (when (< (-> this request priority) f0-2) (set! (-> this request priority) f0-2) (set! (-> this request handle) (process->handle arg0)) diff --git a/goal_src/jak3/engine/spatial-hash/actor-hash.gc b/goal_src/jak3/engine/spatial-hash/actor-hash.gc index 94e9ac81a4..f7c1592bf6 100644 --- a/goal_src/jak3/engine/spatial-hash/actor-hash.gc +++ b/goal_src/jak3/engine/spatial-hash/actor-hash.gc @@ -140,20 +140,15 @@ (while (!= v1-17 (-> this list alive-list-end)) (let* ((s4-0 (-> (the-as connection v1-17) param1)) (f0-7 (vector-vector-distance-squared (-> this tpos) (-> (the-as collide-shape s4-0) trans))) - (f1-2 102400.0) ) (cond - ((< f0-7 (* f1-2 f1-2)) + ((< f0-7 (square 102400.0)) ((method-of-type actor-hash-bucket add-actor-cshape) (-> this data 0) (the-as collide-shape s4-0)) ) - ((let ((f1-5 204800.0)) - (< f0-7 (* f1-5 f1-5)) - ) + ((< f0-7 (square 204800.0)) (add-actor-cshape (-> this data 1) (the-as collide-shape s4-0)) ) - ((let ((f1-8 307200.0)) - (< f0-7 (* f1-8 f1-8)) - ) + ((< f0-7 (square 307200.0)) (add-actor-cshape (-> this data 2) (the-as collide-shape s4-0)) ) (else diff --git a/goal_src/jak3/engine/spatial-hash/collide-hash.gc b/goal_src/jak3/engine/spatial-hash/collide-hash.gc index 5b2d0837d3..1ea80e653a 100644 --- a/goal_src/jak3/engine/spatial-hash/collide-hash.gc +++ b/goal_src/jak3/engine/spatial-hash/collide-hash.gc @@ -98,9 +98,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) @@ -122,216 +119,219 @@ (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 long 3)))) + (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 long 0)))) - (.pextlh v1-12 v1-11 0) - (let ((a0-9 (the-as uint128 (-> s3-0 origin long 1)))) - (.pw.sra a1-3 v1-12 10) - (let ((v1-13 (the-as uint128 (-> s3-0 origin long 2)))) - (.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 long 3)))) + (nop!) + (let ((a2-2 (the-as uint128 (-> s3-0 origin long 0)))) + (.pextlh v1-12 v1-11 0) + (let ((a0-9 (the-as uint128 (-> s3-0 origin long 1)))) + (.pw.sra a1-3 v1-12 10) + (let ((v1-13 (the-as uint128 (-> s3-0 origin long 2)))) + (.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 rvec quad) vf1) - (nop!) - (.svf (&-> s2-0 instance-mat uvec quad) vf2) - (nop!) - (.svf (&-> s2-0 instance-mat fvec quad) 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 rvec quad)) - (nop!) - (.lvf vf2 (&-> s0-0 uvec quad)) - (nop!) - (.lvf vf3 (&-> s0-0 fvec quad)) - (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) - ;; og:preserve-this - (set! (-> (scratchpad-object collide-hash-scratch) collidable-bits 0) (the-as uint128 0)) - (set! (-> (scratchpad-object collide-hash-scratch) collidable-bits 1) (the-as uint128 0)) - (set! (-> (scratchpad-object collide-hash-scratch) tris) (the-as uint 0)) - (fill-bg-using-box-new arg0 (-> s1-1 fragments s3-1) s2-0) - (+! (-> *collide-stats* tris) (-> (scratchpad-object collide-hash-scratch) 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 rvec quad) vf1) + (nop!) + (.svf (&-> s2-0 instance-mat uvec quad) vf2) + (nop!) + (.svf (&-> s2-0 instance-mat fvec quad) 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 rvec quad)) + (nop!) + (.lvf vf2 (&-> s0-0 uvec quad)) + (nop!) + (.lvf vf3 (&-> s0-0 fvec quad)) + (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) + ;; og:preserve-this + (set! (-> (scratchpad-object collide-hash-scratch) collidable-bits 0) (the-as uint128 0)) + (set! (-> (scratchpad-object collide-hash-scratch) collidable-bits 1) (the-as uint128 0)) + (set! (-> (scratchpad-object collide-hash-scratch) tris) (the-as uint 0)) + (fill-bg-using-box-new arg0 (-> s1-1 fragments s3-1) s2-0) + (+! (-> *collide-stats* tris) (-> (scratchpad-object collide-hash-scratch) tris)) + ) ) ) ) ) ) - ) - (else - (if *collide-list-boxes* - (add-collide-debug-box (-> s3-0 bsphere) (new 'static 'rgba :r #xff :g #xff :a #x80)) - ) - ;; og:preserve-this - (set! (-> (scratchpad-object collide-hash-scratch) collidable-bits 0) (the-as uint128 0)) - (set! (-> (scratchpad-object collide-hash-scratch) collidable-bits 1) (the-as uint128 0)) - (set! (-> arg2 instance-ptr) #f) - (set! (-> (scratchpad-object collide-hash-scratch) tris) (the-as uint 0)) - (fill-bg-using-box-new arg0 s3-0 arg2) - (+! (-> *collide-stats* tris) (-> (scratchpad-object collide-hash-scratch) tris)) + (else + (if *collide-list-boxes* + (add-collide-debug-box (-> s3-0 bsphere) (new 'static 'rgba :r #xff :g #xff :a #x80)) + ) + ;; og:preserve-this + (set! (-> (scratchpad-object collide-hash-scratch) collidable-bits 0) (the-as uint128 0)) + (set! (-> (scratchpad-object collide-hash-scratch) collidable-bits 1) (the-as uint128 0)) + (set! (-> arg2 instance-ptr) #f) + (set! (-> (scratchpad-object collide-hash-scratch) tris) (the-as uint 0)) + (fill-bg-using-box-new arg0 s3-0 arg2) + (+! (-> *collide-stats* tris) (-> (scratchpad-object collide-hash-scratch) tris)) + ) ) ) ) @@ -348,14 +348,11 @@ (v1-14 uint128) (v1-15 uint128) (v1-17 number) - (v1-26 float) (a0-10 uint128) (a0-11 uint128) (a1-3 uint128) (a2-3 uint128) (a2-4 uint128) - (sv-16 int) - (sv-640 int) ) (rlet ((acc :class vf) (vf0 :class vf) @@ -372,204 +369,206 @@ (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 long 3)))) + (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 long 0)))) - (.pextlh v1-12 v1-11 0) - (let ((a0-9 (the-as uint128 (-> s2-0 origin long 1)))) - (.pw.sra a1-3 v1-12 10) - (let ((v1-13 (the-as uint128 (-> s2-0 origin long 2)))) - (.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 long 3)))) + (nop!) + (let ((a2-2 (the-as uint128 (-> s2-0 origin long 0)))) + (.pextlh v1-12 v1-11 0) + (let ((a0-9 (the-as uint128 (-> s2-0 origin long 1)))) + (.pw.sra a1-3 v1-12 10) + (let ((v1-13 (the-as uint128 (-> s2-0 origin long 2)))) + (.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 rvec quad) vf1) - (nop!) - (.svf (&-> s1-0 instance-mat uvec quad) vf2) - (nop!) - (.svf (&-> s1-0 instance-mat fvec quad) 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 rvec quad)) - (nop!) - (.lvf vf2 (&-> s0-0 uvec quad)) - (nop!) - (.lvf vf3 (&-> s0-0 fvec quad)) - (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 rvec quad) vf1) + (nop!) + (.svf (&-> s1-0 instance-mat uvec quad) vf2) + (nop!) + (.svf (&-> s1-0 instance-mat fvec quad) 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 rvec quad)) + (nop!) + (.lvf vf2 (&-> s0-0 uvec quad)) + (nop!) + (.lvf vf3 (&-> s0-0 fvec quad)) + (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)) + ) + ) + (set! (-> s1-0 rlength w) (/ 1.0 (vector-length-squared (-> s1-0 move-dist)))) + (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) + ;; og:preserve-this + (set! (-> (scratchpad-object collide-hash-scratch) collidable-bits 0) (the-as uint128 0)) + (set! (-> (scratchpad-object collide-hash-scratch) collidable-bits 1) (the-as uint128 0)) + (set! (-> (scratchpad-object collide-hash-scratch) tris) (the-as uint 0)) + (fill-bg-using-line-sphere-new arg0 (-> s0-1 fragments s2-1) s1-0) + (+! (-> *collide-stats* tris) (-> (scratchpad-object collide-hash-scratch) 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)) - ) - ) - (set! (-> s1-0 rlength w) (/ 1.0 (vector-length-squared (-> s1-0 move-dist)))) - (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) - ;; og:preserve-this - (set! (-> (scratchpad-object collide-hash-scratch) collidable-bits 0) (the-as uint128 0)) - (set! (-> (scratchpad-object collide-hash-scratch) collidable-bits 1) (the-as uint128 0)) - (set! (-> (scratchpad-object collide-hash-scratch) tris) (the-as uint 0)) - (fill-bg-using-line-sphere-new arg0 (-> s0-1 fragments s2-1) s1-0) - (+! (-> *collide-stats* tris) (-> (scratchpad-object collide-hash-scratch) tris)) ) ) ) ) ) - ) - (else - (if *collide-list-boxes* - (add-collide-debug-box (-> s2-0 bsphere) (new 'static 'rgba :r #xff :g #xff :a #x80)) - ) - ;; og:preserve-this - (set! (-> (scratchpad-object collide-hash-scratch) collidable-bits 0) (the-as uint128 0)) - (set! (-> (scratchpad-object collide-hash-scratch) collidable-bits 1) (the-as uint128 0)) - (set! (-> arg2 instance-ptr) #f) - (set! (-> (scratchpad-object collide-hash-scratch) tris) (the-as uint 0)) - (fill-bg-using-line-sphere-new arg0 s2-0 arg2) - (+! (-> *collide-stats* tris) (-> (scratchpad-object collide-hash-scratch) tris)) + (else + (if *collide-list-boxes* + (add-collide-debug-box (-> s2-0 bsphere) (new 'static 'rgba :r #xff :g #xff :a #x80)) + ) + ;; og:preserve-this + (set! (-> (scratchpad-object collide-hash-scratch) collidable-bits 0) (the-as uint128 0)) + (set! (-> (scratchpad-object collide-hash-scratch) collidable-bits 1) (the-as uint128 0)) + (set! (-> arg2 instance-ptr) #f) + (set! (-> (scratchpad-object collide-hash-scratch) tris) (the-as uint 0)) + (fill-bg-using-line-sphere-new arg0 s2-0 arg2) + (+! (-> *collide-stats* tris) (-> (scratchpad-object collide-hash-scratch) tris)) + ) ) ) ) @@ -588,6 +587,7 @@ (+! (-> usage data 51 total) (logand -16 (+ v1-8 15))) ) (dotimes (v1-12 (the-as int (-> this qwc-id-bits))) + ;; og:preserve-this (set! (-> (scratchpad-object collide-hash-scratch) collidable-bits v1-12) (the-as uint128 0)) ) (dotimes (s3-0 (the-as int (-> this num-items))) @@ -595,7 +595,7 @@ (v1-17 (shr a0-11 5)) ) ;; og:preserve-this - (when (not (logtest? (->(scratchpad-object collide-hash-scratch) id-bits v1-17) (ash 1 (the-as int (logand a0-11 31)))) + (when (not (logtest? (-> (scratchpad-object collide-hash-scratch) id-bits v1-17) (ash 1 (the-as int (logand a0-11 31)))) ) (logior! (-> (scratchpad-object collide-hash-scratch) id-bits v1-17) (ash 1 (the-as int (logand a0-11 31)))) (if (= (-> this item-array s3-0 collidable type) collide-hash-fragment) diff --git a/goal_src/jak3/engine/spatial-hash/spatial-hash.gc b/goal_src/jak3/engine/spatial-hash/spatial-hash.gc index 048936e48c..110f28c16e 100644 --- a/goal_src/jak3/engine/spatial-hash/spatial-hash.gc +++ b/goal_src/jak3/engine/spatial-hash/spatial-hash.gc @@ -88,7 +88,7 @@ (t1-0 (-> this dimension-array 0)) (t2-0 (-> this dimension-array 2)) (t3-0 (-> this dimension-array 1)) - (a0-2 (&-> (-> this bucket-array) (/ (the-as int arg0) 8))) + (a0-2 (&-> this bucket-array (/ (the-as int arg0) 8))) (a1-2 (ash 1 (logand (the-as int arg0) 7))) ) (dotimes (t4-3 t3-0) @@ -529,44 +529,45 @@ ) (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 debug) 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 debug) 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 debug) 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 debug) 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 debug) 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 debug) sv-68 sv-72 arg3 #f (the-as rgba -1)) + ) ) ) 0 diff --git a/goal_src/jak3/engine/target/board/board-states.gc b/goal_src/jak3/engine/target/board/board-states.gc index 04b0ac03c3..fdf9893daa 100644 --- a/goal_src/jak3/engine/target/board/board-states.gc +++ b/goal_src/jak3/engine/target/board/board-states.gc @@ -924,10 +924,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 manipy-options none :behavior manipy)) - (sv-160 entity-actor) - ) (if (= arg2 'hit) (set! arg2 #f) ) @@ -985,36 +981,21 @@ (part-tracker-spawn part-tracker :to self :group group-board-quick-jump) ) ) - (let* ((s1-1 (get-process *default-dead-pool* manipy #x20000 1)) - (s2-4 - (when s1-1 - (let ((t9-20 (method-of-type manipy activate))) - (t9-20 (the-as manipy s1-1) self "manipy" (the-as pointer #x70004000)) - ) - (let ((s2-5 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 level) #f))) - (t1-1 #f) - (t2-1 0) - ) - ((the-as (function object object object object object object object none) s2-5) - s0-1 - sv-144 - s3-5 - sv-160 - t0-2 - t1-1 - t2-1 - ) - ) - ) - (-> s1-1 ppointer) - ) - ) - ) + (let ((s2-4 + (process-spawn + manipy + :init manipy-init + s3-5 + (-> self entity) + (art-group-get-by-name *level* "skel-generic-blast" (the-as (pointer level) #f)) + #f + 0 + :name "manipy" + :to self + :stack-size #x20000 + ) + ) + ) (when s2-4 (quaternion-copy! (-> (the-as process-drawable (-> s2-4 0)) root quat) (-> self control quat-for-control)) (send-event (ppointer->process s2-4) 'anim-mode 'play1) diff --git a/goal_src/jak3/engine/target/board/target-board.gc b/goal_src/jak3/engine/target/board/target-board.gc index e4e1b651a6..54245943b3 100644 --- a/goal_src/jak3/engine/target/board/target-board.gc +++ b/goal_src/jak3/engine/target/board/target-board.gc @@ -605,10 +605,8 @@ (when (!= *target* a0-11) (let ((v1-13 (vector-! (new 'stack-no-clear 'vector) (-> a0-11 root trans) gp-0))) 0.0 - (let ((f0-3 (vector-length-squared v1-13)) - (f1-0 (-> gp-0 w)) - ) - (if (>= (* f1-0 f1-0) f0-3) + (let ((f0-3 (vector-length-squared v1-13))) + (if (>= (square (-> gp-0 w)) f0-3) (send-event a0-11 'green-eco-attack) ) ) @@ -625,10 +623,8 @@ (when (!= *target* s5-2) (let ((v1-24 (vector-! (new 'stack-no-clear 'vector) (-> s5-2 control trans) gp-0))) 0.0 - (let ((f0-6 (vector-length-squared v1-24)) - (f1-4 (-> gp-0 w)) - ) - (if (>= (* f1-4 f1-4) f0-6) + (let ((f0-6 (vector-length-squared v1-24))) + (if (>= (square (-> gp-0 w)) f0-6) (send-event s5-2 'green-eco-attack) ) ) @@ -2369,7 +2365,6 @@ ;; WARN: Found some very strange gotos. Check result carefully, this is not well tested. (defbehavior target-board-compute-edge target () - (local-vars (sv-752 int)) (let ((s4-0 *edge-grab-info*) (gp-0 (new 'stack-no-clear 'vector)) ) @@ -2561,8 +2556,8 @@ ) (s3-8 (new 'stack-no-clear 'collide-query)) (f26-0 81920.0) + (sv-752 8) ) - (set! sv-752 8) (let ((v1-205 s3-8)) (set! (-> v1-205 radius) 1228.8) (set! (-> v1-205 collide-with) diff --git a/goal_src/jak3/engine/target/collide-reaction-target.gc b/goal_src/jak3/engine/target/collide-reaction-target.gc index 758dfdfb2d..e30ebd01ec 100644 --- a/goal_src/jak3/engine/target/collide-reaction-target.gc +++ b/goal_src/jak3/engine/target/collide-reaction-target.gc @@ -10,31 +10,32 @@ ;; DECOMP BEGINS (defun poly-find-nearest-edge ((arg0 nav-poly) (arg1 (inline-array vector)) (arg2 vector) (arg3 vector)) - (local-vars (sv-32 vector) (sv-36 number) (sv-40 int) (sv-48 number) (sv-80 vector)) - (set! sv-32 (new 'stack-no-clear 'vector)) - (set! sv-36 4095996000.0) - (set! sv-40 -1) - (set! sv-48 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 (the-as float sv-36)) (and (= f30-0 (the-as float sv-36)) (< (the-as float 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 4095996000.0) + (sv-40 -1) + ) + (let ((sv-48 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 (the-as float sv-36)) (and (= f30-0 (the-as float sv-36)) (< (the-as float 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)) + (vector-copy! (-> arg0 vertex1) (-> arg1 (mod (+ sv-40 1) 3))) ) - (set! (-> arg0 vertex 0 quad) (-> arg1 sv-40 quad)) - (vector-copy! (-> arg0 vertex1) (-> arg1 (mod (+ sv-40 1) 3))) arg0 ) @@ -45,456 +46,445 @@ (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)) - (vector-copy! (-> arg0 low-coverage-norm-of-next1) (-> s4-0 best-other-tri normal)) - 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)) - (vector-copy! (-> arg0 low-coverage-norm-of-next2) (-> s4-0 best-other-tri normal)) - 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)) + (vector-copy! (-> arg0 low-coverage-norm-of-next1) (-> s4-0 best-other-tri normal)) + 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)) + (vector-copy! (-> arg0 low-coverage-norm-of-next2) (-> s4-0 best-other-tri normal)) + 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) ) (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)) - (vector-copy! (-> sv-88 rvec) arg3) - (vector-copy! (-> sv-88 uvec) arg3) - (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))) - (vector-copy! v1-24 (-> arg1 best-my-prim prim-core world-sphere)) - (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)) - ) - (vector-copy! (-> arg0 poly-normal) (-> arg1 best-other-tri normal)) - (collide-shape-moving-angle-set! arg0 sv-84 (-> sv-88 rvec)) - (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))) - (vector-copy! (-> arg0 transv-on-last-impact) (-> arg0 transv)) - (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 rvec 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 rvec))) - ) - 0.0 - (vector-! v1-113 (-> sv-88 rvec) (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 rvec) - (vector-float*! (-> sv-88 rvec) (-> 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))) + (vector-copy! (-> sv-88 rvec) arg3) + (vector-copy! (-> sv-88 uvec) arg3) + (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))) + (vector-copy! v1-24 (-> arg1 best-my-prim prim-core world-sphere)) + (vector-! sv-80 v1-24 (-> arg1 best-other-tri intersect)) ) - ) - ) - ) - (set! sv-96 (logior sv-96 (collide-status touch-surface))) - (cond - ((-> arg1 best-other-prim) - (set! sv-96 (logior sv-96 (collide-status touch-actor))) - (set! (-> arg0 actor-contact-pt quad) (-> arg1 best-other-tri intersect quad)) - (vector-copy! (-> arg0 actor-contact-normal) (-> arg0 poly-normal)) - (set! (-> arg0 actor-contact-handle) (process->handle (-> arg1 best-other-prim 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)) - (vector-copy! (-> arg0 wall-contact-poly-normal) (-> arg0 poly-normal)) - (vector-copy! (-> arg0 wall-contact-normal) sv-84) - (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 rvec) (-> 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)) + ) + (vector-copy! sv-84 sv-80) + (if (= (-> arg1 best-dist) 0.0) + (move-by-vector! arg0 (vector-normalize-copy! (new-stack-vector0) sv-84 3.0)) + ) + (vector-copy! (-> arg0 poly-normal) (-> arg1 best-other-tri normal)) + (collide-shape-moving-angle-set! arg0 sv-84 (-> sv-88 rvec)) + (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 rvec))) - ) - (else - (vector-reflect-flat! arg2 (-> sv-88 rvec) 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 ground-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))) + (vector-copy! (-> arg0 transv-on-last-impact) (-> arg0 transv)) + (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 rvec 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 rvec))) + ) + 0.0 + (vector-! v1-113 (-> sv-88 rvec) (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 ground-touch-point)) + (if (< f1-13 0.0) + (set! f1-13 (* f1-13 f0-21)) + ) + (vector+! + (-> sv-88 rvec) + (vector-float*! (-> sv-88 rvec) (-> 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))) - (not (logtest? (state-flags hang) (-> arg0 process state-flags))) + ) + ) + ) + (logior! sv-96 (collide-status touch-surface)) + (cond + ((-> arg1 best-other-prim) + (logior! sv-96 (collide-status touch-actor)) + (set! (-> arg0 actor-contact-pt quad) (-> arg1 best-other-tri intersect quad)) + (vector-copy! (-> arg0 actor-contact-normal) (-> arg0 poly-normal)) + (set! (-> arg0 actor-contact-handle) (process->handle (-> arg1 best-other-prim cshape process))) + ) + ((= (-> arg0 poly-pat material) (pat-material waterbottom)) + ) + (else + (logior! sv-96 (collide-status touch-background)) + ) + ) + (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)) + (vector-copy! (-> arg0 wall-contact-poly-normal) (-> arg0 poly-normal)) + (vector-copy! (-> arg0 wall-contact-normal) sv-84) + (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 rvec) (-> 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 rvec))) + ) + (else + (vector-reflect-flat! arg2 (-> sv-88 rvec) 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 ground-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 ground-touch-point)) + ) + 0.0 + ) + (and (< 0.0 (vector-dot (-> arg0 ground-poly-normal) arg2)) + (not (logtest? sv-104 (cshape-reaction-flags csrf05))) + (not (logtest? (state-flags hang) (-> arg0 process state-flags))) + ) + ) + (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 rvec) s3-4)) ) + (vector+! arg2 arg2 (-> arg0 poly-normal)) + ) + (else + ) + ) ) - (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 rvec) 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) - (vector-copy! (-> arg0 local-normal) sv-84) - ) - (cond - ((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 rvec) sv-84 (-> arg0 dynam gravity-normal)) - (vector+! arg2 arg2 sv-84) - ) - ((and (or (>= (fabs (-> arg0 trans x)) 16777216.0) (>= (fabs (-> arg0 trans z)) 16777216.0)) - (and (not (focus-test? (the-as process-focusable (-> arg0 process)) board)) (< 0.7 (-> arg0 surface-angle))) - ) - (vector-reflect-flat-above! arg2 (-> sv-88 rvec) sv-84) - ) - (else - (vector-reflect-flat! arg2 (-> sv-88 rvec) sv-84) - (vector+! arg2 arg2 sv-84) - ) - ) - (let ((f0-37 (-> arg0 current-surface slope-change-preserve))) - (when (< 0.0 f0-37) - (let ((v1-234 (new-stack-vector0))) - (let ((f1-28 (vector-dot (-> arg0 pre-collide-local-normal) (-> sv-88 rvec)))) - 0.0 - (vector-! v1-234 (-> sv-88 rvec) (vector-float*! v1-234 (-> arg0 pre-collide-local-normal) f1-28)) - ) - (let ((f1-29 (vector-length v1-234))) - f1-29 - (let ((f1-30 f1-29) - (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) + (vector-copy! (-> arg0 local-normal) sv-84) + ) + (cond + ((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 rvec) sv-84 (-> arg0 dynam gravity-normal)) + (vector+! arg2 arg2 sv-84) + ) + ((and (or (>= (fabs (-> arg0 trans x)) 16777216.0) (>= (fabs (-> arg0 trans z)) 16777216.0)) + (and (not (focus-test? (the-as process-focusable (-> arg0 process)) board)) (< 0.7 (-> arg0 surface-angle))) + ) + (vector-reflect-flat-above! arg2 (-> sv-88 rvec) sv-84) + ) + (else + (vector-reflect-flat! arg2 (-> sv-88 rvec) sv-84) + (vector+! arg2 arg2 sv-84) + ) + ) + (let ((f0-37 (-> arg0 current-surface slope-change-preserve))) + (when (< 0.0 f0-37) + (let ((v1-234 (new-stack-vector0))) + (let ((f1-28 (vector-dot (-> arg0 pre-collide-local-normal) (-> sv-88 rvec)))) + 0.0 + (vector-! v1-234 (-> sv-88 rvec) (vector-float*! v1-234 (-> arg0 pre-collide-local-normal) f1-28)) + ) + (let ((f1-29 (vector-length v1-234))) + f1-29 + (let ((f1-30 f1-29) + (f2-5 (vector-length arg2)) + ) + (if (and (< 409.6 (fabs (- f2-5 f1-30))) (< f2-5 f1-30)) + (vector-normalize! arg2 (lerp-scale f2-5 f1-30 f0-37 0.0 1.0)) + ) + ) + ) ) - (if (and (< 409.6 (fabs (- f2-5 f1-30))) (< f2-5 f1-30)) - (vector-normalize! arg2 (lerp-scale f2-5 f1-30 f0-37 0.0 1.0)) + ) + ) + (set! (-> arg0 ground-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)) + (vector-copy! (-> arg0 ground-poly-normal) (-> arg0 poly-normal)) + (vector-copy! (-> arg0 ground-contact-normal) sv-84) + (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 ground-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 ground-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))) - (vector-copy! (-> arg0 ground-poly-normal) (-> arg0 poly-normal)) - (vector-copy! (-> arg0 ground-contact-normal) sv-84) - (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 ground-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))) - ) + (when *debug-segment* + (+! (-> arg0 history-idx) 1) + (let ((v1-271 (clear-record-tags! *history* (history-channel surface-normal) (-> arg0 history-idx) (the-as uint 2))) + ) + (vector-copy! (-> v1-271 origin) (-> arg1 best-other-tri intersect)) + (vector-copy! (-> v1-271 vector) (-> arg0 surface-normal)) + ) + (let ((v1-274 (clear-record-tags! *history* (history-channel local-normal) (-> arg0 history-idx) (the-as uint 2)))) + (vector-copy! (-> v1-274 origin) (-> arg1 best-other-tri intersect)) + (vector-copy! (-> v1-274 vector) (-> arg0 local-normal)) + ) + (vector-copy! + (-> (clear-record-tags! *history* (history-channel intersect) (-> arg0 history-idx) (the-as uint 2)) vector) + (-> arg1 best-other-tri intersect) + ) + (let ((v1-280 (clear-record-tags! *history* (history-channel transv-out) (-> arg0 history-idx) (the-as uint 2)))) + (vector-copy! (-> v1-280 origin) (-> arg1 best-other-tri intersect)) + (vector-copy! (-> v1-280 vector) arg2) + ) + (let ((v1-283 (clear-record-tags! *history* (history-channel transv-in) (-> arg0 history-idx) (the-as uint 2)))) + (vector-copy! (-> v1-283 origin) (-> arg1 best-other-tri intersect)) + (vector-copy! (-> v1-283 vector) (-> sv-88 uvec)) + ) + (let ((v1-286 (clear-record-tags! *history* (history-channel transv) (-> arg0 history-idx) (the-as uint 2)))) + (vector-copy! (-> v1-286 origin) (-> arg0 trans)) + (vector-copy! (-> v1-286 vector) (-> arg0 transv)) + ) + (vector-copy! + (-> (clear-record-tags! *history* (history-channel trans) (-> arg0 history-idx) (the-as uint 2)) vector) + (-> arg0 trans) + ) + (let ((v1-292 (clear-record-tags! *history* (history-channel pat) (-> arg0 history-idx) (the-as uint 2)))) + (set! (-> v1-292 vector x) (the-as float (-> arg0 cur-pat))) + ) + (let ((v1-294 (clear-record-tags! *history* (history-channel collide-status) (-> arg0 history-idx) (the-as uint 2))) + ) + (set! (-> v1-294 collide-status) (-> arg0 status)) + (set! (-> v1-294 vector z) (the-as float (-> arg0 reaction-flag))) + ) ) + sv-96 ) ) - (logior! (-> arg0 status) sv-96) - (set! (-> arg0 reaction-flag) sv-104) - (when *debug-segment* - (+! (-> arg0 history-idx) 1) - (let ((v1-271 (clear-record-tags! *history* (history-channel surface-normal) (-> arg0 history-idx) (the-as uint 2))) - ) - (vector-copy! (-> v1-271 origin) (-> arg1 best-other-tri intersect)) - (vector-copy! (-> v1-271 vector) (-> arg0 surface-normal)) - ) - (let ((v1-274 (clear-record-tags! *history* (history-channel local-normal) (-> arg0 history-idx) (the-as uint 2)))) - (vector-copy! (-> v1-274 origin) (-> arg1 best-other-tri intersect)) - (vector-copy! (-> v1-274 vector) (-> arg0 local-normal)) - ) - (vector-copy! - (-> (clear-record-tags! *history* (history-channel intersect) (-> arg0 history-idx) (the-as uint 2)) vector) - (-> arg1 best-other-tri intersect) - ) - (let ((v1-280 (clear-record-tags! *history* (history-channel transv-out) (-> arg0 history-idx) (the-as uint 2)))) - (vector-copy! (-> v1-280 origin) (-> arg1 best-other-tri intersect)) - (vector-copy! (-> v1-280 vector) arg2) - ) - (let ((v1-283 (clear-record-tags! *history* (history-channel transv-in) (-> arg0 history-idx) (the-as uint 2)))) - (vector-copy! (-> v1-283 origin) (-> arg1 best-other-tri intersect)) - (vector-copy! (-> v1-283 vector) (-> sv-88 uvec)) - ) - (let ((v1-286 (clear-record-tags! *history* (history-channel transv) (-> arg0 history-idx) (the-as uint 2)))) - (vector-copy! (-> v1-286 origin) (-> arg0 trans)) - (vector-copy! (-> v1-286 vector) (-> arg0 transv)) - ) - (vector-copy! - (-> (clear-record-tags! *history* (history-channel trans) (-> arg0 history-idx) (the-as uint 2)) vector) - (-> arg0 trans) - ) - (let ((v1-292 (clear-record-tags! *history* (history-channel pat) (-> arg0 history-idx) (the-as uint 2)))) - (set! (-> v1-292 vector x) (the-as float (-> arg0 cur-pat))) - ) - (let ((v1-294 (clear-record-tags! *history* (history-channel collide-status) (-> arg0 history-idx) (the-as uint 2))) - ) - (set! (-> v1-294 collide-status) (-> arg0 status)) - (set! (-> v1-294 vector z) (the-as float (-> arg0 reaction-flag))) - ) - ) - sv-96 ) (defun target-collision-no-reaction ((arg0 control-info) (arg1 collide-query) (arg2 vector) (arg3 vector)) diff --git a/goal_src/jak3/engine/target/flut/flut-racer.gc b/goal_src/jak3/engine/target/flut/flut-racer.gc index 45d53f4554..2da8eba9ad 100644 --- a/goal_src/jak3/engine/target/flut/flut-racer.gc +++ b/goal_src/jak3/engine/target/flut/flut-racer.gc @@ -530,10 +530,8 @@ (when (and (!= *target* s2-1) (type? s2-1 civilian)) (let ((v1-25 (vector-! (new 'stack-no-clear 'vector) (-> s2-1 root trans) s5-1))) 0.0 - (let ((f0-10 (vector-length-squared v1-25)) - (f1-2 (-> s5-1 w)) - ) - (when (>= (* f1-2 f1-2) f0-10) + (let ((f0-10 (vector-length-squared v1-25))) + (when (>= (square (-> s5-1 w)) f0-10) (set! (-> this enemy-info attack-damage) 15) (send-attack-from-tshape this s2-1 (the-as touching-shapes-entry #f) (-> this attack-id)) (set! (-> this enemy-info attack-damage) 0) @@ -553,10 +551,8 @@ (when (and (!= *target* s4-2) (type? s4-2 civilian)) (let ((v1-39 (vector-! (new 'stack-no-clear 'vector) (-> s4-2 control trans) s5-1))) 0.0 - (let ((f0-13 (vector-length-squared v1-39)) - (f1-6 (-> s5-1 w)) - ) - (when (>= (* f1-6 f1-6) f0-13) + (let ((f0-13 (vector-length-squared v1-39))) + (when (>= (square (-> s5-1 w)) f0-13) (set! (-> this enemy-info attack-damage) 15) (send-attack-from-tshape this s4-2 (the-as touching-shapes-entry #f) (-> this attack-id)) (set! (-> this enemy-info attack-damage) 0) diff --git a/goal_src/jak3/engine/target/flut/target-flut.gc b/goal_src/jak3/engine/target/flut/target-flut.gc index 1b931e3888..c99d936401 100644 --- a/goal_src/jak3/engine/target/flut/target-flut.gc +++ b/goal_src/jak3/engine/target/flut/target-flut.gc @@ -378,7 +378,6 @@ ;; WARN: Return type mismatch int vs object. (defbehavior flut-update-ik target () - (local-vars (sv-720 vector)) (let ((gp-0 (new 'stack-no-clear 'collide-query)) (s5-0 (-> (the-as process-drawable (-> self parent 0)) root)) ) @@ -417,11 +416,9 @@ (-> s3-0 shoulder-matrix-no-ik) (let ((v1-17 (-> s3-0 elbow-matrix-no-ik)) (s0-0 (new 'stack-no-clear 'vector)) + (sv-720 (new 'stack-no-clear 'vector)) ) - (set! sv-720 (new 'stack-no-clear 'vector)) - (let ((a0-8 (-> *y-vector* quad))) - (set! (-> sv-720 quad) a0-8) - ) + (vector-copy! sv-720 *y-vector*) (let ((s2-0 (new 'stack-no-clear 'vector))) (new 'stack-no-clear 'vector) (new 'stack-no-clear 'vector) @@ -434,11 +431,7 @@ (seek! (-> s3-0 user-blend) f0-11 (* 4.0 (seconds-per-frame))) ) (vector+*! (-> gp-0 start-pos) s0-0 sv-720 6144.0) - (let ((v1-23 (-> gp-0 move-dist)) - (f0-16 -20480.0) - ) - (vector-float*! v1-23 sv-720 f0-16) - ) + (vector-float*! (-> gp-0 move-dist) sv-720 -20480.0) (let ((v1-25 gp-0)) (set! (-> v1-25 radius) 4.096) (set! (-> v1-25 collide-with) (-> gp-0 collide-with)) @@ -960,12 +953,6 @@ ) ) :code (behavior ((arg0 handle) (arg1 symbol) (arg2 int)) - (local-vars - (sv-96 process) - (sv-112 (function vector entity-actor skeleton-group vector manipy-options none :behavior manipy)) - (sv-128 vector) - (sv-144 entity-actor) - ) (target-exit) (+! (-> *game-info* flut-count) 1) (set-setting! 'string-spline-accel 'abs (meters 1) 0) @@ -1062,39 +1049,20 @@ (s2-0 (-> self level)) ) (process-entity-set! self (-> self flut entity)) - (let ((s1-0 (get-process *8k-dead-pool* manipy #x20000 1))) - (set! (-> self manipy) - (the-as - (pointer manipy) - (when s1-0 - (let ((t9-18 (method-of-type manipy activate))) - (t9-18 (the-as manipy s1-0) self "manipy" (the-as pointer #x70004000)) - ) - (let ((s0-0 run-function-in-process)) - (set! sv-96 s1-0) - (set! sv-112 manipy-init) - (set! sv-128 (-> self control trans)) - (set! sv-144 (-> self entity)) - (let ((t0-10 (art-group-get-by-name *level* "skel-flut" (the-as (pointer level) #f))) - (t1-10 'collide-shape-moving) - (t2-0 0) - ) - ((the-as (function object object object object object object object none) s0-0) - sv-96 - sv-112 - sv-128 - sv-144 - t0-10 - t1-10 - t2-0 - ) - ) - ) - (-> s1-0 ppointer) - ) - ) - ) - ) + (set! (-> self manipy) (process-spawn + manipy + :init manipy-init + (-> self control trans) + (-> self entity) + (art-group-get-by-name *level* "skel-flut" (the-as (pointer level) #f)) + 'collide-shape-moving + 0 + :name "manipy" + :from *8k-dead-pool* + :to self + :stack-size #x20000 + ) + ) (set! (-> self entity) s3-0) (set! (-> self level) s2-0) ) diff --git a/goal_src/jak3/engine/target/gun/gun-blue-shot.gc b/goal_src/jak3/engine/target/gun/gun-blue-shot.gc index 45dac81066..522f9a30f5 100644 --- a/goal_src/jak3/engine/target/gun/gun-blue-shot.gc +++ b/goal_src/jak3/engine/target/gun/gun-blue-shot.gc @@ -213,9 +213,7 @@ ((zero? v1-40) (let ((s5-1 (new 'stack-no-clear 'dist-dot-val))) (get-dist-and-dot (the-as gun-blue-shot arg0) s5-1) - (let* ((f0-4 (* 0.5 (+ 1.0 (-> s5-1 dot)))) - (f0-5 (* f0-4 f0-4)) - ) + (let ((f0-5 (square (* 0.5 (+ 1.0 (-> s5-1 dot)))))) (vector-normalize! (-> arg0 root transv) (lerp 122880.0 409600.0 f0-5)) ) ) @@ -269,8 +267,7 @@ ) ) (vector-copy! (-> arg0 root transv) (-> s3-0 current-dir-vec)) - (let* ((f0-26 (* 0.5 (+ 1.0 (-> s3-0 dot)))) - (f0-27 (* f0-26 f0-26)) + (let* ((f0-27 (square (* 0.5 (+ 1.0 (-> s3-0 dot))))) (f0-28 (lerp 122880.0 409600.0 f0-27)) ) (vector-normalize! (-> arg0 root transv) f0-28) @@ -446,80 +443,82 @@ ;; WARN: Return type mismatch (pointer process) vs object. (defbehavior gun-fire-blue-3 target () - (local-vars - (sv-144 gun-info) - (sv-148 projectile-init-by-other-params) - (sv-1280 vector) - (sv-1284 (inline-array target-quality-info)) - (sv-1288 int) - (sv-1296 float) - (sv-1300 object) - ) - (set! sv-144 (-> self gun)) - (set! sv-148 (new 'stack-no-clear 'projectile-init-by-other-params)) - (draw-beam (-> *part-id-table* 364) (-> sv-144 fire-point) (-> sv-144 fire-dir-out) #f) - (set! sv-1280 (new 'stack-no-clear 'vector)) - (set! sv-1284 (new 'stack-no-clear 'inline-array 'target-quality-info 384)) - (set! sv-1288 0) - (set! sv-1296 (the-as float 0.0)) - (set! sv-1300 (send-event *target* 'get-vehicle)) - (vector-copy! sv-1280 (-> sv-144 fire-point)) - (set! (-> sv-1280 w) 163840.0) - (let ((gp-0 (new 'stack-no-clear 'array 'collide-shape 384))) - (countdown (s5-0 (fill-actor-list-for-box *actor-hash* sv-1280 gp-0 384)) - (let ((v1-16 (as-type (-> gp-0 s5-0) collide-shape))) - (when v1-16 - (let ((s4-1 (as-type (-> v1-16 process) process-focusable))) - (when s4-1 - (when (and (!= *target* s4-1) - (!= sv-1300 s4-1) - (not (focus-test? (the-as process-focusable s4-1) disable dead inactive gun-no-target)) - (pc-check-focus-fix (the-as process-focusable s4-1)) ;; og:preserve-this - (or (logtest? (process-mask crate enemy vehicle civilian) (-> s4-1 mask)) - (and (logtest? (process-mask guard) (-> s4-1 mask)) (-> *setting-control* user-current gun-target-guards?)) - ) - ) - (let ((s3-1 (new 'stack-no-clear 'collide-query))) - (vector+float*! (-> s3-1 start-pos) (-> sv-144 fire-point) (-> sv-144 fire-dir-out) 40960.0) - (+! (-> s3-1 start-pos y) 24576.0) - (vector-! (-> s3-1 move-dist) (get-trans (the-as process-focusable s4-1) 3) (-> sv-144 fire-point)) - (let ((v1-32 s3-1)) - (set! (-> v1-32 radius) 40.96) - (set! (-> v1-32 collide-with) (collide-spec backgnd)) - (set! (-> v1-32 ignore-process0) #f) - (set! (-> v1-32 ignore-process1) #f) - (set! (-> v1-32 ignore-pat) - (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) - ) - (set! (-> v1-32 action-mask) (collide-action solid)) - ) - (when (< (fill-and-probe-using-line-sphere *collide-cache* s3-1) 0.0) - (let ((s3-3 - (vector-! (new 'stack-no-clear 'vector) (get-trans (the-as process-focusable s4-1) 3) (-> self control trans)) + (let ((sv-144 (-> self gun)) + (sv-148 (new 'stack-no-clear 'projectile-init-by-other-params)) + ) + (draw-beam (-> *part-id-table* 364) (-> sv-144 fire-point) (-> sv-144 fire-dir-out) #f) + (let ((sv-1280 (new 'stack-no-clear 'vector)) + (sv-1284 (new 'stack-no-clear 'inline-array 'target-quality-info 384)) + (sv-1288 0) + (sv-1296 (the-as float 0.0)) + ) + (let ((a1-1 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-1 from) (process->ppointer self)) + (set! (-> a1-1 num-params) 0) + (set! (-> a1-1 message) 'get-vehicle) + (let ((sv-1300 (send-event-function *target* a1-1))) + (vector-copy! sv-1280 (-> sv-144 fire-point)) + (set! (-> sv-1280 w) 163840.0) + (let ((gp-0 (new 'stack-no-clear 'array 'collide-shape 384))) + (countdown (s5-0 (fill-actor-list-for-box *actor-hash* sv-1280 gp-0 384)) + (let ((v1-16 (as-type (-> gp-0 s5-0) collide-shape))) + (when v1-16 + (let ((s4-1 (as-type (-> v1-16 process) process-focusable))) + (when s4-1 + (when (and (!= *target* s4-1) + (!= sv-1300 s4-1) + (not (focus-test? (the-as process-focusable s4-1) disable dead inactive gun-no-target)) + ;; og:preserve-this + (pc-check-focus-fix s4-1) + (or (logtest? (process-mask crate enemy vehicle civilian) (-> s4-1 mask)) + (and (logtest? (process-mask guard) (-> s4-1 mask)) (-> *setting-control* user-current gun-target-guards?)) + ) + ) + (let ((s3-1 (new 'stack-no-clear 'collide-query))) + (vector+float*! (-> s3-1 start-pos) (-> sv-144 fire-point) (-> sv-144 fire-dir-out) 40960.0) + (+! (-> s3-1 start-pos y) 24576.0) + (vector-! (-> s3-1 move-dist) (get-trans (the-as process-focusable s4-1) 3) (-> sv-144 fire-point)) + (let ((v1-32 s3-1)) + (set! (-> v1-32 radius) 40.96) + (set! (-> v1-32 collide-with) (collide-spec backgnd)) + (set! (-> v1-32 ignore-process0) #f) + (set! (-> v1-32 ignore-process1) #f) + (set! (-> v1-32 ignore-pat) + (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) + ) + (set! (-> v1-32 action-mask) (collide-action solid)) + ) + (when (< (fill-and-probe-using-line-sphere *collide-cache* s3-1) 0.0) + (let ((s3-3 + (vector-! (new 'stack-no-clear 'vector) (get-trans (the-as process-focusable s4-1) 3) (-> self control trans)) + ) + ) + (vector-normalize! s3-3 1.0) + (when (< (-> s3-3 y) 0.5) + (set! (-> sv-1284 sv-1288 targ) (process->handle s4-1)) + (let ((f30-0 1.0)) + (if (and (nonzero? (-> s4-1 draw)) (logtest? (-> s4-1 draw status) (draw-control-status on-screen))) + (set! f30-0 (+ 2.0 f30-0)) + ) + (if (< (vector-vector-xz-distance-squared (-> sv-144 fire-point) (get-trans (the-as process-focusable s4-1) 3)) + 2415919000.0 + ) + (set! f30-0 (+ 4.0 f30-0)) + ) + (if (logtest? (process-mask enemy guard) (-> s4-1 mask)) + (set! f30-0 (+ 28.0 f30-0)) + ) + (if (logtest? (process-mask vehicle civilian) (-> s4-1 mask)) + (set! f30-0 (/ f30-0 4)) + ) + (set! (-> sv-1284 sv-1288 value) f30-0) + (+! sv-1296 f30-0) + ) + (+! sv-1288 1) + ) + ) ) ) - (vector-normalize! s3-3 1.0) - (when (< (-> s3-3 y) 0.5) - (set! (-> sv-1284 sv-1288 targ) (process->handle s4-1)) - (let ((f30-0 1.0)) - (if (and (nonzero? (-> s4-1 draw)) (logtest? (-> s4-1 draw status) (draw-control-status on-screen))) - (set! f30-0 (+ 2.0 f30-0)) - ) - (if (< (vector-vector-xz-distance-squared (-> sv-144 fire-point) (get-trans (the-as process-focusable s4-1) 3)) - 2415919000.0 - ) - (set! f30-0 (+ 4.0 f30-0)) - ) - (if (logtest? (process-mask enemy guard) (-> s4-1 mask)) - (set! f30-0 (+ 28.0 f30-0)) - ) - (if (logtest? (process-mask vehicle civilian) (-> s4-1 mask)) - (set! f30-0 (/ f30-0 4)) - ) - (set! (-> sv-1284 sv-1288 value) f30-0) - (set! sv-1296 (+ sv-1296 f30-0)) - ) - (set! sv-1288 (+ sv-1288 1)) ) ) ) @@ -527,112 +526,112 @@ ) ) ) + ;; og:preserve-this *snip* there was dead code here! + ) + ) + (let* ((v1-132 (/ (the-as int (rand-uint31-gen *random-generator*)) 256)) + (v1-133 (the-as number (logior #x3f800000 v1-132))) + (f0-32 (* (+ -1.0 (the-as float v1-133)) sv-1296)) + (s5-7 (the-as process #f)) + ) + (let ((f1-11 0.0) + (gp-2 (new 'stack-no-clear 'vector)) + ) + (dotimes (v1-136 sv-1288) + (+! f1-11 (-> sv-1284 v1-136 value)) + (when (< f0-32 f1-11) + (set! s5-7 (handle->process (-> sv-1284 v1-136 targ))) + 0 + (goto cfg-91) + ) + ) + (label cfg-91) + (let ((s4-5 (new 'stack-no-clear 'vector))) + (let ((s3-5 s4-5)) + (let* ((f30-2 -1.0) + (f28-0 2.0) + (v1-148 (/ (the-as int (rand-uint31-gen *random-generator*)) 256)) + (v1-149 (the-as number (logior #x3f800000 v1-148))) + ) + (set! (-> s3-5 x) (+ f30-2 (* f28-0 (+ -1.0 (the-as float v1-149))))) + ) + (let* ((f30-3 -0.2) + (f28-1 0.7) + (v1-154 (/ (the-as int (rand-uint31-gen *random-generator*)) 256)) + (v1-155 (the-as number (logior #x3f800000 v1-154))) + ) + (set! (-> s3-5 y) (+ f30-3 (* f28-1 (+ -1.0 (the-as float v1-155))))) + ) + (let* ((f30-4 -1.0) + (f28-2 2.0) + (v1-160 (/ (the-as int (rand-uint31-gen *random-generator*)) 256)) + (v1-161 (the-as number (logior #x3f800000 v1-160))) + ) + (set! (-> s3-5 z) (+ f30-4 (* f28-2 (+ -1.0 (the-as float v1-161))))) + ) + (set! (-> s3-5 w) 1.0) + ) + (vector-normalize! s4-5 163840.0) + (vector+! gp-2 (-> sv-144 fire-point) s4-5) + ) + (let ((s4-6 (new 'stack-no-clear 'vector))) + (vector-copy! s4-6 gp-2) + (if s5-7 + (vector-copy! s4-6 (get-trans (the-as process-focusable (as-type s5-7 process-focusable)) 3)) + ) + (let ((s3-7 (vector-rotate-y! (new 'stack-no-clear 'vector) (-> sv-144 fire-dir-out) 2730.6667)) + (v1-174 (vector-rotate-y! (new 'stack-no-clear 'vector) (-> sv-144 fire-dir-out) -2730.6667)) + (a0-114 (vector-! (new 'stack-no-clear 'vector) s4-6 (-> sv-144 fire-point))) + (s4-7 (new 'stack-no-clear 'vector)) + ) + (if (< (vector-dot s3-7 a0-114) (vector-dot v1-174 a0-114)) + (vector-copy! s4-7 s3-7) + (vector-copy! s4-7 v1-174) + ) + (vector-normalize! a0-114 1.0) + (let* ((s3-8 vector-rotate-y!) + (s2-4 s4-7) + (s1-0 s4-7) + (f30-5 -2730.6667) + (f28-3 5461.3335) + (v1-180 (/ (the-as int (rand-uint31-gen *random-generator*)) 256)) + (v1-181 (the-as number (logior #x3f800000 v1-180))) + ) + (s3-8 s2-4 s1-0 (+ f30-5 (* f28-3 (+ -1.0 (the-as float v1-181))))) + ) + (let* ((f30-6 -0.1) + (f28-4 0.5) + (v1-186 (/ (the-as int (rand-uint31-gen *random-generator*)) 256)) + (v1-187 (the-as number (logior #x3f800000 v1-186))) + ) + (set! (-> s4-7 y) (+ f30-6 (* f28-4 (+ -1.0 (the-as float v1-187))) (-> s4-7 y))) + ) + (vector-normalize! s4-7 1.0) + (set! (-> sv-148 ent) (-> self entity)) + (set! (-> sv-148 charge) 1.0) + (set! (-> sv-148 options) (projectile-options)) + (logclear! (-> sv-148 options) (projectile-options po14 po15 po16)) + (vector-copy! (-> sv-148 pos) (-> sv-144 fire-point)) + (set! (-> sv-148 notify-handle) (the-as handle #f)) + (set! (-> sv-148 owner-handle) (the-as handle #f)) + (set! (-> sv-148 target-handle) (process->handle s5-7)) + (vector-copy! (-> sv-148 target-pos) gp-2) + (set! (-> sv-148 ignore-handle) (process->handle (send-event self 'get-vehicle))) + (let* ((v1-209 *game-info*) + (a0-143 (+ (-> v1-209 attack-id) 1)) + ) + (set! (-> v1-209 attack-id) a0-143) + (set! (-> sv-148 attack-id) a0-143) + ) + (set! (-> sv-148 timeout) (seconds 4)) + (vector-float*! (-> sv-148 vel) s4-7 327680.0) + ) + ) ) ) ) + (spawn-projectile gun-blue-shot-3 sv-148 (ppointer->process (-> sv-144 gun)) *default-dead-pool*) ) - ;; og:preserve-this *snip* there was dead code here! - (let* ((v1-132 (/ (the-as int (rand-uint31-gen *random-generator*)) 256)) - (v1-133 (the-as number (logior #x3f800000 v1-132))) - (f0-32 (* (+ -1.0 (the-as float v1-133)) sv-1296)) - (s5-7 (the-as process #f)) - ) - (let ((f1-11 0.0) - (gp-2 (new 'stack-no-clear 'vector)) - ) - (dotimes (v1-136 sv-1288) - (+! f1-11 (-> sv-1284 v1-136 value)) - (when (< f0-32 f1-11) - (set! s5-7 (handle->process (-> sv-1284 v1-136 targ))) - 0 - (goto cfg-91) - ) - ) - (label cfg-91) - (let ((s4-5 (new 'stack-no-clear 'vector))) - (let ((s3-5 s4-5)) - (let* ((f30-2 -1.0) - (f28-0 2.0) - (v1-148 (/ (the-as int (rand-uint31-gen *random-generator*)) 256)) - (v1-149 (the-as number (logior #x3f800000 v1-148))) - ) - (set! (-> s3-5 x) (+ f30-2 (* f28-0 (+ -1.0 (the-as float v1-149))))) - ) - (let* ((f30-3 -0.2) - (f28-1 0.7) - (v1-154 (/ (the-as int (rand-uint31-gen *random-generator*)) 256)) - (v1-155 (the-as number (logior #x3f800000 v1-154))) - ) - (set! (-> s3-5 y) (+ f30-3 (* f28-1 (+ -1.0 (the-as float v1-155))))) - ) - (let* ((f30-4 -1.0) - (f28-2 2.0) - (v1-160 (/ (the-as int (rand-uint31-gen *random-generator*)) 256)) - (v1-161 (the-as number (logior #x3f800000 v1-160))) - ) - (set! (-> s3-5 z) (+ f30-4 (* f28-2 (+ -1.0 (the-as float v1-161))))) - ) - (set! (-> s3-5 w) 1.0) - ) - (vector-normalize! s4-5 163840.0) - (vector+! gp-2 (-> sv-144 fire-point) s4-5) - ) - (let ((s4-6 (new 'stack-no-clear 'vector))) - (vector-copy! s4-6 gp-2) - (if s5-7 - (vector-copy! s4-6 (get-trans (the-as process-focusable (as-type s5-7 process-focusable)) 3)) - ) - (let ((s3-7 (vector-rotate-y! (new 'stack-no-clear 'vector) (-> sv-144 fire-dir-out) 2730.6667)) - (v1-174 (vector-rotate-y! (new 'stack-no-clear 'vector) (-> sv-144 fire-dir-out) -2730.6667)) - (a0-114 (vector-! (new 'stack-no-clear 'vector) s4-6 (-> sv-144 fire-point))) - (s4-7 (new 'stack-no-clear 'vector)) - ) - (if (< (vector-dot s3-7 a0-114) (vector-dot v1-174 a0-114)) - (vector-copy! s4-7 s3-7) - (vector-copy! s4-7 v1-174) - ) - (vector-normalize! a0-114 1.0) - (let* ((s3-8 vector-rotate-y!) - (s2-4 s4-7) - (s1-0 s4-7) - (f30-5 -2730.6667) - (f28-3 5461.3335) - (v1-180 (/ (the-as int (rand-uint31-gen *random-generator*)) 256)) - (v1-181 (the-as number (logior #x3f800000 v1-180))) - ) - (s3-8 s2-4 s1-0 (+ f30-5 (* f28-3 (+ -1.0 (the-as float v1-181))))) - ) - (let* ((f30-6 -0.1) - (f28-4 0.5) - (v1-186 (/ (the-as int (rand-uint31-gen *random-generator*)) 256)) - (v1-187 (the-as number (logior #x3f800000 v1-186))) - ) - (set! (-> s4-7 y) (+ f30-6 (* f28-4 (+ -1.0 (the-as float v1-187))) (-> s4-7 y))) - ) - (vector-normalize! s4-7 1.0) - (set! (-> sv-148 ent) (-> self entity)) - (set! (-> sv-148 charge) 1.0) - (set! (-> sv-148 options) (projectile-options)) - (logclear! (-> sv-148 options) (projectile-options po14 po15 po16)) - (vector-copy! (-> sv-148 pos) (-> sv-144 fire-point)) - (set! (-> sv-148 notify-handle) (the-as handle #f)) - (set! (-> sv-148 owner-handle) (the-as handle #f)) - (set! (-> sv-148 target-handle) (process->handle s5-7)) - (vector-copy! (-> sv-148 target-pos) gp-2) - (set! (-> sv-148 ignore-handle) (process->handle (send-event self 'get-vehicle))) - (let* ((v1-209 *game-info*) - (a0-143 (+ (-> v1-209 attack-id) 1)) - ) - (set! (-> v1-209 attack-id) a0-143) - (set! (-> sv-148 attack-id) a0-143) - ) - (set! (-> sv-148 timeout) (seconds 4)) - (vector-float*! (-> sv-148 vel) s4-7 327680.0) - ) - ) - ) - ) - (spawn-projectile gun-blue-shot-3 sv-148 (ppointer->process (-> sv-144 gun)) *default-dead-pool*) ) (defun draw-beam-segment () @@ -795,7 +794,6 @@ (defmethod rope-constraint-method-9 ((this rope-constraint) (arg0 int)) - (local-vars (sv-64 vector) (sv-80 vector) (sv-96 vector)) (rlet ((acc :class vf) (vf0 :class vf) (vf1 :class vf) @@ -811,11 +809,11 @@ ) (while (>= (the-as int s3-0) s4-0) (dotimes (s2-0 1) - (set! sv-64 (the-as vector (+ (the-as uint (-> this constraints 0 dir)) (* 48 s4-0)))) - (let ((s1-0 (-> this constraints s4-0)) + (let ((sv-64 (the-as vector (+ (the-as uint (-> this constraints 0 dir)) (* 48 s4-0)))) + (s1-0 (-> this constraints s4-0)) (s0-0 (-> this constraints (+ s4-0 1))) + (sv-96 (new 'stack-no-clear 'vector)) ) - (set! sv-96 (new 'stack-no-clear 'vector)) (let ((v1-6 s0-0) (a0-7 s1-0) ) @@ -830,29 +828,29 @@ (vector-normalize! sv-64 1.0) (let ((f0-2 (vector-dot sv-96 sv-64))) (when (< f0-2 0.9999) - (set! sv-80 (new 'stack-no-clear 'vector)) - 0.0 - (let* ((f28-0 (acos f0-2)) - (f0-4 (/ f28-0 (meters 8))) - ) + (let ((sv-80 (new 'stack-no-clear 'vector))) 0.0 - 0.0 - (- 32768.0 f28-0) - (let* ((f0-6 (fmax 0.0 (fmin 1.0 f0-4))) - (f0-7 (* f0-6 f0-6)) - (f28-1 - (fmin (fmin f28-0 (* (lerp 5461.3335 2184533.2 f0-7) (seconds-per-frame))) (* 131072.0 (seconds-per-frame))) - ) + (let* ((f28-0 (acos f0-2)) + (f0-4 (/ f28-0 (meters 8))) ) - (let ((v1-20 sv-80)) - (.lvf vf1 (&-> sv-96 quad)) - (.lvf vf2 (&-> sv-64 quad)) - (.outer.product.a.vf acc vf1 vf2) - (.outer.product.b.vf vf3 vf2 vf1 acc) - (.svf (&-> v1-20 quad) vf3) + 0.0 + 0.0 + (- 32768.0 f28-0) + (let* ((f0-7 (square (fmax 0.0 (fmin 1.0 f0-4)))) + (f28-1 + (fmin (fmin f28-0 (* (lerp 5461.3335 2184533.2 f0-7) (seconds-per-frame))) (* 131072.0 (seconds-per-frame))) + ) + ) + (let ((v1-20 sv-80)) + (.lvf vf1 (&-> sv-96 quad)) + (.lvf vf2 (&-> sv-64 quad)) + (.outer.product.a.vf acc vf1 vf2) + (.outer.product.b.vf vf3 vf2 vf1 acc) + (.svf (&-> v1-20 quad) vf3) + ) + (vector-normalize! sv-80 1.0) + (vector-rotate-around-axis! sv-96 sv-96 f28-1 sv-80) ) - (vector-normalize! sv-80 1.0) - (vector-rotate-around-axis! sv-96 sv-96 f28-1 sv-80) ) ) (vector-normalize! sv-96 1.0) @@ -1566,7 +1564,8 @@ (set! (-> a1-1 message) 'get-vehicle) (and (!= (send-event-function *target* a1-1) arg0) (not (focus-test? arg0 disable dead inactive gun-no-target)) - (pc-check-focus-fix arg0) ;; og:preserve-this + ;; og:preserve-this + (pc-check-focus-fix arg0) (or (logtest? (process-mask enemy vehicle civilian) (-> arg0 mask)) (and (logtest? (process-mask guard) (-> arg0 mask)) (-> *setting-control* user-current gun-target-guards?)) ) @@ -1588,78 +1587,28 @@ ) (defun find-gun-blue-2-target ((arg0 vector) (arg1 int)) - (local-vars (sv-32 process-drawable) (sv-36 number) (sv-40 vector)) - (set! sv-32 (the-as process-drawable #f)) - (set! sv-36 4096000.0) - (let ((v1-1 (new 'stack-no-clear 'vector))) - (vector-copy! v1-1 arg0) - (set! sv-40 v1-1) - ) - (set! (-> sv-40 w) 0.0) - (let ((s4-0 (new 'stack-no-clear 'array 'collide-shape 384))) - (countdown (s3-0 (fill-actor-list-for-box *actor-hash* arg0 s4-0 384)) - (let ((a0-5 (as-type (-> s4-0 s3-0) collide-shape))) - (when a0-5 - (let ((s2-1 (as-type (-> a0-5 process) process-focusable))) - (when s2-1 - (when (is-valid-blue-2-target (the-as process-focusable s2-1) arg1) - (let* ((s1-2 (vector-! (new 'stack-no-clear 'vector) (get-trans (the-as process-focusable s2-1) 3) sv-40)) - (f0-2 (vector-normalize-ret-len! s1-2 1.0)) - ) - (when (< f0-2 (the-as float sv-36)) - (set! sv-32 s2-1) - (set! sv-36 f0-2) - ) - ) - ) - ) - ) + (let ((sv-32 (the-as process-drawable #f))) + (let ((sv-36 4096000.0) + (v1-1 (new 'stack-no-clear 'vector)) ) - ) - ) - ) - (let ((s4-1 (the-as target (as-type *target* process-focusable)))) - (when (and s4-1 (< (vector-vector-distance (get-trans s4-1 0) arg0) (-> arg0 w))) - (when (is-valid-blue-2-target s4-1 arg1) - (let* ((gp-2 (vector-! (new 'stack-no-clear 'vector) (get-trans s4-1 3) sv-40)) - (f0-4 (vector-normalize-ret-len! gp-2 1.0)) - ) - (when (< f0-4 (the-as float sv-36)) - (set! sv-32 s4-1) - (set! sv-36 f0-4) - ) - ) - ) - ) - ) - sv-32 - ) - -(defun find-gun-blue-2-target-old ((arg0 vector) (arg1 int) (arg2 vector)) - (local-vars (sv-32 process-drawable) (sv-36 number) (sv-40 vector)) - (set! sv-32 (the-as process-drawable #f)) - (set! sv-36 16384.0) - (let ((v1-1 (new 'stack-no-clear 'vector))) - (vector-copy! v1-1 arg0) - (set! sv-40 v1-1) - ) - (set! (-> arg0 w) 16384.0) - (set! (-> sv-40 w) 1.0) - (let ((s3-0 (new 'stack-no-clear 'array 'collide-shape 384))) - (countdown (s2-0 (fill-actor-list-for-box *actor-hash* arg0 s3-0 384)) - (let ((a0-5 (as-type (-> s3-0 s2-0) collide-shape))) - (when a0-5 - (let ((s1-1 (as-type (-> a0-5 process) process-focusable))) - (when s1-1 - (when (is-valid-blue-2-target (the-as process-focusable s1-1) arg1) - (let* ((s0-2 (vector-! (new 'stack-no-clear 'vector) (get-trans (the-as process-focusable s1-1) 3) sv-40)) - (f0-3 (vector-normalize-ret-len! s0-2 1.0)) - (f1-1 (vector-dot s0-2 arg2)) - ) - (when (< f0-3 (the-as float sv-36)) - (when (< 0.6 f1-1) - (set! sv-32 s1-1) - (set! sv-36 f0-3) + (vector-copy! v1-1 arg0) + (let ((sv-40 v1-1)) + (set! (-> sv-40 w) 0.0) + (let ((s4-0 (new 'stack-no-clear 'array 'collide-shape 384))) + (countdown (s3-0 (fill-actor-list-for-box *actor-hash* arg0 s4-0 384)) + (let ((a0-5 (as-type (-> s4-0 s3-0) collide-shape))) + (when a0-5 + (let ((s2-1 (as-type (-> a0-5 process) process-focusable))) + (when s2-1 + (when (is-valid-blue-2-target (the-as process-focusable s2-1) arg1) + (let* ((s1-2 (vector-! (new 'stack-no-clear 'vector) (get-trans (the-as process-focusable s2-1) 3) sv-40)) + (f0-2 (vector-normalize-ret-len! s1-2 1.0)) + ) + (when (< f0-2 (the-as float sv-36)) + (set! sv-32 s2-1) + (set! sv-36 f0-2) + ) + ) ) ) ) @@ -1667,27 +1616,81 @@ ) ) ) - ) - ) - ) - (let ((s3-1 (the-as target (as-type *target* process-focusable)))) - (when (and s3-1 (< (vector-vector-distance (get-trans s3-1 0) arg0) (-> arg0 w))) - (when (is-valid-blue-2-target s3-1 arg1) - (let* ((s5-2 (vector-! (new 'stack-no-clear 'vector) (get-trans s3-1 3) sv-40)) - (f0-5 (vector-normalize-ret-len! s5-2 1.0)) - (f1-4 (vector-dot s5-2 arg2)) - ) - (when (< f0-5 (the-as float sv-36)) - (when (< 0.6 f1-4) - (set! sv-32 s3-1) - (set! sv-36 f0-5) + (let ((s4-1 (the-as target (as-type *target* process-focusable)))) + (when (and s4-1 (< (vector-vector-distance (get-trans s4-1 0) arg0) (-> arg0 w))) + (when (is-valid-blue-2-target s4-1 arg1) + (let* ((gp-2 (vector-! (new 'stack-no-clear 'vector) (get-trans s4-1 3) sv-40)) + (f0-4 (vector-normalize-ret-len! gp-2 1.0)) + ) + (when (< f0-4 (the-as float sv-36)) + (set! sv-32 s4-1) + (set! sv-36 f0-4) + ) + ) ) ) ) ) ) + sv-32 + ) + ) + +(defun find-gun-blue-2-target-old ((arg0 vector) (arg1 int) (arg2 vector)) + (let ((sv-32 (the-as process-drawable #f))) + (let ((sv-36 16384.0) + (v1-1 (new 'stack-no-clear 'vector)) + ) + (vector-copy! v1-1 arg0) + (let ((sv-40 v1-1)) + (set! (-> arg0 w) 16384.0) + (set! (-> sv-40 w) 1.0) + (let ((s3-0 (new 'stack-no-clear 'array 'collide-shape 384))) + (countdown (s2-0 (fill-actor-list-for-box *actor-hash* arg0 s3-0 384)) + (let ((a0-5 (as-type (-> s3-0 s2-0) collide-shape))) + (when a0-5 + (let ((s1-1 (as-type (-> a0-5 process) process-focusable))) + (when s1-1 + (when (is-valid-blue-2-target (the-as process-focusable s1-1) arg1) + (let* ((s0-2 (vector-! (new 'stack-no-clear 'vector) (get-trans (the-as process-focusable s1-1) 3) sv-40)) + (f0-3 (vector-normalize-ret-len! s0-2 1.0)) + (f1-1 (vector-dot s0-2 arg2)) + ) + (when (< f0-3 (the-as float sv-36)) + (when (< 0.6 f1-1) + (set! sv-32 s1-1) + (set! sv-36 f0-3) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + (let ((s3-1 (the-as target (as-type *target* process-focusable)))) + (when (and s3-1 (< (vector-vector-distance (get-trans s3-1 0) arg0) (-> arg0 w))) + (when (is-valid-blue-2-target s3-1 arg1) + (let* ((s5-2 (vector-! (new 'stack-no-clear 'vector) (get-trans s3-1 3) sv-40)) + (f0-5 (vector-normalize-ret-len! s5-2 1.0)) + (f1-4 (vector-dot s5-2 arg2)) + ) + (when (< f0-5 (the-as float sv-36)) + (when (< 0.6 f1-4) + (set! sv-32 s3-1) + (set! sv-36 f0-5) + ) + ) + ) + ) + ) + ) + ) + ) + sv-32 ) - sv-32 ) (define *lightning-pts-cache* (new 'static 'inline-array vector 20 @@ -1762,17 +1765,6 @@ ) (defmethod gun-blue-2-lightning-tracker-method-25 ((this gun-blue-2-lightning-tracker)) - (local-vars - (sv-624 gun-info) - (sv-628 vector) - (sv-632 gun-blue-lightning-command) - (sv-640 int) - (sv-648 int) - (sv-656 (pointer int32)) - (sv-1440 symbol) - (sv-1456 collide-query) - (sv-1472 collide-query) - ) (let ((s5-1 (vector-! (new 'stack-no-clear 'vector) (target-pos 0) (-> this prev-targ-pos)))) (set! (-> s5-1 y) 0.0) (dotimes (v1-1 12) @@ -1784,169 +1776,176 @@ ) ) (vector-copy! (-> this prev-targ-pos) (target-pos 0)) - (set! sv-624 (-> *target* gun)) - (set! sv-628 (-> *target* gun laser-dir)) - (set! sv-632 (new 'stack-no-clear 'gun-blue-lightning-command)) - (set! sv-640 0) - (set! sv-648 -1) - (set! sv-656 (new 'static 'array int32 12 0 0 0 0 0 0 0 0 0 0 0 0)) - (vector-normalize! sv-628 1.0) - (set! (-> *blue-2-lightning-shape* constraints 0 pt quad) (-> sv-624 fire-point quad)) - (vector-copy! (-> *blue-2-lightning-shape* constraints 0 dir) sv-628) - (rope-constraint-method-9 *blue-2-lightning-shape* 0) - (if (zero? (-> this last-probe-index)) - (+! (-> this last-probe-index) 1) - ) - (dotimes (v1-22 12) - (vector-copy! (-> *lightning-pts-cache* v1-22) (-> *blue-2-lightning-shape* constraints v1-22 pt)) - ) - (if (not (gun-blue-2-lightning-tracker-method-26 this sv-628 (-> sv-624 fire-point) sv-632)) - (return 0) - ) - (set! (-> sv-632 msg) (gun-blue-lightning-cmd-msg active)) - (set! (-> sv-632 lightning-info num-pts) 1) - (set! (-> sv-632 lightning-info should-draw-terminal-sparks?) #f) - (set! (-> sv-632 lightning-info should-draw-extension?) #f) - (let ((s5-3 1) - (s4-0 (+ (-> *blue-2-lightning-shape* num-knots) -1)) + (let ((sv-624 (-> *target* gun)) + (sv-628 (-> *target* gun laser-dir)) + (sv-632 (new 'stack-no-clear 'gun-blue-lightning-command)) ) - (while (>= (the-as int s4-0) s5-3) - (let ((s3-0 (new 'stack-no-clear 'vector))) - (vector-copy! s3-0 (-> *lightning-pts-cache* s5-3)) - (let ((s2-0 (the-as process-drawable #f))) - (let ((a0-19 (new 'stack-no-clear 'vector))) - (new 'stack-no-clear 'vector) - (vector-copy! a0-19 s3-0) - (set! (-> a0-19 w) 12288.0) - (if (not (the-as symbol s2-0)) - (set! s2-0 (find-gun-blue-2-target-old - a0-19 - sv-640 - (the-as vector (+ (the-as uint (-> *blue-2-lightning-shape* constraints 0 dir)) (* 48 s5-3))) - ) + (let ((sv-640 0) + (sv-648 -1) + (sv-656 (new 'static 'array int32 12 0 0 0 0 0 0 0 0 0 0 0 0)) + ) + (vector-normalize! sv-628 1.0) + (set! (-> *blue-2-lightning-shape* constraints 0 pt quad) (-> sv-624 fire-point quad)) + (vector-copy! (-> *blue-2-lightning-shape* constraints 0 dir) sv-628) + (rope-constraint-method-9 *blue-2-lightning-shape* 0) + (if (zero? (-> this last-probe-index)) + (+! (-> this last-probe-index) 1) + ) + (dotimes (v1-22 12) + (vector-copy! (-> *lightning-pts-cache* v1-22) (-> *blue-2-lightning-shape* constraints v1-22 pt)) + ) + (if (not (gun-blue-2-lightning-tracker-method-26 this sv-628 (-> sv-624 fire-point) sv-632)) + (return 0) + ) + (set! (-> sv-632 msg) (gun-blue-lightning-cmd-msg active)) + (set! (-> sv-632 lightning-info num-pts) 1) + (set! (-> sv-632 lightning-info should-draw-terminal-sparks?) #f) + (set! (-> sv-632 lightning-info should-draw-extension?) #f) + (let ((s5-3 1) + (s4-0 (+ (-> *blue-2-lightning-shape* num-knots) -1)) + ) + (while (>= (the-as int s4-0) s5-3) + (let ((s3-0 (new 'stack-no-clear 'vector))) + (vector-copy! s3-0 (-> *lightning-pts-cache* s5-3)) + (let ((s2-0 (the-as process-drawable #f))) + (let ((a0-19 (new 'stack-no-clear 'vector))) + (new 'stack-no-clear 'vector) + (vector-copy! a0-19 s3-0) + (set! (-> a0-19 w) 12288.0) + (if (not (the-as symbol s2-0)) + (set! s2-0 (find-gun-blue-2-target-old + a0-19 + sv-640 + (the-as vector (+ (the-as uint (-> *blue-2-lightning-shape* constraints 0 dir)) (* 48 s5-3))) + ) + ) + ) + ) + (cond + (s2-0 + (set! (-> *found-objects* sv-640) (process->handle s2-0)) + (set! (-> *gun-blue-2-targets* s5-3 target) (process->handle s2-0)) + (set! (-> sv-656 s5-3) 1) + (+! sv-640 1) + (set! sv-648 s5-3) + (vector-copy! s3-0 (get-trans (the-as process-focusable s2-0) 3)) + (vector-copy! (-> *lightning-pts-cache* s5-3) s3-0) + (vector-! + (the-as vector (+ (the-as uint (-> *blue-2-lightning-shape* constraints 0 dir)) (* 48 s5-3))) + (-> *lightning-pts-cache* s5-3) + (-> *blue-2-lightning-shape* constraints (+ s5-3 -1) pt) + ) + (vector-normalize! + (the-as vector (+ (the-as uint (-> *blue-2-lightning-shape* constraints 0 dir)) (* 48 s5-3))) + 1.0 + ) + (dotimes (v1-65 1) + ) + ) + (else + (set! (-> sv-656 s5-3) 0) + 0 + ) + ) + (let ((s0-0 s3-0) + (s1-1 (new 'stack-no-clear 'vector)) + ) + (vector-copy! s1-1 (-> *lightning-pts-cache* (+ s5-3 -1))) + (let ((sv-1440 (the-as symbol #f))) + (let ((sv-1456 (new 'stack-no-clear 'collide-query))) + (vector-copy! (-> sv-1456 start-pos) s1-1) + (vector-! (-> sv-1456 move-dist) s0-0 s1-1) + (let ((sv-1472 sv-1456)) + (set! (-> sv-1472 radius) 860.16) + (set! (-> sv-1472 collide-with) + (collide-spec backgnd obstacle vehicle-sphere hit-by-others-list pusher impenetrable-obj) + ) + (set! (-> sv-1472 ignore-process0) (the-as process-tree (send-event *target* 'get-vehicle))) + (set! (-> sv-1472 ignore-process1) #f) + (set! (-> sv-1472 ignore-pat) + (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) + ) + (set! (-> sv-1472 action-mask) (collide-action solid)) ) - ) - ) - (cond - (s2-0 - (set! (-> *found-objects* sv-640) (process->handle s2-0)) - (set! (-> *gun-blue-2-targets* s5-3 target) (process->handle s2-0)) - (set! (-> sv-656 s5-3) 1) - (set! sv-640 (+ sv-640 1)) - (set! sv-648 s5-3) - (vector-copy! s3-0 (get-trans (the-as process-focusable s2-0) 3)) - (vector-copy! (-> *lightning-pts-cache* s5-3) s3-0) - (vector-! - (the-as vector (+ (the-as uint (-> *blue-2-lightning-shape* constraints 0 dir)) (* 48 s5-3))) - (-> *lightning-pts-cache* s5-3) - (-> *blue-2-lightning-shape* constraints (+ s5-3 -1) pt) - ) - (vector-normalize! - (the-as vector (+ (the-as uint (-> *blue-2-lightning-shape* constraints 0 dir)) (* 48 s5-3))) - 1.0 - ) - (dotimes (v1-65 1) - ) - ) - (else - (set! (-> sv-656 s5-3) 0) - 0 - ) - ) - (let ((s0-0 s3-0) - (s1-1 (new 'stack-no-clear 'vector)) - ) - (vector-copy! s1-1 (-> *lightning-pts-cache* (+ s5-3 -1))) - (set! sv-1440 (the-as symbol #f)) - (set! sv-1456 (new 'stack-no-clear 'collide-query)) - (vector-copy! (-> sv-1456 start-pos) s1-1) - (vector-! (-> sv-1456 move-dist) s0-0 s1-1) - (set! sv-1472 sv-1456) - (set! (-> sv-1472 radius) 860.16) - (set! (-> sv-1472 collide-with) - (collide-spec backgnd obstacle vehicle-sphere hit-by-others-list pusher impenetrable-obj) - ) - (set! (-> sv-1472 ignore-process0) (the-as process-tree (send-event *target* 'get-vehicle))) - (set! (-> sv-1472 ignore-process1) #f) - (set! (-> sv-1472 ignore-pat) - (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) - ) - (set! (-> sv-1472 action-mask) (collide-action solid)) - (let ((f0-3 (fill-and-probe-using-line-sphere *collide-cache* sv-1456))) - (when (>= f0-3 0.0) - (vector-float*! (-> sv-1456 move-dist) (-> sv-1456 move-dist) f0-3) - (vector+! s0-0 s1-1 (-> sv-1456 move-dist)) - (set! sv-1440 #t) - (set! (-> this last-probe-index) s5-3) - (cond - ((> s5-3 0) - (let ((v0-11 (vector-normalize-copy! (new 'stack-no-clear 'vector) (-> sv-1456 move-dist) 1.0))) - (vector+float*! (-> sv-632 lightning-info terminal-spark-pos) s0-0 v0-11 -6144.0) - ) - ) - (else - (vector-copy! (-> sv-632 lightning-info terminal-spark-pos) s0-0) + (let ((f0-3 (fill-and-probe-using-line-sphere *collide-cache* sv-1456))) + (when (>= f0-3 0.0) + (vector-float*! (-> sv-1456 move-dist) (-> sv-1456 move-dist) f0-3) + (vector+! s0-0 s1-1 (-> sv-1456 move-dist)) + (set! sv-1440 #t) + (set! (-> this last-probe-index) s5-3) + (cond + ((> s5-3 0) + (let ((v0-11 (vector-normalize-copy! (new 'stack-no-clear 'vector) (-> sv-1456 move-dist) 1.0))) + (vector+float*! (-> sv-632 lightning-info terminal-spark-pos) s0-0 v0-11 -6144.0) + ) + ) + (else + (vector-copy! (-> sv-632 lightning-info terminal-spark-pos) s0-0) + ) + ) + ) + ) + ) + (when (not s2-0) + ) + (vector-copy! (-> *lightning-pts-cache* s5-3) s3-0) + (+! (-> sv-632 lightning-info num-pts) 1) + (let ((s3-1 fire-projectile-if-necessary) + (a2-13 (if (< 1 sv-640) + (the-as int (-> *found-objects* (+ sv-640 -2))) + (process->handle (send-event this 'get-vehicle)) + ) + ) + ) + (s3-1 s1-1 s0-0 (the-as handle a2-13)) + ) + (when sv-1440 + (set! (-> sv-632 lightning-info should-draw-terminal-sparks?) #t) + (set! (-> sv-632 lightning-info should-draw-extension?) #f) + 0 + (goto cfg-54) ) ) ) ) - (when (not s2-0) - ) - (vector-copy! (-> *lightning-pts-cache* s5-3) s3-0) - (+! (-> sv-632 lightning-info num-pts) 1) - (let ((s3-1 fire-projectile-if-necessary) - (a2-13 (if (< 1 sv-640) - (the-as int (-> *found-objects* (+ sv-640 -2))) - (process->handle (send-event this 'get-vehicle)) - ) - ) + ) + (+! s5-3 1) + ) + ) + (label cfg-54) + (if (and (= sv-648 (+ (-> sv-632 lightning-info num-pts) -2)) + (not (-> sv-632 lightning-info should-draw-extension?)) + ) + (set! (-> sv-632 lightning-info should-draw-terminal-sparks?) #f) + ) + (dotimes (s5-4 (-> sv-632 lightning-info num-pts)) + (vector-copy! (-> sv-632 lightning-info pts s5-4) (-> *lightning-pts-cache* s5-4)) + (when (and (> s5-4 0) (zero? (-> sv-656 s5-4))) + (let ((s4-1 + (matrix-f-u-compose + (new 'stack-no-clear 'matrix) + (the-as vector (+ (the-as uint (-> *blue-2-lightning-shape* constraints 0 dir)) (* 48 s5-4))) + *up-vector* + ) ) - (s3-1 s1-1 s0-0 (the-as handle a2-13)) - ) - ) - ) - ) - (when sv-1440 - (set! (-> sv-632 lightning-info should-draw-terminal-sparks?) #t) - (set! (-> sv-632 lightning-info should-draw-extension?) #f) - 0 - (goto cfg-54) - ) - (+! s5-3 1) - ) - ) - (label cfg-54) - (if (and (= sv-648 (+ (-> sv-632 lightning-info num-pts) -2)) - (not (-> sv-632 lightning-info should-draw-extension?)) - ) - (set! (-> sv-632 lightning-info should-draw-terminal-sparks?) #f) - ) - (dotimes (s5-4 (-> sv-632 lightning-info num-pts)) - (vector-copy! (-> sv-632 lightning-info pts s5-4) (-> *lightning-pts-cache* s5-4)) - (when (and (> s5-4 0) (zero? (-> sv-656 s5-4))) - (let ((s4-1 - (matrix-f-u-compose - (new 'stack-no-clear 'matrix) - (the-as vector (+ (the-as uint (-> *blue-2-lightning-shape* constraints 0 dir)) (* 48 s5-4))) - *up-vector* + (f0-9 (the float (sar (shl (the int (+ (-> this revolve-angle) (* 6144.0 (the float s5-4)))) 48) 48))) + (s3-2 (-> sv-632 lightning-info pts s5-4)) ) + (the float (sar (shl (the int (+ (-> this sway-angle) (* 5461.3335 (the float s5-4)))) 48) 48)) + (vector-rotate-around-axis! + (-> s4-1 uvec) + (-> s4-1 uvec) + f0-9 + (the-as vector (+ (the-as uint (-> *blue-2-lightning-shape* constraints 0 dir)) (* 48 s5-4))) ) - (f0-9 (the float (sar (shl (the int (+ (-> this revolve-angle) (* 6144.0 (the float s5-4)))) 48) 48))) - (s3-2 (-> sv-632 lightning-info pts s5-4)) + (vector-normalize! (-> s4-1 uvec) 1.0) + (vector+float*! s3-2 s3-2 (-> s4-1 uvec) 2048.0) ) - (the float (sar (shl (the int (+ (-> this sway-angle) (* 5461.3335 (the float s5-4)))) 48) 48)) - (vector-rotate-around-axis! - (-> s4-1 uvec) - (-> s4-1 uvec) - f0-9 - (the-as vector (+ (the-as uint (-> *blue-2-lightning-shape* constraints 0 dir)) (* 48 s5-4))) ) - (vector-normalize! (-> s4-1 uvec) 1.0) - (vector+float*! s3-2 s3-2 (-> s4-1 uvec) 2048.0) ) ) + (setup-draw! this (-> sv-632 lightning-info)) ) - (setup-draw! this (-> sv-632 lightning-info)) ) ;; WARN: Return type mismatch int vs object. @@ -1963,215 +1962,209 @@ ) (defbehavior gun-fire-blue-2-old target () - (local-vars - (sv-608 gun-info) - (sv-612 vector) - (sv-616 gun-blue-lightning-command) - (sv-768 vector) - (sv-772 vector) - (sv-776 vector) - (sv-784 int) - (sv-792 int) - (sv-800 vector) - (sv-848 vector) - (sv-852 vector) - ) (create-lightning-tracker-if-necessary) - (set! sv-608 (-> self gun)) - (set! sv-612 (-> self gun fire-dir-out)) - (set! sv-616 (new 'stack-no-clear 'gun-blue-lightning-command)) - (cpad-set-buzz! (-> *cpad-list* cpads 0) 1 153 (seconds 0.1)) - (set! (-> sv-616 msg) (gun-blue-lightning-cmd-msg active)) - (set! (-> sv-616 lightning-info num-pts) 0) - (set! (-> sv-616 lightning-info should-draw-terminal-sparks?) #f) - (set! (-> sv-616 lightning-info should-draw-extension?) #t) - (vector-normalize! sv-612 1.0) - (when (not (do-fire-backcheck (-> sv-608 fire-point) sv-612)) - (let ((a0-5 (handle->process (-> sv-608 gun 0 extra)))) - (send-event a0-5 'gun-blue-lightning sv-616) + (let ((sv-608 (-> self gun)) + (sv-612 (-> self gun fire-dir-out)) + (sv-616 (new 'stack-no-clear 'gun-blue-lightning-command)) + ) + (cpad-set-buzz! (-> *cpad-list* cpads 0) 1 153 (seconds 0.1)) + (set! (-> sv-616 msg) (gun-blue-lightning-cmd-msg active)) + (set! (-> sv-616 lightning-info num-pts) 0) + (set! (-> sv-616 lightning-info should-draw-terminal-sparks?) #f) + (set! (-> sv-616 lightning-info should-draw-extension?) #t) + (vector-normalize! sv-612 1.0) + (when (not (do-fire-backcheck (-> sv-608 fire-point) sv-612)) + (let ((a0-5 (handle->process (-> sv-608 gun 0 extra)))) + (send-event a0-5 'gun-blue-lightning sv-616) + ) + (return 0) ) - (return 0) - ) - (let ((v1-23 (new 'stack-no-clear 'vector))) - (vector-copy! v1-23 (-> sv-608 fire-point)) - (set! sv-768 v1-23) - ) - (set! sv-772 (vector+float*! (new 'stack-no-clear 'vector) (-> sv-608 fire-point) sv-612 409600.0)) - (let ((v1-26 (new 'stack-no-clear 'vector))) - (vector-copy! v1-26 sv-612) - (set! sv-776 v1-26) - ) - (set! sv-784 0) - (set! sv-792 -1) - (set! sv-800 (new 'stack-no-clear 'vector)) - (vector-copy! (-> sv-616 lightning-info pts (-> sv-616 lightning-info num-pts)) sv-768) - (+! (-> sv-616 lightning-info num-pts) 1) - (vector-! sv-800 sv-772 sv-768) - (dotimes (gp-0 8) - (let ((f30-0 32768.0)) - (set! sv-848 (new 'stack-no-clear 'vector)) - (set! sv-852 (vector+float*! (new 'stack-no-clear 'vector) sv-768 sv-612 f30-0)) - (vector-copy! sv-848 sv-852) - (set! (-> sv-848 w) 20480.0) - (let ((s5-0 (the-as process #f))) - (let ((s4-0 #f)) - (when (< gp-0 7) - (when (and (handle->process (-> *gun-blue-2-targets* gp-0 target)) - (not (time-elapsed? (-> *gun-blue-2-targets* gp-0 start-time) (seconds 0.5))) - ) - (let ((s3-0 (as-type (handle->process (-> *gun-blue-2-targets* gp-0 target)) process-focusable))) - (when (is-valid-blue-2-target (the-as process-focusable s3-0) sv-784) - (let ((s2-2 (vector-! (new 'stack-no-clear 'vector) (get-trans (the-as process-focusable s3-0) 3) sv-852))) - (vector-normalize-ret-len! s2-2 1.0) - (let ((f0-5 (vector-dot s2-2 sv-776))) - (when (< 0.87 f0-5) - (set! s4-0 #t) - (set! s5-0 s3-0) + (let ((v1-23 (new 'stack-no-clear 'vector))) + (vector-copy! v1-23 (-> sv-608 fire-point)) + (let ((sv-768 v1-23) + (sv-772 (vector+float*! (new 'stack-no-clear 'vector) (-> sv-608 fire-point) sv-612 409600.0)) + (v1-26 (new 'stack-no-clear 'vector)) + ) + (vector-copy! v1-26 sv-612) + (let ((sv-776 v1-26) + (sv-784 0) + (sv-792 -1) + (sv-800 (new 'stack-no-clear 'vector)) + ) + (vector-copy! (-> sv-616 lightning-info pts (-> sv-616 lightning-info num-pts)) sv-768) + (+! (-> sv-616 lightning-info num-pts) 1) + (vector-! sv-800 sv-772 sv-768) + (dotimes (gp-0 8) + (let ((f30-0 32768.0)) + (let ((sv-848 (new 'stack-no-clear 'vector)) + (sv-852 (vector+float*! (new 'stack-no-clear 'vector) sv-768 sv-612 f30-0)) + ) + (vector-copy! sv-848 sv-852) + (set! (-> sv-848 w) 20480.0) + (let ((s5-0 (the-as process #f))) + (let ((s4-0 #f)) + (when (< gp-0 7) + (when (and (handle->process (-> *gun-blue-2-targets* gp-0 target)) + (not (time-elapsed? (-> *gun-blue-2-targets* gp-0 start-time) (seconds 0.5))) + ) + (let ((s3-0 (as-type (handle->process (-> *gun-blue-2-targets* gp-0 target)) process-focusable))) + (when (is-valid-blue-2-target (the-as process-focusable s3-0) sv-784) + (let ((s2-2 (vector-! (new 'stack-no-clear 'vector) (get-trans (the-as process-focusable s3-0) 3) sv-852))) + (vector-normalize-ret-len! s2-2 1.0) + (let ((f0-5 (vector-dot s2-2 sv-776))) + (when (< 0.87 f0-5) + (set! s4-0 #t) + (set! s5-0 s3-0) + ) + ) + ) + ) + ) + ) + (when (not s4-0) + (set! (-> *gun-blue-2-targets* gp-0 target) (the-as handle #f)) + (set-time! (-> *gun-blue-2-targets* gp-0 start-time)) + ) + (if (not s5-0) + (set! s5-0 (find-gun-blue-2-target-old sv-848 sv-784 sv-776)) + ) + ) + ) + (cond + (s5-0 + (set! (-> *found-objects* sv-784) (process->handle s5-0)) + (set! (-> *gun-blue-2-targets* gp-0 target) (process->handle s5-0)) + (+! sv-784 1) + (set! sv-792 gp-0) + (vector-! sv-800 (get-trans (the-as process-focusable s5-0) 3) sv-768) + (vector-normalize! sv-800 1.0) + ) + (else + (vector-normalize! sv-800 1.0) + (let ((f0-7 (vector-dot sv-800 sv-776))) + (when (< f0-7 0.866) + (let ((s5-1 (new 'stack-no-clear 'vector)) + (f28-0 0.0) + ) + (acos f0-7) + 5461.3335 + (vector-cross! s5-1 sv-800 sv-776) + (vector-normalize! s5-1 1.0) + (vector-rotate-around-axis! sv-800 sv-776 f28-0 s5-1) + ) + ) + ) + (vector-normalize! sv-800 1.0) + ) + ) + ) + ) + (vector-copy! sv-776 sv-800) + (let ((s5-3 (vector+float*! (new 'stack-no-clear 'vector) sv-768 sv-800 f30-0))) + (let ((s4-3 #f)) + (let ((s3-1 (new 'stack-no-clear 'collide-query))) + (vector-copy! (-> s3-1 start-pos) sv-768) + (vector-! (-> s3-1 move-dist) s5-3 sv-768) + (let ((v1-99 s3-1)) + (set! (-> v1-99 radius) 40.96) + (set! (-> v1-99 collide-with) + (collide-spec backgnd vehicle-sphere hit-by-others-list pusher impenetrable-obj) + ) + (set! (-> v1-99 ignore-process0) #f) + (set! (-> v1-99 ignore-process1) #f) + (set! (-> v1-99 ignore-pat) + (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) + ) + (set! (-> v1-99 action-mask) (collide-action solid)) + ) + (let ((f0-11 (fill-and-probe-using-line-sphere *collide-cache* s3-1))) + (when (>= f0-11 0.0) + (vector-float*! (-> s3-1 move-dist) (-> s3-1 move-dist) f0-11) + (vector+! s5-3 sv-768 (-> s3-1 move-dist)) + (set! s4-3 #t) + (cond + ((> gp-0 0) + (let ((a0-80 (vector-normalize-copy! (new 'stack-no-clear 'vector) (-> s3-1 move-dist) 1.0))) + (vector+float*! (-> sv-616 lightning-info terminal-spark-pos) s5-3 a0-80 -12288.0) + ) + ) + (else + (vector-copy! (-> sv-616 lightning-info terminal-spark-pos) s5-3) + ) + ) ) ) ) - ) - ) - ) - (when (not s4-0) - (set! (-> *gun-blue-2-targets* gp-0 target) (the-as handle #f)) - (set-time! (-> *gun-blue-2-targets* gp-0 start-time)) - ) - (if (not s5-0) - (set! s5-0 (find-gun-blue-2-target-old sv-848 sv-784 sv-776)) - ) - ) - ) - (cond - (s5-0 - (set! (-> *found-objects* sv-784) (process->handle s5-0)) - (set! (-> *gun-blue-2-targets* gp-0 target) (process->handle s5-0)) - (set! sv-784 (+ sv-784 1)) - (set! sv-792 gp-0) - (vector-! sv-800 (get-trans (the-as process-focusable s5-0) 3) sv-768) - (vector-normalize! sv-800 1.0) - ) - (else - (vector-normalize! sv-800 1.0) - (let ((f0-7 (vector-dot sv-800 sv-776))) - (when (< f0-7 0.866) - (let ((s5-1 (new 'stack-no-clear 'vector)) - (f28-0 0.0) - ) - (acos f0-7) - 5461.3335 - (vector-cross! s5-1 sv-800 sv-776) - (vector-normalize! s5-1 1.0) - (vector-rotate-around-axis! sv-800 sv-776 f28-0 s5-1) - ) - ) - ) - (vector-normalize! sv-800 1.0) - ) - ) - ) - (vector-copy! sv-776 sv-800) - (let ((s5-3 (vector+float*! (new 'stack-no-clear 'vector) sv-768 sv-800 f30-0))) - (let ((s4-3 #f)) - (let ((s3-1 (new 'stack-no-clear 'collide-query))) - (vector-copy! (-> s3-1 start-pos) sv-768) - (vector-! (-> s3-1 move-dist) s5-3 sv-768) - (let ((v1-99 s3-1)) - (set! (-> v1-99 radius) 40.96) - (set! (-> v1-99 collide-with) - (collide-spec backgnd vehicle-sphere hit-by-others-list pusher impenetrable-obj) + (vector-copy! (-> sv-616 lightning-info pts (-> sv-616 lightning-info num-pts)) s5-3) + (+! (-> sv-616 lightning-info num-pts) 1) + (let ((s3-2 fire-projectile-if-necessary) + (s2-3 sv-768) + (s1-0 s5-3) + (a2-7 (if (< 1 sv-784) + (the-as int (-> *found-objects* (+ sv-784 -2))) + (process->handle (send-event self 'get-vehicle)) + ) + ) + ) + (s3-2 s2-3 s1-0 (the-as handle a2-7)) ) - (set! (-> v1-99 ignore-process0) #f) - (set! (-> v1-99 ignore-process1) #f) - (set! (-> v1-99 ignore-pat) - (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) + (vector-copy! sv-768 s5-3) + (when s4-3 + (set! (-> sv-616 lightning-info should-draw-terminal-sparks?) #t) + (set! (-> sv-616 lightning-info should-draw-extension?) #f) + 0 + (goto cfg-70) ) - (set! (-> v1-99 action-mask) (collide-action solid)) + ) + (vector-copy! (-> sv-616 lightning-info terminal-spark-pos) s5-3) + ) ) - (let ((f0-11 (fill-and-probe-using-line-sphere *collide-cache* s3-1))) - (when (>= f0-11 0.0) - (vector-float*! (-> s3-1 move-dist) (-> s3-1 move-dist) f0-11) - (vector+! s5-3 sv-768 (-> s3-1 move-dist)) - (set! s4-3 #t) - (cond - ((> gp-0 0) - (let ((a0-80 (vector-normalize-copy! (new 'stack-no-clear 'vector) (-> s3-1 move-dist) 1.0))) - (vector+float*! (-> sv-616 lightning-info terminal-spark-pos) s5-3 a0-80 -12288.0) - ) + ) + (label cfg-70) + (if (and (= sv-792 (+ (-> sv-616 lightning-info num-pts) -2)) + (not (-> sv-616 lightning-info should-draw-extension?)) ) - (else - (vector-copy! (-> sv-616 lightning-info terminal-spark-pos) s5-3) + (set! (-> sv-616 lightning-info should-draw-terminal-sparks?) #f) + ) + (let ((s5-4 (-> sv-616 lightning-info pts (+ (-> sv-616 lightning-info num-pts) -1)))) + (when (-> sv-616 lightning-info should-draw-extension?) + (let ((gp-2 (vector+float*! (new 'stack-no-clear 'vector) s5-4 sv-800 409600.0)) + (s4-4 (new 'stack-no-clear 'collide-query)) ) + (vector-copy! (-> s4-4 start-pos) s5-4) + (vector-! (-> s4-4 move-dist) gp-2 s5-4) + (let ((v1-154 s4-4)) + (set! (-> v1-154 radius) 40.96) + (set! (-> v1-154 collide-with) + (collide-spec backgnd vehicle-sphere hit-by-others-list pusher impenetrable-obj) + ) + (set! (-> v1-154 ignore-process0) #f) + (set! (-> v1-154 ignore-process1) #f) + (set! (-> v1-154 ignore-pat) + (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) + ) + (set! (-> v1-154 action-mask) (collide-action solid)) + ) + (let ((f0-15 (fill-and-probe-using-line-sphere *collide-cache* s4-4))) + (when (>= f0-15 0.0) + (vector-float*! (-> s4-4 move-dist) (-> s4-4 move-dist) f0-15) + (vector+! gp-2 s5-4 (-> s4-4 move-dist)) + ) + ) + (vector-copy! (-> sv-616 lightning-info extension-end-point) gp-2) + (set! (-> sv-616 lightning-info should-draw-terminal-sparks?) #t) + (let ((a0-122 (vector-normalize-copy! (new 'stack-no-clear 'vector) (-> s4-4 move-dist) 1.0))) + (vector+float*! (-> sv-616 lightning-info terminal-spark-pos) gp-2 a0-122 -12288.0) ) ) ) ) - (vector-copy! (-> sv-616 lightning-info pts (-> sv-616 lightning-info num-pts)) s5-3) - (+! (-> sv-616 lightning-info num-pts) 1) - (let ((s3-2 fire-projectile-if-necessary) - (s2-3 sv-768) - (s1-0 s5-3) - (a2-7 (if (< 1 sv-784) - (the-as int (-> *found-objects* (+ sv-784 -2))) - (process->handle (send-event self 'get-vehicle)) - ) - ) - ) - (s3-2 s2-3 s1-0 (the-as handle a2-7)) - ) - (vector-copy! sv-768 s5-3) - (when s4-3 - (set! (-> sv-616 lightning-info should-draw-terminal-sparks?) #t) - (set! (-> sv-616 lightning-info should-draw-extension?) #f) - 0 - (goto cfg-70) - ) - ) - (vector-copy! (-> sv-616 lightning-info terminal-spark-pos) s5-3) - ) - ) - ) - (label cfg-70) - (if (and (= sv-792 (+ (-> sv-616 lightning-info num-pts) -2)) - (not (-> sv-616 lightning-info should-draw-extension?)) - ) - (set! (-> sv-616 lightning-info should-draw-terminal-sparks?) #f) - ) - (let ((s5-4 (-> sv-616 lightning-info pts (+ (-> sv-616 lightning-info num-pts) -1)))) - (when (-> sv-616 lightning-info should-draw-extension?) - (let ((gp-2 (vector+float*! (new 'stack-no-clear 'vector) s5-4 sv-800 409600.0)) - (s4-4 (new 'stack-no-clear 'collide-query)) - ) - (vector-copy! (-> s4-4 start-pos) s5-4) - (vector-! (-> s4-4 move-dist) gp-2 s5-4) - (let ((v1-154 s4-4)) - (set! (-> v1-154 radius) 40.96) - (set! (-> v1-154 collide-with) - (collide-spec backgnd vehicle-sphere hit-by-others-list pusher impenetrable-obj) - ) - (set! (-> v1-154 ignore-process0) #f) - (set! (-> v1-154 ignore-process1) #f) - (set! (-> v1-154 ignore-pat) - (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) - ) - (set! (-> v1-154 action-mask) (collide-action solid)) - ) - (let ((f0-15 (fill-and-probe-using-line-sphere *collide-cache* s4-4))) - (when (>= f0-15 0.0) - (vector-float*! (-> s4-4 move-dist) (-> s4-4 move-dist) f0-15) - (vector+! gp-2 s5-4 (-> s4-4 move-dist)) - ) - ) - (vector-copy! (-> sv-616 lightning-info extension-end-point) gp-2) - (set! (-> sv-616 lightning-info should-draw-terminal-sparks?) #t) - (let ((a0-122 (vector-normalize-copy! (new 'stack-no-clear 'vector) (-> s4-4 move-dist) 1.0))) - (vector+float*! (-> sv-616 lightning-info terminal-spark-pos) gp-2 a0-122 -12288.0) ) ) ) - ) - (let ((a0-124 (handle->process (-> sv-608 gun 0 extra)))) - (send-event a0-124 'gun-blue-lightning sv-616) + (let ((a0-124 (handle->process (-> sv-608 gun 0 extra)))) + (send-event a0-124 'gun-blue-lightning sv-616) + ) ) ) diff --git a/goal_src/jak3/engine/target/gun/gun-dark-shot.gc b/goal_src/jak3/engine/target/gun/gun-dark-shot.gc index 466e2a864d..f8b56df663 100644 --- a/goal_src/jak3/engine/target/gun/gun-dark-shot.gc +++ b/goal_src/jak3/engine/target/gun/gun-dark-shot.gc @@ -659,7 +659,7 @@ (set! (-> self launch-impact-state) (method-of-object self impact)) ) (set! (-> self launch-speed) (lerp 204800.0 552960.0 f30-0)) - (set! (-> self launch-height-t) (* f30-0 f30-0)) + (set! (-> self launch-height-t) (square f30-0)) ) (let ((v1-10 (-> self state parent))) (when v1-10 @@ -730,7 +730,6 @@ ) (defmethod count-casualties ((this gun-dark-3-nuke)) - (local-vars (sv-1568 vector)) (set! (-> this num-dying-vehicles) (the-as uint 0)) (set! (-> this num-dying-guards) (the-as uint 0)) (set! (-> this num-dying-civilians) (the-as uint 0)) @@ -748,12 +747,8 @@ (when (and (!= *target* s1-1) (not (focus-test? (the-as process-focusable s1-1) disable dead inactive)) (or (logtest? (process-mask enemy guard vehicle civilian) (-> s1-1 mask)) - (and (logtest? (process-mask crate) (-> s1-1 mask)) (let ((s0-1 vector-vector-xz-distance)) - (set! sv-1568 (-> s1-1 root trans)) - (let ((a1-3 (camera-pos))) - (< (s0-1 sv-1568 a1-3) 204800.0) - ) - ) + (and (logtest? (process-mask crate) (-> s1-1 mask)) + (< (vector-vector-xz-distance (-> s1-1 root trans) (camera-pos)) 204800.0) ) ) ) @@ -1281,7 +1276,7 @@ (when (time-elapsed? (-> self state-time) (seconds 5)) (let ((f30-1 (* 0.00066666666 (the float (+ (- (seconds -5) (-> self state-time)) (current-time)))))) 0.0 - (let ((f24-0 (* f30-1 f30-1))) + (let ((f24-0 (square f30-1))) (set! f28-0 (* f28-0 (lerp 1.0 1.3 f24-0))) (set! f26-1 (* f26-1 (lerp 1.0 1.3 f24-0))) ) @@ -1292,7 +1287,7 @@ (vector-copy! (-> v1-144 pos) (-> self mushroom-top-pos)) (set! (-> v1-144 size-x) f28-0) (set! (-> v1-144 size-y) f26-1) - (set! (-> v1-144 alpha-val) (* f30-0 f30-0)) + (set! (-> v1-144 alpha-val) (square f30-0)) (send-event (handle->process (-> self warp)) 'set-pos-and-size v1-144) ) (let ((gp-6 (vector-float*! (new 'stack-no-clear 'vector) *up-vector* f26-1)) @@ -1702,84 +1697,65 @@ (arg5 sparticle-launcher) (arg6 sparticle-launcher) ) - (local-vars (sv-16 process) (sv-32 lightning-spec) (sv-48 process-focusable)) - (set! sv-48 arg0) - (let ((s0-0 arg1)) - (set! sv-32 arg2) - (let ((gp-0 arg4) - (s1-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 0)) - (let ((s2-0 (when sv-16 - (let ((t9-3 (method-of-type lightning-tracker activate))) - (t9-3 (the-as lightning-tracker sv-16) s0-0 "lightning-tracker" (the-as pointer #x70004000)) - ) - (let ((t9-4 run-function-in-process) - (a0-5 sv-16) - (a1-5 lightning-tracker-init) - (a3-3 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-5 - sv-32 - a3-3 - t0-1 - sv-48 - t2-1 - t3-0 - ) - ) - (-> sv-16 ppointer) - ) + (let* ((sv-48 arg0) + (s0-0 arg1) + (sv-32 arg2) + (gp-0 arg4) + (s1-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 0)) + (s2-0 (when sv-16 + ((method-of-type lightning-tracker activate) + (the-as lightning-tracker sv-16) + s0-0 + "lightning-tracker" + (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 s1-0 + (let ((t9-5 sp-launch-particles-var) + (a0-6 *sp-particle-system-2d*) + (a2-4 *launch-matrix*) ) - (when s1-0 - (let ((t9-5 sp-launch-particles-var) - (a0-6 *sp-particle-system-2d*) - (a2-4 *launch-matrix*) - ) - (vector-copy! (-> a2-4 trans) s4-0) - (t9-5 a0-6 s1-0 a2-4 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0) + (vector-copy! (-> a2-4 trans) s4-0) + (t9-5 a0-6 s1-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*) - ) - (vector-copy! (-> a2-5 trans) s4-0) - (t9-6 a0-7 s3-0 a2-5 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0) + (vector-copy! (-> a2-5 trans) s4-0) + (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 s2-0) + (let ((v1-13 (get-field-spec-by-id gp-0 (sp-field-id spt-timer)))) + (if v1-13 + (set! (-> v1-13 initial-valuef) (the-as float (-> (the-as lightning-tracker (-> s2-0 0)) duration))) ) - ) - (when (and gp-0 s2-0) - (let ((v1-13 (get-field-spec-by-id gp-0 (sp-field-id spt-timer)))) - (if v1-13 - (set! (-> v1-13 initial-valuef) (the-as float (-> (the-as lightning-tracker (-> s2-0 0)) duration))) - ) + ) + (let ((t9-8 sp-launch-particles-var) + (a0-12 *sp-particle-system-2d*) + (a1-13 gp-0) + (a2-6 *launch-matrix*) ) - (let ((t9-8 sp-launch-particles-var) - (a0-12 *sp-particle-system-2d*) - (a1-13 gp-0) - (a2-6 *launch-matrix*) - ) - (vector-copy! (-> a2-6 trans) s4-0) - (t9-8 a0-12 a1-13 a2-6 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0) + (vector-copy! (-> a2-6 trans) s4-0) + (t9-8 a0-12 a1-13 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*) - ) - (vector-copy! (-> a2-7 trans) s5-0) - (t9-9 a0-13 gp-0 a2-7 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0) - ) - ) + (vector-copy! (-> a2-7 trans) s5-0) + (t9-9 a0-13 gp-0 a2-7 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0) ) ) ) @@ -1956,9 +1932,7 @@ (!= s1-1 s5-1) ) (let* ((s0-1 (get-trans (the-as process-focusable s1-1) 3)) - (f0-2 (vector-vector-distance-squared (-> self root trans) s0-1)) - (f1-0 (-> s0-1 w)) - (f0-3 (- f0-2 (* f1-0 f1-0))) + (f0-3 (- (vector-vector-distance-squared (-> self root trans) s0-1) (square (-> s0-1 w)))) (v1-80 (+ (-> self result-count) -1)) ) (while (and (>= v1-80 0) (< f0-3 (-> gp-3 v1-80))) @@ -1993,9 +1967,7 @@ (!= s3-1 s5-1) ) (let* ((s5-2 (get-trans s3-1 3)) - (f0-5 (vector-vector-distance-squared (-> self root trans) s5-2)) - (f1-6 (-> s5-2 w)) - (f0-6 (- f0-5 (* f1-6 f1-6))) + (f0-6 (- (vector-vector-distance-squared (-> self root trans) s5-2) (square (-> s5-2 w)))) (v1-101 (+ (-> self result-count) -1)) ) (while (and (>= v1-101 0) (< f0-6 (-> gp-3 v1-101))) @@ -2286,8 +2258,7 @@ (* 10.0 (seconds-per-frame) (- 4096.0 f0-2)) ) ((< 14336.0 f0-2) - (let* ((f0-5 (+ -14336.0 f0-2)) - (f0-7 (* f0-5 f0-5)) + (let* ((f0-7 (square (+ -14336.0 f0-2))) (f0-9 (* 0.00008138021 (- f0-7))) (f0-10 (fmax -61440.0 f0-9)) ) @@ -2438,90 +2409,144 @@ ) (defmethod handle-impact ((this gravity-spinner) (arg0 symbol)) - (local-vars - (sv-144 sphere) - (sv-148 process) - (sv-152 vector) - (sv-156 float) - (sv-160 float) - (sv-164 vector) - (sv-168 symbol) - (sv-172 float) - (sv-1728 vector) - (sv-1732 vector) - (sv-1736 float) - (sv-2304 vector) - (sv-2308 vector) - (sv-2312 float) - ) - (let ((s5-0 (as-type (handle->process (-> this parent-hand)) process-focusable))) - (when s5-0 - (set! sv-144 (new 'stack 'sphere)) - (set! sv-148 (the-as process (send-event *target* 'get-vehicle))) - (let ((v1-7 (new 'stack-no-clear 'vector))) - (vector-copy! v1-7 (-> (the-as process-focusable s5-0) root transv)) - (set! sv-152 v1-7) - ) - (set! sv-156 (the-as float 0.0)) - (set! sv-160 (the-as float 102400.0)) - (set! sv-164 (new 'stack-no-clear 'vector)) - (set! sv-168 (the-as symbol #f)) - (set! sv-172 (the-as float 40960000.0)) - (if arg0 - (set! sv-160 (the-as float 163840.0)) - ) - (set! sv-156 (vector-normalize-ret-len! sv-152 1.0)) - (set! (-> sv-144 quad) (-> (get-trans (the-as process-focusable s5-0) 3) quad)) - (set! (-> sv-144 r) sv-160) - (let ((s3-2 (new 'stack-no-clear 'array 'collide-shape 384))) - (countdown (s2-0 (fill-actor-list-for-box *actor-hash* sv-144 s3-2 384)) - (let ((a0-15 (as-type (-> s3-2 s2-0) collide-shape))) - (when a0-15 - (let ((a0-17 (as-type (-> a0-15 process) process-focusable))) - (when a0-17 - (when (and (!= s5-0 a0-17) - (not (focus-test? (the-as process-focusable a0-17) disable dead inactive gun-no-target)) - (logtest? (process-mask enemy guard civilian) (-> a0-17 mask)) - (not (focus-test? (the-as process-focusable a0-17) no-gravity)) - (!= a0-17 sv-148) - ) - (set! sv-1728 (get-trans (the-as process-focusable a0-17) 3)) - (set! sv-1732 (new 'stack-no-clear 'vector)) - (set! sv-1736 (the-as float 0.0)) - (vector-! sv-1732 sv-1728 (the-as vector sv-144)) - (set! sv-1736 (vector-normalize-ret-len! sv-1732 1.0)) - (when (and (>= sv-160 sv-1736) (< sv-1736 sv-172) (< sv-1736 (* 4.5 sv-156))) - (let ((f30-0 (vector-dot sv-152 sv-1732)) - (f0-12 0.707) - ) - (if arg0 - (set! f0-12 0.5) - ) - (when (< f0-12 f30-0) - (let ((a1-19 (new 'stack 'collide-query))) - (vector-copy! (-> a1-19 start-pos) sv-144) - (vector-! (-> a1-19 move-dist) sv-1728 (-> a1-19 start-pos)) - (let ((v1-53 a1-19)) - (set! (-> v1-53 radius) (* 0.8 (-> (the-as process-focusable s5-0) root root-prim prim-core world-sphere w))) - (set! (-> v1-53 collide-with) (collide-spec backgnd obstacle)) - (set! (-> v1-53 ignore-process0) #f) - (set! (-> v1-53 ignore-process1) #f) - (set! (-> v1-53 ignore-pat) - (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) + (with-pp + (let ((s5-0 (as-type (handle->process (-> this parent-hand)) process-focusable))) + (when s5-0 + (let ((sv-144 (new 'stack 'sphere)) + (a1-4 (new 'stack-no-clear 'event-message-block)) + ) + (set! (-> a1-4 from) (process->ppointer pp)) + (set! (-> a1-4 num-params) 0) + (set! (-> a1-4 message) 'get-vehicle) + (let ((sv-148 (the-as process (send-event-function *target* a1-4))) + (v1-7 (new 'stack-no-clear 'vector)) + ) + (vector-copy! v1-7 (-> (the-as process-focusable s5-0) root transv)) + (let ((sv-152 v1-7) + (sv-156 (the-as float 0.0)) + (sv-160 (the-as float 102400.0)) + (sv-164 (new 'stack-no-clear 'vector)) + (sv-168 (the-as symbol #f)) + ) + (let ((sv-172 (the-as float 40960000.0))) + (if arg0 + (set! sv-160 (the-as float 163840.0)) + ) + (set! sv-156 (vector-normalize-ret-len! sv-152 1.0)) + (set! (-> sv-144 quad) (-> (get-trans (the-as process-focusable s5-0) 3) quad)) + (set! (-> sv-144 r) sv-160) + (let ((s3-2 (new 'stack-no-clear 'array 'collide-shape 384))) + (countdown (s2-0 (fill-actor-list-for-box *actor-hash* sv-144 s3-2 384)) + (let ((a0-15 (as-type (-> s3-2 s2-0) collide-shape))) + (when a0-15 + (let ((a0-17 (as-type (-> a0-15 process) process-focusable))) + (when a0-17 + (when (and (!= s5-0 a0-17) + (not (focus-test? (the-as process-focusable a0-17) disable dead inactive gun-no-target)) + (logtest? (process-mask enemy guard civilian) (-> a0-17 mask)) + (not (focus-test? (the-as process-focusable a0-17) no-gravity)) + (!= a0-17 sv-148) + ) + (let ((sv-1728 (get-trans (the-as process-focusable a0-17) 3)) + (sv-1732 (new 'stack-no-clear 'vector)) + (sv-1736 (the-as float 0.0)) ) - (set! (-> v1-53 action-mask) (collide-action solid)) - ) - (when (< (fill-and-probe-using-line-sphere *collide-cache* a1-19) 0.0) - (set! sv-172 (* sv-1736 (* f30-0 f30-0))) - (set! sv-168 #t) - (let ((f0-18 sv-156)) - (when arg0 - (set! f0-18 (fmin (fmax sv-156 (* 1.5 sv-1736)) (* 3.0 sv-156))) - (if (-> this was-hit-previously?) - (set! f0-18 (fmin f0-18 (* 2.0 sv-156))) + (vector-! sv-1732 sv-1728 (the-as vector sv-144)) + (set! sv-1736 (vector-normalize-ret-len! sv-1732 1.0)) + (when (and (>= sv-160 sv-1736) (< sv-1736 sv-172) (< sv-1736 (* 4.5 sv-156))) + (let ((f30-0 (vector-dot sv-152 sv-1732)) + (f0-12 0.707) + ) + (if arg0 + (set! f0-12 0.5) + ) + (when (< f0-12 f30-0) + (let ((a1-19 (new 'stack 'collide-query))) + (vector-copy! (-> a1-19 start-pos) sv-144) + (vector-! (-> a1-19 move-dist) sv-1728 (-> a1-19 start-pos)) + (let ((v1-53 a1-19)) + (set! (-> v1-53 radius) (* 0.8 (-> (the-as process-focusable s5-0) root root-prim prim-core world-sphere w))) + (set! (-> v1-53 collide-with) (collide-spec backgnd obstacle)) + (set! (-> v1-53 ignore-process0) #f) + (set! (-> v1-53 ignore-process1) #f) + (set! (-> v1-53 ignore-pat) + (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) + ) + (set! (-> v1-53 action-mask) (collide-action solid)) + ) + (when (< (fill-and-probe-using-line-sphere *collide-cache* a1-19) 0.0) + (set! sv-172 (* sv-1736 (square f30-0))) + (set! sv-168 #t) + (let ((f0-18 sv-156)) + (when arg0 + (set! f0-18 (fmin (fmax sv-156 (* 1.5 sv-1736)) (* 3.0 sv-156))) + (if (-> this was-hit-previously?) + (set! f0-18 (fmin f0-18 (* 2.0 sv-156))) + ) + ) + (vector-normalize-copy! sv-164 sv-1732 f0-18) + ) + ) + ) ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + (let ((s3-3 (the-as target (as-type *target* process-focusable)))) + (when (and s3-3 (< (vector-vector-distance (get-trans s3-3 0) sv-144) (-> sv-144 r))) + (when (and (!= s5-0 s3-3) + (not (focus-test? s3-3 disable dead inactive gun-no-target)) + (logtest? (process-mask enemy guard civilian) (-> s3-3 mask)) + (not (focus-test? s3-3 no-gravity)) + (!= s3-3 sv-148) + ) + (let ((sv-2304 (get-trans s3-3 3)) + (sv-2308 (new 'stack-no-clear 'vector)) + (sv-2312 (the-as float 0.0)) + ) + (vector-! sv-2308 sv-2304 (the-as vector sv-144)) + (set! sv-2312 (vector-normalize-ret-len! sv-2308 1.0)) + (when (and (>= sv-160 sv-2312) (< sv-2312 sv-172) (< sv-2312 (* 4.5 sv-156))) + (let ((f30-1 (vector-dot sv-152 sv-2308)) + (f0-28 0.707) + ) + (if arg0 + (set! f0-28 0.5) + ) + (when (< f0-28 f30-1) + (let ((a1-29 (new 'stack 'collide-query))) + (vector-copy! (-> a1-29 start-pos) sv-144) + (vector-! (-> a1-29 move-dist) sv-2304 (-> a1-29 start-pos)) + (let ((v1-103 a1-29)) + (set! (-> v1-103 radius) (* 0.8 (-> (the-as process-focusable s5-0) root root-prim prim-core world-sphere w))) + (set! (-> v1-103 collide-with) (collide-spec backgnd obstacle)) + (set! (-> v1-103 ignore-process0) #f) + (set! (-> v1-103 ignore-process1) #f) + (set! (-> v1-103 ignore-pat) + (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) + ) + (set! (-> v1-103 action-mask) (collide-action solid)) + ) + (when (< (fill-and-probe-using-line-sphere *collide-cache* a1-29) 0.0) + (set! sv-172 (* sv-2312 (square f30-1))) + (set! sv-168 #t) + (let ((f0-34 sv-156)) + (when arg0 + (set! f0-34 (fmin (fmax sv-156 (* 1.5 sv-2312)) (* 3.0 sv-156))) + (if (-> this was-hit-previously?) + (set! f0-34 (fmin f0-34 (* 2.0 sv-156))) + ) + ) + (vector-normalize-copy! sv-164 sv-2308 f0-34) + ) ) - (vector-normalize-copy! sv-164 sv-1732 f0-18) ) ) ) @@ -2531,88 +2556,36 @@ ) ) ) - ) - ) - ) - ) - (let ((s3-3 (the-as target (as-type *target* process-focusable)))) - (when (and s3-3 (< (vector-vector-distance (get-trans s3-3 0) sv-144) (-> sv-144 r))) - (when (and (!= s5-0 s3-3) - (not (focus-test? s3-3 disable dead inactive gun-no-target)) - (logtest? (process-mask enemy guard civilian) (-> s3-3 mask)) - (not (focus-test? s3-3 no-gravity)) - (!= s3-3 sv-148) - ) - (set! sv-2304 (get-trans s3-3 3)) - (set! sv-2308 (new 'stack-no-clear 'vector)) - (set! sv-2312 (the-as float 0.0)) - (vector-! sv-2308 sv-2304 (the-as vector sv-144)) - (set! sv-2312 (vector-normalize-ret-len! sv-2308 1.0)) - (when (and (>= sv-160 sv-2312) (< sv-2312 sv-172) (< sv-2312 (* 4.5 sv-156))) - (let ((f30-1 (vector-dot sv-152 sv-2308)) - (f0-28 0.707) - ) - (if arg0 - (set! f0-28 0.5) - ) - (when (< f0-28 f30-1) - (let ((a1-29 (new 'stack 'collide-query))) - (vector-copy! (-> a1-29 start-pos) sv-144) - (vector-! (-> a1-29 move-dist) sv-2304 (-> a1-29 start-pos)) - (let ((v1-103 a1-29)) - (set! (-> v1-103 radius) (* 0.8 (-> (the-as process-focusable s5-0) root root-prim prim-core world-sphere w))) - (set! (-> v1-103 collide-with) (collide-spec backgnd obstacle)) - (set! (-> v1-103 ignore-process0) #f) - (set! (-> v1-103 ignore-process1) #f) - (set! (-> v1-103 ignore-pat) - (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) - ) - (set! (-> v1-103 action-mask) (collide-action solid)) - ) - (when (< (fill-and-probe-using-line-sphere *collide-cache* a1-29) 0.0) - (set! sv-172 (* sv-2312 (* f30-1 f30-1))) - (set! sv-168 #t) - (let ((f0-34 sv-156)) - (when arg0 - (set! f0-34 (fmin (fmax sv-156 (* 1.5 sv-2312)) (* 3.0 sv-156))) - (if (-> this was-hit-previously?) - (set! f0-34 (fmin f0-34 (* 2.0 sv-156))) - ) - ) - (vector-normalize-copy! sv-164 sv-2308 f0-34) - ) - ) - ) + (when sv-168 + (let ((v0-1 (-> (the-as process-focusable s5-0) root transv))) + (vector-copy! v0-1 sv-164) + v0-1 ) ) ) ) ) ) - (when sv-168 - (let ((v0-1 (-> (the-as process-focusable s5-0) root transv))) - (vector-copy! v0-1 sv-164) - v0-1 - ) - ) ) ) ) (defmethod gravity-spinner-method-16 ((this gravity-spinner) (arg0 vector) (arg1 vector)) - (local-vars (sv-48 vector) (sv-52 vector) (sv-56 float)) (let ((s4-0 (as-type (handle->process (-> this parent-hand)) process-focusable))) (when s4-0 - (set! sv-48 (vector-! (new 'stack-no-clear 'vector) arg0 (get-trans (the-as process-focusable s4-0) 3))) - (set! sv-52 (new 'stack-no-clear 'vector)) - (let ((f30-0 1.0) - (f0-0 (gravity-spinner-method-18 this s4-0)) - (f1-1 (fmin 12288.0 (-> (the-as process-focusable s4-0) root root-prim prim-core world-sphere w))) + (let ((sv-48 (vector-! (new 'stack-no-clear 'vector) arg0 (get-trans (the-as process-focusable s4-0) 3))) + (sv-52 (new 'stack-no-clear 'vector)) + (sv-56 + (/ 1.0 + (* (gravity-spinner-method-18 this s4-0) + (square (fmin 12288.0 (-> (the-as process-focusable s4-0) root root-prim prim-core world-sphere w))) + ) + ) + ) ) - (set! sv-56 (/ f30-0 (* f0-0 (* f1-1 f1-1)))) + (vector-cross! sv-52 sv-48 arg1) + (vector+float*! (-> this rotation-accel) (-> this rotation-accel) sv-52 sv-56) ) - (vector-cross! sv-52 sv-48 arg1) - (vector+float*! (-> this rotation-accel) (-> this rotation-accel) sv-52 sv-56) ) ) 0 @@ -2834,7 +2807,6 @@ (defstate zero-g (gravity-spinner) :virtual #t :event (behavior ((proc process) (argc int) (message symbol) (block event-message-block)) - (local-vars (sv-32 vector) (sv-36 float) (sv-40 uint) (sv-48 uint)) (case message (('get-float-speed) (get-float-speed self) @@ -2864,45 +2836,49 @@ (if (!= proc (handle->process (-> self parent-hand))) (return 0) ) - (set! sv-32 (vector-normalize-copy! (new 'stack-no-clear 'vector) (the-as vector (-> block param 0)) 1.0)) - (set! sv-36 (the-as float 0.0)) - (set! sv-40 (-> block param 2)) - (set! sv-48 (-> block param 3)) - (set! sv-36 (if (logtest? (attack-mask damage) (-> (the-as attack-info sv-40) mask)) - (-> (the-as attack-info sv-40) damage) - (penetrate-using->damage (the-as penetrate sv-48)) - ) + (let ((sv-32 (vector-normalize-copy! (new 'stack-no-clear 'vector) (the-as vector (-> block param 0)) 1.0)) + (sv-36 (the-as float 0.0)) ) - (vector-float*! sv-32 sv-32 (fmin 184320.0 (vector-length (the-as vector (-> block param 4))))) - (if (!= sv-48 1024) - (vector-float*! sv-32 sv-32 (* 2.0 sv-36)) - ) - (set! (-> sv-32 y) (* 0.15 (-> sv-32 y))) - (+! (-> self cached-damage) sv-36) - (let ((s4-0 (as-type proc process-focusable))) - (when s4-0 - (vector-float*! sv-32 sv-32 (fmax 0.5 (gravity-spinner-method-18 self s4-0))) - (vector+float*! - (-> (the-as process-drawable s4-0) root transv) - (-> (the-as process-drawable s4-0) root transv) - sv-32 - 1.0 - ) - (let ((f0-17 (vector-normalize-ret-len! (-> (the-as process-drawable s4-0) root transv) 1.0))) - (vector-float*! - (-> (the-as process-drawable s4-0) root transv) - (-> (the-as process-drawable s4-0) root transv) - (fmin 143360.0 f0-17) + (let ((sv-40 (-> block param 2)) + (sv-48 (-> block param 3)) + ) + (set! sv-36 (if (logtest? (attack-mask damage) (-> (the-as attack-info sv-40) mask)) + (-> (the-as attack-info sv-40) damage) + (penetrate-using->damage (the-as penetrate sv-48)) + ) + ) + (vector-float*! sv-32 sv-32 (fmin 184320.0 (vector-length (the-as vector (-> block param 4))))) + (if (!= sv-48 1024) + (vector-float*! sv-32 sv-32 (* 2.0 sv-36)) ) - ) - (handle-impact self #t) - (gravity-spinner-method-16 self (the-as vector (-> block param 5)) sv-32) ) - ) - (when (< 0.0 sv-36) - (let ((v0-0 (the-as object #t))) - (set! (-> self was-hit-previously?) (the-as symbol v0-0)) - v0-0 + (set! (-> sv-32 y) (* 0.15 (-> sv-32 y))) + (+! (-> self cached-damage) sv-36) + (let ((s4-0 (as-type proc process-focusable))) + (when s4-0 + (vector-float*! sv-32 sv-32 (fmax 0.5 (gravity-spinner-method-18 self s4-0))) + (vector+float*! + (-> (the-as process-drawable s4-0) root transv) + (-> (the-as process-drawable s4-0) root transv) + sv-32 + 1.0 + ) + (let ((f0-17 (vector-normalize-ret-len! (-> (the-as process-drawable s4-0) root transv) 1.0))) + (vector-float*! + (-> (the-as process-drawable s4-0) root transv) + (-> (the-as process-drawable s4-0) root transv) + (fmin 143360.0 f0-17) + ) + ) + (handle-impact self #t) + (gravity-spinner-method-16 self (the-as vector (-> block param 5)) sv-32) + ) + ) + (when (< 0.0 sv-36) + (let ((v0-0 (the-as object #t))) + (set! (-> self was-hit-previously?) (the-as symbol v0-0)) + v0-0 + ) ) ) ) @@ -3234,8 +3210,7 @@ 0.0 0.0 0.0 - (let* ((f0-56 f26-1) - (f0-57 (* f0-56 f0-56)) + (let* ((f0-57 (square f26-1)) (f1-33 (fmax (lerp f30-1 0.0 f0-57) f28-0)) (f0-60 (fmax 0.0 (- f24-1 f1-33))) ) diff --git a/goal_src/jak3/engine/target/gun/gun-part.gc b/goal_src/jak3/engine/target/gun/gun-part.gc index 9b53fb3245..02978022b3 100644 --- a/goal_src/jak3/engine/target/gun/gun-part.gc +++ b/goal_src/jak3/engine/target/gun/gun-part.gc @@ -3818,8 +3818,7 @@ gun (-> arg1 timer) 0.0 0.0 - (let* ((f0-3 (* 0.0022222223 (the float (-> arg1 timer)))) - (f0-4 (* f0-3 f0-3)) + (let* ((f0-4 (square (* 0.0022222223 (the float (-> arg1 timer))))) (f0-5 (- 1.0 f0-4)) ) (vector-normalize! s4-0 (lerp 10240.0 0.0 f0-5)) diff --git a/goal_src/jak3/engine/target/gun/gun-red-shot.gc b/goal_src/jak3/engine/target/gun/gun-red-shot.gc index f605cc7815..c7c8e02552 100644 --- a/goal_src/jak3/engine/target/gun/gun-red-shot.gc +++ b/goal_src/jak3/engine/target/gun/gun-red-shot.gc @@ -238,10 +238,8 @@ ) ) 0.0 - (let ((f0-4 (vector-length-squared s0-2)) - (f1-1 (-> this blast-radius)) - ) - (if (>= (* f1-1 f1-1) f0-4) + (let ((f0-4 (vector-length-squared s0-2))) + (if (>= (square (-> this blast-radius)) f0-4) (send-event s1-1 'attack @@ -277,10 +275,8 @@ (+! (-> *game-info* shots-hit 1) 1.0) (let ((s5-2 (vector-! (new 'stack-no-clear 'vector) (get-trans s3-1 3) (-> this root trans)))) 0.0 - (let ((f0-12 (vector-length-squared s5-2)) - (f1-6 (-> this blast-radius)) - ) - (if (>= (* f1-6 f1-6) f0-12) + (let ((f0-12 (vector-length-squared s5-2))) + (if (>= (square (-> this blast-radius)) f0-12) (send-event s3-1 'attack @@ -307,18 +303,6 @@ ) (defmethod check-should-explode ((this gun-red-3-grenade)) - (local-vars - (sv-1680 vector) - (sv-1684 vector) - (sv-1688 float) - (sv-1692 float) - (sv-1696 symbol) - (sv-1744 vector) - (sv-1748 vector) - (sv-1752 float) - (sv-1756 float) - (sv-1760 symbol) - ) (with-pp (let ((s4-0 (new 'stack-no-clear 'vector)) (gp-0 #f) @@ -344,29 +328,31 @@ (and (logtest? (process-mask guard) (-> a0-10 mask)) (-> *setting-control* user-current gun-target-guards?)) ) ) - (set! sv-1680 - (vector-! (new 'stack-no-clear 'vector) (get-trans (the-as process-focusable a0-10) 3) (-> this root trans)) + (let ((sv-1680 + (vector-! (new 'stack-no-clear 'vector) (get-trans (the-as process-focusable a0-10) 3) (-> this root trans)) + ) + (sv-1684 (vector-normalize-copy! (new 'stack-no-clear 'vector) (-> this root transv) 1.0)) + (sv-1688 (the-as float 0.0)) + (sv-1692 (the-as float 0.0)) + (sv-1696 (time-elapsed? (-> this birth-time) (seconds 0.05))) + ) + (set! sv-1688 (vector-normalize-ret-len! sv-1680 1.0)) + (set! sv-1692 (vector-dot sv-1680 sv-1684)) + (when (< sv-1688 (-> s4-0 w)) + (cond + ((and (< 0.0 sv-1692) sv-1696) + (set! gp-0 #t) + (set! (-> this explode-delay-time) + (the-as time-frame (min 150 (the int (* 300.0 (/ sv-1688 (vector-length (-> this root transv))) sv-1692)))) + ) + ) + ((< sv-1688 8192.0) + (return 2) + ) + ((and (not sv-1696) (< (seconds 0.05) (- (current-time) (-> this birth-time)))) + (return 2) + ) ) - (set! sv-1684 (vector-normalize-copy! (new 'stack-no-clear 'vector) (-> this root transv) 1.0)) - (set! sv-1688 (the-as float 0.0)) - (set! sv-1692 (the-as float 0.0)) - (set! sv-1696 (time-elapsed? (-> this birth-time) (seconds 0.05))) - (set! sv-1688 (vector-normalize-ret-len! sv-1680 1.0)) - (set! sv-1692 (vector-dot sv-1680 sv-1684)) - (when (< sv-1688 (-> s4-0 w)) - (cond - ((and (< 0.0 sv-1692) sv-1696) - (set! gp-0 #t) - (set! (-> this explode-delay-time) - (the-as time-frame (min 150 (the int (* 300.0 (/ sv-1688 (vector-length (-> this root transv))) sv-1692)))) - ) - ) - ((< sv-1688 8192.0) - (return 2) - ) - ((and (not sv-1696) (< (seconds 0.05) (- (current-time) (-> this birth-time)))) - (return 2) - ) ) ) ) @@ -386,27 +372,29 @@ (and (logtest? (process-mask guard) (-> s2-1 mask)) (-> *setting-control* user-current gun-target-guards?)) ) ) - (set! sv-1744 (vector-! (new 'stack-no-clear 'vector) (get-trans s2-1 3) (-> this root trans))) - (set! sv-1748 (vector-normalize-copy! (new 'stack-no-clear 'vector) (-> this root transv) 1.0)) - (set! sv-1752 (the-as float 0.0)) - (set! sv-1756 (the-as float 0.0)) - (set! sv-1760 (time-elapsed? (-> this birth-time) (seconds 0.05))) - (set! sv-1752 (vector-normalize-ret-len! sv-1744 1.0)) - (set! sv-1756 (vector-dot sv-1744 sv-1748)) - (when (< sv-1752 (-> s4-0 w)) - (cond - ((and (< 0.0 sv-1756) sv-1760) - (set! gp-0 #t) - (set! (-> this explode-delay-time) - (the-as time-frame (min 150 (the int (* 300.0 (/ sv-1752 (vector-length (-> this root transv))) sv-1756)))) - ) - ) - ((< sv-1752 8192.0) - (return 2) - ) - ((and (not sv-1760) (< (seconds 0.05) (- (current-time) (-> this birth-time)))) - (return 2) - ) + (let ((sv-1744 (vector-! (new 'stack-no-clear 'vector) (get-trans s2-1 3) (-> this root trans))) + (sv-1748 (vector-normalize-copy! (new 'stack-no-clear 'vector) (-> this root transv) 1.0)) + (sv-1752 (the-as float 0.0)) + (sv-1756 (the-as float 0.0)) + (sv-1760 (time-elapsed? (-> this birth-time) (seconds 0.05))) + ) + (set! sv-1752 (vector-normalize-ret-len! sv-1744 1.0)) + (set! sv-1756 (vector-dot sv-1744 sv-1748)) + (when (< sv-1752 (-> s4-0 w)) + (cond + ((and (< 0.0 sv-1756) sv-1760) + (set! gp-0 #t) + (set! (-> this explode-delay-time) + (the-as time-frame (min 150 (the int (* 300.0 (/ sv-1752 (vector-length (-> this root transv))) sv-1756)))) + ) + ) + ((< sv-1752 8192.0) + (return 2) + ) + ((and (not sv-1760) (< (seconds 0.05) (- (current-time) (-> this birth-time)))) + (return 2) + ) + ) ) ) ) @@ -583,97 +571,89 @@ ) (defmethod find-targets-and-attack! ((this gun-red-2-shockwave)) - (local-vars - (sv-32 vector) - (sv-2672 (function vector vector float)) - (sv-2688 vector) - (sv-2704 vector) - (sv-2720 collide-query) - ) (rlet ((vf0 :class vf) (vf4 :class vf) (vf5 :class vf) (vf6 :class vf) ) (init-vf0-vector) - (set! sv-32 (new 'stack-no-clear 'vector)) - (vector-copy! sv-32 (-> this origin)) - (set! (-> sv-32 w) (-> this current-radius)) - (let ((s5-0 (new 'stack-no-clear 'array 'collide-shape 384))) - (countdown (s4-0 (fill-actor-list-for-box *actor-hash* sv-32 s5-0 384)) - (let ((v1-6 (as-type (-> s5-0 s4-0) collide-shape))) - (when v1-6 - (let ((s3-1 (as-type (-> v1-6 process) process-focusable))) - (when s3-1 - (when (and (!= *target* s3-1) - (not (focus-test? (the-as process-focusable s3-1) disable dead inactive)) - (pc-check-focus-fix (the-as process-focusable s3-1)) ;; og:preserve-this - (or (logtest? (process-mask crate enemy vehicle civilian) (-> s3-1 mask)) - (and (logtest? (process-mask guard) (-> s3-1 mask)) (-> *setting-control* user-current gun-target-guards?)) - ) - ) - (let ((s2-1 #f)) - (let ((s1-0 (process->handle s3-1))) - (dotimes (v1-18 (-> this num-previously-attacked-targets)) - (when (= (-> this previously-attacked-targets v1-18) s1-0) - (set! s2-1 #t) - 0 - (goto cfg-29) - ) - ) - (label cfg-29) - (when (not s2-1) - (let ((s0-0 #f)) - (set! sv-2672 vector-vector-xz-distance-squared) - (set! sv-2688 (-> this origin)) - (let* ((a1-4 (get-trans (the-as process-focusable s3-1) 3)) - (f0-1 (sv-2672 sv-2688 a1-4)) - (f1-0 24576.0) + (let ((sv-32 (new 'stack-no-clear 'vector))) + (vector-copy! sv-32 (-> this origin)) + (set! (-> sv-32 w) (-> this current-radius)) + (let ((s5-0 (new 'stack-no-clear 'array 'collide-shape 384))) + (countdown (s4-0 (fill-actor-list-for-box *actor-hash* sv-32 s5-0 384)) + (let ((v1-6 (as-type (-> s5-0 s4-0) collide-shape))) + (when v1-6 + (let ((s3-1 (as-type (-> v1-6 process) process-focusable))) + (when s3-1 + (when (and (!= *target* s3-1) + (not (focus-test? (the-as process-focusable s3-1) disable dead inactive)) + ;; og:preserve-this + (pc-check-focus-fix s3-1) + (or (logtest? (process-mask crate enemy vehicle civilian) (-> s3-1 mask)) + (and (logtest? (process-mask guard) (-> s3-1 mask)) (-> *setting-control* user-current gun-target-guards?)) ) + ) + (let ((s2-1 #f)) + (let ((s1-0 (process->handle s3-1))) + (dotimes (v1-18 (-> this num-previously-attacked-targets)) + (when (= (-> this previously-attacked-targets v1-18) s1-0) + (set! s2-1 #t) + 0 + (goto cfg-29) + ) + ) + (label cfg-29) + (when (not s2-1) + (let ((s0-0 #f)) (cond - ((< f0-1 (* f1-0 f1-0)) + ((< (vector-vector-xz-distance-squared (-> this origin) (get-trans (the-as process-focusable s3-1) 3)) + (square 24576.0) + ) (set! s0-0 #t) ) (else - (set! sv-2720 (new 'stack-no-clear 'collide-query)) - (vector-copy! (-> sv-2720 start-pos) (-> this origin)) - (set! sv-2704 (-> sv-2720 move-dist)) - (let ((v1-35 (get-trans (the-as process-focusable s3-1) 3)) - (a0-26 (-> this origin)) + (let ((sv-2720 (new 'stack-no-clear 'collide-query))) + (vector-copy! (-> sv-2720 start-pos) (-> this origin)) + (let ((sv-2704 (-> sv-2720 move-dist))) + (let ((v1-35 (get-trans (the-as process-focusable s3-1) 3)) + (a0-26 (-> this origin)) + ) + (.lvf vf4 (&-> v1-35 quad)) + (.lvf vf5 (&-> a0-26 quad)) ) - (.lvf vf4 (&-> v1-35 quad)) - (.lvf vf5 (&-> a0-26 quad)) - ) - (.mov.vf.w vf6 vf0) - (.sub.vf.xyz vf6 vf4 vf5) - (.svf (&-> sv-2704 quad) vf6) - (let ((v1-37 sv-2720)) - (set! (-> v1-37 radius) 40.96) - (set! (-> v1-37 collide-with) (collide-spec backgnd)) - (set! (-> v1-37 ignore-process0) #f) - (set! (-> v1-37 ignore-process1) #f) - (set! (-> v1-37 ignore-pat) - (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) - ) - (set! (-> v1-37 action-mask) (collide-action solid)) - ) - (if (= (fill-and-probe-using-line-sphere *collide-cache* sv-2720) -100000000.0) - (set! s0-0 #t) + (.mov.vf.w vf6 vf0) + (.sub.vf.xyz vf6 vf4 vf5) + (.svf (&-> sv-2704 quad) vf6) ) + (let ((v1-37 sv-2720)) + (set! (-> v1-37 radius) 40.96) + (set! (-> v1-37 collide-with) (collide-spec backgnd)) + (set! (-> v1-37 ignore-process0) #f) + (set! (-> v1-37 ignore-process1) #f) + (set! (-> v1-37 ignore-pat) + (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) + ) + (set! (-> v1-37 action-mask) (collide-action solid)) + ) + (if (= (fill-and-probe-using-line-sphere *collide-cache* sv-2720) -100000000.0) + (set! s0-0 #t) + ) + ) ) ) - ) - (when s0-0 - (send-attack! this (the-as process-focusable s3-1) #t) - (set! (-> this previously-attacked-targets (-> this num-previously-attacked-targets)) (the-as handle s1-0)) - (+! (-> this num-previously-attacked-targets) 1) + (when s0-0 + (send-attack! this (the-as process-focusable s3-1) #t) + (set! (-> this previously-attacked-targets (-> this num-previously-attacked-targets)) (the-as handle s1-0)) + (+! (-> this num-previously-attacked-targets) 1) + ) ) ) ) + (if (and s2-1 (logtest? (process-mask vehicle) (-> s3-1 mask))) + (send-attack! this (the-as process-focusable s3-1) #f) + ) ) - (if (and s2-1 (logtest? (process-mask vehicle) (-> s3-1 mask))) - (send-attack! this (the-as process-focusable s3-1) #f) - ) ) ) ) @@ -906,90 +886,91 @@ ) (defmethod find-collision-point! ((this gun-red-2-shockwave)) - (local-vars (sv-560 collide-query) (sv-564 int) (sv-608 vector) (sv-612 vector) (sv-616 float)) (if (>= (-> this next-computed-collision-point) (-> this num-collision-pts-to-generate)) (return 0) ) - (set! sv-560 (new 'stack-no-clear 'collide-query)) - (set! sv-564 (-> this num-collision-pts-to-generate)) - (set! sv-608 (new 'stack-no-clear 'vector)) - (set! sv-612 (new 'stack-no-clear 'vector)) - (set! sv-616 (/ 65536.0 (the float (+ sv-564 -1)))) - (let ((f30-1 - (+ (* sv-616 (the float (-> this generate-order-array (-> this next-computed-collision-point)))) - (rand-vu-float-range (* -0.43478262 sv-616) (* 0.43478262 sv-616)) - ) - ) + (let ((sv-560 (new 'stack-no-clear 'collide-query)) + (sv-564 (-> this num-collision-pts-to-generate)) + (sv-608 (new 'stack-no-clear 'vector)) + (sv-612 (new 'stack-no-clear 'vector)) ) - (set! (-> this eventual-collision-points (-> this next-computed-collision-point) angle) f30-1) - (set-vector! - sv-608 - (* (rand-vu-float-range 0.7 0.9) (-> this max-ground-radius) (cos f30-1)) - 32768.0 - (* (rand-vu-float-range 0.7 0.9) (-> this max-ground-radius) (sin f30-1)) - 1.0 - ) - ) - (vector+! (-> sv-560 start-pos) (-> this origin) sv-608) - (set! (-> sv-560 start-pos y) (- (-> sv-560 start-pos y) (-> this height-off-ground))) - (+! (-> sv-560 start-pos y) 20480.0) - (set-vector! (-> sv-560 move-dist) 0.0 -65536.0 0.0 1.0) - (let ((v1-29 sv-560)) - (set! (-> v1-29 radius) 40.96) - (set! (-> v1-29 collide-with) (collide-spec backgnd hit-by-others-list pusher impenetrable-obj)) - (set! (-> v1-29 ignore-process0) #f) - (set! (-> v1-29 ignore-process1) #f) - (set! (-> v1-29 ignore-pat) - (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) - ) - (set! (-> v1-29 action-mask) (collide-action solid)) - ) - (let ((f0-25 (fill-and-probe-using-line-sphere *collide-cache* sv-560))) - (when (>= f0-25 0.0) - (vector+*! sv-612 (-> sv-560 start-pos) (-> sv-560 move-dist) f0-25) - (set! (-> this eventual-collision-points (-> this next-computed-collision-point) collision-pt quad) - (-> sv-612 quad) - ) - (+! (-> this eventual-collision-points (-> this next-computed-collision-point) collision-pt y) 204.8) - (set! (-> this eventual-collision-points (-> this next-computed-collision-point) found?) #t) - (set! (-> (the-as - (pointer uint128) - (+ (the-as uint (-> this eventual-collision-points 0 normal)) (* 48 (-> this next-computed-collision-point))) - ) + (let* ((sv-616 (/ 65536.0 (the float (+ sv-564 -1)))) + (f30-1 + (+ (* sv-616 (the float (-> this generate-order-array (-> this next-computed-collision-point)))) + (rand-vu-float-range (* -0.43478262 sv-616) (* 0.43478262 sv-616)) ) - (-> sv-560 best-other-tri normal quad) + ) + ) + (set! (-> this eventual-collision-points (-> this next-computed-collision-point) angle) f30-1) + (set-vector! + sv-608 + (* (rand-vu-float-range 0.7 0.9) (-> this max-ground-radius) (cos f30-1)) + 32768.0 + (* (rand-vu-float-range 0.7 0.9) (-> this max-ground-radius) (sin f30-1)) + 1.0 + ) + ) + (vector+! (-> sv-560 start-pos) (-> this origin) sv-608) + (set! (-> sv-560 start-pos y) (- (-> sv-560 start-pos y) (-> this height-off-ground))) + (+! (-> sv-560 start-pos y) 20480.0) + (set-vector! (-> sv-560 move-dist) 0.0 -65536.0 0.0 1.0) + (let ((v1-29 sv-560)) + (set! (-> v1-29 radius) 40.96) + (set! (-> v1-29 collide-with) (collide-spec backgnd hit-by-others-list pusher impenetrable-obj)) + (set! (-> v1-29 ignore-process0) #f) + (set! (-> v1-29 ignore-process1) #f) + (set! (-> v1-29 ignore-pat) + (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) ) - (let ((s5-1 (new 'stack-no-clear 'vector)) - (s4-0 (new 'stack-no-clear 'vector)) - (s3-1 (vector-float*! (new 'stack-no-clear 'vector) (-> sv-560 best-other-tri normal) 3072.0)) - ) - (let ((s2-0 (vector-normalize-copy! (new 'stack-no-clear 'vector) (-> sv-560 best-other-tri normal) 1.0)) - (s1-0 (new 'stack-no-clear 'vector)) + (set! (-> v1-29 action-mask) (collide-action solid)) + ) + (let ((f0-25 (fill-and-probe-using-line-sphere *collide-cache* sv-560))) + (when (>= f0-25 0.0) + (vector+*! sv-612 (-> sv-560 start-pos) (-> sv-560 move-dist) f0-25) + (set! (-> this eventual-collision-points (-> this next-computed-collision-point) collision-pt quad) + (-> sv-612 quad) ) - (vector-get-unique! s1-0 s2-0) - (vector-cross! s5-1 s2-0 s1-0) - ) - (vector-normalize! s5-1 1.0) - (dotimes (s2-1 4) - (vector-rotate-around-axis! s4-0 s5-1 (* 16384.0 (the float s2-1)) (-> sv-560 best-other-tri normal)) - (vector-normalize! s4-0 10240.0) - (vector+! s4-0 s4-0 s3-1) - (vector+! (-> sv-560 start-pos) sv-612 s4-0) - (vector-float*! (-> sv-560 move-dist) (-> sv-560 best-other-tri normal) -6144.0) - (let ((v1-60 sv-560)) - (set! (-> v1-60 radius) 40.96) - (set! (-> v1-60 collide-with) (collide-spec backgnd hit-by-others-list pusher impenetrable-obj)) - (set! (-> v1-60 ignore-process0) #f) - (set! (-> v1-60 ignore-process1) #f) - (set! (-> v1-60 ignore-pat) - (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) + (+! (-> this eventual-collision-points (-> this next-computed-collision-point) collision-pt y) 204.8) + (set! (-> this eventual-collision-points (-> this next-computed-collision-point) found?) #t) + (set! (-> (the-as + (pointer uint128) + (+ (the-as uint (-> this eventual-collision-points 0 normal)) (* 48 (-> this next-computed-collision-point))) + ) ) - (set! (-> v1-60 action-mask) (collide-action solid)) + (-> sv-560 best-other-tri normal quad) + ) + (let ((s5-1 (new 'stack-no-clear 'vector)) + (s4-0 (new 'stack-no-clear 'vector)) + (s3-1 (vector-float*! (new 'stack-no-clear 'vector) (-> sv-560 best-other-tri normal) 3072.0)) + ) + (let ((s2-0 (vector-normalize-copy! (new 'stack-no-clear 'vector) (-> sv-560 best-other-tri normal) 1.0)) + (s1-0 (new 'stack-no-clear 'vector)) + ) + (vector-get-unique! s1-0 s2-0) + (vector-cross! s5-1 s2-0 s1-0) ) - (when (< (fill-and-probe-using-line-sphere *collide-cache* sv-560) 0.0) - (set! (-> this eventual-collision-points (-> this next-computed-collision-point) found?) #f) - 0 - (goto cfg-11) + (vector-normalize! s5-1 1.0) + (dotimes (s2-1 4) + (vector-rotate-around-axis! s4-0 s5-1 (* 16384.0 (the float s2-1)) (-> sv-560 best-other-tri normal)) + (vector-normalize! s4-0 10240.0) + (vector+! s4-0 s4-0 s3-1) + (vector+! (-> sv-560 start-pos) sv-612 s4-0) + (vector-float*! (-> sv-560 move-dist) (-> sv-560 best-other-tri normal) -6144.0) + (let ((v1-60 sv-560)) + (set! (-> v1-60 radius) 40.96) + (set! (-> v1-60 collide-with) (collide-spec backgnd hit-by-others-list pusher impenetrable-obj)) + (set! (-> v1-60 ignore-process0) #f) + (set! (-> v1-60 ignore-process1) #f) + (set! (-> v1-60 ignore-pat) + (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) + ) + (set! (-> v1-60 action-mask) (collide-action solid)) + ) + (when (< (fill-and-probe-using-line-sphere *collide-cache* sv-560) 0.0) + (set! (-> this eventual-collision-points (-> this next-computed-collision-point) found?) #f) + 0 + (goto cfg-11) + ) ) ) ) @@ -1126,7 +1107,6 @@ ;; WARN: Return type mismatch symbol vs none. (defmethod generate-shockwave-particles ((this gun-red-2-shockwave)) - (local-vars (sv-160 int) (sv-176 shockwave-collision-pt)) (when (and (not (-> this generated-particles?)) (time-elapsed? (-> this state-time) (seconds 0.067))) (set! (-> this generated-particles?) #t) (dotimes (s5-0 150) @@ -1147,28 +1127,30 @@ (s2-1 (new 'stack-no-clear 'vector)) (s1-0 (new 'stack-no-clear 'vector)) ) - (set! sv-160 0) - (while (< sv-160 (-> this next-computed-collision-point)) - (set! sv-176 (-> this eventual-collision-points sv-160)) - (when (-> sv-176 found?) - (let ((f0-9 (deg- (-> sv-176 angle) f26-0))) - (cond - ((and (< f0-9 0.0) (< f24-0 f0-9)) - (set! f24-0 f0-9) - (set! f30-0 (-> sv-176 collision-pt y)) - (set! s0-0 (logior s0-0 1)) - (vector-copy! s2-1 (-> sv-176 normal)) - ) - ((and (>= f0-9 0.0) (< f0-9 f22-0)) - (set! f22-0 f0-9) - (set! f28-0 (-> sv-176 collision-pt y)) - (set! s0-0 (logior s0-0 2)) - (vector-copy! s1-0 (-> sv-176 normal)) - ) + (let ((sv-160 0)) + (while (< sv-160 (-> this next-computed-collision-point)) + (let ((sv-176 (-> this eventual-collision-points sv-160))) + (when (-> sv-176 found?) + (let ((f0-9 (deg- (-> sv-176 angle) f26-0))) + (cond + ((and (< f0-9 0.0) (< f24-0 f0-9)) + (set! f24-0 f0-9) + (set! f30-0 (-> sv-176 collision-pt y)) + (set! s0-0 (logior s0-0 1)) + (vector-copy! s2-1 (-> sv-176 normal)) + ) + ((and (>= f0-9 0.0) (< f0-9 f22-0)) + (set! f22-0 f0-9) + (set! f28-0 (-> sv-176 collision-pt y)) + (set! s0-0 (logior s0-0 2)) + (vector-copy! s1-0 (-> sv-176 normal)) + ) + ) + ) ) ) + (+! sv-160 1) ) - (set! sv-160 (+ sv-160 1)) ) (let ((f26-1 0.0)) (cond @@ -1209,10 +1191,11 @@ (defmethod adjust-warp-radius-and-alpha ((this gun-red-2-shockwave)) (let* ((f0-1 (/ (-> this max-radius) (-> this max-charge-radius))) - (f0-3 - (/ (the float (- (current-time) (-> this state-time))) (* f0-1 (the float (-> this warp-expansion-time)))) + (f0-4 + (square + (/ (the float (- (current-time) (-> this state-time))) (* f0-1 (the float (-> this warp-expansion-time)))) + ) ) - (f0-4 (* f0-3 f0-3)) ) (set! (-> this current-warp-radius) (lerp (-> this min-charge-radius) (-> this max-radius) f0-4)) ) @@ -1345,7 +1328,7 @@ (/ (-> self max-radius) (-> self max-charge-radius)) (let ((f0-15 (/ (-> self max-radius) (meters 20)))) 0.0 - (let ((f1-5 (/ (* 2.0 (- (* 163840.0 f0-15) (-> self max-radius))) (* f0-15 f0-15)))) + (let ((f1-5 (/ (* 2.0 (- (* 163840.0 f0-15) (-> self max-radius))) (square f0-15)))) (set! (-> *part-id-table* 353 init-specs 9 initial-valuef) (* 1.2 f1-5)) ) (let ((v1-15 (the int (* 150.0 f0-15)))) @@ -1554,104 +1537,84 @@ ;; ERROR: Unsupported inline assembly instruction kind - [madda.s f2, f5] ;; ERROR: Unsupported inline assembly instruction kind - [madd.s f1, f3, f6] (defbehavior gun-fire-red-3 target () - (local-vars - (f1-2 float) - (sv-16 gun-info) - (sv-20 vector) - (sv-24 vector) - (sv-28 float) - (sv-144 vector) - (sv-148 vector) - (sv-1952 vector) - (sv-1968 vector) - ) - (set! sv-16 (-> self gun)) - (set! sv-20 (-> self gun fire-dir-out)) - (set! sv-24 (-> self gun fire-point)) - (set! sv-28 (the-as float 266240.0)) - (draw-beam (-> *part-id-table* 217) sv-24 sv-20 #f) - (set! (-> sv-20 y) (fmax 0.3 (-> sv-20 y))) - (vector-normalize! sv-20 1.0) - (let ((v1-17 (cond - ((logtest? (-> group-gun-red3-shot-fired flags) (sp-group-flag sp13)) - (vector-copy! (-> *launch-matrix* trans) (-> sv-16 fire-point)) - (part-tracker-spawn part-tracker-subsampler :to *entity-pool* :group group-gun-red3-shot-fired) - ) - (else - (vector-copy! (-> *launch-matrix* trans) (-> sv-16 fire-point)) - (part-tracker-spawn part-tracker :to *entity-pool* :group group-gun-red3-shot-fired) + (local-vars (f1-2 float)) + (let ((sv-16 (-> self gun)) + (sv-20 (-> self gun fire-dir-out)) + (sv-24 (-> self gun fire-point)) + (sv-28 (the-as float 266240.0)) + ) + (draw-beam (-> *part-id-table* 217) sv-24 sv-20 #f) + (set! (-> sv-20 y) (fmax 0.3 (-> sv-20 y))) + (vector-normalize! sv-20 1.0) + (let ((v1-17 (cond + ((logtest? (-> group-gun-red3-shot-fired flags) (sp-group-flag sp13)) + (vector-copy! (-> *launch-matrix* trans) (-> sv-16 fire-point)) + (part-tracker-spawn part-tracker-subsampler :to *entity-pool* :group group-gun-red3-shot-fired) + ) + (else + (vector-copy! (-> *launch-matrix* trans) (-> sv-16 fire-point)) + (part-tracker-spawn part-tracker :to *entity-pool* :group group-gun-red3-shot-fired) + ) ) ) - ) - ) - (send-event (ppointer->process v1-17) 'clock self) - ) - (set! sv-144 (new 'stack-no-clear 'vector)) - (let ((v1-42 (new 'stack-no-clear 'vector))) - (vector-copy! v1-42 sv-20) - (set! sv-148 v1-42) - ) - (set! (-> sv-148 y) 0.0) - (vector-normalize! sv-148 1.0) - (vector+float*! sv-144 sv-24 sv-148 143360.0) - (set! (-> sv-144 w) 143360.0) - (let ((f30-0 4096000.0) - (s5-0 #f) - (gp-2 (the-as process-focusable #f)) - ) - (let ((a1-11 (new 'stack-no-clear 'event-message-block))) - (set! (-> a1-11 from) (process->ppointer self)) - (set! (-> a1-11 num-params) 0) - (set! (-> a1-11 message) 'get-vehicle) - (let ((s4-0 (send-event-function *target* a1-11))) - (let ((s3-0 (new 'stack-no-clear 'array 'collide-shape 384))) - (countdown (s2-0 (fill-actor-list-for-box *actor-hash* sv-144 s3-0 384)) - (let ((v1-54 (as-type (-> s3-0 s2-0) collide-shape))) - (when v1-54 - (let ((s1-1 (as-type (-> v1-54 process) process-focusable))) - (when s1-1 - (when (and (!= *target* s1-1) - (not (focus-test? (the-as process-focusable s1-1) disable dead inactive gun-no-target)) - (pc-check-focus-fix (the-as process-focusable s1-1)) ;; og:preserve-this - (or (logtest? (process-mask crate enemy vehicle civilian) (-> s1-1 mask)) - (and (logtest? (process-mask guard) (-> s1-1 mask)) (-> *setting-control* user-current gun-target-guards?)) - ) - (!= s4-0 s1-1) - ) - (when (or (not s5-0) (logtest? (process-mask enemy guard) (-> s1-1 mask))) - (set! sv-1952 (new 'stack-no-clear 'vector)) - (let ((v1-71 (-> (get-trans (the-as process-focusable s1-1) 0) quad))) - (set! (-> sv-1952 quad) v1-71) - ) - (set! sv-1968 (vector-normalize-copy! (new 'stack-no-clear 'vector) sv-148 1.0)) - (let ((s0-1 (new 'stack-no-clear 'vector))) - (let ((a1-18 s0-1) - (v1-72 sv-24) - ) - (vector-! a1-18 sv-1952 v1-72) - ) - (let ((f0-7 (vector-normalize-ret-len! s0-1 1.0))) - (let* ((v1-73 s0-1) - ; (f1-1 (-> sv-1968 x)) - ; (f2-0 (-> sv-1968 y)) - ; (f3-0 (-> sv-1968 z)) - ; (f4-0 (-> v1-73 x)) - ; (f5-0 (-> v1-73 y)) - ; (f6-0 (-> v1-73 z)) - ) - ;; og:preserve-this vector-dot - ; (.mula.s f1-1 f4-0) - ; (.madda.s f2-0 f5-0) - ; (.madd.s f1-2 f3-0 f6-0) - (set! f1-2 (vector-dot sv-1968 v1-73)) - ) - (let ((f1-3 f1-2) - (v1-75 (and (not s5-0) (logtest? (process-mask enemy guard) (-> s1-1 mask)))) + ) + (send-event (ppointer->process v1-17) 'clock self) + ) + (let ((sv-144 (new 'stack-no-clear 'vector)) + (v1-42 (new 'stack-no-clear 'vector)) + ) + (vector-copy! v1-42 sv-20) + (let ((sv-148 v1-42)) + (set! (-> sv-148 y) 0.0) + (vector-normalize! sv-148 1.0) + (vector+float*! sv-144 sv-24 sv-148 143360.0) + (set! (-> sv-144 w) 143360.0) + (let ((f30-0 4096000.0) + (s5-0 #f) + (gp-2 (the-as process-focusable #f)) + ) + (let ((a1-11 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-11 from) (process->ppointer self)) + (set! (-> a1-11 num-params) 0) + (set! (-> a1-11 message) 'get-vehicle) + (let ((s4-0 (send-event-function *target* a1-11))) + (let ((s3-0 (new 'stack-no-clear 'array 'collide-shape 384))) + (countdown (s2-0 (fill-actor-list-for-box *actor-hash* sv-144 s3-0 384)) + (let ((v1-54 (as-type (-> s3-0 s2-0) collide-shape))) + (when v1-54 + (let ((s1-1 (as-type (-> v1-54 process) process-focusable))) + (when s1-1 + (when (and (!= *target* s1-1) + (not (focus-test? (the-as process-focusable s1-1) disable dead inactive gun-no-target)) + ;; og:preserve-this + (pc-check-focus-fix s1-1) + (or (logtest? (process-mask crate enemy vehicle civilian) (-> s1-1 mask)) + (and (logtest? (process-mask guard) (-> s1-1 mask)) (-> *setting-control* user-current gun-target-guards?)) + ) + (!= s4-0 s1-1) + ) + (when (or (not s5-0) (logtest? (process-mask enemy guard) (-> s1-1 mask))) + (let ((sv-1952 (new 'stack-no-clear 'vector))) + (vector-copy! sv-1952 (get-trans (the-as process-focusable s1-1) 0)) + (let ((sv-1968 (vector-normalize-copy! (new 'stack-no-clear 'vector) sv-148 1.0)) + (s0-1 (new 'stack-no-clear 'vector)) + ) + (vector-! s0-1 sv-1952 sv-24) + (let ((f0-7 (vector-normalize-ret-len! s0-1 1.0))) + (let* ((v1-73 s0-1)) + (set! f1-2 (vector-dot sv-1968 v1-73)) + ) + (let ((f1-3 f1-2) + (v1-75 (and (not s5-0) (logtest? (process-mask enemy guard) (-> s1-1 mask)))) + ) + (when (and (< 0.707 f1-3) (< (fabs (-> s0-1 y)) 28672.0) (or v1-75 (< f0-7 f30-0))) + (set! s5-0 v1-75) + (set! f30-0 f0-7) + (set! gp-2 (the-as process-focusable s1-1)) + ) + ) + ) ) - (when (and (< 0.707 f1-3) (< (fabs (-> s0-1 y)) 28672.0) (or v1-75 (< f0-7 f30-0))) - (set! s5-0 v1-75) - (set! f30-0 f0-7) - (set! gp-2 (the-as process-focusable s1-1)) ) ) ) @@ -1661,49 +1624,49 @@ ) ) ) + ;; og:preserve-this *snip* there was dead code here! ) ) - ) - ;; og:preserve-this *snip* there was dead code here! - ) - ) - (when gp-2 - (let ((s5-1 (new 'stack-no-clear 'vector))) - (vector-copy! s5-1 (get-trans gp-2 3)) - (let ((f0-10 (vector-vector-xz-distance s5-1 (-> sv-16 fire-point))) - (f1-13 (fabs (- (-> s5-1 y) (-> sv-16 fire-point y)))) + (when gp-2 + (let ((s5-1 (new 'stack-no-clear 'vector))) + (vector-copy! s5-1 (get-trans gp-2 3)) + (let ((f0-10 (vector-vector-xz-distance s5-1 (-> sv-16 fire-point))) + (f1-13 (fabs (- (-> s5-1 y) (-> sv-16 fire-point y)))) + ) + 0.0 + (when (< f1-13 24576.0) + (let ((f0-14 (* 0.5 (asin (/ (* 184320.0 f0-10) (* sv-28 sv-28)))))) + (set! (-> sv-20 y) (sin f0-14)) + ) + (vector-normalize! sv-20 1.0) + ) + ) ) - 0.0 - (when (< f1-13 24576.0) - (let ((f0-14 (* 0.5 (asin (/ (* 184320.0 f0-10) (* sv-28 sv-28)))))) - (set! (-> sv-20 y) (sin f0-14)) - ) - (vector-normalize! sv-20 1.0) ) ) ) ) - ) - (let ((a1-33 (new 'stack-no-clear 'projectile-init-by-other-params))) - (set! (-> a1-33 ent) (-> self entity)) - (set! (-> a1-33 charge) 1.0) - (set! (-> a1-33 options) (projectile-options)) - (logclear! (-> a1-33 options) (projectile-options po14 po15 po16)) - (vector-copy! (-> a1-33 pos) sv-24) - (vector-copy! (-> a1-33 vel) (vector-float*! (new 'stack-no-clear 'vector) sv-20 sv-28)) - (set! (-> a1-33 notify-handle) (the-as handle #f)) - (set! (-> a1-33 owner-handle) (process->handle self)) - (set! (-> a1-33 target-handle) (the-as handle #f)) - (set! (-> a1-33 target-pos quad) (the-as uint128 0)) - (set! (-> a1-33 ignore-handle) (process->handle self)) - (let* ((v1-127 *game-info*) - (a0-100 (+ (-> v1-127 attack-id) 1)) - ) - (set! (-> v1-127 attack-id) a0-100) - (set! (-> a1-33 attack-id) a0-100) + (let ((a1-33 (new 'stack-no-clear 'projectile-init-by-other-params))) + (set! (-> a1-33 ent) (-> self entity)) + (set! (-> a1-33 charge) 1.0) + (set! (-> a1-33 options) (projectile-options)) + (logclear! (-> a1-33 options) (projectile-options po14 po15 po16)) + (vector-copy! (-> a1-33 pos) sv-24) + (vector-copy! (-> a1-33 vel) (vector-float*! (new 'stack-no-clear 'vector) sv-20 sv-28)) + (set! (-> a1-33 notify-handle) (the-as handle #f)) + (set! (-> a1-33 owner-handle) (process->handle self)) + (set! (-> a1-33 target-handle) (the-as handle #f)) + (set! (-> a1-33 target-pos quad) (the-as uint128 0)) + (set! (-> a1-33 ignore-handle) (process->handle self)) + (let* ((v1-127 *game-info*) + (a0-100 (+ (-> v1-127 attack-id) 1)) + ) + (set! (-> v1-127 attack-id) a0-100) + (set! (-> a1-33 attack-id) a0-100) + ) + (set! (-> a1-33 timeout) (seconds 4)) + (the-as gun-red-3-grenade (spawn-projectile gun-red-3-grenade a1-33 self *default-dead-pool*)) ) - (set! (-> a1-33 timeout) (seconds 4)) - (the-as gun-red-3-grenade (spawn-projectile gun-red-3-grenade a1-33 self *default-dead-pool*)) ) ) @@ -2103,14 +2066,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)) ) ) ) @@ -2144,14 +2103,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/goal_src/jak3/engine/target/gun/gun-yellow-shot.gc b/goal_src/jak3/engine/target/gun/gun-yellow-shot.gc index fb69be11ab..654ad53679 100644 --- a/goal_src/jak3/engine/target/gun/gun-yellow-shot.gc +++ b/goal_src/jak3/engine/target/gun/gun-yellow-shot.gc @@ -165,17 +165,6 @@ ) (defmethod find-targets ((this gun-yellow-3-saucer)) - (local-vars - (sv-16 int) - (sv-1072 vector) - (sv-1076 (inline-array target-quality-info-saucer)) - (sv-1080 int) - (sv-1088 float) - (sv-3792 (pointer int8)) - (sv-3800 int) - (sv-3808 float) - (sv-3812 symbol) - ) (if (not (-> this firing?)) (return 0) ) @@ -194,55 +183,58 @@ ) (set-time! (-> this last-deduct-ammo-time)) ) - (set! sv-16 2) - (set! sv-1072 (new 'stack-no-clear 'vector)) - (set! sv-1076 (new 'stack-no-clear 'inline-array 'target-quality-info-saucer 66)) - (set! sv-1080 0) - (set! sv-1088 (the-as float 0.0)) - (vector-copy! sv-1072 (-> this root trans)) - (set! (-> sv-1072 w) 143360.0) - (let ((s5-0 (new 'stack-no-clear 'array 'collide-shape 384))) - (countdown (s4-0 (fill-actor-list-for-box *actor-hash* sv-1072 s5-0 384)) - (let ((v1-34 (as-type (-> s5-0 s4-0) collide-shape))) - (when v1-34 - (let ((s3-1 (as-type (-> v1-34 process) process-focusable))) - (when s3-1 - (when (and (!= *target* s3-1) - (not (focus-test? (the-as process-focusable s3-1) disable dead inactive gun-no-target)) - (pc-check-focus-fix (the-as process-focusable s3-1)) ;; og:preserve-this - (or (logtest? (process-mask enemy vehicle civilian) (-> s3-1 mask)) - (and (logtest? (process-mask guard) (-> s3-1 mask)) (-> *setting-control* user-current gun-target-guards?)) - ) - ) - (let ((s2-1 (new 'stack-no-clear 'collide-query))) - (vector-copy! (-> s2-1 start-pos) (-> this root trans)) - (vector-! (-> s2-1 move-dist) (get-trans (the-as process-focusable s3-1) 3) (-> this root trans)) - (let ((v1-47 s2-1)) - (set! (-> v1-47 radius) 40.96) - (set! (-> v1-47 collide-with) (collide-spec backgnd)) - (set! (-> v1-47 ignore-process0) #f) - (set! (-> v1-47 ignore-process1) #f) - (set! (-> v1-47 ignore-pat) - (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) - ) - (set! (-> v1-47 action-mask) (collide-action solid)) - ) - (when (< (fill-and-probe-using-line-sphere *collide-cache* s2-1) 0.0) - (set! (-> sv-1076 sv-1080 targ) (process->handle s3-1)) - (let ((f0-11 1.0)) - (if (and (nonzero? (-> s3-1 draw)) (logtest? (-> s3-1 draw status) (draw-control-status on-screen))) - (set! f0-11 (+ 2.0 f0-11)) - ) - (if (logtest? (process-mask enemy guard) (-> s3-1 mask)) - (set! f0-11 (+ 28.0 f0-11)) - ) - (if (logtest? (process-mask vehicle civilian) (-> s3-1 mask)) - (set! f0-11 (/ f0-11 4)) - ) - (set! (-> sv-1076 sv-1080 value) f0-11) - (set! sv-1088 (+ sv-1088 f0-11)) + (let ((sv-16 2) + (sv-1072 (new 'stack-no-clear 'vector)) + (sv-1076 (new 'stack-no-clear 'inline-array 'target-quality-info-saucer 66)) + (sv-1080 0) + (sv-1088 (the-as float 0.0)) + ) + (vector-copy! sv-1072 (-> this root trans)) + (set! (-> sv-1072 w) 143360.0) + (let ((s5-0 (new 'stack-no-clear 'array 'collide-shape 384))) + (countdown (s4-0 (fill-actor-list-for-box *actor-hash* sv-1072 s5-0 384)) + (let ((v1-34 (as-type (-> s5-0 s4-0) collide-shape))) + (when v1-34 + (let ((s3-1 (as-type (-> v1-34 process) process-focusable))) + (when s3-1 + (when (and (!= *target* s3-1) + (not (focus-test? (the-as process-focusable s3-1) disable dead inactive gun-no-target)) + ;; og:preserve-this + (pc-check-focus-fix s3-1) + (or (logtest? (process-mask enemy vehicle civilian) (-> s3-1 mask)) + (and (logtest? (process-mask guard) (-> s3-1 mask)) (-> *setting-control* user-current gun-target-guards?)) + ) + ) + (let ((s2-1 (new 'stack-no-clear 'collide-query))) + (vector-copy! (-> s2-1 start-pos) (-> this root trans)) + (vector-! (-> s2-1 move-dist) (get-trans (the-as process-focusable s3-1) 3) (-> this root trans)) + (let ((v1-47 s2-1)) + (set! (-> v1-47 radius) 40.96) + (set! (-> v1-47 collide-with) (collide-spec backgnd)) + (set! (-> v1-47 ignore-process0) #f) + (set! (-> v1-47 ignore-process1) #f) + (set! (-> v1-47 ignore-pat) + (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) + ) + (set! (-> v1-47 action-mask) (collide-action solid)) + ) + (when (< (fill-and-probe-using-line-sphere *collide-cache* s2-1) 0.0) + (set! (-> sv-1076 sv-1080 targ) (process->handle s3-1)) + (let ((f0-11 1.0)) + (if (and (nonzero? (-> s3-1 draw)) (logtest? (-> s3-1 draw status) (draw-control-status on-screen))) + (set! f0-11 (+ 2.0 f0-11)) + ) + (if (logtest? (process-mask enemy guard) (-> s3-1 mask)) + (set! f0-11 (+ 28.0 f0-11)) + ) + (if (logtest? (process-mask vehicle civilian) (-> s3-1 mask)) + (set! f0-11 (/ f0-11 4)) + ) + (set! (-> sv-1076 sv-1080 value) f0-11) + (+! sv-1088 f0-11) + ) + (+! sv-1080 1) ) - (set! sv-1080 (+ sv-1080 1)) ) ) ) @@ -251,57 +243,61 @@ ) ) ) - ) - ;; og:preserve-this *snip* there was dead code here! - (set! sv-3792 (new 'stack-no-clear 'array 'int8 100)) - (set! sv-3800 0) - (set! sv-3808 (the-as float 0.0)) - (set! sv-3812 (the-as symbol #f)) - (when (> sv-1080 0) - (dotimes (s5-2 sv-16) - (let ((f0-20 (rand-vu-float-range 0.0 sv-1088))) - (dotimes (v1-127 sv-1080) - (set! sv-3808 (+ sv-3808 (-> sv-1076 v1-127 value))) - (when (< f0-20 sv-3808) - (dotimes (a0-82 sv-3800) - (when (= (-> sv-3792 a0-82) v1-127) - 0 - (goto cfg-91) + ;; og:preserve-this *snip* there was dead code here! + (let ((sv-3792 (new 'stack-no-clear 'array 'int8 100)) + (sv-3800 0) + ) + (let ((sv-3808 (the-as float 0.0))) + (let ((sv-3812 (the-as symbol #f))) + ) + (when (> sv-1080 0) + (dotimes (s5-2 sv-16) + (let ((f0-20 (rand-vu-float-range 0.0 sv-1088))) + (dotimes (v1-127 sv-1080) + (+! sv-3808 (-> sv-1076 v1-127 value)) + (when (< f0-20 sv-3808) + (dotimes (a0-82 sv-3800) + (when (= (-> sv-3792 a0-82) v1-127) + 0 + (goto cfg-91) + ) + ) + (set! (-> sv-3792 sv-3800) v1-127) + (+! sv-3800 1) + 0 + (goto cfg-94) + ) + (label cfg-91) ) ) - (set! (-> sv-3792 sv-3800) v1-127) - (set! sv-3800 (+ sv-3800 1)) - 0 - (goto cfg-94) + (label cfg-94) ) - (label cfg-91) ) ) - (label cfg-94) - ) - ) - (dotimes (s5-3 sv-3800) - (let* ((a0-95 (as-type (handle->process (-> sv-1076 (-> sv-3792 s5-3) targ)) process-focusable)) - (s4-5 this) - (s3-4 (method-of-object s4-5 spawn-shot)) - (s2-2 (new 'stack-no-clear 'vector)) - ) - (vector-copy! s2-2 (get-trans (the-as process-focusable a0-95) 0)) - (s3-4 s4-5 s2-2) - ) - ) - (let ((s5-4 sv-3800) - (s4-6 (+ sv-16 -1)) + (dotimes (s5-3 sv-3800) + (let* ((a0-95 (as-type (handle->process (-> sv-1076 (-> sv-3792 s5-3) targ)) process-focusable)) + (s4-5 this) + (s3-4 (method-of-object s4-5 spawn-shot)) + (s2-2 (new 'stack-no-clear 'vector)) + ) + (vector-copy! s2-2 (get-trans (the-as process-focusable a0-95) 0)) + (s3-4 s4-5 s2-2) + ) ) - (while (>= s4-6 s5-4) - (let ((s3-5 (new 'stack-no-clear 'vector))) - (set! (-> s3-5 x) (rand-vu-float-range -1.0 1.0)) - (set! (-> s3-5 y) (rand-vu-float-range -0.85 -0.3)) - (set! (-> s3-5 z) (rand-vu-float-range -1.0 1.0)) - (vector+float*! s3-5 (-> this root trans) s3-5 40960.0) - (spawn-shot this s3-5) + (let ((s5-4 sv-3800) + (s4-6 (+ sv-16 -1)) + ) + (while (>= s4-6 s5-4) + (let ((s3-5 (new 'stack-no-clear 'vector))) + (set! (-> s3-5 x) (rand-vu-float-range -1.0 1.0)) + (set! (-> s3-5 y) (rand-vu-float-range -0.85 -0.3)) + (set! (-> s3-5 z) (rand-vu-float-range -1.0 1.0)) + (vector+float*! s3-5 (-> this root trans) s3-5 40960.0) + (spawn-shot this s3-5) + ) + (+! s5-4 1) + ) ) - (+! s5-4 1) ) ) (the-as int #f) @@ -1083,7 +1079,7 @@ ) (let ((f0-3 (vector-dot gp-1 (-> (camera-matrix) fvec)))) (when (< 0.0 f0-3) - (let ((f2-0 (* f0-3 f0-3)) + (let ((f2-0 (square f0-3)) (f0-4 (-> *part-id-table* 266 init-specs 8 initial-valuef)) (f1-3 (-> *part-id-table* 266 init-specs 8 random-rangef)) ) @@ -1273,78 +1269,67 @@ ;; WARN: Return type mismatch symbol vs none. (defbehavior gun-yellow-shot-do-deflect gun-yellow-shot-2 ((arg0 gun-yellow-shot-2) (arg1 vector) (arg2 vector) (arg3 vector)) - (local-vars - (sv-32 vector) - (sv-36 gun-yellow-shot-2) - (sv-40 process) - (sv-80 vector) - (sv-84 vector) - (sv-112 vector) - (sv-116 number) - (sv-120 int) - (sv-128 symbol) - (sv-136 handle) - (sv-1680 vector) - (sv-1712 vector) - (sv-1716 float) - (sv-1720 float) - (sv-1724 vector) - (sv-1744 vector) - (sv-1748 float) - (sv-1752 float) + (let* ((f0-1 (vector-dot arg2 arg3)) + (sv-32 (vector-float*! (new 'stack-no-clear 'vector) arg3 (* -2.0 f0-1))) + ) + (vector+! arg1 arg2 sv-32) ) - (let ((f0-1 (vector-dot arg2 arg3))) - (set! sv-32 (vector-float*! (new 'stack-no-clear 'vector) arg3 (* -2.0 f0-1))) - ) - (vector+! arg1 arg2 sv-32) (if (< 0.2 (-> arg1 y)) (set! (-> arg1 y) (fmax 0.2 (-> arg2 y))) ) - (let ((s4-0 arg0)) - (set! sv-36 s4-0) - (set! sv-40 (handle->process (-> sv-36 last-hit-enemy))) + (let* ((s4-0 arg0) + (sv-36 s4-0) + (sv-40 (handle->process (-> sv-36 last-hit-enemy))) + ) (when (and (time-elapsed? (-> sv-36 last-collide-time) (seconds 0.05)) (rand-vu-percent? 0.75)) - (set! sv-80 (vector-normalize-copy! (new 'stack-no-clear 'vector) arg1 204800.0)) - (set! sv-84 (new 'stack-no-clear 'vector)) - (vector-copy! sv-84 (-> s4-0 root trans)) - (vector+! sv-84 sv-84 sv-80) - (set! (-> sv-84 w) 409600.0) - (set! (-> sv-80 y) 0.0) - (vector-normalize! sv-80 1.0) - (set! sv-112 (vector+! (new 'stack-no-clear 'vector) (-> s4-0 root trans) arg1)) - (set! sv-116 409600000000000000000000.0) - (set! sv-120 -55041728) - (set! sv-128 (the-as symbol #f)) - (set! sv-136 (the-as handle #f)) - (let ((s3-0 (new 'stack-no-clear 'array 'collide-shape 384))) - (countdown (s2-0 (fill-actor-list-for-box *actor-hash* sv-84 s3-0 384)) - (let ((v1-31 (as-type (-> s3-0 s2-0) collide-shape))) - (when v1-31 - (let ((s1-1 (as-type (-> v1-31 process) process-focusable))) - (when s1-1 - (when (and (!= s4-0 s1-1) - (!= s1-1 sv-40) - (not (focus-test? (the-as process-focusable s1-1) disable dead inactive gun-no-target)) - (or (logtest? (process-mask enemy civilian) (-> s1-1 mask)) - (and (logtest? (process-mask guard) (-> s1-1 mask)) (-> *setting-control* user-current gun-target-guards?)) + (let ((sv-80 (vector-normalize-copy! (new 'stack-no-clear 'vector) arg1 204800.0)) + (sv-84 (new 'stack-no-clear 'vector)) + ) + (vector-copy! sv-84 (-> s4-0 root trans)) + (vector+! sv-84 sv-84 sv-80) + (set! (-> sv-84 w) 409600.0) + (set! (-> sv-80 y) 0.0) + (vector-normalize! sv-80 1.0) + (let ((sv-112 (vector+! (new 'stack-no-clear 'vector) (-> s4-0 root trans) arg1)) + (sv-116 409600000000000000000000.0) + (sv-120 -55041728) + (sv-128 (the-as symbol #f)) + (sv-136 (the-as handle #f)) + ) + (let ((s3-0 (new 'stack-no-clear 'array 'collide-shape 384))) + (countdown (s2-0 (fill-actor-list-for-box *actor-hash* sv-84 s3-0 384)) + (let ((v1-31 (as-type (-> s3-0 s2-0) collide-shape))) + (when v1-31 + (let ((s1-1 (as-type (-> v1-31 process) process-focusable))) + (when s1-1 + (when (and (!= s4-0 s1-1) + (!= s1-1 sv-40) + (not (focus-test? (the-as process-focusable s1-1) disable dead inactive gun-no-target)) + (or (logtest? (process-mask enemy civilian) (-> s1-1 mask)) + (and (logtest? (process-mask guard) (-> s1-1 mask)) (-> *setting-control* user-current gun-target-guards?)) + ) ) - ) - (when (or (not sv-128) - (logtest? (process-mask enemy guard) (-> s1-1 mask)) - (not (is-in-ignore-list? sv-36 (process->handle s1-1))) + (when (or (not sv-128) + (logtest? (process-mask enemy guard) (-> s1-1 mask)) + (not (is-in-ignore-list? sv-36 (process->handle s1-1))) + ) + (let* ((sv-1680 (get-trans (the-as process-focusable s1-1) 3)) + (sv-1712 (vector-! (new 'stack-no-clear 'vector) sv-1680 (-> s4-0 root trans))) + (sv-1716 (the-as float 0.0)) + ) + (set! (-> sv-1712 y) 0.0) + (let ((sv-1720 (vector-normalize-ret-len! sv-1712 1.0))) + (set! sv-1716 (vector-dot sv-1712 sv-80)) + (when (or (< (the float sv-120) sv-1716) (and (< 0.707 sv-1716) (= sv-136 *last-hit-deflect-target-handle*))) + (set! sv-116 sv-1720) + (set! sv-120 (the int sv-1716)) + (vector-copy! sv-112 sv-1680) + (set! sv-128 (logtest? (process-mask enemy) (-> s1-1 mask))) + (set! sv-136 (process->handle s1-1)) + ) ) - (set! sv-1680 (get-trans (the-as process-focusable s1-1) 3)) - (set! sv-1712 (vector-! (new 'stack-no-clear 'vector) sv-1680 (-> s4-0 root trans))) - (set! sv-1716 (the-as float 0.0)) - (set! (-> sv-1712 y) 0.0) - (set! sv-1720 (vector-normalize-ret-len! sv-1712 1.0)) - (set! sv-1716 (vector-dot sv-1712 sv-80)) - (when (or (< (the float sv-120) sv-1716) (and (< 0.707 sv-1716) (= sv-136 *last-hit-deflect-target-handle*))) - (set! sv-116 sv-1720) - (set! sv-120 (the int sv-1716)) - (vector-copy! sv-112 sv-1680) - (set! sv-128 (logtest? (process-mask enemy) (-> s1-1 mask))) - (set! sv-136 (process->handle s1-1)) + ) + ) ) ) ) @@ -1352,40 +1337,43 @@ ) ) ) - ) - ) - (let ((s3-1 (the-as target (as-type *target* process-focusable)))) - (when (and s3-1 (< (vector-vector-distance (get-trans s3-1 0) sv-84) (-> sv-84 w))) - (when (and (!= s4-0 s3-1) - (!= s3-1 sv-40) - (not (focus-test? s3-1 disable dead inactive gun-no-target)) - (or (logtest? (process-mask enemy civilian) (-> s3-1 mask)) - (and (logtest? (process-mask guard) (-> s3-1 mask)) (-> *setting-control* user-current gun-target-guards?)) + (let ((s3-1 (the-as target (as-type *target* process-focusable)))) + (when (and s3-1 (< (vector-vector-distance (get-trans s3-1 0) sv-84) (-> sv-84 w))) + (when (and (!= s4-0 s3-1) + (!= s3-1 sv-40) + (not (focus-test? s3-1 disable dead inactive gun-no-target)) + (or (logtest? (process-mask enemy civilian) (-> s3-1 mask)) + (and (logtest? (process-mask guard) (-> s3-1 mask)) (-> *setting-control* user-current gun-target-guards?)) + ) ) - ) - (when (or (not sv-128) - (logtest? (process-mask enemy guard) (-> s3-1 mask)) - (not (is-in-ignore-list? sv-36 (process->handle s3-1))) + (when (or (not sv-128) + (logtest? (process-mask enemy guard) (-> s3-1 mask)) + (not (is-in-ignore-list? sv-36 (process->handle s3-1))) + ) + (let* ((sv-1724 (get-trans s3-1 3)) + (sv-1744 (vector-! (new 'stack-no-clear 'vector) sv-1724 (-> s4-0 root trans))) + (sv-1748 (the-as float 0.0)) + ) + (set! (-> sv-1744 y) 0.0) + (let ((sv-1752 (vector-normalize-ret-len! sv-1744 1.0))) + (set! sv-1748 (vector-dot sv-1744 sv-80)) + (when (or (< (the float sv-120) sv-1748) (and (< 0.707 sv-1748) (= sv-136 *last-hit-deflect-target-handle*))) + (set! sv-116 sv-1752) + (set! sv-120 (the int sv-1748)) + (vector-copy! sv-112 sv-1724) + (set! sv-128 (logtest? (process-mask enemy) (-> s3-1 mask))) + (set! sv-136 (process->handle s3-1)) + ) ) - (set! sv-1724 (get-trans s3-1 3)) - (set! sv-1744 (vector-! (new 'stack-no-clear 'vector) sv-1724 (-> s4-0 root trans))) - (set! sv-1748 (the-as float 0.0)) - (set! (-> sv-1744 y) 0.0) - (set! sv-1752 (vector-normalize-ret-len! sv-1744 1.0)) - (set! sv-1748 (vector-dot sv-1744 sv-80)) - (when (or (< (the float sv-120) sv-1748) (and (< 0.707 sv-1748) (= sv-136 *last-hit-deflect-target-handle*))) - (set! sv-116 sv-1752) - (set! sv-120 (the int sv-1748)) - (vector-copy! sv-112 sv-1724) - (set! sv-128 (logtest? (process-mask enemy) (-> s3-1 mask))) - (set! sv-136 (process->handle s3-1)) + ) + ) ) ) ) + (vector-! arg1 sv-112 (-> s4-0 root trans)) + (set! *last-hit-deflect-target-handle* (the-as (pointer process) sv-136)) ) ) - (vector-! arg1 sv-112 (-> s4-0 root trans)) - (set! *last-hit-deflect-target-handle* (the-as (pointer process) sv-136)) ) ) (vector-normalize! arg1 546133.3) diff --git a/goal_src/jak3/engine/target/logic-target.gc b/goal_src/jak3/engine/target/logic-target.gc index 6bf9352643..0d5b1630e4 100644 --- a/goal_src/jak3/engine/target/logic-target.gc +++ b/goal_src/jak3/engine/target/logic-target.gc @@ -120,232 +120,191 @@ ;; WARN: new jak 2 until loop case, check carefully (defun-debug target-history-print ((arg0 history-iterator)) - (local-vars - (sv-16 object) - (sv-24 int) - (sv-32 collide-status) - (sv-40 number) - (sv-44 vector) - (sv-48 vector) - (sv-52 vector) - (sv-56 vector) - (sv-60 vector) - (sv-64 vector) - (sv-68 number) - (sv-72 history-elt) - (sv-80 time-frame) - (sv-88 uint) + (let ((sv-16 (-> arg0 out))) ) - (set! sv-16 (-> arg0 out)) - (set! sv-24 0) - (set! sv-32 (collide-status)) - (set! sv-40 0) - (set! sv-44 *zero-vector*) - (set! sv-48 *zero-vector*) - (set! sv-52 *zero-vector*) - (set! sv-56 *zero-vector*) - (set! sv-60 *zero-vector*) - (set! sv-64 *zero-vector*) - (set! sv-68 0) - (until #f - (set! sv-72 (update-entries! arg0)) - (if (not sv-72) - (return #f) + (let ((sv-24 0) + (sv-32 (collide-status)) + (sv-40 0.0) + (sv-44 *zero-vector*) + (sv-48 *zero-vector*) + (sv-52 *zero-vector*) + (sv-56 *zero-vector*) + (sv-60 *zero-vector*) + (sv-64 *zero-vector*) + (sv-68 0.0) ) - (set! sv-80 (frame-counter-delta arg0 sv-72)) - (set! sv-88 (-> sv-72 record-id)) - (when (!= sv-24 sv-88) - (set! sv-24 (the-as int sv-88)) - (format - (-> arg0 out) - "~6D ~8S #x~8X " - sv-80 - (if (logtest? sv-32 (collide-status no-touch)) - "air" - (-> *pat-mode-info* (shr (shl (the-as int sv-68) 54) 61) name) + (until #f + (let ((sv-72 (update-entries! arg0))) + (if (not sv-72) + (return #f) ) - sv-32 - ) - (format - (-> arg0 out) - "~C~C~C~C~C~C" - (if (not (logtest? (the-as int sv-40) 1)) - 103 - 87 - ) - (if (not (logtest? (the-as int sv-40) 2)) - 103 - 87 - ) - (cond - ((logtest? (the-as int sv-40) 2048) - 71 - ) - ((not (logtest? (the-as int sv-40) 4)) - 103 - ) - (else - 87 + (let ((sv-80 (frame-counter-delta arg0 sv-72)) + (sv-88 (-> sv-72 record-id)) + ) + (when (!= sv-24 sv-88) + (set! sv-24 (the-as int sv-88)) + (format + (-> arg0 out) + "~6D ~8S #x~8X " + sv-80 + (if (logtest? sv-32 (collide-status no-touch)) + "air" + (-> *pat-mode-info* (shr (shl (the-as int sv-68) 54) 61) name) + ) + sv-32 + ) + (format + (-> arg0 out) + "~C~C~C~C~C~C" + (if (not (logtest? (the-as int sv-40) 1)) + 103 + 87 + ) + (if (not (logtest? (the-as int sv-40) 2)) + 103 + 87 + ) + (cond + ((logtest? (the-as int sv-40) 2048) + 71 + ) + ((not (logtest? (the-as int sv-40) 4)) + 103 + ) + (else + 87 + ) + ) + (cond + ((logtest? (the-as int sv-40) 512) + 66 + ) + ((logtest? (the-as int sv-40) 8) + 76 + ) + (else + 99 + ) + ) + (if (not (logtest? (the-as int sv-40) 16)) + 110 + 66 + ) + (if (not (logtest? (the-as int sv-40) 32)) + 103 + 65 + ) + ) + (format + (-> arg0 out) + "~C~C " + (cond + ((logtest? #x10000 (the-as int sv-40)) + 80 + ) + ((logtest? (the-as int sv-40) #x8000) + 85 + ) + ((logtest? (the-as int sv-40) 64) + 78 + ) + (else + 95 + ) + ) + (cond + ((logtest? (the-as int sv-40) 1024) + 76 + ) + ((logtest? (the-as int sv-40) 256) + 67 + ) + ((logtest? (the-as int sv-40) 128) + 108 + ) + (else + 95 + ) + ) + ) + (format (-> arg0 out) "trans: ~6,,2m ~6,,2m ~6,,2m " (-> sv-44 x) (-> sv-44 y) (-> sv-44 z)) + (format (-> arg0 out) "int: ~6,,2m ~6,,2m ~6,,2m " (-> sv-56 x) (-> sv-56 y) (-> sv-56 z)) + (format (-> arg0 out) "vel: ~6,,2m ~6,,2m ~6,,2m " (-> sv-48 x) (-> sv-48 y) (-> sv-48 z)) + (format (-> arg0 out) "vel-out: ~6,,2m ~6,,2m ~6,,2m " (-> sv-52 x) (-> sv-52 y) (-> sv-52 z)) + (format (-> arg0 out) "normal: ~6,,2f ~6,,2f ~6,,2f " (-> sv-60 x) (-> sv-60 y) (-> sv-60 z)) + (format (-> arg0 out) "local: ~6,,2f ~6,,2f ~6,,2f " (-> sv-64 x) (-> sv-64 y) (-> sv-64 z)) + (format (-> arg0 out) "~%") ) ) - (cond - ((logtest? (the-as int sv-40) 512) - 66 + (case (-> sv-72 channel) + (((history-channel trans)) + (set! sv-44 (-> sv-72 vector)) ) - ((logtest? (the-as int sv-40) 8) - 76 + (((history-channel transv-in)) + (set! sv-48 (-> sv-72 vector)) ) - (else - 99 - ) - ) - (if (not (logtest? (the-as int sv-40) 16)) - 110 - 66 - ) - (if (not (logtest? (the-as int sv-40) 32)) - 103 - 65 - ) - ) - (format - (-> arg0 out) - "~C~C " - (cond - ((logtest? #x10000 (the-as int sv-40)) - 80 + (((history-channel transv-out)) + (set! sv-52 (-> sv-72 vector)) ) - ((logtest? (the-as int sv-40) #x8000) - 85 + (((history-channel intersect)) + (set! sv-56 (-> sv-72 vector)) ) - ((logtest? (the-as int sv-40) 64) - 78 + (((history-channel pat)) + (set! sv-68 (-> sv-72 vector x)) ) - (else - 95 - ) - ) - (cond - ((logtest? (the-as int sv-40) 1024) - 76 + (((history-channel collide-status)) + (set! sv-32 (-> sv-72 collide-status)) + (set! sv-40 (-> sv-72 vector z)) ) - ((logtest? (the-as int sv-40) 256) - 67 + (((history-channel surface-normal)) + (set! sv-60 (-> sv-72 vector)) ) - ((logtest? (the-as int sv-40) 128) - 108 + (((history-channel local-normal)) + (set! sv-64 (-> sv-72 vector)) ) - (else - 95 - ) ) ) - (format (-> arg0 out) "trans: ~6,,2m ~6,,2m ~6,,2m " (-> sv-44 x) (-> sv-44 y) (-> sv-44 z)) - (format (-> arg0 out) "int: ~6,,2m ~6,,2m ~6,,2m " (-> sv-56 x) (-> sv-56 y) (-> sv-56 z)) - (format (-> arg0 out) "vel: ~6,,2m ~6,,2m ~6,,2m " (-> sv-48 x) (-> sv-48 y) (-> sv-48 z)) - (format (-> arg0 out) "vel-out: ~6,,2m ~6,,2m ~6,,2m " (-> sv-52 x) (-> sv-52 y) (-> sv-52 z)) - (format (-> arg0 out) "normal: ~6,,2f ~6,,2f ~6,,2f " (-> sv-60 x) (-> sv-60 y) (-> sv-60 z)) - (format (-> arg0 out) "local: ~6,,2f ~6,,2f ~6,,2f " (-> sv-64 x) (-> sv-64 y) (-> sv-64 z)) - (format (-> arg0 out) "~%") - ) - (case (-> sv-72 channel) - (((history-channel trans)) - (set! sv-44 (-> sv-72 vector)) - ) - (((history-channel transv-in)) - (set! sv-48 (-> sv-72 vector)) - ) - (((history-channel transv-out)) - (set! sv-52 (-> sv-72 vector)) - ) - (((history-channel intersect)) - (set! sv-56 (-> sv-72 vector)) - ) - (((history-channel pat)) - (set! sv-68 (-> sv-72 vector x)) - ) - (((history-channel collide-status)) - (set! sv-32 (-> sv-72 collide-status)) - (set! sv-40 (-> sv-72 vector z)) - ) - (((history-channel surface-normal)) - (set! sv-60 (-> sv-72 vector)) - ) - (((history-channel local-normal)) - (set! sv-64 (-> sv-72 vector)) - ) ) ) #f ) (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) @@ -571,38 +530,29 @@ (let ((v1-175 (-> arg0 control trans))) (format arg1 "pos: ~6,,2m ~6,,2m ~6,,2m " (-> v1-175 x) (-> v1-175 y) (-> v1-175 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-79 format) (a0-147 arg1) @@ -653,22 +603,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 heap current) (the-as uint (-> sv-80 heap 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 heap current) (the-as uint (-> sv-80 heap base))) 10) - sv-72 - (sar sv-64 10) ) (debug-print-channels (-> arg0 skel) arg1) ) @@ -2829,7 +2781,7 @@ ) (defmethod target-init! ((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! (-> *setting-control* user-default kg-primary-target) (process->handle this)) (set! (-> *setting-control* user-default ff-primary-target) (process->handle this)) (set! (-> *setting-control* user-default mh-primary-target) (process->handle this)) @@ -2888,13 +2840,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/goal_src/jak3/engine/target/mech/mech-states.gc b/goal_src/jak3/engine/target/mech/mech-states.gc index 500668572e..25240cb74a 100644 --- a/goal_src/jak3/engine/target/mech/mech-states.gc +++ b/goal_src/jak3/engine/target/mech/mech-states.gc @@ -317,7 +317,6 @@ ) (defbehavior target-mech-punch-pick target ((arg0 symbol)) - (local-vars (sv-144 control-info) (sv-160 float)) (combo-tracker-method-12 (-> self control unknown-combo-tracker00) *null-vector* @@ -339,25 +338,22 @@ ) (when s2-0 (let ((s3-0 (get-trans s2-0 3))) - (set! sv-144 (-> self control)) - (let ((s0-0 s3-0) - (s1-0 deg-diff) - ) - (set! sv-160 (y-angle sv-144)) - (let* ((a1-4 (vector-y-angle (vector-! (new 'stack-no-clear 'vector) s0-0 (-> sv-144 trans)))) - (f0-0 (s1-0 sv-160 a1-4)) + (let* ((sv-144 (-> self control)) + (s0-0 s3-0) + (f0-0 + (deg-diff (y-angle sv-144) (vector-y-angle (vector-! (new 'stack-no-clear 'vector) s0-0 (-> sv-144 trans)))) ) - (cond - ((>= 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 + ((>= 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/goal_src/jak3/engine/target/mech/target-mech.gc b/goal_src/jak3/engine/target/mech/target-mech.gc index 58db3e0aaf..a58b912484 100644 --- a/goal_src/jak3/engine/target/mech/target-mech.gc +++ b/goal_src/jak3/engine/target/mech/target-mech.gc @@ -599,7 +599,7 @@ ) (defbehavior target-mech-handler target ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) - (local-vars (v0-0 object) (a0-19 symbol) (sv-96 target) (sv-112 process)) + (local-vars (v0-0 object) (a0-19 symbol)) (cond ((and (= arg2 'query) (= (-> arg3 param 0) 'mode)) 'mech @@ -689,16 +689,14 @@ (let ((s2-0 (the-as pointer s3-0)) (s1-0 (method-of-type attack-info compute-intersect-info)) (s0-0 (-> arg3 param 1)) + (sv-96 self) ) - (set! sv-96 self) - (set! sv-112 arg0) - (let ((a3-2 (if (type? sv-112 process-drawable) - sv-112 - ) - ) - (t0-0 (-> arg3 param 0)) - ) - (s1-0 (the-as attack-info s2-0) s0-0 sv-96 a3-2 (the-as touching-shapes-entry t0-0)) + (s1-0 + (the-as attack-info s2-0) + s0-0 + sv-96 + (as-type arg0 process-drawable) + (the-as touching-shapes-entry (-> arg3 param 0)) ) ) (format 0 "info: ~A~%" (-> (the-as attack-info s3-0) mode)) @@ -943,7 +941,6 @@ ) (defbehavior mech-update-ik target () - (local-vars (sv-720 vector)) (let ((gp-0 (new 'stack-no-clear 'collide-query)) (s5-0 (-> (the-as process-drawable (-> self parent 0)) root)) ) @@ -979,11 +976,9 @@ (-> s3-0 shoulder-matrix-no-ik) (let ((v1-13 (-> s3-0 elbow-matrix-no-ik)) (s0-0 (new 'stack-no-clear 'vector)) + (sv-720 (new 'stack-no-clear 'vector)) ) - (set! sv-720 (new 'stack-no-clear 'vector)) - (let ((a0-5 (-> *y-vector* quad))) - (set! (-> sv-720 quad) a0-5) - ) + (vector-copy! sv-720 *y-vector*) (let ((s2-0 (new 'stack-no-clear 'vector))) (new 'stack-no-clear 'vector) (new 'stack-no-clear 'vector) @@ -996,11 +991,7 @@ (seek! (-> s3-0 user-blend) f0-11 (* 4.0 (seconds-per-frame))) ) (vector+*! (-> gp-0 start-pos) s0-0 sv-720 6144.0) - (let ((v1-19 (-> gp-0 move-dist)) - (f0-16 -20480.0) - ) - (vector-float*! v1-19 sv-720 f0-16) - ) + (vector-float*! (-> gp-0 move-dist) sv-720 -20480.0) (let ((v1-21 gp-0)) (set! (-> v1-21 radius) 4.096) (set! (-> v1-21 collide-with) (-> gp-0 collide-with)) @@ -1045,11 +1036,6 @@ ;; WARN: Return type mismatch object vs none. (defbehavior target-mech-init target ((arg0 handle) (arg1 float) (arg2 symbol)) - (local-vars - (sv-160 (function vector entity-actor skeleton-group vector manipy-options none :behavior manipy)) - (sv-176 vector) - (sv-192 entity-actor) - ) (target-gun-end-mode #f) (target-exit) (when (zero? (-> self mech)) @@ -1128,40 +1114,21 @@ (s3-0 (-> self level)) ) (process-entity-set! self (-> self mech entity)) - (let ((s2-0 (get-process *8k-dead-pool* manipy #x20000 1))) - (set! (-> self manipy) - (the-as - (pointer manipy) - (when s2-0 - (let ((t9-13 (method-of-type manipy activate))) - (t9-13 (the-as manipy s2-0) self "manipy" (the-as pointer #x70004000)) - ) - (let ((s1-0 run-function-in-process) - (s0-0 s2-0) - ) - (set! sv-160 manipy-init) - (set! sv-176 (-> self control trans)) - (set! sv-192 (-> self entity)) - (let ((t0-1 (art-group-get-by-name *level* "skel-mech" (the-as (pointer level) #f))) - (t1-0 #f) - (t2-0 0) - ) - ((the-as (function object object object object object object object none) s1-0) - s0-0 - sv-160 - sv-176 - sv-192 - t0-1 - t1-0 - t2-0 - ) - ) - ) - (-> s2-0 ppointer) - ) - ) + (set! (-> self manipy) + (process-spawn + manipy + :init manipy-init + (-> self control trans) + (-> self entity) + (art-group-get-by-name *level* "skel-mech" (the-as (pointer level) #f)) + #f + 0 + :name "manipy" + :from *8k-dead-pool* + :to self + :stack-size #x20000 ) - ) + ) (set! (-> self entity) s4-1) (set! (-> self level) s3-0) ) diff --git a/goal_src/jak3/engine/target/pilot-states.gc b/goal_src/jak3/engine/target/pilot-states.gc index 2bd2c59d75..b603387296 100644 --- a/goal_src/jak3/engine/target/pilot-states.gc +++ b/goal_src/jak3/engine/target/pilot-states.gc @@ -310,14 +310,7 @@ (let* ((v1-65 (-> gp-0 accel-array)) (f0-30 (+ (* (-> v1-65 0 x) (-> v1-65 0 x)) (* (-> v1-65 0 z) (-> v1-65 0 z)))) ) - (if (or (and (-> self pilot as-daxter?) (let ((f1-25 1024000.0)) - (< (* f1-25 f1-25) f0-30) - ) - ) - (let ((f1-28 2048000.0)) - (< (* f1-28 f1-28) f0-30) - ) - ) + (if (or (and (-> self pilot as-daxter?) (< (square 1024000.0) f0-30)) (< (square 2048000.0) f0-30)) (go target-pilot-impact) ) ) @@ -928,24 +921,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) (-> *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) (-> *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/goal_src/jak3/engine/target/surface-h.gc b/goal_src/jak3/engine/target/surface-h.gc index 6e00c861bb..3e5172e4a4 100644 --- a/goal_src/jak3/engine/target/surface-h.gc +++ b/goal_src/jak3/engine/target/surface-h.gc @@ -126,13 +126,13 @@ on impact, during touch, on exit, etc." (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)))) ) ) (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/goal_src/jak3/engine/target/target-anim.gc b/goal_src/jak3/engine/target/target-anim.gc index 046577a51a..5ccf10b77a 100644 --- a/goal_src/jak3/engine/target/target-anim.gc +++ b/goal_src/jak3/engine/target/target-anim.gc @@ -37,564 +37,565 @@ ;; WARN: Return type mismatch symbol vs none. ;; WARN: new jak 2 until loop case, check carefully (defbehavior target-stance-anim target () - (local-vars (sv-64 int) (sv-72 ground-tween-info)) - (set! sv-64 22) - (set! sv-72 (new 'stack 'ground-tween-info)) - (let ((v1-4 (ja-group))) - (cond - ((and v1-4 (or (= v1-4 jakb-wade-shallow-walk-ja) (= v1-4 jakb-wade-deep-walk-ja))) - (set! sv-64 45) - ) - ((let ((v1-11 (ja-group))) - (and v1-11 (= v1-11 jakb-roll-flip-ja)) + (let ((sv-64 22)) + (let ((sv-72 (new 'stack 'ground-tween-info))) + ) + (let ((v1-4 (ja-group))) + (cond + ((and v1-4 (or (= v1-4 jakb-wade-shallow-walk-ja) (= v1-4 jakb-wade-deep-walk-ja))) + (set! sv-64 45) ) - ((lambda :behavior target - () - (cond - ((using-gun? self) - (set! (-> self gun top-anim-low-high) 0.0) - (case (gun->eco (-> self gun gun-type)) - (((pickup-type eco-blue)) - (push-anim-to-targ - (-> self skel top-anim) - (the-as art-joint-anim jakb-gun-roll-flip-land-ja) - 0.0 - 0 - 30 - 1.0 - 10.0 - #f + ((let ((v1-11 (ja-group))) + (and v1-11 (= v1-11 jakb-roll-flip-ja)) + ) + ((lambda :behavior target + () + (cond + ((using-gun? self) + (set! (-> self gun top-anim-low-high) 0.0) + (case (gun->eco (-> self gun gun-type)) + (((pickup-type eco-blue)) + (push-anim-to-targ + (-> self skel top-anim) + (the-as art-joint-anim jakb-gun-roll-flip-land-ja) + 0.0 + 0 + 30 + 1.0 + 10.0 + #f + ) ) - ) - (else - (push-anim-to-targ - (-> self skel top-anim) - (the-as art-joint-anim jakb-gun-roll-flip-land-ja) - 0.0 - 0 - 30 - 1.0 - 6.0 - #f + (else + (push-anim-to-targ + (-> self skel top-anim) + (the-as art-joint-anim jakb-gun-roll-flip-land-ja) + 0.0 + 0 + 30 + 1.0 + 6.0 + #f + ) ) ) + (ja-no-eval :group! jakb-roll-flip-land-ja :num! (seek! (ja-aframe 48.0 0)) :frame-num 0.0) + (until (ja-done? 0) + (suspend) + (ja :num! (seek! (ja-aframe 48.0 0))) + ) + (ja-channel-push! 1 (seconds 0.05)) + (let ((gp-2 (target-land-anim))) + (ja-no-eval :group! gp-2 :num! (seek!) :frame-num (ja-aframe 64.0 0)) + ) + (until (ja-done? 0) + (ja-blend-eval) + (suspend) + (ja :num! (seek!)) + ) ) - (ja-no-eval :group! jakb-roll-flip-land-ja :num! (seek! (ja-aframe 48.0 0)) :frame-num 0.0) - (until (ja-done? 0) - (suspend) - (ja :num! (seek! (ja-aframe 48.0 0))) - ) - (ja-channel-push! 1 (seconds 0.05)) - (let ((gp-2 (target-land-anim))) - (ja-no-eval :group! gp-2 :num! (seek!) :frame-num (ja-aframe 64.0 0)) - ) - (until (ja-done? 0) - (ja-blend-eval) - (suspend) - (ja :num! (seek!)) - ) - ) - (else - (ja-no-eval :group! jakb-roll-flip-land-ja :num! (seek!) :frame-num 0.0) - (until (ja-done? 0) - (suspend) - (ja :num! (seek!)) - ) - (ja-no-eval :group! jakb-jump-land-ja :num! (seek!) :frame-num (ja-aframe 55.0 0)) - (until (ja-done? 0) - (suspend) - (ja :num! (seek!)) - ) - ) - ) - (none) - ) - ) - ) - ((let ((v1-18 (ja-group))) - (and v1-18 (or (= v1-18 jakb-gun-attack-from-stance-end-ja) - (= v1-18 jakb-gun-attack-from-stance-blue-end-ja) - (= v1-18 jakb-lightjak-shield-end-ja) - (= v1-18 jakb-attack-from-stance-alt-end-ja) - (= v1-18 jakb-attack-from-stance-end-ja) - ) - ) - ) - (ja-no-eval :num! (seek!)) - (while (not (ja-done? 0)) - (suspend) - (ja-eval) - ) - ) - ((let ((v1-33 (ja-group))) - (and v1-33 - (or (= v1-33 jakb-attack-from-stance-ja) - (= v1-33 jakb-gun-attack-from-stance-ja) - (= v1-33 jakb-gun-attack-from-stance-blue-ja) - (= v1-33 jakb-lightjak-shield-ja) + (else + (ja-no-eval :group! jakb-roll-flip-land-ja :num! (seek!) :frame-num 0.0) + (until (ja-done? 0) + (suspend) + (ja :num! (seek!)) ) + (ja-no-eval :group! jakb-jump-land-ja :num! (seek!) :frame-num (ja-aframe 55.0 0)) + (until (ja-done? 0) + (suspend) + (ja :num! (seek!)) + ) + ) ) + (none) + ) + ) ) - ((lambda :behavior target - () - (set! (-> self control mod-surface) *attack-end-mods*) - (let ((gp-0 (not (using-gun? self)))) - (let* ((v1-3 (ja-group)) - (a1-0 (cond - ((and v1-3 (= v1-3 jakb-gun-attack-from-stance-ja)) - jakb-gun-attack-from-stance-end-ja - ) - ((let ((v1-10 (ja-group))) - (and v1-10 (= v1-10 jakb-gun-attack-from-stance-blue-ja)) + ((let ((v1-18 (ja-group))) + (and v1-18 (or (= v1-18 jakb-gun-attack-from-stance-end-ja) + (= v1-18 jakb-gun-attack-from-stance-blue-end-ja) + (= v1-18 jakb-lightjak-shield-end-ja) + (= v1-18 jakb-attack-from-stance-alt-end-ja) + (= v1-18 jakb-attack-from-stance-end-ja) + ) + ) + ) + (ja-no-eval :num! (seek!)) + (while (not (ja-done? 0)) + (suspend) + (ja-eval) + ) + ) + ((let ((v1-33 (ja-group))) + (and v1-33 + (or (= v1-33 jakb-attack-from-stance-ja) + (= v1-33 jakb-gun-attack-from-stance-ja) + (= v1-33 jakb-gun-attack-from-stance-blue-ja) + (= v1-33 jakb-lightjak-shield-ja) + ) + ) + ) + ((lambda :behavior target + () + (set! (-> self control mod-surface) *attack-end-mods*) + (let ((gp-0 (not (using-gun? self)))) + (let* ((v1-3 (ja-group)) + (a1-0 (cond + ((and v1-3 (= v1-3 jakb-gun-attack-from-stance-ja)) + jakb-gun-attack-from-stance-end-ja ) - jakb-gun-attack-from-stance-blue-end-ja - ) - ((and (= (-> self ext-anim) (target-anim light)) (let ((v1-20 (ja-group))) - (and v1-20 (= v1-20 jakb-lightjak-shield-ja)) - ) - ) - jakb-lightjak-shield-end-ja - ) - ((and (rand-vu-percent? 0.3) (zero? (-> self ext-anim))) - jakb-attack-from-stance-alt-end-ja - ) - (else - jakb-attack-from-stance-end-ja + ((let ((v1-10 (ja-group))) + (and v1-10 (= v1-10 jakb-gun-attack-from-stance-blue-ja)) + ) + jakb-gun-attack-from-stance-blue-end-ja + ) + ((and (= (-> self ext-anim) (target-anim light)) (let ((v1-20 (ja-group))) + (and v1-20 (= v1-20 jakb-lightjak-shield-ja)) + ) + ) + jakb-lightjak-shield-end-ja + ) + ((and (rand-vu-percent? 0.3) (zero? (-> self ext-anim))) + jakb-attack-from-stance-alt-end-ja + ) + (else + jakb-attack-from-stance-end-ja + ) ) ) - ) - ) - (ja-no-eval :group! a1-0 :num! (seek!) :frame-num 0.0) - ) - (until (ja-done? 0) - (when (nonzero? (-> self gun track-target-hold-time)) - (forward-up-nopitch->quaternion - (-> self control dir-targ) - (vector-! (new 'stack-no-clear 'vector) (-> self gun track-trans) (-> self control trans)) - (vector-y-quaternion! (new-stack-vector0) (-> self control dir-targ)) - ) - (set-quaternion! (-> self control) (-> self control dir-targ)) - (goto cfg-43) + ) + (ja-no-eval :group! a1-0 :num! (seek!) :frame-num 0.0) ) - (if (and gp-0 (using-gun? self)) + (until (ja-done? 0) + (when (nonzero? (-> self gun track-target-hold-time)) + (forward-up-nopitch->quaternion + (-> self control dir-targ) + (vector-! (new 'stack-no-clear 'vector) (-> self gun track-trans) (-> self control trans)) + (vector-y-quaternion! (new-stack-vector0) (-> self control dir-targ)) + ) + (set-quaternion! (-> self control) (-> self control dir-targ)) (goto cfg-43) ) - (compute-delta-align! (-> self align)) - (align! (-> self align) (align-opts adjust-quat) 1.0 1.0 1.0) - (suspend) - (ja :num! (seek!)) - ) - ) - (quaternion-copy! (-> self control dir-targ) (-> self control unknown-quaternion04)) - (label cfg-43) - (set! (-> self control mod-surface) *walk-mods*) - (let ((v1-73 (ja-group))) - (when (and (and v1-73 (= v1-73 jakb-gun-attack-from-stance-end-ja)) - (and (using-gun? self) (= (gun->eco (-> self gun gun-type)) (pickup-type eco-yellow))) - ) - (ja-channel-push! 1 (seconds 0.1)) - (ja-no-eval :group! jakb-gun-front-to-side-hop-ja :num! (seek!) :frame-num (ja-aframe 5.0 0)) - (until (ja-done? 0) + (if (and gp-0 (using-gun? self)) + (goto cfg-43) + ) + (compute-delta-align! (-> self align)) + (align! (-> self align) (align-opts adjust-quat) 1.0 1.0 1.0) (suspend) (ja :num! (seek!)) ) ) - ) - (none) - ) - ) - ) - ((let ((v1-40 (ja-group))) - (and v1-40 (= v1-40 (-> self draw art-group data 449))) - ) - (ja-no-eval :group! (-> self draw art-group data 450) :num! (seek!) :frame-num 0.0) - (until (ja-done? 0) - (suspend) - (ja :num! (seek!)) - ) - ) - ((let ((v1-70 (ja-group))) - (and v1-70 (= v1-70 jakb-smack-surface-ja)) - ) - (ja-no-eval :group! jakb-smack-surface-end-ja :num! (seek!) :frame-num 0.0) - (until (ja-done? 0) - (suspend) - (ja :num! (seek!)) - ) - ) - ((let ((v1-100 (ja-group))) - (and v1-100 (or (= v1-100 jakb-powerjak-get-on-ja) (= v1-100 jakb-powerjak-get-on-loop-ja))) - ) - (set! sv-64 60) - ) - ((let ((v1-107 (ja-group))) - (and v1-107 (= v1-107 jakb-darkjak-get-on-fast-ja)) - ) - (ja-no-eval :num! (seek!)) - (while (not (ja-done? 0)) - (suspend) - (ja-eval) - ) - ) - ((let ((v1-122 (ja-group))) - (and v1-122 (or (= v1-122 jakb-attack-punch-ja) - (= v1-122 (-> self draw art-group data 452)) - (= v1-122 (-> self draw art-group data 459)) - (= v1-122 (-> self draw art-group data 454)) - (= v1-122 jakb-darkjak-attack-combo3-ja) - (= v1-122 (-> self draw art-group data 463)) - (= v1-122 (-> self draw art-group data 476)) + (quaternion-copy! (-> self control dir-targ) (-> self control unknown-quaternion04)) + (label cfg-43) + (set! (-> self control mod-surface) *walk-mods*) + (let ((v1-73 (ja-group))) + (when (and (and v1-73 (= v1-73 jakb-gun-attack-from-stance-end-ja)) + (and (using-gun? self) (= (gun->eco (-> self gun gun-type)) (pickup-type eco-yellow))) ) + (ja-channel-push! 1 (seconds 0.1)) + (ja-no-eval :group! jakb-gun-front-to-side-hop-ja :num! (seek!) :frame-num (ja-aframe 5.0 0)) + (until (ja-done? 0) + (suspend) + (ja :num! (seek!)) + ) + ) ) + (none) + ) + ) ) - ((lambda :behavior target - () - (set! (-> self control bend-target) (-> self control bend-amount)) - (set! (-> self control mod-surface) *walk-no-turn-mods*) - (let ((gp-0 (not (using-gun? self)))) - (let* ((v1-5 (ja-group)) - (a1-0 (cond - ((and v1-5 (= v1-5 (-> self draw art-group data 452))) - (logior! (-> self target-flags) (target-flags lleg-still)) - (-> self draw art-group data 453) - ) - ((let ((v1-14 (ja-group))) - (and v1-14 (= v1-14 (-> self draw art-group data 459))) + ((let ((v1-40 (ja-group))) + (and v1-40 (= v1-40 (-> self draw art-group data 449))) + ) + (ja-no-eval :group! (-> self draw art-group data 450) :num! (seek!) :frame-num 0.0) + (until (ja-done? 0) + (suspend) + (ja :num! (seek!)) + ) + ) + ((let ((v1-70 (ja-group))) + (and v1-70 (= v1-70 jakb-smack-surface-ja)) + ) + (ja-no-eval :group! jakb-smack-surface-end-ja :num! (seek!) :frame-num 0.0) + (until (ja-done? 0) + (suspend) + (ja :num! (seek!)) + ) + ) + ((let ((v1-100 (ja-group))) + (and v1-100 (or (= v1-100 jakb-powerjak-get-on-ja) (= v1-100 jakb-powerjak-get-on-loop-ja))) + ) + (set! sv-64 60) + ) + ((let ((v1-107 (ja-group))) + (and v1-107 (= v1-107 jakb-darkjak-get-on-fast-ja)) + ) + (ja-no-eval :num! (seek!)) + (while (not (ja-done? 0)) + (suspend) + (ja-eval) + ) + ) + ((let ((v1-122 (ja-group))) + (and v1-122 (or (= v1-122 jakb-attack-punch-ja) + (= v1-122 (-> self draw art-group data 452)) + (= v1-122 (-> self draw art-group data 459)) + (= v1-122 (-> self draw art-group data 454)) + (= v1-122 jakb-darkjak-attack-combo3-ja) + (= v1-122 (-> self draw art-group data 463)) + (= v1-122 (-> self draw art-group data 476)) + ) + ) + ) + ((lambda :behavior target + () + (set! (-> self control bend-target) (-> self control bend-amount)) + (set! (-> self control mod-surface) *walk-no-turn-mods*) + (let ((gp-0 (not (using-gun? self)))) + (let* ((v1-5 (ja-group)) + (a1-0 (cond + ((and v1-5 (= v1-5 (-> self draw art-group data 452))) + (logior! (-> self target-flags) (target-flags lleg-still)) + (-> self draw art-group data 453) ) - (logior! (-> self target-flags) (target-flags lleg-still)) - (-> self draw art-group data 460) - ) - ((let ((v1-23 (ja-group))) - (and v1-23 (= v1-23 (-> self draw art-group data 454))) + ((let ((v1-14 (ja-group))) + (and v1-14 (= v1-14 (-> self draw art-group data 459))) + ) + (logior! (-> self target-flags) (target-flags lleg-still)) + (-> self draw art-group data 460) ) - (logior! (-> self target-flags) (target-flags lleg-still)) - (-> self draw art-group data 455) - ) - ((let ((v1-32 (ja-group))) - (and v1-32 (= v1-32 jakb-darkjak-attack-combo3-ja)) + ((let ((v1-23 (ja-group))) + (and v1-23 (= v1-23 (-> self draw art-group data 454))) + ) + (logior! (-> self target-flags) (target-flags lleg-still)) + (-> self draw art-group data 455) ) - (logior! (-> self target-flags) (target-flags lleg-still)) - jakb-darkjak-attack-combo3-end-ja - ) - ((let ((v1-41 (ja-group))) - (and v1-41 (= v1-41 (-> self draw art-group data 463))) + ((let ((v1-32 (ja-group))) + (and v1-32 (= v1-32 jakb-darkjak-attack-combo3-ja)) + ) + (logior! (-> self target-flags) (target-flags lleg-still)) + jakb-darkjak-attack-combo3-end-ja ) - (logior! (-> self target-flags) (target-flags lleg-still)) - (-> self draw art-group data 464) - ) - (else - (let ((v1-50 (ja-group))) - (cond - ((and v1-50 (= v1-50 (-> self draw art-group data 476))) - (logior! (-> self target-flags) (target-flags lleg-still)) - (-> self draw art-group data 477) - ) - ((and (rand-vu-percent? 0.3) (zero? (-> self ext-anim))) - jakb-attack-punch-alt-end-ja - ) - (else - jakb-attack-punch-end-ja + ((let ((v1-41 (ja-group))) + (and v1-41 (= v1-41 (-> self draw art-group data 463))) + ) + (logior! (-> self target-flags) (target-flags lleg-still)) + (-> self draw art-group data 464) + ) + (else + (let ((v1-50 (ja-group))) + (cond + ((and v1-50 (= v1-50 (-> self draw art-group data 476))) + (logior! (-> self target-flags) (target-flags lleg-still)) + (-> self draw art-group data 477) + ) + ((and (rand-vu-percent? 0.3) (zero? (-> self ext-anim))) + jakb-attack-punch-alt-end-ja + ) + (else + jakb-attack-punch-end-ja + ) ) ) ) ) ) - ) - ) - (ja-no-eval :group! a1-0 :num! (seek!) :frame-num 0.0) - ) - (until (ja-done? 0) - (seek! (-> self control bend-target) 0.0 (seconds-per-frame)) - (if (and gp-0 (using-gun? self)) - (goto cfg-59) - ) - (suspend) - (ja :num! (seek!)) - ) - ) - (label cfg-59) - (set! (-> self control mod-surface) *walk-mods*) - (set! (-> self control bend-target) 0.0) - (rot->dir-targ! (-> self control)) - (logclear! (-> self target-flags) (target-flags lleg-still rleg-still lleg-no-ik rleg-no-ik)) - (none) - ) - ) - ) - ((let ((v1-129 (ja-group))) - (and v1-129 (= v1-129 jakb-gun-attack-butt-ja)) - ) - (set! (-> self control bend-target) (-> self control bend-amount)) - (set! (-> self control mod-surface) *walk-no-turn-mods*) - (let ((a1-22 jakb-gun-attack-butt-end-ja)) - (ja-no-eval :group! a1-22 :num! (seek!) :frame-num 0.0) - ) - (until (ja-done? 0) - (seek! (-> self control bend-target) 0.0 (seconds-per-frame)) - (suspend) - (ja :num! (seek!)) - ) - (set! (-> self control mod-surface) *walk-mods*) - (set! (-> self control bend-target) 0.0) - (rot->dir-targ! (-> self control)) - ) - ((let ((v1-163 (ja-group))) - (and v1-163 (= v1-163 jakb-gun-attack-butt-blue-ja)) - ) - (set! (-> self control bend-target) (-> self control bend-amount)) - (set! (-> self control mod-surface) *walk-no-turn-mods*) - (let ((a1-25 jakb-gun-attack-butt-blue-end-ja)) - (ja-no-eval :group! a1-25 :num! (seek!) :frame-num 0.0) - ) - (until (ja-done? 0) - (seek! (-> self control bend-target) 0.0 (seconds-per-frame)) - (suspend) - (ja :num! (seek!)) - ) - (set! (-> self control mod-surface) *walk-mods*) - (set! (-> self control bend-target) 0.0) - (rot->dir-targ! (-> self control)) - ) - ((let ((v1-197 (ja-group))) - (and (and v1-197 (or (= v1-197 jakb-gun-jump-land-ja) (= v1-197 jakb-gun-jump-land-side-ja))) - (not (using-gun? self)) - ) - ) - (set! sv-64 60) - ) - ((let ((v1-205 (ja-group))) - (and v1-205 (or (= v1-205 jakb-duck-stance-ja) - (= v1-205 jakb-duck-walk-ja) - (= v1-205 jakb-gun-duck-walk-ja) - (= v1-205 jakb-duck-roll-ja) - (= v1-205 jakb-gun-duck-roll-ja) - (= v1-205 (-> self draw art-group data 474)) - ) - ) - ) - (let ((t9-27 - (lambda :behavior target - () - (cond - ((and (and (focus-test? self dark) (nonzero? (-> self darkjak))) (= (-> self ext-anim) (target-anim dark))) - (ja-channel-push! 1 (seconds 0.04)) - (ja-no-eval :group! (-> self draw art-group data 475) :num! (seek!) :frame-num 0.0) - (until (ja-done? 0) - (suspend) - (ja :num! (seek!)) - ) - 12 - ) - ((nonzero? (-> self ext-anim)) - 30 - ) - (else - (ja-channel-push! 1 (seconds 0.04)) - (ja-no-eval :group! jakb-stance-to-duck-ja :num! (seek! 0.0 1.2) :frame-num max) - (until (ja-done? 0) - (suspend) - (ja :num! (seek! 0.0 1.2)) - ) - 12 ) + (ja-no-eval :group! a1-0 :num! (seek!) :frame-num 0.0) + ) + (until (ja-done? 0) + (seek! (-> self control bend-target) 0.0 (seconds-per-frame)) + (if (and gp-0 (using-gun? self)) + (goto cfg-59) + ) + (suspend) + (ja :num! (seek!)) + ) + ) + (label cfg-59) + (set! (-> self control mod-surface) *walk-mods*) + (set! (-> self control bend-target) 0.0) + (rot->dir-targ! (-> self control)) + (logclear! (-> self target-flags) (target-flags lleg-still rleg-still lleg-no-ik rleg-no-ik)) + (none) + ) + ) + ) + ((let ((v1-129 (ja-group))) + (and v1-129 (= v1-129 jakb-gun-attack-butt-ja)) + ) + (set! (-> self control bend-target) (-> self control bend-amount)) + (set! (-> self control mod-surface) *walk-no-turn-mods*) + (let ((a1-22 jakb-gun-attack-butt-end-ja)) + (ja-no-eval :group! a1-22 :num! (seek!) :frame-num 0.0) + ) + (until (ja-done? 0) + (seek! (-> self control bend-target) 0.0 (seconds-per-frame)) + (suspend) + (ja :num! (seek!)) + ) + (set! (-> self control mod-surface) *walk-mods*) + (set! (-> self control bend-target) 0.0) + (rot->dir-targ! (-> self control)) + ) + ((let ((v1-163 (ja-group))) + (and v1-163 (= v1-163 jakb-gun-attack-butt-blue-ja)) + ) + (set! (-> self control bend-target) (-> self control bend-amount)) + (set! (-> self control mod-surface) *walk-no-turn-mods*) + (let ((a1-25 jakb-gun-attack-butt-blue-end-ja)) + (ja-no-eval :group! a1-25 :num! (seek!) :frame-num 0.0) + ) + (until (ja-done? 0) + (seek! (-> self control bend-target) 0.0 (seconds-per-frame)) + (suspend) + (ja :num! (seek!)) + ) + (set! (-> self control mod-surface) *walk-mods*) + (set! (-> self control bend-target) 0.0) + (rot->dir-targ! (-> self control)) + ) + ((let ((v1-197 (ja-group))) + (and (and v1-197 (or (= v1-197 jakb-gun-jump-land-ja) (= v1-197 jakb-gun-jump-land-side-ja))) + (not (using-gun? self)) + ) + ) + (set! sv-64 60) + ) + ((let ((v1-205 (ja-group))) + (and v1-205 (or (= v1-205 jakb-duck-stance-ja) + (= v1-205 jakb-duck-walk-ja) + (= v1-205 jakb-gun-duck-walk-ja) + (= v1-205 jakb-duck-roll-ja) + (= v1-205 jakb-gun-duck-roll-ja) + (= v1-205 (-> self draw art-group data 474)) + ) + ) + ) + (let ((t9-27 + (lambda :behavior target + () + (cond + ((and (and (focus-test? self dark) (nonzero? (-> self darkjak))) (= (-> self ext-anim) (target-anim dark))) + (ja-channel-push! 1 (seconds 0.04)) + (ja-no-eval :group! (-> self draw art-group data 475) :num! (seek!) :frame-num 0.0) + (until (ja-done? 0) + (suspend) + (ja :num! (seek!)) + ) + 12 + ) + ((nonzero? (-> self ext-anim)) + 30 + ) + (else + (ja-channel-push! 1 (seconds 0.04)) + (ja-no-eval :group! jakb-stance-to-duck-ja :num! (seek! 0.0 1.2) :frame-num max) + (until (ja-done? 0) + (suspend) + (ja :num! (seek! 0.0 1.2)) + ) + 12 + ) + ) + (none) ) - (none) ) ) - ) - (new 'stack-no-clear 'array 'time-frame 4) - (t9-27) + (new 'stack-no-clear 'array 'time-frame 4) + (t9-27) + ) ) - ) - ((let ((v1-212 (ja-group))) - (or (and (and v1-212 (or (= v1-212 jakb-walk-ja) (= v1-212 (-> self draw art-group data 442)))) - (begin (set! sv-64 45) (< 0.5 (-> self skel root-channel 6 frame-interp (-> self skel active-frame-interp)))) - (not (using-gun? self)) - ) - (let ((v1-226 (ja-group))) - (and v1-226 (or (= v1-226 jakb-run-squash-ja) - (= v1-226 jakb-run-squash-weak-ja) - (= v1-226 jakb-attack-from-stance-run-end-ja) - (= v1-226 jakb-attack-from-stance-run-alt-end-ja) - ) + ((let ((v1-212 (ja-group))) + (or (and (and v1-212 (or (= v1-212 jakb-walk-ja) (= v1-212 (-> self draw art-group data 442)))) + (begin (set! sv-64 45) (< 0.5 (-> self skel root-channel 6 frame-interp (-> self skel active-frame-interp)))) + (not (using-gun? self)) ) - ) - ) - ) - ((lambda :behavior target - ((arg0 (pointer time-frame))) - (cond - ((and (rand-vu-percent? 0.3) (not (and (focus-test? self dark) (nonzero? (-> self darkjak))))) - (ja-channel-push! 1 (seconds 0.1)) - (ja-no-eval :group! jakb-run-to-stance-fast-ja :num! (seek!) :frame-num 0.0) - (until (ja-done? 0) - (if (using-gun? self) - (return #f) - ) - (suspend) - (ja :num! (seek!)) - ) - ) - (else - (let* ((v1-32 (ja-group)) - (f30-1 (cond - ((and v1-32 (or (= v1-32 jakb-walk-ja) (= v1-32 (-> self draw art-group data 442)))) - (let ((f0-10 (+ 50.0 (* 0.8333333 (+ -25.0 (ja-aframe-num 0)))))) - (- f0-10 (* (the float (the int (/ f0-10 50.0))) 50.0)) + (let ((v1-226 (ja-group))) + (and v1-226 (or (= v1-226 jakb-run-squash-ja) + (= v1-226 jakb-run-squash-weak-ja) + (= v1-226 jakb-attack-from-stance-run-end-ja) + (= v1-226 jakb-attack-from-stance-run-alt-end-ja) ) - ) - (else - 0.0 + ) + ) + ) + ) + ((lambda :behavior target + ((arg0 (pointer time-frame))) + (cond + ((and (rand-vu-percent? 0.3) (not (and (focus-test? self dark) (nonzero? (-> self darkjak))))) + (ja-channel-push! 1 (seconds 0.1)) + (ja-no-eval :group! jakb-run-to-stance-fast-ja :num! (seek!) :frame-num 0.0) + (until (ja-done? 0) + (if (using-gun? self) + (return #f) + ) + (suspend) + (ja :num! (seek!)) + ) + ) + (else + (let* ((v1-32 (ja-group)) + (f30-1 (cond + ((and v1-32 (or (= v1-32 jakb-walk-ja) (= v1-32 (-> self draw art-group data 442)))) + (let ((f0-10 (+ 50.0 (* 0.8333333 (+ -25.0 (ja-aframe-num 0)))))) + (- f0-10 (* (the float (the int (/ f0-10 50.0))) 50.0)) + ) + ) + (else + 0.0 + ) ) ) - ) - ) - (set! (-> arg0 0) (seconds 0.15)) - (ja-channel-push! 1 (-> arg0 0)) - (ja :group! jakb-run-to-stance-loop-ja :num! (identity (ja-aframe f30-1 0))) - ) - (dotimes (gp-2 3) - (until (ja-done? 0) - (if (using-gun? self) - (return #f) - ) - (suspend) - (ja :num! (seek!)) + ) + (set! (-> arg0 0) (seconds 0.15)) + (ja-channel-push! 1 (-> arg0 0)) + (ja :group! jakb-run-to-stance-loop-ja :num! (identity (ja-aframe f30-1 0))) ) - (ja :num-func num-func-identity :frame-num 0.0) - ) - (ja-no-eval :group! jakb-run-to-stance-ja :num! (seek! (ja-aframe 82.0 0)) :frame-num 0.0) - (until (ja-done? 0) - (suspend) - (ja :num! (seek! (ja-aframe 82.0 0))) - ) - (when (not (and (focus-test? self dark) (nonzero? (-> self darkjak)))) - (ja-no-eval :group! jakb-run-to-stance-ja :num! (seek! (ja-aframe 142.0 0)) :frame-num (ja-aframe 82.0 0)) - (until (ja-done? 0) - (suspend) - (ja :num! (seek! (ja-aframe 142.0 0))) + (dotimes (gp-2 3) + (until (ja-done? 0) + (if (using-gun? self) + (return #f) + ) + (suspend) + (ja :num! (seek!)) + ) + (ja :num-func num-func-identity :frame-num 0.0) ) - (logior! (-> self target-flags) (target-flags lleg-still rleg-still)) - (ja-no-eval :group! jakb-run-to-stance-ja :num! (seek!) :frame-num (ja-aframe 142.0 0)) + (ja-no-eval :group! jakb-run-to-stance-ja :num! (seek! (ja-aframe 82.0 0)) :frame-num 0.0) (until (ja-done? 0) (suspend) - (ja :num! (seek!)) + (ja :num! (seek! (ja-aframe 82.0 0))) + ) + (when (not (and (focus-test? self dark) (nonzero? (-> self darkjak)))) + (ja-no-eval :group! jakb-run-to-stance-ja :num! (seek! (ja-aframe 142.0 0)) :frame-num (ja-aframe 82.0 0)) + (until (ja-done? 0) + (suspend) + (ja :num! (seek! (ja-aframe 142.0 0))) + ) + (logior! (-> self target-flags) (target-flags lleg-still rleg-still)) + (ja-no-eval :group! jakb-run-to-stance-ja :num! (seek!) :frame-num (ja-aframe 142.0 0)) + (until (ja-done? 0) + (suspend) + (ja :num! (seek!)) + ) ) ) ) + (none) ) - (none) + (new 'stack-no-clear 'array 'time-frame 4) ) - (new 'stack-no-clear 'array 'time-frame 4) - ) - ) - ((let ((v1-233 (ja-group))) - (and (and v1-233 (= v1-233 jakb-walk-ja)) (>= (-> self control ctrl-xz-vel) 5734.4)) ) - (set! sv-64 45) - ) - ((and (and (focus-test? self light) (nonzero? (-> self lightjak))) - (and (= (-> self ext-anim) (target-anim light)) (let ((v1-250 (ja-group))) - (and v1-250 (= v1-250 jakb-lightjak-get-on-land-ja)) - ) - ) - ) - (set! sv-64 45) - ) - ((and (= (-> self ext-anim) (target-anim light)) (let ((v1-260 (ja-group))) - (and v1-260 (= v1-260 jakb-lightjak-freeze-ja)) - ) - ) - (ja-channel-push! 1 (seconds 0.05)) - (ja-no-eval :group! jakb-lightjak-freeze-land-ja :num! (seek!) :frame-num 0.0) - (until (ja-done? 0) - (suspend) - (ja :num! (seek!)) + ((let ((v1-233 (ja-group))) + (and (and v1-233 (= v1-233 jakb-walk-ja)) (>= (-> self control ctrl-xz-vel) 5734.4)) + ) + (set! sv-64 45) ) - ) - ) - ) - (if (and (using-gun? self) (-> self next-state) (= (-> self next-state name) 'target-stance)) - (go target-gun-stance) - ) - (when (and (and (focus-test? self light) (nonzero? (-> self lightjak))) - (and (= (-> self ext-anim) (target-anim light)) - (zero? (-> self lightjak latch-out-time)) - (let ((v1-306 (ja-group))) - (not (and v1-306 (or (= v1-306 jakb-lightjak-heal-end-ja) - (= v1-306 jakb-lightjak-swoop-land-ja) - (= v1-306 jakb-lightjak-get-on-land-ja) - (= v1-306 jakb-lightjak-shield-end-ja) - (= v1-306 jakb-lightjak-freeze-land-ja) - ) - ) - ) - ) - ) - ) - (ja-channel-push! 1 (seconds 0.05)) - (ja-no-eval :group! jakb-lightjak-stance-to-stance-ja :num! (seek!) :frame-num 0.0) - (until (ja-done? 0) - (if (not (and (focus-test? self light) (nonzero? (-> self lightjak)))) - (goto cfg-316) - ) - (suspend) - (ja :num! (seek!)) - ) - ) - (until #f - (let ((gp-0 (cond - ((and (and (focus-test? self dark) (nonzero? (-> self darkjak))) - (and (= (-> self ext-anim) (target-anim dark)) - (zero? (-> self darkjak latch-out-time)) - (not (using-gun? self)) - ) - ) - (-> self draw art-group data 446) + ((and (and (focus-test? self light) (nonzero? (-> self lightjak))) + (and (= (-> self ext-anim) (target-anim light)) (let ((v1-250 (ja-group))) + (and v1-250 (= v1-250 jakb-lightjak-get-on-land-ja)) + ) ) - ((and (and (focus-test? self light) (nonzero? (-> self lightjak))) - (and (= (-> self ext-anim) (target-anim light)) (zero? (-> self lightjak latch-out-time))) - ) - jakb-lightjak-stance-ja - ) - (else - jakb-stance-loop-ja - ) - ) - ) - ) - (when (not (and (ja-group? gp-0) (= (ja-group-size) 1))) - (ja-channel-push! 1 (the-as time-frame sv-64)) - (set! (-> self skel root-channel 0 frame-group) (the-as art-joint-anim gp-0)) + ) + (set! sv-64 45) + ) + ((and (= (-> self ext-anim) (target-anim light)) (let ((v1-260 (ja-group))) + (and v1-260 (= v1-260 jakb-lightjak-freeze-ja)) + ) + ) + (ja-channel-push! 1 (seconds 0.05)) + (ja-no-eval :group! jakb-lightjak-freeze-land-ja :num! (seek!) :frame-num 0.0) + (until (ja-done? 0) + (suspend) + (ja :num! (seek!)) + ) + ) ) ) - (logior! (-> self target-flags) (target-flags lleg-still rleg-still)) - (while (let ((v1-385 (ja-group))) - (cond - ((and (and v1-385 (= v1-385 (-> self draw art-group data 446))) - (not (and (and (focus-test? self dark) (nonzero? (-> self darkjak))) - (and (= (-> self ext-anim) (target-anim dark)) - (zero? (-> self darkjak latch-out-time)) - (not (using-gun? self)) - ) + (if (and (using-gun? self) (-> self next-state) (= (-> self next-state name) 'target-stance)) + (go target-gun-stance) + ) + (when (and (and (focus-test? self light) (nonzero? (-> self lightjak))) + (and (= (-> self ext-anim) (target-anim light)) + (zero? (-> self lightjak latch-out-time)) + (let ((v1-306 (ja-group))) + (not (and v1-306 (or (= v1-306 jakb-lightjak-heal-end-ja) + (= v1-306 jakb-lightjak-swoop-land-ja) + (= v1-306 jakb-lightjak-get-on-land-ja) + (= v1-306 jakb-lightjak-shield-end-ja) + (= v1-306 jakb-lightjak-freeze-land-ja) + ) + ) + ) + ) + ) + ) + (ja-channel-push! 1 (seconds 0.05)) + (ja-no-eval :group! jakb-lightjak-stance-to-stance-ja :num! (seek!) :frame-num 0.0) + (until (ja-done? 0) + (if (not (and (focus-test? self light) (nonzero? (-> self lightjak)))) + (goto cfg-316) + ) + (suspend) + (ja :num! (seek!)) + ) + ) + (until #f + (let ((gp-0 (cond + ((and (and (focus-test? self dark) (nonzero? (-> self darkjak))) + (and (= (-> self ext-anim) (target-anim dark)) + (zero? (-> self darkjak latch-out-time)) + (not (using-gun? self)) ) ) + (-> self draw art-group data 446) ) - (set! sv-64 60) - #f - ) - (else - #t + ((and (and (focus-test? self light) (nonzero? (-> self lightjak))) + (and (= (-> self ext-anim) (target-anim light)) (zero? (-> self lightjak latch-out-time))) + ) + jakb-lightjak-stance-ja + ) + (else + jakb-stance-loop-ja + ) + ) + ) + ) + (when (not (and (ja-group? gp-0) (= (ja-group-size) 1))) + (ja-channel-push! 1 (the-as time-frame sv-64)) + (set! (-> self skel root-channel 0 frame-group) (the-as art-joint-anim gp-0)) + ) + ) + (logior! (-> self target-flags) (target-flags lleg-still rleg-still)) + (while (let ((v1-385 (ja-group))) + (cond + ((and (and v1-385 (= v1-385 (-> self draw art-group data 446))) + (not (and (and (focus-test? self dark) (nonzero? (-> self darkjak))) + (and (= (-> self ext-anim) (target-anim dark)) + (zero? (-> self darkjak latch-out-time)) + (not (using-gun? self)) + ) + ) + ) + ) + (set! sv-64 60) + #f + ) + (else + #t + ) ) ) - ) - (suspend) - (ja :num! (loop!)) - (if (can-play-stance-amibent?) - (go target-stance-ambient) - ) + (suspend) + (ja :num! (loop!)) + (if (can-play-stance-amibent?) + (go target-stance-ambient) + ) + ) + (label cfg-316) ) - (label cfg-316) ) #f (none) @@ -790,7 +791,6 @@ ;; 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) @@ -1158,18 +1158,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 (and (focus-test? self dark) (nonzero? (-> self darkjak))) (= (-> self ext-anim) (target-anim dark))) + (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 (and (focus-test? self dark) (nonzero? (-> self darkjak))) (= (-> self ext-anim) (target-anim dark))) - (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-211 (-> self skel effect))) diff --git a/goal_src/jak3/engine/target/target-darkjak.gc b/goal_src/jak3/engine/target/target-darkjak.gc index 25fa4ff05a..ab06c5004d 100644 --- a/goal_src/jak3/engine/target/target-darkjak.gc +++ b/goal_src/jak3/engine/target/target-darkjak.gc @@ -81,7 +81,6 @@ ;; WARN: Return type mismatch object vs symbol. (defmethod deal-damage! ((this darkjak-ball) (arg0 process) (arg1 event-message-block)) - (local-vars (sv-288 process) (sv-304 vector)) (let ((s4-0 (new 'stack 'attack-info))) (let ((v1-1 s4-0)) (set! (-> v1-1 mode) (-> this attack-mode)) @@ -113,34 +112,25 @@ (the-as uint -1) ) ) + (s0-0 (as-type arg0 process-focusable)) ) - (set! sv-288 arg0) - (let ((s0-0 (if (type? sv-288 process-focusable) - sv-288 - ) - ) - ) - (when s0-0 - (set! sv-304 s2-0) - (let ((v1-27 (-> (get-trans (the-as process-focusable s0-0) 3) quad))) - (set! (-> sv-304 quad) v1-27) - ) - (when (not (focus-test? (the-as process-focusable s0-0) hit)) - (if s1-0 - (get-intersect-point s2-0 s1-0 (-> this root) (the-as touching-shapes-entry arg1)) - ) - (cond - ((logtest? (-> group-darkjak-smack-hit flags) (sp-group-flag sp13)) - (vector-copy! (-> *launch-matrix* trans) s2-0) - (part-tracker-spawn part-tracker-subsampler :to this :group group-darkjak-smack-hit) - ) - (else - (vector-copy! (-> *launch-matrix* trans) s2-0) - (part-tracker-spawn part-tracker :to this :group group-darkjak-smack-hit) - ) + (when s0-0 + (vector-copy! s2-0 (get-trans (the-as process-focusable s0-0) 3)) + (when (not (focus-test? (the-as process-focusable s0-0) hit)) + (if s1-0 + (get-intersect-point s2-0 s1-0 (-> this root) (the-as touching-shapes-entry arg1)) + ) + (cond + ((logtest? (-> group-darkjak-smack-hit flags) (sp-group-flag sp13)) + (vector-copy! (-> *launch-matrix* trans) s2-0) + (part-tracker-spawn part-tracker-subsampler :to this :group group-darkjak-smack-hit) + ) + (else + (vector-copy! (-> *launch-matrix* trans) s2-0) + (part-tracker-spawn part-tracker :to this :group group-darkjak-smack-hit) ) - (sound-play "djak-strike-ko") ) + (sound-play "djak-strike-ko") ) ) ) @@ -1207,16 +1197,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 () @@ -1264,286 +1244,288 @@ ) ) ) - (set! sv-16 (the-as float 0.0)) - (set! sv-20 (the-as float 1.0)) - (set! sv-24 0) - (set! sv-32 0) - (set! sv-40 0) - (set! sv-48 (the-as float 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 target-flags) (target-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 (the-as float 1.0)) + (sv-24 0) + (sv-32 0) + (sv-40 0) + (sv-48 (the-as float 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 int64)) (arg2 (pointer int64))) - (let ((s3-0 (if (and (focus-test? self dark) - (nonzero? (-> self darkjak)) - (logtest? (-> self darkjak stage) (darkjak-stage tracking)) - ) - (combo-tracker-method-13 - (-> self control unknown-combo-tracker00) - (-> self control send-attack-dest) - (-> self control trans) - 24576.0 - (-> self control c-R-w fvec) - 65536.0 - ) - ) - ) - ) - (when #t - (+! (-> arg1 0) 1) - (if s3-0 - (combo-tracker-method-12 - (-> self control unknown-combo-tracker00) - (-> self control trans) - (get-trans s3-0 3) - s3-0 - (current-time) - ) - ) - (target-start-attack) - (target-danger-set! 'punch #f) - (if (not (logtest? (-> self darkjak stage) (darkjak-stage force-on endless-dark))) - (send-event self 'get-pickup (pickup-type eco-pill-dark) (- (-> *FACT-bank* darkjak-punch-inc))) - ) - (let ((v1-34 (ja-group))) - (cond - ((and v1-34 (or (= v1-34 (-> self draw art-group data 452)) (= v1-34 (-> self draw art-group data 459)))) - (ja-channel-push! 1 (seconds 0.1)) - (ja-no-eval :group! (-> self draw art-group data 454) :num! (seek!)) + (until (ja-done? 0) + (if (and (cpad-pressed? (-> self control cpad number) square) + (not (logtest? (-> self target-flags) (target-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! (-> self draw art-group data 463) :num! (seek!)) - ) - ) - ) - (initialize (-> self control impact-ctrl) self 28 3276.8 (-> self control root-prim prim-core collide-with)) - (set! (-> arg0 0) (fmax 0.0 (-> arg0 0))) + (< sv-32 2) ) - ) - (set! (-> arg2 0) 0) - 0 - ) - (& sv-16) - (the-as (pointer int64) (& sv-32)) - (the-as (pointer int64) (& sv-40)) - ) - ) - (compute-delta-align! (-> 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) (-> *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-83 (ja-group))) - (not (and (and v1-83 (= v1-83 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 (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-124 - (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-124 x) (-> v1-124 x)) (* (-> v1-124 z) (-> v1-124 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 (-> self draw art-group data 452)) - (>= f30-2 11.0) - (>= (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 452)) 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 int64)) (arg2 (pointer int64))) + (let ((s3-0 (if (and (focus-test? self dark) + (nonzero? (-> self darkjak)) + (logtest? (-> self darkjak stage) (darkjak-stage tracking)) ) - ) - (and (= gp-2 (-> self draw art-group data 459)) - (>= f30-2 11.0) - (>= (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 459)) frames num-frames) -1)) - (ja-frame-num 0) - ) - ) - (and (= gp-2 (-> self draw art-group data 454)) - (>= f30-2 49.0) - (>= (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 454)) 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 (-> self draw art-group data 463)) - (>= f30-2 62.0) - (>= (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 463)) frames num-frames) -1)) - (ja-frame-num 0) - ) - ) + (combo-tracker-method-13 + (-> self control unknown-combo-tracker00) + (-> self control send-attack-dest) + (-> self control trans) + 24576.0 + (-> self control c-R-w fvec) + 65536.0 + ) + ) ) - #t + ) + (when #t + (+! (-> arg1 0) 1) + (if s3-0 + (combo-tracker-method-12 + (-> self control unknown-combo-tracker00) + (-> self control trans) + (get-trans s3-0 3) + s3-0 + (current-time) + ) ) + (target-start-attack) + (target-danger-set! 'punch #f) + (if (not (logtest? (-> self darkjak stage) (darkjak-stage force-on endless-dark))) + (send-event self 'get-pickup (pickup-type eco-pill-dark) (- (-> *FACT-bank* darkjak-punch-inc))) + ) + (let ((v1-34 (ja-group))) + (cond + ((and v1-34 (or (= v1-34 (-> self draw art-group data 452)) (= v1-34 (-> self draw art-group data 459)))) + (ja-channel-push! 1 (seconds 0.1)) + (ja-no-eval :group! (-> self draw art-group data 454) :num! (seek!)) + ) + (else + (ja-channel-push! 1 (seconds 0.1)) + (ja-no-eval :group! (-> self draw art-group data 463) :num! (seek!)) + ) + ) + ) + (initialize (-> self control impact-ctrl) self 28 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 :board #x1) - ) - 0.0 - ) - (>= 0.0 (vector-dot (-> gp-3 best-other-tri normal) (-> self control impact-ctrl dir))) + (set! (-> arg2 0) 0) + 0 + ) + (& sv-16) + (the-as (pointer int64) (& sv-32)) + (the-as (pointer int64) (& sv-40)) + ) + ) + (compute-delta-align! (-> 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) (-> *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-83 (ja-group))) + (not (and (and v1-83 (= v1-83 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 (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)) ) - (when (= (-> gp-3 best-other-tri pat mode) (pat-mode wall)) - (cond - ((logtest? (-> group-punch-hit flags) (sp-group-flag sp13)) - (vector-copy! (-> *launch-matrix* trans) (-> gp-3 best-other-tri intersect)) - (part-tracker-spawn part-tracker-subsampler :to self :group group-punch-hit) + (let ((v1-124 + (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-124 x) (-> v1-124 x)) (* (-> v1-124 z) (-> v1-124 z)))))) + ) + (set-forward-vel sv-16) + ) ) - (else - (vector-copy! (-> *launch-matrix* trans) (-> gp-3 best-other-tri intersect)) - (part-tracker-spawn part-tracker :to self :group group-punch-hit) + (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)) ) - ) - (let ((name (static-sound-name "djak-punch-hit"))) - (play-effect-sound - (-> self skel effect) - (the-as symbol "punch") - -1.0 - (-> self control impact-ctrl joint) - (the-as basic #f) - (the-as sound-name name) + (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)) ) - ) - (activate! *camera-smush-control* 819.2 15 75 1.0 0.9 (-> *display* camera-clock)) - (set! sv-16 (the-as float -61440.0)) + (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-6 (ja-group)) - (f0-59 (ja-aframe-num 0)) - ) - (if (and (= gp-6 jakb-darkjak-attack-combo3-ja) - (>= f0-59 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 (-> self draw art-group data 452)) + (>= f30-2 11.0) + (>= (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 452)) frames num-frames) -1)) + (ja-frame-num 0) + ) + ) + (and (= gp-2 (-> self draw art-group data 459)) + (>= f30-2 11.0) + (>= (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 459)) frames num-frames) -1)) + (ja-frame-num 0) + ) + ) + (and (= gp-2 (-> self draw art-group data 454)) + (>= f30-2 49.0) + (>= (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 454)) 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 (-> self draw art-group data 463)) + (>= f30-2 62.0) + (>= (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 463)) 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 :board #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)) + (cond + ((logtest? (-> group-punch-hit flags) (sp-group-flag sp13)) + (vector-copy! (-> *launch-matrix* trans) (-> gp-3 best-other-tri intersect)) + (part-tracker-spawn part-tracker-subsampler :to self :group group-punch-hit) + ) + (else + (vector-copy! (-> *launch-matrix* trans) (-> gp-3 best-other-tri intersect)) + (part-tracker-spawn part-tracker :to self :group group-punch-hit) + ) + ) + (let ((name (static-sound-name "djak-punch-hit"))) + (play-effect-sound + (-> self skel effect) + (the-as symbol "punch") + -1.0 + (-> self control impact-ctrl joint) + (the-as basic #f) + (the-as sound-name name) + ) + ) + (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-6 (ja-group)) + (f0-59 (ja-aframe-num 0)) + ) + (if (and (= gp-6 jakb-darkjak-attack-combo3-ja) + (>= f0-59 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) 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) 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) (-> *TARGET-bank* ground-timeout)) @@ -1954,224 +1936,223 @@ (update-clock! (-> self darkjak) 16) ) :code (behavior () - (local-vars - (v1-100 symbol) - (sv-16 float) - (sv-20 float) - (sv-160 vector) - (sv-164 (function object :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*) (vector-copy! (-> self alt-cam-pos) (-> self control trans)) - (set! sv-16 (the-as float 0.0)) - (set! sv-20 (the-as float 1.0)) - (ja-channel-push! 1 (seconds 0.15)) - (when (jump-hit-ground-stuck?) - (ja-no-eval :group! (-> self draw art-group data 451) :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 (the-as float 1.0)) + ) + (ja-channel-push! 1 (seconds 0.15)) + (when (jump-hit-ground-stuck?) + (ja-no-eval :group! (-> self draw art-group data 451) :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! (-> self draw art-group data 466) :num! (seek!) :frame-num 0.0) - (until (ja-done? 0) - (compute-delta-align! (-> 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! (-> self draw art-group data 467) :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! (-> self draw art-group data 466) :num! (seek!) :frame-num 0.0) + (until (ja-done? 0) + (compute-delta-align! (-> 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! (-> self draw art-group data 467) :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 target-flags) (target-flags tf6)) + (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 target-flags) (target-flags tf6)) - (while (not (jump-hit-ground-stuck?)) - (let ((v1-105 (new-stack-vector0)) - (f0-42 (vector-dot (-> self control dynam gravity-normal) (-> self control transv))) + (set-forward-vel 0.0) + (ja-no-eval :group! (-> self draw art-group data 468) :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) + (send-event self 'get-pickup (pickup-type eco-pill-dark) (- (-> *FACT-bank* darkjak-bomb0-inc))) + (let ((sv-160 (vector<-cspace! (new 'stack-no-clear 'vector) (joint-node jakb-lod0-jg sk_lhand)))) + (let ((sv-164 (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) + ) + ) + ) + ) + ) + ) + (set! (-> sv-160 y) (-> self control root-prim prim-core world-sphere y)) + (cond + ((logtest? (-> group-darkjak-bomb flags) (sp-group-flag sp13)) + (vector-copy! (-> *launch-matrix* trans) sv-160) + (part-tracker-spawn part-tracker-subsampler :to *entity-pool* :group group-darkjak-bomb) + ) + (else + (vector-copy! (-> *launch-matrix* trans) sv-160) + (part-tracker-spawn part-tracker :to *entity-pool* :group group-darkjak-bomb) + ) + ) + (let ((gp-6 (process-spawn + manipy + :init manipy-init + sv-160 + (-> self entity) + (art-group-get-by-name *level* "skel-bomb-blast" (the-as (pointer level) #f)) + #f + 0 + :name "manipy" + :to self + :stack-size #x20000 + ) + ) + ) + (when gp-6 + (send-event (ppointer->process gp-6) 'anim-mode 'play1) + (send-event (ppointer->process gp-6) 'anim "idle") + (set-vector! (-> (the-as process-drawable (-> gp-6 0)) root scale) sv-20 1.0 sv-20 1.0) + (send-event (ppointer->process gp-6) 'trans-hook sv-164) + ) ) - 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)) + (let ((gp-8 (process-spawn + manipy + :init manipy-init + sv-160 + (-> self entity) + (art-group-get-by-name *level* "skel-generic-blast" (the-as (pointer level) #f)) + #f + 0 + :name "manipy" + :to self + :stack-size #x20000 + ) + ) + ) + (when gp-8 + (send-event (ppointer->process gp-8) 'anim-mode 'play1) + (send-event (ppointer->process gp-8) 'anim "idle") + (set-vector! (-> (the-as manipy (-> gp-8 0)) root scale) sv-20 1.0 sv-20 1.0) ) ) ) - (ja :num! (seek! (ja-aframe 33.0 0))) - (suspend) - ) - (set-forward-vel 0.0) - (ja-no-eval :group! (-> self draw art-group data 468) :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) - (send-event self 'get-pickup (pickup-type eco-pill-dark) (- (-> *FACT-bank* darkjak-bomb0-inc))) - (set! sv-160 (vector<-cspace! (new 'stack-no-clear 'vector) (joint-node jakb-lod0-jg sk_lhand))) - (set! sv-164 (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) - ) - ) - ) - ) - ) - (set! (-> sv-160 y) (-> self control root-prim prim-core world-sphere y)) - (cond - ((logtest? (-> group-darkjak-bomb flags) (sp-group-flag sp13)) - (vector-copy! (-> *launch-matrix* trans) sv-160) - (part-tracker-spawn part-tracker-subsampler :to *entity-pool* :group group-darkjak-bomb) - ) - (else - (vector-copy! (-> *launch-matrix* trans) sv-160) - (part-tracker-spawn part-tracker :to *entity-pool* :group group-darkjak-bomb) + (ja-no-eval :num! (seek! (ja-aframe 38.0 0))) + (while (not (ja-done? 0)) + (target-darkjak-bomb-collide (& sv-16) sv-20) + (set-forward-vel 0.0) + (suspend) + (ja-eval) ) - ) - (let ((gp-6 (process-spawn - manipy - :init manipy-init - sv-160 - (-> self entity) - (art-group-get-by-name *level* "skel-bomb-blast" (the-as (pointer level) #f)) - #f - 0 - :name "manipy" - :to self - :stack-size #x20000 - ) - ) - ) - (when gp-6 - (send-event (ppointer->process gp-6) 'anim-mode 'play1) - (send-event (ppointer->process gp-6) 'anim "idle") - (set-vector! (-> (the-as process-drawable (-> gp-6 0)) root scale) sv-20 1.0 sv-20 1.0) - (send-event (ppointer->process gp-6) 'trans-hook sv-164) + (ja-no-eval :num! (seek!)) + (while (not (ja-done? 0)) + (target-darkjak-bomb-collide (& sv-16) sv-20) + (set-forward-vel 0.0) + (suspend) + (ja-eval) ) - ) - (let ((gp-8 (process-spawn - manipy - :init manipy-init - sv-160 - (-> self entity) - (art-group-get-by-name *level* "skel-generic-blast" (the-as (pointer level) #f)) - #f - 0 - :name "manipy" - :to self - :stack-size #x20000 - ) - ) - ) - (when gp-8 - (send-event (ppointer->process gp-8) 'anim-mode 'play1) - (send-event (ppointer->process gp-8) 'anim "idle") - (set-vector! (-> (the-as manipy (-> gp-8 0)) root scale) sv-20 1.0 sv-20 1.0) + (remove-setting! 'music-volume) + (remove-setting! 'sfx-volume) + (remove-setting! 'ambient-volume) + (ja-no-eval :group! (-> self draw art-group data 461) :num! (seek! (ja-aframe 90.0 0)) :frame-num 0.0) + (until (ja-done? 0) + (target-darkjak-bomb-collide (& sv-16) sv-20) + (suspend) + (ja :num! (seek! (ja-aframe 90.0 0))) ) ) - (ja-no-eval :num! (seek! (ja-aframe 38.0 0))) - (while (not (ja-done? 0)) - (target-darkjak-bomb-collide (& sv-16) sv-20) - (set-forward-vel 0.0) - (suspend) - (ja-eval) - ) - (ja-no-eval :num! (seek!)) - (while (not (ja-done? 0)) - (target-darkjak-bomb-collide (& 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! (-> self draw art-group data 461) :num! (seek! (ja-aframe 90.0 0)) :frame-num 0.0) - (until (ja-done? 0) - (target-darkjak-bomb-collide (& 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 20) (go target-darkjak-get-off) @@ -2201,7 +2182,6 @@ ) (defbehavior target-bomb1-fire-shot target ((arg0 (array handle)) (arg1 int) (arg2 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) @@ -2254,19 +2234,21 @@ (s2-0 (-> *lightning-spec-id-table* 11)) (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) @@ -2311,19 +2293,6 @@ (update-clock! (-> self darkjak) 32) ) :code (behavior ((arg0 float) (arg1 float)) - (local-vars - (sv-112 (array collide-shape)) - (sv-120 int) - (sv-128 vector) - (sv-132 (array handle)) - (sv-136 int) - (sv-144 time-frame) - (sv-152 time-frame) - (sv-160 float) - (sv-164 float) - (sv-168 time-frame) - (sv-176 uint) - ) (logior! (-> self target-flags) (target-flags tf4)) (set! (-> self neck flex-blend) 0.0) (set-setting! 'music-volume 'rel 0.0 0) @@ -2356,106 +2325,112 @@ (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-112 (-> self focus-search)) - (set! sv-120 0) - (set! sv-128 (vector<-cspace! (new 'stack-no-clear 'vector) (joint-node jakb-lod0-jg main))) - (set! sv-132 (-> self handle-search)) - (set! (-> sv-132 length) 0) - (set! (-> sv-128 w) 327680.0) - (set! sv-120 (fill-actor-list-for-box *actor-hash* sv-128 (-> sv-112 data) (-> sv-112 allocated-length))) - (set! (-> sv-112 length) sv-120) - (countdown (s5-0 sv-120) - (let ((v1-56 (as-type (-> sv-112 s5-0 process) process-focusable))) - (when (and v1-56 (logtest? (process-mask crate enemy guard vehicle) (-> v1-56 mask))) - (set! (-> sv-132 (-> sv-132 length)) (process->handle v1-56)) - (+! (-> sv-132 length) 1) - (if (< (-> sv-132 allocated-length) (-> sv-132 length)) - (set! (-> sv-132 length) (-> sv-132 allocated-length)) - ) + (let ((sv-112 (-> self focus-search)) + (sv-120 0) + (sv-128 (vector<-cspace! (new 'stack-no-clear 'vector) (joint-node jakb-lod0-jg main))) + (sv-132 (-> self handle-search)) + ) + (set! (-> sv-132 length) 0) + (set! (-> sv-128 w) 327680.0) + (set! sv-120 (fill-actor-list-for-box *actor-hash* sv-128 (-> sv-112 data) (-> sv-112 allocated-length))) + (set! (-> sv-112 length) sv-120) + (countdown (s5-0 sv-120) + (let ((v1-56 (as-type (-> sv-112 s5-0 process) process-focusable))) + (when (and v1-56 (logtest? (process-mask crate enemy guard vehicle) (-> v1-56 mask))) + (set! (-> sv-132 (-> sv-132 length)) (process->handle v1-56)) + (+! (-> sv-132 length) 1) + (if (< (-> sv-132 allocated-length) (-> sv-132 length)) + (set! (-> sv-132 length) (-> sv-132 allocated-length)) + ) + ) ) ) - ) - (set! (-> self control mod-surface) (new 'static 'surface - :name 'uppercut - :turnv 524288.0 - :turnvf 15.0 - :tiltv 32768.0 - :tiltvf 150.0 - :tiltvv 262144.0 - :tiltvvf 15.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 - :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 + :turnvf 15.0 + :tiltv 32768.0 + :tiltvf 150.0 + :tiltvv 262144.0 + :tiltvvf 15.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 + :mode 'air + :flags (surface-flag air attack spin gun-off laser-hide) + ) + ) + (let ((sv-136 0) + (sv-144 (current-time)) + (sv-152 (current-time)) + (sv-160 (the-as float 0.0)) + (sv-164 (the-as float 0.0)) + ) + (let ((sv-168 (current-time))) ) - (set! sv-136 0) - (set! sv-144 (current-time)) - (set! sv-152 (current-time)) - (set! sv-160 (the-as float 0.0)) - (set! sv-164 (the-as float 0.0)) - (set! sv-168 (current-time)) - (let* ((v1-77 (-> self game)) - (a0-34 (+ (-> v1-77 attack-id) 1)) - ) - (set! (-> v1-77 attack-id) a0-34) - (set! sv-176 a0-34) - ) - (ja-channel-push! 2 (seconds 0.05)) - (ja :group! (-> self draw art-group data 469)) - (ja :chan 1 :group! (-> self draw art-group data 470)) - (while (or (< sv-136 (-> sv-132 length)) (not (time-elapsed? sv-152 (seconds 1.5)))) - (let ((v1-84 (new-stack-vector0))) - (let ((f0-10 (vector-dot (-> self control dynam gravity-normal) (-> self control transv)))) - 0.0 - (vector-! v1-84 (-> self control transv) (vector-float*! v1-84 (-> self control dynam gravity-normal) f0-10)) - ) - (let* ((f0-11 (vector-length v1-84)) - (f1-3 f0-11) - (f2-0 0.0) + (let* ((v1-77 (-> self game)) + (a0-34 (+ (-> v1-77 attack-id) 1)) ) - (vector+! - (-> self control transv) - (vector-float*! (-> self control transv) (-> self control dynam gravity-normal) f2-0) - (vector-float*! v1-84 v1-84 (/ f0-11 f1-3)) + (set! (-> v1-77 attack-id) a0-34) + (let ((sv-176 a0-34)) + (ja-channel-push! 2 (seconds 0.05)) + (ja :group! (-> self draw art-group data 469)) + (ja :chan 1 :group! (-> self draw art-group data 470)) + (while (or (< sv-136 (-> sv-132 length)) (not (time-elapsed? sv-152 (seconds 1.5)))) + (let ((v1-84 (new-stack-vector0))) + (let ((f0-10 (vector-dot (-> self control dynam gravity-normal) (-> self control transv)))) + 0.0 + (vector-! v1-84 (-> self control transv) (vector-float*! v1-84 (-> self control dynam gravity-normal) f0-10)) + ) + (let* ((f0-11 (vector-length v1-84)) + (f1-3 f0-11) + (f2-0 0.0) + ) + (vector+! + (-> self control transv) + (vector-float*! (-> self control transv) (-> self control dynam gravity-normal) f2-0) + (vector-float*! v1-84 v1-84 (/ f0-11 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-144 (seconds 0.1)) + (set! sv-144 (current-time)) + (target-bomb1-fire-shot sv-132 sv-136 (the-as int sv-176)) + (+! sv-136 1) + (if (time-elapsed? (-> self state-time) (seconds 1)) + (set! sv-164 (the-as float 1.0)) + ) + ) + (set! sv-160 (seek sv-160 sv-164 (* 6.0 (seconds-per-frame)))) + (ja :num! (loop!)) + (let ((a0-61 (-> self skel root-channel 1))) + (let ((f0-21 sv-160)) + (set! (-> a0-61 frame-interp 1) f0-21) + (set! (-> a0-61 frame-interp 0) f0-21) + ) + (set! (-> a0-61 param 0) 0.0) + (joint-control-channel-group-eval! a0-61 (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-144 (seconds 0.1)) - (set! sv-144 (current-time)) - (target-bomb1-fire-shot sv-132 sv-136 (the-as int sv-176)) - (set! sv-136 (+ sv-136 1)) - (if (time-elapsed? (-> self state-time) (seconds 1)) - (set! sv-164 (the-as float 1.0)) - ) - ) - (set! sv-160 (seek sv-160 sv-164 (* 6.0 (seconds-per-frame)))) - (ja :num! (loop!)) - (let ((a0-61 (-> self skel root-channel 1))) - (let ((f0-21 sv-160)) - (set! (-> a0-61 frame-interp 1) f0-21) - (set! (-> a0-61 frame-interp 0) f0-21) - ) - (set! (-> a0-61 param 0) 0.0) - (joint-control-channel-group-eval! a0-61 (the-as art-joint-anim #f) num-func-chan) - ) - (suspend) ) (set! (-> self post-hook) gp-0) ) diff --git a/goal_src/jak3/engine/target/target-death.gc b/goal_src/jak3/engine/target/target-death.gc index 8fa2d72c76..b563614365 100644 --- a/goal_src/jak3/engine/target/target-death.gc +++ b/goal_src/jak3/engine/target/target-death.gc @@ -227,7 +227,6 @@ ;; WARN: Return type mismatch object vs none. (defbehavior apply-pos-from-entity target ((arg0 continue-point)) - (local-vars (sv-1328 collide-query)) (let ((s1-0 (entity-by-name (the-as string (-> arg0 on-goto))))) (cond (s1-0 @@ -257,28 +256,29 @@ (set! (-> s2-0 x) (* 4096.0 (the float (-> s0-0 user-int16 0)))) (set! (-> s2-0 y) (-> s1-0 extra trans y)) (set! (-> s2-0 z) (* 4096.0 (the float (-> s0-0 user-int16 1)))) - (set! sv-1328 (new 'stack-no-clear 'collide-query)) - (set-vector! (-> sv-1328 move-dist) 0.0 -204800.0 0.0 1.0) - (vector-copy! (-> sv-1328 start-pos) s2-0) - (+! (-> sv-1328 start-pos y) 102400.0) - (let ((v1-20 sv-1328)) - (set! (-> v1-20 radius) 409.6) - (set! (-> v1-20 collide-with) (collide-spec backgnd)) - (set! (-> v1-20 ignore-process0) #f) - (set! (-> v1-20 ignore-process1) #f) - (set! (-> v1-20 ignore-pat) - (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) + (let ((sv-1328 (new 'stack-no-clear 'collide-query))) + (set-vector! (-> sv-1328 move-dist) 0.0 -204800.0 0.0 1.0) + (vector-copy! (-> sv-1328 start-pos) s2-0) + (+! (-> sv-1328 start-pos y) 102400.0) + (let ((v1-20 sv-1328)) + (set! (-> v1-20 radius) 409.6) + (set! (-> v1-20 collide-with) (collide-spec backgnd)) + (set! (-> v1-20 ignore-process0) #f) + (set! (-> v1-20 ignore-process1) #f) + (set! (-> v1-20 ignore-pat) + (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) + ) + (set! (-> v1-20 action-mask) (collide-action solid)) + ) + (let ((f0-12 (fill-and-probe-using-line-sphere *collide-cache* sv-1328))) + (cond + ((>= f0-12 0.0) + (vector+*! s2-0 (-> sv-1328 start-pos) (-> sv-1328 move-dist) f0-12) + (set! (-> s2-0 y) (+ 4096.0 (-> s2-0 y))) + ) + (else + (format 0 "failed to find gem ground on pos-from-entity~%") ) - (set! (-> v1-20 action-mask) (collide-action solid)) - ) - (let ((f0-12 (fill-and-probe-using-line-sphere *collide-cache* sv-1328))) - (cond - ((>= f0-12 0.0) - (vector+*! s2-0 (-> sv-1328 start-pos) (-> sv-1328 move-dist) f0-12) - (set! (-> s2-0 y) (+ 4096.0 (-> s2-0 y))) - ) - (else - (format 0 "failed to find gem ground on pos-from-entity~%") ) ) ) @@ -1335,336 +1335,337 @@ ) ) :code (behavior ((arg0 symbol) (arg1 attack-info)) - (local-vars (sv-32 attack-info) (sv-36 vector)) (logclear! (-> self water flags) (water-flag 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) (-> *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) - ) - ) - ) - (let ((v1-13 (if (logtest? (-> arg1 mask) (attack-mask mode)) - (-> arg1 mode) - 'generic - ) - ) + (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) (-> *TARGET-bank* hit-invulnerable-timeout)) + (set! (-> v1-7 damage) (-> *FACT-bank* health-default-inc)) ) - (when (or (= v1-13 'lava) (or (= v1-13 'melt) (= v1-13 'fry) (= v1-13 'slime))) - (let ((v1-16 sv-32)) - (set! (-> v1-16 shove-up) 32768.0) - (set! (-> v1-16 angle) 'lava) - (set! (-> v1-16 control) 1.0) - (set! (-> v1-16 damage) 4.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)) - ) - (when (and (focus-test? self dark) (nonzero? (-> self darkjak))) - (set! (-> sv-32 damage) (fmax 1.0 (ceil (/ (-> sv-32 damage) 2)))) - 0 - ) - (vector-copy! sv-36 (-> sv-32 vector)) - (let ((f0-19 (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-19) - '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))) - (vector-copy! gp-1 (-> self control last-trans-on-ground)) - (ja-channel-set! 0) - (suspend-for (seconds 1) - ) - (move-to-point! (-> self control) gp-1) - ) - (vector-copy! (-> self control camera-pos) (-> self control trans)) - (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)) - ) - ) + ) ) - (('fry) - (pickup-collectable! (-> self fact) (pickup-type health) (- (-> sv-32 damage)) (the-as handle #f)) - (cond - ((and (= (-> self game mode) 'play) (>= 0.0 (-> self fact health))) - (go target-death (-> sv-32 mode)) - ) - (else - (sound-play "death-melt") - (cond - ((logtest? (-> group-lava-death flags) (sp-group-flag sp13)) - (vector-copy! (-> *launch-matrix* trans) (-> self control trans)) - (part-tracker-spawn part-tracker-subsampler :to *entity-pool* :group group-lava-death) - ) - (else - (vector-copy! (-> *launch-matrix* trans) (-> self control trans)) - (part-tracker-spawn part-tracker :to *entity-pool* :group group-lava-death) - ) - ) - ) - ) - ) - (('lava 'melt 'slime) - (pickup-collectable! (-> self fact) (pickup-type health) -1000.0 (the-as handle #f)) - (cond - ((and (= (-> self game mode) 'play) (>= 0.0 (-> self fact health))) - (go target-death (-> sv-32 mode)) - ) - (else - (sound-play "death-melt") - (cond - ((logtest? (-> group-lava-death flags) (sp-group-flag sp13)) - (vector-copy! (-> *launch-matrix* trans) (-> self control trans)) - (part-tracker-spawn part-tracker-subsampler :to *entity-pool* :group group-lava-death) - ) - (else - (vector-copy! (-> *launch-matrix* trans) (-> self control trans)) - (part-tracker-spawn part-tracker :to *entity-pool* :group group-lava-death) - ) - ) - ) - ) - ) - (('drown-death - 'sharkey - 'dark-eco-pool - 'instant-death - 'crush - 'death - 'grenade - 'bot - 'turret - 'centipede - 'big-explosion - 'tentacle - ) - (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) - (case (-> sv-32 angle) - (('front) - (forward-up-nopitch->quaternion - (-> self control dir-targ) - (vector-negate! (new 'stack-no-clear 'vector) sv-36) - (-> self control dynam gravity-normal) - ) - ) - (else - (forward-up-nopitch->quaternion (-> self control dir-targ) sv-36 (-> self control dynam gravity-normal)) - ) - ) - (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-211 (-> sv-32 mode)) - (gp-9 (cond - ((= v1-211 'shock-red) - group-lightning-red-glow - ) - ((= v1-211 'shock-green) - group-lightning-green-glow - ) - (else - group-lightning-glow - ) + (let ((v1-13 (if (logtest? (-> arg1 mask) (attack-mask mode)) + (-> arg1 mode) + 'generic ) - ) - ) - (if (logtest? (-> gp-9 flags) (sp-group-flag sp13)) - (part-tracker-spawn - part-tracker-subsampler - :to self - :group gp-9 - :duration (seconds 1) - :target self - :mat-joint 6 - ) - (part-tracker-spawn part-tracker :to self :group gp-9 :duration (seconds 1) :target self :mat-joint 6) - ) - ) - (let ((gp-10 (-> 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-247 (new-stack-vector0))) - (let ((f0-36 (vector-dot (-> self control dynam gravity-normal) (-> self control transv)))) - 0.0 - (vector-! - v1-247 - (-> self control transv) - (vector-float*! v1-247 (-> self control dynam gravity-normal) f0-36) - ) - ) - (let* ((f0-37 (vector-length v1-247)) - (f1-6 f0-37) - (f2-0 0.0) ) - (vector+! - (-> self control transv) - (vector-float*! (-> self control transv) (-> self control dynam gravity-normal) f2-0) - (vector-float*! v1-247 v1-247 (/ f0-37 f1-6)) + ) + (when (or (= v1-13 'lava) (or (= v1-13 'melt) (= v1-13 'fry) (= v1-13 'slime))) + (let ((v1-16 sv-32)) + (set! (-> v1-16 shove-up) 32768.0) + (set! (-> v1-16 angle) 'lava) + (set! (-> v1-16 control) 1.0) + (set! (-> v1-16 damage) 4.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)) + ) + (when (and (focus-test? self dark) (nonzero? (-> self darkjak))) + (set! (-> sv-32 damage) (fmax 1.0 (ceil (/ (-> sv-32 damage) 2)))) + 0 + ) + (vector-copy! sv-36 (-> sv-32 vector)) + (let ((f0-19 (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-19) + '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))) + (vector-copy! gp-1 (-> self control last-trans-on-ground)) + (ja-channel-set! 0) + (suspend-for (seconds 1) + ) + (move-to-point! (-> self control) gp-1) + ) + (vector-copy! (-> self control camera-pos) (-> self control trans)) + (send-event *camera* 'teleport) + (go target-stance) + ) + (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-263 (new-stack-vector0)) - (f0-44 (vector-dot (-> self control dynam gravity-normal) (-> self control transv))) - ) - 0.0 - (vector-! - v1-263 - (-> self control transv) - (vector-float*! v1-263 (-> self control dynam gravity-normal) f0-44) - ) - (let* ((f1-9 (vector-length v1-263)) - (f2-1 f1-9) - (f0-45 (+ f0-44 (* 286720.0 (seconds-per-frame)))) - ) - (vector+! - (-> self control transv) - (vector-float*! (-> self control transv) (-> self control dynam gravity-normal) f0-45) - (vector-float*! v1-263 v1-263 (/ f1-9 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 + (('fry) + (pickup-collectable! (-> self fact) (pickup-type health) (- (-> sv-32 damage)) (the-as handle #f)) + (cond + ((and (= (-> self game mode) 'play) (>= 0.0 (-> self fact health))) + (go target-death (-> sv-32 mode)) + ) + (else + (sound-play "death-melt") + (cond + ((logtest? (-> group-lava-death flags) (sp-group-flag sp13)) + (vector-copy! (-> *launch-matrix* trans) (-> self control trans)) + (part-tracker-spawn part-tracker-subsampler :to *entity-pool* :group group-lava-death) ) - ) - (('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* 160) - 0 - 0 - 40960.0 + (else + (vector-copy! (-> *launch-matrix* trans) (-> self control trans)) + (part-tracker-spawn part-tracker :to *entity-pool* :group group-lava-death) ) ) ) ) - (suspend) - (ja :num! (seek!)) ) - (set! (-> sv-32 angle) 'back) - (set! (-> self post-hook) gp-10) + (('lava 'melt 'slime) + (pickup-collectable! (-> self fact) (pickup-type health) -1000.0 (the-as handle #f)) + (cond + ((and (= (-> self game mode) 'play) (>= 0.0 (-> self fact health))) + (go target-death (-> sv-32 mode)) + ) + (else + (sound-play "death-melt") + (cond + ((logtest? (-> group-lava-death flags) (sp-group-flag sp13)) + (vector-copy! (-> *launch-matrix* trans) (-> self control trans)) + (part-tracker-spawn part-tracker-subsampler :to *entity-pool* :group group-lava-death) + ) + (else + (vector-copy! (-> *launch-matrix* trans) (-> self control trans)) + (part-tracker-spawn part-tracker :to *entity-pool* :group group-lava-death) + ) + ) + ) + ) + ) + (('drown-death + 'sharkey + 'dark-eco-pool + 'instant-death + 'crush + 'death + 'grenade + 'bot + 'turret + 'centipede + 'big-explosion + 'tentacle + ) + (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) + (case (-> sv-32 angle) + (('front) + (forward-up-nopitch->quaternion + (-> self control dir-targ) + (vector-negate! (new 'stack-no-clear 'vector) sv-36) + (-> self control dynam gravity-normal) + ) + ) + (else + (forward-up-nopitch->quaternion (-> self control dir-targ) sv-36 (-> self control dynam gravity-normal)) + ) + ) + (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-211 (-> sv-32 mode)) + (gp-9 (cond + ((= v1-211 'shock-red) + group-lightning-red-glow + ) + ((= v1-211 'shock-green) + group-lightning-green-glow + ) + (else + group-lightning-glow + ) + ) + ) + ) + (if (logtest? (-> gp-9 flags) (sp-group-flag sp13)) + (part-tracker-spawn + part-tracker-subsampler + :to self + :group gp-9 + :duration (seconds 1) + :target self + :mat-joint 6 + ) + (part-tracker-spawn part-tracker :to self :group gp-9 :duration (seconds 1) :target self :mat-joint 6) + ) + ) + (let ((gp-10 (-> 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-247 (new-stack-vector0))) + (let ((f0-36 (vector-dot (-> self control dynam gravity-normal) (-> self control transv)))) + 0.0 + (vector-! + v1-247 + (-> self control transv) + (vector-float*! v1-247 (-> self control dynam gravity-normal) f0-36) + ) + ) + (let* ((f0-37 (vector-length v1-247)) + (f1-6 f0-37) + (f2-0 0.0) + ) + (vector+! + (-> self control transv) + (vector-float*! (-> self control transv) (-> self control dynam gravity-normal) f2-0) + (vector-float*! v1-247 v1-247 (/ f0-37 f1-6)) + ) + ) + ) + (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-263 (new-stack-vector0)) + (f0-44 (vector-dot (-> self control dynam gravity-normal) (-> self control transv))) + ) + 0.0 + (vector-! + v1-263 + (-> self control transv) + (vector-float*! v1-263 (-> self control dynam gravity-normal) f0-44) + ) + (let* ((f1-9 (vector-length v1-263)) + (f2-1 f1-9) + (f0-45 (+ f0-44 (* 286720.0 (seconds-per-frame)))) + ) + (vector+! + (-> self control transv) + (vector-float*! (-> self control transv) (-> self control dynam gravity-normal) f0-45) + (vector-float*! v1-263 v1-263 (/ f1-9 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* 160) + 0 + 0 + 40960.0 + ) + ) + ) + ) + (suspend) + (ja :num! (seek!)) + ) + (set! (-> sv-32 angle) 'back) + (set! (-> self post-hook) gp-10) + ) + ) + (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)) 'notice '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) ) - ) - (when (and (= (-> self game mode) 'play) (and (>= 0.0 (-> self fact health)) (using-gun? self))) - (send-event (ppointer->process (-> self gun gun)) 'notice '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) - (cond - ((and (= (-> self game mode) 'play) (>= 0.0 (-> self fact health))) - (go target-death (-> sv-32 mode)) - ) - ((and (and (focus-test? self dark) (nonzero? (-> self darkjak))) (>= 1.0 (-> self fact health))) - (go target-darkjak-get-off) - ) - ((and (and (focus-test? self light) (nonzero? (-> self lightjak))) (>= 1.0 (-> self fact health))) - (go target-lightjak-get-off) - ) - (else - (go target-hit-ground #f) + (cond + ((and (= (-> self game mode) 'play) (>= 0.0 (-> self fact health))) + (go target-death (-> sv-32 mode)) + ) + ((and (and (focus-test? self dark) (nonzero? (-> self darkjak))) (>= 1.0 (-> self fact health))) + (go target-darkjak-get-off) + ) + ((and (and (focus-test? self light) (nonzero? (-> self lightjak))) (>= 1.0 (-> self fact health))) + (go target-lightjak-get-off) + ) + (else + (go target-hit-ground #f) + ) ) ) ) @@ -1815,7 +1816,6 @@ ) (defbehavior target-death-main target ((arg0 symbol)) - (local-vars (sv-96 level) (sv-112 vector)) (let ((v1-0 arg0)) (if (= v1-0 'tar) (sound-play "death-drown") @@ -1905,91 +1905,77 @@ (send-event self 'blend-shape #t) (apply-settings *setting-control*) (flag-setup) - (set! sv-96 (the-as level #f)) - (art-group-get-by-name *level* "daxter-highres" (new 'stack-no-clear 'array 'level 1)) - (let ((s4-1 (if (and sv-96 (nonzero? (-> sv-96 entity)) (> (-> sv-96 entity length) 0)) - (-> sv-96 entity data 0 entity) - ) - ) - ) - (when s4-1 - (let ((s5-2 (ppointer->handle (process-spawn - pov-camera - (-> self control trans) - (art-group-get-by-name *level* "skel-scenecamera" (the-as (pointer level) #f)) - gp-2 - 12 - self - '() - :name "pov-camera" - :to *target-pool* - ) - ) - ) - ) - (when (handle->process s5-2) - (let* ((s2-1 (get-process *default-dead-pool* manipy #x20000 1)) - (s3-1 - (when s2-1 - (let ((t9-33 (method-of-type manipy activate))) - (t9-33 (the-as manipy s2-1) (handle->process s5-2) "sidekick-highres" (the-as pointer #x70004000)) - ) - (let ((s3-2 run-function-in-process) - (s1-1 s2-1) - (s0-1 manipy-init) - ) - (set! sv-112 (-> self control trans)) - (let ((t0-6 (art-group-get-by-name *level* "skel-sidekick-highres" (the-as (pointer level) #f))) - (t1-5 #f) - (t2-3 0) - ) - ((the-as (function object object object object object object object none) s3-2) - s1-1 - s0-1 - sv-112 - s4-1 - t0-6 - t1-5 - t2-3 - ) - ) - ) - (-> s2-1 ppointer) - ) - ) - ) - (process-spawn-function - process - (lambda :behavior target ((arg0 handle)) (suspend) (send-event (handle->process arg0) 'light-index 240)) - (ppointer->handle s3-1) - :to self - ) - (send-event (ppointer->process s3-1) 'anim-mode 'clone-anim) - (send-event (ppointer->process s3-1) 'blend-shape #t) - ) - (send-event (handle->process s5-2) 'music-movie-volume 0.0) - (send-event (handle->process s5-2) 'sfx-movie-volume 0.5) - (send-event (handle->process s5-2) 'ambient-movie-volume 0.5) - (set! (-> self post-hook) target-no-ja-move-post) - (ja-channel-set! 0) - (while (handle->process s5-2) - (gui-control-method-12 - *gui-control* - self - (gui-channel art-load) - (gui-action queue) - (-> gp-2 name) - 0 - -99.0 - (new 'static 'sound-id) - ) - (suspend) - ) - (set-blackout-frames (seconds 0.2)) - (let ((a0-83 (handle->process s5-2))) - (if a0-83 - (deactivate a0-83) + (let ((sv-96 (the-as level #f))) + (art-group-get-by-name *level* "daxter-highres" (new 'stack-no-clear 'array 'level 1)) + (let ((s4-1 (if (and sv-96 (nonzero? (-> sv-96 entity)) (> (-> sv-96 entity length) 0)) + (-> sv-96 entity data 0 entity) + ) ) + ) + (when s4-1 + (let ((s5-2 (ppointer->handle (process-spawn + pov-camera + (-> self control trans) + (art-group-get-by-name *level* "skel-scenecamera" (the-as (pointer level) #f)) + gp-2 + 12 + self + '() + :name "pov-camera" + :to *target-pool* + ) + ) + ) + ) + (when (handle->process s5-2) + (let ((s3-1 + (process-spawn + manipy + :init manipy-init + (-> self control trans) + s4-1 + (art-group-get-by-name *level* "skel-sidekick-highres" (the-as (pointer level) #f)) + #f + 0 + :name "sidekick-highres" + :to (handle->process s5-2) + :stack-size #x20000 + ) + ) + ) + (process-spawn-function + process + (lambda :behavior target ((arg0 handle)) (suspend) (send-event (handle->process arg0) 'light-index 240)) + (ppointer->handle s3-1) + :to self + ) + (send-event (ppointer->process s3-1) 'anim-mode 'clone-anim) + (send-event (ppointer->process s3-1) 'blend-shape #t) + ) + (send-event (handle->process s5-2) 'music-movie-volume 0.0) + (send-event (handle->process s5-2) 'sfx-movie-volume 0.5) + (send-event (handle->process s5-2) 'ambient-movie-volume 0.5) + (set! (-> self post-hook) target-no-ja-move-post) + (ja-channel-set! 0) + (while (handle->process s5-2) + (gui-control-method-12 + *gui-control* + self + (gui-channel art-load) + (gui-action queue) + (-> gp-2 name) + 0 + -99.0 + (new 'static 'sound-id) + ) + (suspend) + ) + (set-blackout-frames (seconds 0.2)) + (let ((a0-83 (handle->process s5-2))) + (if a0-83 + (deactivate a0-83) + ) + ) ) ) ) diff --git a/goal_src/jak3/engine/target/target-handler.gc b/goal_src/jak3/engine/target/target-handler.gc index bd65d01091..72276e2469 100644 --- a/goal_src/jak3/engine/target/target-handler.gc +++ b/goal_src/jak3/engine/target/target-handler.gc @@ -274,22 +274,15 @@ ;; WARN: Return type mismatch object vs none. (defbehavior target-darkjak-effect-trans target ((arg0 handle) (arg1 (pointer process-drawable)) (arg2 (pointer time-frame)) (arg3 time-frame)) - (local-vars (sv-112 vector) (sv-128 matrix)) (let ((s2-0 sp-launch-particles-var) (s1-0 *sp-particle-system-2d*) (s0-0 (-> *part-id-table* 173)) + (sv-128 *launch-matrix*) ) - (set! sv-128 *launch-matrix*) - (set! sv-112 (-> sv-128 trans)) - (let ((v1-6 (-> (process-drawable-random-point! (ppointer->process arg1) (new 'stack-no-clear 'vector)) quad))) - (set! (-> sv-112 quad) v1-6) - ) - (let ((a3-1 #f) - (t0-0 #f) - (t1-0 1.0) - ) - (s2-0 s1-0 s0-0 sv-128 (the-as sparticle-launch-state a3-1) (the-as sparticle-launch-control t0-0) t1-0) + (let ((sv-112 (-> sv-128 trans))) + (vector-copy! sv-112 (process-drawable-random-point! (ppointer->process arg1) (new 'stack-no-clear 'vector))) ) + (s2-0 s1-0 s0-0 sv-128 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0) ) (send-event (ppointer->process arg1) 'color-effect 'dark (seconds 0.2)) (when (time-elapsed? (-> arg2 0) (seconds 0.05)) @@ -330,9 +323,8 @@ ) (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-128 vector) (sv-132 touching-prims-entry) (sv-136 int) (sv-144 int)) - (set! sv-144 arg3) - (let ((s1-0 arg4) + (let ((sv-144 arg3) + (s1-0 arg4) (s0-0 arg5) ) (if (and (= arg1 'bomb) @@ -346,339 +338,342 @@ (let* ((f30-0 (penetrate-using->damage s0-0)) (s5-0 (as-type arg0 process-focusable)) (s2-1 (and s5-0 (focus-test? s5-0 dead hit))) + (a1-2 (new 'stack-no-clear 'event-message-block)) ) - (set! sv-96 - (the-as symbol (send-event - arg0 - 'attack - arg2 - (static-attack-info :mask (vehicle-impulse-factor) ((id (the-as uint sv-144)) - (damage f30-0) - (vehicle-damage-factor 1.0) - (vehicle-impulse-factor 1.0) - (mode arg1) - (count (the-as uint s1-0)) - (penetrate-using s0-0) - ) - ) - ) + (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 uint (static-attack-info :mask (vehicle-impulse-factor) ((id (the-as uint sv-144)) + (damage f30-0) + (vehicle-damage-factor 1.0) + (vehicle-impulse-factor 1.0) + (mode arg1) + (count (the-as uint s1-0)) + (penetrate-using s0-0) + ) + ) ) ) - (when sv-96 - (let ((v1-17 (new 'stack-no-clear 'vector))) - (vector-copy! v1-17 (-> self control trans)) - (set! sv-128 v1-17) - ) - (set! sv-132 (if arg2 - (prims-touching? arg2 (-> self control) (the-as uint 256)) - ) - ) - (set! sv-136 -1) - (cond - ((not arg2) - ) - (sv-132 - (set! sv-136 1) - (get-intersect-point sv-128 sv-132 (-> self control) arg2) - ) - ((let ((v0-6 (prims-touching? arg2 (-> self control) (the-as uint 128)))) - (set! sv-132 v0-6) - v0-6 - ) - (set! sv-136 0) - (get-intersect-point sv-128 sv-132 (-> self control) arg2) - ) - ) - (set! (-> self control send-attack-dest) (process->handle arg0)) - (set-time! (-> self control send-attack-time)) - (send-event self 'hit arg1 arg0 arg2 sv-128) - ;; og:preserve-this process cast - (set! arg0 (the process (and (and (focus-test? self dark) - (nonzero? (-> self darkjak)) - (logtest? (-> self darkjak stage) (darkjak-stage active)) - ) - arg0 - ) - ) - ) - (when arg0 - (when (and s5-0 (not s2-1) (-> self control danger-mode) (not (logtest? (-> s5-0 mask) (process-mask dark-effect)))) - (logior! (-> s5-0 mask) (process-mask dark-effect)) - (process-spawn-function - process - (lambda :behavior target - ((arg0 handle)) - (local-vars (sv-16 int)) - (let ((gp-0 (-> self parent))) - (let ((s4-0 (current-time))) - (set! sv-16 0) - (+! (-> self clock ref-count) -1) - (+! (-> gp-0 0 clock ref-count) 1) - (set! (-> self clock) (-> gp-0 0 clock)) - (while (let ((v1-10 gp-0)) - (and (or (focus-test? - (the-as process-focusable (if v1-10 - (the-as process-focusable (-> v1-10 0 self)) - ) - ) - dead - hit - ) - (let ((v1-15 gp-0)) - (and (-> (the-as process (if v1-15 - (the-as process (-> v1-15 0 self)) - ) - ) - next-state - ) - (let ((v1-18 gp-0)) - (= (-> (the-as process (if v1-18 - (the-as process (-> v1-18 0 self)) - ) - ) - next-state - name + (let ((sv-96 (the-as symbol (send-event-function arg0 a1-2)))) + (when sv-96 + (let ((v1-17 (new 'stack-no-clear 'vector))) + (vector-copy! v1-17 (-> self control trans)) + (let ((sv-128 v1-17) + (sv-132 (if arg2 + (prims-touching? arg2 (-> self control) (the-as uint 256)) + ) + ) + (sv-136 -1) + ) + (cond + ((not arg2) + ) + (sv-132 + (set! sv-136 1) + (get-intersect-point sv-128 sv-132 (-> self control) arg2) + ) + ((let ((v0-6 (prims-touching? arg2 (-> self control) (the-as uint 128)))) + (set! sv-132 v0-6) + v0-6 + ) + (set! sv-136 0) + (get-intersect-point sv-128 sv-132 (-> self control) arg2) + ) + ) + (set! (-> self control send-attack-dest) (process->handle arg0)) + (set-time! (-> self control send-attack-time)) + (send-event self 'hit arg1 arg0 arg2 sv-128) + ;; og:preserve-this process cast + (set! arg0 (the process (and (and (focus-test? self dark) + (nonzero? (-> self darkjak)) + (logtest? (-> self darkjak stage) (darkjak-stage active)) + ) + arg0 + ) + )) + (when arg0 + (when (and s5-0 (not s2-1) (-> self control danger-mode) (not (logtest? (-> s5-0 mask) (process-mask dark-effect)))) + (logior! (-> s5-0 mask) (process-mask dark-effect)) + (process-spawn-function + process + (lambda :behavior target + ((arg0 handle)) + (let ((gp-0 (-> self parent))) + (let ((s4-0 (current-time)) + (sv-16 0) + ) + (+! (-> self clock ref-count) -1) + (+! (-> gp-0 0 clock ref-count) 1) + (set! (-> self clock) (-> gp-0 0 clock)) + (while (let ((v1-10 gp-0)) + (and (or (focus-test? + (the-as process-focusable (if v1-10 + (the-as process-focusable (-> v1-10 0 self)) + ) ) - 'knocked - ) - ) + dead + hit + ) + (let ((v1-15 gp-0)) + (and (-> (the-as process (if v1-15 + (the-as process (-> v1-15 0 self)) + ) + ) + next-state + ) + (let ((v1-18 gp-0)) + (= (-> (the-as process (if v1-18 + (the-as process (-> v1-18 0 self)) + ) + ) + next-state + name + ) + 'knocked + ) + ) + ) + ) + ) + (not (time-elapsed? s4-0 (seconds 15))) + (not (logtest? (-> (the-as process-focusable (-> gp-0 0)) draw status) (draw-control-status no-draw no-draw-temp)) ) ) - ) - (not (time-elapsed? s4-0 (seconds 15))) - (not (logtest? (-> (the-as process-focusable (-> gp-0 0)) draw status) (draw-control-status no-draw no-draw-temp)) - ) - ) - ) - (target-darkjak-effect-trans - arg0 - (the-as (pointer process-drawable) gp-0) - (the-as (pointer time-frame) (& sv-16)) - s4-0 + ) + (target-darkjak-effect-trans + arg0 + (the-as (pointer process-drawable) gp-0) + (the-as (pointer time-frame) (& sv-16)) + s4-0 + ) + (suspend) + ) + ) + (logclear! (-> gp-0 0 mask) (process-mask dark-effect)) + (send-event (ppointer->process gp-0) 'color-effect #f 0) ) - (suspend) + (none) ) + (process->handle self) + :to s5-0 ) - (logclear! (-> gp-0 0 mask) (process-mask dark-effect)) - (send-event (ppointer->process gp-0) 'color-effect #f 0) ) - (none) ) - (process->handle self) - :to s5-0 - ) - ) - ) - (let ((v1-57 arg1)) - (cond - ((or (= v1-57 'spin) (= v1-57 'spin-air) (= v1-57 'board-spin) (= v1-57 'board-zap)) - (case sv-136 - ((1) + (let ((v1-57 arg1)) (cond - ((logtest? (-> group-spin-hit flags) (sp-group-flag sp13)) - (vector-copy! (-> *launch-matrix* trans) sv-128) - (part-tracker-spawn part-tracker-subsampler :to self :group group-spin-hit) - ) - (else - (vector-copy! (-> *launch-matrix* trans) sv-128) - (part-tracker-spawn part-tracker :to self :group group-spin-hit) - ) - ) - ) - (else - (do-effect (-> self skel effect) "group-spin-hit" -1.0 49) - ) - ) - (play-effect-sound - (-> self skel effect) - (the-as symbol "sound") - -1.0 - 49 - (the-as basic #f) - (cond - ((= arg1 'board-spin) - (static-sound-name "board-impact") - ) - ((= arg1 'board-zap) - (static-sound-name "board-zap-hit") - ) - ((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-57 'get-on) (= v1-57 'darkjak)) - (let ((v1-105 sv-136)) - (when (or (zero? v1-105) (= v1-105 1)) - (cond - ((logtest? (-> group-punch-hit flags) (sp-group-flag sp13)) - (vector-copy! (-> *launch-matrix* trans) sv-128) - (part-tracker-spawn part-tracker-subsampler :to self :group group-punch-hit) - ) - (else - (vector-copy! (-> *launch-matrix* trans) sv-128) - (part-tracker-spawn part-tracker :to self :group group-punch-hit) - ) - ) - ) - ) - (play-effect-sound - (-> self skel effect) - (the-as symbol "sound") - -1.0 - 3 - (the-as basic #f) - (static-sound-name "get-on-hit") - ) - ) - ((= v1-57 'shield) - (play-effect-sound - (-> self skel effect) - (the-as symbol "sound") - -1.0 - 3 - (the-as basic #f) - (static-sound-name "shield-attack") - ) - ) - ((or (= v1-57 'punch) (= v1-57 'dark-smack) (= v1-57 'mech-punch)) - (let ((v1-147 sv-136)) - (when (or (zero? v1-147) (= v1-147 1)) - (cond - ((logtest? (-> group-punch-hit flags) (sp-group-flag sp13)) - (vector-copy! (-> *launch-matrix* trans) sv-128) - (part-tracker-spawn part-tracker-subsampler :to self :group group-punch-hit) - ) - (else - (vector-copy! (-> *launch-matrix* trans) sv-128) - (part-tracker-spawn part-tracker :to self :group group-punch-hit) - ) - ) - ) - ) - (cond - ((= arg1 'mech-punch) - (play-effect-sound - (-> self skel effect) - (the-as symbol "sound") - -1.0 - 28 - (the-as basic #f) - (static-sound-name "mech-punch-hit") - ) - ) - (else - (let ((name (if (using-gun? self) - (the-as sound-name (static-sound-name "gun-punch-hit")) - (the-as sound-name (static-sound-name "punch-hit")) - ) - ) + ((or (= v1-57 'spin) (= v1-57 'spin-air) (= v1-57 'board-spin) (= v1-57 'board-zap)) + (case sv-136 + ((1) + (cond + ((logtest? (-> group-spin-hit flags) (sp-group-flag sp13)) + (vector-copy! (-> *launch-matrix* trans) sv-128) + (part-tracker-spawn part-tracker-subsampler :to self :group group-spin-hit) + ) + (else + (vector-copy! (-> *launch-matrix* trans) sv-128) + (part-tracker-spawn part-tracker :to self :group group-spin-hit) + ) + ) + ) + (else + (do-effect (-> self skel effect) "group-spin-hit" -1.0 49) ) + ) + (play-effect-sound + (-> self skel effect) + (the-as symbol "sound") + -1.0 + 49 + (the-as basic #f) + (cond + ((= arg1 'board-spin) + (static-sound-name "board-impact") + ) + ((= arg1 'board-zap) + (static-sound-name "board-zap-hit") + ) + ((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-57 'get-on) (= v1-57 'darkjak)) + (let ((v1-105 sv-136)) + (when (or (zero? v1-105) (= v1-105 1)) + (cond + ((logtest? (-> group-punch-hit flags) (sp-group-flag sp13)) + (vector-copy! (-> *launch-matrix* trans) sv-128) + (part-tracker-spawn part-tracker-subsampler :to self :group group-punch-hit) + ) + (else + (vector-copy! (-> *launch-matrix* trans) sv-128) + (part-tracker-spawn part-tracker :to self :group group-punch-hit) + ) + ) + ) + ) + (play-effect-sound + (-> self skel effect) + (the-as symbol "sound") + -1.0 + 3 + (the-as basic #f) + (static-sound-name "get-on-hit") + ) + ) + ((= v1-57 'shield) + (play-effect-sound + (-> self skel effect) + (the-as symbol "sound") + -1.0 + 3 + (the-as basic #f) + (static-sound-name "shield-attack") + ) + ) + ((or (= v1-57 'punch) (= v1-57 'dark-smack) (= v1-57 'mech-punch)) + (let ((v1-147 sv-136)) + (when (or (zero? v1-147) (= v1-147 1)) + (cond + ((logtest? (-> group-punch-hit flags) (sp-group-flag sp13)) + (vector-copy! (-> *launch-matrix* trans) sv-128) + (part-tracker-spawn part-tracker-subsampler :to self :group group-punch-hit) + ) + (else + (vector-copy! (-> *launch-matrix* trans) sv-128) + (part-tracker-spawn part-tracker :to self :group group-punch-hit) + ) + ) + ) + ) + (cond + ((= arg1 'mech-punch) + (play-effect-sound + (-> self skel effect) + (the-as symbol "sound") + -1.0 + 28 + (the-as basic #f) + (static-sound-name "mech-punch-hit") + ) + ) + (else + (let ((name (if (using-gun? self) + (the-as sound-name (static-sound-name "gun-punch-hit")) + (the-as sound-name (static-sound-name "punch-hit")) + ) + ) + ) + (play-effect-sound + (-> self skel effect) + (the-as symbol "sound") + -1.0 + 28 + (the-as basic #f) + (the-as sound-name name) + ) + ) + ) + ) + (cpad-set-buzz! (-> *cpad-list* cpads 0) 1 178 (seconds 0.1)) + ) + ((= v1-57 'flip) + (play-effect-sound + (-> self skel effect) + (the-as symbol "sound") + -1.0 + 49 + (the-as basic #f) + (static-sound-name "punch-hit") + ) + (cpad-set-buzz! (-> *cpad-list* cpads 0) 1 127 (seconds 0.1)) + ) + ((= v1-57 'uppercut) + (let ((v1-199 sv-136)) + (when (or (zero? v1-199) (= v1-199 1)) + (cond + ((logtest? (-> group-punch-hit flags) (sp-group-flag sp13)) + (vector-copy! (-> *launch-matrix* trans) sv-128) + (part-tracker-spawn part-tracker-subsampler :to self :group group-punch-hit) + ) + (else + (vector-copy! (-> *launch-matrix* trans) sv-128) + (part-tracker-spawn part-tracker :to self :group group-punch-hit) + ) + ) + ) + ) + (do-effect (-> self skel effect) "group-uppercut-hit" -1.0 28) (play-effect-sound (-> self skel effect) (the-as symbol "sound") -1.0 28 (the-as basic #f) - (the-as sound-name name) + (static-sound-name "uppercut-hit") + ) + (cpad-set-buzz! (-> *cpad-list* cpads 0) 1 178 (seconds 0.1)) + ) + ((or (= v1-57 'flop) (= v1-57 'flop-down)) + (do-effect (-> self skel effect) "group-flop-hit" -1.0 28) + (do-effect (-> self skel effect) "group-flop-hit" -1.0 19) + (play-effect-sound + (-> self skel effect) + (the-as symbol "sound") + -1.0 + 28 + (the-as basic #f) + (static-sound-name "flop-hit") + ) + (cpad-set-buzz! (-> *cpad-list* cpads 0) 1 178 (seconds 0.1)) + ) + ((= v1-57 'flut-attack) + (play-effect-sound + (-> self skel effect) + (the-as symbol "sound") + -1.0 + 28 + (the-as basic #f) + (static-sound-name "flut-punch-hit") + ) + (cpad-set-buzz! (-> *cpad-list* cpads 0) 1 255 (seconds 0.2)) + ) + ((= v1-57 'darkjak) + (set-time! (-> self darkjak attack-time)) + (let* ((v1-256 *game-info*) + (a0-141 (+ (-> v1-256 attack-id) 1)) + ) + (set! (-> v1-256 attack-id) a0-141) + (set! (-> self darkjak attack-id) a0-141) + a0-141 ) ) - ) - ) - (cpad-set-buzz! (-> *cpad-list* cpads 0) 1 178 (seconds 0.1)) - ) - ((= v1-57 'flip) - (play-effect-sound - (-> self skel effect) - (the-as symbol "sound") - -1.0 - 49 - (the-as basic #f) - (static-sound-name "punch-hit") - ) - (cpad-set-buzz! (-> *cpad-list* cpads 0) 1 127 (seconds 0.1)) - ) - ((= v1-57 'uppercut) - (let ((v1-199 sv-136)) - (when (or (zero? v1-199) (= v1-199 1)) - (cond - ((logtest? (-> group-punch-hit flags) (sp-group-flag sp13)) - (vector-copy! (-> *launch-matrix* trans) sv-128) - (part-tracker-spawn part-tracker-subsampler :to self :group group-punch-hit) - ) - (else - (vector-copy! (-> *launch-matrix* trans) sv-128) - (part-tracker-spawn part-tracker :to self :group group-punch-hit) + ((= v1-57 'lightjak) + (set-time! (-> self darkjak attack-time)) + (let* ((v1-260 *game-info*) + (a0-145 (+ (-> v1-260 attack-id) 1)) + ) + (set! (-> v1-260 attack-id) a0-145) + (set! (-> self darkjak attack-id) a0-145) + a0-145 ) ) - ) - ) - (do-effect (-> self skel effect) "group-uppercut-hit" -1.0 28) - (play-effect-sound - (-> self skel effect) - (the-as symbol "sound") - -1.0 - 28 - (the-as basic #f) - (static-sound-name "uppercut-hit") - ) - (cpad-set-buzz! (-> *cpad-list* cpads 0) 1 178 (seconds 0.1)) - ) - ((or (= v1-57 'flop) (= v1-57 'flop-down)) - (do-effect (-> self skel effect) "group-flop-hit" -1.0 28) - (do-effect (-> self skel effect) "group-flop-hit" -1.0 19) - (play-effect-sound - (-> self skel effect) - (the-as symbol "sound") - -1.0 - 28 - (the-as basic #f) - (static-sound-name "flop-hit") - ) - (cpad-set-buzz! (-> *cpad-list* cpads 0) 1 178 (seconds 0.1)) - ) - ((= v1-57 'flut-attack) - (play-effect-sound - (-> self skel effect) - (the-as symbol "sound") - -1.0 - 28 - (the-as basic #f) - (static-sound-name "flut-punch-hit") - ) - (cpad-set-buzz! (-> *cpad-list* cpads 0) 1 255 (seconds 0.2)) - ) - ((= v1-57 'darkjak) - (set-time! (-> self darkjak attack-time)) - (let* ((v1-256 *game-info*) - (a0-141 (+ (-> v1-256 attack-id) 1)) - ) - (set! (-> v1-256 attack-id) a0-141) - (set! (-> self darkjak attack-id) a0-141) - a0-141 - ) - ) - ((= v1-57 'lightjak) - (set-time! (-> self darkjak attack-time)) - (let* ((v1-260 *game-info*) - (a0-145 (+ (-> v1-260 attack-id) 1)) - ) - (set! (-> v1-260 attack-id) a0-145) - (set! (-> self darkjak attack-id) a0-145) - a0-145 - ) - ) + ) + ) + ) ) ) + sv-96 ) ) ) - sv-96 ) (defbehavior target-generic-event-handler target ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) diff --git a/goal_src/jak3/engine/target/target-part.gc b/goal_src/jak3/engine/target/target-part.gc index 7ffa4f4112..dfd5fd84f4 100644 --- a/goal_src/jak3/engine/target/target-part.gc +++ b/goal_src/jak3/engine/target/target-part.gc @@ -128,47 +128,48 @@ ) (defun birth-func-target-orient ((arg0 sparticle-system) (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) ) @@ -2877,27 +2878,25 @@ (arg4 int) (arg5 float) ) - (local-vars - (sv-640 (pointer process)) - (sv-720 float) - (sv-736 int) - (sv-752 matrix) - (sv-768 collide-query) - (sv-784 symbol) - (sv-800 vector) - (sv-816 int) - (sv-832 process) - ) - (set! sv-720 arg5) - (let ((s5-0 *lightning-probe-vars*)) - (if (= arg3 256) - (set! sv-736 arg3) - (set! sv-736 (rand-vu-int-range 3 (/ (+ (-> arg0 node-list length) -1) 2))) + (local-vars (sv-736 int)) + (let ((sv-720 arg5) + (s5-0 *lightning-probe-vars*) ) - (set! sv-752 (new 'stack-no-clear 'matrix)) - (set! sv-768 (new 'stack-no-clear 'collide-query)) - (set! sv-784 (the-as symbol #f)) - (let ((gp-0 (new 'stack-no-clear 'vector))) + (set! sv-736 (cond + ((= arg3 256) + (set! sv-736 arg3) + sv-736 + ) + (else + (rand-vu-int-range 3 (/ (+ (-> arg0 node-list length) -1) 2)) + ) + ) + ) + (let ((sv-752 (new 'stack-no-clear 'matrix)) + (sv-768 (new 'stack-no-clear 'collide-query)) + (sv-784 (the-as symbol #f)) + (gp-0 (new 'stack-no-clear 'vector)) + ) (vector-copy! gp-0 *up-vector*) (when (nonzero? arg3) (set! sv-736 arg3) @@ -2907,35 +2906,37 @@ (vector-copy! (-> sv-768 start-pos) (-> arg0 root trans)) (vector<-cspace! (-> sv-768 start-pos) (-> arg0 node-list data sv-736)) ) - (set! sv-800 (-> sv-768 move-dist)) - (set! (-> sv-800 x) (rand-vu-float-range 0.0 65536.0)) - (set! (-> sv-800 y) (rand-vu-float-range 0.0 65536.0)) - (set! (-> sv-800 z) (rand-vu-float-range 0.0 65536.0)) - (set! (-> sv-800 w) 1.0) + (let ((sv-800 (-> sv-768 move-dist))) + (set! (-> sv-800 x) (rand-vu-float-range 0.0 65536.0)) + (set! (-> sv-800 y) (rand-vu-float-range 0.0 65536.0)) + (set! (-> sv-800 z) (rand-vu-float-range 0.0 65536.0)) + (set! (-> sv-800 w) 1.0) + ) (matrix-rotate-zyx! sv-752 (-> sv-768 move-dist)) - (set! sv-816 6) - (while (nonzero? sv-816) - (set! sv-816 (+ sv-816 -1)) - (vector-rotate*! (-> sv-768 move-dist) (-> s5-0 probe-dirs sv-816) sv-752) - (vector-normalize! (-> sv-768 move-dist) sv-720) - (let ((v1-31 sv-768)) - (set! (-> v1-31 radius) 409.6) - (set! (-> v1-31 collide-with) (collide-spec backgnd crate obstacle hit-by-others-list pusher)) - (set! (-> v1-31 ignore-process0) arg0) - (set! (-> v1-31 ignore-process1) #f) - (set! (-> v1-31 ignore-pat) - (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) - ) - (set! (-> v1-31 action-mask) (collide-action solid)) - ) - (when (>= (fill-and-probe-using-line-sphere *collide-cache* sv-768) 0.0) - (set-time! (-> s5-0 last-valid-time)) - (set! (-> s5-0 src-joint-index) (the-as uint sv-736)) - (vector-copy! (-> s5-0 end-pos) (-> sv-768 best-other-tri intersect)) - (when (< 8192.0 (vector-vector-distance (-> s5-0 end-pos) (-> sv-768 start-pos))) - (vector-copy! gp-0 (-> sv-768 best-other-tri normal)) - (set! sv-784 #t) - (goto cfg-15) + (let ((sv-816 6)) + (while (nonzero? sv-816) + (+! sv-816 -1) + (vector-rotate*! (-> sv-768 move-dist) (-> s5-0 probe-dirs sv-816) sv-752) + (vector-normalize! (-> sv-768 move-dist) sv-720) + (let ((v1-31 sv-768)) + (set! (-> v1-31 radius) 409.6) + (set! (-> v1-31 collide-with) (collide-spec backgnd crate obstacle hit-by-others-list pusher)) + (set! (-> v1-31 ignore-process0) arg0) + (set! (-> v1-31 ignore-process1) #f) + (set! (-> v1-31 ignore-pat) + (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) + ) + (set! (-> v1-31 action-mask) (collide-action solid)) + ) + (when (>= (fill-and-probe-using-line-sphere *collide-cache* sv-768) 0.0) + (set-time! (-> s5-0 last-valid-time)) + (set! (-> s5-0 src-joint-index) (the-as uint sv-736)) + (vector-copy! (-> s5-0 end-pos) (-> sv-768 best-other-tri intersect)) + (when (< 8192.0 (vector-vector-distance (-> s5-0 end-pos) (-> sv-768 start-pos))) + (vector-copy! gp-0 (-> sv-768 best-other-tri normal)) + (set! sv-784 #t) + (goto cfg-15) + ) ) ) ) @@ -2946,31 +2947,33 @@ (a1-14 lightning-tracker) (a2-2 (the-as object #x4000)) (a3-1 0) + (sv-832 (t9-10 a0-24 a1-14 (the-as int a2-2) a3-1)) + (sv-640 (when sv-832 + ((method-of-type lightning-tracker activate) + (the-as lightning-tracker sv-832) + arg0 + "lightning-tracker" + (the-as pointer #x70004000) + ) + (set! a2-2 arg1) + (set! a3-1 arg4) + (run-now-in-process + sv-832 + lightning-tracker-init + (the-as lightning-spec a2-2) + a3-1 + arg2 + arg0 + (if (= arg3 256) + (-> arg0 root trans) + (-> s5-0 src-joint-index) + ) + (-> s5-0 end-pos) + ) + (-> sv-832 ppointer) + ) + ) ) - (set! sv-832 (t9-10 a0-24 a1-14 (the-as int a2-2) a3-1)) - (set! sv-640 - (when sv-832 - (let ((t9-11 (method-of-type lightning-tracker activate))) - (t9-11 (the-as lightning-tracker sv-832) arg0 "lightning-tracker" (the-as pointer #x70004000)) - ) - (set! a2-2 arg1) - (set! a3-1 arg4) - (run-now-in-process - sv-832 - lightning-tracker-init - (the-as lightning-spec a2-2) - a3-1 - arg2 - arg0 - (if (= arg3 256) - (-> arg0 root trans) - (-> s5-0 src-joint-index) - ) - (-> s5-0 end-pos) - ) - (-> sv-832 ppointer) - ) - ) (when sv-640 (set! (-> (the-as lightning-tracker (-> sv-640 0)) user-time 0) 0) (let ((v1-63 (get-field-spec-by-id (-> *part-id-table* 168) (sp-field-id spt-timer)))) @@ -3014,104 +3017,109 @@ (arg5 int) (arg6 float) ) - (local-vars - (sv-624 (pointer process)) - (sv-640 float) - (sv-656 int) - (sv-672 matrix) - (sv-688 collide-query) - (sv-704 symbol) - (sv-720 vector) - (sv-736 int) - (sv-752 process) - ) - (set! sv-640 arg6) - (when (or (= arg4 256) (and (nonzero? (-> arg0 node-list)) (> (-> arg0 node-list length) 0))) - (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))) - ) - (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) - (vector-copy! (-> sv-688 start-pos) (-> arg0 root trans)) - (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-35 sv-688)) - (set! (-> v1-35 radius) 409.6) - (set! (-> v1-35 collide-with) (collide-spec backgnd crate obstacle hit-by-others-list pusher)) - (set! (-> v1-35 ignore-process0) arg0) - (set! (-> v1-35 ignore-process1) #f) - (set! (-> v1-35 ignore-pat) - (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) - ) - (set! (-> v1-35 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)) - (vector-copy! (-> s5-0 end-pos) (-> sv-688 best-other-tri intersect)) - (when (< 8192.0 (vector-vector-distance (-> s5-0 end-pos) (-> sv-688 start-pos))) - (set! sv-704 #t) - (goto cfg-21) + (local-vars (sv-656 int)) + (let ((sv-640 arg6)) + (when (or (= arg4 256) (and (nonzero? (-> arg0 node-list)) (> (-> arg0 node-list length) 0))) + (let ((s5-0 *lightning-probe-vars*)) + (set! sv-656 (cond + ((= arg4 256) + (set! sv-656 arg4) + sv-656 + ) + (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 ) - ) - ) - (label cfg-21) - (when sv-704 - (set! sv-752 (get-process *default-dead-pool* lightning-tracker #x4000 0)) - (set! sv-624 - (when sv-752 - (let ((t9-11 (method-of-type lightning-tracker activate))) - (t9-11 (the-as lightning-tracker sv-752) arg0 "lightning-tracker" (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) + (if (= arg4 256) + (vector-copy! (-> sv-688 start-pos) (-> arg0 root trans)) + (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-35 sv-688)) + (set! (-> v1-35 radius) 409.6) + (set! (-> v1-35 collide-with) (collide-spec backgnd crate obstacle hit-by-others-list pusher)) + (set! (-> v1-35 ignore-process0) arg0) + (set! (-> v1-35 ignore-process1) #f) + (set! (-> v1-35 ignore-pat) + (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) ) - (-> s5-0 end-pos) + (set! (-> v1-35 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)) + (vector-copy! (-> s5-0 end-pos) (-> sv-688 best-other-tri intersect)) + (when (< 8192.0 (vector-vector-distance (-> s5-0 end-pos) (-> sv-688 start-pos))) + (set! sv-704 #t) + (goto cfg-21) ) - (-> sv-752 ppointer) ) ) - (when sv-624 - (set! (-> (the-as lightning-tracker (-> sv-624 0)) user-time 0) 0) - (when arg3 - (let ((v1-66 (get-field-spec-by-id arg3 (sp-field-id spt-timer)))) - (if v1-66 - (set! (-> v1-66 initial-valuef) (the-as float (-> (the-as lightning-tracker (-> sv-624 0)) duration))) + ) + (label cfg-21) + (when sv-704 + (let* ((sv-752 (get-process *default-dead-pool* lightning-tracker #x4000 0)) + (sv-624 (when sv-752 + ((method-of-type lightning-tracker activate) + (the-as lightning-tracker sv-752) + arg0 + "lightning-tracker" + (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! (-> (the-as lightning-tracker (-> sv-624 0)) user-time 0) 0) + (when arg3 + (let ((v1-66 (get-field-spec-by-id arg3 (sp-field-id spt-timer)))) + (if v1-66 + (set! (-> v1-66 initial-valuef) (the-as float (-> (the-as lightning-tracker (-> sv-624 0)) duration))) + ) + ) + (let ((t9-14 sp-launch-particles-var) + (a0-30 *sp-particle-system-2d*) + (a2-5 *launch-matrix*) + ) + (vector-copy! (-> a2-5 trans) (-> s5-0 end-pos)) + (t9-14 a0-30 arg3 a2-5 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0) + ) ) - ) - (let ((t9-14 sp-launch-particles-var) - (a0-30 *sp-particle-system-2d*) - (a2-5 *launch-matrix*) - ) - (vector-copy! (-> a2-5 trans) (-> s5-0 end-pos)) - (t9-14 a0-30 arg3 a2-5 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0) + ) ) ) ) @@ -3129,50 +3137,44 @@ (arg3 (function lightning-tracker none)) (arg4 sparticle-launcher) ) - (local-vars (sv-16 int) (sv-64 vector) (sv-68 vector) (sv-72 (pointer process))) (when (and (nonzero? (-> arg0 skel)) (nonzero? (-> arg1 skel))) (let* ((v1-7 (-> arg0 draw lod-set lod (-> arg0 draw lod-set max-lod) geo length)) (s0-0 (-> arg1 draw lod-set lod (-> arg1 draw lod-set max-lod) geo length)) (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))) - (set! sv-72 (process-spawn - lightning-tracker - :init lightning-tracker-init - arg2 - 0 - arg3 - arg0 - s1-0 - sv-16 - :name "lightning-tracker" - :to arg1 - :unk 0 + (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 (get-process *default-dead-pool* lightning-tracker #x4000 0)) + (sv-72 (when s0-1 + (let ((t9-5 (method-of-type lightning-tracker activate))) + (t9-5 (the-as lightning-tracker s0-1) arg1 "lightning-tracker" (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-19 (get-field-spec-by-id arg4 (sp-field-id spt-timer)))) - (if v1-19 - (set! (-> v1-19 initial-valuef) (the-as float (-> (the-as lightning-tracker (-> sv-72 0)) duration))) - ) - ) - (let ((t9-8 sp-launch-particles-var) - (a0-20 *sp-particle-system-2d*) - (a1-14 arg4) - (a2-4 *launch-matrix*) - ) - (vector-copy! (-> a2-4 trans) sv-64) - (t9-8 a0-20 a1-14 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*) - ) - (vector-copy! (-> a2-5 trans) sv-68) - (t9-9 a0-21 arg4 a2-5 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0) + ) + ) + (when (and arg4 sv-72) + (let ((v1-19 (get-field-spec-by-id arg4 (sp-field-id spt-timer)))) + (if v1-19 + (set! (-> v1-19 initial-valuef) (the-as float (-> (the-as lightning-tracker (-> sv-72 0)) duration))) + ) + ) + (let ((t9-8 sp-launch-particles-var) + (a0-20 *sp-particle-system-2d*) + (a1-14 arg4) + (a2-4 *launch-matrix*) + ) + (vector-copy! (-> a2-4 trans) sv-64) + (t9-8 a0-20 a1-14 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*) + ) + (vector-copy! (-> a2-5 trans) sv-68) + (t9-9 a0-21 arg4 a2-5 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0) + ) ) ) ) @@ -3211,149 +3213,140 @@ (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 ((vf0 :class vf) (vf4 :class vf) (vf5 :class vf) (vf6 :class vf) ) (init-vf0-vector) - (let ((s1-0 (-> arg0 draw lod-set lod (-> arg0 draw cur-lod) geo length))) - (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 length)) + (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 0)) - (let ((a0-35 (when sv-560 - (let ((t9-13 (method-of-type lightning-tracker activate))) - (t9-13 (the-as lightning-tracker sv-560) arg0 "lightning-tracker" (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 0)) + (a0-35 (when sv-560 + ((method-of-type lightning-tracker activate) + (the-as lightning-tracker sv-560) + arg0 + "lightning-tracker" + (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)) + (run-now-in-process sv-560 lightning-tracker-init arg1 0 arg2 arg0 #f #f) + (-> sv-560 ppointer) + ) ) - (set! (-> s4-1 state points-to-draw) 0) - (vector+*! s3-1 sv-432 sv-448 arg4) - (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)) + ) + (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) + (vector+*! s3-1 sv-432 sv-448 arg4) + (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) @@ -3361,12 +3354,7 @@ (vector-orient-by-quat! s1-2 sv-448 sv-480) (vector-copy! s1-2 sv-448) (vector+*! s2-1 sv-640 s1-2 arg4) - (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-34 (vector-average! (new 'stack-no-clear 'vector) s2-1 s3-1))) - (sv-592 sv-608 sv-624 a2-34) - ) + (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) @@ -3374,8 +3362,8 @@ (vector-copy! s0-2 sv-464) (vector-copy! sv-448 s1-2) (vector-copy! sv-432 sv-640) - (set! sv-576 (+ sv-576 1)) ) + (+! sv-576 1) ) ) ) diff --git a/goal_src/jak3/engine/target/target-turret.gc b/goal_src/jak3/engine/target/target-turret.gc index 7da9f1fbea..498c95dec6 100644 --- a/goal_src/jak3/engine/target/target-turret.gc +++ b/goal_src/jak3/engine/target/target-turret.gc @@ -1210,7 +1210,6 @@ ) (defmethod target-turret-method-48 ((this target-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)) @@ -1220,27 +1219,28 @@ ) (set! (-> s3-0 y) 0.0) (vector-xz-normalize! s3-0 24576.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) - (vector-copy! (-> s2-0 start-pos) s5-0) - (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) + (vector-copy! (-> s2-0 start-pos) s5-0) + (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))) + (vector-copy! arg0 s5-0) + (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))) - (vector-copy! arg0 s5-0) - (return #t) - ) - (set! sv-592 (+ sv-592 1)) ) ) #f diff --git a/goal_src/jak3/engine/target/target-util.gc b/goal_src/jak3/engine/target/target-util.gc index b0eadc9051..191cd061fa 100644 --- a/goal_src/jak3/engine/target/target-util.gc +++ b/goal_src/jak3/engine/target/target-util.gc @@ -2183,44 +2183,34 @@ ) (defun external-target-spawn ((arg0 vector) (arg1 quaternion) (arg2 process) (arg3 symbol) (arg4 manipy-options)) - (local-vars - (v1-5 symbol) - (sv-96 process) - (sv-112 (function vector entity-actor skeleton-group vector manipy-options none :behavior manipy)) - (sv-128 entity-actor) - ) + (local-vars (v1-5 symbol) (sv-128 entity-actor)) (let* ((s1-0 (get-process *default-dead-pool* manipy #x20000 1)) (s5-0 (when s1-0 (let ((t9-1 (method-of-type manipy activate))) (t9-1 (the-as manipy s1-0) arg2 "manipy" (the-as pointer #x70004000)) ) - (let ((s5-1 run-function-in-process)) - (set! sv-96 s1-0) - (set! sv-112 manipy-init) + (let ((s5-1 run-function-in-process) + (sv-96 s1-0) + (sv-112 manipy-init) + ) (set! v1-5 (when (not (logtest? (-> arg2 mask) (process-mask process-tree))) (set! sv-128 (the-as entity-actor v1-5)) (set! sv-128 (-> arg2 entity)) v1-5 ) ) - (let ((t0-1 (target-skel-group)) - (t1-0 (if (logtest? arg4 (manipy-options mo3)) - (the-as vector #f) - (new 'static 'vector :y 2867.2 :w 3276.8) - ) - ) - (t2-0 2) - ) - ((the-as (function object object object object object object object none) s5-1) - sv-96 - sv-112 - arg0 - sv-128 - t0-1 - t1-0 - t2-0 - ) - ) + ((the-as (function object object object object object object object none) s5-1) + sv-96 + sv-112 + arg0 + sv-128 + (target-skel-group) + (if (logtest? arg4 (manipy-options mo3)) + (the-as vector #f) + (new 'static 'vector :y 2867.2 :w 3276.8) + ) + 2 + ) ) (-> s1-0 ppointer) ) diff --git a/goal_src/jak3/engine/target/target2.gc b/goal_src/jak3/engine/target/target2.gc index fa919a0bd1..2b6bc690ef 100644 --- a/goal_src/jak3/engine/target/target2.gc +++ b/goal_src/jak3/engine/target/target2.gc @@ -1641,63 +1641,65 @@ process (lambda :behavior process ((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)) + ) (vector-copy! v1-2 arg0) - (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 ) #f ) diff --git a/goal_src/jak3/engine/ui/hud-classes.gc b/goal_src/jak3/engine/ui/hud-classes.gc index cf2ccd2a5b..e3227cb42b 100644 --- a/goal_src/jak3/engine/ui/hud-classes.gc +++ b/goal_src/jak3/engine/ui/hud-classes.gc @@ -932,434 +932,432 @@ ) (defmethod draw ((this hud-gun)) - (local-vars - (sv-32 int) - (sv-40 int) - (sv-48 int) - (sv-56 int) - (sv-64 hud-sprite) - (sv-72 int) - (sv-80 int) - (sv-88 int) - (sv-96 int) - (sv-104 int) - (sv-112 int) - ) - (set! sv-32 0) - (set! sv-40 0) - (set! sv-48 0) - (set! sv-56 0) - (set! sv-64 (new 'stack-no-clear 'hud-sprite)) - (set! sv-72 (the int (get-max-ammo-for-gun *game-info* (the-as pickup-type (-> this values 0 current))))) - (set! sv-80 20) - (set! sv-88 -1) - (set! sv-96 -1) - (set! sv-104 -1) - (set! sv-112 -1) - (case (gun->eco (the-as pickup-type (-> this values 0 current))) - (((pickup-type eco-yellow)) - (let ((v1-10 (-> this sprites 15 color-ptr))) - (set! (-> v1-10 0) 128) - (set! (-> v1-10 1) 128) - (set! (-> v1-10 2) 96) - (set! (-> v1-10 3) 128) - ) - (set! sv-96 (+ (-> this values 0 current) -29)) - (set! (-> this sprites 0 tid) (the-as texture-id (get-texture hud-gunyellow-common-01 level-default-minimap))) - (set! (-> this sprites 14 tid) - (the-as texture-id (get-texture hud-gun-yellow-shell-01 level-default-minimap)) - ) - (set! (-> this sprites 0 scale-x) 1.8) - (set! (-> this sprites 0 scale-y) 1.8) - (set! (-> this sprites 1 scale-x) 1.8) - (set! (-> this sprites 1 scale-y) 1.8) - (set! sv-32 10) - (set! sv-40 7) - ) - (((pickup-type eco-dark)) - (let ((v1-19 (-> this sprites 15 color-ptr))) - (set! (-> v1-19 0) 128) - (set! (-> v1-19 1) 96) - (set! (-> v1-19 2) 128) - (set! (-> v1-19 3) 128) - ) - (set! sv-112 (+ (-> this values 0 current) -35)) - (set! (-> this sprites 0 tid) (the-as texture-id (get-texture hud-gunpurple-common-01 level-default-minimap))) - (set! (-> this sprites 14 tid) - (the-as texture-id (get-texture hud-gun-purple-shell-01 level-default-minimap)) - ) - (set! (-> this sprites 0 scale-x) 1.6) - (set! (-> this sprites 0 scale-y) 1.6) - (set! (-> this sprites 1 scale-x) 1.6) - (set! (-> this sprites 1 scale-y) 1.6) - (set! sv-32 23) - (set! sv-80 10) - ) - (((pickup-type eco-blue)) - (let ((v1-28 (-> this sprites 15 color-ptr))) - (set! (-> v1-28 0) 96) - (set! (-> v1-28 1) 128) - (set! (-> v1-28 2) 128) - (set! (-> v1-28 3) 128) - ) - (set! sv-104 (+ (-> this values 0 current) -32)) - (set! (-> this sprites 0 tid) (the-as texture-id (get-texture hud-gunblue-common-01 level-default-minimap))) - (set! (-> this sprites 14 tid) (the-as texture-id (get-texture hud-gun-blue-shell-01 level-default-minimap))) - (set! (-> this sprites 0 scale-x) 1.7) - (set! (-> this sprites 0 scale-y) 1.7) - (set! (-> this sprites 1 scale-x) 1.7) - (set! (-> this sprites 1 scale-y) 1.7) - (set! sv-32 6) - (set! sv-40 13) - ) - (else - (let ((v1-37 (-> this sprites 15 color-ptr))) - (set! (-> v1-37 0) 128) - (set! (-> v1-37 1) 64) - (set! (-> v1-37 2) 64) - (set! (-> v1-37 3) 128) + (let ((sv-32 0) + (sv-40 0) + (sv-48 0) + (sv-56 0) + (sv-64 (new 'stack-no-clear 'hud-sprite)) + (sv-72 (the int (get-max-ammo-for-gun *game-info* (the-as pickup-type (-> this values 0 current))))) ) - (set! sv-88 (+ (-> this values 0 current) -26)) - (set! (-> this sprites 0 tid) (the-as texture-id (get-texture hud-gunred-common-01 level-default-minimap))) - (set! (-> this sprites 14 tid) (the-as texture-id (get-texture hud-gun-red-shell-01 level-default-minimap))) - (set! (-> this sprites 0 scale-x) 1.6) - (set! (-> this sprites 0 scale-y) 1.6) - (set! (-> this sprites 1 scale-x) 1.6) - (set! (-> this sprites 1 scale-y) 1.6) - (set! sv-32 23) - (set! sv-40 -2) - (set! sv-80 20) - ) - ) - (case (-> this values 0 current) - ((26) - (set! (-> this sprites 1 tid) (the-as texture-id (get-texture hud-gunred-01a level-default-minimap))) - (set! sv-48 -102) - ) - ((27) - (set! (-> this sprites 1 tid) (the-as texture-id (get-texture hud-gunred-02a level-default-minimap))) - (set! sv-48 -153) - ) - ((28) - (set! (-> this sprites 1 tid) (the-as texture-id (get-texture hud-gunred-03a level-default-minimap))) - (set! sv-48 -153) - ) - ((29) - (set! (-> this sprites 1 tid) (the-as texture-id (get-texture hud-gunyellow-01a level-default-minimap))) - (set! sv-48 -172) - ) - ((30) - (set! (-> this sprites 1 tid) (the-as texture-id (get-texture hud-gunyellow-02a level-default-minimap))) - (set! sv-48 -172) - ) - ((31) - (set! (-> this sprites 0 tid) (the-as texture-id (get-texture hud-gunyellow-03b level-default-minimap))) - (set! (-> this sprites 1 tid) (the-as texture-id (get-texture hud-gunyellow-03a level-default-minimap))) - (set! sv-48 -172) - ) - ((32) - (set! (-> this sprites 1 tid) (the-as texture-id (get-texture hud-gunblue-01a level-default-minimap))) - (set! sv-48 -135) - ) - ((33) - (set! (-> this sprites 1 tid) (the-as texture-id (get-texture hud-gunblue-02a level-default-minimap))) - (set! sv-48 -162) - (set! sv-56 -49) - ) - ((34) - (set! (-> this sprites 1 tid) (the-as texture-id (get-texture hud-gunblue-03a level-default-minimap))) - (set! sv-48 -162) - (set! sv-56 -49) - ) - ((35) - (set! (-> this sprites 1 tid) (the-as texture-id (get-texture hud-gunpurple-01a level-default-minimap))) - (set! sv-48 -153) - ) - ((36) - (set! (-> this sprites 1 tid) (the-as texture-id (get-texture hud-gunpurple-02a level-default-minimap))) - (set! sv-48 -153) - ) - ((37) - (set! (-> this sprites 1 tid) (the-as texture-id (get-texture hud-gunpurple-03a level-default-minimap))) - (set! sv-48 -153) - ) - ) - (set-hud-piece-position! - sv-64 - (- (the int (+ 507.0 (* 130.0 (-> this offset)))) (the int (* 80.0 (-> *video-params* relative-x-scale)))) - (the int (+ 40.0 (* -100.0 (-> this offset)))) - ) - (set-hud-piece-position! - (-> this sprites 0) - (- (the int (+ 507.0 (* 130.0 (-> this offset)))) - (the int (* (the float sv-32) (-> *video-params* relative-x-scale))) - ) - (the int (+ (- 25.0 (the float sv-40)) (* -100.0 (-> this offset)))) - ) - (let ((f30-0 1.0)) - (cond - ((zero? (-> this values 0 current)) - (set! f30-0 0.0) - (set! (-> this strings 0 pos x) 0) - (set-as-offset-from! (-> this sprites 1) (-> this sprites 0 pos) -3 0) - ) - (else - (set-as-offset-from! (-> this sprites 1) (-> this sprites 0 pos) sv-48 sv-56) - (set-as-offset-from! - (the-as hud-sprite (-> this strings 0 pos)) - (-> this sprites 0 pos) - (+ sv-32 -70) - (+ sv-40 61) + (let ((sv-80 20) + (sv-88 -1) + (sv-96 -1) + (sv-104 -1) + (sv-112 -1) ) - (set-as-offset-from! (-> this sprites 14) (-> this sprites 0 pos) (+ sv-32 -68) (+ (if (= sv-80 20) - 122 - 97 + (let ((v1-9 (gun->eco (the-as pickup-type (-> this values 0 current))))) + (set! sv-80 + (cond + ((= v1-9 (pickup-type eco-yellow)) + (let ((v1-10 (-> this sprites 15 color-ptr))) + (set! (-> v1-10 0) 128) + (set! (-> v1-10 1) 128) + (set! (-> v1-10 2) 96) + (set! (-> v1-10 3) 128) + ) + (set! sv-96 (+ (-> this values 0 current) -29)) + (set! (-> this sprites 0 tid) (the-as texture-id (get-texture hud-gunyellow-common-01 level-default-minimap))) + (set! (-> this sprites 14 tid) + (the-as texture-id (get-texture hud-gun-yellow-shell-01 level-default-minimap)) + ) + (set! (-> this sprites 0 scale-x) 1.8) + (set! (-> this sprites 0 scale-y) 1.8) + (set! (-> this sprites 1 scale-x) 1.8) + (set! (-> this sprites 1 scale-y) 1.8) + (set! sv-32 10) + (set! sv-40 7) + sv-80 + ) + ((= v1-9 (pickup-type eco-dark)) + (let ((v1-19 (-> this sprites 15 color-ptr))) + (set! (-> v1-19 0) 128) + (set! (-> v1-19 1) 96) + (set! (-> v1-19 2) 128) + (set! (-> v1-19 3) 128) + ) + (set! sv-112 (+ (-> this values 0 current) -35)) + (set! (-> this sprites 0 tid) (the-as texture-id (get-texture hud-gunpurple-common-01 level-default-minimap))) + (set! (-> this sprites 14 tid) + (the-as texture-id (get-texture hud-gun-purple-shell-01 level-default-minimap)) + ) + (set! (-> this sprites 0 scale-x) 1.6) + (set! (-> this sprites 0 scale-y) 1.6) + (set! (-> this sprites 1 scale-x) 1.6) + (set! (-> this sprites 1 scale-y) 1.6) + (set! sv-32 23) + (set! sv-80 10) + sv-80 + ) + ((= v1-9 (pickup-type eco-blue)) + (let ((v1-28 (-> this sprites 15 color-ptr))) + (set! (-> v1-28 0) 96) + (set! (-> v1-28 1) 128) + (set! (-> v1-28 2) 128) + (set! (-> v1-28 3) 128) + ) + (set! sv-104 (+ (-> this values 0 current) -32)) + (set! (-> this sprites 0 tid) (the-as texture-id (get-texture hud-gunblue-common-01 level-default-minimap))) + (set! (-> this sprites 14 tid) (the-as texture-id (get-texture hud-gun-blue-shell-01 level-default-minimap))) + (set! (-> this sprites 0 scale-x) 1.7) + (set! (-> this sprites 0 scale-y) 1.7) + (set! (-> this sprites 1 scale-x) 1.7) + (set! (-> this sprites 1 scale-y) 1.7) + (set! sv-32 6) + (set! sv-40 13) + sv-80 + ) + (else + (let ((v1-37 (-> this sprites 15 color-ptr))) + (set! (-> v1-37 0) 128) + (set! (-> v1-37 1) 64) + (set! (-> v1-37 2) 64) + (set! (-> v1-37 3) 128) + ) + (set! sv-88 (+ (-> this values 0 current) -26)) + (set! (-> this sprites 0 tid) (the-as texture-id (get-texture hud-gunred-common-01 level-default-minimap))) + (set! (-> this sprites 14 tid) (the-as texture-id (get-texture hud-gun-red-shell-01 level-default-minimap))) + (set! (-> this sprites 0 scale-x) 1.6) + (set! (-> this sprites 0 scale-y) 1.6) + (set! (-> this sprites 1 scale-x) 1.6) + (set! (-> this sprites 1 scale-y) 1.6) + (set! sv-32 23) + (set! sv-40 -2) + 20 + ) + ) + ) + ) + (case (-> this values 0 current) + ((26) + (set! (-> this sprites 1 tid) (the-as texture-id (get-texture hud-gunred-01a level-default-minimap))) + (set! sv-48 -102) + ) + ((27) + (set! (-> this sprites 1 tid) (the-as texture-id (get-texture hud-gunred-02a level-default-minimap))) + (set! sv-48 -153) + ) + ((28) + (set! (-> this sprites 1 tid) (the-as texture-id (get-texture hud-gunred-03a level-default-minimap))) + (set! sv-48 -153) + ) + ((29) + (set! (-> this sprites 1 tid) (the-as texture-id (get-texture hud-gunyellow-01a level-default-minimap))) + (set! sv-48 -172) + ) + ((30) + (set! (-> this sprites 1 tid) (the-as texture-id (get-texture hud-gunyellow-02a level-default-minimap))) + (set! sv-48 -172) + ) + ((31) + (set! (-> this sprites 0 tid) (the-as texture-id (get-texture hud-gunyellow-03b level-default-minimap))) + (set! (-> this sprites 1 tid) (the-as texture-id (get-texture hud-gunyellow-03a level-default-minimap))) + (set! sv-48 -172) + ) + ((32) + (set! (-> this sprites 1 tid) (the-as texture-id (get-texture hud-gunblue-01a level-default-minimap))) + (set! sv-48 -135) + ) + ((33) + (set! (-> this sprites 1 tid) (the-as texture-id (get-texture hud-gunblue-02a level-default-minimap))) + (set! sv-48 -162) + (set! sv-56 -49) + ) + ((34) + (set! (-> this sprites 1 tid) (the-as texture-id (get-texture hud-gunblue-03a level-default-minimap))) + (set! sv-48 -162) + (set! sv-56 -49) + ) + ((35) + (set! (-> this sprites 1 tid) (the-as texture-id (get-texture hud-gunpurple-01a level-default-minimap))) + (set! sv-48 -153) + ) + ((36) + (set! (-> this sprites 1 tid) (the-as texture-id (get-texture hud-gunpurple-02a level-default-minimap))) + (set! sv-48 -153) + ) + ((37) + (set! (-> this sprites 1 tid) (the-as texture-id (get-texture hud-gunpurple-03a level-default-minimap))) + (set! sv-48 -153) + ) + ) + (set-hud-piece-position! + sv-64 + (- (the int (+ 507.0 (* 130.0 (-> this offset)))) (the int (* 80.0 (-> *video-params* relative-x-scale)))) + (the int (+ 40.0 (* -100.0 (-> this offset)))) + ) + (set-hud-piece-position! + (-> this sprites 0) + (- (the int (+ 507.0 (* 130.0 (-> this offset)))) + (the int (* (the float sv-32) (-> *video-params* relative-x-scale))) + ) + (the int (+ (- 25.0 (the float sv-40)) (* -100.0 (-> this offset)))) + ) + (let ((f30-0 1.0)) + (cond + ((zero? (-> this values 0 current)) + (set! f30-0 0.0) + (set! (-> this strings 0 pos x) 0) + (set-as-offset-from! (-> this sprites 1) (-> this sprites 0 pos) -3 0) + ) + (else + (set-as-offset-from! (-> this sprites 1) (-> this sprites 0 pos) sv-48 sv-56) + (set-as-offset-from! + (the-as hud-sprite (-> this strings 0 pos)) + (-> this sprites 0 pos) + (+ sv-32 -70) + (+ sv-40 61) + ) + (set-as-offset-from! (-> this sprites 14) (-> this sprites 0 pos) (+ sv-32 -68) (+ (if (= sv-80 20) + 122 + 97 + ) + sv-40 ) - sv-40 - ) - ) - (set! (-> this sprites 14 scale-x) 1.0) - (let ((s5-0 (the int (+ 0.1 (* (the float sv-80) (/ (the float (-> this values 1 current)) (the float sv-72))))))) - (if (and (zero? s5-0) (nonzero? (-> this values 1 current))) - (set! s5-0 1) - ) - (when (not (-> *setting-control* user-current gun-special-mode)) - (with-dma-buffer-add-bucket ((s3-0 (-> *display* frames (-> *display* on-screen) global-buf)) - (bucket-id hud-draw-hud-alpha) - ) - (dotimes (s2-0 sv-80) - (if (= s2-0 s5-0) - (set! (-> this sprites 14 tid) (the-as texture-id (get-texture hud-gun-empty-shell-01 level-default-minimap))) - ) - (draw (-> this sprites 14) s3-0 (-> this level) #f) - (+! (-> this sprites 14 pos y) -5) - (if (= s2-0 (+ (/ sv-80 2) -1)) - (set-as-offset-from! (-> this sprites 14) (-> this sprites 0 pos) (+ sv-32 -83) (+ (if (= sv-80 20) - 122 - 97 + ) + (set! (-> this sprites 14 scale-x) 1.0) + (let ((s5-0 (the int (+ 0.1 (* (the float sv-80) (/ (the float (-> this values 1 current)) (the float sv-72))))))) + (if (and (zero? s5-0) (nonzero? (-> this values 1 current))) + (set! s5-0 1) + ) + (when (not (-> *setting-control* user-current gun-special-mode)) + (with-dma-buffer-add-bucket ((s3-0 (-> *display* frames (-> *display* on-screen) global-buf)) + (bucket-id hud-draw-hud-alpha) + ) + (dotimes (s2-0 sv-80) + (if (= s2-0 s5-0) + (set! (-> this sprites 14 tid) (the-as texture-id (get-texture hud-gun-empty-shell-01 level-default-minimap))) + ) + (draw (-> this sprites 14) s3-0 (-> this level) #f) + (+! (-> this sprites 14 pos y) -5) + (if (= s2-0 (+ (/ sv-80 2) -1)) + (set-as-offset-from! (-> this sprites 14) (-> this sprites 0 pos) (+ sv-32 -83) (+ (if (= sv-80 20) + 122 + 97 + ) + sv-40 ) - sv-40 - ) - ) + ) + ) ) + ) ) ) ) ) + (set! (-> this sprites 14 scale-x) 0.0) + (set-as-offset-from! (-> this sprites 15) (-> sv-64 pos) -4 -4) + (dotimes (v1-125 12) + (set! (-> this sprites (+ v1-125 2) scale-x) 0.0) + ) + (let ((s5-1 + (+ (if (and (logtest? (-> *target* game features) (game-feature gun)) + (and (-> *setting-control* user-current gun) + (logtest? (logand (-> *setting-control* user-current features) (game-feature gun-red-1)) + (-> *target* game features) + ) + ) + ) + 1 + 0 + ) + (if (and (logtest? (-> *target* game features) (game-feature gun)) + (and (-> *setting-control* user-current gun) + (logtest? (logand (-> *setting-control* user-current features) (game-feature gun-red-2)) + (-> *target* game features) + ) + ) + ) + 1 + 0 + ) + (if (and (logtest? (-> *target* game features) (game-feature gun)) + (and (-> *setting-control* user-current gun) + (logtest? (logand (-> *setting-control* user-current features) (game-feature gun-red-3)) + (-> *target* game features) + ) + ) + ) + 1 + 0 + ) + ) + ) + ) + (dotimes (s4-1 s5-1) + (let ((s3-1 (- 10 s4-1))) + (hud-sprite-method-11 + (-> this sprites s3-1) + (if (>= sv-88 s4-1) + (-> *gun-arrow-table* (+ (* s4-1 2) 1)) + (-> *gun-arrow-table* (* s4-1 2)) + ) + (-> sv-64 pos) + 0 + 0 + ) + (if (= f30-0 0.0) + (set! (-> this sprites s3-1 scale-x) f30-0) + ) + ) + ) + ) + (let ((s5-2 + (+ (if (and (logtest? (-> *target* game features) (game-feature gun)) + (-> *setting-control* user-current gun) + (logtest? (logand (-> *setting-control* user-current features) (game-feature gun-yellow-1)) + (-> *target* game features) + ) + ) + 1 + 0 + ) + (if (and (logtest? (-> *target* game features) (game-feature gun)) + (and (-> *setting-control* user-current gun) + (logtest? (logand (-> *setting-control* user-current features) (game-feature gun-yellow-2)) + (-> *target* game features) + ) + ) + ) + 1 + 0 + ) + (if (and (logtest? (-> *target* game features) (game-feature gun)) + (and (-> *setting-control* user-current gun) + (logtest? (logand (-> *setting-control* user-current features) (game-feature gun-yellow-3)) + (-> *target* game features) + ) + ) + ) + 1 + 0 + ) + ) + ) + ) + (dotimes (s4-2 s5-2) + (let ((s3-2 (- 13 s4-2))) + (hud-sprite-method-11 + (-> this sprites s3-2) + (if (>= sv-96 s4-2) + (-> *gun-arrow-table* (+ (* s4-2 2) 7)) + (-> *gun-arrow-table* (+ (* s4-2 2) 6)) + ) + (-> sv-64 pos) + 0 + 0 + ) + (if (= f30-0 0.0) + (set! (-> this sprites s3-2 scale-x) f30-0) + ) + ) + ) + ) + (let ((s5-3 + (+ (if (and (logtest? (-> *target* game features) (game-feature gun)) + (-> *setting-control* user-current gun) + (logtest? (logand (-> *setting-control* user-current features) (game-feature gun-blue-1)) + (-> *target* game features) + ) + ) + 1 + 0 + ) + (if (and (logtest? (-> *target* game features) (game-feature gun)) + (and (-> *setting-control* user-current gun) + (logtest? (logand (-> *setting-control* user-current features) (game-feature gun-blue-2)) + (-> *target* game features) + ) + ) + ) + 1 + 0 + ) + (if (and (logtest? (-> *target* game features) (game-feature gun)) + (and (-> *setting-control* user-current gun) + (logtest? (logand (-> *setting-control* user-current features) (game-feature gun-blue-3)) + (-> *target* game features) + ) + ) + ) + 1 + 0 + ) + ) + ) + ) + (dotimes (s4-3 s5-3) + (let ((s3-3 (- 4 s4-3))) + (hud-sprite-method-11 + (-> this sprites s3-3) + (if (>= sv-104 s4-3) + (-> *gun-arrow-table* (+ (* s4-3 2) 13)) + (-> *gun-arrow-table* (+ (* s4-3 2) 12)) + ) + (-> sv-64 pos) + 0 + 0 + ) + (if (= f30-0 0.0) + (set! (-> this sprites s3-3 scale-x) f30-0) + ) + ) + ) + ) + (let ((s5-4 + (+ (if (and (logtest? (-> *target* game features) (game-feature gun)) + (-> *setting-control* user-current gun) + (logtest? (logand (-> *setting-control* user-current features) (game-feature gun-dark-1)) + (-> *target* game features) + ) + ) + 1 + 0 + ) + (if (and (logtest? (-> *target* game features) (game-feature gun)) + (and (-> *setting-control* user-current gun) + (logtest? (logand (game-feature gun-dark-2) (-> *setting-control* user-current features)) + (-> *target* game features) + ) + ) + ) + 1 + 0 + ) + (if (and (logtest? (-> *target* game features) (game-feature gun)) + (and (-> *setting-control* user-current gun) + (logtest? (logand (game-feature gun-dark-3) (-> *setting-control* user-current features)) + (-> *target* game features) + ) + ) + ) + 1 + 0 + ) + ) + ) + ) + (dotimes (s4-4 s5-4) + (let ((s3-4 (- 7 s4-4))) + (hud-sprite-method-11 + (-> this sprites s3-4) + (if (>= sv-112 s4-4) + (-> *gun-arrow-table* (+ (* s4-4 2) 19)) + (-> *gun-arrow-table* (+ (* s4-4 2) 18)) + ) + (-> sv-64 pos) + 0 + 0 + ) + (if (= f30-0 0.0) + (set! (-> this sprites s3-4 scale-x) f30-0) + ) + ) + ) + ) ) ) - (set! (-> this sprites 14 scale-x) 0.0) - (set-as-offset-from! (-> this sprites 15) (-> sv-64 pos) -4 -4) - (dotimes (v1-125 12) - (set! (-> this sprites (+ v1-125 2) scale-x) 0.0) - ) - (let ((s5-1 - (+ (if (and (logtest? (-> *target* game features) (game-feature gun)) - (and (-> *setting-control* user-current gun) - (logtest? (logand (-> *setting-control* user-current features) (game-feature gun-red-1)) - (-> *target* game features) - ) - ) - ) - 1 - 0 - ) - (if (and (logtest? (-> *target* game features) (game-feature gun)) - (and (-> *setting-control* user-current gun) - (logtest? (logand (-> *setting-control* user-current features) (game-feature gun-red-2)) - (-> *target* game features) - ) - ) - ) - 1 - 0 - ) - (if (and (logtest? (-> *target* game features) (game-feature gun)) - (and (-> *setting-control* user-current gun) - (logtest? (logand (-> *setting-control* user-current features) (game-feature gun-red-3)) - (-> *target* game features) - ) - ) - ) - 1 - 0 - ) - ) - ) - ) - (dotimes (s4-1 s5-1) - (let ((s3-1 (- 10 s4-1))) - (hud-sprite-method-11 - (-> this sprites s3-1) - (if (>= sv-88 s4-1) - (-> *gun-arrow-table* (+ (* s4-1 2) 1)) - (-> *gun-arrow-table* (* s4-1 2)) - ) - (-> sv-64 pos) - 0 - 0 - ) - (if (= f30-0 0.0) - (set! (-> this sprites s3-1 scale-x) f30-0) - ) - ) - ) - ) - (let ((s5-2 - (+ (if (and (logtest? (-> *target* game features) (game-feature gun)) - (-> *setting-control* user-current gun) - (logtest? (logand (-> *setting-control* user-current features) (game-feature gun-yellow-1)) - (-> *target* game features) - ) - ) - 1 - 0 - ) - (if (and (logtest? (-> *target* game features) (game-feature gun)) - (and (-> *setting-control* user-current gun) - (logtest? (logand (-> *setting-control* user-current features) (game-feature gun-yellow-2)) - (-> *target* game features) - ) - ) - ) - 1 - 0 - ) - (if (and (logtest? (-> *target* game features) (game-feature gun)) - (and (-> *setting-control* user-current gun) - (logtest? (logand (-> *setting-control* user-current features) (game-feature gun-yellow-3)) - (-> *target* game features) - ) - ) - ) - 1 - 0 - ) - ) - ) - ) - (dotimes (s4-2 s5-2) - (let ((s3-2 (- 13 s4-2))) - (hud-sprite-method-11 - (-> this sprites s3-2) - (if (>= sv-96 s4-2) - (-> *gun-arrow-table* (+ (* s4-2 2) 7)) - (-> *gun-arrow-table* (+ (* s4-2 2) 6)) - ) - (-> sv-64 pos) - 0 - 0 - ) - (if (= f30-0 0.0) - (set! (-> this sprites s3-2 scale-x) f30-0) - ) - ) - ) - ) - (let ((s5-3 - (+ (if (and (logtest? (-> *target* game features) (game-feature gun)) - (-> *setting-control* user-current gun) - (logtest? (logand (-> *setting-control* user-current features) (game-feature gun-blue-1)) - (-> *target* game features) - ) - ) - 1 - 0 - ) - (if (and (logtest? (-> *target* game features) (game-feature gun)) - (and (-> *setting-control* user-current gun) - (logtest? (logand (-> *setting-control* user-current features) (game-feature gun-blue-2)) - (-> *target* game features) - ) - ) - ) - 1 - 0 - ) - (if (and (logtest? (-> *target* game features) (game-feature gun)) - (and (-> *setting-control* user-current gun) - (logtest? (logand (-> *setting-control* user-current features) (game-feature gun-blue-3)) - (-> *target* game features) - ) - ) - ) - 1 - 0 - ) - ) - ) - ) - (dotimes (s4-3 s5-3) - (let ((s3-3 (- 4 s4-3))) - (hud-sprite-method-11 - (-> this sprites s3-3) - (if (>= sv-104 s4-3) - (-> *gun-arrow-table* (+ (* s4-3 2) 13)) - (-> *gun-arrow-table* (+ (* s4-3 2) 12)) - ) - (-> sv-64 pos) - 0 - 0 - ) - (if (= f30-0 0.0) - (set! (-> this sprites s3-3 scale-x) f30-0) - ) - ) - ) - ) - (let ((s5-4 - (+ (if (and (logtest? (-> *target* game features) (game-feature gun)) - (-> *setting-control* user-current gun) - (logtest? (logand (-> *setting-control* user-current features) (game-feature gun-dark-1)) - (-> *target* game features) - ) - ) - 1 - 0 - ) - (if (and (logtest? (-> *target* game features) (game-feature gun)) - (and (-> *setting-control* user-current gun) - (logtest? (logand (game-feature gun-dark-2) (-> *setting-control* user-current features)) - (-> *target* game features) - ) - ) - ) - 1 - 0 - ) - (if (and (logtest? (-> *target* game features) (game-feature gun)) - (and (-> *setting-control* user-current gun) - (logtest? (logand (game-feature gun-dark-3) (-> *setting-control* user-current features)) - (-> *target* game features) - ) - ) - ) - 1 - 0 - ) - ) - ) - ) - (dotimes (s4-4 s5-4) - (let ((s3-4 (- 7 s4-4))) - (hud-sprite-method-11 - (-> this sprites s3-4) - (if (>= sv-112 s4-4) - (-> *gun-arrow-table* (+ (* s4-4 2) 19)) - (-> *gun-arrow-table* (+ (* s4-4 2) 18)) - ) - (-> sv-64 pos) - 0 - 0 - ) - (if (= f30-0 0.0) - (set! (-> this sprites s3-4 scale-x) f30-0) - ) - ) - ) - ) + (format (clear (-> this strings 0 text)) "~D/~D" (-> this values 1 current) sv-72) ) - (format (clear (-> this strings 0 text)) "~D/~D" (-> this values 1 current) sv-72) (if (and *target* (nonzero? (-> *target* gun)) (< (-> this values 1 current) (the int (-> *target* gun ammo-required))) diff --git a/goal_src/jak3/engine/ui/progress/progress-draw.gc b/goal_src/jak3/engine/ui/progress/progress-draw.gc index 1e077de235..89eaf185e8 100644 --- a/goal_src/jak3/engine/ui/progress/progress-draw.gc +++ b/goal_src/jak3/engine/ui/progress/progress-draw.gc @@ -193,35 +193,26 @@ (arg5 float) (arg6 int) ) - (local-vars (sv-16 (function string font-context draw-string-result)) (sv-32 (function _varargs_ object))) (let ((v1-0 arg0)) (set! (-> v1-0 width) 10000.0) ) (set-scale! arg0 arg4) - (set! sv-16 get-string-length) - (set! sv-32 format) - (let ((a0-3 (clear *temp-string*)) - (a1-1 "~S") - (a2-1 arg3) + (let ((sv-16 get-string-length)) + (format (clear *temp-string*) "~S" arg3) + (let ((f0-2 (-> (sv-16 *temp-string* arg0) length))) + (let ((v1-5 arg0)) + (set! (-> v1-5 width) arg1) ) - (sv-32 a0-3 a1-1 a2-1) - ) - (let* ((a0-4 *temp-string*) - (a1-2 arg0) - (f0-2 (-> (sv-16 a0-4 a1-2) length)) + (cond + ((< arg1 f0-2) + (if (< (/ arg1 f0-2) arg5) + (set-scale! arg0 arg4) + (set-scale! arg0 (/ (* arg1 arg4) f0-2)) + ) ) - (let ((v1-5 arg0)) - (set! (-> v1-5 width) arg1) - ) - (cond - ((< arg1 f0-2) - (if (< (/ arg1 f0-2) arg5) - (set-scale! arg0 arg4) - (set-scale! arg0 (/ (* arg1 arg4) f0-2)) - ) - ) - (else - (set-scale! arg0 arg4) + (else + (set-scale! arg0 arg4) + ) ) ) ) @@ -406,7 +397,6 @@ ;; WARN: Return type mismatch int vs object. (defmethod draw-prev-next-footer ((this progress) (arg0 font-context) (arg1 float)) - (local-vars (sv-16 string)) (let ((s3-0 *progress-work*)) (progress-method-33 this (-> s3-0 footer)) (draw-bg-box-alpha-2 this (-> s3-0 footer) (* 64.0 arg1)) @@ -431,14 +421,11 @@ (set! (-> a0-11 flags) (font-flags kerning large)) ) (let ((s3-1 print-game-text)) - (let ((s2-0 format) - (s1-0 (clear *temp-string*)) - (s0-0 "~S~S") - ) - (set! sv-16 (lookup-text! *common-text* (text-id progress-footer-prev-l1) #f)) - (let ((a3-0 (lookup-text! *common-text* (text-id progress-prev) #f))) - (s2-0 s1-0 s0-0 sv-16 a3-0) - ) + (format + (clear *temp-string*) + "~S~S" + (lookup-text! *common-text* (text-id progress-footer-prev-l1) #f) + (lookup-text! *common-text* (text-id progress-prev) #f) ) (s3-1 *temp-string* arg0 #f 44 (bucket-id hud-draw-hud-alpha)) ) @@ -519,139 +506,125 @@ (arg5 symbol) (arg6 float) ) - (local-vars - (sv-16 float) - (sv-20 string) - (sv-24 vector) - (sv-32 symbol) - (sv-48 (function progress font-context float float string float float int float)) - (sv-64 font-context) - (sv-80 float) - (sv-96 float) - (sv-112 (function progress font-context float float string float float int float)) - (sv-128 progress) - (sv-144 font-context) - (sv-160 float) - (sv-176 float) - ) - (set! sv-32 arg5) - (let ((s1-0 arg6)) - (set! sv-16 (fmax 0.0 (* 2.0 (- 0.5 (-> this menu-transition))))) - (set! sv-20 (the-as string #f)) - (set! sv-24 (get-scissor-stack-top this)) + (let ((sv-32 arg5) + (s1-0 arg6) + (sv-16 (fmax 0.0 (* 2.0 (- 0.5 (-> this menu-transition))))) + (sv-20 (the-as string #f)) + (sv-24 (get-scissor-stack-top this)) + ) (set! (-> arg0 alpha) sv-16) (let ((a0-2 arg0)) (set! (-> a0-2 flags) (font-flags kerning middle large)) ) (let ((f30-0 0.0)) - (cond - (sv-32 - (let ((a0-3 arg0)) - (set! (-> a0-3 color) (font-color font-color-32)) - ) - (set! (-> arg0 origin x) (+ 10.0 (-> sv-24 x))) - (let ((s0-1 this)) - (set! sv-48 (method-of-object s0-1 progress-method-45)) - (set! sv-64 arg0) - (set! sv-80 (+ (- -20.0 (-> sv-24 x)) (-> sv-24 z))) - (set! sv-96 (the-as float 24.5)) - (let* ((t0-1 (lookup-text! *common-text* arg1 #f)) - (t2-1 0.75) - (t3-1 35) - (f28-0 (sv-48 s0-1 sv-64 sv-80 sv-96 t0-1 s1-0 t2-1 t3-1)) - ) - (set! f30-0 (/ f28-0 2)) - (set-scale! arg0 (/ (-> arg0 scale) 2)) - (draw-highlight-bar this arg0 (the int (+ -1.0 (-> arg0 origin y))) (the int (+ 2.0 f28-0)) sv-16) - (+! (-> arg0 origin y) f28-0) - ) - ) - (set! sv-20 (cond - ((-> this yes-no-choice) - (format - (clear *temp-string*) - "~33L~S ~44L~S" - (lookup-text! *common-text* arg2 #f) - (lookup-text! *common-text* arg3 #f) - ) - *temp-string* - ) - (else - (format - (clear *temp-string*) - "~44L~S~33L ~S" - (lookup-text! *common-text* arg2 #f) - (lookup-text! *common-text* arg3 #f) - ) - *temp-string* - ) - ) - ) - ) - (else - (cond - (arg4 - (let ((a0-16 arg0)) - (set! (-> a0-16 color) (font-color font-color-33)) - ) - ) - (else - (let ((a0-17 arg0)) - (set! (-> a0-17 color) (font-color font-color-32)) - ) - ) - ) - (set! (-> arg0 origin x) (+ 10.0 (-> sv-24 x))) - (set! sv-128 this) - (set! sv-112 (method-of-object sv-128 progress-method-45)) - (set! sv-144 arg0) - (set! sv-160 (+ (- -20.0 (-> sv-24 x)) (-> sv-24 z))) - (set! sv-176 (the-as float 24.5)) - (let ((t0-3 (the-as object (lookup-text! *common-text* arg1 #f)))) - (let* ((t1-2 s1-0) - (t2-2 0.75) - (t3-2 35) - (f28-1 (sv-112 sv-128 sv-144 sv-160 sv-176 (the-as string t0-3) t1-2 t2-2 t3-2)) - ) - (when arg4 - (let* ((a0-20 this) - (t9-14 (method-of-object a0-20 draw-highlight-bar)) - (a1-12 arg0) - (a2-12 (the int (+ -1.0 (-> arg0 origin y)))) - (a3-6 (the int (+ 1.0 f28-1))) - ) - (set! t0-3 sv-16) - (t9-14 a0-20 a1-12 a2-12 a3-6 (the-as float t0-3)) + (set! sv-20 + (cond + (sv-32 + (let ((a0-3 arg0)) + (set! (-> a0-3 color) (font-color font-color-32)) ) - ) - (+! (-> arg0 origin y) f28-1) - ) - (set! sv-20 (cond - ((-> this yes-no-choice) - (format - (clear *temp-string*) - "~1L~S~44L ~S" - (lookup-text! *common-text* arg2 #f) - (lookup-text! *common-text* arg3 #f) - (the-as none t0-3) + (set! (-> arg0 origin x) (+ 10.0 (-> sv-24 x))) + (let ((f28-0 (progress-method-45 + this + arg0 + (+ (- -20.0 (-> sv-24 x)) (-> sv-24 z)) + (the-as float 24.5) + (lookup-text! *common-text* arg1 #f) + s1-0 + 0.75 + 35 + ) ) - *temp-string* - ) - (else - (format - (clear *temp-string*) - "~44L~S ~1L~S~1L" - (lookup-text! *common-text* arg2 #f) - (lookup-text! *common-text* arg3 #f) - (the-as none t0-3) - ) - *temp-string* - ) - ) + ) + (set! f30-0 (/ f28-0 2)) + (set-scale! arg0 (/ (-> arg0 scale) 2)) + (draw-highlight-bar this arg0 (the int (+ -1.0 (-> arg0 origin y))) (the int (+ 2.0 f28-0)) sv-16) + (+! (-> arg0 origin y) f28-0) ) + (set! sv-20 (cond + ((-> this yes-no-choice) + (format + (clear *temp-string*) + "~33L~S ~44L~S" + (lookup-text! *common-text* arg2 #f) + (lookup-text! *common-text* arg3 #f) + ) + *temp-string* + ) + (else + (format + (clear *temp-string*) + "~44L~S~33L ~S" + (lookup-text! *common-text* arg2 #f) + (lookup-text! *common-text* arg3 #f) + ) + *temp-string* + ) + ) + ) + sv-20 + ) + (else + (cond + (arg4 + (let ((a0-16 arg0)) + (set! (-> a0-16 color) (font-color font-color-33)) + ) + ) + (else + (let ((a0-17 arg0)) + (set! (-> a0-17 color) (font-color font-color-32)) + ) + ) + ) + (set! (-> arg0 origin x) (+ 10.0 (-> sv-24 x))) + (let* ((sv-128 this) + (sv-112 (method-of-object sv-128 progress-method-45)) + (sv-144 arg0) + (sv-160 (+ (- -20.0 (-> sv-24 x)) (-> sv-24 z))) + (sv-176 (the-as float 24.5)) + (t0-3 (the-as object (lookup-text! *common-text* arg1 #f))) + ) + (let ((f28-1 (sv-112 sv-128 sv-144 sv-160 sv-176 (the-as string t0-3) s1-0 0.75 35))) + (when arg4 + (let* ((a0-20 this) + (t9-14 (method-of-object a0-20 draw-highlight-bar)) + (a1-12 arg0) + (a2-12 (the int (+ -1.0 (-> arg0 origin y)))) + (a3-6 (the int (+ 1.0 f28-1))) + ) + (set! t0-3 sv-16) + (t9-14 a0-20 a1-12 a2-12 a3-6 (the-as float t0-3)) + ) + ) + (+! (-> arg0 origin y) f28-1) + ) + (cond + ((-> this yes-no-choice) + (format + (clear *temp-string*) + "~1L~S~44L ~S" + (lookup-text! *common-text* arg2 #f) + (lookup-text! *common-text* arg3 #f) + (the-as none t0-3) + ) + *temp-string* + ) + (else + (format + (clear *temp-string*) + "~44L~S ~1L~S~1L" + (lookup-text! *common-text* arg2 #f) + (lookup-text! *common-text* arg3 #f) + (the-as none t0-3) + ) + *temp-string* + ) + ) + ) + ) + ) ) - ) - ) (progress-method-44 this arg0 sv-20) (+! (-> arg0 origin y) f30-0) ) @@ -699,24 +672,15 @@ (arg5 float) (arg6 float) ) - (local-vars - (sv-80 float) - (sv-96 float) - (sv-112 vector) - (sv-128 int) - (sv-144 rgba) - (sv-160 dma-buffer) - (sv-176 pointer) - ) - (set! sv-80 arg3) - (let ((s1-0 arg4) + (let ((sv-80 arg3) + (s1-0 arg4) (s5-0 arg5) ) - (set! sv-96 arg6) - (set! sv-112 (get-scissor-stack-top this)) - (let ((s0-0 (new 'stack 'hud-sprite)) - (f30-0 (* (- (-> sv-112 z) (-> sv-112 x)) s1-0)) - ) + (let* ((sv-96 arg6) + (sv-112 (get-scissor-stack-top this)) + (s0-0 (new 'stack 'hud-sprite)) + (f30-0 (* (- (-> sv-112 z) (-> sv-112 x)) s1-0)) + ) (let ((s1-1 (- (- 256 (if sv-96 10 0 @@ -725,79 +689,79 @@ (the int (/ f30-0 2)) ) ) + (sv-128 (the int (+ (-> sv-112 y) (* (- (-> sv-112 w) (-> sv-112 y)) sv-80)))) ) - (set! sv-128 (the int (+ (-> sv-112 y) (* (- (-> sv-112 w) (-> sv-112 y)) sv-80)))) 1.0 - (let ((f28-0 f30-0)) - (let ((f24-0 (-> *video-params* relative-x-scale-reciprical)) - (f26-0 (-> *video-params* relative-x-scale)) - ) - (set! sv-160 (-> *display* frames (-> *display* on-screen) global-buf)) - (set! sv-176 (-> sv-160 base)) - (set! (-> s0-0 tid) (the-as texture-id (get-texture hud-sliderbackground progress-minimap))) + (let* ((f28-0 f30-0) + (f24-0 (-> *video-params* relative-x-scale-reciprical)) + (f26-0 (-> *video-params* relative-x-scale)) + (sv-160 (-> *display* frames (-> *display* on-screen) global-buf)) + (sv-176 (-> sv-160 base)) + ) + (set! (-> s0-0 tid) (the-as texture-id (get-texture hud-sliderbackground progress-minimap))) + (if (-> s0-0 tid) + (set! (-> s0-0 scale-x) (/ (* f30-0 f24-0) (the float (-> (the-as texture (-> s0-0 tid)) w)))) + ) + (set! (-> s0-0 scale-y) 0.7) + (let ((v1-28 (-> s0-0 color-ptr))) + (set! (-> v1-28 0) 128) + (set! (-> v1-28 1) 128) + (set! (-> v1-28 2) 128) + (set! (-> v1-28 3) (the int (* 128.0 arg2))) + ) + (set-vector! (-> s0-0 pos) s1-1 sv-128 #x3fffff 0) + (draw s0-0 sv-160 (-> *level* level-default) #t) + (let ((f24-1 0.2)) + (set! (-> s0-0 tid) (the-as texture-id (get-texture hud-sliderframe progress-minimap))) + (set! (-> s0-0 scale-x) f24-1) + (set! (-> s0-0 scale-y) 1.33) (if (-> s0-0 tid) - (set! (-> s0-0 scale-x) (/ (* f30-0 f24-0) (the float (-> (the-as texture (-> s0-0 tid)) w)))) + (set! f28-0 (- f30-0 (* f24-1 f26-0 (the float (-> (the-as texture (-> s0-0 tid)) w))))) ) - (set! (-> s0-0 scale-y) 0.7) - (let ((v1-28 (-> s0-0 color-ptr))) - (set! (-> v1-28 0) 128) - (set! (-> v1-28 1) 128) - (set! (-> v1-28 2) 128) - (set! (-> v1-28 3) (the int (* 128.0 arg2))) - ) - (set-vector! (-> s0-0 pos) s1-1 sv-128 #x3fffff 0) - (draw s0-0 sv-160 (-> *level* level-default) #t) - (let ((f24-1 0.2)) - (set! (-> s0-0 tid) (the-as texture-id (get-texture hud-sliderframe progress-minimap))) - (set! (-> s0-0 scale-x) f24-1) - (set! (-> s0-0 scale-y) 1.33) - (if (-> s0-0 tid) - (set! f28-0 (- f30-0 (* f24-1 f26-0 (the float (-> (the-as texture (-> s0-0 tid)) w))))) - ) - ) - (let* ((v1-39 (the int (* f28-0 s5-0))) - (a1-3 (+ s1-1 (the int (* 18.0 f26-0)) v1-39)) - (a3-2 (the int (- f28-0 (the float v1-39)))) - (t1-1 (shr (shl (the int (* 128.0 arg2)) 56) 32)) - ) - (draw-sprite2d-xy sv-160 a1-3 (+ sv-128 7) a3-2 9 (the-as rgba t1-1) #x3fffff) - ) + ) + (let* ((v1-39 (the int (* f28-0 s5-0))) + (a1-3 (+ s1-1 (the int (* 18.0 f26-0)) v1-39)) + (a3-2 (the int (- f28-0 (the float v1-39)))) + (t1-1 (shr (shl (the int (* 128.0 arg2)) 56) 32)) + ) + (draw-sprite2d-xy sv-160 a1-3 (+ sv-128 7) a3-2 9 (the-as rgba t1-1) #x3fffff) ) (set-vector! (-> s0-0 pos) (+ s1-1 (the int (* f28-0 s5-0))) (+ sv-128 -4) #x3fffff 0) - ) - (draw s0-0 sv-160 (-> *level* level-default) #t) - (when sv-96 - (set! sv-144 (-> *font-work* color-table 32 color 0)) - (set! (-> s0-0 tid) (the-as texture-id (get-texture hud-speaker-empty progress-minimap))) - (set! (-> s0-0 scale-x) 1.0) - (set! (-> s0-0 scale-y) 1.0) - (let ((v1-55 (-> s0-0 color-ptr))) - (set! (-> v1-55 0) (the-as int (-> sv-144 r))) - (set! (-> v1-55 1) (the-as int (-> sv-144 g))) - (set! (-> v1-55 2) (the-as int (-> sv-144 b))) - (set! (-> v1-55 3) (the int (* 128.0 arg2))) - ) - (set-vector! (-> s0-0 pos) (+ s1-1 -20) (+ sv-128 -5) #x3fffff 0) (draw s0-0 sv-160 (-> *level* level-default) #t) - (set! (-> s0-0 tid) (the-as texture-id (get-texture hud-speaker-full progress-minimap))) - (set! (-> s0-0 scale-x) 1.0) - (set! (-> s0-0 scale-y) 1.0) - (set-vector! (-> s0-0 pos) (+ (the int f30-0) 8 s1-1) (+ sv-128 -5) #x3fffff 0) - (draw s0-0 sv-160 (-> *level* level-default) #t) - ) - (let ((a3-6 (-> sv-160 base))) - (when (!= sv-176 a3-6) - (let ((v1-68 (the-as object (-> sv-160 base)))) - (set! (-> (the-as dma-packet v1-68) dma) (new 'static 'dma-tag :id (dma-tag-id next))) - (set! (-> (the-as dma-packet v1-68) vif0) (new 'static 'vif-tag)) - (set! (-> (the-as dma-packet v1-68) vif1) (new 'static 'vif-tag)) - (set! (-> sv-160 base) (&+ (the-as pointer v1-68) 16)) + (when sv-96 + (let ((sv-144 (-> *font-work* color-table 32 color 0))) + (set! (-> s0-0 tid) (the-as texture-id (get-texture hud-speaker-empty progress-minimap))) + (set! (-> s0-0 scale-x) 1.0) + (set! (-> s0-0 scale-y) 1.0) + (let ((v1-55 (-> s0-0 color-ptr))) + (set! (-> v1-55 0) (the-as int (-> sv-144 r))) + (set! (-> v1-55 1) (the-as int (-> sv-144 g))) + (set! (-> v1-55 2) (the-as int (-> sv-144 b))) + (set! (-> v1-55 3) (the int (* 128.0 arg2))) + ) ) - (dma-bucket-insert-tag - (-> *display* frames (-> *display* on-screen) bucket-group) - (bucket-id hud-draw-hud-alpha) - sv-176 - (the-as (pointer dma-tag) a3-6) + (set-vector! (-> s0-0 pos) (+ s1-1 -20) (+ sv-128 -5) #x3fffff 0) + (draw s0-0 sv-160 (-> *level* level-default) #t) + (set! (-> s0-0 tid) (the-as texture-id (get-texture hud-speaker-full progress-minimap))) + (set! (-> s0-0 scale-x) 1.0) + (set! (-> s0-0 scale-y) 1.0) + (set-vector! (-> s0-0 pos) (+ (the int f30-0) 8 s1-1) (+ sv-128 -5) #x3fffff 0) + (draw s0-0 sv-160 (-> *level* level-default) #t) + ) + (let ((a3-6 (-> sv-160 base))) + (when (!= sv-176 a3-6) + (let ((v1-68 (the-as object (-> sv-160 base)))) + (set! (-> (the-as dma-packet v1-68) dma) (new 'static 'dma-tag :id (dma-tag-id next))) + (set! (-> (the-as dma-packet v1-68) vif0) (new 'static 'vif-tag)) + (set! (-> (the-as dma-packet v1-68) vif1) (new 'static 'vif-tag)) + (set! (-> sv-160 base) (&+ (the-as pointer v1-68) 16)) + ) + (dma-bucket-insert-tag + (-> *display* frames (-> *display* on-screen) bucket-group) + (bucket-id hud-draw-hud-alpha) + sv-176 + (the-as (pointer dma-tag) a3-6) + ) ) ) ) @@ -835,10 +799,9 @@ ) (defmethod draw-icon-array! ((this progress-icon-array) (arg0 int) (arg1 int) (arg2 float) (arg3 float) (arg4 rgba) (arg5 float)) - (local-vars (sv-96 int) (sv-112 int) (sv-128 dma-buffer) (sv-144 pointer)) - (set! sv-96 arg0) - (set! sv-112 arg1) - (let ((s5-0 arg2) + (let ((sv-96 arg0) + (sv-112 arg1) + (s5-0 arg2) (s4-0 arg3) (s1-0 arg4) (s0-0 arg5) @@ -866,22 +829,24 @@ (the int (* (the float (-> s0-1 offset x)) s5-0)) (the int (* (the float (-> s0-1 offset y)) s4-0)) ) - (set! sv-128 (-> *display* frames (-> *display* on-screen) global-buf)) - (set! sv-144 (-> sv-128 base)) - (draw s3-0 sv-128 (-> *level* level-default) #t) - (let ((a3-3 (-> sv-128 base))) - (when (!= sv-144 a3-3) - (let ((v1-24 (the-as object (-> sv-128 base)))) - (set! (-> (the-as dma-packet v1-24) dma) (new 'static 'dma-tag :id (dma-tag-id next))) - (set! (-> (the-as dma-packet v1-24) vif0) (new 'static 'vif-tag)) - (set! (-> (the-as dma-packet v1-24) vif1) (new 'static 'vif-tag)) - (set! (-> sv-128 base) (&+ (the-as pointer v1-24) 16)) - ) - (dma-bucket-insert-tag - (-> *display* frames (-> *display* on-screen) bucket-group) - (-> s0-1 bucket) - sv-144 - (the-as (pointer dma-tag) a3-3) + (let* ((sv-128 (-> *display* frames (-> *display* on-screen) global-buf)) + (sv-144 (-> sv-128 base)) + ) + (draw s3-0 sv-128 (-> *level* level-default) #t) + (let ((a3-3 (-> sv-128 base))) + (when (!= sv-144 a3-3) + (let ((v1-24 (the-as object (-> sv-128 base)))) + (set! (-> (the-as dma-packet v1-24) dma) (new 'static 'dma-tag :id (dma-tag-id next))) + (set! (-> (the-as dma-packet v1-24) vif0) (new 'static 'vif-tag)) + (set! (-> (the-as dma-packet v1-24) vif1) (new 'static 'vif-tag)) + (set! (-> sv-128 base) (&+ (the-as pointer v1-24) 16)) + ) + (dma-bucket-insert-tag + (-> *display* frames (-> *display* on-screen) bucket-group) + (-> s0-1 bucket) + sv-144 + (the-as (pointer dma-tag) a3-3) + ) ) ) ) @@ -1036,197 +1001,157 @@ ) (defmethod draw-option ((this menu-missions-option) (arg0 progress) (arg1 font-context) (arg2 int) (arg3 symbol)) - (local-vars - (sv-176 float) - (sv-180 game-task-node-info) - (sv-184 game-task-node-info) - (sv-188 float) - (sv-192 int) - (sv-200 symbol) - (sv-208 int) - (sv-216 (array game-task-node-info)) - (sv-224 string) - (sv-240 (function _varargs_ object)) - (sv-256 string) - (sv-272 game-task-node-info) - (sv-288 text-id) - (sv-304 (function string font-context symbol int bucket-id float)) - (sv-320 (function _varargs_ object)) - (sv-336 string) - (sv-352 string) - (sv-368 (function string font-context symbol int bucket-id float)) - (sv-384 (function _varargs_ object)) - ) - (set! sv-176 (fmax 0.0 (* 2.0 (- 0.5 (-> arg0 menu-transition))))) - (set! sv-180 (new 'stack 'game-task-node-info)) - (set! sv-184 (new 'stack 'game-task-node-info)) - (set! (-> arg0 current-task-index) (length (-> *game-info* sub-task-list))) - (set! (-> arg0 current-line-index) -1) - (set! (-> arg0 current-task) (game-task unknown)) - (set! (-> arg0 first-closed-line-index) -1) - (set! (-> arg0 extra-text-state) -1) - (set! (-> arg0 num-open-tasks-found) 0) - (set! (-> arg0 num-closed-tasks-found) 0) - (set! (-> arg1 alpha) sv-176) - (set! (-> *game-info* mission-list 0) sv-180) - (set! (-> sv-180 description) (text-id progress-missions-todo)) - (set! (-> sv-184 description) (text-id progress-missions-completed)) - (progress-method-33 arg0 (-> *progress-work* body-footer)) - (let ((s3-0 (get-scissor-stack-top arg0))) - (set! sv-188 (- (-> s3-0 w) (-> s3-0 y))) - (set! sv-192 1) - (set! sv-200 #t) - (set! sv-208 (length (-> *game-info* sub-task-list))) - (set! sv-216 (-> *game-info* mission-list)) - (dotimes (s2-0 sv-208) - (let ((v0-6 (find-mission-text-at-index arg0 s2-0))) - (when v0-6 - (when (and (logtest? (-> v0-6 flags) (game-task-node-flag closed)) sv-200) - (set! sv-200 (the-as symbol #f)) - (set! (-> sv-216 sv-192) sv-184) - (set! sv-192 (+ sv-192 1)) - ) - (set! (-> sv-216 sv-192) v0-6) - (set! sv-192 (+ sv-192 1)) + (local-vars (sv-288 text-id)) + (let ((sv-176 (fmax 0.0 (* 2.0 (- 0.5 (-> arg0 menu-transition)))))) + (let ((sv-180 (new 'stack 'game-task-node-info)) + (sv-184 (new 'stack 'game-task-node-info)) ) - ) - ) - (set! (-> arg0 total-num-tasks) sv-192) - (sort-task-node-result (-> arg0 total-num-tasks)) - (let ((a0-17 arg1)) - (set! (-> a0-17 flags) (font-flags kerning large)) - ) - (set-scale! arg1 0.5) - (let ((f30-0 14.0) - (s2-1 get-string-length) - ) - (let ((s1-0 format) - (s0-0 (clear *temp-string*)) - ) - (set! sv-224 "~S") - (let ((a2-2 (lookup-text! *common-text* (text-id progress-missions-complete-icon) #f))) - (s1-0 s0-0 sv-224 a2-2) - ) - ) - (let ((f30-1 (+ f30-0 (-> (s2-1 *temp-string* arg1) length)))) - (let ((v1-45 arg1)) - (set! (-> v1-45 width) (+ (- (- -10.0 f30-1) (-> s3-0 x)) (-> s3-0 z))) - ) - (let ((s2-2 (-> *game-info* mission-list)) - (s1-2 (max 0 (the int (-> this current-index)))) + (set! (-> arg0 current-task-index) (length (-> *game-info* sub-task-list))) + (set! (-> arg0 current-line-index) -1) + (set! (-> arg0 current-task) (game-task unknown)) + (set! (-> arg0 first-closed-line-index) -1) + (set! (-> arg0 extra-text-state) -1) + (set! (-> arg0 num-open-tasks-found) 0) + (set! (-> arg0 num-closed-tasks-found) 0) + (set! (-> arg1 alpha) sv-176) + (set! (-> *game-info* mission-list 0) sv-180) + (set! (-> sv-180 description) (text-id progress-missions-todo)) + (set! (-> sv-184 description) (text-id progress-missions-completed)) + (progress-method-33 arg0 (-> *progress-work* body-footer)) + (let* ((s3-0 (get-scissor-stack-top arg0)) + (sv-188 (- (-> s3-0 w) (-> s3-0 y))) + ) + (let ((sv-192 1)) + (let ((sv-200 #t) + (sv-208 (length (-> *game-info* sub-task-list))) + (sv-216 (-> *game-info* mission-list)) + ) + (dotimes (s2-0 sv-208) + (let ((v0-6 (find-mission-text-at-index arg0 s2-0))) + (when v0-6 + (when (and (logtest? (-> v0-6 flags) (game-task-node-flag closed)) sv-200) + (set! sv-200 (the-as symbol #f)) + (set! (-> sv-216 sv-192) sv-184) + (+! sv-192 1) + ) + (set! (-> sv-216 sv-192) v0-6) + (+! sv-192 1) + ) + ) ) - (let* ((s0-1 (-> s2-2 s1-2)) - (a1-10 - (if (and (logtest? (-> s0-1 flags) (game-task-node-flag closed)) (task-complete? *game-info* (-> s0-1 task))) - (-> *game-info* play-list (-> s0-1 task) text-name) - (-> s0-1 description) - ) + ) + (set! (-> arg0 total-num-tasks) sv-192) + ) + (sort-task-node-result (-> arg0 total-num-tasks)) + (let ((a0-17 arg1)) + (set! (-> a0-17 flags) (font-flags kerning large)) + ) + (set-scale! arg1 0.5) + (let ((f30-0 14.0) + (s2-1 get-string-length) + ) + (format (clear *temp-string*) "~S" (lookup-text! *common-text* (text-id progress-missions-complete-icon) #f)) + (let ((f30-1 (+ f30-0 (-> (s2-1 *temp-string* arg1) length)))) + (let ((v1-45 arg1)) + (set! (-> v1-45 width) (+ (- (- -10.0 f30-1) (-> s3-0 x)) (-> s3-0 z))) + ) + (let* ((s2-2 (-> *game-info* mission-list)) + (s1-2 (max 0 (the int (-> this current-index)))) + (s0-1 (-> s2-2 s1-2)) + (a1-10 + (if (and (logtest? (-> s0-1 flags) (game-task-node-flag closed)) (task-complete? *game-info* (-> s0-1 task))) + (-> *game-info* play-list (-> s0-1 task) text-name) + (-> s0-1 description) + ) + ) + (sv-256 (lookup-text! *common-text* a1-10 #f)) + (s0-2 print-game-text) ) - ) - (set! sv-256 (lookup-text! *common-text* a1-10 #f)) - ) - (let ((s0-2 print-game-text)) - (set! sv-240 format) - (let ((a0-29 (clear *temp-string*)) - (a1-11 "~S") - ) - (sv-240 a0-29 a1-11 sv-256) - ) - (let ((f28-0 (s0-2 *temp-string* arg1 #t 44 (bucket-id hud-draw-hud-alpha)))) - (let* ((v1-60 arg1) - (f0-14 (+ 10.0 (-> s3-0 x))) - (f1-6 4.0) - (f2-2 (-> this current-index)) - (f1-8 (+ (- f1-6 (* f28-0 (- f2-2 (* (the float (the int (/ f2-2 1.0))) 1.0)))) (-> s3-0 y))) - ) - (set! (-> v1-60 origin x) f0-14) - (set! (-> v1-60 origin y) f1-8) - ) - (let ((v1-61 arg1)) - (set! (-> v1-61 height) sv-188) - ) - (while (and (< (-> arg1 origin y) (-> s3-0 w)) (< s1-2 (-> arg0 total-num-tasks))) - (set! sv-272 (-> s2-2 s1-2)) - (if (and (logtest? (-> sv-272 flags) (game-task-node-flag closed)) (task-complete? *game-info* (-> sv-272 task))) - (set! sv-288 (-> *game-info* play-list (-> sv-272 task) text-name)) - (set! sv-288 (-> sv-272 description)) - ) - (let ((s0-3 (lookup-text! *common-text* sv-288 #f))) - (set! (-> arg1 origin x) (+ 10.0 (-> s3-0 x))) - (cond - ((or (= sv-288 (text-id progress-missions-todo)) (= sv-288 (text-id progress-missions-completed))) - (let ((a0-41 arg1)) - (set! (-> a0-41 color) (font-color font-color-34)) + (format (clear *temp-string*) "~S" sv-256) + (let ((f28-0 (s0-2 *temp-string* arg1 #t 44 (bucket-id hud-draw-hud-alpha)))) + (let* ((v1-60 arg1) + (f0-14 (+ 10.0 (-> s3-0 x))) + (f1-6 4.0) + (f2-2 (-> this current-index)) + (f1-8 (+ (- f1-6 (* f28-0 (- f2-2 (* (the float (the int (/ f2-2 1.0))) 1.0)))) (-> s3-0 y))) ) - ) - (else - (set! sv-304 print-game-text) - (set! sv-320 format) - (set! sv-336 (clear *temp-string*)) - (set! sv-352 "~S") - (let ((a2-8 (lookup-text! - *common-text* - (if (logtest? (-> sv-272 flags) (game-task-node-flag closed)) - (text-id progress-missions-complete-icon) - (text-id progress-missions-todo-icon) - ) - #f - ) - ) - ) - (sv-320 sv-336 sv-352 a2-8) - ) - (let ((a0-45 *temp-string*) - (a1-17 arg1) - (a2-9 #f) - (a3-2 44) - (t0-2 579) - ) - (sv-304 a0-45 a1-17 a2-9 a3-2 (the-as bucket-id t0-2)) - ) - (let ((a0-46 arg1)) - (set! (-> a0-46 color) (font-color font-color-32)) - ) - (set! (-> arg1 origin x) (+ (-> s3-0 x) f30-1)) - ) - ) - (let ((f26-0 (-> arg1 origin y))) - (set! sv-368 print-game-text) - (set! sv-384 format) - (let ((a0-48 (clear *temp-string*)) - (a1-18 "~S") - ) - (sv-384 a0-48 a1-18 s0-3) - ) - (let ((a0-49 *temp-string*) - (a1-19 arg1) - (a2-11 #f) - (a3-3 44) - (t0-3 579) - ) - (set! (-> arg1 origin y) (+ f26-0 (sv-368 a0-49 a1-19 a2-11 a3-3 (the-as bucket-id t0-3)))) - ) - ) + (set! (-> v1-60 origin x) f0-14) + (set! (-> v1-60 origin y) f1-8) + ) + (set! (-> arg1 height) sv-188) + (while (and (< (-> arg1 origin y) (-> s3-0 w)) (< s1-2 (-> arg0 total-num-tasks))) + (let ((sv-272 (-> s2-2 s1-2))) + (set! sv-288 + (cond + ((and (logtest? (-> sv-272 flags) (game-task-node-flag closed)) (task-complete? *game-info* (-> sv-272 task))) + (set! sv-288 (-> *game-info* play-list (-> sv-272 task) text-name)) + sv-288 + ) + (else + (-> sv-272 description) + ) + ) + ) + (let ((s0-3 (lookup-text! *common-text* sv-288 #f))) + (set! (-> arg1 origin x) (+ 10.0 (-> s3-0 x))) + (cond + ((or (= sv-288 (text-id progress-missions-todo)) (= sv-288 (text-id progress-missions-completed))) + (let ((a0-41 arg1)) + (set! (-> a0-41 color) (font-color font-color-34)) + ) + ) + (else + (let ((sv-304 print-game-text)) + (let ((sv-320 format) + (sv-336 (clear *temp-string*)) + (sv-352 "~S") + ) + (sv-320 sv-336 sv-352 (lookup-text! + *common-text* + (if (logtest? (-> sv-272 flags) (game-task-node-flag closed)) + (text-id progress-missions-complete-icon) + (text-id progress-missions-todo-icon) + ) + #f + ) + ) + ) + (sv-304 *temp-string* arg1 #f 44 (bucket-id hud-draw-hud-alpha)) + ) + (let ((a0-46 arg1)) + (set! (-> a0-46 color) (font-color font-color-32)) + ) + (set! (-> arg1 origin x) (+ (-> s3-0 x) f30-1)) + ) + ) + (let ((f26-0 (-> arg1 origin y)) + (sv-368 print-game-text) + ) + (format (clear *temp-string*) "~S" s0-3) + (set! (-> arg1 origin y) (+ f26-0 (sv-368 *temp-string* arg1 #f 44 (bucket-id hud-draw-hud-alpha)))) + ) + ) + ) + (+! s1-2 1) + ) + (set! (-> this on-screen) (< (-> arg1 origin y) (-> s3-0 w))) + (seek! + (-> this current-index) + (-> this target-index) + (* (/ (-> this scroll-speed) f28-0) (seconds-per-frame)) ) - (+! s1-2 1) - ) - (set! (-> this on-screen) (< (-> arg1 origin y) (-> s3-0 w))) - (seek! - (-> this current-index) - (-> this target-index) - (* (/ (-> this scroll-speed) f28-0) (seconds-per-frame)) ) ) ) ) ) ) - ) - (progress-method-34 arg0) - (let ((s3-1 *progress-work*)) - (draw-header arg0 arg1 sv-176 (text-id progress-missions)) - (draw-bg-box-alpha-2 arg0 (-> s3-1 footer) (* 64.0 sv-176)) - (draw-bg-box-outline arg0 (-> s3-1 footer) (* 128.0 sv-176)) + (progress-method-34 arg0) + (let ((s3-1 *progress-work*)) + (draw-header arg0 arg1 sv-176 (text-id progress-missions)) + (draw-bg-box-alpha-2 arg0 (-> s3-1 footer) (* 64.0 sv-176)) + (draw-bg-box-outline arg0 (-> s3-1 footer) (* 128.0 sv-176)) + ) ) (progress-method-47 arg0 @@ -1285,19 +1210,12 @@ ) (defmethod highscore-page-info-method-11 ((this highscore-page-info) (arg0 font-context) (arg1 int) (arg2 float) (arg3 float) (arg4 float)) - (local-vars (sv-16 string) (sv-32 string)) (set! (-> arg0 origin x) arg3) (let ((a0-1 arg0)) (set! (-> a0-1 flags) (font-flags kerning large)) ) (let ((s1-0 print-game-text)) - (let ((s0-0 format)) - (set! sv-16 (clear *temp-string*)) - (set! sv-32 "~S") - (let ((a2-2 (lookup-text! *common-text* (the-as text-id arg1) #f))) - (s0-0 sv-16 sv-32 a2-2) - ) - ) + (format (clear *temp-string*) "~S" (lookup-text! *common-text* (the-as text-id arg1) #f)) (s1-0 *temp-string* arg0 #f 44 (bucket-id hud-draw-hud-alpha)) ) (let ((a0-6 arg0)) @@ -1309,95 +1227,64 @@ ) (defmethod highscore-page-info-method-9 ((this highscore-page-info) (arg0 progress) (arg1 font-context) (arg2 float) (arg3 float)) - (local-vars - (sv-16 highscore-info) - (sv-32 (function string font-context symbol int bucket-id float)) - (sv-48 (function _varargs_ object)) - (sv-64 string) - (sv-80 string) - (sv-96 int) - (sv-112 int) - ) (let ((s3-0 (get-scissor-stack-top arg0))) - (let ((f28-0 (-> *video-params* relative-x-scale))) - (set! sv-16 (-> *highscore-info-array* (-> this game-score))) - (let ((f30-0 (- (-> s3-0 z) (-> s3-0 x))) - (s0-0 *progress-work*) - ) - (let ((a0-3 arg1)) - (set! (-> a0-3 flags) (font-flags kerning large)) + (let ((f28-0 (-> *video-params* relative-x-scale)) + (sv-16 (-> *highscore-info-array* (-> this game-score))) + (f30-0 (- (-> s3-0 z) (-> s3-0 x))) + (s0-0 *progress-work*) ) - (set-scale! arg1 0.675) - (let ((a0-5 arg1)) - (set! (-> a0-5 color) (font-color font-color-32)) - ) - (set! (-> arg1 origin x) (+ 10.0 arg2 (-> s3-0 x))) - (adjust-font-origin-y arg0 arg1 0.01) - (let ((v1-11 arg1)) - (set! (-> v1-11 width) (* 0.75 f30-0)) - ) - (set! sv-32 print-game-text) - (set! sv-48 format) - (set! sv-64 (clear *temp-string*)) - (set! sv-80 "~S") - (let ((a2-3 (lookup-text! *common-text* (-> this text) #f))) - (sv-48 sv-64 sv-80 a2-3) - ) - (let ((a0-11 *temp-string*) - (a1-4 arg1) - (a2-4 #f) - (a3-1 32) - (t0-1 579) - ) - (sv-32 a0-11 a1-4 a2-4 a3-1 (the-as bucket-id t0-1)) - ) - (draw-icon-array! - (-> *progress-icon-arrays* (-> this icon)) - (the int (+ (- (-> s3-0 z) (* (-> this icon-offsetx) f28-0)) arg2)) - (the int (+ (-> s3-0 y) (-> this icon-offsety))) - (-> this icon-scalex) - (-> this icon-scaley) - (new 'static 'rgba :r #x80 :g #x80 :b #x80 :a (the int (* 128.0 arg3))) - arg3 - ) - (when (not (logtest? (-> sv-16 flags) (highscore-flags hf1))) - (let ((f28-1 (* 20.0 f28-0)) - (f26-0 (+ 50.0 (-> s3-0 y))) - ) - (set! sv-96 (the int (+ 48.0 (-> s3-0 y)))) - (set! sv-112 (logior #x808080 (shr (shl (the int (* 128.0 arg3)) 56) 32))) - (let ((f24-0 0.25) - (f22-0 (+ 10.0 arg2 (-> s3-0 x))) - ) - (set-scale! arg1 0.45) - (let ((f20-0 f22-0)) - (draw-icon-array! (-> *progress-icon-arrays* 63) (the int f20-0) sv-96 f24-0 f24-0 (the-as rgba sv-112) arg3) - (highscore-page-info-method-10 this arg1 (-> sv-16 gold-score) (+ f20-0 f28-1) f26-0) - ) - (let ((f20-1 (+ f22-0 (* 0.333 f30-0)))) - (draw-icon-array! (-> *progress-icon-arrays* 64) (the int f20-1) sv-96 f24-0 f24-0 (the-as rgba sv-112) arg3) - (highscore-page-info-method-10 this arg1 (-> sv-16 silver-score) (+ f20-1 f28-1) f26-0) - ) - (let ((f30-1 (+ f22-0 (* 0.667 f30-0)))) - (let* ((a0-23 (-> *progress-icon-arrays* 65)) - (t9-11 (method-of-object a0-23 draw-icon-array!)) - (a1-10 (the int f30-1)) - (a3-7 f24-0) - (t0-7 f24-0) - (t2-3 arg3) - ) - (t9-11 a0-23 a1-10 sv-96 a3-7 t0-7 (the-as rgba sv-112) t2-3) - ) - (highscore-page-info-method-10 this arg1 (-> sv-16 bronze-score) (+ f30-1 f28-1) f26-0) - ) - ) - ) - ) - (draw-bg-box-alpha-2 arg0 (-> s0-0 highscore-1) (* 16.0 arg3)) - (draw-bg-box-outline arg0 (-> s0-0 highscore-1) (* 128.0 arg3)) - (draw-bg-box-outline arg0 (-> s0-0 highscore-0) (* 128.0 arg3)) - (progress-method-33 arg0 (-> s0-0 highscore-body)) + (let ((a0-3 arg1)) + (set! (-> a0-3 flags) (font-flags kerning large)) ) + (set-scale! arg1 0.675) + (let ((a0-5 arg1)) + (set! (-> a0-5 color) (font-color font-color-32)) + ) + (set! (-> arg1 origin x) (+ 10.0 arg2 (-> s3-0 x))) + (adjust-font-origin-y arg0 arg1 0.01) + (let ((v1-11 arg1)) + (set! (-> v1-11 width) (* 0.75 f30-0)) + ) + (let ((sv-32 print-game-text)) + (format (clear *temp-string*) "~S" (lookup-text! *common-text* (-> this text) #f)) + (sv-32 *temp-string* arg1 #f 32 (bucket-id hud-draw-hud-alpha)) + ) + (draw-icon-array! + (-> *progress-icon-arrays* (-> this icon)) + (the int (+ (- (-> s3-0 z) (* (-> this icon-offsetx) f28-0)) arg2)) + (the int (+ (-> s3-0 y) (-> this icon-offsety))) + (-> this icon-scalex) + (-> this icon-scaley) + (new 'static 'rgba :r #x80 :g #x80 :b #x80 :a (the int (* 128.0 arg3))) + arg3 + ) + (when (not (logtest? (-> sv-16 flags) (highscore-flags hf1))) + (let ((f28-1 (* 20.0 f28-0)) + (f26-0 (+ 50.0 (-> s3-0 y))) + (sv-96 (the int (+ 48.0 (-> s3-0 y)))) + (sv-112 (logior #x808080 (shr (shl (the int (* 128.0 arg3)) 56) 32))) + (f24-0 0.25) + (f22-0 (+ 10.0 arg2 (-> s3-0 x))) + ) + (set-scale! arg1 0.45) + (let ((f20-0 f22-0)) + (draw-icon-array! (-> *progress-icon-arrays* 63) (the int f20-0) sv-96 f24-0 f24-0 (the-as rgba sv-112) arg3) + (highscore-page-info-method-10 this arg1 (-> sv-16 gold-score) (+ f20-0 f28-1) f26-0) + ) + (let ((f20-1 (+ f22-0 (* 0.333 f30-0)))) + (draw-icon-array! (-> *progress-icon-arrays* 64) (the int f20-1) sv-96 f24-0 f24-0 (the-as rgba sv-112) arg3) + (highscore-page-info-method-10 this arg1 (-> sv-16 silver-score) (+ f20-1 f28-1) f26-0) + ) + (let ((f30-1 (+ f22-0 (* 0.667 f30-0)))) + (draw-icon-array! (-> *progress-icon-arrays* 65) (the int f30-1) sv-96 f24-0 f24-0 (the-as rgba sv-112) arg3) + (highscore-page-info-method-10 this arg1 (-> sv-16 bronze-score) (+ f30-1 f28-1) f26-0) + ) + ) + ) + (draw-bg-box-alpha-2 arg0 (-> s0-0 highscore-1) (* 16.0 arg3)) + (draw-bg-box-outline arg0 (-> s0-0 highscore-1) (* 128.0 arg3)) + (draw-bg-box-outline arg0 (-> s0-0 highscore-0) (* 128.0 arg3)) + (progress-method-33 arg0 (-> s0-0 highscore-body)) ) (let ((f30-2 (+ 10.0 arg2 (-> s3-0 x))) (f28-2 (+ -10.0 arg2 (-> s3-0 z))) @@ -1520,30 +1407,13 @@ ) (defmethod inventory-item-group-method-10 ((this inventory-item-group) (arg0 progress) (arg1 font-context) (arg2 float) (arg3 float) (arg4 int)) - (local-vars - (sv-16 (function string font-context symbol int bucket-id float)) - (sv-32 (function _varargs_ object)) - (sv-48 string) - (sv-64 string) - ) (dotimes (s0-0 (-> this items length)) (when (and arg4 (have-items? this)) (set-scale! arg1 0.45) (adjust-font-origin-y arg0 arg1 0.9) - (set! sv-16 print-game-text) - (set! sv-32 format) - (set! sv-48 (clear *temp-string*)) - (set! sv-64 "~S") - (let ((a2-3 (lookup-text! *common-text* (-> this name) #f))) - (sv-32 sv-48 sv-64 a2-3) - ) - (let ((a0-7 *temp-string*) - (a1-4 arg1) - (a2-4 #f) - (a3-1 44) - (t0-1 579) - ) - (sv-16 a0-7 a1-4 a2-4 a3-1 (the-as bucket-id t0-1)) + (let ((sv-16 print-game-text)) + (format (clear *temp-string*) "~S" (lookup-text! *common-text* (-> this name) #f)) + (sv-16 *temp-string* arg1 #f 44 (bucket-id hud-draw-hud-alpha)) ) ) (inventory-item-method-10 (-> this items s0-0) arg0 arg1 arg2 arg3 (the-as symbol arg4)) @@ -1553,20 +1423,13 @@ ) (defmethod inventory-screen-method-9 ((this inventory-screen) (arg0 progress) (arg1 font-context) (arg2 float) (arg3 float)) - (local-vars (sv-16 string) (sv-32 string)) (set-scale! arg1 0.45) (let ((a0-2 arg1)) (set! (-> a0-2 color) (font-color font-color-32)) ) (adjust-font-origin-y arg0 arg1 0.01) (let ((s1-0 print-game-text)) - (let ((s0-0 format)) - (set! sv-16 (clear *temp-string*)) - (set! sv-32 "~S") - (let ((a2-3 (lookup-text! *common-text* (-> this name) #f))) - (s0-0 sv-16 sv-32 a2-3) - ) - ) + (format (clear *temp-string*) "~S" (lookup-text! *common-text* (-> this name) #f)) (s1-0 *temp-string* arg1 #f 44 (bucket-id hud-draw-hud-alpha)) ) (dotimes (s1-1 (-> this groups length)) @@ -1623,18 +1486,8 @@ (arg5 float) (arg6 float) ) - (local-vars - (sv-48 float) - (sv-64 (function string font-context symbol int bucket-id float)) - (sv-80 (function _varargs_ object)) - (sv-96 string) - (sv-112 string) - (sv-128 (function _varargs_ object)) - (sv-144 string) - (sv-160 string) - ) - (set! sv-48 arg4) - (let ((s0-0 arg5) + (let ((sv-48 arg4) + (s0-0 arg5) (s3-0 arg6) (s2-0 (get-scissor-stack-top arg0)) ) @@ -1644,53 +1497,38 @@ (let ((v1-2 arg1)) (set! (-> v1-2 width) (+ -20.0 sv-48)) ) - (set! sv-64 print-game-text) - (set! sv-80 format) - (set! sv-96 (clear *temp-string*)) - (set! sv-112 "~S") - (let ((a2-2 (lookup-text! *common-text* (-> this action) #f))) - (sv-80 sv-96 sv-112 a2-2) - ) - (let* ((a0-7 *temp-string*) - (a1-3 arg1) - (a2-3 #f) - (a3-1 40) - (t0-1 579) - (f30-0 (sv-64 a0-7 a1-3 a2-3 a3-1 (the-as bucket-id t0-1))) - ) - (set! (-> arg1 origin x) (+ 10.0 arg3)) - (let ((v1-8 arg1)) - (set! (-> v1-8 width) (+ -20.0 s0-0)) - ) - (let ((s0-1 print-game-text)) - (set! sv-128 format) - (set! sv-144 (clear *temp-string*)) - (set! sv-160 "~S") - (let ((a2-5 (lookup-text! *common-text* (-> this button) #f))) - (sv-128 sv-144 sv-160 a2-5) + (let ((sv-64 print-game-text)) + (format (clear *temp-string*) "~S" (lookup-text! *common-text* (-> this action) #f)) + (let ((f30-0 (sv-64 *temp-string* arg1 #f 40 (bucket-id hud-draw-hud-alpha)))) + (set! (-> arg1 origin x) (+ 10.0 arg3)) + (let ((v1-8 arg1)) + (set! (-> v1-8 width) (+ -20.0 s0-0)) ) - (let* ((f0-11 (s0-1 *temp-string* arg1 #f 40 (bucket-id hud-draw-hud-alpha))) - (f30-1 (+ 8.0 (fmax f30-0 f0-11))) - ) - (let ((s1-1 (new 'stack 'hud-box)) - (f28-0 (+ arg3 (* 0.5 (- (-> s2-0 z) (-> s2-0 x))))) + (let ((s0-1 print-game-text)) + (format (clear *temp-string*) "~S" (lookup-text! *common-text* (-> this button) #f)) + (let* ((f0-11 (s0-1 *temp-string* arg1 #f 40 (bucket-id hud-draw-hud-alpha))) + (f30-1 (+ 8.0 (fmax f30-0 f0-11))) + ) + (let ((s1-1 (new 'stack 'hud-box)) + (f28-0 (+ arg3 (* 0.5 (- (-> s2-0 z) (-> s2-0 x))))) + ) + (set! (-> s1-1 box min y) (+ -6.0 (-> arg1 origin y))) + (set! (-> s1-1 box max y) (+ (-> s1-1 box min y) f30-1)) + (set-vector! (-> s1-1 color) 192 192 96 (the int (* 128.0 s3-0))) + (with-dma-buffer-add-bucket ((s2-1 (-> *display* frames (-> *display* on-screen) global-buf)) + ;; og:preserve-this changed from particles bucket + (bucket-id hud-draw-hud-alpha) + ) + (set! (-> s1-1 box min x) arg2) + (set! (-> s1-1 box max x) arg3) + (draw-box-prim-only s1-1 s2-1) + (set! (-> s1-1 box min x) arg3) + (set! (-> s1-1 box max x) f28-0) + (draw-box-prim-only s1-1 s2-1) ) - (set! (-> s1-1 box min y) (+ -6.0 (-> arg1 origin y))) - (set! (-> s1-1 box max y) (+ (-> s1-1 box min y) f30-1)) - (set-vector! (-> s1-1 color) 192 192 96 (the int (* 128.0 s3-0))) - (with-dma-buffer-add-bucket ((s2-1 (-> *display* frames (-> *display* on-screen) global-buf)) - ;; og:preserve-this changed from particles bucket - (bucket-id hud-draw-hud-alpha) - ) - (set! (-> s1-1 box min x) arg2) - (set! (-> s1-1 box max x) arg3) - (draw-box-prim-only s1-1 s2-1) - (set! (-> s1-1 box min x) arg3) - (set! (-> s1-1 box max x) f28-0) - (draw-box-prim-only s1-1 s2-1) ) + (+! (-> arg1 origin y) f30-1) ) - (+! (-> arg1 origin y) f30-1) ) ) ) @@ -1703,25 +1541,9 @@ ;; ERROR: Stack slot load at 64 mismatch: defined as size 4, got size 16 ;; ERROR: Stack slot load at 64 mismatch: defined as size 4, got size 16 (defmethod controls-page-info-method-11 ((this controls-page-info) (arg0 progress) (arg1 font-context) (arg2 float) (arg3 float)) - (local-vars - (v1-28 int) - (v1-29 int) - (sv-16 float) - (sv-32 (function progress font-context float float string float float int float)) - (sv-48 font-context) - (sv-64 float) - (sv-80 int) - (sv-96 (function string font-context symbol int bucket-id float)) - (sv-112 (function _varargs_ object)) - (sv-128 string) - (sv-144 string) - (sv-160 (function string font-context symbol int bucket-id float)) - (sv-176 (function _varargs_ object)) - (sv-192 string) - (sv-208 string) - ) - (set! sv-16 arg2) - (let ((s2-0 arg3) + (local-vars (v1-28 int) (v1-29 int)) + (let ((sv-16 arg2) + (s2-0 arg3) (s3-0 *progress-work*) ) (let ((s1-0 (get-scissor-stack-top arg0))) @@ -1741,19 +1563,15 @@ (let ((a0-7 arg1)) (set! (-> a0-7 color) (font-color font-color-34)) ) - (let ((s0-0 arg0)) - (set! sv-32 (method-of-object s0-0 progress-method-45)) - (set! sv-48 arg1) - (let ((s1-1 (+ (- -20.0 (-> s1-0 x)) (-> s1-0 z)))) - (set! sv-64 (the-as float 28.0)) - (let ((t0-1 (lookup-text! *common-text* (-> this title) #f)) - (t1-0 0.7) - (t2-0 0.5) - (t3-0 32) - ) - (sv-32 s0-0 sv-48 s1-1 sv-64 t0-1 t1-0 t2-0 t3-0) - ) - ) + (progress-method-45 + arg0 + arg1 + (+ (- -20.0 (-> s1-0 x)) (-> s1-0 z)) + (the-as float 28.0) + (lookup-text! *common-text* (-> this title) #f) + 0.7 + 0.5 + 32 ) ) (progress-method-34 arg0) @@ -1778,72 +1596,54 @@ (let ((v1-25 arg1)) (set! (-> v1-25 width) (+ -20.0 f30-0)) ) - (set! sv-80 0) - (let ((v1-27 sv-80) - (a0-20 (min (the int (-> this current-index)) s1-2)) - ) - (set-on-less-than v1-28 v1-27 a0-20) - (move-if-not-zero v1-29 a0-20 v1-28 v1-28) - ) - (set! sv-80 v1-29) - (set! sv-96 print-game-text) - (set! sv-112 format) - (set! sv-128 (clear *temp-string*)) - (set! sv-144 "~S") - (let ((a2-5 (lookup-text! *common-text* (the-as text-id (-> this text sv-80 text)) #f))) - (sv-112 sv-128 sv-144 a2-5) - ) - (let* ((a0-24 *temp-string*) - (a1-10 arg1) - (a2-6 #t) - (a3-2 40) - (t0-2 579) - (f22-0 (sv-96 a0-24 a1-10 a2-6 a3-2 (the-as bucket-id t0-2))) - ) - (set! sv-160 print-game-text) - (set! sv-176 format) - (set! sv-192 (clear *temp-string*)) - (set! sv-208 "~S") - (let ((a2-8 (lookup-text! *common-text* (-> this text sv-80 id) #f))) - (sv-176 sv-192 sv-208 a2-8) - ) - (let* ((a0-28 *temp-string*) - (a1-13 arg1) - (a2-9 #t) - (a3-3 40) - (t0-3 579) - (f0-23 (sv-160 a0-28 a1-13 a2-9 a3-3 (the-as bucket-id t0-3))) - (f22-1 (+ 8.0 (fmax f22-0 f0-23))) - ) - (let* ((v1-47 arg1) - (f0-26 (+ 10.0 (-> s0-1 x))) - (f1-12 4.0) - (f2-0 (-> this current-index)) - (f1-14 (+ (- f1-12 (* f22-1 (- f2-0 (* (the float (the int (/ f2-0 1.0))) 1.0)))) (-> s0-1 y))) - ) - (set! (-> v1-47 origin x) f0-26) - (set! (-> v1-47 origin y) f1-14) - ) - (while (and (< (-> arg1 origin y) (-> s0-1 w)) (< sv-80 s1-2)) - (when (= sv-80 3) - (nop!) - (nop!) - 0 + (let ((sv-80 0)) + (let ((v1-27 sv-80) + (a0-20 (min (the int (-> this current-index)) s1-2)) + ) + (set-on-less-than v1-28 v1-27 a0-20) + (move-if-not-zero v1-29 a0-20 v1-28 v1-28) + ) + (set! sv-80 v1-29) + (let ((sv-96 print-game-text)) + (format (clear *temp-string*) "~S" (lookup-text! *common-text* (the-as text-id (-> this text sv-80 text)) #f)) + (let ((f22-0 (sv-96 *temp-string* arg1 #t 40 (bucket-id hud-draw-hud-alpha))) + (sv-160 print-game-text) + ) + (format (clear *temp-string*) "~S" (lookup-text! *common-text* (-> this text sv-80 id) #f)) + (let* ((f0-23 (sv-160 *temp-string* arg1 #t 40 (bucket-id hud-draw-hud-alpha))) + (f22-1 (+ 8.0 (fmax f22-0 f0-23))) + ) + (let* ((v1-47 arg1) + (f0-26 (+ 10.0 (-> s0-1 x))) + (f1-12 4.0) + (f2-0 (-> this current-index)) + (f1-14 (+ (- f1-12 (* f22-1 (- f2-0 (* (the float (the int (/ f2-0 1.0))) 1.0)))) (-> s0-1 y))) + ) + (set! (-> v1-47 origin x) f0-26) + (set! (-> v1-47 origin y) f1-14) + ) + (while (and (< (-> arg1 origin y) (-> s0-1 w)) (< sv-80 s1-2)) + (when (= sv-80 3) + (nop!) + (nop!) + 0 + ) + ((method-of-type controls-string-info controls-string-info-method-9) + (the-as controls-string-info (-> this text sv-80)) + arg0 + arg1 + f26-0 + f24-0 + f30-0 + f28-1 + s2-0 + ) + (+! sv-80 1) + ) + (set! (-> this on-screen) (< (-> arg1 origin y) (-> s0-1 w))) + (seek! (-> this current-index) (-> this target-index) (* (/ 300.0 f22-1) (seconds-per-frame))) ) - ((method-of-type controls-string-info controls-string-info-method-9) - (the-as controls-string-info (-> this text sv-80)) - arg0 - arg1 - f26-0 - f24-0 - f30-0 - f28-1 - s2-0 - ) - (set! sv-80 (+ sv-80 1)) ) - (set! (-> this on-screen) (< (-> arg1 origin y) (-> s0-1 w))) - (seek! (-> this current-index) (-> this target-index) (* (/ 300.0 f22-1) (seconds-per-frame))) ) ) ) @@ -2012,7 +1812,6 @@ ) (defmethod draw-option ((this menu-language-game-option) (arg0 progress) (arg1 font-context) (arg2 int) (arg3 symbol)) - (local-vars (sv-16 string) (sv-32 string)) (let ((f30-0 (fmax 0.0 (* 2.0 (- 0.5 (-> arg0 menu-transition)))))) (set-scale! arg1 0.65) (adjust-font-origin-y arg0 arg1 (-> this offset-y)) @@ -2040,14 +1839,7 @@ ) (draw-highlight-bar arg0 arg1 (the int (-> arg1 origin y)) 42 f30-0) (let ((s2-1 print-game-text)) - (let ((s1-1 format) - (s0-1 (clear *temp-string*)) - ) - (set! sv-16 "~S") - (let ((a2-4 (lookup-text! *common-text* (-> this name) #f))) - (s1-1 s0-1 sv-16 a2-4) - ) - ) + (format (clear *temp-string*) "~S" (lookup-text! *common-text* (-> this name) #f)) (s2-1 *temp-string* arg1 #f 44 (bucket-id hud-draw-hud-alpha)) ) (+! (-> arg1 origin y) 24.0) @@ -2091,14 +1883,7 @@ ) (set-scale! arg1 0.65) (let ((s2-4 print-game-text)) - (let ((s1-2 format) - (s0-2 (clear *temp-string*)) - ) - (set! sv-32 "~S") - (let ((a2-14 (lookup-text! *common-text* (-> this name) #f))) - (s1-2 s0-2 sv-32 a2-14) - ) - ) + (format (clear *temp-string*) "~S" (lookup-text! *common-text* (-> this name) #f)) (s2-4 *temp-string* arg1 #f 44 (bucket-id hud-draw-hud-alpha)) ) (set-scale! arg1 0.5) @@ -2130,7 +1915,6 @@ ;; ERROR: Stack slot load at 48 mismatch: defined as size 4, got size 16 ;; ERROR: Stack slot load at 48 mismatch: defined as size 4, got size 16 (defmethod draw-option ((this menu-center-screen-graphic-option) (arg0 progress) (arg1 font-context) (arg2 int) (arg3 symbol)) - (local-vars (sv-16 float) (sv-32 font-context) (sv-48 float)) (let ((f30-0 (fmax 0.0 (* 2.0 (- 0.5 (-> arg0 menu-transition))))) (s4-0 (get-scissor-stack-top arg0)) ) @@ -2145,63 +1929,63 @@ ) (adjust-font-origin-y arg0 arg1 0.45) (set! (-> arg1 origin x) (+ 30.0 (-> s4-0 x))) - (let* ((s3-1 arg0) - (s2-1 (method-of-object s3-1 progress-method-45)) - (s1-1 arg1) - (s0-0 (+ (- -60.0 (-> s4-0 x)) (-> s4-0 z))) - ) - (set! sv-16 (the-as float 16.0)) - (let* ((t0-1 (lookup-text! *common-text* (text-id progress-graphics-center-screen-dpad) #f)) - (t1-0 0.5) - (t2-0 0.95) - (t3-0 32) - (f0-7 (s2-1 s3-1 s1-1 s0-0 sv-16 t0-1 t1-0 t2-0 t3-0)) - (f1-6 (* 0.4 (-> arg1 max-x))) - (f2-4 (+ (-> s4-0 x) (* 0.5 (- (-> s4-0 z) (-> s4-0 x))))) - (f30-1 (+ f2-4 f1-6)) - (f28-0 (- f2-4 f1-6)) - (f26-0 (+ -8.0 (/ f0-7 2) (-> arg1 origin y))) + (let* ((f0-7 + (progress-method-45 + arg0 + arg1 + (+ (- -60.0 (-> s4-0 x)) (-> s4-0 z)) + (the-as float 16.0) + (lookup-text! *common-text* (text-id progress-graphics-center-screen-dpad) #f) + 0.5 + 0.95 + 32 + ) ) - (let ((f1-10 (+ -15.0 (-> arg1 origin y))) - (f24-0 (+ 3.0 f0-7 (-> arg1 origin y))) - ) - (let ((v1-17 arg1)) - (set! (-> v1-17 origin x) (-> s4-0 x)) - (set! (-> v1-17 origin y) f1-10) + (f1-6 (* 0.4 (-> arg1 max-x))) + (f2-4 (+ (-> s4-0 x) (* 0.5 (- (-> s4-0 z) (-> s4-0 x))))) + (f30-1 (+ f2-4 f1-6)) + (f28-0 (- f2-4 f1-6)) + (f26-0 (+ -8.0 (/ f0-7 2) (-> arg1 origin y))) + ) + (let ((f1-10 (+ -15.0 (-> arg1 origin y))) + (f24-0 (+ 3.0 f0-7 (-> arg1 origin y))) ) - (let ((v1-18 arg1)) - (set! (-> v1-18 width) (- (-> s4-0 z) (-> s4-0 x))) + (let ((v1-17 arg1)) + (set! (-> v1-17 origin x) (-> s4-0 x)) + (set! (-> v1-17 origin y) f1-10) + ) + (let ((v1-18 arg1)) + (set! (-> v1-18 width) (- (-> s4-0 z) (-> s4-0 x))) + ) + (let ((s3-2 print-game-text)) + (format (clear *temp-string*) "~33L~C" 160) + (s3-2 *temp-string* arg1 #f 44 (bucket-id hud-draw-hud-alpha)) + ) + (set! (-> arg1 origin y) f24-0) + ) + (let ((s3-3 print-game-text)) + (format (clear *temp-string*) "~33L~C" 162) + (s3-3 *temp-string* arg1 #f 44 (bucket-id hud-draw-hud-alpha)) + ) + (let ((a0-13 arg1)) + (set! (-> a0-13 flags) (font-flags kerning right large)) + ) + (let ((v1-20 arg1) + (f0-12 f26-0) ) - (let ((s3-2 print-game-text)) - (format (clear *temp-string*) "~33L~C" 160) - (s3-2 *temp-string* arg1 #f 44 (bucket-id hud-draw-hud-alpha)) - ) - (set! (-> arg1 origin y) f24-0) - ) - (let ((s3-3 print-game-text)) - (format (clear *temp-string*) "~33L~C" 162) - (s3-3 *temp-string* arg1 #f 44 (bucket-id hud-draw-hud-alpha)) - ) - (let ((a0-13 arg1)) - (set! (-> a0-13 flags) (font-flags kerning right large)) - ) - (let ((v1-20 arg1) - (f0-12 f26-0) - ) - (set! (-> v1-20 origin x) f28-0) - (set! (-> v1-20 origin y) f0-12) - ) - (let ((s3-4 print-game-text)) - (format (clear *temp-string*) "~33L~C" 163) - (s3-4 *temp-string* arg1 #f 44 (bucket-id hud-draw-hud-alpha)) - ) - (let ((a0-17 arg1)) - (set! (-> a0-17 flags) (font-flags kerning large)) - ) - (let ((v1-22 arg1)) - (set! (-> v1-22 origin x) f30-1) - (set! (-> v1-22 origin y) f26-0) - ) + (set! (-> v1-20 origin x) f28-0) + (set! (-> v1-20 origin y) f0-12) + ) + (let ((s3-4 print-game-text)) + (format (clear *temp-string*) "~33L~C" 163) + (s3-4 *temp-string* arg1 #f 44 (bucket-id hud-draw-hud-alpha)) + ) + (let ((a0-17 arg1)) + (set! (-> a0-17 flags) (font-flags kerning large)) + ) + (let ((v1-22 arg1)) + (set! (-> v1-22 origin x) f30-1) + (set! (-> v1-22 origin y) f26-0) ) ) (let ((s3-5 print-game-text)) @@ -2241,23 +2025,21 @@ ) ) (set! (-> arg1 origin x) (+ 10.0 (-> s4-0 x))) - (let* ((s1-2 arg0) - (s0-1 (method-of-object s1-2 progress-method-45)) - ) - (set! sv-32 arg1) - (let ((s4-1 (+ (- -20.0 (-> s4-0 x)) (-> s4-0 z)))) - (set! sv-48 (* 32.0 f28-1)) - (let* ((t0-7 (lookup-text! *common-text* (-> this name) #f)) - (t1-1 f28-1) - (t2-1 0.75) - (t3-1 32) - (f0-26 (s0-1 s1-2 sv-32 s4-1 sv-48 t0-7 t1-1 t2-1 t3-1)) - ) - (if (= (-> arg0 option-index) arg2) - (draw-highlight-bar arg0 arg1 (the int (+ -1.0 (-> arg1 origin y))) (the int (+ 4.0 f0-26)) f30-0) - ) + (let ((f0-26 (progress-method-45 + arg0 + arg1 + (+ (- -20.0 (-> s4-0 x)) (-> s4-0 z)) + (* 32.0 f28-1) + (lookup-text! *common-text* (-> this name) #f) + f28-1 + 0.75 + 32 + ) + ) + ) + (if (= (-> arg0 option-index) arg2) + (draw-highlight-bar arg0 arg1 (the int (+ -1.0 (-> arg1 origin y))) (the int (+ 4.0 f0-26)) f30-0) ) - ) ) ) ) @@ -2636,18 +2418,6 @@ ) (defmethod draw-option ((this menu-memcard-slot-option) (arg0 progress) (arg1 font-context) (arg2 int) (arg3 symbol)) - (local-vars - (sv-48 (function string font-context symbol int bucket-id float)) - (sv-64 (function _varargs_ object)) - (sv-80 string) - (sv-96 string) - (sv-112 (function string font-context symbol int bucket-id float)) - (sv-128 dma-buffer) - (sv-144 pointer) - (sv-160 int) - (sv-176 (function string font-context symbol int bucket-id float)) - (sv-192 (function _varargs_ object)) - ) (let ((f30-0 (fmax 0.0 (* 2.0 (- 0.5 (-> arg0 menu-transition))))) (f28-0 (if (= (-> arg0 current) 'select-save-title) 0.2 @@ -2671,57 +2441,43 @@ (f26-0 (+ (-> s3-1 y) (* f0-4 (the float arg2)))) (f28-1 (+ f26-0 f0-4)) (s1-0 (the int (+ (-> s3-1 x) (* 0.7 (- (-> s3-1 z) (-> s3-1 x))) (* -48.0 f24-0)))) + (sv-160 (the int (+ 32.0 (-> s3-1 y)))) + (s2-0 *progress-save-info*) ) - (set! sv-160 (the int (+ 32.0 (-> s3-1 y)))) - (let ((s2-0 *progress-save-info*)) - (let ((v1-16 arg1) - (f1-12 (+ 10.0 (-> s3-1 x))) - (f2-13 (+ f26-0 (* 0.5 (- f0-4 (* 32.0 (-> arg1 scale)))))) - ) - (set! (-> v1-16 origin x) f1-12) - (set! (-> v1-16 origin y) f2-13) - ) - (set! (-> arg1 height) f0-4) - (let ((a0-11 arg1)) - (set! (-> a0-11 flags) (font-flags kerning large)) - ) - (when (and s2-0 (= (-> s2-0 formatted) 1) (= (-> s2-0 inited) 1)) - (cond - ((= (-> s2-0 file arg2 present) 1) - (set! sv-48 print-game-text) - (set! sv-64 format) - (set! sv-80 (clear *temp-string*)) - (set! sv-96 "~S ~D") - (let ((a2-2 (lookup-text! *common-text* (text-id text-0073) #f)) - (a3-1 (+ arg2 1)) - ) - (sv-64 sv-80 sv-96 a2-2 a3-1) - ) - (let ((a0-21 *temp-string*) - (a1-6 arg1) - (a2-3 #f) - (a3-2 44) - (t0-1 579) - ) - (sv-48 a0-21 a1-6 a2-3 a3-2 (the-as bucket-id t0-1)) - ) - ) - ((zero? (-> s2-0 file arg2 present)) - (set! sv-112 print-game-text) - (let ((a0-23 (lookup-text! *common-text* (text-id progress-empty) #f)) - (a1-8 arg1) - (a2-5 #f) - (a3-3 44) - (t0-2 579) - ) - (sv-112 a0-23 a1-8 a2-5 a3-3 (the-as bucket-id t0-2)) - ) - ) + (let ((v1-16 arg1) + (f1-12 (+ 10.0 (-> s3-1 x))) + (f2-13 (+ f26-0 (* 0.5 (- f0-4 (* 32.0 (-> arg1 scale)))))) ) - (when (= arg2 (-> arg0 option-index)) - (set-scale! arg1 0.8) - (set! sv-128 (-> *display* frames (-> *display* on-screen) global-buf)) - (set! sv-144 (-> sv-128 base)) + (set! (-> v1-16 origin x) f1-12) + (set! (-> v1-16 origin y) f2-13) + ) + (set! (-> arg1 height) f0-4) + (let ((a0-11 arg1)) + (set! (-> a0-11 flags) (font-flags kerning large)) + ) + (when (and s2-0 (= (-> s2-0 formatted) 1) (= (-> s2-0 inited) 1)) + (cond + ((= (-> s2-0 file arg2 present) 1) + (let ((sv-48 print-game-text)) + (format (clear *temp-string*) "~S ~D" (lookup-text! *common-text* (text-id text-0073) #f) (+ arg2 1)) + (sv-48 *temp-string* arg1 #f 44 (bucket-id hud-draw-hud-alpha)) + ) + ) + ((zero? (-> s2-0 file arg2 present)) + (print-game-text + (lookup-text! *common-text* (text-id progress-empty) #f) + arg1 + #f + 44 + (bucket-id hud-draw-hud-alpha) + ) + ) + ) + (when (= arg2 (-> arg0 option-index)) + (set-scale! arg1 0.8) + (let* ((sv-128 (-> *display* frames (-> *display* on-screen) global-buf)) + (sv-144 (-> sv-128 base)) + ) (let ((f24-1 (+ (-> s3-1 x) (* 0.4 (- (-> s3-1 z) (-> s3-1 x)))))) (set-vector! (-> s0-0 color) 128 128 128 (the int (* 16.0 f30-0))) (set! (-> (the-as vector (-> s0-0 box)) quad) (-> s3-1 quad)) @@ -2761,112 +2517,101 @@ ) ) ) - (when (= (-> s2-0 file arg2 present) 1) - (when (= arg2 (-> arg0 option-index)) - (let* ((a0-49 (-> *progress-icon-arrays* (-> s2-0 file arg2 level-index))) - (t9-16 (method-of-object a0-49 draw-icon-array!)) - (a3-5 1.0) - (t0-3 1.0) - (t1-0 (the-as uint #x80808080)) - (t2-0 f30-0) - ) - (t9-16 a0-49 s1-0 sv-160 a3-5 t0-3 (the-as rgba t1-0) t2-0) - ) - (set-scale! arg1 0.6) - (let ((a0-51 arg1)) - (set! (-> a0-51 color) (font-color font-color-32)) - ) - (adjust-font-origin-y arg0 arg1 0.675) - (let ((a0-53 arg1)) - (set! (-> a0-53 flags) (font-flags kerning right large)) - ) - (let* ((v1-91 (-> s2-0 file arg2 game-time0)) - (v1-92 (logior (shl (-> s2-0 file arg2 game-time1) 32) v1-91)) - (s1-1 (/ (the-as int v1-92) #x107ac0)) - (s0-1 (/ (mod (the-as int v1-92) #x107ac0) #x4650)) - ) - (set! (-> arg1 origin x) (+ (-> s3-1 x) (* 0.675 (- (-> s3-1 z) (-> s3-1 x))))) - (set! sv-176 print-game-text) - (set! sv-192 format) - (let ((a0-63 (clear *temp-string*)) - (a1-16 "~2,'0D:~2,'0D") - ) - (sv-192 a0-63 a1-16 s1-1 s0-1) - ) - ) - (let ((a0-64 *temp-string*) - (a1-17 arg1) - (a2-10 #f) - (a3-7 44) - (t0-4 579) - ) - (sv-176 a0-64 a1-17 a2-10 a3-7 (the-as bucket-id t0-4)) - ) - (draw-icon-array! - (-> *progress-icon-arrays* 66) - (the int (+ 10.0 (* 0.4 (- (-> s3-1 z) (-> s3-1 x))) (-> s3-1 x))) - (the int (-> arg1 origin y)) - 0.65 - 0.65 - (new 'static 'rgba :r #x80 :g #x80 :b #x80 :a #x80) - f30-0 - ) - (set! (-> arg1 origin x) (+ (- (+ -10.0 (-> s3-1 z)) (-> s3-1 x)) (-> s3-1 x))) - (let ((s1-2 print-game-text)) - (format (clear *temp-string*) "~D%" (the int (-> s2-0 file arg2 completion-percentage))) - (s1-2 *temp-string* arg1 #f 44 (bucket-id hud-draw-hud-alpha)) - ) - (draw-icon-array! - (-> *progress-icon-arrays* 67) - (the int (+ -8.0 (* 0.75 (- (-> s3-1 z) (-> s3-1 x))) (-> s3-1 x))) - (the int (-> arg1 origin y)) - 0.7 - 0.7 - (new 'static 'rgba :r #x80 :g #x80 :b #x80 :a #x80) - f30-0 - ) - (adjust-font-origin-y arg0 arg1 0.83) + ) + (when (= (-> s2-0 file arg2 present) 1) + (when (= arg2 (-> arg0 option-index)) + (draw-icon-array! + (-> *progress-icon-arrays* (-> s2-0 file arg2 level-index)) + s1-0 + sv-160 + 1.0 + 1.0 + (new 'static 'rgba :r #x80 :g #x80 :b #x80 :a #x80) + f30-0 + ) + (set-scale! arg1 0.6) + (let ((a0-51 arg1)) + (set! (-> a0-51 color) (font-color font-color-32)) + ) + (adjust-font-origin-y arg0 arg1 0.675) + (let ((a0-53 arg1)) + (set! (-> a0-53 flags) (font-flags kerning right large)) + ) + (let* ((v1-91 (-> s2-0 file arg2 game-time0)) + (v1-92 (logior (shl (-> s2-0 file arg2 game-time1) 32) v1-91)) + (s1-1 (/ (the-as int v1-92) #x107ac0)) + (s0-1 (/ (mod (the-as int v1-92) #x107ac0) #x4650)) + ) (set! (-> arg1 origin x) (+ (-> s3-1 x) (* 0.675 (- (-> s3-1 z) (-> s3-1 x))))) - (let ((s1-3 print-game-text)) - (format (clear *temp-string*) "~D" (the int (-> s2-0 file arg2 skill-count))) - (s1-3 *temp-string* arg1 #f 44 (bucket-id hud-draw-hud-alpha)) + (let ((sv-176 print-game-text)) + (format (clear *temp-string*) "~2,'0D:~2,'0D" s1-1 s0-1) + (sv-176 *temp-string* arg1 #f 44 (bucket-id hud-draw-hud-alpha)) ) - (draw-icon-array! - (-> *progress-icon-arrays* 68) - (the int (+ 10.0 (* 0.4 (- (-> s3-1 z) (-> s3-1 x))) (-> s3-1 x))) - (the int (+ -2.0 (-> arg1 origin y))) - 0.7 - 0.7 - (new 'static 'rgba :r #x80 :g #x80 :b #x80 :a #x80) - f30-0 + ) + (draw-icon-array! + (-> *progress-icon-arrays* 66) + (the int (+ 10.0 (* 0.4 (- (-> s3-1 z) (-> s3-1 x))) (-> s3-1 x))) + (the int (-> arg1 origin y)) + 0.65 + 0.65 + (new 'static 'rgba :r #x80 :g #x80 :b #x80 :a #x80) + f30-0 + ) + (set! (-> arg1 origin x) (+ (- (+ -10.0 (-> s3-1 z)) (-> s3-1 x)) (-> s3-1 x))) + (let ((s1-2 print-game-text)) + (format (clear *temp-string*) "~D%" (the int (-> s2-0 file arg2 completion-percentage))) + (s1-2 *temp-string* arg1 #f 44 (bucket-id hud-draw-hud-alpha)) + ) + (draw-icon-array! + (-> *progress-icon-arrays* 67) + (the int (+ -8.0 (* 0.75 (- (-> s3-1 z) (-> s3-1 x))) (-> s3-1 x))) + (the int (-> arg1 origin y)) + 0.7 + 0.7 + (new 'static 'rgba :r #x80 :g #x80 :b #x80 :a #x80) + f30-0 + ) + (adjust-font-origin-y arg0 arg1 0.83) + (set! (-> arg1 origin x) (+ (-> s3-1 x) (* 0.675 (- (-> s3-1 z) (-> s3-1 x))))) + (let ((s1-3 print-game-text)) + (format (clear *temp-string*) "~D" (the int (-> s2-0 file arg2 skill-count))) + (s1-3 *temp-string* arg1 #f 44 (bucket-id hud-draw-hud-alpha)) + ) + (draw-icon-array! + (-> *progress-icon-arrays* 68) + (the int (+ 10.0 (* 0.4 (- (-> s3-1 z) (-> s3-1 x))) (-> s3-1 x))) + (the int (+ -2.0 (-> arg1 origin y))) + 0.7 + 0.7 + (new 'static 'rgba :r #x80 :g #x80 :b #x80 :a #x80) + f30-0 + ) + (set! (-> arg1 origin x) (+ (- (+ -10.0 (-> s3-1 z)) (-> s3-1 x)) (-> s3-1 x))) + (let ((s1-4 print-game-text)) + (format (clear *temp-string*) "~D" (the int (-> s2-0 file arg2 gem-count))) + (s1-4 *temp-string* arg1 #f 44 (bucket-id hud-draw-hud-alpha)) + ) + (draw-icon-array! + (-> *progress-icon-arrays* 69) + (the int (+ -14.0 (* 0.75 (- (-> s3-1 z) (-> s3-1 x))) (-> s3-1 x))) + (the int (-> arg1 origin y)) + 0.5 + 0.5 + (new 'static 'rgba :r #x80 :g #x80 :b #x80 :a #x80) + f30-0 + ) + (when (logtest? (-> s2-0 file arg2 secrets) 1) + (let ((a0-79 arg1)) + (set! (-> a0-79 flags) (font-flags kerning middle large)) ) - (set! (-> arg1 origin x) (+ (- (+ -10.0 (-> s3-1 z)) (-> s3-1 x)) (-> s3-1 x))) - (let ((s1-4 print-game-text)) - (format (clear *temp-string*) "~D" (the int (-> s2-0 file arg2 gem-count))) - (s1-4 *temp-string* arg1 #f 44 (bucket-id hud-draw-hud-alpha)) + (set! (-> arg1 origin x) (+ (-> s3-1 x) (* 0.4 (- (-> s3-1 z) (-> s3-1 x))))) + (set! (-> arg1 origin y) (+ 8.0 (-> s3-1 y))) + (let ((v1-140 arg1)) + (set! (-> v1-140 width) (* 0.6 (- (-> s3-1 z) (-> s3-1 x)))) ) - (draw-icon-array! - (-> *progress-icon-arrays* 69) - (the int (+ -14.0 (* 0.75 (- (-> s3-1 z) (-> s3-1 x))) (-> s3-1 x))) - (the int (-> arg1 origin y)) - 0.5 - 0.5 - (new 'static 'rgba :r #x80 :g #x80 :b #x80 :a #x80) - f30-0 - ) - (when (logtest? (-> s2-0 file arg2 secrets) 1) - (let ((a0-79 arg1)) - (set! (-> a0-79 flags) (font-flags kerning middle large)) - ) - (set! (-> arg1 origin x) (+ (-> s3-1 x) (* 0.4 (- (-> s3-1 z) (-> s3-1 x))))) - (set! (-> arg1 origin y) (+ 8.0 (-> s3-1 y))) - (let ((v1-140 arg1)) - (set! (-> v1-140 width) (* 0.6 (- (-> s3-1 z) (-> s3-1 x)))) - ) - (let ((s3-2 print-game-text)) - (format (clear *temp-string*) "~S" (lookup-text! *common-text* (text-id progress-secrets-hero-mode) #f)) - (s3-2 *temp-string* arg1 #f 44 (bucket-id hud-draw-hud-alpha)) - ) + (let ((s3-2 print-game-text)) + (format (clear *temp-string*) "~S" (lookup-text! *common-text* (text-id progress-secrets-hero-mode) #f)) + (s3-2 *temp-string* arg1 #f 44 (bucket-id hud-draw-hud-alpha)) ) ) ) @@ -3828,17 +3573,6 @@ ) (defmethod draw-option ((this menu-select-start-option) (arg0 progress) (arg1 font-context) (arg2 int) (arg3 symbol)) - (local-vars - (sv-16 string) - (sv-32 string) - (sv-48 (function game-text-info text-id symbol string)) - (sv-64 game-text-info) - (sv-80 (function _varargs_ object)) - (sv-96 string) - (sv-112 string) - (sv-128 (function game-text-info text-id symbol string)) - (sv-144 game-text-info) - ) (set! (-> *progress-list-level* mode) (-> arg0 current)) (set! (-> *progress-list-level* act) (-> *progress-work* selected-num)) (let ((f30-0 (fmax 0.0 (* 2.0 (- 0.5 (-> arg0 menu-transition)))))) @@ -3852,17 +3586,10 @@ (let ((s2-1 (max 0 (the int (-> this current-index)))) (s1-0 print-game-text) ) - (let ((s0-0 format)) - (set! sv-16 (clear *temp-string*)) - (set! sv-32 "~S") - (set! sv-64 *common-text*) - (set! sv-48 (method-of-object sv-64 lookup-text!)) - (let* ((a1-3 (-> (progress-list-method-9 *progress-list-level* s2-1) text-name)) - (a2-1 #f) - (a2-2 (sv-48 sv-64 a1-3 a2-1)) - ) - (s0-0 sv-16 sv-32 a2-2) - ) + (format + (clear *temp-string*) + "~S" + (lookup-text! *common-text* (-> (progress-list-method-9 *progress-list-level* s2-1) text-name) #f) ) (let ((f28-0 (s1-0 *temp-string* arg1 #t 44 (bucket-id hud-draw-hud-alpha)))) (let ((s1-1 (get-scissor-stack-top arg0))) @@ -3895,16 +3622,10 @@ ) ) (let ((s0-1 print-game-text)) - (set! sv-80 format) - (set! sv-96 (clear *temp-string*)) - (set! sv-112 "~S") - (set! sv-144 *common-text*) - (set! sv-128 (method-of-object sv-144 lookup-text!)) - (let* ((a1-7 (-> (progress-list-method-9 *progress-list-level* s2-1) text-name)) - (a2-4 #f) - (a2-5 (sv-128 sv-144 a1-7 a2-4)) - ) - (sv-80 sv-96 sv-112 a2-5) + (format + (clear *temp-string*) + "~S" + (lookup-text! *common-text* (-> (progress-list-method-9 *progress-list-level* s2-1) text-name) #f) ) (let ((f26-0 (s0-1 *temp-string* arg1 #f 40 (bucket-id hud-draw-hud-alpha)))) (if (= s2-1 (-> this selected-index)) @@ -3963,15 +3684,6 @@ ) (defmethod draw-option ((this menu-select-scene-option) (arg0 progress) (arg1 font-context) (arg2 int) (arg3 symbol)) - (local-vars - (sv-16 (function _varargs_ object)) - (sv-32 string) - (sv-48 string) - (sv-64 (function string font-context symbol int bucket-id float)) - (sv-80 (function _varargs_ object)) - (sv-96 string) - (sv-112 string) - ) (let ((f30-0 (fmax 0.0 (* 2.0 (- 0.5 (-> arg0 menu-transition)))))) (let* ((v1-3 (-> *progress-work* selected-num)) (s3-0 (cond @@ -4000,12 +3712,7 @@ (let ((s1-1 (max 0 (the int (-> this current-index)))) (s0-0 print-game-text) ) - (set! sv-16 format) - (set! sv-32 (clear *temp-string*)) - (set! sv-48 "~S") - (let ((a2-2 (lookup-text! *common-text* (-> s3-0 s1-1 text) #f))) - (sv-16 sv-32 sv-48 a2-2) - ) + (format (clear *temp-string*) "~S" (lookup-text! *common-text* (-> s3-0 s1-1 text) #f)) (let ((f28-0 (s0-0 *temp-string* arg1 #t 44 (bucket-id hud-draw-hud-alpha)))) (let ((s0-1 (get-scissor-stack-top arg0))) (let ((f0-5 (- (-> s0-1 w) (-> s0-1 y)))) @@ -4036,24 +3743,14 @@ ) ) ) - (set! sv-64 print-game-text) - (set! sv-80 format) - (set! sv-96 (clear *temp-string*)) - (set! sv-112 "~S") - (let ((a2-5 (lookup-text! *common-text* (-> s3-0 s1-1 text) #f))) - (sv-80 sv-96 sv-112 a2-5) - ) - (let* ((a0-21 *temp-string*) - (a1-7 arg1) - (a2-6 #f) - (a3-2 40) - (t0-2 579) - (f26-0 (sv-64 a0-21 a1-7 a2-6 a3-2 (the-as bucket-id t0-2))) - ) - (if (= s1-1 (-> this selected-index)) - (draw-highlight-bar arg0 arg1 (the int (+ -2.0 (-> arg1 origin y))) (the int (+ 2.0 f26-0)) f30-0) - ) - (+! (-> arg1 origin y) f26-0) + (let ((sv-64 print-game-text)) + (format (clear *temp-string*) "~S" (lookup-text! *common-text* (-> s3-0 s1-1 text) #f)) + (let ((f26-0 (sv-64 *temp-string* arg1 #f 40 (bucket-id hud-draw-hud-alpha)))) + (if (= s1-1 (-> this selected-index)) + (draw-highlight-bar arg0 arg1 (the int (+ -2.0 (-> arg1 origin y))) (the int (+ 2.0 f26-0)) f30-0) + ) + (+! (-> arg1 origin y) f26-0) + ) ) (+! s1-1 1) ) @@ -4319,452 +4016,365 @@ ) (defmethod draw-option ((this menu-secret-option) (arg0 progress) (arg1 font-context) (arg2 int) (arg3 symbol)) - (local-vars - (a0-19 string) - (sv-16 float) - (sv-24 int) - (sv-96 int) - (sv-112 int) - (sv-128 int) - (sv-144 string) - (sv-160 string) - (sv-176 (function _varargs_ object)) - (sv-192 string) - (sv-208 text-id) - (sv-224 (function _varargs_ object)) - (sv-240 string) - (sv-256 (function string font-context symbol int bucket-id float)) - (sv-272 (function _varargs_ object)) - (sv-288 int) - (sv-304 (function string font-context symbol int bucket-id float)) - (sv-320 (function _varargs_ object)) - (sv-336 (function _varargs_ object)) - (sv-352 string) - (sv-368 string) - (sv-384 (function _varargs_ object)) - (sv-400 (function _varargs_ object)) - (sv-416 (function _varargs_ object)) - ) - (set! sv-16 (fmax 0.0 (* 2.0 (- 0.5 (-> arg0 menu-transition))))) - (set! sv-24 (the int (-> *game-info* skill))) - (set! (-> arg1 alpha) sv-16) - (cond - ((not (loaded? *bigmap*)) - (progress-method-51 arg0 arg1) - ) - (else - (new 'stack 'hud-sprite) - (let ((s2-0 (get-texture hud-orb progress-minimap))) - (when (and s2-0 (not (-> this available-title))) - (progress-method-33 arg0 (-> *progress-work* sub-header)) - (let ((s3-0 (get-scissor-stack-top arg0))) - (let* ((f0-5 0.64) - (f30-0 (+ 10.0 (* (the float (-> s2-0 w)) f0-5 (-> *video-params* relative-x-scale)))) - ) - (let ((f1-5 (* (the float (-> s2-0 h)) f0-5))) - (+ (- (- -20.0 f30-0) (-> s3-0 x)) (-> s3-0 z)) - (let ((t1-0 (logior #x808080 (shr (shl (the int (* 128.0 sv-16)) 56) 32)))) - (draw-icon-array! - (-> *progress-icon-arrays* 68) - (the int (+ 10.0 (-> s3-0 x))) - (the int (+ (-> s3-0 y) (* 0.5 (- 28.0 f1-5)))) - f0-5 - f0-5 - (the-as rgba t1-0) - sv-16 - ) - ) - ) - (let ((v1-26 arg1)) - (set! (-> v1-26 height) 28.0) - ) - (let ((a0-13 arg1)) - (set! (-> a0-13 flags) (font-flags kerning large)) - ) - (let ((f28-0 0.45)) - (let ((a0-14 arg1)) - (set! (-> a0-14 color) (font-color font-color-34)) - ) - (cond - ((-> this buy-menu) - (let ((s2-1 format) - (s1-0 (clear *temp-string*)) - (s0-0 "x~D ~S") - ) - (set! sv-96 (-> *menu-secrets-array* (-> this selected-index) cost)) - (let ((a3-2 (lookup-text! *common-text* (text-id progress-secrets-price) #f))) - (s2-1 s1-0 s0-0 sv-96 a3-2) - ) - ) - (set! a0-19 *temp-string*) - ) - (else - (let ((s2-2 format) - (s1-1 (clear *temp-string*)) - (s0-1 "x~D ~S") - ) - (set! sv-112 sv-24) - (let ((a3-3 (lookup-text! *common-text* (text-id progress-secrets-orbs-available) #f))) - (s2-2 s1-1 s0-1 sv-112 a3-3) - ) - ) - (set! a0-19 *temp-string*) - ) - ) - (set-scale! arg1 f28-0) - (let ((v1-43 arg1) - (f0-10 (+ (-> s3-0 x) f30-0)) - (f1-11 (+ (-> s3-0 y) (* 0.5 (- 28.0 (* 32.0 f28-0))))) - ) - (set! (-> v1-43 origin x) f0-10) - (set! (-> v1-43 origin y) f1-11) - ) - ) - ) - (print-game-text a0-19 arg1 #f 44 (bucket-id hud-draw-hud-alpha)) - (let ((a0-23 arg1)) - (set! (-> a0-23 flags) (font-flags kerning right large)) - ) - (set! (-> arg1 origin x) (+ -10.0 (-> s3-0 z))) - ) - (let ((s3-1 print-game-text)) - (let ((s2-3 format) - (s1-2 (clear *temp-string*)) - (s0-2 "~D/600 ~S") - ) - (set! sv-128 (the int (-> *game-info* skill-total))) - (let ((a3-5 (lookup-text! *common-text* (text-id progress-secrets-orbs-collected) #f))) - (s2-3 s1-2 s0-2 sv-128 a3-5) - ) - ) - (s3-1 *temp-string* arg1 #f 44 (bucket-id hud-draw-hud-alpha)) - ) - (progress-method-34 arg0) - ) + (local-vars (a0-19 string) (sv-192 string) (sv-240 string)) + (let ((sv-16 (fmax 0.0 (* 2.0 (- 0.5 (-> arg0 menu-transition))))) + (sv-24 (the int (-> *game-info* skill))) ) - (set-scale! arg1 0.42) - (cond - ((-> this available-title) - (progress-method-33 arg0 (-> *progress-work* body-footer)) - (progress-method-53 arg0 arg1) - (let ((a0-32 arg1)) - (set! (-> a0-32 color) (font-color font-color-32)) - ) - (let ((a0-33 arg1)) - (set! (-> a0-33 flags) (font-flags kerning middle middle-vert large)) - ) - (let ((s4-1 print-game-text)) - (format (clear *temp-string*) (lookup-text! *common-text* (text-id text-0080) #f)) - (s4-1 *temp-string* arg1 #f 44 (bucket-id hud-draw-hud-alpha)) - ) - (progress-method-34 arg0) - (progress-method-33 arg0 (-> *progress-work* footer)) - (let ((a0-40 arg1)) - (set! (-> a0-40 flags) (font-flags kerning middle large)) - ) - (adjust-font-origin-y arg0 arg1 0.1) - (let ((a0-42 arg1)) - (set! (-> a0-42 color) (font-color font-color-33)) - ) - (let ((f0-16 (print-game-text - (lookup-text! *common-text* (text-id progress-continue) #f) - arg1 - #f - 32 - (bucket-id hud-draw-hud-alpha) - ) + (set! (-> arg1 alpha) sv-16) + (cond + ((not (loaded? *bigmap*)) + (progress-method-51 arg0 arg1) + ) + (else + (new 'stack 'hud-sprite) + (let ((s2-0 (get-texture hud-orb progress-minimap))) + (when (and s2-0 (not (-> this available-title))) + (progress-method-33 arg0 (-> *progress-work* sub-header)) + (let ((s3-0 (get-scissor-stack-top arg0))) + (let* ((f0-5 0.64) + (f30-0 (+ 10.0 (* (the float (-> s2-0 w)) f0-5 (-> *video-params* relative-x-scale)))) + ) + (let ((f1-5 (* (the float (-> s2-0 h)) f0-5))) + (+ (- (- -20.0 f30-0) (-> s3-0 x)) (-> s3-0 z)) + (let ((t1-0 (logior #x808080 (shr (shl (the int (* 128.0 sv-16)) 56) 32)))) + (draw-icon-array! + (-> *progress-icon-arrays* 68) + (the int (+ 10.0 (-> s3-0 x))) + (the int (+ (-> s3-0 y) (* 0.5 (- 28.0 f1-5)))) + f0-5 + f0-5 + (the-as rgba t1-0) + sv-16 ) - ) - (draw-highlight-bar arg0 arg1 (the int (+ -2.0 (-> arg1 origin y))) (the int (+ 4.0 f0-16)) (-> arg1 alpha)) - ) - (progress-method-34 arg0) - ) - ((-> this buy-menu) - (progress-method-33 arg0 (-> *progress-work* body)) - (adjust-font-origin-y arg0 arg1 0.45) - (progress-method-50 - arg0 - arg1 - (-> *menu-secrets-array* (-> this selected-index) name) - (text-id progress-secrets-buy) - (text-id progress-secrets-cancel) - #t - #t - 0.65 - ) - (let ((s4-3 *progress-work*)) - (draw-header arg0 arg1 sv-16 (text-id progress-secrets)) - (draw-bg-box-outline arg0 (-> s4-3 sub-header) (* 128.0 sv-16)) - ) - (progress-method-34 arg0) - ) - (else - (progress-method-33 arg0 (-> *progress-work* sub-body-footer)) - (let* ((s3-3 (get-scissor-stack-top arg0)) - (f22-0 (- (-> s3-3 w) (-> s3-3 y))) - (f30-1 (+ 10.0 (* 24.0 (-> *video-params* relative-x-scale) (-> arg1 scale)))) - (f28-1 (+ (- -10.0 (-> s3-3 x)) (-> s3-3 z))) - (s2-5 get-string-length) - ) - (let ((s1-3 format) - (s0-3 (clear *temp-string*)) - ) - (set! sv-144 "~32L~S~44L ~S") - (set! sv-160 (lookup-text! *common-text* (text-id progress-on) #f)) - (let ((a3-12 (lookup-text! *common-text* (text-id progress-off) #f))) - (s1-3 s0-3 sv-144 sv-160 a3-12) - ) - ) - (let* ((f0-27 (-> (s2-5 *temp-string* arg1) length)) - (f26-0 (- (- (- f28-1 f30-1) f0-27) f30-1)) - ) - (- f28-1 f26-0) - (let ((a0-60 arg1)) - (set! (-> a0-60 flags) (font-flags kerning large)) - ) - (let ((v1-100 arg1)) - (set! (-> v1-100 width) f26-0) - ) - (let ((s2-6 *menu-secrets-array*) - (s1-5 (max 0 (the int (-> this current-index)))) ) - (let* ((a0-61 (-> s2-6 s1-5)) - (s0-4 (-> a0-61 name)) + ) + (let ((v1-26 arg1)) + (set! (-> v1-26 height) 28.0) + ) + (let ((a0-13 arg1)) + (set! (-> a0-13 flags) (font-flags kerning large)) + ) + (let ((f28-0 0.45)) + (let ((a0-14 arg1)) + (set! (-> a0-14 color) (font-color font-color-34)) + ) + (cond + ((-> this buy-menu) + (format + (clear *temp-string*) + "x~D ~S" + (-> *menu-secrets-array* (-> this selected-index) cost) + (lookup-text! *common-text* (text-id progress-secrets-price) #f) ) - (case (secret-item-option-method-12 a0-61) - ((4) - (set! sv-192 "?????????") + (set! a0-19 *temp-string*) ) (else - (set! sv-192 (lookup-text! *common-text* s0-4 #f)) + (format + (clear *temp-string*) + "x~D ~S" + sv-24 + (lookup-text! *common-text* (text-id progress-secrets-orbs-available) #f) + ) + (set! a0-19 *temp-string*) ) ) + (set-scale! arg1 f28-0) + (let ((v1-43 arg1) + (f0-10 (+ (-> s3-0 x) f30-0)) + (f1-11 (+ (-> s3-0 y) (* 0.5 (- 28.0 (* 32.0 f28-0))))) + ) + (set! (-> v1-43 origin x) f0-10) + (set! (-> v1-43 origin y) f1-11) + ) ) - (let ((s0-5 print-game-text)) - (set! sv-176 format) - (let ((a0-65 (clear *temp-string*)) - (a1-37 "~S") + ) + (print-game-text a0-19 arg1 #f 44 (bucket-id hud-draw-hud-alpha)) + (let ((a0-23 arg1)) + (set! (-> a0-23 flags) (font-flags kerning right large)) + ) + (set! (-> arg1 origin x) (+ -10.0 (-> s3-0 z))) + ) + (let ((s3-1 print-game-text)) + (format + (clear *temp-string*) + "~D/600 ~S" + (the int (-> *game-info* skill-total)) + (lookup-text! *common-text* (text-id progress-secrets-orbs-collected) #f) + ) + (s3-1 *temp-string* arg1 #f 44 (bucket-id hud-draw-hud-alpha)) + ) + (progress-method-34 arg0) + ) + ) + (set-scale! arg1 0.42) + (cond + ((-> this available-title) + (progress-method-33 arg0 (-> *progress-work* body-footer)) + (progress-method-53 arg0 arg1) + (let ((a0-32 arg1)) + (set! (-> a0-32 color) (font-color font-color-32)) + ) + (let ((a0-33 arg1)) + (set! (-> a0-33 flags) (font-flags kerning middle middle-vert large)) + ) + (let ((s4-1 print-game-text)) + (format (clear *temp-string*) (lookup-text! *common-text* (text-id text-0080) #f)) + (s4-1 *temp-string* arg1 #f 44 (bucket-id hud-draw-hud-alpha)) + ) + (progress-method-34 arg0) + (progress-method-33 arg0 (-> *progress-work* footer)) + (let ((a0-40 arg1)) + (set! (-> a0-40 flags) (font-flags kerning middle large)) + ) + (adjust-font-origin-y arg0 arg1 0.1) + (let ((a0-42 arg1)) + (set! (-> a0-42 color) (font-color font-color-33)) + ) + (let ((f0-16 (print-game-text + (lookup-text! *common-text* (text-id progress-continue) #f) + arg1 + #f + 32 + (bucket-id hud-draw-hud-alpha) + ) ) - (sv-176 a0-65 a1-37 sv-192) - ) - (let ((f24-0 (s0-5 *temp-string* arg1 #t 40 (bucket-id hud-draw-hud-alpha)))) - (let ((f0-33 4.0) - (f1-25 (-> this current-index)) - ) - (set! (-> arg1 origin y) - (+ (- f0-33 (* f24-0 (- f1-25 (* (the float (the int (/ f1-25 1.0))) 1.0)))) (-> s3-3 y)) - ) + ) + (draw-highlight-bar arg0 arg1 (the int (+ -2.0 (-> arg1 origin y))) (the int (+ 4.0 f0-16)) (-> arg1 alpha)) + ) + (progress-method-34 arg0) + ) + ((-> this buy-menu) + (progress-method-33 arg0 (-> *progress-work* body)) + (adjust-font-origin-y arg0 arg1 0.45) + (progress-method-50 + arg0 + arg1 + (-> *menu-secrets-array* (-> this selected-index) name) + (text-id progress-secrets-buy) + (text-id progress-secrets-cancel) + #t + #t + 0.65 + ) + (let ((s4-3 *progress-work*)) + (draw-header arg0 arg1 sv-16 (text-id progress-secrets)) + (draw-bg-box-outline arg0 (-> s4-3 sub-header) (* 128.0 sv-16)) + ) + (progress-method-34 arg0) + ) + (else + (progress-method-33 arg0 (-> *progress-work* sub-body-footer)) + (let* ((s3-3 (get-scissor-stack-top arg0)) + (f22-0 (- (-> s3-3 w) (-> s3-3 y))) + (f30-1 (+ 10.0 (* 24.0 (-> *video-params* relative-x-scale) (-> arg1 scale)))) + (f28-1 (+ (- -10.0 (-> s3-3 x)) (-> s3-3 z))) + (s2-5 get-string-length) + ) + (format + (clear *temp-string*) + "~32L~S~44L ~S" + (lookup-text! *common-text* (text-id progress-on) #f) + (lookup-text! *common-text* (text-id progress-off) #f) + ) + (let* ((f0-27 (-> (s2-5 *temp-string* arg1) length)) + (f26-0 (- (- (- f28-1 f30-1) f0-27) f30-1)) + ) + (- f28-1 f26-0) + (let ((a0-60 arg1)) + (set! (-> a0-60 flags) (font-flags kerning large)) + ) + (let ((v1-100 arg1)) + (set! (-> v1-100 width) f26-0) + ) + (let ((s2-6 *menu-secrets-array*) + (s1-5 (max 0 (the int (-> this current-index)))) ) - (set! (-> arg1 height) f22-0) - (while (and (< (-> arg1 origin y) (-> s3-3 w)) (< s1-5 (-> *menu-secrets-array* length))) - (let ((s0-6 (-> s2-6 s1-5))) - (set! sv-208 (-> s2-6 s1-5 name)) - (set! sv-288 (secret-item-option-method-12 s0-6)) - (case sv-288 - ((4) - (set! sv-240 "?????????") - ) - (else - (let* ((a0-69 *common-text*) - (t9-51 (method-of-object a0-69 lookup-text!)) - (a2-27 #f) - ) - (set! sv-240 (t9-51 a0-69 sv-208 a2-27)) - ) - ) - ) - (cond - ((logtest? (-> s2-6 s1-5 flags) (secret-item-option-flags sf0)) - (set! (-> arg1 origin x) (+ 10.0 (-> s3-3 x))) - (let ((v1-130 arg1)) - (set! (-> v1-130 width) f28-1) - ) - (let ((a0-70 arg1)) - (set! (-> a0-70 color) (font-color font-color-34)) - ) - (let ((a0-71 arg1)) - (set! (-> a0-71 flags) (font-flags kerning large)) - ) - (let ((f22-1 (-> arg1 origin y)) - (s0-7 print-game-text) - ) - (set! sv-224 format) - (let ((a0-73 (clear *temp-string*)) - (a1-40 "~S") - ) - (sv-224 a0-73 a1-40 sv-240) - ) - (set! (-> arg1 origin y) (+ f22-1 (s0-7 *temp-string* arg1 #f 40 (bucket-id hud-draw-hud-alpha)))) - ) - ) - ((not (and (logtest? (-> s2-6 s1-5 flags) (secret-item-option-flags sf4)) - (or (nonzero? (-> *setting-control* user-current subtitle-language)) - (nonzero? (-> *setting-control* user-current language)) - (nonzero? (-> *setting-control* user-current audio-language)) - ) + (let* ((a0-61 (-> s2-6 s1-5)) + (s0-4 (-> a0-61 name)) + (v1-105 (secret-item-option-method-12 a0-61)) + ) + (set! sv-192 (cond + ((= v1-105 4) + (set! sv-192 "?????????") + sv-192 + ) + (else + (lookup-text! *common-text* s0-4 #f) ) - ) - (set! (-> arg1 origin x) (+ (-> s3-3 x) f30-1)) - (let ((v1-147 arg1)) - (set! (-> v1-147 width) f26-0) - ) - (let ((v1-148 sv-288)) - (cond - ((or (= v1-148 4) (= v1-148 3)) - (let ((a0-79 arg1)) - (set! (-> a0-79 flags) (font-flags kerning large ff7)) - ) - (let ((v1-150 arg1)) - (set! (-> v1-150 color) (font-color font-color-44)) - ) - ) - ((zero? v1-148) - (let ((a0-81 arg1)) - (set! (-> a0-81 flags) (font-flags kerning large)) - ) - (let ((v1-152 arg1)) - (set! (-> v1-152 color) (font-color font-color-34)) - ) - ) - (else - (let ((a0-83 arg1)) - (set! (-> a0-83 flags) (font-flags kerning large)) ) - (let ((v1-154 arg1)) - (set! (-> v1-154 color) (font-color font-color-32)) - ) - ) - ) - ) - (let ((f22-2 (-> arg1 origin y))) - (set! sv-256 print-game-text) - (set! sv-272 format) - (let ((a0-86 (clear *temp-string*)) - (a1-44 "~S") - (a2-30 sv-240) - ) - (sv-272 a0-86 a1-44 a2-30) - ) - (let* ((a0-87 *temp-string*) - (a1-45 arg1) - (a2-31 #f) - (a3-15 40) - (t0-10 579) - (f20-0 (sv-256 a0-87 a1-45 a2-31 a3-15 (the-as bucket-id t0-10))) - ) - (when (not (logtest? (-> s2-6 s1-5 flags) (secret-item-option-flags sf0))) - (set! (-> arg1 origin x) (+ (-> s3-3 x) f28-1)) - (let ((a0-88 arg1)) - (set! (-> a0-88 flags) (font-flags kerning right large)) - ) - (set! sv-352 (lookup-text! *common-text* (text-id progress-on) #f)) - (set! sv-368 (lookup-text! *common-text* (text-id progress-off) #f)) - (cond - ((or (zero? sv-288) (= sv-288 3)) - (set! sv-304 print-game-text) - (set! sv-320 format) - (let ((a0-93 (clear *temp-string*)) - (a1-48 "~d") - (a2-34 (-> s0-6 cost)) - ) - (sv-320 a0-93 a1-48 a2-34) - ) - (let ((a0-94 *temp-string*) - (a1-49 arg1) - (a2-35 #f) - (a3-16 40) - (t0-11 579) - ) - (sv-304 a0-94 a1-49 a2-35 a3-16 (the-as bucket-id t0-11)) - ) - ) - ((= sv-288 1) - (cond - ((logtest? (-> s2-6 s1-5 flags) (secret-item-option-flags sf1)) - (let ((s0-8 print-game-text)) - (set! sv-336 format) - (let ((a0-97 (clear *temp-string*)) - (a1-50 "~32L~S~44L ~S") - ) - (sv-336 a0-97 a1-50 sv-352 sv-368) - ) - (s0-8 *temp-string* arg1 #f 40 (bucket-id hud-draw-hud-alpha)) - ) - ) - (else - (let ((s0-9 print-game-text)) - (set! sv-384 format) - (let ((a0-100 (clear *temp-string*)) - (a1-52 "~S") - (a2-38 sv-352) - ) - (sv-384 a0-100 a1-52 a2-38) - ) - (s0-9 *temp-string* arg1 #f 40 (bucket-id hud-draw-hud-alpha)) - ) - ) - ) - ) - ((= sv-288 2) - (cond - ((logtest? (-> s2-6 s1-5 flags) (secret-item-option-flags sf1)) - (let ((s0-10 print-game-text)) - (set! sv-400 format) - (let ((a0-104 (clear *temp-string*)) - (a1-54 "~44L~S ~32L~S~1L") - (a2-40 sv-352) - (a3-20 sv-368) - ) - (sv-400 a0-104 a1-54 a2-40 a3-20) - ) - (s0-10 *temp-string* arg1 #f 40 (bucket-id hud-draw-hud-alpha)) - ) - ) - (else - (let ((s0-11 print-game-text)) - (set! sv-416 format) - (let ((a0-107 (clear *temp-string*)) - (a1-56 "~S") - (a2-42 sv-368) - ) - (sv-416 a0-107 a1-56 a2-42) - ) - (s0-11 *temp-string* arg1 #f 40 (bucket-id hud-draw-hud-alpha)) - ) - ) - ) - ) - ) - ) - (+! (-> arg1 origin y) f20-0) - (if (= s1-5 (-> this selected-index)) - (draw-highlight-bar arg0 arg1 (the int (+ -2.0 f22-2)) (the int (+ 3.0 f20-0)) sv-16) - ) - ) - ) - ) ) + ) + (let ((s0-5 print-game-text)) + (format (clear *temp-string*) "~S" sv-192) + (let ((f24-0 (s0-5 *temp-string* arg1 #t 40 (bucket-id hud-draw-hud-alpha)))) + (let ((f0-33 4.0) + (f1-25 (-> this current-index)) + ) + (set! (-> arg1 origin y) + (+ (- f0-33 (* f24-0 (- f1-25 (* (the float (the int (/ f1-25 1.0))) 1.0)))) (-> s3-3 y)) + ) ) - (+! s1-5 1) + (set! (-> arg1 height) f22-0) + (while (and (< (-> arg1 origin y) (-> s3-3 w)) (< s1-5 (-> *menu-secrets-array* length))) + (let* ((s0-6 (-> s2-6 s1-5)) + (sv-208 (-> s2-6 s1-5 name)) + (sv-288 (secret-item-option-method-12 s0-6)) + ) + (let ((v1-120 sv-288)) + (set! sv-240 (cond + ((= v1-120 4) + (set! sv-240 "?????????") + sv-240 + ) + (else + (lookup-text! *common-text* sv-208 #f) + ) + ) + ) + ) + (cond + ((logtest? (-> s2-6 s1-5 flags) (secret-item-option-flags sf0)) + (set! (-> arg1 origin x) (+ 10.0 (-> s3-3 x))) + (let ((v1-130 arg1)) + (set! (-> v1-130 width) f28-1) + ) + (let ((a0-70 arg1)) + (set! (-> a0-70 color) (font-color font-color-34)) + ) + (let ((a0-71 arg1)) + (set! (-> a0-71 flags) (font-flags kerning large)) + ) + (let ((f22-1 (-> arg1 origin y)) + (s0-7 print-game-text) + ) + (format (clear *temp-string*) "~S" sv-240) + (set! (-> arg1 origin y) (+ f22-1 (s0-7 *temp-string* arg1 #f 40 (bucket-id hud-draw-hud-alpha)))) + ) + ) + ((not (and (logtest? (-> s2-6 s1-5 flags) (secret-item-option-flags sf4)) + (or (nonzero? (-> *setting-control* user-current subtitle-language)) + (nonzero? (-> *setting-control* user-current language)) + (nonzero? (-> *setting-control* user-current audio-language)) + ) + ) + ) + (set! (-> arg1 origin x) (+ (-> s3-3 x) f30-1)) + (let ((v1-147 arg1)) + (set! (-> v1-147 width) f26-0) + ) + (let ((v1-148 sv-288)) + (cond + ((or (= v1-148 4) (= v1-148 3)) + (let ((a0-79 arg1)) + (set! (-> a0-79 flags) (font-flags kerning large ff7)) + ) + (let ((v1-150 arg1)) + (set! (-> v1-150 color) (font-color font-color-44)) + ) + ) + ((zero? v1-148) + (let ((a0-81 arg1)) + (set! (-> a0-81 flags) (font-flags kerning large)) + ) + (let ((v1-152 arg1)) + (set! (-> v1-152 color) (font-color font-color-34)) + ) + ) + (else + (let ((a0-83 arg1)) + (set! (-> a0-83 flags) (font-flags kerning large)) + ) + (let ((v1-154 arg1)) + (set! (-> v1-154 color) (font-color font-color-32)) + ) + ) + ) + ) + (let ((f22-2 (-> arg1 origin y)) + (sv-256 print-game-text) + ) + (format (clear *temp-string*) "~S" sv-240) + (let ((f20-0 (sv-256 *temp-string* arg1 #f 40 (bucket-id hud-draw-hud-alpha)))) + (when (not (logtest? (-> s2-6 s1-5 flags) (secret-item-option-flags sf0))) + (set! (-> arg1 origin x) (+ (-> s3-3 x) f28-1)) + (let ((a0-88 arg1)) + (set! (-> a0-88 flags) (font-flags kerning right large)) + ) + (let ((sv-352 (lookup-text! *common-text* (text-id progress-on) #f)) + (sv-368 (lookup-text! *common-text* (text-id progress-off) #f)) + ) + (cond + ((or (zero? sv-288) (= sv-288 3)) + (let ((sv-304 print-game-text)) + (format (clear *temp-string*) "~d" (-> s0-6 cost)) + (sv-304 *temp-string* arg1 #f 40 (bucket-id hud-draw-hud-alpha)) + ) + ) + ((= sv-288 1) + (cond + ((logtest? (-> s2-6 s1-5 flags) (secret-item-option-flags sf1)) + (let ((s0-8 print-game-text)) + (format (clear *temp-string*) "~32L~S~44L ~S" sv-352 sv-368) + (s0-8 *temp-string* arg1 #f 40 (bucket-id hud-draw-hud-alpha)) + ) + ) + (else + (let ((s0-9 print-game-text)) + (format (clear *temp-string*) "~S" sv-352) + (s0-9 *temp-string* arg1 #f 40 (bucket-id hud-draw-hud-alpha)) + ) + ) + ) + ) + ((= sv-288 2) + (cond + ((logtest? (-> s2-6 s1-5 flags) (secret-item-option-flags sf1)) + (let ((s0-10 print-game-text)) + (format (clear *temp-string*) "~44L~S ~32L~S~1L" sv-352 sv-368) + (s0-10 *temp-string* arg1 #f 40 (bucket-id hud-draw-hud-alpha)) + ) + ) + (else + (let ((s0-11 print-game-text)) + (format (clear *temp-string*) "~S" sv-368) + (s0-11 *temp-string* arg1 #f 40 (bucket-id hud-draw-hud-alpha)) + ) + ) + ) + ) + ) + ) + ) + (+! (-> arg1 origin y) f20-0) + (if (= s1-5 (-> this selected-index)) + (draw-highlight-bar arg0 arg1 (the int (+ -2.0 f22-2)) (the int (+ 3.0 f20-0)) sv-16) + ) + ) + ) + ) + ) + ) + (+! s1-5 1) + ) + (seek! (-> this current-index) (-> this target-index) (* (/ 600.0 f24-0) (seconds-per-frame))) ) - (seek! (-> this current-index) (-> this target-index) (* (/ 600.0 f24-0) (seconds-per-frame))) ) ) ) ) - ) - (progress-method-34 arg0) - (let ((s3-4 *progress-work*)) - (draw-header arg0 arg1 sv-16 (text-id progress-secrets)) - (draw-bg-box-outline arg0 (-> s3-4 sub-header) (* 128.0 sv-16)) - (draw-bg-box-alpha-2 arg0 (-> s3-4 footer) (* 64.0 sv-16)) - (draw-bg-box-outline arg0 (-> s3-4 footer) (* 128.0 sv-16)) - ) - (progress-method-47 - arg0 - arg1 - (!= (-> this current-index) 0.0) - (!= (-> this current-index) (the float (+ (-> *menu-secrets-array* length) -1))) + (progress-method-34 arg0) + (let ((s3-4 *progress-work*)) + (draw-header arg0 arg1 sv-16 (text-id progress-secrets)) + (draw-bg-box-outline arg0 (-> s3-4 sub-header) (* 128.0 sv-16)) + (draw-bg-box-alpha-2 arg0 (-> s3-4 footer) (* 64.0 sv-16)) + (draw-bg-box-outline arg0 (-> s3-4 footer) (* 128.0 sv-16)) + ) + (progress-method-47 + arg0 + arg1 + (!= (-> this current-index) 0.0) + (!= (-> this current-index) (the float (+ (-> *menu-secrets-array* length) -1))) + ) ) ) ) diff --git a/goal_src/jak3/engine/ui/progress/progress.gc b/goal_src/jak3/engine/ui/progress/progress.gc index 68b29db366..ca43f50046 100644 --- a/goal_src/jak3/engine/ui/progress/progress.gc +++ b/goal_src/jak3/engine/ui/progress/progress.gc @@ -12,6 +12,7 @@ (kmemopen global "progress-data") +;; og:preserve-this (define *progress-stack* (the-as (pointer uint8) (malloc 'global DPROCESS_STACK_SIZE))) (define *progress-process* (the-as (pointer progress) #f)) @@ -498,6 +499,7 @@ (set-menu-mode *blit-displays-work* #t) ) (set! *progress-process* + ;; og:preserve-this (process-spawn progress arg1 :name "progress" :to arg0 :stack (&-> *progress-stack* DPROCESS_STACK_SIZE)) ) (set-master-mode 'progress) @@ -1432,23 +1434,22 @@ ) (defbehavior progress-post progress () - (local-vars (sv-208 font-context) (sv-212 int) (sv-216 hud-box) (sv-220 symbol)) (when (-> self current-options) (set-selected-color self) (set! (-> self scissor-count) -1) (progress-method-33 self (-> *progress-work* full-screen)) - (let ((gp-0 (-> self current-options options))) - (let ((s3-0 (-> self current-options y-center)) - (s5-0 (-> self current-options y-space)) + (let ((gp-0 (-> self current-options options)) + (s3-0 (-> self current-options y-center)) + (s5-0 (-> self current-options y-space)) + (s2-0 (new-stack-matrix0)) + (s4-0 *progress-work*) + ) + (mem-copy! (the-as pointer s2-0) (the-as pointer *font-default-matrix*) 64) + (let ((sv-208 (new 'stack 'font-context s2-0 0 0 0.0 (font-color default) (font-flags shadow kerning))) + (sv-212 (- s3-0 (/ (* s5-0 (length gp-0)) 2))) + (sv-216 (new 'stack-no-clear 'hud-box)) ) - (let ((s2-0 (new-stack-matrix0)) - (s4-0 *progress-work*) - ) - (mem-copy! (the-as pointer s2-0) (the-as pointer *font-default-matrix*) 64) - (set! sv-208 (new 'stack 'font-context s2-0 0 0 0.0 (font-color default) (font-flags shadow kerning))) - (set! sv-212 (- s3-0 (/ (* s5-0 (length gp-0)) 2))) - (set! sv-216 (new 'stack-no-clear 'hud-box)) - (set! sv-220 (and (!= (-> self current) 'main) (or (= (-> self next) 'none) (> (-> self state-pos) 0)))) + (let ((sv-220 (and (!= (-> self current) 'main) (or (= (-> self next) 'none) (> (-> self state-pos) 0))))) (progress-method-33 self (-> s4-0 small-screen)) (when sv-220 (begin-scan sv-216 self) @@ -1459,53 +1460,52 @@ ) ) ) - ) - (if (or (= (-> self current-options) *title*) (= (-> self current-options) *options-options*)) - (+ s5-0 20) + (if (or (= (-> self current-options) *title*) (= (-> self current-options) *options-options*)) + (+ s5-0 20) + ) + (dotimes (s5-1 (length gp-0)) + (set! (-> self current-index) s5-1) + (set-scale! sv-208 0.5) + (set! (-> sv-208 origin x) 70.0) + (set! (-> sv-208 origin y) (the float sv-212)) + (set-width! sv-208 375) + (set-height! sv-208 30) + (set! (-> sv-208 flags) (font-flags kerning middle middle-vert large)) + (let ((v1-51 sv-208)) + (set! (-> v1-51 color) (if (and (= s5-1 (-> self option-index)) (= (-> self menu-transition) 0.0)) + (font-color font-color-33) + (font-color font-color-32) + ) + ) + ) + (draw-option + (-> gp-0 s5-1) + self + sv-208 + s5-1 + (and (= (-> self menu-transition) 0.0) (-> self selected-option) (= s5-1 (-> self option-index))) + ) ) - ) - (dotimes (s5-1 (length gp-0)) - (set! (-> self current-index) s5-1) - (set-scale! sv-208 0.5) - (set! (-> sv-208 origin x) 70.0) - (set! (-> sv-208 origin y) (the float sv-212)) - (set-width! sv-208 375) - (set-height! sv-208 30) - (set! (-> sv-208 flags) (font-flags kerning middle middle-vert large)) - (let ((v1-51 sv-208)) - (set! (-> v1-51 color) (if (and (= s5-1 (-> self option-index)) (= (-> self menu-transition) 0.0)) - (font-color font-color-33) - (font-color font-color-32) - ) - ) - ) - (draw-option - (-> gp-0 s5-1) - self - sv-208 - s5-1 - (and (= (-> self menu-transition) 0.0) (-> self selected-option) (= s5-1 (-> self option-index))) + (if sv-220 + (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) + ) + ) + ) + (progress-method-34 self) + ;; og:preserve-this + ;; calling end-scan without calling begin-scan will use uninitialized stack memory + ;; for box parameters, which may draw a large number of lines and overflow DMA memory. + (if sv-220 + (end-scan sv-216 (-> self scanlines-alpha)) + ) ) ) ) - (if sv-220 - (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) - ) - ) - ) - (progress-method-34 self) - - ;; og:preserve-this - ;; calling end-scan without calling begin-scan will use uninitialized stack memory - ;; for box parameters, which may draw a large number of lines and overflow DMA memory. - (if sv-220 - (end-scan sv-216 (-> self scanlines-alpha)) - ) ) (when (and (< 0.8 (-> self anim-frame)) (or (= (-> self current) 'bigmap) (= (-> self next) 'bigmap))) (progress-method-33 self (-> *progress-work* full-screen)) diff --git a/goal_src/jak3/engine/util/profile.gc b/goal_src/jak3/engine/util/profile.gc index 2b829992cd..7f9fe1a7a9 100644 --- a/goal_src/jak3/engine/util/profile.gc +++ b/goal_src/jak3/engine/util/profile.gc @@ -758,7 +758,7 @@ (let ((s3-0 (-> *profile-array* data s5-0)) (s4-0 *profile-collapse*) ) - (mem-copy! (&-> s3-0 type) (&-> (-> this data s5-0) type) #x4030) + (mem-copy! (&-> s3-0 type) (&-> this data s5-0 type) #x4030) (cond ((zero? s5-0) ((lambda ((arg0 profile-segment-array) (arg1 profile-collapse)) @@ -841,7 +841,6 @@ (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)) @@ -919,12 +918,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 @@ -970,12 +964,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/goal_src/jak3/engine/util/sync-info.gc b/goal_src/jak3/engine/util/sync-info.gc index 005522645a..61b1c79134 100644 --- a/goal_src/jak3/engine/util/sync-info.gc +++ b/goal_src/jak3/engine/util/sync-info.gc @@ -63,7 +63,6 @@ ;; WARN: Return type mismatch float vs none. (defmethod initialize! ((this sync-linear) (arg0 sync-info-params)) - (local-vars (sv-16 res-tag)) (if (!= (-> arg0 sync-type) 'sync-linear) (format 0 @@ -77,8 +76,9 @@ ) (let ((a0-3 (-> arg0 entity))) (when a0-3 - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-6 (res-lump-data a0-3 'sync (pointer float) :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-6 (res-lump-data a0-3 'sync (pointer float) :tag-ptr (& sv-16))) + ) (when v1-6 (set! s4-0 (the int (* 300.0 (-> v1-6 0)))) (set! f30-0 (-> v1-6 1)) @@ -130,7 +130,6 @@ ;; WARN: Return type mismatch float vs none. (defmethod initialize! ((this sync-eased) (arg0 sync-info-params)) - (local-vars (sv-16 res-tag)) (if (!= (-> arg0 sync-type) 'sync-eased) (format 0 @@ -148,8 +147,9 @@ ) (let ((a0-3 (-> arg0 entity))) (when a0-3 - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-6 (res-lump-data a0-3 'sync (pointer float) :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-6 (res-lump-data 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)) @@ -211,7 +211,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)) @@ -262,14 +262,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))) ) ) ) @@ -298,7 +298,6 @@ ;; WARN: Return type mismatch float vs none. (defmethod initialize! ((this sync-paused) (arg0 sync-info-params)) - (local-vars (sv-16 res-tag)) (if (!= (-> arg0 sync-type) 'sync-paused) (format 0 @@ -314,8 +313,9 @@ ) (let ((a0-3 (-> arg0 entity))) (when a0-3 - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-6 (res-lump-data a0-3 'sync (pointer float) :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-6 (res-lump-data 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/goal_src/jak3/levels/city/blow-tower/blow-tower-obs.gc b/goal_src/jak3/levels/city/blow-tower/blow-tower-obs.gc index 6be01b8f66..9a41b9fba5 100644 --- a/goal_src/jak3/levels/city/blow-tower/blow-tower-obs.gc +++ b/goal_src/jak3/levels/city/blow-tower/blow-tower-obs.gc @@ -619,7 +619,7 @@ ;; ERROR: Unsupported inline assembly instruction kind - [madda.s f1, f4] ;; ERROR: Unsupported inline assembly instruction kind - [madd.s f0, f2, f5] (defmethod tower-flyer-method-47 ((this tower-flyer) (arg0 vector) (arg1 quaternion) (arg2 vector)) - (local-vars (f0-10 float) (sv-208 vector)) + (local-vars (f0-10 float)) (with-pp (rlet ((vf0 :class vf) (vf4 :class vf) @@ -652,43 +652,33 @@ ) (let ((s1-2 (vector-! (new 'stack-no-clear 'vector) arg0 s2-0))) 0.0 - (set! sv-208 (new 'stack-no-clear 'vector)) - (let ((v1-19 s2-0) - (a0-11 (-> this basetrans)) - ) - (.lvf vf4 (&-> v1-19 quad)) - (.lvf vf5 (&-> a0-11 quad)) - ) - (.mov.vf.w vf6 vf0) - (.sub.vf.xyz vf6 vf4 vf5) - (.svf (&-> sv-208 quad) vf6) - 0.0 - (let ((s2-1 (new 'stack-no-clear 'vector))) - (let ((s0-0 (new 'stack-no-clear 'vector))) - (vector-normalize-ret-len! s1-2 1.0) - (let* ((v1-21 s1-2) - ; (f0-9 (-> sv-208 x)) - ; (f1-2 (-> sv-208 y)) - ; (f2-0 (-> sv-208 z)) - ; (f3-0 (-> v1-21 x)) - ; (f4-0 (-> v1-21 y)) - ; (f5-0 (-> v1-21 z)) - ) - ;; og:preserve-this - ; (.mula.s f0-9 f3-0) - ; (.madda.s f1-2 f4-0) - ; (.madd.s f0-10 f2-0 f5-0) - (set! f0-10 (vector-dot sv-208 v1-21)) - ) - (let ((f0-11 f0-10)) - (vector+float*! s2-1 (-> this basetrans) s1-2 f0-11) - ) - (compute-tower-flyer-lerp-point this s0-0 arg0 s2-1 (* f30-0 (seconds-per-frame))) + (let ((sv-208 (new 'stack-no-clear 'vector))) + (let ((v1-19 s2-0) + (a0-11 (-> this basetrans)) + ) + (.lvf vf4 (&-> v1-19 quad)) + (.lvf vf5 (&-> a0-11 quad)) ) - (set! *current-color* *color-white*) - (when (= (tower-fly-quick-raycast (-> this basetrans) s3-1 (new 'stack-no-clear 'vector) 2048.0) -100000000.0) - (vector-copy! arg2 s2-1) - (return #t) + (.mov.vf.w vf6 vf0) + (.sub.vf.xyz vf6 vf4 vf5) + (.svf (&-> sv-208 quad) vf6) + 0.0 + (let ((s2-1 (new 'stack-no-clear 'vector))) + (let ((s0-0 (new 'stack-no-clear 'vector))) + (vector-normalize-ret-len! s1-2 1.0) + (let* ((v1-21 s1-2)) + (set! f0-10 (vector-dot sv-208 v1-21)) + ) + (let ((f0-11 f0-10)) + (vector+float*! s2-1 (-> this basetrans) s1-2 f0-11) + ) + (compute-tower-flyer-lerp-point this s0-0 arg0 s2-1 (* f30-0 (seconds-per-frame))) + ) + (set! *current-color* *color-white*) + (when (= (tower-fly-quick-raycast (-> this basetrans) s3-1 (new 'stack-no-clear 'vector) 2048.0) -100000000.0) + (vector-copy! arg2 s2-1) + (return #t) + ) ) ) ) @@ -730,73 +720,74 @@ ) (defmethod tower-flyer-method-49 ((this tower-flyer) (arg0 vector) (arg1 quaternion)) - (local-vars (sv-608 collide-query) (sv-612 vector) (sv-616 symbol)) (let ((s4-0 (new 'stack-no-clear 'vector))) (let ((s2-0 (new 'stack-no-clear 'vector))) - (set! sv-608 (new 'stack-no-clear 'collide-query)) - (set! sv-612 (vector-z-quaternion! (new 'stack-no-clear 'vector) arg1)) - (set! sv-616 #t) - (vector-copy! (-> sv-608 start-pos) arg0) - (vector-float*! (-> sv-608 move-dist) sv-612 (+ 16384.0 (-> this desired-z-dist))) - (let ((v1-7 sv-608)) - (set! (-> v1-7 radius) 4096.0) - (set! (-> v1-7 collide-with) (collide-spec backgnd)) - (set! (-> v1-7 ignore-process0) #f) - (set! (-> v1-7 ignore-process1) #f) - (set! (-> v1-7 ignore-pat) - (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) - ) - (set! (-> v1-7 action-mask) (collide-action solid)) - ) - (let ((f0-3 (fill-and-probe-using-line-sphere *collide-cache* sv-608))) - (cond - ((>= f0-3 0.0) - (vector-float*! (-> sv-608 move-dist) (-> sv-608 move-dist) f0-3) - (let ((v1-15 (vector-! (new 'stack-no-clear 'vector) (-> this basetrans) arg0)) - (a1-5 (new 'stack-no-clear 'collide-query)) - ) - 0.0 - (let ((f30-0 (vector-length (-> sv-608 move-dist))) - (f28-0 (vector-dot v1-15 sv-612)) + (let ((sv-608 (new 'stack-no-clear 'collide-query)) + (sv-612 (vector-z-quaternion! (new 'stack-no-clear 'vector) arg1)) + (sv-616 #t) + ) + (vector-copy! (-> sv-608 start-pos) arg0) + (vector-float*! (-> sv-608 move-dist) sv-612 (+ 16384.0 (-> this desired-z-dist))) + (let ((v1-7 sv-608)) + (set! (-> v1-7 radius) 4096.0) + (set! (-> v1-7 collide-with) (collide-spec backgnd)) + (set! (-> v1-7 ignore-process0) #f) + (set! (-> v1-7 ignore-process1) #f) + (set! (-> v1-7 ignore-pat) + (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) + ) + (set! (-> v1-7 action-mask) (collide-action solid)) + ) + (let ((f0-3 (fill-and-probe-using-line-sphere *collide-cache* sv-608))) + (cond + ((>= f0-3 0.0) + (vector-float*! (-> sv-608 move-dist) (-> sv-608 move-dist) f0-3) + (let ((v1-15 (vector-! (new 'stack-no-clear 'vector) (-> this basetrans) arg0)) + (a1-5 (new 'stack-no-clear 'collide-query)) ) - (vector+float*! s4-0 arg0 sv-612 f28-0) - (vector-copy! (-> a1-5 start-pos) (-> this basetrans)) - (vector-! (-> a1-5 move-dist) s4-0 (-> a1-5 start-pos)) - (let ((v1-21 a1-5)) - (set! (-> v1-21 radius) 40.96) - (set! (-> v1-21 collide-with) (collide-spec backgnd)) - (set! (-> v1-21 ignore-process0) #f) - (set! (-> v1-21 ignore-process1) #f) - (set! (-> v1-21 ignore-pat) - (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) - ) - (set! (-> v1-21 action-mask) (collide-action solid)) - ) - (cond - ((or (>= (fill-and-probe-using-line-sphere *collide-cache* a1-5) 0.0) (>= (+ 6144.0 f30-0) f28-0)) - (set! (-> this use-z-dist) (fmin (+ -8192.0 f30-0) (-> this desired-z-dist))) - (set! (-> this current-z-dist) (fmin (-> this current-z-dist) f30-0)) - (seek! (-> this current-z-dist) (-> this use-z-dist) (* 61440.0 (seconds-per-frame))) - (set-time! (-> this last-wall-clip-time)) - ) - (else - (set! (-> this current-z-dist) f28-0) - (set-time! (-> this last-wall-clip-time)) - (set! sv-616 (the-as symbol #f)) + 0.0 + (let ((f30-0 (vector-length (-> sv-608 move-dist))) + (f28-0 (vector-dot v1-15 sv-612)) + ) + (vector+float*! s4-0 arg0 sv-612 f28-0) + (vector-copy! (-> a1-5 start-pos) (-> this basetrans)) + (vector-! (-> a1-5 move-dist) s4-0 (-> a1-5 start-pos)) + (let ((v1-21 a1-5)) + (set! (-> v1-21 radius) 40.96) + (set! (-> v1-21 collide-with) (collide-spec backgnd)) + (set! (-> v1-21 ignore-process0) #f) + (set! (-> v1-21 ignore-process1) #f) + (set! (-> v1-21 ignore-pat) + (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) + ) + (set! (-> v1-21 action-mask) (collide-action solid)) + ) + (cond + ((or (>= (fill-and-probe-using-line-sphere *collide-cache* a1-5) 0.0) (>= (+ 6144.0 f30-0) f28-0)) + (set! (-> this use-z-dist) (fmin (+ -8192.0 f30-0) (-> this desired-z-dist))) + (set! (-> this current-z-dist) (fmin (-> this current-z-dist) f30-0)) + (seek! (-> this current-z-dist) (-> this use-z-dist) (* 61440.0 (seconds-per-frame))) + (set-time! (-> this last-wall-clip-time)) + ) + (else + (set! (-> this current-z-dist) f28-0) + (set-time! (-> this last-wall-clip-time)) + (set! sv-616 (the-as symbol #f)) + ) ) ) ) ) - ) - ((time-elapsed? (-> this last-wall-clip-time) (seconds 1)) - (seek! (-> this current-z-dist) (-> this use-z-dist) (* 20480.0 (seconds-per-frame))) - (seek! (-> this use-z-dist) (-> this desired-z-dist) (* 8192.0 (seconds-per-frame))) - ) + ((time-elapsed? (-> this last-wall-clip-time) (seconds 1)) + (seek! (-> this current-z-dist) (-> this use-z-dist) (* 20480.0 (seconds-per-frame))) + (seek! (-> this use-z-dist) (-> this desired-z-dist) (* 8192.0 (seconds-per-frame))) + ) + ) + ) + (when sv-616 + (vector-normalize! (-> sv-608 move-dist) (-> this current-z-dist)) + (vector+! s4-0 arg0 (-> sv-608 move-dist)) ) - ) - (when sv-616 - (vector-normalize! (-> sv-608 move-dist) (-> this current-z-dist)) - (vector+! s4-0 arg0 (-> sv-608 move-dist)) ) (vector-! s2-0 s4-0 arg0) (let ((a0-36 (vector-! (new 'stack-no-clear 'vector) s2-0 (-> this local-offset)))) @@ -1674,81 +1665,85 @@ ) (defun bt-barrel-ground-probe ((arg0 vector)) - (local-vars (sv-560 collide-query) (sv-564 vector)) - (set! sv-560 (new 'stack-no-clear 'collide-query)) - (set! sv-564 arg0) - (vector+float*! (-> sv-560 start-pos) sv-564 *up-vector* 24576.0) - (set! (-> sv-560 move-dist quad) (the-as uint128 0)) - (set! (-> sv-560 move-dist y) -81920.0) - (let ((v1-8 sv-560)) - (set! (-> v1-8 radius) 409.6) - (set! (-> v1-8 collide-with) (collide-spec backgnd)) - (set! (-> v1-8 ignore-process0) #f) - (set! (-> v1-8 ignore-process1) #f) - (set! (-> v1-8 ignore-pat) - (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) - ) - (set! (-> v1-8 action-mask) (collide-action solid)) - ) - (when (>= (fill-and-probe-using-line-sphere *collide-cache* sv-560) 0.0) - (if (< (fabs (- (-> sv-560 best-other-tri intersect y) (-> arg0 y))) 24576.0) - (set! (-> sv-564 y) (fmax 0.0 (+ 12697.6 (-> sv-560 best-other-tri intersect y)))) + (let ((sv-560 (new 'stack-no-clear 'collide-query)) + (sv-564 arg0) ) + (vector+float*! (-> sv-560 start-pos) sv-564 *up-vector* 24576.0) + (set! (-> sv-560 move-dist quad) (the-as uint128 0)) + (set! (-> sv-560 move-dist y) -81920.0) + (let ((v1-8 sv-560)) + (set! (-> v1-8 radius) 409.6) + (set! (-> v1-8 collide-with) (collide-spec backgnd)) + (set! (-> v1-8 ignore-process0) #f) + (set! (-> v1-8 ignore-process1) #f) + (set! (-> v1-8 ignore-pat) + (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) + ) + (set! (-> v1-8 action-mask) (collide-action solid)) + ) + (when (>= (fill-and-probe-using-line-sphere *collide-cache* sv-560) 0.0) + (if (< (fabs (- (-> sv-560 best-other-tri intersect y) (-> arg0 y))) 24576.0) + (set! (-> sv-564 y) (fmax 0.0 (+ 12697.6 (-> sv-560 best-other-tri intersect y)))) + ) + ) ) ) ;; WARN: Return type mismatch symbol vs none. (defbehavior setup-bt-barrels bt-barrel-stack ((arg0 int) (arg1 int) (arg2 float) (arg3 float)) - (local-vars (sv-48 vector) (sv-52 vector) (sv-80 vector) (sv-84 float) (sv-112 process) (sv-128 vector)) - (set! sv-48 (vector-z-quaternion! (new 'stack-no-clear 'vector) (-> self root quat))) - (let ((v1-1 (new 'stack-no-clear 'vector))) - (vector-copy! v1-1 (-> self root trans)) - (set! sv-52 v1-1) - ) - (let ((a0-5 sv-48)) - (vector-copy! a0-5 sv-48) - (set! (-> a0-5 y) 0.0) - (vector-normalize! a0-5 1.0) - ) - (dotimes (s2-0 arg0) - (let ((v1-4 (new 'stack-no-clear 'vector))) - (vector-copy! v1-4 sv-52) - (set! sv-80 v1-4) - ) - (let* ((f30-0 (- (/ arg2 2))) - (v1-6 (/ (the-as int (rand-uint31-gen *random-generator*)) 256)) - (v1-7 (the-as number (logior #x3f800000 v1-6))) - ) - (set! sv-84 (+ f30-0 (* (+ -1.0 (the-as float v1-7)) (+ (/ arg2 2) (/ arg2 2))))) - ) - (vector+float*! sv-80 sv-80 (vector-cross! (new 'stack-no-clear 'vector) sv-48 *up-vector*) (* sv-84 arg3)) - (bt-barrel-ground-probe sv-80) - (dotimes (s1-0 arg1) - (let ((s0-0 (handle->process (-> *blow-tower-targets* hellcat)))) - (set! sv-112 (get-process *default-dead-pool* bt-barrel #x4000 1)) - (when sv-112 - (let ((t9-5 (method-of-type bt-barrel activate))) - (t9-5 (the-as bt-barrel sv-112) s0-0 "bt-barrel" (the-as pointer #x70004000)) - ) - (run-now-in-process sv-112 bt-barrel-init-by-other sv-80) - (-> sv-112 ppointer) - ) + (let ((sv-48 (vector-z-quaternion! (new 'stack-no-clear 'vector) (-> self root quat))) + (v1-1 (new 'stack-no-clear 'vector)) ) - ) - (suspend) - 0 - (vector+float*! sv-52 sv-52 sv-48 arg2) - (let ((s1-1 sv-52) - (s0-1 sv-52) + (vector-copy! v1-1 (-> self root trans)) + (let ((sv-52 v1-1)) + (let ((a0-5 sv-48)) + (vector-copy! a0-5 sv-48) + (set! (-> a0-5 y) 0.0) + (vector-normalize! a0-5 1.0) + ) + (dotimes (s2-0 arg0) + (let ((v1-4 (new 'stack-no-clear 'vector))) + (vector-copy! v1-4 sv-52) + (let ((sv-80 v1-4)) + (let* ((f30-0 (- (/ arg2 2))) + (v1-6 (/ (the-as int (rand-uint31-gen *random-generator*)) 256)) + (v1-7 (the-as number (logior #x3f800000 v1-6))) + (sv-84 (+ f30-0 (* (+ -1.0 (the-as float v1-7)) (+ (/ arg2 2) (/ arg2 2))))) + ) + (vector+float*! sv-80 sv-80 (vector-cross! (new 'stack-no-clear 'vector) sv-48 *up-vector*) (* sv-84 arg3)) + ) + (bt-barrel-ground-probe sv-80) + (dotimes (s1-0 arg1) + (let ((s0-0 (handle->process (-> *blow-tower-targets* hellcat))) + (sv-112 (get-process *default-dead-pool* bt-barrel #x4000 1)) + ) + (when sv-112 + ((method-of-type bt-barrel activate) (the-as bt-barrel sv-112) s0-0 "bt-barrel" (the-as pointer #x70004000)) + (run-now-in-process sv-112 bt-barrel-init-by-other sv-80) + (-> sv-112 ppointer) + ) + ) + ) + ) + ) + (suspend) + 0 + (vector+float*! sv-52 sv-52 sv-48 arg2) + (let* ((s1-1 sv-52) + (s0-1 sv-52) + (sv-128 sv-48) + (f30-1 arg3) + (f28-0 (- (/ arg2 4))) + (v1-30 (/ (the-as int (rand-uint31-gen *random-generator*)) 256)) + (v1-31 (the-as number (logior #x3f800000 v1-30))) + ) + (vector+float*! + s1-1 + s0-1 + sv-128 + (* f30-1 (+ f28-0 (* (+ -1.0 (the-as float v1-31)) (+ (/ arg2 4) (/ arg2 4))))) + ) ) - (set! sv-128 sv-48) - (let* ((f30-1 arg3) - (f28-0 (- (/ arg2 4))) - (v1-30 (/ (the-as int (rand-uint31-gen *random-generator*)) 256)) - (v1-31 (the-as number (logior #x3f800000 v1-30))) - (f0-18 (* f30-1 (+ f28-0 (* (+ -1.0 (the-as float v1-31)) (+ (/ arg2 4) (/ arg2 4)))))) - ) - (vector+float*! s1-1 s0-1 sv-128 f0-18) ) ) ) diff --git a/goal_src/jak3/levels/city/blow-tower/blow-tower-obs2.gc b/goal_src/jak3/levels/city/blow-tower/blow-tower-obs2.gc index fdc02f3c3a..f03490c18d 100644 --- a/goal_src/jak3/levels/city/blow-tower/blow-tower-obs2.gc +++ b/goal_src/jak3/levels/city/blow-tower/blow-tower-obs2.gc @@ -250,20 +250,23 @@ ) (defmethod blow-tower-enemy-method-34 ((this bt-roboguard)) - (local-vars (sv-16 int) (sv-24 time-frame)) (bt-roboguard-method-46 this) - (set! sv-16 (the-as int (- (-> this path-clock-time) (-> this active-clock-time)))) - (set! sv-24 (- (-> *blow-tower-targets* mission-time) (-> this active-clock-time))) - (cond - ((= (-> this focus) (-> *blow-tower-targets* pickup)) - (set! sv-16 (max 750 sv-16)) - ) - (else - (set! sv-16 (max 450 sv-16)) - (set! sv-16 (the int (* 0.75 (the float sv-16)))) - ) + (let ((sv-16 (the-as int (- (-> this path-clock-time) (-> this active-clock-time)))) + (sv-24 (- (-> *blow-tower-targets* mission-time) (-> this active-clock-time))) + ) + (set! sv-16 (cond + ((= (-> this focus) (-> *blow-tower-targets* pickup)) + (set! sv-16 (max 750 (the-as time-frame sv-16))) + sv-16 + ) + (else + (set! sv-16 (max 450 (the-as time-frame sv-16))) + (the int (* 0.75 (the float sv-16))) + ) + ) + ) + (set! (-> this difficulty) (fmax 0.0 (fmin 1.0 (/ (the float sv-24) (the float sv-16))))) ) - (set! (-> this difficulty) (fmax 0.0 (fmin 1.0 (/ (the float sv-24) (the float sv-16))))) (cond ((= (-> this focus) (-> *blow-tower-targets* pickup)) (set! (-> this difficulty) (* (-> this difficulty) (-> this difficulty))) @@ -1343,10 +1346,9 @@ ) (let ((f0-15 f30-0)) 0.0 - (let* ((f0-16 (evaluate *grunt-jump-curve* f0-15 (loop-behavior use-default))) - (f0-17 (* f0-16 f0-16)) + (let* ((f0-17 (square (evaluate *grunt-jump-curve* f0-15 (loop-behavior use-default)))) (f0-18 (lerp (-> this jump-height-percentage-start) (-> this jump-height-percentage-end) f0-17)) - (f0-20 (- (* 2.0 f0-18) (* f0-18 f0-18))) + (f0-20 (- (* 2.0 f0-18) (square f0-18))) (f0-21 (* (-> this apex-height) f0-20)) ) (set! (-> this root trans y) (+ (-> this jump-start-pos y) f0-21)) @@ -1455,7 +1457,7 @@ ((< 0.0 f1-1) (set! (-> this jump-height-percentage-start) 0.0) (set! (-> this jump-height-percentage-end) - (/ (- (- f3-2) (sqrtf (- (* f3-2 f3-2) (* 4.0 f2-4 f0-5)))) (* 2.0 f0-5)) + (/ (- (- f3-2) (sqrtf (- (square f3-2) (* 4.0 f2-4 f0-5)))) (* 2.0 f0-5)) ) ) (else @@ -1464,7 +1466,7 @@ (set! (-> this jump-start-pos y) f1-5) ) (set! (-> this jump-height-percentage-start) - (/ (+ (- f3-2) (sqrtf (- (* f3-2 f3-2) (* 4.0 f2-4 f0-5)))) (* 2.0 f0-5)) + (/ (+ (- f3-2) (sqrtf (- (square f3-2) (* 4.0 f2-4 f0-5)))) (* 2.0 f0-5)) ) (set! (-> this jump-height-percentage-end) 2.0) ) @@ -2432,7 +2434,7 @@ (set! (-> this bob-xform root trans quad) (-> v1-42 quad)) ) (when (= (-> this target) (-> *blow-tower-targets* hellcat)) - (let ((f0-26 (- 1.0 (* f30-0 f30-0)))) + (let ((f0-26 (- 1.0 (square f30-0)))) (vector-float*! (the-as vector (-> this bob-xform)) (the-as vector (-> this bob-xform)) 2.0) (vector-float*! (the-as vector (-> this bob-xform)) (the-as vector (-> this bob-xform)) f0-26) ) @@ -2685,70 +2687,64 @@ (s5-0 (-> this main-joint-movement 2)) (s3-0 (lambda ((arg0 bt-mh-flyer) (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))) - 0.75 - (quaternion-rotate-local-z! sv-208 a1-3 sv-192) - (quaternion->matrix s5-0 sv-208) - (vector-copy! s2-1 (-> arg0 root scale)) - (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 (* 1638400.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))) + (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)) + ) + 0.75 + (quaternion-rotate-local-z! sv-208 a1-3 sv-192) + (quaternion->matrix s5-0 sv-208) + (vector-copy! s2-1 (-> arg0 root scale)) + (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 (* 1638400.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) ) - (set! (-> *part-id-table* 4817 init-specs 4 initial-valuef) (* f20-0 f2-6)) - (set! (-> *part-id-table* 4817 init-specs 5 initial-valuef) (* f26-0 f0-15)) - (set! (-> *part-id-table* 4821 init-specs 3 initial-valuef) (* f22-0 f2-6)) - (set! (-> *part-id-table* 4818 init-specs 1 initial-valuef) (* f24-0 f0-15)) - (set! (-> *part-id-table* 4819 init-specs 1 initial-valuef) (* f1-10 f0-15)) - (set! (-> *part-id-table* 4820 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 uvec) (* 0.3 f0-16)) ) + ) + (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* 4817 init-specs 4 initial-valuef) (* f20-0 f2-6)) + (set! (-> *part-id-table* 4817 init-specs 5 initial-valuef) (* f26-0 f0-15)) + (set! (-> *part-id-table* 4821 init-specs 3 initial-valuef) (* f22-0 f2-6)) + (set! (-> *part-id-table* 4818 init-specs 1 initial-valuef) (* f24-0 f0-15)) + (set! (-> *part-id-table* 4819 init-specs 1 initial-valuef) (* f1-10 f0-15)) + (set! (-> *part-id-table* 4820 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 uvec) (* 0.3 f0-16)) ) ) - (vector-copy! (-> s5-0 trans) s4-0) - (spawn-from-mat (-> arg0 engine-part) s5-0) - (lerp-scale 0.75 1.0 f28-0 1638.4 f30-0) ) ) + (vector-copy! (-> s5-0 trans) s4-0) + (spawn-from-mat (-> arg0 engine-part) s5-0) + (lerp-scale 0.75 1.0 f28-0 1638.4 f30-0) ) ) 0 @@ -2842,30 +2838,29 @@ ) (defun kg-bombbot-find-nearest-nav-mesh ((arg0 kg-bombbot) (arg1 float)) - (local-vars (sv-64 nav-poly) (sv-68 nav-mesh) (sv-72 float) (sv-76 kg-bombbot)) - (set! sv-64 (new 'stack-no-clear 'nav-poly)) - (set! sv-68 (the-as nav-mesh #f)) - (set! sv-72 arg1) - (set! sv-76 arg0) - (set! (-> sv-64 data 20) (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 vertex 0) (the-as vector sv-76) (the-as vector (-> s3-0 bounds))) - (let ((f0-1 (vector-length-squared (-> sv-64 vertex 0))) - (f1-0 (-> s3-0 bounds r)) - ) - (when (< f0-1 (* f1-0 f1-0)) - (set! (-> sv-64 vertex1 x) 4096.0) - (nav-mesh-method-46 s3-0 sv-64) - (when (>= sv-72 (-> sv-64 vertex1 w)) - (set! sv-72 (-> sv-64 vertex1 w)) - (set! sv-68 s3-0) + (let ((sv-64 (new 'stack-no-clear 'nav-poly)) + (sv-68 (the-as nav-mesh #f)) + ) + (let ((sv-72 arg1) + (sv-76 arg0) + ) + (set! (-> sv-64 data 20) (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 vertex 0) (the-as vector sv-76) (the-as vector (-> s3-0 bounds))) + (when (< (vector-length-squared (-> sv-64 vertex 0)) (square (-> s3-0 bounds r))) + (set! (-> sv-64 vertex1 x) 4096.0) + (nav-mesh-method-46 s3-0 sv-64) + (when (>= sv-72 (-> sv-64 vertex1 w)) + (set! sv-72 (-> sv-64 vertex1 w)) + (set! sv-68 s3-0) + ) ) ) ) @@ -2876,8 +2871,8 @@ ) ) ) + sv-68 ) - sv-68 ) (defmethod bombbot-method-205 ((this kg-bombbot)) diff --git a/goal_src/jak3/levels/city/blow-tower/blow-tower-shared.gc b/goal_src/jak3/levels/city/blow-tower/blow-tower-shared.gc index 69891334e1..0fa5dd45eb 100644 --- a/goal_src/jak3/levels/city/blow-tower/blow-tower-shared.gc +++ b/goal_src/jak3/levels/city/blow-tower/blow-tower-shared.gc @@ -154,63 +154,63 @@ ) (defmethod blow-tower-path-cursor-method-11 ((this blow-tower-path-cursor) (arg0 vector)) - (local-vars (f1-5 number) (f2-4 float) (sv-32 number) (sv-40 int) (sv-48 vector) (sv-52 number)) - (set! sv-32 40960000.0) - (set! sv-40 -1) - (set! sv-48 (new 'stack-no-clear 'vector)) - (set! sv-52 0.0) - (dotimes (s4-0 (+ (-> this path num-nodes) -1)) - (let ((s2-1 (vector-! (new 'stack-no-clear 'vector) arg0 (-> this path pts s4-0))) - (s3-1 (vector-! (new 'stack-no-clear 'vector) (-> this path pts (+ s4-0 1)) (-> this path pts s4-0))) + (local-vars (f1-5 number) (f2-4 float)) + (let ((sv-32 40960000.0) + (sv-40 -1) + ) + (let ((sv-48 (new 'stack-no-clear 'vector)) + (sv-52 (the-as float 0.0)) ) - 0.0 - 0.0 - 0.0 - 0.0 - 0.0 - (set! (-> s2-1 y) 0.0) - (set! (-> s3-1 y) 0.0) - (let ((f1-0 (vector-normalize-ret-len! s3-1 1.0)) - (f0-10 (vector-dot s2-1 s3-1)) - ) - (cond - ((< f0-10 0.0) - (set! f2-4 (sqrtf (+ (* (-> s2-1 x) (-> s2-1 x)) (* (-> s2-1 z) (-> s2-1 z))))) - (set! f1-5 0.0) - ) - ((< f1-0 f0-10) - (let ((v1-11 s2-1)) - (set! f2-4 (sqrtf (+ (* (-> v1-11 x) (-> v1-11 x)) (* (-> v1-11 z) (-> v1-11 z))))) - ) - (set! f1-5 1.0) - ) - (else - (let ((f2-9 (vector-dot s2-1 s2-1)) - (f3-2 f0-10) - ) - (set! f2-4 (sqrtf (- f2-9 (* f3-2 f3-2)))) + (dotimes (s4-0 (+ (-> this path num-nodes) -1)) + (let ((s2-1 (vector-! (new 'stack-no-clear 'vector) arg0 (-> this path pts s4-0))) + (s3-1 (vector-! (new 'stack-no-clear 'vector) (-> this path pts (+ s4-0 1)) (-> this path pts s4-0))) + ) + 0.0 + 0.0 + 0.0 + 0.0 + 0.0 + (set! (-> s2-1 y) 0.0) + (set! (-> s3-1 y) 0.0) + (let ((f1-0 (vector-normalize-ret-len! s3-1 1.0)) + (f0-10 (vector-dot s2-1 s3-1)) + ) + (cond + ((< f0-10 0.0) + (set! f2-4 (sqrtf (+ (* (-> s2-1 x) (-> s2-1 x)) (* (-> s2-1 z) (-> s2-1 z))))) + (set! f1-5 0.0) + ) + ((< f1-0 f0-10) + (let ((v1-11 s2-1)) + (set! f2-4 (sqrtf (+ (* (-> v1-11 x) (-> v1-11 x)) (* (-> v1-11 z) (-> v1-11 z))))) + ) + (set! f1-5 1.0) + ) + (else + (set! f2-4 (sqrtf (- (vector-dot s2-1 s2-1) (square f0-10)))) + (set! f1-5 (/ f0-10 f1-0)) + ) + ) + (when (< f2-4 (the-as float sv-32)) + (set! sv-32 f2-4) + (set! sv-40 s4-0) + (set! sv-52 (the-as float f1-5)) + (vector+float*! sv-48 (-> this path pts s4-0) s3-1 f0-10) ) - (set! f1-5 (/ f0-10 f1-0)) ) ) - (when (< f2-4 (the-as float sv-32)) - (set! sv-32 f2-4) - (set! sv-40 s4-0) - (set! sv-52 f1-5) - (vector+float*! sv-48 (-> this path pts s4-0) s3-1 f0-10) - ) ) + (set! (-> this interp-tt) sv-52) ) - ) - (set! (-> this interp-tt) (the-as float sv-52)) - (set! (-> this current-tt) - (lerp - (-> this path node-info sv-40 accum-time-percentage) - (-> this path node-info (+ sv-40 1) accum-time-percentage) - (-> this interp-tt) + (set! (-> this current-tt) + (lerp + (-> this path node-info sv-40 accum-time-percentage) + (-> this path node-info (+ sv-40 1) accum-time-percentage) + (-> this interp-tt) + ) ) - ) - (blow-tower-path-cursor-method-12 this sv-40) + (blow-tower-path-cursor-method-12 this sv-40) + ) (set! (-> this current-time) (the-as time-frame (the int (* (-> this current-tt) (the float (-> this path total-time))))) ) diff --git a/goal_src/jak3/levels/city/blow-tower/cty-blow-tower.gc b/goal_src/jak3/levels/city/blow-tower/cty-blow-tower.gc index 4ef6c78d0c..ba8e3752f0 100644 --- a/goal_src/jak3/levels/city/blow-tower/cty-blow-tower.gc +++ b/goal_src/jak3/levels/city/blow-tower/cty-blow-tower.gc @@ -460,59 +460,56 @@ ) (defmethod on-attacked ((this bt-vehicle) (arg0 float) (arg1 attack-info) (arg2 process-focusable)) - (local-vars - (sv-64 vector) - (sv-68 vector) - (sv-72 vector) - (sv-76 float) - (sv-80 (pointer float)) - (sv-88 int) - (sv-96 vector) - (sv-100 float) - ) - (set! sv-64 (new 'stack-no-clear 'vector)) - (set! sv-68 (-> this root trans)) - (set! sv-72 (new 'stack-no-clear 'vector)) - (set! sv-76 (the-as float 0.0)) - (set! sv-80 (new 'static 'array float 4 0.0 0.0 0.0 0.0)) - (set! sv-88 0) - (set! sv-96 (vector-z-quaternion! (new 'stack-no-clear 'vector) (-> this root quat))) - (set! sv-100 (the-as float 0.0)) - (let ((s2-0 (new 'stack-no-clear 'attack-info))) - (attack-info-method-9 arg1 s2-0 arg2 this) - (vector-copy! sv-64 (-> s2-0 intersection)) - ) - (let ((a0-6 (as-type arg2 process-focusable))) - (if a0-6 - (vector-copy! sv-64 (get-trans a0-6 3)) + (let ((sv-64 (new 'stack-no-clear 'vector)) + (sv-68 (-> this root trans)) + (sv-72 (new 'stack-no-clear 'vector)) ) - ) - (vector-! sv-72 sv-64 sv-68) - (set! (-> sv-72 y) 0.0) - (let ((a0-8 sv-96)) - (vector-copy! a0-8 sv-96) - (set! (-> a0-8 y) 0.0) - (vector-normalize! a0-8 1.0) - ) - (set! sv-100 (* 0.6 (-> this root root-prim local-sphere w))) - (vector-float*! sv-96 sv-96 sv-100) - (let ((s4-3 (vector-rotate-around-y! (new 'stack-no-clear 'vector) sv-96 8192.0)) - (f30-0 0.0) - ) - (dotimes (s3-1 4) - (set! (-> sv-80 s3-1) (/ (vector-vector-distance s4-3 sv-72) sv-100)) - (set! (-> sv-80 s3-1) (fmax 0.0 (fmin 1.0 (-> sv-80 s3-1)))) - (set! (-> sv-80 s3-1) (- 1.0 (-> sv-80 s3-1))) - (set! (-> sv-80 s3-1) (* (-> sv-80 s3-1) (-> sv-80 s3-1))) - (+! f30-0 (-> sv-80 s3-1)) - (vector-rotate-around-y! s4-3 s4-3 -16384.0) + (let ((sv-76 (the-as float 0.0))) ) - (when (< 0.1 f30-0) - (dotimes (v1-46 4) - (set! (-> sv-80 v1-46) (/ (-> sv-80 v1-46) f30-0)) + (let ((sv-80 (new 'static 'array float 4 0.0 0.0 0.0 0.0))) + (let ((sv-88 0)) ) - (dotimes (v1-49 4) - (+! (-> this damage-state v1-49) (* (-> sv-80 v1-49) arg0)) + (let ((sv-96 (vector-z-quaternion! (new 'stack-no-clear 'vector) (-> this root quat))) + (sv-100 (the-as float 0.0)) + ) + (let ((s2-0 (new 'stack-no-clear 'attack-info))) + (attack-info-method-9 arg1 s2-0 arg2 this) + (vector-copy! sv-64 (-> s2-0 intersection)) + ) + (let ((a0-6 (as-type arg2 process-focusable))) + (if a0-6 + (vector-copy! sv-64 (get-trans a0-6 3)) + ) + ) + (vector-! sv-72 sv-64 sv-68) + (set! (-> sv-72 y) 0.0) + (let ((a0-8 sv-96)) + (vector-copy! a0-8 sv-96) + (set! (-> a0-8 y) 0.0) + (vector-normalize! a0-8 1.0) + ) + (set! sv-100 (* 0.6 (-> this root root-prim local-sphere w))) + (vector-float*! sv-96 sv-96 sv-100) + (let ((s4-3 (vector-rotate-around-y! (new 'stack-no-clear 'vector) sv-96 8192.0)) + (f30-0 0.0) + ) + (dotimes (s3-1 4) + (set! (-> sv-80 s3-1) (/ (vector-vector-distance s4-3 sv-72) sv-100)) + (set! (-> sv-80 s3-1) (fmax 0.0 (fmin 1.0 (-> sv-80 s3-1)))) + (set! (-> sv-80 s3-1) (- 1.0 (-> sv-80 s3-1))) + (set! (-> sv-80 s3-1) (* (-> sv-80 s3-1) (-> sv-80 s3-1))) + (+! f30-0 (-> sv-80 s3-1)) + (vector-rotate-around-y! s4-3 s4-3 -16384.0) + ) + (when (< 0.1 f30-0) + (dotimes (v1-46 4) + (set! (-> sv-80 v1-46) (/ (-> sv-80 v1-46) f30-0)) + ) + (dotimes (v1-49 4) + (+! (-> this damage-state v1-49) (* (-> sv-80 v1-49) arg0)) + ) + ) + ) ) ) ) @@ -557,7 +554,7 @@ ((< (-> this start-path-height-offset) (-> this dest-path-height-offset)) ) (else - (set! f0-7 (* f0-7 f0-7)) + (set! f0-7 (square f0-7)) ) ) (let* ((f0-8 (evaluate *bt-height-adjust* f0-7 (loop-behavior use-default))) @@ -962,7 +959,6 @@ ;; ERROR: Stack slot load at 176 mismatch: defined as size 4, got size 16 ;; WARN: Return type mismatch quaternion vs object. (defmethod bt-vehicle-method-36 ((this bt-hellcat) (arg0 int) (arg1 vector) (arg2 quaternion)) - (local-vars (sv-176 float)) (let ((s3-0 (quaternion->matrix (new 'stack-no-clear 'matrix) arg2))) (quaternion-rotate-local-y! arg2 arg2 32768.0) (let ((f30-0 0.7) @@ -1000,15 +996,7 @@ (vector-! s2-0 s0-0 s1-0) ) (let ((f30-1 (-> this land-grunt-offset))) - (let ((s4-1 vector-rotate-around-axis!) - (s3-1 s2-0) - (s0-1 s2-0) - ) - (set! sv-176 f30-1) - (let ((a3-1 (vector-y-quaternion! (new 'stack-no-clear 'vector) arg2))) - (s4-1 s3-1 s0-1 sv-176 a3-1) - ) - ) + (vector-rotate-around-axis! s2-0 s2-0 f30-1 (vector-y-quaternion! (new 'stack-no-clear 'vector) arg2)) (vector+! s2-0 s2-0 s1-0) (vector+! arg1 arg1 s2-0) (quaternion-rotate-local-y! arg2 arg2 f30-1) @@ -1046,45 +1034,48 @@ ) (defmethod bt-hellcat-method-50 ((this bt-hellcat) (arg0 int) (arg1 quaternion) (arg2 vector) (arg3 vector)) - (local-vars (sv-48 vector) (sv-56 int) (sv-64 number) (sv-68 quaternion)) - (set! sv-48 (new 'stack-no-clear 'vector)) - (set! sv-56 -1) - (set! sv-64 -1.0) - (set! sv-68 (new 'stack-no-clear 'quaternion)) - (quaternion-copy! sv-68 arg1) - (let ((v1-5 (the-as bt-gun-manager (handle->process (-> this child-turret))))) - (quaternion-copy! sv-68 (-> v1-5 cam-quat)) - ) - (vector-z-quaternion! sv-48 sv-68) - (let ((a0-8 sv-48)) - (vector-copy! a0-8 sv-48) - (set! (-> a0-8 y) 0.0) - (vector-normalize! a0-8 1.0) - ) - (dotimes (s2-0 12) - (when (= (-> this spots s2-0 rider-index) arg0) - (let ((a0-9 (new 'stack-no-clear 'vector))) - (vector-copy! a0-9 (-> this spots s2-0 offset-dir)) - (set! (-> a0-9 y) 0.0) - (let ((v1-18 (vector-normalize! a0-9 1.0))) - 0.0 - (let ((f0-5 (vector-dot v1-18 sv-48))) - (when (< (the-as float sv-64) f0-5) - (set! sv-64 f0-5) - (set! sv-56 s2-0) - (if arg3 - (vector-copy! arg3 v1-18) + (let ((sv-48 (new 'stack-no-clear 'vector)) + (sv-56 -1) + ) + (let ((sv-64 -1.0)) + (let ((sv-68 (new 'stack-no-clear 'quaternion))) + (quaternion-copy! sv-68 arg1) + (let ((v1-5 (the-as bt-gun-manager (handle->process (-> this child-turret))))) + (quaternion-copy! sv-68 (-> v1-5 cam-quat)) + ) + (vector-z-quaternion! sv-48 sv-68) + ) + (let ((a0-8 sv-48)) + (vector-copy! a0-8 sv-48) + (set! (-> a0-8 y) 0.0) + (vector-normalize! a0-8 1.0) + ) + (dotimes (s2-0 12) + (when (= (-> this spots s2-0 rider-index) arg0) + (let ((a0-9 (new 'stack-no-clear 'vector))) + (vector-copy! a0-9 (-> this spots s2-0 offset-dir)) + (set! (-> a0-9 y) 0.0) + (let ((v1-18 (vector-normalize! a0-9 1.0))) + 0.0 + (let ((f0-5 (vector-dot v1-18 sv-48))) + (when (< (the-as float sv-64) f0-5) + (set! sv-64 f0-5) + (set! sv-56 s2-0) + (if arg3 + (vector-copy! arg3 v1-18) + ) ) + ) ) ) ) ) ) + (if arg2 + (vector-copy! arg2 sv-48) + ) + sv-56 ) - (if arg2 - (vector-copy! arg2 sv-48) - ) - sv-56 ) (defmethod init-spots ((this bt-hellcat)) @@ -1120,36 +1111,42 @@ ) (defmethod bt-hellcat-method-48 ((this bt-hellcat) (arg0 handle) (arg1 quaternion)) - (local-vars (s3-0 int) (sv-16 int) (sv-24 int) (sv-64 number) (sv-72 int) (sv-80 vector) (sv-84 vector)) - (set! sv-16 0) - (set! sv-24 2) - (dotimes (v1-1 2) - (when (handle->process (-> this assigned-spots v1-1)) - (set! sv-16 (logior sv-16 (ash 1 v1-1))) - (set! sv-24 (+ sv-24 -1)) - ) - ) - (when (zero? sv-24) - (set! s3-0 -1) - (goto cfg-26) - ) - (set! sv-64 -1.0) - (set! sv-72 -1) - (set! sv-80 (new 'stack-no-clear 'vector)) - (set! sv-84 (new 'stack-no-clear 'vector)) - (dotimes (s3-1 2) - (when (not (logtest? sv-16 (ash 1 s3-1))) - (bt-hellcat-method-50 this s3-1 arg1 sv-80 sv-84) - 0.0 - (let ((f0-3 (vector-dot sv-80 sv-84))) - (when (< (the-as float sv-64) f0-3) - (set! sv-72 s3-1) - (set! sv-64 f0-3) + (local-vars (s3-0 int)) + (let ((sv-16 0)) + (let ((sv-24 2)) + (dotimes (v1-1 2) + (when (handle->process (-> this assigned-spots v1-1)) + (logior! sv-16 (ash 1 v1-1)) + (+! sv-24 -1) ) ) + (when (zero? sv-24) + (set! s3-0 -1) + (goto cfg-26) + ) + ) + (let ((sv-64 -1.0) + (sv-72 -1) + ) + (let ((sv-80 (new 'stack-no-clear 'vector)) + (sv-84 (new 'stack-no-clear 'vector)) + ) + (dotimes (s3-1 2) + (when (not (logtest? sv-16 (ash 1 s3-1))) + (bt-hellcat-method-50 this s3-1 arg1 sv-80 sv-84) + 0.0 + (let ((f0-3 (vector-dot sv-80 sv-84))) + (when (< (the-as float sv-64) f0-3) + (set! sv-72 s3-1) + (set! sv-64 f0-3) + ) + ) + ) + ) + ) + (set! s3-0 sv-72) ) ) - (set! s3-0 sv-72) (set! (-> this assigned-spots s3-0) arg0) (set! (-> this spots (bt-hellcat-method-50 this s3-0 arg1 (the-as vector #f) (the-as vector #f)) owner) arg0) (label cfg-26) @@ -1160,76 +1157,60 @@ ;; ERROR: Unsupported inline assembly instruction kind - [madda.s f1, f4] ;; ERROR: Unsupported inline assembly instruction kind - [madd.s f0, f2, f5] (defmethod bt-hellcat-method-47 ((this bt-hellcat) (arg0 int) (arg1 vector) (arg2 quaternion) (arg3 symbol)) - (local-vars - (f0-4 float) - (sv-176 symbol) - (sv-192 int) - (sv-208 vector) - (sv-224 quaternion) - (sv-240 vector) - (sv-256 matrix) - ) - (set! sv-176 arg3) - (set! sv-192 0) - (while (< sv-192 12) - (when (and (= arg0 (-> this spots sv-192 rider-index)) (handle->process (-> this spots sv-192 owner))) - (let ((s0-0 (-> this spots sv-192))) - (let ((s2-0 (new 'stack-no-clear 'vector))) - (set! sv-208 (new 'stack-no-clear 'vector)) - (let ((s1-0 (new 'stack-no-clear 'vector))) + (local-vars (f0-4 float)) + (let ((sv-176 arg3) + (sv-192 0) + ) + (while (< sv-192 12) + (when (and (= arg0 (-> this spots sv-192 rider-index)) (handle->process (-> this spots sv-192 owner))) + (let ((s0-0 (-> this spots sv-192))) + (let ((s2-0 (new 'stack-no-clear 'vector)) + (sv-208 (new 'stack-no-clear 'vector)) + (s1-0 (new 'stack-no-clear 'vector)) + ) (bt-hellcat-method-46 this s2-0 (the-as quaternion sv-208)) (when sv-176 - (set! sv-224 (quaternion-copy! (new 'stack-no-clear 'quaternion) (the-as quaternion sv-208))) - (set! sv-240 (new 'stack-no-clear 'vector)) - (let ((v1-21 (the-as bt-gun-manager (handle->process (-> this child-turret))))) - (quaternion-copy! sv-224 (-> v1-21 cam-quat)) - ) - (vector-z-quaternion! sv-240 sv-224) - (let ((a0-14 sv-240)) - (vector-copy! a0-14 sv-240) - (set! (-> a0-14 y) 0.0) - (vector-normalize! a0-14 1.0) - ) - (acos (vector-dot sv-240 (the-as vector (+ (the-as uint (-> this spots 0 offset-dir)) (* sv-192 64))))) - (let ((f30-0 4551.1113) - (t9-6 acos) + (let ((sv-224 (quaternion-copy! (new 'stack-no-clear 'quaternion) (the-as quaternion sv-208))) + (sv-240 (new 'stack-no-clear 'vector)) ) - ;; og:preserve-this - (let* ((v1-29 (-> this spots sv-192 offset-dir)) - ; (v1-29 (the-as object (+ (the-as uint (-> this spots 0 offset-dir)) (* sv-192 64)))) - ; (f0-3 (-> sv-240 x)) - ; (f1-0 (-> sv-240 y)) - ; (f2-0 (-> sv-240 z)) - ; (f3-0 (-> (the-as vector v1-29) x)) - ; (f4-0 (-> (the-as vector v1-29) y)) - ; (f5-0 (-> (the-as vector v1-29) z)) - ) - ; (.mula.s f0-3 f3-0) - ; (.madda.s f1-0 f4-0) - ; (.madd.s f0-4 f2-0 f5-0) - (set! f0-4 (vector-dot sv-240 v1-29)) + (let ((v1-21 (the-as bt-gun-manager (handle->process (-> this child-turret))))) + (quaternion-copy! sv-224 (-> v1-21 cam-quat)) ) - (when (< f30-0 (t9-6 f0-4)) - (let ((v1-33 (bt-hellcat-method-50 this arg0 (-> this root quat) (the-as vector #f) (the-as vector #f)))) - (let ((a0-25 (-> s0-0 owner))) - (set! (-> s0-0 owner) (the-as handle #f)) - (set! (-> this spots v1-33 owner) a0-25) + (vector-z-quaternion! sv-240 sv-224) + (let ((a0-14 sv-240)) + (vector-copy! a0-14 sv-240) + (set! (-> a0-14 y) 0.0) + (vector-normalize! a0-14 1.0) + ) + (acos (vector-dot sv-240 (the-as vector (+ (the-as uint (-> this spots 0 offset-dir)) (* sv-192 64))))) + (let ((f30-0 4551.1113) + (t9-6 acos) + ) + (let* ((v1-29 (the-as object (+ (the-as uint (-> this spots 0 offset-dir)) (* sv-192 64))))) + (set! f0-4 (vector-dot sv-240 (the-as vector v1-29))) + ) + (when (< f30-0 (t9-6 f0-4)) + (let ((v1-33 (bt-hellcat-method-50 this arg0 (-> this root quat) (the-as vector #f) (the-as vector #f)))) + (let ((a0-25 (-> s0-0 owner))) + (set! (-> s0-0 owner) (the-as handle #f)) + (set! (-> this spots v1-33 owner) a0-25) + ) + (set! s0-0 (-> this spots v1-33)) ) - (set! s0-0 (-> this spots v1-33)) ) ) ) ) (let ((v1-38 (handle->process (-> this child-turret)))) (when v1-38 - (let ((s3-1 matrix-u-f-compose)) - (set! sv-256 (new 'stack-no-clear 'matrix)) - (let* ((a1-15 (vector-y-quaternion! (new 'stack-no-clear 'vector) (the-as quaternion (&-> v1-38 stack 4064)))) - (a2-3 (-> s0-0 offset-dir)) - (a1-16 (s3-1 sv-256 a1-15 a2-3)) - ) - (matrix->quaternion arg2 a1-16) - ) + (let ((a1-16 (matrix-u-f-compose + (new 'stack-no-clear 'matrix) + (vector-y-quaternion! (new 'stack-no-clear 'vector) (the-as quaternion (&-> v1-38 stack 4064))) + (-> s0-0 offset-dir) + ) + ) + ) + (matrix->quaternion arg2 a1-16) ) (quaternion-rotate-local-x! arg2 arg2 (/ (-> this roll-amount) 2)) ) @@ -1237,12 +1218,12 @@ (vector-! s1-0 s2-0 (-> this root trans)) (vector+! arg1 arg1 s1-0) ) + (quaternion-rotate-local-x! arg2 arg2 (-> s0-0 y-rot)) ) - (quaternion-rotate-local-x! arg2 arg2 (-> s0-0 y-rot)) + (return 0) ) - (return 0) + (+! sv-192 1) ) - (set! sv-192 (+ sv-192 1)) ) 0 ) @@ -1547,20 +1528,8 @@ ;; WARN: Return type mismatch symbol vs none. ;; ERROR: Function may read a register that is not set: s4 (defmethod bt-gun-manager-method-19 ((this bt-gun-manager)) - (local-vars - (v1-17 symbol) - ;; og:preserve-this - (s4-0 object) - (f28-0 float) - (f30-0 float) - (sv-64 vector) - (sv-68 bt-hud-target-pers) - (sv-96 vector) - (sv-100 vector) - (sv-112 process) - (sv-128 vector) - (sv-144 vector) - ) + ;; og:preserve-this symbol -> object + (local-vars (v1-17 symbol) (s4-0 object) (f28-0 float) (f30-0 float) (sv-112 process)) (bt-gun-manager-method-23 this) (set! (-> this hud-target tid) (the-as @@ -1590,42 +1559,32 @@ (s1-1 (+ (-> this num-onscreen-targets) -1)) ) (while (>= s1-1 s2-1) - (set! sv-128 (new 'stack-no-clear 'vector)) - (let ((s0-1 transform-point-vector!)) - (set! sv-144 sv-128) - (let ((v1-15 (-> this onscreen-targets s2-1 hand))) - (set! s4-0 (and (nonzero? (l32-false-check v1-15)) (begin - (set! sv-112 (the-as process s4-0)) - (let ((a0-15 (-> v1-15 process 0))) - (set! v1-17 (when (= (-> v1-15 pid) (-> a0-15 pid)) - (set! sv-112 (the-as process v1-17)) - (set! sv-112 a0-15) - v1-17 - ) - ) - ) - sv-112 - s4-0 - ) - ) - ) - ) - (let ((a1-9 (get-trans - (the-as process-focusable (if (type? sv-112 process-focusable) - (the-as process-focusable sv-112) - ) - ) - 3 - ) - ) + (let ((sv-128 (new 'stack-no-clear 'vector))) + (let ((s0-1 transform-point-vector!) + (sv-144 sv-128) ) - (s0-1 sv-144 a1-9) - ) - ) - (let ((t9-9 vector-vector-distance) - (a1-10 s3-0) + (let ((v1-15 (-> this onscreen-targets s2-1 hand))) + (set! s4-0 (and (nonzero? (l32-false-check v1-15)) (begin + (set! sv-112 (the-as process s4-0)) + (let ((a0-15 (-> v1-15 process 0))) + (set! v1-17 (when (= (-> v1-15 pid) (-> a0-15 pid)) + (set! sv-112 (the-as process v1-17)) + (set! sv-112 a0-15) + v1-17 + ) + ) + ) + sv-112 + s4-0 + ) + ) + ) ) - (when (< (t9-9 sv-128 a1-10) (+ (-> this onscreen-targets s5-0 size) (-> this onscreen-targets s2-1 size))) + (s0-1 sv-144 (get-trans (the-as process-focusable (as-type sv-112 process-focusable)) 3)) + ) + (when (< (vector-vector-distance sv-128 s3-0) + (+ (-> this onscreen-targets s5-0 size) (-> this onscreen-targets s2-1 size)) + ) (+! (-> this onscreen-targets s5-0 num-overlap) 1) (+! (-> this onscreen-targets s2-1 num-overlap) 1) ) @@ -1636,107 +1595,111 @@ ) ) (dotimes (s5-1 (-> this num-onscreen-targets)) - (set! sv-64 (new 'stack-no-clear 'vector)) - (set! sv-68 (-> this hud-pers (-> this onscreen-targets s5-1 target-pers-index))) - (when (and (< (-> this onscreen-targets s5-1 size) 256.0) - (!= (-> (handle->process (-> this onscreen-targets s5-1 hand)) type) bt-barrel) - ) - (set! sv-96 (new 'stack-no-clear 'vector)) - (set! sv-100 - (get-trans - (the-as process-focusable (as-type (handle->process (-> this onscreen-targets s5-1 hand)) process-focusable)) - 3 - ) - ) - (transform-point-vector! sv-96 sv-100) - (+! (-> sv-96 x) -1792.0) - (+! (-> sv-96 y) -1840.0) - (when (and (>= (-> sv-96 x) 0.0) (>= 2048.0 (-> sv-96 x)) (>= (-> sv-96 y) 0.0) (>= 2048.0 (-> sv-96 y))) - (cond - ((-> this onscreen-targets s5-1 hit?) - (seek! (-> sv-68 rotate) 16384.0 (* 65536.0 (seconds-per-frame))) - (seek! (-> sv-68 size-scalar) 1.0 (* 16.0 (seconds-per-frame))) - (set! (-> sv-68 alpha) 1.0) - ) - (else - (seek! (-> sv-68 size-scalar) 4.0 (* 8.0 (seconds-per-frame))) - (seek! (-> sv-68 rotate) 0.0 (* 65536.0 (seconds-per-frame))) - (seek! (-> sv-68 alpha) 0.0 (* 3.0 (seconds-per-frame))) - (set! (-> sv-68 outer-rotate) (- (-> sv-68 outer-rotate) (* 32768.0 (seconds-per-frame)))) - ) - ) - 0.0 - 0.0 - (set! f28-0 (cond - ((-> this onscreen-targets s5-1 hit?) - (set! (-> this hud-target color x) 127) - (set! (-> this hud-target color y) 75) - (set! (-> this hud-target color z) 0) - (set! f30-0 (* 80.0 (-> this onscreen-targets s5-1 alpha))) - (set! (-> this hud-target-inner color x) 127) - (set! (-> this hud-target-inner color y) 40) - (set! (-> this hud-target-inner color z) 0) - (set! f28-0 (* 80.0 (-> this onscreen-targets s5-1 alpha))) - (when (= (current-time) (-> sv-68 hold-start-time)) - (set! (-> this hud-target color x) 128) - (set! (-> this hud-target color y) 128) - (set! (-> this hud-target color z) 128) - (set! f30-0 64.0) - (set! (-> this hud-target-inner color x) 255) - (set! (-> this hud-target-inner color y) 0) - (set! (-> this hud-target-inner color z) 0) - (set! f28-0 64.0) - ) - f28-0 - ) - (else - (set! (-> this hud-target color x) 127) - (set! (-> this hud-target color y) 40) - (set! (-> this hud-target color z) 0) - (set! f30-0 (* 45.0 (-> this onscreen-targets s5-1 alpha))) - (* 80.0 (-> sv-68 alpha) (-> this onscreen-targets s5-1 alpha)) - ) - ) - ) - (let ((f0-40 (vector-vector-distance sv-100 (camera-pos)))) - 0.0 - (let* ((f0-41 (lerp-scale-clamp 1.0 0.1 f0-40 327680.0 819200.0)) - (f1-22 (* f30-0 f0-41)) - (f0-42 (* f28-0 f0-41)) + (let ((sv-64 (new 'stack-no-clear 'vector))) + ) + (let ((sv-68 (-> this hud-pers (-> this onscreen-targets s5-1 target-pers-index)))) + (when (and (< (-> this onscreen-targets s5-1 size) 256.0) + (!= (-> (handle->process (-> this onscreen-targets s5-1 hand)) type) bt-barrel) ) - (set! (-> this hud-target color w) (the int f1-22)) - (set! (-> this hud-target-inner color w) (the int f0-42)) - ) - ) - (set! (-> this hud-target angle) 0.0) - (set! (-> this hud-target flags) (hud-sprite-flags hsf3)) - (set! (-> this hud-target-inner flags) (hud-sprite-flags hsf3)) - (let* ((f0-46 (/ (-> this onscreen-targets s5-1 size) 32)) - (f0-48 (fmax 0.4 (fmin 2.0 f0-46))) - (f0-49 (* 2.0 f0-48)) + (let ((sv-96 (new 'stack-no-clear 'vector)) + (sv-100 + (get-trans + (the-as process-focusable (as-type (handle->process (-> this onscreen-targets s5-1 hand)) process-focusable)) + 3 + ) + ) + ) + (transform-point-vector! sv-96 sv-100) + (+! (-> sv-96 x) -1792.0) + (+! (-> sv-96 y) -1840.0) + (when (and (>= (-> sv-96 x) 0.0) (>= 2048.0 (-> sv-96 x)) (>= (-> sv-96 y) 0.0) (>= 2048.0 (-> sv-96 y))) + (cond + ((-> this onscreen-targets s5-1 hit?) + (seek! (-> sv-68 rotate) 16384.0 (* 65536.0 (seconds-per-frame))) + (seek! (-> sv-68 size-scalar) 1.0 (* 16.0 (seconds-per-frame))) + (set! (-> sv-68 alpha) 1.0) ) - (set! (-> this hud-target scale-x) f0-49) - (set! (-> this hud-target scale-y) f0-49) - (set! (-> this hud-target-inner scale-x) (* (-> sv-68 size-scalar) f0-49)) - (set! (-> this hud-target-inner scale-y) (* (-> sv-68 size-scalar) f0-49)) - ) - (set! (-> this hud-target pos x) (the int (the float (the int (-> sv-96 x))))) - (set! (-> this hud-target pos y) (the int (the float (the int (-> sv-96 y))))) - (set! (-> this hud-target pos z) 0) - (set! (-> this hud-target-inner pos x) (the int (the float (the int (-> sv-96 x))))) - (set! (-> this hud-target-inner pos y) (the int (the float (the int (-> sv-96 y))))) - (set! (-> this hud-target-inner pos z) 0) - (set! (-> this hud-target-inner angle) (-> sv-68 rotate)) - (set! (-> this hud-target angle) (-> sv-68 outer-rotate)) - (with-dma-buffer-add-bucket ((s3-2 (-> *display* frames (-> *display* on-screen) global-buf)) - (bucket-id hud-draw-hud-alpha) - ) - (draw (-> this hud-target) s3-2 (-> *level* level-default) #f) - ) - (with-dma-buffer-add-bucket ((s3-3 (-> *display* frames (-> *display* on-screen) global-buf)) - (bucket-id hud-draw-hud-alpha) - ) - (draw (-> this hud-target-inner) s3-3 (-> *level* level-default) #f) + (else + (seek! (-> sv-68 size-scalar) 4.0 (* 8.0 (seconds-per-frame))) + (seek! (-> sv-68 rotate) 0.0 (* 65536.0 (seconds-per-frame))) + (seek! (-> sv-68 alpha) 0.0 (* 3.0 (seconds-per-frame))) + (set! (-> sv-68 outer-rotate) (- (-> sv-68 outer-rotate) (* 32768.0 (seconds-per-frame)))) + ) + ) + 0.0 + 0.0 + (set! f28-0 (cond + ((-> this onscreen-targets s5-1 hit?) + (set! (-> this hud-target color x) 127) + (set! (-> this hud-target color y) 75) + (set! (-> this hud-target color z) 0) + (set! f30-0 (* 80.0 (-> this onscreen-targets s5-1 alpha))) + (set! (-> this hud-target-inner color x) 127) + (set! (-> this hud-target-inner color y) 40) + (set! (-> this hud-target-inner color z) 0) + (set! f28-0 (* 80.0 (-> this onscreen-targets s5-1 alpha))) + (when (= (current-time) (-> sv-68 hold-start-time)) + (set! (-> this hud-target color x) 128) + (set! (-> this hud-target color y) 128) + (set! (-> this hud-target color z) 128) + (set! f30-0 64.0) + (set! (-> this hud-target-inner color x) 255) + (set! (-> this hud-target-inner color y) 0) + (set! (-> this hud-target-inner color z) 0) + (set! f28-0 64.0) + ) + f28-0 + ) + (else + (set! (-> this hud-target color x) 127) + (set! (-> this hud-target color y) 40) + (set! (-> this hud-target color z) 0) + (set! f30-0 (* 45.0 (-> this onscreen-targets s5-1 alpha))) + (* 80.0 (-> sv-68 alpha) (-> this onscreen-targets s5-1 alpha)) + ) + ) + ) + (let ((f0-40 (vector-vector-distance sv-100 (camera-pos)))) + 0.0 + (let* ((f0-41 (lerp-scale-clamp 1.0 0.1 f0-40 327680.0 819200.0)) + (f1-22 (* f30-0 f0-41)) + (f0-42 (* f28-0 f0-41)) + ) + (set! (-> this hud-target color w) (the int f1-22)) + (set! (-> this hud-target-inner color w) (the int f0-42)) + ) + ) + (set! (-> this hud-target angle) 0.0) + (set! (-> this hud-target flags) (hud-sprite-flags hsf3)) + (set! (-> this hud-target-inner flags) (hud-sprite-flags hsf3)) + (let* ((f0-46 (/ (-> this onscreen-targets s5-1 size) 32)) + (f0-48 (fmax 0.4 (fmin 2.0 f0-46))) + (f0-49 (* 2.0 f0-48)) + ) + (set! (-> this hud-target scale-x) f0-49) + (set! (-> this hud-target scale-y) f0-49) + (set! (-> this hud-target-inner scale-x) (* (-> sv-68 size-scalar) f0-49)) + (set! (-> this hud-target-inner scale-y) (* (-> sv-68 size-scalar) f0-49)) + ) + (set! (-> this hud-target pos x) (the int (the float (the int (-> sv-96 x))))) + (set! (-> this hud-target pos y) (the int (the float (the int (-> sv-96 y))))) + (set! (-> this hud-target pos z) 0) + (set! (-> this hud-target-inner pos x) (the int (the float (the int (-> sv-96 x))))) + (set! (-> this hud-target-inner pos y) (the int (the float (the int (-> sv-96 y))))) + (set! (-> this hud-target-inner pos z) 0) + (set! (-> this hud-target-inner angle) (-> sv-68 rotate)) + (set! (-> this hud-target angle) (-> sv-68 outer-rotate)) + (with-dma-buffer-add-bucket ((s3-2 (-> *display* frames (-> *display* on-screen) global-buf)) + (bucket-id hud-draw-hud-alpha) + ) + (draw (-> this hud-target) s3-2 (-> *level* level-default) #f) + ) + (with-dma-buffer-add-bucket ((s3-3 (-> *display* frames (-> *display* on-screen) global-buf)) + (bucket-id hud-draw-hud-alpha) + ) + (draw (-> this hud-target-inner) s3-3 (-> *level* level-default) #f) + ) + ) ) ) ) @@ -1813,6 +1776,7 @@ ;; (if (-> *setting-control* cam-current flip-vertical) ;; (set! f30-0 (* -1.0 f30-0)) ;; ) + ;; og:preserve-this (set! (-> this rotyv) (analog-input-horizontal-first (the-as int (-> *cpad-list* cpads 0 leftx)) 128.0 32.0 120.0 1.0)) (set! (-> this rotxv) (* f30-0 (analog-input-vertical-first (the-as int (-> *cpad-list* cpads 0 lefty)) 128.0 32.0 120.0 1.0)) @@ -1832,12 +1796,9 @@ 0.0 (let* ((f1-10 (/ (fabs f1-8) f0-4)) (f2-3 (/ (fabs f2-1) (* 1.2307693 f0-4))) - (f0-6 (* f1-10 f1-10)) - (f28-0 (* f2-3 f2-3)) - (f1-11 f28-0) - (f1-13 (* f1-11 f1-11)) - (f2-4 f0-6) - (f30-1 (sqrtf (+ f1-13 (* f2-4 f2-4)))) + (f0-6 (square f1-10)) + (f28-0 (square f2-3)) + (f30-1 (sqrtf (+ (square f28-0) (square f0-6)))) ) (let ((f26-0 0.0) (f24-0 0.0) @@ -1986,52 +1947,53 @@ ) (defmethod bt-gun-manager-method-18 ((this bt-gun-manager) (arg0 float)) - (local-vars (sv-80 vector) (sv-84 vector) (sv-88 vector) (sv-92 vector)) (let ((s5-0 (new 'stack-no-clear 'vector))) (set! (-> s5-0 x) (lerp 0.0 512.0 (-> this roty))) (set! (-> s5-0 y) (lerp 0.0 416.0 (-> this rotx))) (set! (-> s5-0 z) 0.0) (set! (-> s5-0 w) 1.0) - (set! sv-80 s5-0) - ) - (set! sv-84 (new 'stack-no-clear 'vector)) - (set! sv-88 (new 'stack-no-clear 'vector)) - (set! sv-92 (new 'stack-no-clear 'vector)) - (set! (-> this hud-aim pos x) (the int (-> sv-80 x))) - (set! (-> this hud-aim pos y) (the int (-> sv-80 y))) - (set! (-> this hud-aim pos z) 0) - (set! (-> this hud-aim flags) (hud-sprite-flags hsf3)) - (set! (-> this hud-aim scale-x) 1.0) - (set! (-> this hud-aim scale-y) 1.0) - (let ((v1-9 (-> this hud-aim color-ptr))) - (set! (-> v1-9 0) 231) - (set! (-> v1-9 1) 168) - (set! (-> v1-9 2) 0) - (set! (-> v1-9 3) 128) - ) - (set! (-> this hud-aim tid) - (the-as - texture-id - (lookup-texture-by-name "hud-target-reticle" (the-as string #f) (the-as (pointer texture-page) #f)) + (let ((sv-80 s5-0) + (sv-84 (new 'stack-no-clear 'vector)) + (sv-88 (new 'stack-no-clear 'vector)) + (sv-92 (new 'stack-no-clear 'vector)) ) + (set! (-> this hud-aim pos x) (the int (-> sv-80 x))) + (set! (-> this hud-aim pos y) (the int (-> sv-80 y))) + (set! (-> this hud-aim pos z) 0) + (set! (-> this hud-aim flags) (hud-sprite-flags hsf3)) + (set! (-> this hud-aim scale-x) 1.0) + (set! (-> this hud-aim scale-y) 1.0) + (let ((v1-9 (-> this hud-aim color-ptr))) + (set! (-> v1-9 0) 231) + (set! (-> v1-9 1) 168) + (set! (-> v1-9 2) 0) + (set! (-> v1-9 3) 128) ) - (with-dma-buffer-add-bucket ((s4-0 (-> *display* frames (-> *display* on-screen) global-buf)) - (bucket-id hud-draw-hud-alpha) - ) - (draw (-> this hud-aim) s4-0 (-> *level* level-default) #f) + (set! (-> this hud-aim tid) + (the-as + texture-id + (lookup-texture-by-name "hud-target-reticle" (the-as string #f) (the-as (pointer texture-page) #f)) + ) + ) + (with-dma-buffer-add-bucket ((s4-0 (-> *display* frames (-> *display* on-screen) global-buf)) + (bucket-id hud-draw-hud-alpha) + ) + (draw (-> this hud-aim) s4-0 (-> *level* level-default) #f) + ) + (send-event (handle->process (-> this parent-vehicle)) 'get-turret-pos sv-88 sv-84) + (vector+float*! sv-88 (camera-pos) (-> (camera-matrix) fvec) 40960.0) + (+! (-> sv-80 x) -256.0) + (+! (-> sv-80 y) -208.0) + (reverse-transform-point! + sv-92 + sv-88 + (vector-float*! (new 'stack-no-clear 'vector) (-> (camera-matrix) fvec) 1.0) + sv-80 + ) + (vector-copy! (-> this aim-pos) sv-92) + (vector-! (-> this aim-dir) sv-92 (-> this root trans)) + ) ) - (send-event (handle->process (-> this parent-vehicle)) 'get-turret-pos sv-88 sv-84) - (vector+float*! sv-88 (camera-pos) (-> (camera-matrix) fvec) 40960.0) - (+! (-> sv-80 x) -256.0) - (+! (-> sv-80 y) -208.0) - (reverse-transform-point! - sv-92 - sv-88 - (vector-float*! (new 'stack-no-clear 'vector) (-> (camera-matrix) fvec) 1.0) - sv-80 - ) - (vector-copy! (-> this aim-pos) sv-92) - (vector-! (-> this aim-dir) sv-92 (-> this root trans)) (vector-normalize! (-> this aim-dir) 1.0) (quaternion-look-at! (-> this root quat) (-> this aim-dir) *up-vector*) (blow-tower-path-cursor-method-9 @@ -2102,8 +2064,7 @@ ) (let* ((f0-24 (vector-dot s4-12 s2-2)) (f0-25 (+ 1.0 f0-24)) - (f0-26 (/ f0-25 2)) - (f0-27 (* f0-26 f0-26)) + (f0-27 (square (/ f0-25 2))) (f0-28 (lerp 0.0 2.0 f0-27)) (f30-0 (fmax 0.3 (fmin 2.0 f0-28))) ) @@ -2455,344 +2416,326 @@ ) (defmethod find-target ((this bt-gun-manager)) - (local-vars - (sv-16 float) - (sv-20 process-drawable) - (sv-24 int) - (sv-32 process-drawable) - (sv-80 vector) - (sv-84 vector) - (sv-88 float) - (sv-128 vector) - (sv-132 vector) - (sv-136 float) - (sv-208 vector) - (sv-212 vector) - (sv-216 vector) - (sv-220 vector) - (sv-224 float) - (sv-228 bt-gun-manager-target) - (sv-784 process-drawable) - (sv-832 vector) - (sv-836 vector) - (sv-840 float) - (sv-880 vector) - (sv-884 vector) - (sv-888 float) - (sv-960 vector) - (sv-964 vector) - (sv-968 vector) - (sv-972 vector) - (sv-976 float) - (sv-980 bt-gun-manager-target) - (sv-1536 process-drawable) - (sv-1584 vector) - (sv-1588 vector) - (sv-1592 float) - (sv-1632 vector) - (sv-1636 vector) - (sv-1640 float) - (sv-1712 vector) - (sv-1716 vector) - (sv-1720 vector) - (sv-1724 vector) - (sv-1728 float) - (sv-1732 bt-gun-manager-target) - ) (set! (-> this num-onscreen-targets) 0) - (set! sv-16 (the-as float 18.0)) - (set! sv-20 (the-as process-drawable #f)) - (set! sv-24 -1) - (when #f - (let ((v1-4 (-> *collide-player-list* alive-list next0))) - *collide-player-list* - (let ((s5-0 (-> v1-4 next0))) - (while (!= v1-4 (-> *collide-player-list* alive-list-end)) - (let* ((v1-5 (the-as collide-shape (-> (the-as connection v1-4) param1))) - (s4-0 (-> v1-5 root-prim)) - ) - (when (logtest? (-> s4-0 prim-core collide-as) (collide-spec enemy obstacle hit-by-others-list)) - (set! sv-32 (as-type (-> v1-5 process) process-focusable)) - (when (and sv-32 - (< (-> this num-onscreen-targets) 32) - (not (logtest? (-> (the-as process-focusable sv-32) focus-status) (focus-status disable dead ignore inactive)) - ) - ) - (let ((s3-1 (new 'stack-no-clear 'vector))) - (vector-copy! s3-1 (get-trans (the-as process-focusable sv-32) 3)) - (set! sv-80 s3-1) - ) - (set! sv-84 (new 'stack-no-clear 'vector)) - (set! sv-88 (the-as float 0.0)) - (set! sv-88 (vector-vector-distance (-> this root trans) sv-80)) - (vector-! sv-84 sv-80 (camera-pos)) - (when (and (< 1.0 (vector-dot sv-84 (-> (camera-matrix) fvec))) (< sv-88 819200.0)) - (set! sv-128 (new 'stack-no-clear 'vector)) - (set! sv-132 (vector+float*! (new 'stack-no-clear 'vector) (-> this root trans) (-> this aim-dir) 40960.0)) - (set! sv-136 (the-as float 0.0)) - (set-vector! sv-132 (lerp 0.0 512.0 (-> this roty)) (lerp 0.0 416.0 (-> this rotx)) 0.0 1.0) - (+! (-> sv-132 x) -256.0) - (+! (-> sv-132 y) -208.0) - (+! (-> sv-132 x) 2048.0) - (+! (-> sv-132 y) 2048.0) - (transform-point-vector! sv-128 sv-80) - (set! (-> sv-128 z) 0.0) - (set! sv-208 (new 'stack-no-clear 'vector)) - (set! sv-212 (new 'stack-no-clear 'vector)) - (set! sv-216 (new 'stack-no-clear 'vector)) - (set! sv-220 (new 'stack-no-clear 'vector)) - (vector+float*! sv-208 sv-80 (-> (camera-matrix) rvec) (* 0.6 (-> s4-0 prim-core world-sphere w))) - (vector+float*! sv-212 sv-80 (-> (camera-matrix) rvec) (* 0.6 (- (-> s4-0 prim-core world-sphere w)))) - (transform-point-vector! sv-216 sv-208) - (transform-point-vector! sv-220 sv-212) - (set! (-> sv-216 z) 0.0) - (set! (-> sv-220 z) 0.0) - (set! sv-224 (* 0.5 (vector-vector-distance sv-216 sv-220))) - (set! sv-228 (-> this onscreen-targets (-> this num-onscreen-targets))) - (set! sv-136 (vector-vector-distance sv-132 sv-128)) - (set! sv-136 (- sv-136 sv-224)) - (let ((a1-11 (new 'stack-no-clear 'collide-query))) - (vector-copy! (-> a1-11 start-pos) (-> this root trans)) - (vector-! (-> a1-11 move-dist) sv-80 (-> a1-11 start-pos)) - (let ((v1-57 a1-11)) - (set! (-> v1-57 radius) 40.96) - (set! (-> v1-57 collide-with) (collide-spec backgnd)) - (set! (-> v1-57 ignore-process0) #f) - (set! (-> v1-57 ignore-process1) #f) - (set! (-> v1-57 ignore-pat) - (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) - ) - (set! (-> v1-57 action-mask) (collide-action solid)) - ) - (when (< (fill-and-probe-using-line-sphere *collide-cache* a1-11) 0.0) - (when (< sv-136 sv-16) - (set! sv-20 sv-32) - (set! sv-16 sv-136) - (vector-copy! (-> this hit-pos) sv-80) - (set! sv-24 (-> this num-onscreen-targets)) - ) - (transform-point-qword! (-> sv-228 transformed-pos) sv-80) - (set! (-> sv-228 hit?) #f) - (set! (-> sv-228 hand) (process->handle sv-32)) - (set! (-> sv-228 size) sv-224) - (set! (-> sv-228 alpha) (lerp-scale-clamp 0.0 1.0 sv-88 20480.0 61440.0)) - (+! (-> this num-onscreen-targets) 1) - ) - ) - ) - ) - ) - ) - (set! v1-4 s5-0) - *collide-player-list* - (set! s5-0 (-> s5-0 next0)) - ) + (let ((sv-16 (the-as float 18.0)) + (sv-20 (the-as process-drawable #f)) + (sv-24 -1) ) - ) - ) - (when #t (when #f - (let ((v1-80 (-> *collide-hit-by-player-list* alive-list next0))) - *collide-hit-by-player-list* - (let ((s5-1 (-> v1-80 next0))) - (while (!= v1-80 (-> *collide-hit-by-player-list* alive-list-end)) - (let* ((v1-81 (the-as collide-shape (-> (the-as connection v1-80) param1))) - (s4-1 (-> v1-81 root-prim)) + (let ((v1-4 (-> *collide-player-list* alive-list next0))) + *collide-player-list* + (let ((s5-0 (-> v1-4 next0))) + (while (!= v1-4 (-> *collide-player-list* alive-list-end)) + (let* ((v1-5 (the-as collide-shape (-> (the-as connection v1-4) param1))) + (s4-0 (-> v1-5 root-prim)) ) - (when (logtest? (-> s4-1 prim-core collide-as) (collide-spec enemy obstacle hit-by-others-list)) - (set! sv-784 (as-type (-> v1-81 process) process-focusable)) - (when (and sv-784 - (< (-> this num-onscreen-targets) 32) - (not (logtest? (-> (the-as process-focusable sv-784) focus-status) (focus-status disable dead ignore inactive)) + (when (logtest? (-> s4-0 prim-core collide-as) (collide-spec enemy obstacle hit-by-others-list)) + (let ((sv-32 (as-type (-> v1-5 process) process-focusable))) + (when (and sv-32 + (< (-> this num-onscreen-targets) 32) + (not (logtest? (-> (the-as process-focusable sv-32) focus-status) (focus-status disable dead ignore inactive)) + ) + ) + (let ((s3-1 (new 'stack-no-clear 'vector))) + (vector-copy! s3-1 (get-trans (the-as process-focusable sv-32) 3)) + (let ((sv-80 s3-1) + (sv-84 (new 'stack-no-clear 'vector)) + (sv-88 (the-as float 0.0)) + ) + (set! sv-88 (vector-vector-distance (-> this root trans) sv-80)) + (vector-! sv-84 sv-80 (camera-pos)) + (when (and (< 1.0 (vector-dot sv-84 (-> (camera-matrix) fvec))) (< sv-88 819200.0)) + (let ((sv-128 (new 'stack-no-clear 'vector)) + (sv-132 (vector+float*! (new 'stack-no-clear 'vector) (-> this root trans) (-> this aim-dir) 40960.0)) + (sv-136 (the-as float 0.0)) + ) + (set-vector! sv-132 (lerp 0.0 512.0 (-> this roty)) (lerp 0.0 416.0 (-> this rotx)) 0.0 1.0) + (+! (-> sv-132 x) -256.0) + (+! (-> sv-132 y) -208.0) + (+! (-> sv-132 x) 2048.0) + (+! (-> sv-132 y) 2048.0) + (transform-point-vector! sv-128 sv-80) + (set! (-> sv-128 z) 0.0) + (let ((sv-208 (new 'stack-no-clear 'vector)) + (sv-212 (new 'stack-no-clear 'vector)) + (sv-216 (new 'stack-no-clear 'vector)) + (sv-220 (new 'stack-no-clear 'vector)) + ) + (vector+float*! sv-208 sv-80 (-> (camera-matrix) rvec) (* 0.6 (-> s4-0 prim-core world-sphere w))) + (vector+float*! sv-212 sv-80 (-> (camera-matrix) rvec) (* 0.6 (- (-> s4-0 prim-core world-sphere w)))) + (transform-point-vector! sv-216 sv-208) + (transform-point-vector! sv-220 sv-212) + (set! (-> sv-216 z) 0.0) + (set! (-> sv-220 z) 0.0) + (let ((sv-224 (* 0.5 (vector-vector-distance sv-216 sv-220))) + (sv-228 (-> this onscreen-targets (-> this num-onscreen-targets))) + ) + (set! sv-136 (- (vector-vector-distance sv-132 sv-128) sv-224)) + (let ((a1-11 (new 'stack-no-clear 'collide-query))) + (vector-copy! (-> a1-11 start-pos) (-> this root trans)) + (vector-! (-> a1-11 move-dist) sv-80 (-> a1-11 start-pos)) + (let ((v1-57 a1-11)) + (set! (-> v1-57 radius) 40.96) + (set! (-> v1-57 collide-with) (collide-spec backgnd)) + (set! (-> v1-57 ignore-process0) #f) + (set! (-> v1-57 ignore-process1) #f) + (set! (-> v1-57 ignore-pat) + (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) + ) + (set! (-> v1-57 action-mask) (collide-action solid)) + ) + (when (< (fill-and-probe-using-line-sphere *collide-cache* a1-11) 0.0) + (when (< sv-136 sv-16) + (set! sv-20 sv-32) + (set! sv-16 sv-136) + (vector-copy! (-> this hit-pos) sv-80) + (set! sv-24 (-> this num-onscreen-targets)) + ) + (transform-point-qword! (-> sv-228 transformed-pos) sv-80) + (set! (-> sv-228 hit?) #f) + (set! (-> sv-228 hand) (process->handle sv-32)) + (set! (-> sv-228 size) sv-224) + (set! (-> sv-228 alpha) (lerp-scale-clamp 0.0 1.0 sv-88 20480.0 61440.0)) + (+! (-> this num-onscreen-targets) 1) + ) + ) ) - ) - (let ((s3-10 (new 'stack-no-clear 'vector))) - (vector-copy! s3-10 (get-trans (the-as process-focusable sv-784) 3)) - (set! sv-832 s3-10) - ) - (set! sv-836 (new 'stack-no-clear 'vector)) - (set! sv-840 (the-as float 0.0)) - (set! sv-840 (vector-vector-distance (-> this root trans) sv-832)) - (vector-! sv-836 sv-832 (camera-pos)) - (when (and (< 1.0 (vector-dot sv-836 (-> (camera-matrix) fvec))) (< sv-840 819200.0)) - (set! sv-880 (new 'stack-no-clear 'vector)) - (set! sv-884 (vector+float*! (new 'stack-no-clear 'vector) (-> this root trans) (-> this aim-dir) 40960.0)) - (set! sv-888 (the-as float 0.0)) - (set-vector! sv-884 (lerp 0.0 512.0 (-> this roty)) (lerp 0.0 416.0 (-> this rotx)) 0.0 1.0) - (+! (-> sv-884 x) -256.0) - (+! (-> sv-884 y) -208.0) - (+! (-> sv-884 x) 2048.0) - (+! (-> sv-884 y) 2048.0) - (transform-point-vector! sv-880 sv-832) - (set! (-> sv-880 z) 0.0) - (set! sv-960 (new 'stack-no-clear 'vector)) - (set! sv-964 (new 'stack-no-clear 'vector)) - (set! sv-968 (new 'stack-no-clear 'vector)) - (set! sv-972 (new 'stack-no-clear 'vector)) - (vector+float*! sv-960 sv-832 (-> (camera-matrix) rvec) (* 0.6 (-> s4-1 prim-core world-sphere w))) - (vector+float*! sv-964 sv-832 (-> (camera-matrix) rvec) (* 0.6 (- (-> s4-1 prim-core world-sphere w)))) - (transform-point-vector! sv-968 sv-960) - (transform-point-vector! sv-972 sv-964) - (set! (-> sv-968 z) 0.0) - (set! (-> sv-972 z) 0.0) - (set! sv-976 (* 0.5 (vector-vector-distance sv-968 sv-972))) - (set! sv-980 (-> this onscreen-targets (-> this num-onscreen-targets))) - (set! sv-888 (vector-vector-distance sv-884 sv-880)) - (set! sv-888 (- sv-888 sv-976)) - (let ((a1-25 (new 'stack-no-clear 'collide-query))) - (vector-copy! (-> a1-25 start-pos) (-> this root trans)) - (vector-! (-> a1-25 move-dist) sv-832 (-> a1-25 start-pos)) - (let ((v1-133 a1-25)) - (set! (-> v1-133 radius) 40.96) - (set! (-> v1-133 collide-with) (collide-spec backgnd)) - (set! (-> v1-133 ignore-process0) #f) - (set! (-> v1-133 ignore-process1) #f) - (set! (-> v1-133 ignore-pat) - (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) ) - (set! (-> v1-133 action-mask) (collide-action solid)) - ) - (when (< (fill-and-probe-using-line-sphere *collide-cache* a1-25) 0.0) - (when (< sv-888 sv-16) - (set! sv-20 sv-784) - (set! sv-16 sv-888) - (vector-copy! (-> this hit-pos) sv-832) - (set! sv-24 (-> this num-onscreen-targets)) + ) ) - (transform-point-qword! (-> sv-980 transformed-pos) sv-832) - (set! (-> sv-980 hit?) #f) - (set! (-> sv-980 hand) (process->handle sv-784)) - (set! (-> sv-980 size) sv-976) - (set! (-> sv-980 alpha) (lerp-scale-clamp 0.0 1.0 sv-840 20480.0 61440.0)) - (+! (-> this num-onscreen-targets) 1) ) ) ) ) ) ) - (set! v1-80 s5-1) - *collide-hit-by-player-list* - (set! s5-1 (-> s5-1 next0)) + (set! v1-4 s5-0) + *collide-player-list* + (set! s5-0 (-> s5-0 next0)) ) ) ) ) (when #t - (let ((v1-155 (-> *collide-hit-by-others-list* alive-list next0))) - *collide-hit-by-others-list* - (let ((s5-2 (-> v1-155 next0))) - (while (!= v1-155 (-> *collide-hit-by-others-list* alive-list-end)) - (let* ((v1-156 (the-as collide-shape (-> (the-as connection v1-155) param1))) - (s4-2 (-> v1-156 root-prim)) - ) - (when (logtest? (-> s4-2 prim-core collide-as) (collide-spec enemy obstacle hit-by-others-list)) - (set! sv-1536 (as-type (-> v1-156 process) process-focusable)) - (when (and sv-1536 - (< (-> this num-onscreen-targets) 32) - (not (logtest? (-> (the-as process-focusable sv-1536) focus-status) (focus-status disable dead ignore inactive)) - ) - ) - (let ((s3-19 (new 'stack-no-clear 'vector))) - (vector-copy! s3-19 (get-trans (the-as process-focusable sv-1536) 3)) - (set! sv-1584 s3-19) - ) - (set! sv-1588 (new 'stack-no-clear 'vector)) - (set! sv-1592 (the-as float 0.0)) - (set! sv-1592 (vector-vector-distance (-> this root trans) sv-1584)) - (vector-! sv-1588 sv-1584 (camera-pos)) - (when (and (< 1.0 (vector-dot sv-1588 (-> (camera-matrix) fvec))) (< sv-1592 819200.0)) - (set! sv-1632 (new 'stack-no-clear 'vector)) - (set! sv-1636 (vector+float*! (new 'stack-no-clear 'vector) (-> this root trans) (-> this aim-dir) 40960.0)) - (set! sv-1640 (the-as float 0.0)) - (set-vector! sv-1636 (lerp 0.0 512.0 (-> this roty)) (lerp 0.0 416.0 (-> this rotx)) 0.0 1.0) - (+! (-> sv-1636 x) -256.0) - (+! (-> sv-1636 y) -208.0) - (+! (-> sv-1636 x) 2048.0) - (+! (-> sv-1636 y) 2048.0) - (transform-point-vector! sv-1632 sv-1584) - (set! (-> sv-1632 z) 0.0) - (set! sv-1712 (new 'stack-no-clear 'vector)) - (set! sv-1716 (new 'stack-no-clear 'vector)) - (set! sv-1720 (new 'stack-no-clear 'vector)) - (set! sv-1724 (new 'stack-no-clear 'vector)) - (vector+float*! sv-1712 sv-1584 (-> (camera-matrix) rvec) (* 0.6 (-> s4-2 prim-core world-sphere w))) - (vector+float*! sv-1716 sv-1584 (-> (camera-matrix) rvec) (* 0.6 (- (-> s4-2 prim-core world-sphere w)))) - (transform-point-vector! sv-1720 sv-1712) - (transform-point-vector! sv-1724 sv-1716) - (set! (-> sv-1720 z) 0.0) - (set! (-> sv-1724 z) 0.0) - (set! sv-1728 (* 0.5 (vector-vector-distance sv-1720 sv-1724))) - (set! sv-1732 (-> this onscreen-targets (-> this num-onscreen-targets))) - (set! sv-1640 (vector-vector-distance sv-1636 sv-1632)) - (set! sv-1640 (- sv-1640 sv-1728)) - (let ((a1-39 (new 'stack-no-clear 'collide-query))) - (vector-copy! (-> a1-39 start-pos) (-> this root trans)) - (vector-! (-> a1-39 move-dist) sv-1584 (-> a1-39 start-pos)) - (let ((v1-208 a1-39)) - (set! (-> v1-208 radius) 40.96) - (set! (-> v1-208 collide-with) (collide-spec backgnd)) - (set! (-> v1-208 ignore-process0) #f) - (set! (-> v1-208 ignore-process1) #f) - (set! (-> v1-208 ignore-pat) - (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) + (when #f + (let ((v1-80 (-> *collide-hit-by-player-list* alive-list next0))) + *collide-hit-by-player-list* + (let ((s5-1 (-> v1-80 next0))) + (while (!= v1-80 (-> *collide-hit-by-player-list* alive-list-end)) + (let* ((v1-81 (the-as collide-shape (-> (the-as connection v1-80) param1))) + (s4-1 (-> v1-81 root-prim)) + ) + (when (logtest? (-> s4-1 prim-core collide-as) (collide-spec enemy obstacle hit-by-others-list)) + (let ((sv-784 (as-type (-> v1-81 process) process-focusable))) + (when (and sv-784 + (< (-> this num-onscreen-targets) 32) + (not (logtest? (-> (the-as process-focusable sv-784) focus-status) (focus-status disable dead ignore inactive)) + ) + ) + (let ((s3-10 (new 'stack-no-clear 'vector))) + (vector-copy! s3-10 (get-trans (the-as process-focusable sv-784) 3)) + (let ((sv-832 s3-10) + (sv-836 (new 'stack-no-clear 'vector)) + (sv-840 (the-as float 0.0)) ) - (set! (-> v1-208 action-mask) (collide-action solid)) - ) - (when (< (fill-and-probe-using-line-sphere *collide-cache* a1-39) 0.0) - (when (< sv-1640 sv-16) - (set! sv-20 sv-1536) - (set! sv-16 sv-1640) - (vector-copy! (-> this hit-pos) sv-1584) - (set! sv-24 (-> this num-onscreen-targets)) + (set! sv-840 (vector-vector-distance (-> this root trans) sv-832)) + (vector-! sv-836 sv-832 (camera-pos)) + (when (and (< 1.0 (vector-dot sv-836 (-> (camera-matrix) fvec))) (< sv-840 819200.0)) + (let ((sv-880 (new 'stack-no-clear 'vector)) + (sv-884 (vector+float*! (new 'stack-no-clear 'vector) (-> this root trans) (-> this aim-dir) 40960.0)) + (sv-888 (the-as float 0.0)) + ) + (set-vector! sv-884 (lerp 0.0 512.0 (-> this roty)) (lerp 0.0 416.0 (-> this rotx)) 0.0 1.0) + (+! (-> sv-884 x) -256.0) + (+! (-> sv-884 y) -208.0) + (+! (-> sv-884 x) 2048.0) + (+! (-> sv-884 y) 2048.0) + (transform-point-vector! sv-880 sv-832) + (set! (-> sv-880 z) 0.0) + (let ((sv-960 (new 'stack-no-clear 'vector)) + (sv-964 (new 'stack-no-clear 'vector)) + (sv-968 (new 'stack-no-clear 'vector)) + (sv-972 (new 'stack-no-clear 'vector)) + ) + (vector+float*! sv-960 sv-832 (-> (camera-matrix) rvec) (* 0.6 (-> s4-1 prim-core world-sphere w))) + (vector+float*! sv-964 sv-832 (-> (camera-matrix) rvec) (* 0.6 (- (-> s4-1 prim-core world-sphere w)))) + (transform-point-vector! sv-968 sv-960) + (transform-point-vector! sv-972 sv-964) + (set! (-> sv-968 z) 0.0) + (set! (-> sv-972 z) 0.0) + (let ((sv-976 (* 0.5 (vector-vector-distance sv-968 sv-972))) + (sv-980 (-> this onscreen-targets (-> this num-onscreen-targets))) + ) + (set! sv-888 (- (vector-vector-distance sv-884 sv-880) sv-976)) + (let ((a1-25 (new 'stack-no-clear 'collide-query))) + (vector-copy! (-> a1-25 start-pos) (-> this root trans)) + (vector-! (-> a1-25 move-dist) sv-832 (-> a1-25 start-pos)) + (let ((v1-133 a1-25)) + (set! (-> v1-133 radius) 40.96) + (set! (-> v1-133 collide-with) (collide-spec backgnd)) + (set! (-> v1-133 ignore-process0) #f) + (set! (-> v1-133 ignore-process1) #f) + (set! (-> v1-133 ignore-pat) + (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) + ) + (set! (-> v1-133 action-mask) (collide-action solid)) + ) + (when (< (fill-and-probe-using-line-sphere *collide-cache* a1-25) 0.0) + (when (< sv-888 sv-16) + (set! sv-20 sv-784) + (set! sv-16 sv-888) + (vector-copy! (-> this hit-pos) sv-832) + (set! sv-24 (-> this num-onscreen-targets)) + ) + (transform-point-qword! (-> sv-980 transformed-pos) sv-832) + (set! (-> sv-980 hit?) #f) + (set! (-> sv-980 hand) (process->handle sv-784)) + (set! (-> sv-980 size) sv-976) + (set! (-> sv-980 alpha) (lerp-scale-clamp 0.0 1.0 sv-840 20480.0 61440.0)) + (+! (-> this num-onscreen-targets) 1) + ) + ) + ) + ) + ) + ) ) - (transform-point-qword! (-> sv-1732 transformed-pos) sv-1584) - (set! (-> sv-1732 hit?) #f) - (set! (-> sv-1732 hand) (process->handle sv-1536)) - (set! (-> sv-1732 size) sv-1728) - (set! (-> sv-1732 alpha) (lerp-scale-clamp 0.0 1.0 sv-1592 20480.0 61440.0)) - (+! (-> this num-onscreen-targets) 1) ) ) ) ) ) + (set! v1-80 s5-1) + *collide-hit-by-player-list* + (set! s5-1 (-> s5-1 next0)) + ) + ) + ) + ) + (when #t + (let ((v1-155 (-> *collide-hit-by-others-list* alive-list next0))) + *collide-hit-by-others-list* + (let ((s5-2 (-> v1-155 next0))) + (while (!= v1-155 (-> *collide-hit-by-others-list* alive-list-end)) + (let* ((v1-156 (the-as collide-shape (-> (the-as connection v1-155) param1))) + (s4-2 (-> v1-156 root-prim)) + ) + (when (logtest? (-> s4-2 prim-core collide-as) (collide-spec enemy obstacle hit-by-others-list)) + (let ((sv-1536 (as-type (-> v1-156 process) process-focusable))) + (when (and sv-1536 + (< (-> this num-onscreen-targets) 32) + (not (logtest? (-> (the-as process-focusable sv-1536) focus-status) (focus-status disable dead ignore inactive)) + ) + ) + (let ((s3-19 (new 'stack-no-clear 'vector))) + (vector-copy! s3-19 (get-trans (the-as process-focusable sv-1536) 3)) + (let ((sv-1584 s3-19) + (sv-1588 (new 'stack-no-clear 'vector)) + (sv-1592 (the-as float 0.0)) + ) + (set! sv-1592 (vector-vector-distance (-> this root trans) sv-1584)) + (vector-! sv-1588 sv-1584 (camera-pos)) + (when (and (< 1.0 (vector-dot sv-1588 (-> (camera-matrix) fvec))) (< sv-1592 819200.0)) + (let ((sv-1632 (new 'stack-no-clear 'vector)) + (sv-1636 (vector+float*! (new 'stack-no-clear 'vector) (-> this root trans) (-> this aim-dir) 40960.0)) + (sv-1640 (the-as float 0.0)) + ) + (set-vector! sv-1636 (lerp 0.0 512.0 (-> this roty)) (lerp 0.0 416.0 (-> this rotx)) 0.0 1.0) + (+! (-> sv-1636 x) -256.0) + (+! (-> sv-1636 y) -208.0) + (+! (-> sv-1636 x) 2048.0) + (+! (-> sv-1636 y) 2048.0) + (transform-point-vector! sv-1632 sv-1584) + (set! (-> sv-1632 z) 0.0) + (let ((sv-1712 (new 'stack-no-clear 'vector)) + (sv-1716 (new 'stack-no-clear 'vector)) + (sv-1720 (new 'stack-no-clear 'vector)) + (sv-1724 (new 'stack-no-clear 'vector)) + ) + (vector+float*! sv-1712 sv-1584 (-> (camera-matrix) rvec) (* 0.6 (-> s4-2 prim-core world-sphere w))) + (vector+float*! sv-1716 sv-1584 (-> (camera-matrix) rvec) (* 0.6 (- (-> s4-2 prim-core world-sphere w)))) + (transform-point-vector! sv-1720 sv-1712) + (transform-point-vector! sv-1724 sv-1716) + (set! (-> sv-1720 z) 0.0) + (set! (-> sv-1724 z) 0.0) + (let ((sv-1728 (* 0.5 (vector-vector-distance sv-1720 sv-1724))) + (sv-1732 (-> this onscreen-targets (-> this num-onscreen-targets))) + ) + (set! sv-1640 (- (vector-vector-distance sv-1636 sv-1632) sv-1728)) + (let ((a1-39 (new 'stack-no-clear 'collide-query))) + (vector-copy! (-> a1-39 start-pos) (-> this root trans)) + (vector-! (-> a1-39 move-dist) sv-1584 (-> a1-39 start-pos)) + (let ((v1-208 a1-39)) + (set! (-> v1-208 radius) 40.96) + (set! (-> v1-208 collide-with) (collide-spec backgnd)) + (set! (-> v1-208 ignore-process0) #f) + (set! (-> v1-208 ignore-process1) #f) + (set! (-> v1-208 ignore-pat) + (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) + ) + (set! (-> v1-208 action-mask) (collide-action solid)) + ) + (when (< (fill-and-probe-using-line-sphere *collide-cache* a1-39) 0.0) + (when (< sv-1640 sv-16) + (set! sv-20 sv-1536) + (set! sv-16 sv-1640) + (vector-copy! (-> this hit-pos) sv-1584) + (set! sv-24 (-> this num-onscreen-targets)) + ) + (transform-point-qword! (-> sv-1732 transformed-pos) sv-1584) + (set! (-> sv-1732 hit?) #f) + (set! (-> sv-1732 hand) (process->handle sv-1536)) + (set! (-> sv-1732 size) sv-1728) + (set! (-> sv-1732 alpha) (lerp-scale-clamp 0.0 1.0 sv-1592 20480.0 61440.0)) + (+! (-> this num-onscreen-targets) 1) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + (set! v1-155 s5-2) + *collide-hit-by-others-list* + (set! s5-2 (-> s5-2 next0)) ) - (set! v1-155 s5-2) - *collide-hit-by-others-list* - (set! s5-2 (-> s5-2 next0)) ) ) ) ) - ) - (cond - (sv-20 - (let ((s5-3 (process->handle sv-20))) - (when (or (!= (-> this target-hand) s5-3) (not (-> this found-target?))) - (let ((s4-3 (-> this hud-pers (-> this onscreen-targets sv-24 target-pers-index)))) - (set! (-> s4-3 alpha) 0.0) - (set! (-> s4-3 rotate) 0.0) - (when (time-elapsed? (-> this last-beep-time) (seconds 0.1)) - (sound-play "tracking-beep1" :vol 90) - (set-time! (-> this last-beep-time)) + (cond + (sv-20 + (let ((s5-3 (process->handle sv-20))) + (when (or (!= (-> this target-hand) s5-3) (not (-> this found-target?))) + (let ((s4-3 (-> this hud-pers (-> this onscreen-targets sv-24 target-pers-index)))) + (set! (-> s4-3 alpha) 0.0) + (set! (-> s4-3 rotate) 0.0) + (when (time-elapsed? (-> this last-beep-time) (seconds 0.1)) + (sound-play "tracking-beep1" :vol 90) + (set-time! (-> this last-beep-time)) + ) + (set! (-> s4-3 size-scalar) 4.0) + (set-time! (-> s4-3 hold-start-time)) ) - (set! (-> s4-3 size-scalar) 4.0) - (set-time! (-> s4-3 hold-start-time)) ) + (set! (-> this target-hand) (the-as handle s5-3)) + ) + (set! (-> this found-target?) #t) + (let ((v0-53 (the-as object #t))) + (set! (-> this onscreen-targets sv-24 hit?) (the-as symbol v0-53)) + v0-53 ) - (set! (-> this target-hand) (the-as handle s5-3)) ) - (set! (-> this found-target?) #t) - (let ((v0-53 (the-as object #t))) - (set! (-> this onscreen-targets sv-24 hit?) (the-as symbol v0-53)) - v0-53 + (else + (set! (-> this found-target?) #f) + (vector+float*! (-> this hit-pos) (-> this root trans) (-> this aim-dir) 327680.0) ) ) - (else - (set! (-> this found-target?) #f) - (vector+float*! (-> this hit-pos) (-> this root trans) (-> this aim-dir) 327680.0) - ) ) ) @@ -2932,7 +2875,7 @@ ) (defmethod bt-vehicle-method-31 ((this bt-hellcat)) - (local-vars (f30-2 float) (sv-256 vector) (sv-260 vector) (sv-264 vector) (sv-268 vector)) + (local-vars (f30-2 float)) (set-vector! (-> this rider-spots data 0 offset-pos) 0.0 0.0 0.0 1.0) (set-vector! (-> this rider-spots data 1 offset-pos) 0.0 0.0 0.0 1.0) (let ((s5-0 (new 'stack 'blow-tower-clock))) @@ -2999,73 +2942,75 @@ ) (let ((v1-58 (new 'stack-no-clear 'vector))) (vector-copy! v1-58 (-> this path-cursor norm)) - (set! sv-256 v1-58) - ) - (set! sv-260 (vector-x-quaternion! (new 'stack-no-clear 'vector) (-> this root quat))) - (set! sv-264 (vector-z-quaternion! (new 'stack-no-clear 'vector) (-> this root quat))) - (set! sv-268 (new 'stack-no-clear 'vector)) - (set! (-> sv-260 y) 0.0) - (vector-normalize! sv-260 1.0) - (set! (-> sv-264 y) 0.0) - (vector-normalize! sv-264 1.0) - (set! (-> sv-256 y) 0.0) - (vector-normalize! sv-256 1.0) - (seek! - (-> this roll-amount) - (-> this dest-roll-amount) - (* (-> this roll-amount-seek-rate) (seconds-per-frame)) - ) - (let ((s4-2 (quaternion-look-at! (new 'stack-no-clear 'quaternion) sv-256 *up-vector*)) - (f30-1 (seconds-per-frame)) - ) - 0.0 - (let ((v1-68 (the-as bt-gun-manager (handle->process (-> this child-turret)))) - (s3-3 (-> this pitch-quat)) + (let ((sv-256 v1-58) + (sv-260 (vector-x-quaternion! (new 'stack-no-clear 'vector) (-> this root quat))) + (sv-264 (vector-z-quaternion! (new 'stack-no-clear 'vector) (-> this root quat))) + (sv-268 (new 'stack-no-clear 'vector)) ) - (let ((f28-1 (-> this roll-amount))) - (vector-rotate-around-axis! sv-268 sv-260 (-> v1-68 rot-y-shift) *up-vector*) - (quaternion-vector-angle! s3-3 sv-268 f28-1) + (set! (-> sv-260 y) 0.0) + (vector-normalize! sv-260 1.0) + (set! (-> sv-264 y) 0.0) + (vector-normalize! sv-264 1.0) + (set! (-> sv-256 y) 0.0) + (vector-normalize! sv-256 1.0) + (seek! + (-> this roll-amount) + (-> this dest-roll-amount) + (* (-> this roll-amount-seek-rate) (seconds-per-frame)) ) - (quaternion*! s4-2 s3-3 s4-2) - ) - (let* ((f0-33 (vector-dot sv-256 sv-264)) - (f1-5 (* 2.5 (- 1.0 f0-33))) - (f0-36 (- 1.0 (* (- 1.0 f1-5) (- 1.0 f1-5)))) - ) - (if (< 0.0 (vector-dot sv-256 sv-260)) - (set! f0-36 (* -1.0 f0-36)) + (let ((s4-2 (quaternion-look-at! (new 'stack-no-clear 'quaternion) sv-256 *up-vector*)) + (f30-1 (seconds-per-frame)) + ) + 0.0 + (let ((v1-68 (the-as bt-gun-manager (handle->process (-> this child-turret)))) + (s3-3 (-> this pitch-quat)) + ) + (let ((f28-1 (-> this roll-amount))) + (vector-rotate-around-axis! sv-268 sv-260 (-> v1-68 rot-y-shift) *up-vector*) + (quaternion-vector-angle! s3-3 sv-268 f28-1) + ) + (quaternion*! s4-2 s3-3 s4-2) ) - (quaternion-rotate-local-z! s4-2 s4-2 (* 8192.0 f0-36)) - ) - (if (-> s5-0 debug?) - (set! f30-1 1.0) + (let* ((f0-33 (vector-dot sv-256 sv-264)) + (f1-5 (* 2.5 (- 1.0 f0-33))) + (f0-36 (- 1.0 (* (- 1.0 f1-5) (- 1.0 f1-5)))) + ) + (if (< 0.0 (vector-dot sv-256 sv-260)) + (set! f0-36 (* -1.0 f0-36)) + ) + (quaternion-rotate-local-z! s4-2 s4-2 (* 8192.0 f0-36)) + ) + (if (-> s5-0 debug?) + (set! f30-1 1.0) + ) + (let ((f0-38 (-> this path-height-vel))) + 0.0 + (let ((f0-41 (fmax -1.0 (fmin 1.0 (/ f0-38 (meters 10)))))) + (quaternion-rotate-local-x! s4-2 s4-2 (* -4551.1113 f0-41)) + ) + ) + (quaternion-slerp! (-> this quat-before-bounce) (-> this quat-before-bounce) s4-2 f30-1) ) - (let ((f0-38 (-> this path-height-vel))) - 0.0 - (let ((f0-41 (fmax -1.0 (fmin 1.0 (/ f0-38 (meters 10)))))) - (quaternion-rotate-local-x! s4-2 s4-2 (* -4551.1113 f0-41)) + (quaternion-copy! (-> this root quat) (-> this quat-before-bounce)) + (let ((s5-1 (new 'stack-no-clear 'quaternion))) + 1.0 + (set! f30-2 (cond + ((handle->process (-> this grunt-rider-boarded?)) + (quaternion-vector-angle! s5-1 sv-268 1820.4445) + 5.0 + ) + (else + (set! f30-2 1.0) + (quaternion-identity! s5-1) + f30-2 + ) + ) + ) + (quaternion-slerp! (-> this quat-grunt-tilt) (-> this quat-grunt-tilt) s5-1 (* f30-2 (seconds-per-frame))) ) ) - (quaternion-slerp! (-> this quat-before-bounce) (-> this quat-before-bounce) s4-2 f30-1) ) ) - (quaternion-copy! (-> this root quat) (-> this quat-before-bounce)) - (let ((s5-1 (new 'stack-no-clear 'quaternion))) - 1.0 - (set! f30-2 (cond - ((handle->process (-> this grunt-rider-boarded?)) - (quaternion-vector-angle! s5-1 sv-268 1820.4445) - 5.0 - ) - (else - (set! f30-2 1.0) - (quaternion-identity! s5-1) - f30-2 - ) - ) - ) - (quaternion-slerp! (-> this quat-grunt-tilt) (-> this quat-grunt-tilt) s5-1 (* f30-2 (seconds-per-frame))) - ) (quaternion*! (-> this root quat) (-> this quat-grunt-tilt) (-> this quat-before-bounce)) (when (time-elapsed? (-> this state-time) (seconds 0.2)) (let ((s5-2 (new 'stack-no-clear 'quaternion)) diff --git a/goal_src/jak3/levels/city/bombbot/bombbot.gc b/goal_src/jak3/levels/city/bombbot/bombbot.gc index df816a98b4..32a578ee23 100644 --- a/goal_src/jak3/levels/city/bombbot/bombbot.gc +++ b/goal_src/jak3/levels/city/bombbot/bombbot.gc @@ -1228,16 +1228,7 @@ ;; ERROR: Stack slot load at 896 mismatch: defined as size 4, got size 16 ;; ERROR: Stack slot load at 912 mismatch: defined as size 4, got size 16 (defmethod bombbot-method-194 ((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) - (sv-960 uint) - ) + (local-vars (at-0 int)) (with-pp (rlet ((acc :class vf) (vf0 :class vf) @@ -1294,19 +1285,21 @@ (toggle-cspec-deadly this #t (+ s4-0 1)) (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-40 s3-0)) - (.lvf vf1 (&-> sv-864 quad)) - (.lvf vf2 (&-> v1-40 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-40 s3-0)) + (.lvf vf1 (&-> sv-864 quad)) + (.lvf vf2 (&-> v1-40 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-6 s0-0) (v1-42 s0-0) (a0-12 (new 'stack-no-clear 'vector)) @@ -1395,66 +1388,37 @@ (when (-> s1-0 moving) (vector-copy! (-> s1-0 position) (-> s1-0 next-position)) (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-36 (camera-pos)) - (a1-23 (-> s1-0 position)) - (a2-20 (sv-928 a0-36 a1-23)) - (a3-2 40960.0) - (t0-1 409600.0) - (f30-1 (s0-1 sv-896 sv-912 a2-20 a3-2 t0-1)) - ) - (when (and (!= f30-1 0.0) (< 16384.0 (vector-length (-> s1-0 speed)))) - (if (bombbot-method-207 this) - (activate! *camera-smush-control* f30-1 37 600 1.0 0.1 (-> pp clock)) - ) - (cond - ((logtest? (-> group-land-poof-stn flags) (sp-group-flag sp13)) - (vector-copy! (-> *launch-matrix* trans) (-> s1-0 position)) - (part-tracker-spawn part-tracker-subsampler :to this :group group-land-poof-stn) - ) - (else - (vector-copy! (-> *launch-matrix* trans) (-> s1-0 position)) - (part-tracker-spawn part-tracker :to this :group group-land-poof-stn) - ) - ) - (when (or (zero? s4-0) (= s4-0 1)) - (cond - ((and *target* (focus-test? *target* grabbed)) - (let ((s0-4 sound-play-by-name)) - (set! sv-944 (make-u128 #x6d6163 (the-as uint #x2d6b6c61772d6262))) - (let ((a1-32 (new-sound-id)) - (a2-32 1024) - (a3-8 0) - (t0-3 0) - (t1-2 0) - (t2-1 (-> s1-0 position)) - ) - (s0-4 (the-as sound-name sv-944) a1-32 a2-32 a3-8 t0-3 (the-as sound-group t1-2) t2-1) + (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 ) ) - ) - (else - (let ((s0-5 sound-play-by-name)) - (set! sv-960 (make-u128 0 (the-as uint #x6b6c61772d6262))) - (let ((a1-33 (new-sound-id)) - (a2-33 1024) - (a3-9 0) - (t0-4 0) - (t1-3 0) - (t2-2 (-> s1-0 position)) - ) - (s0-5 (the-as sound-name sv-960) a1-33 a2-33 a3-9 t0-4 (the-as sound-group t1-3) t2-2) - ) - ) - ) - ) - (if (bombbot-method-207 this) - (cpad-set-buzz! (-> *cpad-list* cpads 0) 1 (the int (* 255.0 (* 0.00061035156 f30-1))) (seconds 0.2)) - ) + ) + (when (and (!= f30-1 0.0) (< 16384.0 (vector-length (-> s1-0 speed)))) + (if (bombbot-method-207 this) + (activate! *camera-smush-control* f30-1 37 600 1.0 0.1 (-> pp clock)) ) + (cond + ((logtest? (-> group-land-poof-stn flags) (sp-group-flag sp13)) + (vector-copy! (-> *launch-matrix* trans) (-> s1-0 position)) + (part-tracker-spawn part-tracker-subsampler :to this :group group-land-poof-stn) + ) + (else + (vector-copy! (-> *launch-matrix* trans) (-> s1-0 position)) + (part-tracker-spawn part-tracker :to this :group group-land-poof-stn) + ) + ) + (when (or (zero? s4-0) (= s4-0 1)) + (if (and *target* (focus-test? *target* grabbed)) + (sound-play "bb-walk-cam" :position (-> s1-0 position)) + (sound-play "bb-walk" :position (-> s1-0 position)) + ) + (if (bombbot-method-207 this) + (cpad-set-buzz! (-> *cpad-list* cpads 0) 1 (the int (* 255.0 (* 0.00061035156 f30-1))) (seconds 0.2)) + ) ) ) ) @@ -1503,7 +1467,6 @@ (defmethod enemy-common-post ((this bombbot)) "Common implementation of post. Runs ja-post." - (local-vars (sv-48 sparticle-launcher) (sv-52 sparticle-launcher)) (let ((t9-0 (method-of-type nav-enemy enemy-common-post))) (t9-0 this) ) @@ -1538,56 +1501,61 @@ (the-as (function rigid-body-object float none) (method-of-object this bombbot-method-198)) ) (bombbot-method-199 this) - (set! sv-48 (the-as sparticle-launcher #f)) - (set! sv-52 (the-as sparticle-launcher #f)) - (cond - ((< (-> this hit-points) (* 0.33 (-> this max-hit-points))) - (set! sv-48 (-> *part-id-table* 925)) - (set! sv-52 (-> *part-id-table* 921)) - ) - ((< (-> this hit-points) (* 0.66 (-> this max-hit-points))) - (set! sv-48 (-> *part-id-table* 928)) - ) - (else - (if (< (rand-vu) 0.05) - (set! sv-48 (-> *part-id-table* 930)) + (let ((sv-48 (the-as sparticle-launcher #f)) + (sv-52 (the-as sparticle-launcher #f)) + ) + (set! sv-48 (cond + ((< (-> this hit-points) (* 0.33 (-> this max-hit-points))) + (set! sv-48 (-> *part-id-table* 925)) + (set! sv-52 (-> *part-id-table* 921)) + sv-48 + ) + ((< (-> this hit-points) (* 0.66 (-> this max-hit-points))) + (-> *part-id-table* 928) + ) + (else + (if (< (rand-vu) 0.05) + (set! sv-48 (-> *part-id-table* 930)) + ) + sv-48 + ) + ) ) - ) - ) - (when sv-48 - (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-52 (< (rand-vu) 0.005)) - (let ((t9-15 sp-launch-particles-var) - (a0-23 *sp-particle-system-2d*) - (a1-10 sv-48) - (a2-2 *launch-matrix*) - ) - (vector-copy! (-> a2-2 trans) s5-3) - (t9-15 a0-23 a1-10 a2-2 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0) + (when sv-48 + (let ((gp-1 (-> this node-list data 4 bone transform)) + (s5-3 (new 'stack-no-clear 'vector)) ) - ) - (let ((t9-16 sp-launch-particles-var) - (a0-24 *sp-particle-system-2d*) - (a1-11 sv-48) - (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-52 (< (rand-vu) 0.005)) + (let ((t9-15 sp-launch-particles-var) + (a0-23 *sp-particle-system-2d*) + (a1-10 sv-48) + (a2-2 *launch-matrix*) + ) + (vector-copy! (-> a2-2 trans) s5-3) + (t9-15 a0-23 a1-10 a2-2 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0) ) - (vector-copy! (-> a2-3 trans) s5-3) - (t9-16 a0-24 a1-11 a2-3 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0) + ) + (let ((t9-16 sp-launch-particles-var) + (a0-24 *sp-particle-system-2d*) + (a1-11 sv-48) + (a2-3 *launch-matrix*) + ) + (vector-copy! (-> a2-3 trans) s5-3) + (t9-16 a0-24 a1-11 a2-3 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0) + ) ) ) ) @@ -2797,13 +2765,6 @@ ) (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) (vf1 :class vf) (vf2 :class vf) @@ -2825,25 +2786,24 @@ (vector-copy! s1-0 (-> v1-3 pos-offset)) (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-9 (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-9 quad) vf3) - (let ((a2-5 (t9-4 a0-14 a1-9 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-9 (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-9 quad) vf3) + (sv-176 sv-192 sv-208 (t9-4 a0-14 a1-9 f0-8)) ) ) ) @@ -2913,7 +2873,6 @@ ) (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) @@ -2921,34 +2880,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 fvec)) - (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) - (vector-copy! (-> arg0 bone transform trans) s5-0) ) + (rot-zxy-from-vector! s0-0 (-> arg0 bone transform fvec)) + (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) + (vector-copy! (-> arg0 bone transform trans) s5-0) ) 0 (none) @@ -2956,7 +2916,6 @@ ) (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) @@ -2971,15 +2930,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 fvec)) (rot-zxy-from-vector! s1-0 s0-0) (set! (-> s3-0 x) (fmax -4551.1113 (fmin 4551.1113 (deg- (-> s1-0 x) (-> s2-0 x))))) @@ -3025,7 +2986,7 @@ ) (defmethod bombbot-method-198 ((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) @@ -3049,13 +3010,11 @@ (-> this rigidbody matrix) ) ) + (sv-160 (new 'stack-no-clear 'vector)) ) - (set! sv-160 (new 'stack-no-clear 'vector)) - (let ((v1-19 (-> *bombbot-spring-setup* s5-0 wpos2 quad))) - (set! (-> sv-160 quad) v1-19) - ) - (set! sv-176 (new 'stack-no-clear 'vector)) - (let ((s0-0 (new 'stack-no-clear 'vector)) + (vector-copy! sv-160 (-> *bombbot-spring-setup* s5-0 wpos2)) + (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)) @@ -3073,11 +3032,7 @@ (.sub.vf.xyz vf6 vf4 vf5) (.svf (&-> v1-31 quad) vf6) ) - (let ((a1-4 s1-0) - (v1-32 *null-vector*) - ) - (vector-! a1-4 sv-176 v1-32) - ) + (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))) @@ -3610,92 +3565,85 @@ ) (defmethod bombbot-method-196 ((this bombbot-player) (arg0 vector)) - (local-vars - (sv-864 process-drawable) - (sv-868 number) - (sv-872 vector) - (sv-876 vector) - (sv-880 collide-query) - (sv-884 (pointer collide-shape)) - (sv-888 vector) - (sv-896 int) - ) - (set! sv-864 (the-as process-drawable #f)) - ;; og:preserve-this - (set! sv-868 (the-as float #x7f800000)) - (set! sv-872 (new 'stack-no-clear 'vector)) - (set! sv-876 (new 'stack-no-clear 'vector)) - (set! sv-880 (new 'stack-no-clear 'collide-query)) - (set! sv-884 (new 'stack-no-clear 'array 'collide-shape 64)) - (let ((s5-0 (new 'stack-no-clear 'vector))) - (vector-copy! s5-0 (-> (camera-matrix) fvec)) - (set! sv-888 s5-0) - ) - (set! sv-896 0) - (set! (-> sv-888 y) 0.0) - (vector-normalize! sv-888 1.0) - (vector+*! sv-876 (camera-pos) sv-888 40960.0) - (vector-copy! sv-876 (get-trans this 4)) - (matrix->trans (-> this node-list data 6 bone transform) sv-872) - (set! (-> sv-876 y) (-> sv-872 y)) - (vector-normalize-copy! sv-872 sv-888 204800.0) - (vector-copy! (-> sv-880 start-pos) sv-876) - (vector-copy! (-> sv-880 move-dist) sv-872) - (let ((v1-20 sv-880)) - (set! (-> v1-20 radius) 40.96) - (set! (-> v1-20 collide-with) (collide-spec backgnd)) - (set! (-> v1-20 ignore-process0) this) - (set! (-> v1-20 ignore-process1) #f) - (set! (-> v1-20 ignore-pat) - (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) - ) - (set! (-> v1-20 action-mask) (collide-action solid)) - ) - (let ((f0-5 (fill-and-probe-using-line-sphere *collide-cache* sv-880))) - (if (>= f0-5 0.0) - (vector-float*! sv-872 sv-872 f0-5) + (let ((sv-864 (the-as process-drawable #f)) + ;; og:preserve-this + (sv-868 (the-as float #x7f800000)) + (sv-872 (new 'stack-no-clear 'vector)) + (sv-876 (new 'stack-no-clear 'vector)) + (sv-880 (new 'stack-no-clear 'collide-query)) + (sv-884 (new 'stack-no-clear 'array 'collide-shape 64)) + (s5-0 (new 'stack-no-clear 'vector)) ) - ) - (set! sv-896 (fill-actor-list-for-sphere *actor-hash* sv-876 sv-872 40960.0 sv-884 64 -1)) - (countdown (s5-4 sv-896) - (let ((a0-19 (as-type (-> sv-884 s5-4) collide-shape))) - (when a0-19 - (let ((s4-1 (as-type (-> a0-19 process) process-focusable)) - (s3-1 (new 'stack-no-clear 'vector)) + (vector-copy! s5-0 (-> (camera-matrix) fvec)) + (let ((sv-888 s5-0) + (sv-896 0) + ) + (set! (-> sv-888 y) 0.0) + (vector-normalize! sv-888 1.0) + (vector+*! sv-876 (camera-pos) sv-888 40960.0) + (vector-copy! sv-876 (get-trans this 4)) + (matrix->trans (-> this node-list data 6 bone transform) sv-872) + (set! (-> sv-876 y) (-> sv-872 y)) + (vector-normalize-copy! sv-872 sv-888 204800.0) + (vector-copy! (-> sv-880 start-pos) sv-876) + (vector-copy! (-> sv-880 move-dist) sv-872) + (let ((v1-20 sv-880)) + (set! (-> v1-20 radius) 40.96) + (set! (-> v1-20 collide-with) (collide-spec backgnd)) + (set! (-> v1-20 ignore-process0) this) + (set! (-> v1-20 ignore-process1) #f) + (set! (-> v1-20 ignore-pat) + (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) ) - (when (and s4-1 - (valid-target? this (the-as process-focusable s4-1)) - (not (logtest? (process-mask guard) (-> s4-1 mask))) - (not (logtest? (process-mask civilian) (-> s4-1 mask))) - (not (logtest? (process-mask vehicle) (-> s4-1 mask))) - ) - (vector-! s3-1 (-> s4-1 root trans) (-> this root trans)) - (set! (-> s3-1 y) 0.0) - (vector-normalize! s3-1 1.0) - (when (< (cos 2730.6667) (vector-dot s3-1 sv-888)) - (let ((f0-8 (vector-vector-xz-distance (-> this root trans) (-> s4-1 root trans)))) - (when (and (or (not sv-864) (< f0-8 (the-as float sv-868))) - (< (-> s4-1 root trans y) (+ 61440.0 (-> this root trans y))) - ) - (set! sv-864 s4-1) - (set! sv-868 f0-8) + (set! (-> v1-20 action-mask) (collide-action solid)) + ) + (let ((f0-5 (fill-and-probe-using-line-sphere *collide-cache* sv-880))) + (if (>= f0-5 0.0) + (vector-float*! sv-872 sv-872 f0-5) + ) + ) + (set! sv-896 (fill-actor-list-for-sphere *actor-hash* sv-876 sv-872 40960.0 sv-884 64 -1)) + (countdown (s5-4 sv-896) + (let ((a0-19 (as-type (-> sv-884 s5-4) collide-shape))) + (when a0-19 + (let ((s4-1 (as-type (-> a0-19 process) process-focusable)) + (s3-1 (new 'stack-no-clear 'vector)) + ) + (when (and s4-1 + (valid-target? this (the-as process-focusable s4-1)) + (not (logtest? (process-mask guard) (-> s4-1 mask))) + (not (logtest? (process-mask civilian) (-> s4-1 mask))) + (not (logtest? (process-mask vehicle) (-> s4-1 mask))) + ) + (vector-! s3-1 (-> s4-1 root trans) (-> this root trans)) + (set! (-> s3-1 y) 0.0) + (vector-normalize! s3-1 1.0) + (when (< (cos 2730.6667) (vector-dot s3-1 sv-888)) + (let ((f0-8 (vector-vector-xz-distance (-> this root trans) (-> s4-1 root trans)))) + (when (and (or (not sv-864) (< f0-8 (the-as float sv-868))) + (< (-> s4-1 root trans y) (+ 61440.0 (-> this root trans y))) + ) + (set! sv-864 s4-1) + (set! sv-868 f0-8) + ) + ) ) ) ) ) ) - ) - ) - (cond - (sv-864 - (vector-copy! (-> this target-pos) (get-trans (the-as process-focusable sv-864) 3)) - (vector-copy! (-> this start-target-pos) (-> sv-864 root trans)) - (vector-copy! (-> this start-target-vel) (-> sv-864 root transv)) - (focus-on! (-> this focus) (the-as process-focusable sv-864) this) - ) - (else - (vector+! (-> this target-pos) sv-876 sv-872) - (clear-focused (-> this focus)) + (cond + (sv-864 + (vector-copy! (-> this target-pos) (get-trans (the-as process-focusable sv-864) 3)) + (vector-copy! (-> this start-target-pos) (-> sv-864 root trans)) + (vector-copy! (-> this start-target-vel) (-> sv-864 root transv)) + (focus-on! (-> this focus) (the-as process-focusable sv-864) this) + ) + (else + (vector+! (-> this target-pos) sv-876 sv-872) + (clear-focused (-> this focus)) + ) + ) ) ) ) diff --git a/goal_src/jak3/levels/city/common/cty-borrow-manager.gc b/goal_src/jak3/levels/city/common/cty-borrow-manager.gc index 02cc5b991c..2b95dd0a52 100644 --- a/goal_src/jak3/levels/city/common/cty-borrow-manager.gc +++ b/goal_src/jak3/levels/city/common/cty-borrow-manager.gc @@ -94,276 +94,271 @@ ;; WARN: new jak 2 until loop case, check carefully (defmethod cty-borrow-manager-method-12 ((this cty-borrow-manager) (arg0 load-state)) - (local-vars - (sv-16 int) - (sv-24 int) - (sv-32 int) - (sv-40 int) - (sv-48 (array uint16)) - (sv-52 (array uint16)) - (sv-56 (array uint16)) - (sv-60 (array uint16)) - ) - (set! sv-16 0) - (set! sv-24 0) - (set! sv-32 0) - (set! sv-40 0) - (when (zero? (-> *setting-control* user-current level-trans-time)) - (dotimes (v1-3 10) - (set! (-> arg0 target v1-3 name) (-> arg0 want-exp v1-3 name)) - (set! (-> arg0 target v1-3 display?) (-> arg0 want-exp v1-3 display?)) - (set! (-> arg0 target v1-3 force-vis?) (-> arg0 want-exp v1-3 force-vis?)) - (set! (-> arg0 target v1-3 force-inside?) (-> arg0 want-exp v1-3 force-inside?)) - ) - (return 0) - ) - (dotimes (v1-7 10) - (let ((a1-9 (-> arg0 target v1-7 name)) - (a0-15 #f) - ) - (when a1-9 - (dotimes (a2-1 10) - (when (= a1-9 (-> arg0 want-exp a2-1 name)) - (set! a0-15 #t) - 0 - (goto cfg-15) - ) - ) - (label cfg-15) - (if (not a0-15) - (set! sv-16 (logior sv-16 (ash 1 v1-7))) - ) + (let ((sv-16 0) + (sv-24 0) + (sv-32 0) ) - ) - ) - (dotimes (v1-10 10) - (let ((a1-15 (-> arg0 want-exp v1-10 name)) - (a0-19 #f) + (let ((sv-40 0)) + (when (zero? (-> *setting-control* user-current level-trans-time)) + (dotimes (v1-3 10) + (set! (-> arg0 target v1-3 name) (-> arg0 want-exp v1-3 name)) + (set! (-> arg0 target v1-3 display?) (-> arg0 want-exp v1-3 display?)) + (set! (-> arg0 target v1-3 force-vis?) (-> arg0 want-exp v1-3 force-vis?)) + (set! (-> arg0 target v1-3 force-inside?) (-> arg0 want-exp v1-3 force-inside?)) ) - (when a1-15 - (dotimes (a2-6 10) - (when (= a1-15 (-> arg0 target a2-6 name)) - (set! a0-19 #t) - 0 - (goto cfg-31) - ) - ) - (label cfg-31) - (if (not a0-19) - (set! sv-24 (logior sv-24 (ash 1 v1-10))) - ) + (return 0) ) - ) - ) - (set! sv-48 (new 'static 'boxed-array :type uint16 :length 0 :allocated-length 6)) - (set! sv-52 (new 'static 'boxed-array :type uint16 :length 0 :allocated-length 6)) - (set! sv-56 (new 'static 'boxed-array :type uint16 :length 0 :allocated-length 6)) - (set! sv-60 (new 'static 'boxed-array :type uint16 :length 0 :allocated-length 6)) - (dotimes (v1-17 5) - (set! (-> sv-48 v1-17) (the-as uint 0)) - (set! (-> sv-52 v1-17) (the-as uint 0)) - (set! (-> sv-60 v1-17) (the-as uint 0)) - ) - (set! (-> sv-56 0) (the-as uint 3)) - (set! (-> sv-56 1) (the-as uint 0)) - (set! (-> sv-56 2) (the-as uint 0)) - (set! (-> sv-56 3) (the-as uint 1)) - (set! (-> sv-56 4) (the-as uint 1)) - (set! (-> sv-56 5) (the-as uint 10)) - (dotimes (s4-0 10) - (when (logtest? sv-16 (ash 1 s4-0)) - (let ((v1-29 #f) - (s3-0 (-> arg0 target s4-0 name)) - ) - (dotimes (a0-35 (-> this borrow-holds length)) - (when (= (-> this borrow-holds data a0-35 name) s3-0) - (set! v1-29 (parent-also-loaded? arg0 s3-0)) - 0 - (goto cfg-53) + (dotimes (v1-7 10) + (let ((a1-9 (-> arg0 target v1-7 name)) + (a0-15 #f) + ) + (when a1-9 + (dotimes (a2-1 10) + (when (= a1-9 (-> arg0 want-exp a2-1 name)) + (set! a0-15 #t) + 0 + (goto cfg-15) + ) + ) + (label cfg-15) + (if (not a0-15) + (logior! sv-16 (ash 1 v1-7)) + ) ) ) - (label cfg-53) - (when v1-29 - (set! sv-16 (logclear sv-16 (ash 1 s4-0))) - (set! sv-32 (logior sv-32 (ash 1 s4-0))) - (let ((v1-34 (-> (lookup-level-info s3-0) memory-mode))) - -1 - (let ((v1-35 - (cond - ((= v1-34 (level-memory-mode borrow3)) - 3 - ) - ((= v1-34 (level-memory-mode borrow4)) - 4 - ) - ((= v1-34 (level-memory-mode borrow-city-small)) - 0 - ) - ((or (= v1-34 (level-memory-mode borrow0)) - (= v1-34 (level-memory-mode borrow1)) - (= v1-34 (level-memory-mode borrow2)) - ) - (break!) - 0 - ) - (else - 5 + ) + (dotimes (v1-10 10) + (let ((a1-15 (-> arg0 want-exp v1-10 name)) + (a0-19 #f) + ) + (when a1-15 + (dotimes (a2-6 10) + (when (= a1-15 (-> arg0 target a2-6 name)) + (set! a0-19 #t) + 0 + (goto cfg-31) + ) + ) + (label cfg-31) + (if (not a0-19) + (logior! sv-24 (ash 1 v1-10)) + ) + ) + ) + ) + (let ((sv-48 (new 'static 'boxed-array :type uint16 :length 0 :allocated-length 6)) + (sv-52 (new 'static 'boxed-array :type uint16 :length 0 :allocated-length 6)) + (sv-56 (new 'static 'boxed-array :type uint16 :length 0 :allocated-length 6)) + (sv-60 (new 'static 'boxed-array :type uint16 :length 0 :allocated-length 6)) + ) + (dotimes (v1-17 5) + (set! (-> sv-48 v1-17) (the-as uint 0)) + (set! (-> sv-52 v1-17) (the-as uint 0)) + (set! (-> sv-60 v1-17) (the-as uint 0)) + ) + (set! (-> sv-56 0) (the-as uint 3)) + (set! (-> sv-56 1) (the-as uint 0)) + (set! (-> sv-56 2) (the-as uint 0)) + (set! (-> sv-56 3) (the-as uint 1)) + (set! (-> sv-56 4) (the-as uint 1)) + (set! (-> sv-56 5) (the-as uint 10)) + (dotimes (s4-0 10) + (when (logtest? sv-16 (ash 1 s4-0)) + (let ((v1-29 #f) + (s3-0 (-> arg0 target s4-0 name)) + ) + (dotimes (a0-35 (-> this borrow-holds length)) + (when (= (-> this borrow-holds data a0-35 name) s3-0) + (set! v1-29 (parent-also-loaded? arg0 s3-0)) + 0 + (goto cfg-53) + ) + ) + (label cfg-53) + (when v1-29 + (logclear! sv-16 (ash 1 s4-0)) + (logior! sv-32 (ash 1 s4-0)) + (let ((v1-34 (-> (lookup-level-info s3-0) memory-mode))) + -1 + (let ((v1-35 + (cond + ((= v1-34 (level-memory-mode borrow3)) + 3 + ) + ((= v1-34 (level-memory-mode borrow4)) + 4 + ) + ((= v1-34 (level-memory-mode borrow-city-small)) + 0 + ) + ((or (= v1-34 (level-memory-mode borrow0)) + (= v1-34 (level-memory-mode borrow1)) + (= v1-34 (level-memory-mode borrow2)) + ) + (break!) + 0 + ) + (else + 5 + ) + ) + ) ) - ) + (+! (-> sv-48 v1-35) 1) ) ) - (+! (-> sv-48 v1-35) 1) + ) ) ) ) - ) - ) - ) - (dotimes (s4-1 10) - (let* ((a0-58 (-> arg0 want-exp s4-1 name)) - (v1-44 (-> (lookup-level-info a0-58) memory-mode)) - (v1-45 - (cond - ((= v1-44 (level-memory-mode borrow3)) - 3 - ) - ((= v1-44 (level-memory-mode borrow4)) - 4 - ) - ((= v1-44 (level-memory-mode borrow-city-small)) - 0 - ) - ((or (= v1-44 (level-memory-mode borrow0)) - (= v1-44 (level-memory-mode borrow1)) - (= v1-44 (level-memory-mode borrow2)) - ) - (break!) - 0 - ) - (else - 5 - ) - ) - ) - ) - (when (not (logtest? (-> sv-60 v1-45) (ash 1 s4-1))) - (+! (-> sv-52 v1-45) 1) - (logior! (-> sv-60 v1-45) (ash 1 s4-1)) - ) - ) - ) - (until #f - (let ((s4-2 0)) - (dotimes (s3-1 5) - (cond - ((< (-> sv-56 s3-1) (+ (-> sv-48 s3-1) (-> sv-52 s3-1))) - (let ((f30-0 1000.0) - (s2-0 -1) - ) - (dotimes (s1-0 10) - (when (logtest? (-> sv-60 s3-1) (ash 1 s1-0)) - (let* ((a0-86 (-> arg0 want-exp s1-0 name)) - (a1-55 (lookup-level-info a0-86)) - (f0-0 (cty-borrow-manager-method-18 this a1-55)) - ) - (if (not (logtest? sv-24 (ash 1 s1-0))) - (set! f0-0 (* 10.0 f0-0)) + (dotimes (s4-1 10) + (let* ((a0-58 (-> arg0 want-exp s4-1 name)) + (v1-44 (-> (lookup-level-info a0-58) memory-mode)) + (v1-45 + (cond + ((= v1-44 (level-memory-mode borrow3)) + 3 + ) + ((= v1-44 (level-memory-mode borrow4)) + 4 + ) + ((= v1-44 (level-memory-mode borrow-city-small)) + 0 + ) + ((or (= v1-44 (level-memory-mode borrow0)) + (= v1-44 (level-memory-mode borrow1)) + (= v1-44 (level-memory-mode borrow2)) + ) + (break!) + 0 + ) + (else + 5 ) - (when (< f0-0 f30-0) - (set! f30-0 f0-0) - (set! s2-0 s1-0) ) ) ) - ) + (when (not (logtest? (-> sv-60 v1-45) (ash 1 s4-1))) + (+! (-> sv-52 v1-45) 1) + (logior! (-> sv-60 v1-45) (ash 1 s4-1)) + ) + ) + ) + (until #f + (let ((s4-2 0)) + (dotimes (s3-1 5) + (cond + ((< (-> sv-56 s3-1) (+ (-> sv-48 s3-1) (-> sv-52 s3-1))) + (let ((f30-0 1000.0) + (s2-0 -1) + ) + (dotimes (s1-0 10) + (when (logtest? (-> sv-60 s3-1) (ash 1 s1-0)) + (let* ((a0-86 (-> arg0 want-exp s1-0 name)) + (a1-55 (lookup-level-info a0-86)) + (f0-0 (cty-borrow-manager-method-18 this a1-55)) + ) + (if (not (logtest? sv-24 (ash 1 s1-0))) + (set! f0-0 (* 10.0 f0-0)) + ) + (when (< f0-0 f30-0) + (set! f30-0 f0-0) + (set! s2-0 s1-0) + ) + ) + ) + ) + (cond + ((>= s2-0 0) + (logclear! sv-24 (ash 1 s2-0)) + (logior! sv-40 (ash 1 s2-0)) + (logclear! (-> sv-60 s3-1) (ash 1 s2-0)) + (+! (-> sv-52 s3-1) -1) + ) + (else + (return 0) + ) + ) + ) + ) + (else + (+! s4-2 1) + ) + ) + ) + (when (= s4-2 5) + 0 + (goto cfg-140) + ) + ) + ) + ) + #f + (label cfg-140) + (set! sv-16 (lognot sv-32)) + (set! sv-24 (lognot sv-40)) + (logior! sv-40 -1024) + (let ((s4-3 0) + (s3-2 0) + ) + (while (and (< s4-3 10) (< s3-2 10)) + (cond + ((not (logtest? sv-40 (ash 1 s4-3))) (cond - ((>= s2-0 0) - (set! sv-24 (logclear sv-24 (ash 1 s2-0))) - (set! sv-40 (logior sv-40 (ash 1 s2-0))) - (logclear! (-> sv-60 s3-1) (ash 1 s2-0)) - (+! (-> sv-52 s3-1) -1) + ((not (logtest? sv-32 (ash 1 s3-2))) + (set! (-> arg0 target s3-2 name) (-> arg0 want-exp s4-3 name)) + (set! (-> arg0 target s3-2 display?) (-> arg0 want-exp s4-3 display?)) + (set! (-> arg0 target s3-2 force-vis?) (-> arg0 want-exp s4-3 force-vis?)) + (set! (-> arg0 target s3-2 force-inside?) (-> arg0 want-exp s4-3 force-inside?)) + (send-event *traffic-manager* 'borrow-notify-shutdown-end (-> arg0 target s3-2 name)) + (+! s4-3 1) + (+! s3-2 1) ) (else - (return 0) + (+! s3-2 1) ) ) ) - ) - (else - (+! s4-2 1) - ) - ) - ) - (when (= s4-2 5) - 0 - (goto cfg-140) - ) - ) - ) - #f - (label cfg-140) - (set! sv-16 (lognot sv-32)) - (set! sv-24 (lognot sv-40)) - (set! sv-40 (logior -1024 sv-40)) - (let ((s4-3 0) - (s3-2 0) - ) - (while (and (< s4-3 10) (< s3-2 10)) - (cond - ((not (logtest? sv-40 (ash 1 s4-3))) - (cond - ((not (logtest? sv-32 (ash 1 s3-2))) - (set! (-> arg0 target s3-2 name) (-> arg0 want-exp s4-3 name)) - (set! (-> arg0 target s3-2 display?) (-> arg0 want-exp s4-3 display?)) - (set! (-> arg0 target s3-2 force-vis?) (-> arg0 want-exp s4-3 force-vis?)) - (set! (-> arg0 target s3-2 force-inside?) (-> arg0 want-exp s4-3 force-inside?)) - (send-event *traffic-manager* 'borrow-notify-shutdown-end (-> arg0 target s3-2 name)) - (+! s4-3 1) - (+! s3-2 1) - ) - (else - (+! s3-2 1) - ) - ) - ) - (else - (+! s4-3 1) - ) - ) - ) - ) - (let ((s4-4 0)) - (dotimes (s3-3 10) - (set! (car (ref& *cty-borrow-manager-list* s4-4)) #f) - (when (not (logtest? sv-32 (ash 1 s3-3))) - (let ((s2-1 (-> arg0 target s3-3 name))) - (case (-> (lookup-level-info s2-1) memory-mode) - (((level-memory-mode borrow0) - (level-memory-mode borrow1) - (level-memory-mode borrow2) - (level-memory-mode borrow3) - (level-memory-mode borrow4) - (level-memory-mode borrow-city-small) + (else + (+! s4-3 1) ) - (set! (car (ref& *cty-borrow-manager-list* s4-4)) s2-1) - (+! s4-4 1) - ) ) ) ) ) + (let ((s4-4 0)) + (dotimes (s3-3 10) + (set! (car (ref& *cty-borrow-manager-list* s4-4)) #f) + (when (not (logtest? sv-32 (ash 1 s3-3))) + (let ((s2-1 (-> arg0 target s3-3 name))) + (case (-> (lookup-level-info s2-1) memory-mode) + (((level-memory-mode borrow0) + (level-memory-mode borrow1) + (level-memory-mode borrow2) + (level-memory-mode borrow3) + (level-memory-mode borrow4) + (level-memory-mode borrow-city-small) + ) + (set! (car (ref& *cty-borrow-manager-list* s4-4)) s2-1) + (+! s4-4 1) + ) + ) + ) + ) + ) + ) + (persist-with-delay + *setting-control* + (the-as symbol *city-borrow-manager*) + (seconds 1000) + 'borrow-hold + (the-as symbol *cty-borrow-manager-list*) + 0.0 + 0 + ) + (cty-borrow-manager-method-16 this) + (cty-borrow-manager-method-17 this arg0 sv-32) ) - (persist-with-delay - *setting-control* - (the-as symbol *city-borrow-manager*) - (seconds 1000) - 'borrow-hold - (the-as symbol *cty-borrow-manager-list*) - 0.0 - 0 - ) - (cty-borrow-manager-method-16 this) - (cty-borrow-manager-method-17 this arg0 sv-32) (update-sound-info arg0) ) diff --git a/goal_src/jak3/levels/city/common/ff-squad-control.gc b/goal_src/jak3/levels/city/common/ff-squad-control.gc index 4f17faa3b1..b2777dff77 100644 --- a/goal_src/jak3/levels/city/common/ff-squad-control.gc +++ b/goal_src/jak3/levels/city/common/ff-squad-control.gc @@ -171,14 +171,14 @@ ) (defmethod squad-control-method-16 ((this ff-squad-control) (arg0 vector) (arg1 process-focusable) (arg2 squad-target-status)) - (local-vars (sv-176 (array crimson-guard)) (sv-180 (array float)) (sv-184 int)) (let ((t9-0 (method-of-type squad-control squad-control-method-16))) (t9-0 this arg0 arg1 arg2) ) - (let ((s4-0 (get-idx-in-status-arr this (-> arg2 handle)))) - (set! sv-176 (the-as (array crimson-guard) (new 'stack 'boxed-array crimson-guard 16))) - (set! sv-180 (the-as (array float) (new 'stack 'boxed-array float 16))) - (set! sv-184 0) + (let ((s4-0 (get-idx-in-status-arr this (-> arg2 handle))) + (sv-176 (the-as (array crimson-guard) (new 'stack 'boxed-array crimson-guard 16))) + (sv-180 (the-as (array float) (new 'stack 'boxed-array float 16))) + (sv-184 0) + ) (dotimes (s3-0 (the-as int (-> this traffic tracker1 active-object-count))) (case (-> this traffic tracker1 active-object-type-list s3-0) (((traffic-type guard-a)) @@ -189,7 +189,7 @@ ;; og:preserve-this only add guard to the list if their distance isn't NaN ;; any < operation involving NaN will return #t, causing infinite loop in bubble sort below (when (not (is-nan? (-> sv-180 sv-184))) - (set! sv-184 (+ sv-184 1)) + (+! sv-184 1) (set! (-> s2-0 move-index) -1) ) ) diff --git a/goal_src/jak3/levels/city/common/guard-states.gc b/goal_src/jak3/levels/city/common/guard-states.gc index 819277516a..ae3c4f3c97 100644 --- a/goal_src/jak3/levels/city/common/guard-states.gc +++ b/goal_src/jak3/levels/city/common/guard-states.gc @@ -248,16 +248,14 @@ ) ) (when (logtest? (-> self draw status) (draw-control-status on-screen)) - (let ((f0-0 61440.0)) - (cond - ((< (* f0-0 f0-0) (vector-vector-xz-distance-squared (target-pos 0) (-> self root trans))) - (speech-control-method-13 *speech-control* self (speech-type guard-chatter) (-> self traffic-id)) - (speech-control-method-17 *speech-control* (speech-type guard-chatter-jak) 0.2) - ) - (else - (speech-control-method-13 *speech-control* self (speech-type guard-chatter-jak) (-> self traffic-id)) - (speech-control-method-17 *speech-control* (speech-type guard-chatter) 0.2) - ) + (cond + ((< (square 61440.0) (vector-vector-xz-distance-squared (target-pos 0) (-> self root trans))) + (speech-control-method-13 *speech-control* self (speech-type guard-chatter) (-> self traffic-id)) + (speech-control-method-17 *speech-control* (speech-type guard-chatter-jak) 0.2) + ) + (else + (speech-control-method-13 *speech-control* self (speech-type guard-chatter-jak) (-> self traffic-id)) + (speech-control-method-17 *speech-control* (speech-type guard-chatter) 0.2) ) ) ) @@ -383,11 +381,7 @@ ) :post (behavior () (if (and (nonzero? (-> self controller branch)) - (let ((f0-0 (vector-vector-xz-distance-squared (-> self root trans) (-> self dest-point))) - (f1-0 16384.0) - ) - (< f0-0 (* f1-0 f1-0)) - ) + (< (vector-vector-xz-distance-squared (-> self root trans) (-> self dest-point)) (square 16384.0)) ) (vehicle-controller-method-14 (-> self controller) (the-as vehicle self)) ) @@ -475,7 +469,7 @@ ) (let ((f0-7 (* 2.0 (crimson-guard-method-283 this)))) (when (and (time-elapsed? (-> this state-time) (seconds 1)) - (< (* f0-7 f0-7) (vector-vector-xz-distance-squared (-> this root trans) (get-trans s5-0 0))) + (< (square f0-7) (vector-vector-xz-distance-squared (-> this root trans) (get-trans s5-0 0))) ) (set-time! (-> this state-time)) (crimson-guard-method-289 this 0.0) @@ -493,7 +487,6 @@ ) (defmethod crimson-guard-method-254 ((this crimson-guard)) - (local-vars (sv-112 vector) (sv-128 vector) (sv-144 int)) (handle->process (-> this focus handle)) (let ((s5-0 (new 'stack-no-clear 'vector))) (vector-copy! s5-0 (-> this move-position)) @@ -504,27 +497,30 @@ (s0-0 (new 'stack-no-clear 'vector)) (s4-0 (new 'stack-no-clear 'vector)) ) - (set! sv-112 (new 'stack-no-clear 'vector)) - (vector-copy! s1-0 s5-0) - (vector-z-quaternion! s2-0 (-> this root quat)) - (let ((f30-0 (* 182.04445 (* 60.0 (the float (- (-> this traffic-id) *guard-min-id-hack*)))))) - (set! sv-128 s0-0) - (set! (-> sv-128 x) (cos f30-0)) - (set! (-> sv-128 y) 0.0) - (set! (-> sv-128 z) (sin f30-0)) - ) - (set! (-> sv-128 w) 1.0) - (vector+*! s1-0 s1-0 s0-0 12288.0) - (let ((f30-2 (* 0.5 (vector-vector-xz-distance s3-0 s1-0)))) - (vector-normalize! s2-0 (/ f30-2 2)) - (vector-normalize! s0-0 (* 2.0 f30-2)) - ) - (set! sv-144 0) - (while (< sv-144 10) - (do-spline s4-0 s3-0 s2-0 s1-0 s0-0 (* 0.1 (the float sv-144))) - (do-spline sv-112 s3-0 s2-0 s1-0 s0-0 (* 0.1 (the float (+ sv-144 1)))) - (add-debug-line #t (bucket-id debug-no-zbuf1) s4-0 sv-112 *color-red* #f (the-as rgba -1)) - (set! sv-144 (+ sv-144 1)) + (let ((sv-112 (new 'stack-no-clear 'vector))) + (vector-copy! s1-0 s5-0) + (vector-z-quaternion! s2-0 (-> this root quat)) + (let ((f30-0 (* 182.04445 (* 60.0 (the float (- (-> this traffic-id) *guard-min-id-hack*))))) + (sv-128 s0-0) + ) + (set! (-> sv-128 x) (cos f30-0)) + (set! (-> sv-128 y) 0.0) + (set! (-> sv-128 z) (sin f30-0)) + (set! (-> sv-128 w) 1.0) + ) + (vector+*! s1-0 s1-0 s0-0 12288.0) + (let ((f30-2 (* 0.5 (vector-vector-xz-distance s3-0 s1-0)))) + (vector-normalize! s2-0 (/ f30-2 2)) + (vector-normalize! s0-0 (* 2.0 f30-2)) + ) + (let ((sv-144 0)) + (while (< sv-144 10) + (do-spline s4-0 s3-0 s2-0 s1-0 s0-0 (* 0.1 (the float sv-144))) + (do-spline sv-112 s3-0 s2-0 s1-0 s0-0 (* 0.1 (the float (+ sv-144 1)))) + (add-debug-line #t (bucket-id debug-no-zbuf1) s4-0 sv-112 *color-red* #f (the-as rgba -1)) + (+! sv-144 1) + ) + ) ) (do-spline s4-0 s3-0 s2-0 s1-0 s0-0 0.9) (vector-copy! s4-0 s5-0) diff --git a/goal_src/jak3/levels/city/common/guard-tazer.gc b/goal_src/jak3/levels/city/common/guard-tazer.gc index 262d096eae..d20948c4f9 100644 --- a/goal_src/jak3/levels/city/common/guard-tazer.gc +++ b/goal_src/jak3/levels/city/common/guard-tazer.gc @@ -8,7 +8,6 @@ ;; DECOMP BEGINS (defun spread-lightning-lazer ((arg0 lightning-control) (arg1 vector) (arg2 vector) (arg3 vector)) - (local-vars (sv-640 int) (sv-656 vector)) (let ((s5-0 (new 'stack-no-clear 'vector))) (vector-copy! s5-0 arg1) (let ((s4-0 (new 'stack-no-clear 'vector))) @@ -19,8 +18,9 @@ (vector-length arg2) (let ((s1-0 (new 'stack-no-clear 'vector))) (vector-copy! s1-0 arg3) - (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) @@ -64,11 +64,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) - (vector-copy! s1-0 sv-656) - (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) + (vector-copy! s1-0 sv-656) + (vector-flatten! s4-0 s4-0 sv-656) + ) ) (else (vector+! s5-0 s5-0 s4-0) @@ -79,7 +80,7 @@ ) ) ) - (set! sv-640 (+ sv-640 1)) + (+! sv-640 1) ) ) ) @@ -91,7 +92,6 @@ ;; WARN: Return type mismatch object vs none. (defmethod crimson-guard-method-263 ((this crimson-guard)) - (local-vars (sv-832 vector)) (let* ((s4-0 (vector<-cspace! (new 'stack-no-clear 'vector) (-> this node-list data 14))) (v0-1 (vector<-cspace! (new 'stack-no-clear 'vector) (-> this node-list data 15))) (s2-0 (vector-normalize! (vector-! (new 'stack-no-clear 'vector) s4-0 v0-1) 16384.0)) @@ -134,15 +134,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-832 (-> s3-0 best-other-tri normal)) - (let* ((a2-3 (rand-vu-float-range 0.0 65536.0)) - (a2-4 (s1-1 s0-0 sv-832 a2-3)) - ) - (vector-orient-by-quat! s2-1 s2-1 a2-4) - ) + (vector-orient-by-quat! s2-1 s2-1 a2-4) ) (cond ((logtest? (-> part-crimson-lightning-glow flags) (sp-group-flag sp13)) diff --git a/goal_src/jak3/levels/city/common/height-map.gc b/goal_src/jak3/levels/city/common/height-map.gc index 10926a9b27..b3d6bdffe9 100644 --- a/goal_src/jak3/levels/city/common/height-map.gc +++ b/goal_src/jak3/levels/city/common/height-map.gc @@ -121,7 +121,6 @@ ) (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 'inline-array 'bounding-box 2))) @@ -138,16 +137,17 @@ (let ((s0-0 s2-0)) (set! (-> s5-0 0 min x) (-> this x-offset)) (set! (-> s5-0 0 min 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)) - (vector-copy! (-> s5-0 0 max) (-> s5-0 0 min)) - (+! (-> s5-0 0 min x) f28-0) - (set! s0-0 (&-> s0-0 1)) - (set! (-> s5-0 0 min y) (+ (-> this y-offset) (* (the float (-> s0-0 0)) (-> this y-scale)))) - (if (and (point-in-bbox? (-> s5-0 1) (-> s5-0 0 min)) (point-in-bbox? (-> s5-0 1) (-> s5-0 0 max))) - (add-debug-line #t (bucket-id debug) (-> s5-0 0 min) (-> s5-0 0 max) *color-red* #f (the-as rgba -1)) - ) + (let ((sv-80 (+ s4-0 -1))) + (while (nonzero? sv-80) + (+! sv-80 -1) + (vector-copy! (-> s5-0 0 max) (-> s5-0 0 min)) + (+! (-> s5-0 0 min x) f28-0) + (set! s0-0 (&-> s0-0 1)) + (set! (-> s5-0 0 min y) (+ (-> this y-offset) (* (the float (-> s0-0 0)) (-> this y-scale)))) + (if (and (point-in-bbox? (-> s5-0 1) (-> s5-0 0 min)) (point-in-bbox? (-> s5-0 1) (-> s5-0 0 max))) + (add-debug-line #t (bucket-id debug) (-> s5-0 0 min) (-> s5-0 0 max) *color-red* #f (the-as rgba -1)) + ) + ) ) ) (+! (-> s5-0 0 min z) f30-0) @@ -162,18 +162,19 @@ (set! (-> s5-0 0 min 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)) - (vector-copy! (-> s5-0 0 max) (-> s5-0 0 min)) - (+! (-> s5-0 0 min z) f30-0) - (&+! s0-1 s4-0) - (set! (-> s5-0 0 min 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) + (vector-copy! (-> s5-0 0 max) (-> s5-0 0 min)) + (+! (-> s5-0 0 min z) f30-0) + (&+! s0-1 s4-0) + (set! (-> s5-0 0 min y) + (+ (-> this y-offset) (* (the float (-> (the-as (pointer int8) s0-1))) (-> this y-scale))) + ) + (if (and (point-in-bbox? (-> s5-0 1) (-> s5-0 0 min)) (point-in-bbox? (-> s5-0 1) (-> s5-0 0 max))) + (add-debug-line #t (bucket-id debug) (-> s5-0 0 min) (-> s5-0 0 max) *color-blue* #f (the-as rgba -1)) ) - (if (and (point-in-bbox? (-> s5-0 1) (-> s5-0 0 min)) (point-in-bbox? (-> s5-0 1) (-> s5-0 0 max))) - (add-debug-line #t (bucket-id debug) (-> s5-0 0 min) (-> s5-0 0 max) *color-blue* #f (the-as rgba -1)) - ) + ) ) ) (+! (-> s5-0 0 min x) f28-0) diff --git a/goal_src/jak3/levels/city/common/kg-squad-member.gc b/goal_src/jak3/levels/city/common/kg-squad-member.gc index d12197846b..26c7b519bc 100644 --- a/goal_src/jak3/levels/city/common/kg-squad-member.gc +++ b/goal_src/jak3/levels/city/common/kg-squad-member.gc @@ -121,11 +121,10 @@ ) (defmethod kg-squad-member-method-219 ((this kg-squad-member) (arg0 process-focusable)) - (let* ((s4-0 (get-trans arg0 0)) - (f0-0 (vector-vector-xz-distance-squared (-> this root trans) s4-0)) - (f1-0 409600.0) - ) - (or (and (< f0-0 (* f1-0 f1-0)) (< (fabs (- (-> s4-0 y) (-> this root trans y))) 61440.0)) + (let ((s4-0 (get-trans arg0 0))) + (or (and (< (vector-vector-xz-distance-squared (-> this root trans) s4-0) (square 409600.0)) + (< (fabs (- (-> s4-0 y) (-> this root trans y))) 61440.0) + ) (< 0.0 (get-hatred-val-for-target this (process->handle arg0))) ) ) @@ -226,13 +225,9 @@ (if (or (not (-> this draw)) (not (logtest? (-> this draw status) (draw-control-status on-screen)))) (return #f) ) - (let ((f0-0 (vector-vector-xz-distance-squared (-> this root trans) (math-camera-pos))) - (f1-0 122880.0) - ) - (if (< f0-0 (* f1-0 f1-0)) - (return #t) - ) - ) + (if (< (vector-vector-xz-distance-squared (-> this root trans) (math-camera-pos)) (square 122880.0)) + (return #t) + ) #f ) diff --git a/goal_src/jak3/levels/city/common/krimson-wall.gc b/goal_src/jak3/levels/city/common/krimson-wall.gc index 400e29bdfb..76b9b0d71b 100644 --- a/goal_src/jak3/levels/city/common/krimson-wall.gc +++ b/goal_src/jak3/levels/city/common/krimson-wall.gc @@ -209,7 +209,6 @@ (defmethod init-from-entity! ((this krimson-wall-break) (arg0 entity-actor)) "Set up a newly created process from the entity that created it." - (local-vars (sv-96 entity)) (set! (-> this level) (level-get *level* (-> this level-name))) (stack-size-set! (-> this main-thread) 512) (set! (-> this root) (new 'process 'trsqv)) @@ -236,39 +235,20 @@ (set! s5-1 (-> v0-8 extra trans)) ) ) - (let ((s3-1 (get-process *default-dead-pool* manipy #x20000 1))) - (set! (-> this pillar 0) - (the-as - (pointer manipy) - (when s3-1 - (let ((t9-10 (method-of-type manipy activate))) - (t9-10 (the-as manipy s3-1) this "krimson-wall-break" (the-as pointer #x70004000)) - ) - (let ((s2-1 run-function-in-process) - (s1-0 s3-1) - (s0-0 manipy-init) - ) - (set! sv-96 (-> this level entity data 0 entity)) - (let ((t0-1 (art-group-get-by-name *level* "skel-krimson-wall-break" (the-as (pointer level) #f))) - (t1-1 #f) - (t2-1 0) - ) - ((the-as (function object object object object object object object none) s2-1) - s1-0 - s0-0 - s4-1 - sv-96 - t0-1 - t1-1 - t2-1 - ) - ) - ) - (-> s3-1 ppointer) - ) - ) + (set! (-> this pillar 0) + (process-spawn + manipy + :init manipy-init + s4-1 + (-> this level entity data 0 entity) + (art-group-get-by-name *level* "skel-krimson-wall-break" (the-as (pointer level) #f)) + #f + 0 + :name "krimson-wall-break" + :to this + :stack-size #x20000 ) - ) + ) (send-event (ppointer->process (-> this pillar 0)) 'anim-mode 'clone-anim) (send-event (ppointer->process (-> this pillar 0)) 'prefix "a-") (set! (-> this pillar 1) diff --git a/goal_src/jak3/levels/city/common/mh-squad-member.gc b/goal_src/jak3/levels/city/common/mh-squad-member.gc index e4766521ae..3e70d7f8d3 100644 --- a/goal_src/jak3/levels/city/common/mh-squad-member.gc +++ b/goal_src/jak3/levels/city/common/mh-squad-member.gc @@ -84,11 +84,10 @@ ) (defmethod pfoc-in-range? ((this mh-squad-member) (arg0 process-focusable)) - (let* ((s5-0 (get-trans arg0 0)) - (f0-0 (vector-vector-xz-distance-squared (-> this root trans) s5-0)) - (f1-0 245760.0) + (let ((s5-0 (get-trans arg0 0))) + (and (< (vector-vector-xz-distance-squared (-> this root trans) s5-0) (square 245760.0)) + (< (fabs (- (-> s5-0 y) (-> this root trans y))) 61440.0) ) - (and (< f0-0 (* f1-0 f1-0)) (< (fabs (- (-> s5-0 y) (-> this root trans y))) 61440.0)) ) ) @@ -220,22 +219,18 @@ (the-as enemy-aware #f) ) (update-focus this) - (let ((f0-0 (vector-vector-xz-distance-squared (-> this root trans) (-> this focus-pos))) - (f1-0 266240.0) - ) - (cond - ((< f0-0 (* f1-0 f1-0)) - (when (not (logtest? (-> this squad alert-state flags) (squad-alert-flag war))) - (set! v0-6 (logior (-> this flags) (citizen-flag persistent))) - (set! (-> this flags) (the-as citizen-flag v0-6)) - v0-6 - ) + (cond + ((< (vector-vector-xz-distance-squared (-> this root trans) (-> this focus-pos)) (square 266240.0)) + (when (not (logtest? (-> this squad alert-state flags) (squad-alert-flag war))) + (set! v0-6 (logior (-> this flags) (citizen-flag persistent))) + (set! (-> this flags) (the-as citizen-flag v0-6)) + v0-6 ) - (else - (set! v0-6 (logclear (-> this flags) (citizen-flag persistent))) - (set! (-> this flags) (the-as citizen-flag v0-6)) - v0-6 - ) + ) + (else + (set! v0-6 (logclear (-> this flags) (citizen-flag persistent))) + (set! (-> this flags) (the-as citizen-flag v0-6)) + v0-6 ) ) ) diff --git a/goal_src/jak3/levels/city/common/nav-graph.gc b/goal_src/jak3/levels/city/common/nav-graph.gc index ec13489ad8..2776fded70 100644 --- a/goal_src/jak3/levels/city/common/nav-graph.gc +++ b/goal_src/jak3/levels/city/common/nav-graph.gc @@ -93,11 +93,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 debug) gp-0 *color-red*) (let ((s4-1 add-debug-text-3d) @@ -926,9 +922,7 @@ (defmethod find-nearest-nav-node ((this nav-graph) (arg0 vector) (arg1 symbol)) (let ((gp-0 (the-as nav-node #f))) - (let* ((f0-0 409600000.0) - (f30-0 (* f0-0 f0-0)) - ) + (let ((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)) @@ -983,7 +977,6 @@ ) (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)) @@ -1001,24 +994,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-poly)) - ) - (vector-! (-> a1-5 vertex 0) s3-0 (the-as vector (-> a0-10 bounds))) - (set! (-> a1-5 vertex1 x) 40960.0) - (set! (-> a1-5 data 20) (the-as uint 2)) - (if (nav-mesh-method-45 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-poly)) + ) + (vector-! (-> a1-5 vertex 0) s3-0 (the-as vector (-> a0-10 bounds))) + (set! (-> a1-5 vertex1 x) 40960.0) + (set! (-> a1-5 data 20) (the-as uint 2)) + (if (nav-mesh-method-45 a0-10 a1-5) + (set! (-> s4-0 nav-mesh-id) (-> sv-80 aid)) + ) + ) ) ) ) @@ -1204,15 +1193,6 @@ ) (defmethod from-editor ((this nav-graph) (arg0 mysql-nav-graph) (arg1 symbol)) - (local-vars - (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) - ) (set! (-> this node-count) 0) (set! (-> this branch-count) 0) (set! (-> this link-count) 0) @@ -1230,8 +1210,9 @@ cfg-27 :delay (nop!) ) - (set! sv-16 (temp-edge-size s0-0)) - (let ((s1-0 (add-node this sv-16))) + (let* ((sv-16 (temp-edge-size s0-0)) + (s1-0 (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) @@ -1250,50 +1231,52 @@ (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) + ) (while (nonzero? sv-32) - (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))) - (cond - ((or (= arg1 #f) (= arg1 (-> sv-48 level_name))) - (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) - ) - ) - ) - ) - (t9-11 sv-64 a1-11) - ) - ) - (else - (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) + (+! 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)))) + (cond + ((or (= arg1 #f) (= arg1 (-> sv-48 level_name))) + (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) + ) + ) + ) + ) + (else + (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) + ) + (+! (-> this link-count) 1) + ) + ) ) ) (+! s5-0 1) diff --git a/goal_src/jak3/levels/city/common/trail.gc b/goal_src/jak3/levels/city/common/trail.gc index b6998dbba5..721b59c7ef 100644 --- a/goal_src/jak3/levels/city/common/trail.gc +++ b/goal_src/jak3/levels/city/common/trail.gc @@ -32,21 +32,10 @@ 1.0 ) (vector-lerp! s5-0 s4-0 s3-0 0.5) - (let* ((s2-0 (math-camera-pos)) - (f0-14 (vector-vector-distance-squared s4-0 s2-0)) - (f1-12 819200.0) - ) - (when (or (< f0-14 (* f1-12 f1-12)) - (let ((f0-15 (vector-vector-distance-squared s3-0 s2-0)) - (f1-15 819200.0) - ) - (< f0-15 (* f1-15 f1-15)) - ) - (let ((f0-16 (vector-vector-distance-squared s5-0 s2-0)) - (f1-18 819200.0) - ) - (< f0-16 (* f1-18 f1-18)) - ) + (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 debug) s4-0 s3-0 *color-orange* #f (the-as rgba -1)) (let ((s4-1 add-debug-text-3d) @@ -75,25 +64,22 @@ ) (set! (-> s4-0 quad) (-> s5-0 quad)) (set! (-> s4-0 r) 4096.0) - (let ((f0-8 (vector-vector-distance-squared s5-0 (math-camera-pos))) - (f1-6 819200.0) - ) - (when (and (< f0-8 (* f1-6 f1-6)) (sphere-in-view-frustum? s4-0)) - (add-debug-x #t (bucket-id debug) s5-0 *color-red*) - (let ((s4-1 add-debug-text-3d) - (s3-1 #t) - (s2-1 583) - ) - (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 debug) s5-0 *color-red*) + (let ((s4-1 add-debug-text-3d) + (s3-1 #t) + (s2-1 583) + ) + (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)) ) ) ) ) (defmethod trail-graph-method-15 ((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 4)) @@ -124,24 +110,10 @@ ) (let ((s1-0 add-debug-text-3d) (s0-0 #t) + (sv-80 583) ) - (set! sv-80 583) - (set! sv-96 format) - (let ((a0-21 (clear *temp-string*)) - (a1-5 "cell ~D (~D,~D)") - (a2-4 arg0) - (a3-4 (logand arg0 15)) - (t0-4 (/ arg0 16)) - ) - (sv-96 a0-21 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)))))) @@ -160,33 +132,33 @@ ;; WARN: new jak 2 until loop case, check carefully (defmethod trail-graph-method-16 ((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) (+ (-> arg2 y) arg5) (+ (-> arg2 z) arg5) 1.0) - (set! sv-48 0) - (until #f - (vector-copy! (-> s0-0 0) (-> s0-0 1)) - (cond - ((< sv-48 arg0) - (let ((a0-6 (-> this node (-> arg1 sv-48)))) - (set-vector! - (-> s0-0 1) - (+ (* 4096.0 (the float (-> a0-6 x))) arg5) - (+ (* 4096.0 (the float (-> a0-6 y))) arg5) - (+ (* 4096.0 (the float (-> a0-6 z))) arg5) - 1.0 + (let ((sv-48 0)) + (until #f + (vector-copy! (-> s0-0 0) (-> s0-0 1)) + (cond + ((< sv-48 arg0) + (let ((a0-6 (-> this node (-> arg1 sv-48)))) + (set-vector! + (-> s0-0 1) + (+ (* 4096.0 (the float (-> a0-6 x))) arg5) + (+ (* 4096.0 (the float (-> a0-6 y))) arg5) + (+ (* 4096.0 (the float (-> a0-6 z))) arg5) + 1.0 + ) ) ) - ) - ((= sv-48 arg0) - (set-vector! (-> s0-0 1) (+ (-> arg3 x) arg5) (+ (-> arg3 y) arg5) (+ (-> arg3 z) arg5) 1.0) - ) - (else - (return #f) + ((= sv-48 arg0) + (set-vector! (-> s0-0 1) (+ (-> arg3 x) arg5) (+ (-> arg3 y) arg5) (+ (-> arg3 z) arg5) 1.0) + ) + (else + (return #f) + ) ) + (add-debug-line #t (bucket-id debug) (-> s0-0 0) (-> s0-0 1) arg4 #f (the-as rgba -1)) + (+! sv-48 1) ) - (add-debug-line #t (bucket-id debug) (-> s0-0 0) (-> s0-0 1) arg4 #f (the-as rgba -1)) - (set! sv-48 (+ sv-48 1)) ) ) #f @@ -407,7 +379,7 @@ (cond ((> a1-1 0) (let* ((a1-4 (the-as object (+ (the-as uint (-> this visgroup)) (* (+ a1-1 -1) 4)))) - (a0-7 (&-> (-> this visnode-ids) (-> (the-as (pointer uint16) a1-4)))) + (a0-7 (&-> this visnode-ids (-> (the-as (pointer uint16) a1-4)))) ) (countdown (a1-5 (-> (the-as trail-conn-hash-cell a1-4) conn-count)) (let ((a3-4 (-> v1-1 (-> a0-7 0)))) @@ -464,7 +436,7 @@ (when (not (logtest? a2-4 a1-2)) (set! (-> arg0 cell-quads 0 byte a0-1) (logior a2-4 a1-2)) (let* ((v1-3 (-> this conn-hash cell v1-1)) - (s4-0 (&-> (-> this conn-hash conn-ids) (-> v1-3 first-conn))) + (s4-0 (&-> this conn-hash conn-ids (-> v1-3 first-conn))) ) (countdown (s3-0 (-> v1-3 conn-count)) (let* ((s2-0 (-> s4-0 0)) @@ -614,7 +586,7 @@ (cond ((> v1-1 0) (let* ((v1-4 (the-as object (+ (the-as uint (-> this visgroup)) (* (+ v1-1 -1) 4)))) - (s4-1 (&-> (-> this visnode-ids) (-> (the-as (pointer uint16) v1-4)))) + (s4-1 (&-> this visnode-ids (-> (the-as (pointer uint16) v1-4)))) (s3-0 (-> (the-as trail-conn-hash-cell v1-4) conn-count)) ) (-> this visnode-ids) @@ -871,7 +843,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)))) ) @@ -910,7 +882,7 @@ (set! (-> this goal-node-id) s5-0) (return 3) ) - (let ((s3-0 (&-> (-> this conn-ids) (-> s4-0 first-conn)))) + (let ((s3-0 (&-> this conn-ids (-> s4-0 first-conn)))) (countdown (s2-0 (-> s4-0 conn-count)) (let* ((a0-8 (-> this conn (-> s3-0 0))) (v1-14 (-> a0-8 flags)) @@ -1014,7 +986,7 @@ (vector-copy! (-> s5-0 p1) (-> s5-0 p0)) (set! (-> s5-0 best-count) (the-as uint 0)) (set! (-> s5-0 best-dist) -1.0) - (let ((s2-0 (&-> (-> this conn-ids) (-> v1-2 first-conn)))) + (let ((s2-0 (&-> this conn-ids (-> v1-2 first-conn)))) (countdown (s1-0 (-> v1-2 conn-count)) (let* ((v1-4 (-> this conn (-> s2-0 0))) (s0-0 (-> v1-4 tail-id)) diff --git a/goal_src/jak3/levels/city/ctyport-obs.gc b/goal_src/jak3/levels/city/ctyport-obs.gc index 8619026afa..f61a26856d 100644 --- a/goal_src/jak3/levels/city/ctyport-obs.gc +++ b/goal_src/jak3/levels/city/ctyport-obs.gc @@ -277,169 +277,132 @@ ) (defmethod vehicle-method-103 ((this boat-base)) - (local-vars (v1-8 float)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf1 :class vf) - (vf2 :class vf) - ) - (init-vf0-vector) - (when (time-elapsed? (-> this disturbed-time) (seconds 2)) - (let* ((f0-0 (-> this camera-dist2)) - (f1-0 0.000024414063) - (f0-1 (* f0-0 (* f1-0 f1-0))) - ) - (.lvf vf1 (&-> (-> this rbody ang-velocity) 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-8 vf1) - (when (< v1-8 f0-1) - (logclear! (-> this v-flags) (vehicle-flag disturbed)) - (vehicle-method-142 this) - ) + (when (time-elapsed? (-> this disturbed-time) (seconds 2)) + (let ((f0-1 (* (-> this camera-dist2) (square 0.000024414063)))) + (when (< (vector-length-squared (-> this rbody ang-velocity)) f0-1) + (logclear! (-> this v-flags) (vehicle-flag disturbed)) + (vehicle-method-142 this) ) ) - 0 - (none) ) + 0 + (none) ) ;; WARN: Return type mismatch none vs object. (defmethod rigid-body-object-method-30 ((this boat-base)) - (local-vars (v1-42 float)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf1 :class vf) - (vf2 :class vf) - ) - (init-vf0-vector) - (rider-trans) - (let ((t9-1 (method-of-type vehicle rigid-body-object-method-30))) - (t9-1 this) - ) - (let ((s5-0 (-> this root))) - (pull-riders! s5-0) - (cond - ((logtest? (do-push-aways s5-0) (collide-spec jak)) - (+! (-> this overlap-player-counter) 1) - ;; og:preserve-this changed for high fps - (when (< (the uint (/ 60.0 DISPLAY_FPS_RATIO)) (-> this overlap-player-counter)) - (send-event - *target* - 'attack-invinc - #f - (static-attack-info - :mask (vehicle-impulse-factor) - ((id (new-attack-id)) (damage 1000.0) (vehicle-damage-factor 1.0) (vehicle-impulse-factor 1.0) (mode 'smush)) - ) + (rider-trans) + (let ((t9-1 (method-of-type vehicle rigid-body-object-method-30))) + (t9-1 this) + ) + (let ((s5-0 (-> this root))) + (pull-riders! s5-0) + (cond + ((logtest? (do-push-aways s5-0) (collide-spec jak)) + (+! (-> this overlap-player-counter) 1) + ;; og:preserve-this changed for high fps + (when (< (the uint (/ 60.0 DISPLAY_FPS_RATIO)) (-> this overlap-player-counter)) + (send-event + *target* + 'attack-invinc + #f + (static-attack-info + :mask (vehicle-impulse-factor) + ((id (new-attack-id)) (damage 1000.0) (vehicle-damage-factor 1.0) (vehicle-impulse-factor 1.0) (mode 'smush)) ) - (set! (-> this overlap-player-counter) (the-as uint 0)) - 0 ) + (set! (-> this overlap-player-counter) (the-as uint 0)) + 0 ) - (else - (set! (-> this overlap-player-counter) (the-as uint 0)) - 0 - ) - ) - ) - (when (not (logtest? (-> this rbody flags) (rigid-body-flag enable-physics))) - (let ((s5-1 (new 'stack-no-clear 'inline-array 'vector 6))) - (let ((a1-1 (-> this nav state))) - (vector-copy! (-> s5-1 0) (-> a1-1 velocity)) - ) - (let ((s4-0 (new 'stack 'clamp-travel-vector-to-mesh-return-info))) - (let ((s3-0 (-> this nav state current-poly))) - (vector-xz-normalize-copy! (-> s5-1 3) (-> s5-1 0) 163840.0) - (vector-copy! (-> s5-1 4) (-> s5-1 3)) - (clamp-vector-to-mesh-no-gaps (-> this nav) (-> this root trans) s3-0 (-> s5-1 4) s4-0) - ) - (when (-> s4-0 found-boundary) - (let ((f30-0 (vector-length (-> s5-1 0)))) - (vector-flatten! (-> s5-1 0) (-> s5-1 0) (-> s4-0 boundary-normal)) - (vector-rotate90-around-y! (-> s5-1 0) (-> s4-0 boundary-normal)) - (vector-normalize! (-> s5-1 0) f30-0) - ) - (when (= this *debug-actor*) - (add-debug-vector #t (bucket-id debug-no-zbuf1) (-> this root trans) (-> s5-1 0) (meters 10) *color-blue*) - (format *stdebug* "avoid border~%") - ) - ) - ) - (let* ((f0-3 4.096) - (f0-5 (* f0-3 f0-3)) - ) - (.lvf vf1 (&-> (-> s5-1 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-42 vf1) - (when (< f0-5 v1-42) - (vector-copy! (-> s5-1 5) (-> s5-1 0)) - (vector-normalize! (-> s5-1 5) 1.0) - (let ((s4-1 (-> this root quat))) - (quaternion-set! (the-as quaternion (-> s5-1 2)) 0.0 (-> s5-1 5 x) 0.0 (+ 1.0 (-> s5-1 5 z))) - (quaternion-normalize! (the-as quaternion (-> s5-1 2))) - (quaternion-smooth-seek! s4-1 s4-1 (the-as quaternion (-> s5-1 2)) (* 1.2 (seconds-per-frame))) - ) - (vector-z-quaternion! (-> s5-1 1) (-> this root quat)) - (vector-v*float+! (-> this root trans) (-> this root trans) (-> s5-1 1) 8954.266) - (seek! (-> this root trans y) 4096.0 (* 4096.0 (seconds-per-frame))) - ) - ) - ) - (when (= this *debug-actor*) - (format *stdebug* "no physics~%") - (format *stdebug* "~M~%" (-> this root trans y)) - ) - ) - (if (= this *debug-actor*) - (format *stdebug* "speed ~M~%" (vector-length (-> this root transv))) - ) - (let ((s4-2 (handle->process (-> this manager))) - (s5-2 (new 'stack-no-clear 'vector)) - ) - (when s4-2 - (let ((a1-22 (-> this nav state))) - (vector-copy! s5-2 (-> a1-22 target-pos)) - ) - (if (or (= (-> this path-num) 2) (-> *setting-control* user-current stop-boats?)) - (get-point-at-percent-along-path! - (-> (the-as boat-manager (+ (* (-> this path-num) 4) (the-as uint s4-2))) paths 0) - (-> this root trans) - (-> this path-index) - 'interp - ) - ) - (when (and (not (or (= (-> this path-num) 2) (-> *setting-control* user-current stop-boats?))) - (< (vector-vector-xz-distance (-> this root trans) s5-2) 163840.0) - ) - (+! (-> this path-index) 0.01) - (let ((f0-20 (-> this path-index))) - (set! (-> this path-index) (- f0-20 (* (the float (the int (/ f0-20 1.0))) 1.0))) - ) - ) - (get-point-at-percent-along-path! - (-> (the-as boat-manager (+ (* (-> this path-num) 4) (the-as uint s4-2))) paths 0) - s5-2 - (-> this path-index) - 'interp - ) - (let ((v1-102 (-> this nav state))) - (logclear! (-> v1-102 flags) (nav-state-flag directional-mode)) - (logior! (-> v1-102 flags) (nav-state-flag target-poly-dirty)) - (vector-copy! (-> v1-102 target-pos) s5-2) - ) + ) + (else + (set! (-> this overlap-player-counter) (the-as uint 0)) 0 ) ) - (vehicle-method-78 this) ) + (when (not (logtest? (-> this rbody flags) (rigid-body-flag enable-physics))) + (let ((s5-1 (new 'stack-no-clear 'inline-array 'vector 6))) + (let ((a1-1 (-> this nav state))) + (vector-copy! (-> s5-1 0) (-> a1-1 velocity)) + ) + (let ((s4-0 (new 'stack 'clamp-travel-vector-to-mesh-return-info))) + (let ((s3-0 (-> this nav state current-poly))) + (vector-xz-normalize-copy! (-> s5-1 3) (-> s5-1 0) 163840.0) + (vector-copy! (-> s5-1 4) (-> s5-1 3)) + (clamp-vector-to-mesh-no-gaps (-> this nav) (-> this root trans) s3-0 (-> s5-1 4) s4-0) + ) + (when (-> s4-0 found-boundary) + (let ((f30-0 (vector-length (-> s5-1 0)))) + (vector-flatten! (-> s5-1 0) (-> s5-1 0) (-> s4-0 boundary-normal)) + (vector-rotate90-around-y! (-> s5-1 0) (-> s4-0 boundary-normal)) + (vector-normalize! (-> s5-1 0) f30-0) + ) + (when (= this *debug-actor*) + (add-debug-vector #t (bucket-id debug-no-zbuf1) (-> this root trans) (-> s5-1 0) (meters 10) *color-blue*) + (format *stdebug* "avoid border~%") + ) + ) + ) + (when (< (square 4.096) (vector-length-squared (-> s5-1 0))) + (vector-copy! (-> s5-1 5) (-> s5-1 0)) + (vector-normalize! (-> s5-1 5) 1.0) + (let ((s4-1 (-> this root quat))) + (quaternion-set! (the-as quaternion (-> s5-1 2)) 0.0 (-> s5-1 5 x) 0.0 (+ 1.0 (-> s5-1 5 z))) + (quaternion-normalize! (the-as quaternion (-> s5-1 2))) + (quaternion-smooth-seek! s4-1 s4-1 (the-as quaternion (-> s5-1 2)) (* 1.2 (seconds-per-frame))) + ) + (vector-z-quaternion! (-> s5-1 1) (-> this root quat)) + (vector-v*float+! (-> this root trans) (-> this root trans) (-> s5-1 1) 8954.266) + (seek! (-> this root trans y) 4096.0 (* 4096.0 (seconds-per-frame))) + ) + ) + (when (= this *debug-actor*) + (format *stdebug* "no physics~%") + (format *stdebug* "~M~%" (-> this root trans y)) + ) + ) + (if (= this *debug-actor*) + (format *stdebug* "speed ~M~%" (vector-length (-> this root transv))) + ) + (let ((s4-2 (handle->process (-> this manager))) + (s5-2 (new 'stack-no-clear 'vector)) + ) + (when s4-2 + (let ((a1-22 (-> this nav state))) + (vector-copy! s5-2 (-> a1-22 target-pos)) + ) + (if (or (= (-> this path-num) 2) (-> *setting-control* user-current stop-boats?)) + (get-point-at-percent-along-path! + (-> (the-as boat-manager (+ (* (-> this path-num) 4) (the-as uint s4-2))) paths 0) + (-> this root trans) + (-> this path-index) + 'interp + ) + ) + (when (and (not (or (= (-> this path-num) 2) (-> *setting-control* user-current stop-boats?))) + (< (vector-vector-xz-distance (-> this root trans) s5-2) 163840.0) + ) + (+! (-> this path-index) 0.01) + (let ((f0-20 (-> this path-index))) + (set! (-> this path-index) (- f0-20 (* (the float (the int (/ f0-20 1.0))) 1.0))) + ) + ) + (get-point-at-percent-along-path! + (-> (the-as boat-manager (+ (* (-> this path-num) 4) (the-as uint s4-2))) paths 0) + s5-2 + (-> this path-index) + 'interp + ) + (let ((v1-102 (-> this nav state))) + (logclear! (-> v1-102 flags) (nav-state-flag directional-mode)) + (logior! (-> v1-102 flags) (nav-state-flag target-poly-dirty)) + (vector-copy! (-> v1-102 target-pos) s5-2) + ) + 0 + ) + ) + (vehicle-method-78 this) ) (defmethod clear-impulse-force-flag! ((this boat-base)) diff --git a/goal_src/jak3/levels/city/ctywide-obs.gc b/goal_src/jak3/levels/city/ctywide-obs.gc index d6efbcbad8..cd195c009a 100644 --- a/goal_src/jak3/levels/city/ctywide-obs.gc +++ b/goal_src/jak3/levels/city/ctywide-obs.gc @@ -188,14 +188,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))) (vector-copy! (-> s5-0 0) (-> s4-0 control trans)) - (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)))) ) @@ -462,12 +461,7 @@ (set! (-> v0-6 x) 0.0) (set! (-> v0-6 y) (* 0.00024414062 (/ arg2 2))) (set! (-> v0-6 z) 0.0) - (let ((f0-20 0.5) - (f1-7 (* f30-1 f30-1)) - (f2-2 arg2) - ) - (set! (-> v0-6 w) (* f0-20 (sqrtf (+ f1-7 (* f2-2 f2-2))))) - ) + (set! (-> v0-6 w) (* 0.5 (sqrtf (+ (square f30-1) (square arg2))))) v0-6 ) ) @@ -703,9 +697,9 @@ ((or (-> *setting-control* user-current disable-parking-spots?) (focus-test? s5-0 dead inactive) (not (logtest? (vehicle-flag waiting-for-player) (-> s5-0 v-flags))) - (let ((f0-0 (-> this test-sphere r))) - (< (* f0-0 f0-0) (vector-vector-distance-squared (-> s5-0 root trans) (-> this test-sphere))) - ) + (< (square (-> this test-sphere r)) + (vector-vector-distance-squared (-> s5-0 root trans) (-> this test-sphere)) + ) ) (logclear! (-> s5-0 v-flags) (vehicle-flag persistent)) (cond @@ -713,11 +707,11 @@ (when (or (< (-> *display* base-clock frame-counter) (-> *game-info* blackout-time)) (>= (-> *setting-control* user-current bg-a) 1.0) (>= (-> *setting-control* user-current bg-a-force) 1.0) - (let ((f0-5 (-> this test-sphere r))) - (and (>= (* f0-5 f0-5) (vector-vector-distance-squared (-> s5-0 root trans) (-> this test-sphere))) - (not (sphere-in-view-frustum? (-> this test-sphere))) - ) - ) + (and (>= (square (-> this test-sphere r)) + (vector-vector-distance-squared (-> s5-0 root trans) (-> this test-sphere)) + ) + (not (sphere-in-view-frustum? (-> this test-sphere))) + ) ) (send-event (handle->process (-> this vehicle)) 'traffic-off-force) (set! (-> this vehicle) (the-as handle #f)) @@ -1491,34 +1485,20 @@ (remove-setting! 'mode-name) ) :trans (behavior () - (local-vars - (sv-272 vector) - (sv-288 quaternion) - (sv-304 (function float float float float float float)) - (sv-320 float) - (sv-336 float) - ) (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!) + (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) + (lerp-scale (-> self rotmin) (-> self rotmax) (sin (* 7281.778 (-> self time))) -1.0 1.0) ) - (set! sv-272 (new 'stack-no-clear 'vector)) - (set! sv-288 (-> self root quat)) - (set! sv-304 lerp-scale) - (set! sv-320 (-> self rotmin)) - (set! sv-336 (-> self rotmax)) - (let* ((a2-0 (sin (* 7281.778 (-> self time)))) - (a3-0 -1.0) - (t0-0 1.0) - (a2-1 (sv-304 sv-320 sv-336 a2-0 a3-0 t0-0)) - ) - (vector+! s5-0 s4-0 (s3-0 s2-0 s1-0 (s0-0 (the-as quaternion sv-272) sv-288 a2-1))) ) ) (vector-copy! (-> *camera* slave 0 trans) gp-0) @@ -2503,12 +2483,12 @@ (defmethod init-from-entity! ((this flitter-spawner) (arg0 entity-actor)) "Set up a newly created process from the entity that created it." - (local-vars (sv-16 res-tag)) (set! (-> this root) (new 'process 'trsqv)) (process-drawable-from-entity! this arg0) (set! (-> this entity) arg0) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-2 (res-lump-data (-> this entity) 'actor-groups (pointer actor-group) :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-2 (res-lump-data (-> this entity) 'actor-groups (pointer actor-group) :tag-ptr (& sv-16))) + ) (cond ((and v1-2 (nonzero? (-> sv-16 elt-count))) (set! (-> this actor-group) v1-2) diff --git a/goal_src/jak3/levels/city/ctywide-part.gc b/goal_src/jak3/levels/city/ctywide-part.gc index 8b7f919d47..a21b3a1cb7 100644 --- a/goal_src/jak3/levels/city/ctywide-part.gc +++ b/goal_src/jak3/levels/city/ctywide-part.gc @@ -169,7 +169,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/goal_src/jak3/levels/city/destroy-grid/cty-destroy-grid.gc b/goal_src/jak3/levels/city/destroy-grid/cty-destroy-grid.gc index 751fea166d..994a323342 100644 --- a/goal_src/jak3/levels/city/destroy-grid/cty-destroy-grid.gc +++ b/goal_src/jak3/levels/city/destroy-grid/cty-destroy-grid.gc @@ -358,9 +358,8 @@ (when *target* (let ((a1-0 (-> *target* control trans)) (v1-4 (-> this root)) - (f0-0 14336.0) ) - (when (>= (* f0-0 f0-0) (vector-vector-distance-squared (-> v1-4 trans) a1-0)) + (when (>= (square 14336.0) (vector-vector-distance-squared (-> v1-4 trans) a1-0)) (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)) @@ -1742,11 +1741,7 @@ (send-event this 'complete) ) (if (and (< (vector-vector-distance (-> this goal-pos) (-> s5-0 root trans)) 163840.0) - (let ((f0-4 (vector-length-squared (-> (the-as vehicle s4-4) root transv))) - (f1-2 12288.0) - ) - (< f0-4 (* f1-2 f1-2)) - ) + (< (vector-length-squared (-> (the-as vehicle s4-4) root transv)) (square 12288.0)) ) (send-event s5-0 'exit-vehicle (-> this goal-pos-front)) ) @@ -1761,38 +1756,32 @@ ) ) (when (!= v1-197 -1) - (let ((f0-5 (vector-length-squared (-> (the-as vehicle s4-4) root transv))) - (f1-5 32768.0) - ) - (when (and (< f0-5 (* f1-5 f1-5)) - (let ((f0-6 (vector-vector-distance-squared (-> (the-as vehicle s4-4) root trans) (-> s5-0 root trans))) - (f1-8 204800.0) - ) - (< f0-6 (* f1-8 f1-8)) - ) - ) - (send-event s5-0 'board-vehicle (the-as vehicle s4-4)) - (when (and (nonzero? (-> this next-box)) (!= (the-as jinx (-> this next-box)) (length (-> this actor-group 0)))) - (let ((a1-50 (new 'stack-no-clear 'event-message-block))) - (set! (-> a1-50 from) (process->ppointer pp)) - (set! (-> a1-50 num-params) 0) - (set! (-> a1-50 message) 'explode) - (let ((t9-38 send-event-function) - (v1-228 (-> this actor-group 0 data (+ (-> this next-box) -1) actor)) + (when (and (< (vector-length-squared (-> (the-as vehicle s4-4) root transv)) (square 32768.0)) + (< (vector-vector-distance-squared (-> (the-as vehicle s4-4) root trans) (-> s5-0 root trans)) + (square 204800.0) ) - (t9-38 - (if v1-228 - (-> v1-228 extra process) - ) - a1-50 + ) + (send-event s5-0 'board-vehicle (the-as vehicle s4-4)) + (when (and (nonzero? (-> this next-box)) (!= (the-as jinx (-> this next-box)) (length (-> this actor-group 0)))) + (let ((a1-50 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-50 from) (process->ppointer pp)) + (set! (-> a1-50 num-params) 0) + (set! (-> a1-50 message) 'explode) + (let ((t9-38 send-event-function) + (v1-228 (-> this actor-group 0 data (+ (-> this next-box) -1) actor)) ) + (t9-38 + (if v1-228 + (-> v1-228 extra process) + ) + a1-50 ) ) - (set-speech-name this (-> *jinx-board-vehicle-speech* *jinx-board-vehicle-speech-index*) 300 600) - (set! *jinx-board-vehicle-speech-index* - (mod (+ *jinx-board-vehicle-speech-index* 1) (-> *jinx-board-vehicle-speech* length)) - ) ) + (set-speech-name this (-> *jinx-board-vehicle-speech* *jinx-board-vehicle-speech-index*) 300 600) + (set! *jinx-board-vehicle-speech-index* + (mod (+ *jinx-board-vehicle-speech-index* 1) (-> *jinx-board-vehicle-speech* length)) + ) ) ) ) @@ -1842,7 +1831,6 @@ (defstate active (task-manager-city-destroy-grid) :virtual #t :enter (behavior () - (local-vars (sv-272 res-tag)) (set-time! (-> self state-time)) (let ((s5-0 *traffic-manager*) (gp-0 (new 'stack 'traffic-object-spawn-params)) @@ -1884,12 +1872,13 @@ (set-setting! 'mh-primary-target v1-40 1.0 (-> v1-40 0 pid)) ) (set! (-> self entity) (the-as entity-actor gp-1)) - (set! sv-272 (new 'static 'res-tag)) - (let ((v1-44 (res-lump-data gp-1 'actor-groups pointer :tag-ptr (& sv-272)))) + (let* ((sv-272 (new 'static 'res-tag)) + (v1-44 (res-lump-data gp-1 'actor-groups (pointer actor-group) :tag-ptr (& sv-272))) + ) (cond ((and v1-44 (nonzero? (-> sv-272 elt-count))) (set! (-> self actor-group-count) (the-as int (-> sv-272 elt-count))) - (set! (-> self actor-group) (the-as (pointer actor-group) v1-44)) + (set! (-> self actor-group) v1-44) ) (else (format 0 "ERROR: ~s: entity missing actor-group!~%" (game-task->string (-> self node-info task))) @@ -2096,7 +2085,6 @@ (defmethod init-from-entity! ((this com-power-box) (arg0 entity-actor)) "Set up a newly created process from the entity that created it." - (local-vars (sv-80 vector) (sv-96 vector)) (rlet ((acc :class vf) (vf0 :class vf) (vf4 :class vf) @@ -2154,14 +2142,15 @@ (s1-0 #x46333333) (s0-0 (new 'stack-no-clear 'vector)) ) - (set! sv-80 (-> this root trans)) - (let ((v0-10 (vector-x-quaternion! (new 'stack-no-clear 'vector) (-> this root quat)))) - (let ((v1-36 8192.0)) - (.mov vf7 v1-36) + (let ((sv-80 (-> this root trans))) + (let ((v0-10 (vector-x-quaternion! (new 'stack-no-clear 'vector) (-> this root quat)))) + (let ((v1-36 8192.0)) + (.mov vf7 v1-36) + ) + (.lvf vf5 (&-> v0-10 quad)) ) - (.lvf vf5 (&-> v0-10 quad)) + (.lvf vf4 (&-> sv-80 quad)) ) - (.lvf vf4 (&-> sv-80 quad)) (.add.x.vf.w vf6 vf0 vf0) (.mul.x.vf.xyz acc vf5 vf7) (.add.mul.w.vf.xyz vf6 vf4 vf0 acc) @@ -2182,14 +2171,15 @@ (s1-1 #x46333333) (s0-1 (new 'stack-no-clear 'vector)) ) - (set! sv-96 (-> this root trans)) - (let ((v0-14 (vector-x-quaternion! (new 'stack-no-clear 'vector) (-> this root quat)))) - (let ((v1-46 -8192.0)) - (.mov vf7 v1-46) + (let ((sv-96 (-> this root trans))) + (let ((v0-14 (vector-x-quaternion! (new 'stack-no-clear 'vector) (-> this root quat)))) + (let ((v1-46 -8192.0)) + (.mov vf7 v1-46) + ) + (.lvf vf5 (&-> v0-14 quad)) ) - (.lvf vf5 (&-> v0-14 quad)) + (.lvf vf4 (&-> sv-96 quad)) ) - (.lvf vf4 (&-> sv-96 quad)) (.add.x.vf.w vf6 vf0 vf0) (.mul.x.vf.xyz acc vf5 vf7) (.add.mul.w.vf.xyz vf6 vf4 vf0 acc) diff --git a/goal_src/jak3/levels/city/freehq/freehq-part.gc b/goal_src/jak3/levels/city/freehq/freehq-part.gc index f54e0ab04b..3085a808a0 100644 --- a/goal_src/jak3/levels/city/freehq/freehq-part.gc +++ b/goal_src/jak3/levels/city/freehq/freehq-part.gc @@ -223,7 +223,7 @@ (let ((v1-1 (-> arg4 sprite key))) (when (nonzero? v1-1) (let ((f0-2 (+ (- 5120.0 (-> arg2 launchrot 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/goal_src/jak3/levels/city/hijack/billiards.gc b/goal_src/jak3/levels/city/hijack/billiards.gc index ad87f86fb2..a292bfeddf 100644 --- a/goal_src/jak3/levels/city/hijack/billiards.gc +++ b/goal_src/jak3/levels/city/hijack/billiards.gc @@ -236,9 +236,7 @@ (vector+float*! (-> s3-1 pos) v1-38 s1-2 (- 1.0 f30-1)) (let ((v1-39 (vector-normalize-copy! (new 'stack-no-clear 'vector) s1-2 1.0))) 0.0 - (let* ((f0-18 (fabs (-> v1-39 data s2-1))) - (f1-10 (* f0-18 f0-18)) - ) + (let ((f1-10 (square (fabs (-> v1-39 data s2-1))))) (vector-float*! s1-2 s1-2 (* -1.0 (- 1.0 (* f1-10 (-> this bounce-wall-friction))))) ) ) diff --git a/goal_src/jak3/levels/city/hijack/cty-hijack-missile.gc b/goal_src/jak3/levels/city/hijack/cty-hijack-missile.gc index 85894d80ca..d9ab006aa6 100644 --- a/goal_src/jak3/levels/city/hijack/cty-hijack-missile.gc +++ b/goal_src/jak3/levels/city/hijack/cty-hijack-missile.gc @@ -804,7 +804,6 @@ ;; WARN: Return type mismatch object vs none. ;; WARN: Function (method 51 cty-hijack-missile) has a return type of none, but the expression builder found a return statement. (defmethod cty-hijack-missile-method-51 ((this cty-hijack-missile)) - (local-vars (sv-64 float) (sv-68 float) (sv-72 float) (sv-76 vector) (sv-80 float)) (let ((s5-0 (as-type (handle->process (-> this track-obj)) process-focusable)) (s4-1 (new 'stack-no-clear 'vector)) (a0-5 (new 'stack-no-clear 'vector)) @@ -823,165 +822,167 @@ (set! (-> this vel-factor) *k1*) ) ) - (set! sv-64 (-> this offset-dist)) - (set! sv-68 (-> this current-speed)) - (set! sv-72 (the-as float 0.0)) - (set! sv-76 (vector-! (new 'stack-no-clear 'vector) s4-1 (-> this basetrans))) - (set! sv-80 (the-as float 0.0)) - (set! sv-72 (vector-normalize-ret-len! sv-76 1.0)) - (if (and (-> this is-leader?) (< (vector-vector-xz-distance (-> this basetrans) s4-1) 18432.0)) - (go (method-of-object this explode)) - ) - (cond - ((< 409.6 sv-72) - (set! sv-80 (+ (* (- sv-72 sv-64) *k0*) (* (- f30-0 sv-68) (-> this vel-factor)))) - (set! sv-80 (* sv-80 *accel-scalar*)) - (+! (-> this current-speed) (* sv-80 (seconds-per-frame))) - (when (-> this is-leader?) - ) - (seek! (-> this min-chase-speed) (-> this min-targ-chase-speed) (* 6144.0 (seconds-per-frame))) - (set! (-> this current-speed) (fmax (-> this current-speed) (-> this target-speed))) - (cond - ((>= 0.0 (-> this max-chase-speed)) - (when (< (vector-vector-xz-distance (-> this basetrans) (get-trans s5-0 0)) 32768.0) - ) + (let ((sv-64 (-> this offset-dist)) + (sv-68 (-> this current-speed)) + (sv-72 (the-as float 0.0)) + (sv-76 (vector-! (new 'stack-no-clear 'vector) s4-1 (-> this basetrans))) ) - ((< (vector-vector-xz-distance (-> this basetrans) (get-trans s5-0 0)) 81920.0) - (set! (-> this current-speed) - (fmax (fmin (-> this current-speed) (-> this max-chase-speed)) (-> this min-chase-speed)) + (let ((sv-80 (the-as float 0.0))) + (set! sv-72 (vector-normalize-ret-len! sv-76 1.0)) + (if (and (-> this is-leader?) (< (vector-vector-xz-distance (-> this basetrans) s4-1) 18432.0)) + (go (method-of-object this explode)) + ) + (cond + ((< 409.6 sv-72) + (set! sv-80 (* (+ (* (- sv-72 sv-64) *k0*) (* (- f30-0 sv-68) (-> this vel-factor))) *accel-scalar*)) + (+! (-> this current-speed) (* sv-80 (seconds-per-frame))) + (when (-> this is-leader?) + ) + (seek! (-> this min-chase-speed) (-> this min-targ-chase-speed) (* 6144.0 (seconds-per-frame))) + (set! (-> this current-speed) (fmax (-> this current-speed) (-> this target-speed))) + (cond + ((>= 0.0 (-> this max-chase-speed)) + (when (< (vector-vector-xz-distance (-> this basetrans) (get-trans s5-0 0)) 32768.0) ) - ) - ) - (when (-> this is-leader?) - ) - (quaternion-look-at! (-> this root quat) sv-76 *up-vector*) - (vector+float*! (-> this basetrans) (-> this basetrans) sv-76 (* (-> this current-speed) (seconds-per-frame))) - ) - (else - (vector+float*! - (-> this basetrans) - (-> this basetrans) - (vector-z-quaternion! (new 'stack-no-clear 'vector) (-> this root quat)) - (* (-> this current-speed) (seconds-per-frame)) + ) + ((< (vector-vector-xz-distance (-> this basetrans) (get-trans s5-0 0)) 81920.0) + (set! (-> this current-speed) + (fmax (fmin (-> this current-speed) (-> this max-chase-speed)) (-> this min-chase-speed)) + ) + ) + ) + (when (-> this is-leader?) + ) + (quaternion-look-at! (-> this root quat) sv-76 *up-vector*) + (vector+float*! (-> this basetrans) (-> this basetrans) sv-76 (* (-> this current-speed) (seconds-per-frame))) + ) + (else + (vector+float*! + (-> this basetrans) + (-> this basetrans) + (vector-z-quaternion! (new 'stack-no-clear 'vector) (-> this root quat)) + (* (-> this current-speed) (seconds-per-frame)) + ) + ) ) ) - ) - ) - ) - (when (< (-> this next-lisa-time) (current-time)) - (let* ((f30-1 30720.0) - (f28-0 6144.0) - (v1-57 (/ (the-as int (rand-uint31-gen *random-generator*)) 256)) - (v1-58 (the-as number (logior #x3f800000 v1-57))) - ) - (set! (-> this circle-mag) (+ f30-1 (* f28-0 (+ -1.0 (the-as float v1-58))))) - ) - (cond - ((!= (-> this stage) 1) - (let* ((f30-2 43690.668) - (f28-1 10922.664) - (v1-64 (/ (the-as int (rand-uint31-gen *random-generator*)) 256)) - (v1-65 (the-as number (logior #x3f800000 v1-64))) - ) - (set! (-> this lisa rate theta) (* (+ f30-2 (* f28-1 (+ -1.0 (the-as float v1-65)))) (seconds-per-frame))) - ) - (let* ((f30-3 9216.0) - (f28-2 7987.199) - (v1-71 (/ (the-as int (rand-uint31-gen *random-generator*)) 256)) - (v1-72 (the-as number (logior #x3f800000 v1-71))) - ) - (set! (-> this lisa dest x-mag) (+ f30-3 (* f28-2 (+ -1.0 (the-as float v1-72))))) - ) - (let* ((f30-4 9216.0) - (f28-3 7987.199) - (v1-77 (/ (the-as int (rand-uint31-gen *random-generator*)) 256)) - (v1-78 (the-as number (logior #x3f800000 v1-77))) - ) - (set! (-> this lisa dest y-mag) (+ f30-4 (* f28-3 (+ -1.0 (the-as float v1-78))))) - ) - (let* ((f30-5 0.5) - (f28-4 0.75) - (v1-83 (/ (the-as int (rand-uint31-gen *random-generator*)) 256)) - (v1-84 (the-as number (logior #x3f800000 v1-83))) - ) - (set! (-> this lisa dest theta-rate) (+ f30-5 (* f28-4 (+ -1.0 (the-as float v1-84))))) - ) - ) - (else - (let* ((f30-6 32768.0) - (f28-5 10922.668) - (v1-90 (/ (the-as int (rand-uint31-gen *random-generator*)) 256)) - (v1-91 (the-as number (logior #x3f800000 v1-90))) + (when (< (-> this next-lisa-time) (current-time)) + (let* ((f30-1 30720.0) + (f28-0 6144.0) + (v1-57 (/ (the-as int (rand-uint31-gen *random-generator*)) 256)) + (v1-58 (the-as number (logior #x3f800000 v1-57))) + ) + (set! (-> this circle-mag) (+ f30-1 (* f28-0 (+ -1.0 (the-as float v1-58))))) + ) + (cond + ((!= (-> this stage) 1) + (let* ((f30-2 43690.668) + (f28-1 10922.664) + (v1-64 (/ (the-as int (rand-uint31-gen *random-generator*)) 256)) + (v1-65 (the-as number (logior #x3f800000 v1-64))) + ) + (set! (-> this lisa rate theta) (* (+ f30-2 (* f28-1 (+ -1.0 (the-as float v1-65)))) (seconds-per-frame))) ) - (set! (-> this lisa rate theta) (* (+ f30-6 (* f28-5 (+ -1.0 (the-as float v1-91)))) (seconds-per-frame))) + (let* ((f30-3 9216.0) + (f28-2 7987.199) + (v1-71 (/ (the-as int (rand-uint31-gen *random-generator*)) 256)) + (v1-72 (the-as number (logior #x3f800000 v1-71))) + ) + (set! (-> this lisa dest x-mag) (+ f30-3 (* f28-2 (+ -1.0 (the-as float v1-72))))) + ) + (let* ((f30-4 9216.0) + (f28-3 7987.199) + (v1-77 (/ (the-as int (rand-uint31-gen *random-generator*)) 256)) + (v1-78 (the-as number (logior #x3f800000 v1-77))) + ) + (set! (-> this lisa dest y-mag) (+ f30-4 (* f28-3 (+ -1.0 (the-as float v1-78))))) + ) + (let* ((f30-5 0.5) + (f28-4 0.75) + (v1-83 (/ (the-as int (rand-uint31-gen *random-generator*)) 256)) + (v1-84 (the-as number (logior #x3f800000 v1-83))) + ) + (set! (-> this lisa dest theta-rate) (+ f30-5 (* f28-4 (+ -1.0 (the-as float v1-84))))) + ) + ) + (else + (let* ((f30-6 32768.0) + (f28-5 10922.668) + (v1-90 (/ (the-as int (rand-uint31-gen *random-generator*)) 256)) + (v1-91 (the-as number (logior #x3f800000 v1-90))) + ) + (set! (-> this lisa rate theta) (* (+ f30-6 (* f28-5 (+ -1.0 (the-as float v1-91)))) (seconds-per-frame))) + ) + (let* ((f30-7 5120.0) + (f28-6 5120.0) + (v1-97 (/ (the-as int (rand-uint31-gen *random-generator*)) 256)) + (v1-98 (the-as number (logior #x3f800000 v1-97))) + ) + (set! (-> this lisa dest x-mag) (+ f30-7 (* f28-6 (+ -1.0 (the-as float v1-98))))) + ) + (let* ((f30-8 9216.0) + (f28-7 1024.0) + (v1-103 (/ (the-as int (rand-uint31-gen *random-generator*)) 256)) + (v1-104 (the-as number (logior #x3f800000 v1-103))) + ) + (set! (-> this lisa dest y-mag) (+ f30-8 (* f28-7 (+ -1.0 (the-as float v1-104))))) + ) + (let* ((f30-9 0.5) + (f28-8 0.75) + (v1-109 (/ (the-as int (rand-uint31-gen *random-generator*)) 256)) + (v1-110 (the-as number (logior #x3f800000 v1-109))) + ) + (set! (-> this lisa dest theta-rate) (+ f30-9 (* f28-8 (+ -1.0 (the-as float v1-110))))) + ) + ) + ) + (set! (-> this next-lisa-time) + (the-as time-frame (+ (mod (the-as int (rand-uint31-gen *random-generator*)) 601) 150 (current-time))) + ) ) - (let* ((f30-7 5120.0) - (f28-6 5120.0) - (v1-97 (/ (the-as int (rand-uint31-gen *random-generator*)) 256)) - (v1-98 (the-as number (logior #x3f800000 v1-97))) - ) - (set! (-> this lisa dest x-mag) (+ f30-7 (* f28-6 (+ -1.0 (the-as float v1-98))))) + (let ((v1-118 (the-as vehicle (handle->process (-> this track-obj))))) + (when v1-118 + (when (and (< 0.75 (fabs (-> v1-118 controls steering))) (!= (-> this stage) 1)) + (seek! (-> this lisa dest x-mag) (-> this circle-mag) (* 18432.0 (seconds-per-frame))) + (seek! (-> this lisa dest y-mag) (-> this circle-mag) (* 18432.0 (seconds-per-frame))) + ) + ) ) - (let* ((f30-8 9216.0) - (f28-7 1024.0) - (v1-103 (/ (the-as int (rand-uint31-gen *random-generator*)) 256)) - (v1-104 (the-as number (logior #x3f800000 v1-103))) - ) - (set! (-> this lisa dest y-mag) (+ f30-8 (* f28-7 (+ -1.0 (the-as float v1-104))))) + (set! (-> this lisa dest wx) 1.0) + (set! (-> this lisa dest wy) 1.2) + (set! (-> this lisa rate wx) 10.0) + (set! (-> this lisa rate wy) 10.0) + (set! (-> this lisa rate x-mag) (* 10240.0 (seconds-per-frame))) + (set! (-> this lisa rate y-mag) (* 10240.0 (seconds-per-frame))) + (set! (-> this lisa rate period-shift) (* 16384.0 (seconds-per-frame))) + (set! (-> this lisa dest period-shift) 16384.0) + (update! (-> this lisa)) + (let ((s5-3 (evaluate! (-> this lisa) (new 'stack-no-clear 'vector)))) + (vector-float*! s5-3 s5-3 0.5) + (vector-lerp! (-> this lisa-pt) (-> this lisa-pt) s5-3 1.0) + (let ((a2-9 (matrix-f-u-compose (matrix-identity! (new 'stack-no-clear 'matrix)) sv-76 *up-vector*))) + (vector-matrix*! s5-3 (-> this lisa-pt) a2-9) + ) + (vector+! (-> this root trans) (-> this basetrans) s5-3) ) - (let* ((f30-9 0.5) - (f28-8 0.75) - (v1-109 (/ (the-as int (rand-uint31-gen *random-generator*)) 256)) - (v1-110 (the-as number (logior #x3f800000 v1-109))) - ) - (set! (-> this lisa dest theta-rate) (+ f30-9 (* f28-8 (+ -1.0 (the-as float v1-110))))) + (let ((v1-147 (the-as vehicle (handle->process (-> this track-obj))))) + (when v1-147 + (if (< 0.75 (fabs (-> v1-147 controls steering))) + (set! (-> this bobber turning?) #t) + (set! (-> this bobber turning?) #f) + ) + ) + ) + (if (= (-> this stage) 1) + (set! (-> this bobber output-scale) 4096.0) + (set! (-> this bobber output-scale) 16384.0) + ) + (hijack-missile-bobber-method-10 (-> this bobber)) + (let ((f0-118 (- (-> this bobber output-val) (* 0.8 (-> this bobber output-scale))))) + (vector+float*! (-> this root trans) (-> this root trans) sv-76 f0-118) ) ) ) - (set! (-> this next-lisa-time) - (the-as time-frame (+ (mod (the-as int (rand-uint31-gen *random-generator*)) 601) 150 (current-time))) - ) - ) - (let ((v1-118 (the-as vehicle (handle->process (-> this track-obj))))) - (when v1-118 - (when (and (< 0.75 (fabs (-> v1-118 controls steering))) (!= (-> this stage) 1)) - (seek! (-> this lisa dest x-mag) (-> this circle-mag) (* 18432.0 (seconds-per-frame))) - (seek! (-> this lisa dest y-mag) (-> this circle-mag) (* 18432.0 (seconds-per-frame))) - ) - ) - ) - (set! (-> this lisa dest wx) 1.0) - (set! (-> this lisa dest wy) 1.2) - (set! (-> this lisa rate wx) 10.0) - (set! (-> this lisa rate wy) 10.0) - (set! (-> this lisa rate x-mag) (* 10240.0 (seconds-per-frame))) - (set! (-> this lisa rate y-mag) (* 10240.0 (seconds-per-frame))) - (set! (-> this lisa rate period-shift) (* 16384.0 (seconds-per-frame))) - (set! (-> this lisa dest period-shift) 16384.0) - (update! (-> this lisa)) - (let ((s5-3 (evaluate! (-> this lisa) (new 'stack-no-clear 'vector)))) - (vector-float*! s5-3 s5-3 0.5) - (vector-lerp! (-> this lisa-pt) (-> this lisa-pt) s5-3 1.0) - (let ((a2-9 (matrix-f-u-compose (matrix-identity! (new 'stack-no-clear 'matrix)) sv-76 *up-vector*))) - (vector-matrix*! s5-3 (-> this lisa-pt) a2-9) - ) - (vector+! (-> this root trans) (-> this basetrans) s5-3) - ) - (let ((v1-147 (the-as vehicle (handle->process (-> this track-obj))))) - (when v1-147 - (if (< 0.75 (fabs (-> v1-147 controls steering))) - (set! (-> this bobber turning?) #t) - (set! (-> this bobber turning?) #f) - ) - ) - ) - (if (= (-> this stage) 1) - (set! (-> this bobber output-scale) 4096.0) - (set! (-> this bobber output-scale) 16384.0) - ) - (hijack-missile-bobber-method-10 (-> this bobber)) - (let ((f0-118 (- (-> this bobber output-val) (* 0.8 (-> this bobber output-scale))))) - (vector+float*! (-> this root trans) (-> this root trans) sv-76 f0-118) ) (let ((s5-5 (vector-! (new 'stack-no-clear 'vector) (-> this root trans) (-> this last-trans)))) (vector-normalize! s5-5 1.0) @@ -1222,11 +1223,8 @@ ) (go-virtual explode) ) - (let* ((a1-3 (-> self tracked-player-positions data (-> self current-track-index))) - (f0-6 (vector-vector-distance-squared (-> self root trans) a1-3)) - (f1-2 819.2) - ) - (when (< f0-6 (* f1-2 f1-2)) + (let ((a1-3 (-> self tracked-player-positions data (-> self current-track-index)))) + (when (< (vector-vector-distance-squared (-> self root trans) a1-3) (square 819.2)) (if (< (-> self current-track-index) (the-as uint (+ (-> self tracked-player-positions length) -1))) (+! (-> self current-track-index) 1) ) diff --git a/goal_src/jak3/levels/city/port/attack/ctyport-attack-bbush.gc b/goal_src/jak3/levels/city/port/attack/ctyport-attack-bbush.gc index 32196cb12c..d7c653a482 100644 --- a/goal_src/jak3/levels/city/port/attack/ctyport-attack-bbush.gc +++ b/goal_src/jak3/levels/city/port/attack/ctyport-attack-bbush.gc @@ -323,7 +323,6 @@ ;; WARN: Return type mismatch symbol vs none. (defmethod init! ((this ctyport-attack-manager-bbush)) - (local-vars (sv-96 res-tag)) (let ((t9-0 (method-of-type task-manager init!))) (t9-0 this) ) @@ -355,11 +354,14 @@ ) ) (set! (-> this mine-layout) *ctyport-bbush-mine-positions*) - (set! sv-96 (new 'static 'res-tag)) - (let ((v1-40 (res-lump-data (entity-by-name "port-attack-bbush-1") 'actor-groups pointer :tag-ptr (& sv-96)))) + (let* ((sv-96 (new 'static 'res-tag)) + (v1-40 + (res-lump-data (entity-by-name "port-attack-bbush-1") 'actor-groups (pointer actor-group) :tag-ptr (& sv-96)) + ) + ) (cond ((and v1-40 (nonzero? (-> sv-96 elt-count))) - (set! (-> this actor-group) (the-as (pointer actor-group) v1-40)) + (set! (-> this actor-group) v1-40) (set! (-> this actor-group-count) (the-as int (-> sv-96 elt-count))) ) (else diff --git a/goal_src/jak3/levels/city/port/attack/ctyport-attack.gc b/goal_src/jak3/levels/city/port/attack/ctyport-attack.gc index 431da38efe..8c04aa0adf 100644 --- a/goal_src/jak3/levels/city/port/attack/ctyport-attack.gc +++ b/goal_src/jak3/levels/city/port/attack/ctyport-attack.gc @@ -1672,13 +1672,9 @@ (defmethod update ((this ctyport-mine) (arg0 float)) (when (>= (+ (current-time) (seconds -0.5)) (-> this last-play-time)) - (let ((f0-0 (vector-vector-xz-distance-squared (-> this root trans) (target-pos 0))) - (f1-0 491520.0) - ) - (if (< f0-0 (* f1-0 f1-0)) - (sound-play "port-mine-flash" :position (-> this root trans)) - ) - ) + (if (< (vector-vector-xz-distance-squared (-> this root trans) (target-pos 0)) (square 491520.0)) + (sound-play "port-mine-flash" :position (-> this root trans)) + ) (set-time! (-> this last-play-time)) ) (let* ((f0-1 (vector-length (-> this root trans))) @@ -2628,7 +2624,6 @@ ) (defmethod ctyport-attack-manager-method-44 ((this ctyport-attack-manager) (arg0 ctyport-mine-layout)) - (local-vars (sv-208 vector) (sv-224 vector)) (let ((s5-0 (new 'stack-no-clear 'vector))) 0.0 (new 'stack-no-clear 'vector) @@ -2664,31 +2659,25 @@ (let ((v1-28 (-> arg0 stored-handles s2-0))) (send-event (handle->process v1-28) 'activate s5-0) ) - (let ((s1-0 s5-0) - (s0-0 s5-0) - ) - (set! sv-208 s4-0) - (let* ((f30-1 1.0) - (f28-0 0.29999995) - (v1-33 (/ (the-as int (rand-uint31-gen *random-generator*)) 256)) - (v1-34 (the-as number (logior #x3f800000 v1-33))) - (f0-16 (* (+ f30-1 (* f28-0 (+ -1.0 (the-as float v1-34)))) (-> arg0 spacing))) - ) - (vector+float*! s1-0 s0-0 sv-208 f0-16) - ) + (let* ((s1-0 s5-0) + (s0-0 s5-0) + (sv-208 s4-0) + (f30-1 1.0) + (f28-0 0.29999995) + (v1-33 (/ (the-as int (rand-uint31-gen *random-generator*)) 256)) + (v1-34 (the-as number (logior #x3f800000 v1-33))) + ) + (vector+float*! s1-0 s0-0 sv-208 (* (+ f30-1 (* f28-0 (+ -1.0 (the-as float v1-34)))) (-> arg0 spacing))) ) - (let ((s1-2 s5-0) - (s0-1 s5-0) - ) - (set! sv-224 (-> s3-1 rvec)) - (let* ((f30-2 -10240.0) - (f28-1 20480.0) - (v1-40 (/ (the-as int (rand-uint31-gen *random-generator*)) 256)) - (v1-41 (the-as number (logior #x3f800000 v1-40))) - (f0-21 (+ f30-2 (* f28-1 (+ -1.0 (the-as float v1-41))))) - ) - (vector+float*! s1-2 s0-1 sv-224 f0-21) - ) + (let* ((s1-2 s5-0) + (s0-1 s5-0) + (sv-224 (-> s3-1 rvec)) + (f30-2 -10240.0) + (f28-1 20480.0) + (v1-40 (/ (the-as int (rand-uint31-gen *random-generator*)) 256)) + (v1-41 (the-as number (logior #x3f800000 v1-40))) + ) + (vector+float*! s1-2 s0-1 sv-224 (+ f30-2 (* f28-1 (+ -1.0 (the-as float v1-41))))) ) ) ) @@ -2964,7 +2953,7 @@ (v1-40 (/ (the-as int (rand-uint31-gen *random-generator*)) 256)) (v1-41 (the-as number (logior #x3f800000 v1-40))) ) - (+! f30-0 (* (+ f28-0 (* f26-0 (+ -1.0 (the-as float v1-41)))) (lerp 0.01 0.06 (* f30-0 f30-0)))) + (+! f30-0 (* (+ f28-0 (* f26-0 (+ -1.0 (the-as float v1-41)))) (lerp 0.01 0.06 (square f30-0)))) ) ) (let ((f30-1 (fmax 0.0 (fmin 1.15 f30-0)))) diff --git a/goal_src/jak3/levels/city/protect/assault-task.gc b/goal_src/jak3/levels/city/protect/assault-task.gc index a15dccd9de..437b9469a7 100644 --- a/goal_src/jak3/levels/city/protect/assault-task.gc +++ b/goal_src/jak3/levels/city/protect/assault-task.gc @@ -201,9 +201,7 @@ (quaternion-slerp! s4-1 (-> this original-cam-quat) s3-0 (/ f30-0 f0-9)) ) ((< (- 1.0 f0-9) f30-0) - (let* ((f0-12 (/ (- f30-0 f0-9) (- 1.0 f0-9))) - (f0-13 (* f0-12 f0-12)) - ) + (let ((f0-13 (square (/ (- f30-0 f0-9) (- 1.0 f0-9))))) (quaternion-slerp! s4-1 s3-0 s4-1 f0-13) ) ) @@ -963,7 +961,6 @@ ) (defmethod spawn-guards ((this task-manager-city-port-assault) (arg0 int)) - (local-vars (sv-848 vector) (sv-864 vector) (sv-880 assault-object-spawn-params)) (rlet ((acc :class vf) (vf0 :class vf) (vf1 :class vf) @@ -980,9 +977,9 @@ ) (dotimes (s1-0 arg0) (let ((s0-0 s3-0)) - (set! sv-848 (-> this current-room center-pos)) - (set! sv-864 s4-0) - (let* ((f28-0 24576.0) + (let* ((sv-848 (-> this current-room center-pos)) + (sv-864 s4-0) + (f28-0 24576.0) (f26-0 0.0) (v1-6 (/ (the-as int (rand-uint31-gen *random-generator*)) 256)) (v1-7 (the-as number (logior #x3f800000 v1-6))) @@ -1025,21 +1022,22 @@ (vector-normalize! s2-0 1.0) (let ((s0-2 (get-last-unused-handle! (-> *assault-squad* spawn-records 3)))) (when (handle->process s0-2) - (set! sv-880 (new 'stack 'assault-object-spawn-params)) - (set! (-> sv-880 flags) (traffic-spawn-flags)) - (vector-copy! (-> sv-880 position) s3-0) - (set! (-> sv-880 behavior) (the-as uint 2)) - (set! (-> sv-880 flags) (traffic-spawn-flags)) - (set! (-> sv-880 suck-level) (get-suck-level this)) - (set! (-> sv-880 user-data) (the-as uint (-> this current-room center-pos))) - (logior! (-> sv-880 flags) (traffic-spawn-flags tsf7)) - (set! (-> sv-880 velocity quad) (the-as uint128 0)) - (quaternion-identity! (-> sv-880 rotation)) - (quaternion-look-at! (-> sv-880 rotation) s2-0 *up-vector*) - (set! (-> sv-880 nav-mesh) (find-nearest-nav-mesh (-> sv-880 position) (the-as float #x7f800000))) - (set! (-> sv-880 nav-branch) #f) - (set! (-> sv-880 guard-type) (the-as uint 1)) - (send-event (handle->process s0-2) 'traffic-activate sv-880 *traffic-engine*) + (let ((sv-880 (new 'stack 'assault-object-spawn-params))) + (set! (-> sv-880 flags) (traffic-spawn-flags)) + (vector-copy! (-> sv-880 position) s3-0) + (set! (-> sv-880 behavior) (the-as uint 2)) + (set! (-> sv-880 flags) (traffic-spawn-flags)) + (set! (-> sv-880 suck-level) (get-suck-level this)) + (set! (-> sv-880 user-data) (the-as uint (-> this current-room center-pos))) + (logior! (-> sv-880 flags) (traffic-spawn-flags tsf7)) + (set! (-> sv-880 velocity quad) (the-as uint128 0)) + (quaternion-identity! (-> sv-880 rotation)) + (quaternion-look-at! (-> sv-880 rotation) s2-0 *up-vector*) + (set! (-> sv-880 nav-mesh) (find-nearest-nav-mesh (-> sv-880 position) (the-as float #x7f800000))) + (set! (-> sv-880 nav-branch) #f) + (set! (-> sv-880 guard-type) (the-as uint 1)) + (send-event (handle->process s0-2) 'traffic-activate sv-880 *traffic-engine*) + ) ) ) (vector-rotate-around-y! s4-0 s4-0 f30-0) @@ -1051,15 +1049,7 @@ ) (defmethod spawn-citizens ((this task-manager-city-port-assault) (arg0 int)) - (local-vars - (v1-65 int) - (sv-848 vector) - (sv-864 vector) - (sv-880 assault-object-spawn-params) - (sv-896 (function quaternion quaternion float quaternion)) - (sv-912 quaternion) - (sv-928 quaternion) - ) + (local-vars (v1-65 int)) (rlet ((acc :class vf) (vf0 :class vf) (vf1 :class vf) @@ -1076,9 +1066,9 @@ ) (dotimes (s1-0 arg0) (let ((s0-0 s3-0)) - (set! sv-848 (-> this current-room center-pos)) - (set! sv-864 s4-0) - (let* ((f28-0 10240.0) + (let* ((sv-848 (-> this current-room center-pos)) + (sv-864 s4-0) + (f28-0 10240.0) (f26-0 47104.0) (v1-7 (/ (the-as int (rand-uint31-gen *random-generator*)) 256)) (v1-8 (the-as number (logior #x3f800000 v1-7))) @@ -1121,42 +1111,42 @@ (vector-normalize! s2-0 1.0) (let ((s0-2 (get-last-unused-handle! (-> *assault-squad* spawn-records 1)))) (when (handle->process s0-2) - (set! sv-880 (new 'stack 'assault-object-spawn-params)) - (set! (-> sv-880 flags) (traffic-spawn-flags)) - (vector-copy! (-> sv-880 position) s3-0) - (set! (-> sv-880 behavior) (the-as uint 2)) - (set! (-> sv-880 flags) (traffic-spawn-flags)) - (set! (-> sv-880 suck-level) (get-suck-level this)) - (set! (-> sv-880 user-data) (the-as uint (-> this current-room center-pos))) - (logior! (-> sv-880 flags) (traffic-spawn-flags tsf7)) - (set! (-> sv-880 velocity quad) (the-as uint128 0)) - (quaternion-identity! (-> sv-880 rotation)) - (quaternion-look-at! (-> sv-880 rotation) s2-0 *up-vector*) - (set! (-> sv-880 nav-mesh) (find-nearest-nav-mesh (-> sv-880 position) (the-as float #x7f800000))) - (set! (-> sv-880 nav-branch) #f) - (set! sv-896 quaternion-rotate-y!) - (set! sv-912 (-> sv-880 rotation)) - (set! sv-928 (-> sv-880 rotation)) - (let* ((f28-1 65536.0) - (v1-56 (/ (the-as int (rand-uint31-gen *random-generator*)) 256)) - (v1-57 (the-as number (logior #x3f800000 v1-56))) - (a2-2 (* f28-1 (+ -1.0 (the-as float v1-57)))) - ) - (sv-896 sv-912 sv-928 a2-2) - ) - (+! (-> sv-880 position y) 409.6) - (cond - ((= (-> this current-room-index) (-> (task-perm-by-index *game-info* 46) user-uint64)) - (set! v1-65 600) - (set! (-> sv-880 flee-time) (the-as time-frame v1-65)) - ) - (else - (set! v1-65 2100) - (set! (-> sv-880 flee-time) (the-as time-frame v1-65)) + (let ((sv-880 (new 'stack 'assault-object-spawn-params))) + (set! (-> sv-880 flags) (traffic-spawn-flags)) + (vector-copy! (-> sv-880 position) s3-0) + (set! (-> sv-880 behavior) (the-as uint 2)) + (set! (-> sv-880 flags) (traffic-spawn-flags)) + (set! (-> sv-880 suck-level) (get-suck-level this)) + (set! (-> sv-880 user-data) (the-as uint (-> this current-room center-pos))) + (logior! (-> sv-880 flags) (traffic-spawn-flags tsf7)) + (set! (-> sv-880 velocity quad) (the-as uint128 0)) + (quaternion-identity! (-> sv-880 rotation)) + (quaternion-look-at! (-> sv-880 rotation) s2-0 *up-vector*) + (set! (-> sv-880 nav-mesh) (find-nearest-nav-mesh (-> sv-880 position) (the-as float #x7f800000))) + (set! (-> sv-880 nav-branch) #f) + (let* ((sv-896 quaternion-rotate-y!) + (sv-912 (-> sv-880 rotation)) + (sv-928 (-> sv-880 rotation)) + (f28-1 65536.0) + (v1-56 (/ (the-as int (rand-uint31-gen *random-generator*)) 256)) + (v1-57 (the-as number (logior #x3f800000 v1-56))) + ) + (sv-896 sv-912 sv-928 (* f28-1 (+ -1.0 (the-as float v1-57)))) ) + (+! (-> sv-880 position y) 409.6) + (cond + ((= (-> this current-room-index) (-> (task-perm-by-index *game-info* 46) user-uint64)) + (set! v1-65 600) + (set! (-> sv-880 flee-time) (the-as time-frame v1-65)) + ) + (else + (set! v1-65 2100) + (set! (-> sv-880 flee-time) (the-as time-frame v1-65)) + ) + ) + (set! (-> sv-880 flee-time) (the-as time-frame v1-65)) + (send-event (handle->process s0-2) 'traffic-activate sv-880 *traffic-engine*) ) - (set! (-> sv-880 flee-time) (the-as time-frame v1-65)) - (send-event (handle->process s0-2) 'traffic-activate sv-880 *traffic-engine*) ) ) (vector-rotate-around-y! s4-0 s4-0 f30-0) @@ -1575,8 +1565,7 @@ ((20) (let ((f0-1 (/ (-> *target* fact health) (-> *target* fact health-max)))) 0.0 - (let* ((f0-2 (- 1.0 f0-1)) - (f0-3 (* f0-2 f0-2)) + (let* ((f0-3 (square (- 1.0 f0-1))) (f0-4 (lerp 0.0 7.0 f0-3)) ) (* (-> arg0 percentages arg1) f0-4) diff --git a/goal_src/jak3/levels/city/protect/cty-protect.gc b/goal_src/jak3/levels/city/protect/cty-protect.gc index 1731ac2e03..ae89d34b28 100644 --- a/goal_src/jak3/levels/city/protect/cty-protect.gc +++ b/goal_src/jak3/levels/city/protect/cty-protect.gc @@ -494,8 +494,7 @@ (let ((f28-0 (/ (-> *target* fact health) (-> *target* fact health-max)))) 0.0 (let* ((f0-9 (lerp 0.3 0.5 f30-0)) - (f1-2 (- 1.0 f28-0)) - (f1-3 (* f1-2 f1-2)) + (f1-3 (square (- 1.0 f28-0))) (f30-1 (lerp 0.0 f0-9 f1-3)) (v1-13 (/ (the-as int (rand-uint31-gen *random-generator*)) 256)) (v1-14 (the-as number (logior #x3f800000 v1-13))) diff --git a/goal_src/jak3/levels/city/protect/flying-turret.gc b/goal_src/jak3/levels/city/protect/flying-turret.gc index df207be415..ee076138f6 100644 --- a/goal_src/jak3/levels/city/protect/flying-turret.gc +++ b/goal_src/jak3/levels/city/protect/flying-turret.gc @@ -314,13 +314,9 @@ (the-as enemy-aware #f) ) (update-focus this) - (let ((f0-0 (vector-vector-xz-distance-squared (-> this root trans) (-> this focus-pos))) - (f1-0 204800.0) - ) - (when (< f0-0 (* f1-0 f1-0)) - (set-time! (-> this pursuit-start-time)) - (logior! (-> this flags) (citizen-flag persistent in-pursuit)) - ) + (when (< (vector-vector-xz-distance-squared (-> this root trans) (-> this focus-pos)) (square 204800.0)) + (set-time! (-> this pursuit-start-time)) + (logior! (-> this flags) (citizen-flag persistent in-pursuit)) ) ) (else @@ -339,11 +335,8 @@ ) (defmethod kg-squad-member-method-219 ((this flying-turret) (arg0 process-focusable)) - (let* ((s4-0 (get-trans arg0 0)) - (f0-0 (vector-vector-xz-distance-squared (-> this root trans) s4-0)) - (f1-0 245760.0) - ) - (or (and (< f0-0 (* f1-0 f1-0)) + (let ((s4-0 (get-trans arg0 0))) + (or (and (< (vector-vector-xz-distance-squared (-> this root trans) s4-0) (square 245760.0)) (< (fabs (- (-> s4-0 y) (-> this root trans y))) 61440.0) (< (-> s4-0 y) (-> this root trans y)) ) @@ -371,9 +364,7 @@ (vector-length (-> this root transv)) (set! f30-0 (vector-length s5-1)) (let* ((f1-3 (/ f30-0 (-> this enemy-info run-travel-speed))) - (f0-10 (fmax 0.0 (fmin 1.0 f1-3))) - (f0-11 (* f0-10 f0-10)) - (f0-12 (* f0-11 f0-11)) + (f0-12 (square (square (fmax 0.0 (fmin 1.0 f1-3))))) ) (when (!= (-> this chase-mode) 3) (let ((f1-5 (vector-length (-> this root transv)))) @@ -512,7 +503,7 @@ 0.0 (let ((f0-6 (-> this thruster-intensity))) (if (< f0-6 1.0) - (set! f0-6 (* f0-6 f0-6)) + (set! f0-6 (square f0-6)) ) (let ((f0-8 (* (lerp 3072.0 8601.6 f0-6) (-> this thruster-intensity-scalar)))) (set! (-> *part-id-table* 4709 init-specs 4 initial-valuef) f0-8) @@ -1017,62 +1008,51 @@ (go-virtual active) ) ) - (let ((f0-0 (vector-vector-xz-distance-squared (-> self root trans) (-> self focus-pos))) - (f1-0 245760.0) - ) + (let ((f0-0 (vector-vector-xz-distance-squared (-> self root trans) (-> self focus-pos)))) (cond - ((< (* f1-0 f1-0) f0-0) + ((< (square 245760.0) f0-0) (vector-copy! (-> self move-dest) (-> self focus-pos)) (set! (-> self chase-mode) (the-as uint 0)) 0 ) - ((and (= (-> self chase-mode) 0) (let ((f1-3 163840.0)) - (< f0-0 (* f1-3 f1-3)) - ) - ) + ((and (= (-> self chase-mode) 0) (< f0-0 (square 163840.0))) (set! (-> self chase-mode) (the-as uint 1)) (vector-copy! (-> self move-dest) (-> self root trans)) ) ) ) (when (= (-> self chase-mode) 1) - (let ((f0-1 (vector-vector-xz-distance-squared (-> self root trans) (-> self move-dest))) - (f1-6 20480.0) - ) - (cond - ((or (< f0-1 (* f1-6 f1-6)) (= (-> self thrust-mode) 2)) - (set-time! (-> self last-check-chase-pos-time)) - (let ((a1-5 (get-handle-pos (-> self squad) (-> self focus handle) (new 'stack-no-clear 'vector))) - (f0-2 245760.0) - ) - (cond - ((or (< (* f0-2 f0-2) (vector-vector-xz-distance-squared (-> self move-dest) a1-5)) (-> self hit-player?)) - (set! (-> self hit-player?) #f) - (squad-control-method-31 (-> self squad) (-> self move-dest) self (-> self current-enemy) 81920.0 0.0) - (flying-turret-method-230 self (the-as uint 0)) - ) - (else - (when (!= (-> self thrust-mode) 2) - (flying-turret-method-230 self (the-as uint 2)) - (set! (-> self num-shots-fired) 0) - (set! (-> self hit-player?) #f) - ) - (vector-copy! (-> self move-dest) (-> self root trans)) + (cond + ((or (< (vector-vector-xz-distance-squared (-> self root trans) (-> self move-dest)) (square 20480.0)) + (= (-> self thrust-mode) 2) + ) + (set-time! (-> self last-check-chase-pos-time)) + (let ((a1-5 (get-handle-pos (-> self squad) (-> self focus handle) (new 'stack-no-clear 'vector)))) + (cond + ((or (< (square 245760.0) (vector-vector-xz-distance-squared (-> self move-dest) a1-5)) (-> self hit-player?)) + (set! (-> self hit-player?) #f) + (squad-control-method-31 (-> self squad) (-> self move-dest) self (-> self current-enemy) 81920.0 0.0) + (flying-turret-method-230 self (the-as uint 0)) + ) + (else + (when (!= (-> self thrust-mode) 2) + (flying-turret-method-230 self (the-as uint 2)) + (set! (-> self num-shots-fired) 0) + (set! (-> self hit-player?) #f) ) + (vector-copy! (-> self move-dest) (-> self root trans)) ) ) ) - ((time-elapsed? (-> self last-check-chase-pos-time) (seconds 1)) - (set-time! (-> self last-check-chase-pos-time)) - (let ((a1-10 (get-handle-pos (-> self squad) (-> self focus handle) (new 'stack-no-clear 'vector))) - (f0-5 204800.0) - ) - (if (< (* f0-5 f0-5) (vector-vector-xz-distance-squared (-> self move-dest) a1-10)) - (squad-control-method-31 (-> self squad) (-> self move-dest) self (-> self current-enemy) 81920.0 0.0) - ) - ) + ) + ((time-elapsed? (-> self last-check-chase-pos-time) (seconds 1)) + (set-time! (-> self last-check-chase-pos-time)) + (let ((a1-10 (get-handle-pos (-> self squad) (-> self focus handle) (new 'stack-no-clear 'vector)))) + (if (< (square 204800.0) (vector-vector-xz-distance-squared (-> self move-dest) a1-10)) + (squad-control-method-31 (-> self squad) (-> self move-dest) self (-> self current-enemy) 81920.0 0.0) + ) ) - ) + ) ) ) (when (and (= (-> self thrust-mode) 2) diff --git a/goal_src/jak3/levels/city/protect/protect-gunship.gc b/goal_src/jak3/levels/city/protect/protect-gunship.gc index 259ba10521..f8b475d963 100644 --- a/goal_src/jak3/levels/city/protect/protect-gunship.gc +++ b/goal_src/jak3/levels/city/protect/protect-gunship.gc @@ -1115,9 +1115,7 @@ (set! (-> s5-0 spans-internal data 0 num-inner-points) 5) (set! (-> s5-0 spans data 0 inner-random-offset-size) 1228.8) (when (not (time-elapsed? (-> this last-hit-time) (seconds 0.3))) - (let* ((f0-16 (* 0.011111111 (the float (- (current-time) (-> this last-hit-time))))) - (f0-17 (* f0-16 f0-16)) - ) + (let ((f0-17 (square (* 0.011111111 (the float (- (current-time) (-> this last-hit-time))))))) (set! (-> s5-0 spans data 0 inner-random-offset-size) (* (-> s5-0 spans data 0 inner-random-offset-size) (lerp 5.0 1.0 f0-17)) ) @@ -1274,31 +1272,30 @@ ) (defun find-nearest-nav-mesh-protect ((arg0 vector) (arg1 float)) - (local-vars (sv-64 nav-poly) (sv-68 nav-mesh) (sv-72 float) (sv-76 vector)) - (set! sv-64 (new 'stack-no-clear 'nav-poly)) - (set! sv-68 (the-as nav-mesh #f)) - (set! sv-72 arg1) - (set! sv-76 arg0) - (set! (-> sv-64 data 20) (the-as uint 7)) - (dotimes (gp-0 (-> *level* length)) - (let ((v1-5 (-> *level* level gp-0))) - (when (= (-> v1-5 status) 'active) - (when (!= (-> v1-5 name) 'lctyprot) - (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 vertex 0) sv-76 (the-as vector (-> s3-0 bounds))) - (let ((f0-1 (vector-length-squared (-> sv-64 vertex 0))) - (f1-0 (-> s3-0 bounds r)) - ) - (when (< f0-1 (* f1-0 f1-0)) - (set! (-> sv-64 vertex1 x) (-> s3-0 nearest-y-threshold)) - (nav-mesh-method-46 s3-0 sv-64) - (when (>= sv-72 (-> sv-64 vertex1 w)) - (set! sv-72 (-> sv-64 vertex1 w)) - (set! sv-68 s3-0) + (let ((sv-64 (new 'stack-no-clear 'nav-poly)) + (sv-68 (the-as nav-mesh #f)) + ) + (let ((sv-72 arg1) + (sv-76 arg0) + ) + (set! (-> sv-64 data 20) (the-as uint 7)) + (dotimes (gp-0 (-> *level* length)) + (let ((v1-5 (-> *level* level gp-0))) + (when (= (-> v1-5 status) 'active) + (when (!= (-> v1-5 name) 'lctyprot) + (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 vertex 0) sv-76 (the-as vector (-> s3-0 bounds))) + (when (< (vector-length-squared (-> sv-64 vertex 0)) (square (-> s3-0 bounds r))) + (set! (-> sv-64 vertex1 x) (-> s3-0 nearest-y-threshold)) + (nav-mesh-method-46 s3-0 sv-64) + (when (>= sv-72 (-> sv-64 vertex1 w)) + (set! sv-72 (-> sv-64 vertex1 w)) + (set! sv-68 s3-0) + ) ) ) ) @@ -1310,8 +1307,8 @@ ) ) ) + sv-68 ) - sv-68 ) (defbehavior gunship-event-handler protect-gunship ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) @@ -1881,16 +1878,12 @@ (if (and (logtest? (process-mask target crate enemy guard vehicle civilian) (-> s3-1 mask)) (not (focus-test? (the-as process-focusable s3-1) disable dead inactive)) (-> (the-as process-focusable s3-1) root root-prim) - (let ((f0-7 - (vector-vector-distance-squared - (-> self dest-pos) - (-> (the-as process-focusable s3-1) root root-prim prim-core world-sphere) - ) - ) - (f1-4 f30-0) - ) - (< f0-7 (* f1-4 f1-4)) - ) + (< (vector-vector-distance-squared + (-> self dest-pos) + (-> (the-as process-focusable s3-1) root root-prim prim-core world-sphere) + ) + (square f30-0) + ) ) (send-event s3-1 @@ -1920,7 +1913,7 @@ (not (focus-test? s5-1 disable dead inactive)) (-> s5-1 control root-prim) (< (vector-vector-distance-squared (-> self dest-pos) (-> s5-1 control root-prim prim-core world-sphere)) - (* f30-0 f30-0) + (square f30-0) ) ) (send-event @@ -2150,8 +2143,7 @@ (f24-1 (/ f0-35 4)) (f0-38 (floor (the float (/ s5-5 3)))) (f2-0 (/ f30-3 (meters 15))) - (f1-15 (fmax 0.0 (fmin 1.0 f2-0))) - (f1-16 (* f1-15 f1-15)) + (f1-16 (square (fmax 0.0 (fmin 1.0 f2-0)))) (f0-39 (* f0-38 (- 1.0 f1-16))) (f0-41 (* f26-2 (+ 0.75 f0-39))) (f30-4 (fmin 40960.0 f0-41)) @@ -2348,8 +2340,7 @@ (set! (-> s5-0 y) 0.0) (let* ((f0-11 (vector-normalize-ret-len! s5-0 1.0)) (f1-6 (/ f0-11 (meters 25))) - (f0-13 (fmax 0.0 (fmin 1.0 f1-6))) - (f0-14 (* f0-13 f0-13)) + (f0-14 (square (fmax 0.0 (fmin 1.0 f1-6)))) ) (vector-cross! (new 'stack-no-clear 'vector) *up-vector* s5-0) (let ((f0-15 (* 2730.6667 f0-14)) @@ -2889,161 +2880,106 @@ ;; ERROR: Unsupported inline assembly instruction kind - [madda.s f1, f4] ;; ERROR: Unsupported inline assembly instruction kind - [madd.s f0, f2, f5] (defun find-reposition-pt ((arg0 vector) (arg1 vector) (arg2 vector) (arg3 int) (arg4 int) (arg5 float) (arg6 float)) - (local-vars - (f0-16 float) - (sv-32 int) - (sv-40 float) - (sv-44 float) - (sv-48 vector) - (sv-52 symbol) - (sv-56 float) - (sv-60 vector) - (sv-64 float) - (sv-68 float) - (sv-72 float) - (sv-76 float) - (sv-80 float) - (sv-144 (function vector vector float)) - (sv-160 vector) - (sv-176 vector) - (sv-192 vector) - ) + (local-vars (f0-16 float)) (rlet ((vf0 :class vf) (vf4 :class vf) (vf5 :class vf) (vf6 :class vf) ) (init-vf0-vector) - (set! sv-32 -1) - (let ((f0-0 409600000.0)) - (set! sv-40 (* f0-0 f0-0)) - ) - (set! sv-44 (the-as float 409600000.0)) - (set! sv-48 (new 'stack-no-clear 'vector)) - (set! sv-52 #t) - (set! sv-56 (the-as float 0.0)) - (let ((v1-9 (the-as protect-gunship (handle->process (-> *active-gunships* arg4 proc))))) - (when v1-9 - (vector-! sv-48 (-> v1-9 root trans) arg1) - (set! (-> sv-48 y) 0.0) - (set! sv-56 (vector-normalize-ret-len! sv-48 1.0)) - ) - ) - (dotimes (s0-0 (-> *protect-path* length)) - (set! sv-60 (-> *protect-path* s0-0)) - (set! sv-64 (vector-vector-xz-distance-squared arg2 (-> *protect-path* s0-0))) - (set! sv-68 (vector-vector-xz-distance-squared arg1 (-> *protect-path* s0-0))) - (set! sv-144 vector-vector-xz-distance-squared) - (set! sv-160 (-> *protect-path* s0-0)) - (let ((a1-8 (target-pos 0))) - (set! sv-72 (sv-144 sv-160 a1-8)) - ) - (set! sv-76 (the-as float 0.0)) - (set! sv-80 (the-as float 1.0)) - (set! sv-52 #t) - (let ((v1-30 (the-as protect-gunship (handle->process (-> *active-gunships* arg4 proc))))) - (when v1-30 - (set! sv-44 (vector-vector-xz-distance sv-60 (-> v1-30 root trans))) - (set! sv-176 (new 'stack-no-clear 'vector)) - (let ((v1-34 sv-60) - (a0-24 arg1) - ) - (.lvf vf4 (&-> v1-34 quad)) - (.lvf vf5 (&-> a0-24 quad)) + (let ((sv-32 -1)) + (let ((sv-40 (square 409600000.0)) + (sv-44 (the-as float 409600000.0)) + (sv-48 (new 'stack-no-clear 'vector)) + (sv-52 #t) + (sv-56 (the-as float 0.0)) ) - (.mov.vf.w vf6 vf0) - (.sub.vf.xyz vf6 vf4 vf5) - (.svf (&-> sv-176 quad) vf6) - 0.0 - (let ((a0-25 sv-176)) - (vector-copy! a0-25 sv-176) - (set! (-> a0-25 y) 0.0) - (vector-normalize! a0-25 1.0) - ) - (let* ((v1-38 sv-48) - ; (f0-15 (-> sv-176 x)) - ; (f1-0 (-> sv-176 y)) - ; (f2-0 (-> sv-176 z)) - ; (f3-0 (-> v1-38 x)) - ; (f4-0 (-> v1-38 y)) - ; (f5-0 (-> v1-38 z)) - ) - ;; og:preserve-this - ; (.mula.s f0-15 f3-0) - ; (.madda.s f1-0 f4-0) - ; (.madd.s f0-16 f2-0 f5-0) - (set! f0-16 (vector-dot sv-176 v1-38)) - ) - (let ((f0-17 f0-16)) - (if (and (< 0.8 f0-17) (< sv-44 sv-56)) - (set! sv-52 (the-as symbol #f)) - ) + (let ((v1-9 (the-as protect-gunship (handle->process (-> *active-gunships* arg4 proc))))) + (when v1-9 + (vector-! sv-48 (-> v1-9 root trans) arg1) + (set! (-> sv-48 y) 0.0) + (set! sv-56 (vector-normalize-ret-len! sv-48 1.0)) ) ) - ) - (let ((f0-19 143360.0)) - (when (and (< (* f0-19 f0-19) sv-72) - (let ((f0-22 sv-72) - (f1-4 319488.0) - ) - (< f0-22 (* f1-4 f1-4)) - ) - (and (< 102400.0 sv-44) sv-52) - ) - (when (or (not (logtest? arg3 2)) (let ((a0-32 (find-nearest-nav-mesh-protect sv-60 (the-as float #x7f800000)))) - (when a0-32 - (set! sv-192 (new 'stack-no-clear 'vector)) - (nav-mesh-method-10 a0-32 sv-192 sv-60 (the-as nav-poly #f)) - (let ((t9-9 vector-vector-xz-distance) - (a1-14 sv-60) - ) - (< (t9-9 sv-192 a1-14) 4096.0) - ) - ) - ) + (dotimes (s0-0 (-> *protect-path* length)) + (let ((sv-60 (-> *protect-path* s0-0)) + (sv-64 (vector-vector-xz-distance-squared arg2 (-> *protect-path* s0-0))) + (sv-68 (vector-vector-xz-distance-squared arg1 (-> *protect-path* s0-0))) + (sv-72 (vector-vector-xz-distance-squared (-> *protect-path* s0-0) (target-pos 0))) + (sv-76 (the-as float 0.0)) + ) + (let ((sv-80 (the-as float 1.0))) + ) + (set! sv-52 #t) + (let ((v1-30 (the-as protect-gunship (handle->process (-> *active-gunships* arg4 proc))))) + (when v1-30 + (set! sv-44 (vector-vector-xz-distance sv-60 (-> v1-30 root trans))) + (let ((sv-176 (new 'stack-no-clear 'vector))) + (let ((v1-34 sv-60) + (a0-24 arg1) + ) + (.lvf vf4 (&-> v1-34 quad)) + (.lvf vf5 (&-> a0-24 quad)) ) - (when (or (not (logtest? arg3 6)) (let ((f0-25 arg5)) - (< (* f0-25 f0-25) sv-64) - ) + (.mov.vf.w vf6 vf0) + (.sub.vf.xyz vf6 vf4 vf5) + (.svf (&-> sv-176 quad) vf6) + 0.0 + (let ((a0-25 sv-176)) + (vector-copy! a0-25 sv-176) + (set! (-> a0-25 y) 0.0) + (vector-normalize! a0-25 1.0) + ) + (let* ((v1-38 sv-48)) + (set! f0-16 (vector-dot sv-176 v1-38)) + ) + ) + (let ((f0-17 f0-16)) + (if (and (< 0.8 f0-17) (< sv-44 sv-56)) + (set! sv-52 (the-as symbol #f)) ) - (when (or (not (logtest? arg3 1)) (let ((f0-28 sv-72) - (f1-10 286720.0) + ) + ) + ) + (when (and (< (square 143360.0) sv-72) (< sv-72 (square 319488.0)) (and (< 102400.0 sv-44) sv-52)) + (when (or (not (logtest? arg3 2)) (let ((a0-32 (find-nearest-nav-mesh-protect sv-60 (the-as float #x7f800000)))) + (when a0-32 + (let ((sv-192 (new 'stack-no-clear 'vector))) + (nav-mesh-method-10 a0-32 sv-192 sv-60 (the-as nav-poly #f)) + (< (vector-vector-xz-distance sv-192 sv-60) 4096.0) ) - (and (< f0-28 (* f1-10 f1-10)) (let ((f0-29 163840.0)) - (< (* f0-29 f0-29) sv-72) - ) - ) + ) ) ) - (let ((f0-32 sv-68) - (f1-14 arg6) + (when (or (not (logtest? arg3 6)) (< (square arg5) sv-64)) + (when (or (not (logtest? arg3 1)) (and (< sv-72 (square 286720.0)) (< (square 163840.0) sv-72))) + (set! sv-76 (fabs (- sv-68 (square arg6)))) + (let ((a0-35 (new 'stack 'sphere))) + (set! (-> a0-35 quad) (-> sv-60 quad)) + (set! (-> a0-35 r) 20480.0) + (if (not (sphere-in-view-frustum? a0-35)) + (set! sv-76 (* 100.0 sv-76)) + ) ) - (set! sv-76 (fabs (- f0-32 (* f1-14 f1-14)))) - ) - (let ((a0-35 (new 'stack 'sphere))) - (set! (-> a0-35 quad) (-> sv-60 quad)) - (set! (-> a0-35 r) 20480.0) - (if (not (sphere-in-view-frustum? a0-35)) - (set! sv-76 (* 100.0 sv-76)) + (when (< sv-76 sv-40) + (set! sv-40 sv-76) + (set! sv-32 s0-0) ) - ) - (when (< sv-76 sv-40) - (set! sv-40 sv-76) - (set! sv-32 s0-0) + ) ) ) ) ) ) ) - ) - (cond - ((< -1 sv-32) - (-> *protect-path* sv-32) - ) - (else - (empty) - arg1 + (cond + ((< -1 sv-32) + (-> *protect-path* sv-32) + ) + (else + (empty) + arg1 + ) ) ) ) @@ -3360,8 +3296,7 @@ 0.0 0.0 (let* ((f0-6 (vector-length v1-8)) - (f0-7 (/ f0-6 (meters 25))) - (f1-3 (* f0-7 f0-7 (seconds-per-frame))) + (f1-3 (* (square (/ f0-6 (meters 25))) (seconds-per-frame))) (f0-10 (fmax 0.0 (fmin 1.0 f1-3))) ) (vector+float*! (-> this root transv) (-> this root transv) v1-8 f0-10) @@ -3387,8 +3322,7 @@ (let ((f1-6 (vector-normalize-ret-len! s5-3 1.0))) (when (< f1-6 122880.0) (let* ((f0-21 (/ f1-6 (meters 30))) - (f0-22 (- 1.0 f0-21)) - (f0-23 (* f0-22 f0-22)) + (f0-23 (square (- 1.0 f0-21))) ) (vector-float*! s5-3 s5-3 (- 122880.0 f1-6)) (vector+float*! (-> this root transv) (-> this root transv) s5-3 (* 4.0 (seconds-per-frame) f0-23)) diff --git a/goal_src/jak3/levels/city/protect/roboguard-city.gc b/goal_src/jak3/levels/city/protect/roboguard-city.gc index 87d040f74b..65eeedb044 100644 --- a/goal_src/jak3/levels/city/protect/roboguard-city.gc +++ b/goal_src/jak3/levels/city/protect/roboguard-city.gc @@ -1318,11 +1318,7 @@ (!= self s3-1) (not (focus-test? (the-as process-focusable s3-1) disable dead inactive)) (logtest? (process-mask crate guard vehicle civilian metalhead) (-> s3-1 mask)) - (let ((f0-0 (vector-vector-xz-distance-squared gp-0 (get-trans (the-as process-focusable s3-1) 3))) - (f1-0 10240.0) - ) - (< f0-0 (* f1-0 f1-0)) - ) + (< (vector-vector-xz-distance-squared gp-0 (get-trans (the-as process-focusable s3-1) 3)) (square 10240.0)) ) (send-attack-from-tshape self s3-1 (the-as touching-shapes-entry #f) (-> self persistent-attack-id)) ) @@ -1338,11 +1334,7 @@ (!= self s5-2) (not (focus-test? s5-2 disable dead inactive)) (logtest? (process-mask crate guard vehicle civilian metalhead) (-> s5-2 mask)) - (let ((f0-2 (vector-vector-xz-distance-squared gp-0 (get-trans s5-2 3))) - (f1-4 10240.0) - ) - (< f0-2 (* f1-4 f1-4)) - ) + (< (vector-vector-xz-distance-squared gp-0 (get-trans s5-2 3)) (square 10240.0)) ) (send-attack-from-tshape self s5-2 (the-as touching-shapes-entry #f) (-> self persistent-attack-id)) ) @@ -2242,17 +2234,13 @@ (the-as enemy-aware #f) ) (update-focus this) - (let ((f0-2 (vector-vector-xz-distance-squared (-> this root trans) (-> this focus-pos))) - (f1-1 204800.0) - ) - (when (< f0-2 (* f1-1 f1-1)) - (set-time! (-> this pursuit-start-time)) - (logior! (-> this flags) (citizen-flag in-pursuit)) - (when (not (logtest? (-> this squad alert-state flags) (squad-alert-flag war))) - (let ((v0-6 (the-as object (logior (-> this flags) (citizen-flag persistent))))) - (set! (-> this flags) (the-as citizen-flag v0-6)) - v0-6 - ) + (when (< (vector-vector-xz-distance-squared (-> this root trans) (-> this focus-pos)) (square 204800.0)) + (set-time! (-> this pursuit-start-time)) + (logior! (-> this flags) (citizen-flag in-pursuit)) + (when (not (logtest? (-> this squad alert-state flags) (squad-alert-flag war))) + (let ((v0-6 (the-as object (logior (-> this flags) (citizen-flag persistent))))) + (set! (-> this flags) (the-as citizen-flag v0-6)) + v0-6 ) ) ) diff --git a/goal_src/jak3/levels/city/sniper/cty-sniper-battery.gc b/goal_src/jak3/levels/city/sniper/cty-sniper-battery.gc index 9c11b8ac33..eb9a56a28d 100644 --- a/goal_src/jak3/levels/city/sniper/cty-sniper-battery.gc +++ b/goal_src/jak3/levels/city/sniper/cty-sniper-battery.gc @@ -861,7 +861,6 @@ (defmethod init-from-entity! ((this cty-sniper-battery) (arg0 entity-actor)) "Set up a newly created process from the entity that created it." - (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) @@ -904,12 +903,13 @@ ) (process-drawable-from-entity! this arg0) (logclear! (-> this mask) (process-mask actor-pause)) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-25 (res-lump-data arg0 'actor-groups pointer :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-25 (res-lump-data arg0 'actor-groups (pointer actor-group) :tag-ptr (& sv-16))) + ) (cond ((and v1-25 (nonzero? (-> sv-16 elt-count))) (set! (-> this actor-group-count) (the-as int (-> sv-16 elt-count))) - (set! (-> this actor-group) (the-as (pointer actor-group) v1-25)) + (set! (-> this actor-group) v1-25) ) (else (set! (-> this actor-group-count) 0) diff --git a/goal_src/jak3/levels/city/sniper/cty-sniper-turret.gc b/goal_src/jak3/levels/city/sniper/cty-sniper-turret.gc index f1489c99f5..ed55878f8f 100644 --- a/goal_src/jak3/levels/city/sniper/cty-sniper-turret.gc +++ b/goal_src/jak3/levels/city/sniper/cty-sniper-turret.gc @@ -248,14 +248,15 @@ ) (defmethod task-manager-method-26 ((this task-manager-city-sniper-fight)) - (local-vars (v1-10 object) (sv-16 res-tag)) + (local-vars (v1-10 object)) (when (not (-> this sniper-turrets-marker-entity)) (let ((s5-0 (entity-by-name "cty-sniper-fight-turret-manager-1"))) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-3 (res-lump-data s5-0 'actor-groups pointer :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-3 (res-lump-data s5-0 'actor-groups (pointer actor-group) :tag-ptr (& sv-16))) + ) (cond ((and v1-3 (nonzero? (-> sv-16 elt-count))) - (set! (-> this actor-group) (the-as (pointer actor-group) v1-3)) + (set! (-> this actor-group) v1-3) (set! (-> this actor-group-count) (the-as int (-> sv-16 elt-count))) ) (else @@ -3152,12 +3153,12 @@ (defmethod init-from-entity! ((this cty-sniper-turret) (arg0 entity-actor)) "Set up a newly created process from the entity that created it." - (local-vars (sv-16 res-tag)) ;; og:preserve-this added (stack-size-set! (-> this main-thread) 1024) (set! (-> this entity) arg0) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-1 (res-lump-data arg0 'actor-groups (pointer actor-group) :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-1 (res-lump-data arg0 'actor-groups (pointer actor-group) :tag-ptr (& sv-16))) + ) (when (and v1-1 (nonzero? (-> sv-16 elt-count))) (set! (-> this actor-group-count) (the-as int (-> sv-16 elt-count))) (set! (-> this actor-group) v1-1) diff --git a/goal_src/jak3/levels/city/traffic/citizen/citizen.gc b/goal_src/jak3/levels/city/traffic/citizen/citizen.gc index 1c266daa2b..060d3a865f 100644 --- a/goal_src/jak3/levels/city/traffic/citizen/citizen.gc +++ b/goal_src/jak3/levels/city/traffic/citizen/citizen.gc @@ -487,9 +487,7 @@ *cty-faction-manager* (and (or (not (-> this draw)) (not (logtest? (-> this draw status) (draw-control-status on-screen))) - (let ((f0-0 450560.0)) - (< (* f0-0 f0-0) (vector-vector-xz-distance-squared (-> this root trans) (math-camera-pos))) - ) + (< (square 450560.0) (vector-vector-xz-distance-squared (-> this root trans) (math-camera-pos))) ) (nonzero? (-> this controller branch)) (or (not (cty-faction-manager-method-23 *cty-faction-manager* (the-as uint (-> this controller branch clock-mask))) @@ -1034,7 +1032,6 @@ ) (defmethod citizen-method-203 ((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)) @@ -1051,54 +1048,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) - (vector-copy! s1-0 s0-0) - (vector-copy! s1-0 sv-320) - ) - ) - ((< 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) + (vector-copy! s1-0 s0-0) (vector-copy! s1-0 sv-320) ) - (else - (vector-copy! s1-0 s0-0) - ) - ) + ) + ((< 4096.0 f1-10) + (vector-copy! s1-0 sv-320) + ) + (else + (vector-copy! s1-0 s0-0) ) - (vector-copy! arg0 s1-0) - (let ((a1-11 (new 'stack-no-clear 'vector))) - (vector-copy! a1-11 (-> this root trans)) - (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)) + ) + ) + (vector-copy! arg0 s1-0) + (let ((a1-11 (new 'stack-no-clear 'vector))) + (vector-copy! a1-11 (-> this root trans)) + (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)) ) ) ) @@ -1656,11 +1646,9 @@ (cond ((not (logtest? (-> self flags) (citizen-flag in-formation))) (when (and (nonzero? (-> self controller branch)) - (let ((f0-0 (vector-vector-xz-distance-squared (-> self root trans) (-> self dest-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 dest-point)) (square 16384.0)) + (logtest? (-> self nav state flags) (nav-state-flag at-target)) + ) ) (let ((gp-0 (-> self controller branch))) (vehicle-controller-method-14 (-> self controller) (the-as vehicle self)) @@ -1694,11 +1682,7 @@ (a1-12 (new 'stack-no-clear 'vector)) ) (vector-copy! a1-12 (-> a2-2 target-pos)) - (let ((f0-2 (t9-4 a0-16 a1-12)) - (f1-3 4096.0) - ) - (< f0-2 (* f1-3 f1-3)) - ) + (< (t9-4 a0-16 a1-12) (square 4096.0)) ) ) (-> self nav state speed) diff --git a/goal_src/jak3/levels/city/traffic/citizen/civilian.gc b/goal_src/jak3/levels/city/traffic/citizen/civilian.gc index bef40300a9..e7ddd75f87 100644 --- a/goal_src/jak3/levels/city/traffic/citizen/civilian.gc +++ b/goal_src/jak3/levels/city/traffic/citizen/civilian.gc @@ -504,7 +504,6 @@ ) (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 dest-point) (-> self root trans)))) (vector-! (new 'stack-no-clear 'vector) (-> self dest-point) (the-as vector (-> self danger-pos))) @@ -517,67 +516,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-poly)) ) - (let ((v1-6 (-> self nav)) - (a0-8 (-> self danger-pos)) - (a1-5 (new 'stack-no-clear 'nav-poly)) - ) - (vector-! (-> a1-5 vertex 0) (the-as vector a0-8) (the-as vector (-> v1-6 state mesh bounds))) - (set! (-> a1-5 vertex1 x) (-> v1-6 nearest-y-threshold)) - (set! (-> a1-5 data 20) (the-as uint 2)) - (set! sv-352 (nav-mesh-method-45 (-> 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) - (vector-copy! s4-0 s3-0) - (vector-copy! s4-0 s2-0) + (vector-! (-> a1-5 vertex 0) (the-as vector a0-8) (the-as vector (-> v1-6 state mesh bounds))) + (set! (-> a1-5 vertex1 x) (-> v1-6 nearest-y-threshold)) + (set! (-> a1-5 data 20) (the-as uint 2)) + (let ((sv-352 (nav-mesh-method-45 (-> 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) - (vector-copy! s4-0 s2-0) - ) - (else - (vector-copy! s4-0 s3-0) + (cond + ((< 0.0 (vector-dot s1-1 gp-1)) + (if (< 8192.0 f0-7) + (vector-copy! s4-0 s3-0) + (vector-copy! s4-0 s2-0) + ) + ) + ((< 8192.0 f1-7) + (vector-copy! s4-0 s2-0) + ) + (else + (vector-copy! s4-0 s3-0) + ) ) ) - ) - (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) - ) - (vector-copy! gp-1 s4-0) - (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) + ) + (vector-copy! gp-1 s4-0) + (vector-xz-normalize! gp-1 (* 16384.0 f0-15)) + ) ) + (vector-xz-normalize! s5-1 16384.0) ) - (vector-xz-normalize! s5-1 16384.0) ) ) ) @@ -699,7 +691,6 @@ ) (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)) @@ -716,41 +707,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) + (vector-copy! s4-0 s3-0) + (vector-copy! s4-0 s2-0) ) - (cond - ((< 0.0 (vector-dot gp-0 s5-1)) - (if (< 4096.0 f0-9) - (vector-copy! s4-0 s3-0) - (vector-copy! s4-0 s2-0) - ) - ) - ((< 4096.0 f1-8) - (vector-copy! s4-0 s2-0) - ) - (else - (vector-copy! s4-0 s3-0) - ) + ) + ((< 4096.0 f1-8) + (vector-copy! s4-0 s2-0) + ) + (else + (vector-copy! s4-0 s3-0) ) ) - (vector-copy! gp-0 s4-0) ) + (vector-copy! gp-0 s4-0) ) ) (if *citizen-debug* @@ -1708,7 +1693,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)) @@ -1739,24 +1723,15 @@ (quaternion-copy! s3-0 (-> s2-0 root quat)) (vehicle-method-66 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) @@ -1926,7 +1901,6 @@ ) ) :code (behavior () - (local-vars (sv-128 float) (sv-144 float)) (ja-channel-push! 1 (seconds 0.1)) (remove-riders (the-as vehicle (handle->process (-> self vehicle))) (the-as handle self)) (logclear! (-> self focus-status) (focus-status pilot-riding pilot)) @@ -1984,24 +1958,16 @@ ) (vehicle-method-66 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/goal_src/jak3/levels/city/traffic/citizen/guard.gc b/goal_src/jak3/levels/city/traffic/citizen/guard.gc index 32eb880760..513fadf8ed 100644 --- a/goal_src/jak3/levels/city/traffic/citizen/guard.gc +++ b/goal_src/jak3/levels/city/traffic/citizen/guard.gc @@ -227,60 +227,48 @@ ) (defmethod crimson-guard-method-259 ((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) - ) - (set! sv-240 arg0) - (let ((s0-1 (vector+*! (new 'stack-no-clear 'vector) (-> this root trans) *y-vector* 8192.0))) - (set! sv-320 (new 'stack-no-clear 'vector)) - (set! sv-304 (new 'stack-no-clear 'vector)) - (let ((s1-0 (new 'stack-no-clear 'vector)) - (s2-0 (new 'stack-no-clear 'vector)) - (s5-0 (new 'stack-no-clear 'vector)) + (let ((sv-240 arg0) + (s0-1 (vector+*! (new 'stack-no-clear 'vector) (-> this root trans) *y-vector* 8192.0)) + (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)) + ) + (-> this node-list data 4 bone transform) + (let ((s4-0 (vector-x-quaternion! (new 'stack-no-clear 'vector) (-> this root quat))) + (s3-0 (vector-y-quaternion! (new 'stack-no-clear 'vector) (-> this root quat))) ) - (-> this node-list data 4 bone transform) - (let ((s4-0 (vector-x-quaternion! (new 'stack-no-clear 'vector) (-> this root quat))) - (s3-0 (vector-y-quaternion! (new 'stack-no-clear 'vector) (-> this root quat))) - ) - (vector-z-quaternion! (new 'stack-no-clear 'vector) (-> this root quat)) - (vector-copy! s0-1 (-> this root trans)) - (if (logtest? (enemy-flag drawn-mirrored) (-> this enemy-flags)) - (vector+*! s0-1 s0-1 s4-0 4096.0) - (vector+*! s0-1 s0-1 s4-0 2048.0) - ) - (vector+*! s0-1 s0-1 s3-0 8540.16) - (vector-normalize! (vector-! sv-320 sv-240 s0-1) 1.0) - (set! sv-288 (new 'stack-no-clear 'vector)) - (let ((v1-19 (-> sv-240 quad))) - (set! (-> sv-288 quad) v1-19) - ) - (set! sv-256 vector-rotate90-around-y!) - (set! sv-272 (new 'stack-no-clear 'vector)) - (let* ((a1-15 (vector-normalize! (vector-! (new 'stack-no-clear 'vector) sv-288 s0-1) -2998.272)) - (v0-5 (sv-256 sv-272 a1-15)) - ) - (vector+! sv-288 sv-288 v0-5) + (vector-z-quaternion! (new 'stack-no-clear 'vector) (-> this root quat)) + (vector-copy! s0-1 (-> this root trans)) + (if (logtest? (enemy-flag drawn-mirrored) (-> this enemy-flags)) + (vector+*! s0-1 s0-1 s4-0 4096.0) + (vector+*! s0-1 s0-1 s4-0 2048.0) ) + (vector+*! s0-1 s0-1 s3-0 8540.16) + (vector-normalize! (vector-! sv-320 sv-240 s0-1) 1.0) + (let ((sv-288 (new 'stack-no-clear 'vector))) + (vector-copy! sv-288 sv-240) + (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-1) -2998.272) + ) + ) (vector-normalize! (vector-! sv-320 sv-288 s0-1) 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) - (set! (-> s5-0 x) (fmax -14563.556 (fmin 14563.556 (deg- (-> s1-0 x) (-> s2-0 x))))) - (set! (-> s5-0 y) (fmax -14563.556 (fmin 14563.556 (deg- (-> s1-0 y) (-> s2-0 y))))) - (set! (-> s5-0 z) 0.0) - (let ((s2-1 (new 'stack-no-clear 'quaternion))) - (let ((s1-1 (new 'stack-no-clear 'quaternion))) - (quaternion-vector-angle! s2-1 s4-0 (-> s5-0 x)) - (quaternion-vector-angle! s1-1 s3-0 (-> s5-0 y)) - (quaternion*! s2-1 s1-1 s2-1) - ) - (quaternion-slerp! (-> this joint quat) (-> this joint quat) s2-1 (* 5.0 (seconds-per-frame))) + ) + (vector-z-quaternion! sv-304 (-> this root quat)) + (rot-zxy-from-vector! s2-0 sv-304) + (rot-zxy-from-vector! s1-0 sv-320) + (set! (-> s5-0 x) (fmax -14563.556 (fmin 14563.556 (deg- (-> s1-0 x) (-> s2-0 x))))) + (set! (-> s5-0 y) (fmax -14563.556 (fmin 14563.556 (deg- (-> s1-0 y) (-> s2-0 y))))) + (set! (-> s5-0 z) 0.0) + (let ((s2-1 (new 'stack-no-clear 'quaternion))) + (let ((s1-1 (new 'stack-no-clear 'quaternion))) + (quaternion-vector-angle! s2-1 s4-0 (-> s5-0 x)) + (quaternion-vector-angle! s1-1 s3-0 (-> s5-0 y)) + (quaternion*! s2-1 s1-1 s2-1) ) + (quaternion-slerp! (-> this joint quat) (-> this joint quat) s2-1 (* 5.0 (seconds-per-frame))) ) ) ) @@ -1084,55 +1072,58 @@ ) (defmethod crimson-guard-method-282 ((this crimson-guard) (arg0 vector) (arg1 traffic-target-formation) (arg2 (pointer float)) (arg3 int)) - (local-vars (sv-16 int) (sv-24 float) (sv-28 float) (sv-32 float)) - (set! sv-16 -1) - ;; og:preserve-this - (set! sv-24 (the-as float #x7f800000)) - (set! sv-28 (crimson-guard-method-283 this)) - (let ((v1-4 (-> this guard-type))) - (set! sv-32 (the-as float (if (or (= v1-4 (guard-type rifle)) (= v1-4 (guard-type grenade))) - #x47200000 - #x46000000 - ) - ) + (let ((sv-16 -1)) + ;; og:preserve-this + (let ((sv-24 (the-as float #x7f800000)) + (sv-28 (crimson-guard-method-283 this)) ) - ) - (dotimes (s1-0 arg3) - (when (>= (-> arg1 circle-range s1-0) sv-32) - (let* ((a1-3 (vector-rotate-around-y! - (new 'stack-no-clear 'vector) - *x-vector* - (* 182.04445 (/ (* 360.0 (the float s1-0)) (the float arg3))) - ) - ) - (a0-6 (vector+float*! (new 'stack-no-clear 'vector) arg0 a1-3 (fmin sv-28 (-> arg1 circle-range s1-0)))) - (f0-8 (vector-vector-distance a0-6 (-> this root trans))) + (let* ((v1-4 (-> this guard-type)) + (sv-32 (the-as float (if (or (= v1-4 (guard-type rifle)) (= v1-4 (guard-type grenade))) + #x47200000 + #x46000000 + ) + ) + ) ) - (when (and (< f0-8 sv-24) (= (-> arg2 s1-0) 0.0)) - (set! sv-16 s1-0) - (set! sv-24 f0-8) + (dotimes (s1-0 arg3) + (when (>= (-> arg1 circle-range s1-0) sv-32) + (let* ((a1-3 (vector-rotate-around-y! + (new 'stack-no-clear 'vector) + *x-vector* + (* 182.04445 (/ (* 360.0 (the float s1-0)) (the float arg3))) + ) + ) + (a0-6 (vector+float*! (new 'stack-no-clear 'vector) arg0 a1-3 (fmin sv-28 (-> arg1 circle-range s1-0)))) + (f0-8 (vector-vector-distance a0-6 (-> this root trans))) + ) + (when (and (< f0-8 sv-24) (= (-> arg2 s1-0) 0.0)) + (set! sv-16 s1-0) + (set! sv-24 f0-8) + ) + ) + ) + ) + ) + (cond + ((!= sv-16 -1) + (let ((v1-26 (vector-rotate-around-y! + (new 'stack-no-clear 'vector) + *x-vector* + (* 182.04445 (/ (* 360.0 (the float sv-16)) (the float arg3))) + ) + ) + ) + (vector+float*! (-> this move-position) arg0 v1-26 (fmin sv-28 (-> arg1 circle-range sv-16))) + ) + (set! (-> arg2 sv-16) (fmin sv-28 (-> arg1 circle-range sv-16))) + ) + (else + (vector-copy! (-> this move-position) (-> this root trans)) ) ) ) + (!= sv-16 -1) ) - (cond - ((!= sv-16 -1) - (let ((v1-26 (vector-rotate-around-y! - (new 'stack-no-clear 'vector) - *x-vector* - (* 182.04445 (/ (* 360.0 (the float sv-16)) (the float arg3))) - ) - ) - ) - (vector+float*! (-> this move-position) arg0 v1-26 (fmin sv-28 (-> arg1 circle-range sv-16))) - ) - (set! (-> arg2 sv-16) (fmin sv-28 (-> arg1 circle-range sv-16))) - ) - (else - (vector-copy! (-> this move-position) (-> this root trans)) - ) - ) - (!= sv-16 -1) ) (defmethod crimson-guard-method-262 ((this crimson-guard)) @@ -1272,14 +1263,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-266 ((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 ((vf0 :class vf) (vf4 :class vf) (vf5 :class vf) @@ -1292,8 +1276,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)))) @@ -1308,59 +1292,52 @@ (vector-! (-> a1-7 vertex 0) a0-8 (the-as vector (-> v1-15 state mesh bounds))) (set! (-> a1-7 vertex1 x) (-> v1-15 nearest-y-threshold)) (set! (-> a1-7 data 20) (the-as uint 2)) - (set! sv-816 (nav-mesh-method-45 (-> v1-15 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)) - ) - ;; og:preserve-this vector-dot - ; (.mula.s f0-7 f3-2) - ; (.madda.s f1-4 f4-0) - ; (.madd.s f0-8 f2-2 f5-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))) - (vector-copy! a1-8 s1-0) - (set! (-> a1-8 w) 8192.0) - (when (not (check-sphere-blocked! (-> 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-6 sv-832) - (t0-2 (vector-! (new 'stack-no-clear 'vector) v1-30 (the-as vector (-> sv-800 state mesh bounds)))) - ) - (t9-7 a0-18 sv-816 a2-6 a3-3 t0-2) + (let ((sv-816 (nav-mesh-method-45 (-> v1-15 state mesh) a1-7))) + (when sv-816 + (let* ((v1-19 s4-0)) + (set! f0-8 (vector-dot sv-768 v1-19)) + ) + (let ((f28-0 f0-8)) + (new 'stack-no-clear 'vector) + (let ((a1-8 (new 'stack-no-clear 'vector))) + (vector-copy! a1-8 s1-0) + (set! (-> a1-8 w) 8192.0) + (when (not (check-sphere-blocked! (-> 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 (the-as vector (-> 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)) + ) + (vector-copy! arg0 s1-0) ) ) - (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)) - ) - (vector-copy! arg0 s1-0) ) ) ) diff --git a/goal_src/jak3/levels/city/traffic/citizen/metalhead-grunt.gc b/goal_src/jak3/levels/city/traffic/citizen/metalhead-grunt.gc index 8f174adc60..ffa4c4718b 100644 --- a/goal_src/jak3/levels/city/traffic/citizen/metalhead-grunt.gc +++ b/goal_src/jak3/levels/city/traffic/citizen/metalhead-grunt.gc @@ -708,11 +708,7 @@ ) ) (zero? (rnd-int this 3)) - (let ((f0-2 (vector-vector-distance-squared (-> this root trans) (target-pos 0))) - (f1-2 32768.0) - ) - (>= f0-2 (* f1-2 f1-2)) - ) + (>= (vector-vector-distance-squared (-> this root trans) (target-pos 0)) (square 32768.0)) ) (go-die this) ) @@ -995,23 +991,18 @@ (s4-0 (new 'stack-no-clear 'vector)) ) (vector-! s4-0 v1-3 (-> this root trans)) - (let* ((f30-0 (vector-length-squared s4-0)) - (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 (vector-length-squared s4-0)) + (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)) ) ) @@ -1038,10 +1029,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-time-frame self (seconds 1) (seconds 1.2)))) ) diff --git a/goal_src/jak3/levels/city/traffic/citizen/metalhead-predator.gc b/goal_src/jak3/levels/city/traffic/citizen/metalhead-predator.gc index 684a2baac2..7e1b55df47 100644 --- a/goal_src/jak3/levels/city/traffic/citizen/metalhead-predator.gc +++ b/goal_src/jak3/levels/city/traffic/citizen/metalhead-predator.gc @@ -666,7 +666,6 @@ ) (defmethod metalhead-predator-method-225 ((this metalhead-predator) (arg0 int) (arg1 float)) - (local-vars (sv-272 vector) (sv-288 vector)) (rlet ((acc :class vf) (vf0 :class vf) (vf4 :class vf) @@ -701,23 +700,22 @@ (when s3-0 (seek! (-> this miss-amount) (* 0.2 (vector-length (-> s3-0 root transv))) 4096.0) (vector-copy! s2-0 (get-trans s3-0 3)) - (set! sv-272 (new 'stack-no-clear 'vector)) - (let ((v1-28 (-> s5-0 pos)) - (a0-19 s2-0) - ) - (.lvf vf4 (&-> v1-28 quad)) - (.lvf vf5 (&-> a0-19 quad)) - ) - (.mov.vf.w vf6 vf0) - (.sub.vf.xyz vf6 vf4 vf5) - (.svf (&-> sv-272 quad) vf6) - (let* ((f0-5 (vector-length sv-272)) - (f0-6 (/ f0-5 (meters 130))) - ) - (set! sv-288 (new 'stack-no-clear 'vector)) - (let ((s0-0 (new 'stack-no-clear 'vector)) - (s1-1 (new 'stack-no-clear 'vector)) + (let ((sv-272 (new 'stack-no-clear 'vector))) + (let ((v1-28 (-> s5-0 pos)) + (a0-19 s2-0) ) + (.lvf vf4 (&-> v1-28 quad)) + (.lvf vf5 (&-> a0-19 quad)) + ) + (.mov.vf.w vf6 vf0) + (.sub.vf.xyz vf6 vf4 vf5) + (.svf (&-> sv-272 quad) vf6) + (let* ((f0-5 (vector-length sv-272)) + (f0-6 (/ f0-5 (meters 130))) + (sv-288 (new 'stack-no-clear 'vector)) + (s0-0 (new 'stack-no-clear 'vector)) + (s1-1 (new 'stack-no-clear 'vector)) + ) (vector+*! s2-0 s2-0 (-> s3-0 root transv) f0-6) (vector-normalize! sv-272 1.0) (vector-flatten! sv-288 *up-vector* sv-272) @@ -727,11 +725,7 @@ (let ((a2-4 (quaternion-vector-angle! (new 'stack-no-clear 'quaternion) sv-272 (-> this shoot-angle)))) (vector-orient-by-quat! sv-288 sv-288 a2-4) ) - (let* ((t9-9 quaternion-vector-angle!) - (a0-29 (new 'stack-no-clear 'quaternion)) - (a2-5 (-> this shoot-angle)) - (a2-6 (t9-9 a0-29 sv-272 a2-5)) - ) + (let ((a2-6 (quaternion-vector-angle! (new 'stack-no-clear 'quaternion) sv-272 (-> this shoot-angle)))) (vector-orient-by-quat! s0-0 s0-0 a2-6) ) (let ((a0-31 s1-1)) diff --git a/goal_src/jak3/levels/city/traffic/traffic-engine.gc b/goal_src/jak3/levels/city/traffic/traffic-engine.gc index 8e49f25fa3..1c325ea39e 100644 --- a/goal_src/jak3/levels/city/traffic/traffic-engine.gc +++ b/goal_src/jak3/levels/city/traffic/traffic-engine.gc @@ -253,14 +253,14 @@ ;; WARN: Function (method 21 traffic-tracker) has a return type of none, but the expression builder found a return statement. (defmethod activate-from-params ((this traffic-tracker) (arg0 traffic-object-spawn-params)) - (local-vars (sv-16 handle)) (let ((gp-0 (-> arg0 object-type))) (b! (logtest? (process-mask enemy guard) (-> *kernel-context* prevent-from-run)) cfg-21 :delay (nop!)) (set! (-> arg0 proc) #f) (let ((v1-5 (-> this traffic object-type-info-array gp-0))) (when (and (> (-> v1-5 inactive-count) 0) (> (-> v1-5 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 (when (= gp-0 (traffic-type formation)) (when (not (rigid-body-object-method-30 (the-as vehicle s3-0))) @@ -352,12 +352,12 @@ ) (defmethod activate-by-handle ((this traffic-tracker) (arg0 traffic-object-spawn-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)) @@ -999,10 +999,8 @@ 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-6 f0-6) (vector-length-squared v1-19)) + (not (and (logtest? (focus-status pilot) s3-0) (let ((v1-19 (-> s4-0 0 bbox max))) + (< (square 40960.0) (vector-length-squared v1-19)) ) ) ) @@ -1013,10 +1011,8 @@ ) ((logtest? (focus-status dangerous flut 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) - ) - (if (< (* f0-11 f0-11) (vector-length-squared (the-as vector v1-31))) + (let ((v1-31 (-> s4-0 0))) + (if (< (square 20480.0) (vector-length-squared (the-as vector v1-31))) (set! f30-0 20480.0) ) ) @@ -1174,7 +1170,6 @@ ;; WARN: Function (method 52 traffic-engine) has a return type of none, but the expression builder found a return statement. (defmethod update-traffic-amount ((this traffic-engine)) - (local-vars (sv-48 int) (sv-64 nav-segment)) (if (not (-> this allow-spawning?)) (return 0) ) @@ -1277,22 +1272,24 @@ (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 (and (not (logtest? (-> s4-2 city-info cell-array (-> sv-64 from-cell-id) flags) (ash 1 s3-3))) - (< (-> sv-64 branch density) (the-as uint 128)) - ) - (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 (and (not (logtest? (-> s4-2 city-info cell-array (-> sv-64 from-cell-id) flags) (ash 1 s3-3))) + (< (-> sv-64 branch density) (the-as uint 128)) + ) + (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)) ) ) ) diff --git a/goal_src/jak3/levels/city/traffic/vehicle/vehicle-control.gc b/goal_src/jak3/levels/city/traffic/vehicle/vehicle-control.gc index 859a87cbbd..a0ebb5d80f 100644 --- a/goal_src/jak3/levels/city/traffic/vehicle/vehicle-control.gc +++ b/goal_src/jak3/levels/city/traffic/vehicle/vehicle-control.gc @@ -246,13 +246,10 @@ (if (logtest? (-> this flags) (vehicle-controller-flag left-turn)) (vector-float*! (-> s4-0 1) (-> s4-0 1) -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))) (vector-copy! arg1 arg0) (vector+*! arg1 arg1 (-> s4-0 0) f1-9) ) diff --git a/goal_src/jak3/levels/city/traffic/vehicle/vehicle-effects.gc b/goal_src/jak3/levels/city/traffic/vehicle/vehicle-effects.gc index ea264af6c5..6db96f5756 100644 --- a/goal_src/jak3/levels/city/traffic/vehicle/vehicle-effects.gc +++ b/goal_src/jak3/levels/city/traffic/vehicle/vehicle-effects.gc @@ -103,7 +103,6 @@ (init! *vehicle-particle-common-info*) (defmethod vehicle-method-78 ((this vehicle)) - (local-vars (sv-224 sparticle-launcher) (sv-228 sparticle-launcher)) (let ((a1-0 (-> this clock)) (a0-1 (-> this traffic-priority-id)) ) @@ -167,20 +166,16 @@ (set! (-> s5-0 glow color y) (rand-vu-float-range 192.0 255.0)) (set! (-> s5-0 glow color w) (* (-> s5-0 float1) (rand-vu-float-range 16.0 18.0))) (add! *simple-sprite-system* (-> s5-0 glow)) - (let ((f0-22 (-> this camera-dist2)) - (f1-7 245760.0) - ) - (when (< f0-22 (* f1-7 f1-7)) - (let ((f0-23 3276.8)) - (set! (-> s5-0 glow position w) f0-23) - (set! (-> s5-0 glow size-y) f0-23) - ) - (set! (-> s5-0 glow fade-a) -0.00001356) - (set! (-> s5-0 glow fade-b) 2.3332994) - (set! (-> s5-0 glow color z) (rand-vu-float-range 128.0 160.0)) - (set! (-> s5-0 glow color w) (* (-> s5-0 float1) (rand-vu-float-range 32.0 36.0))) - (add! *simple-sprite-system* (-> s5-0 glow)) + (when (< (-> this camera-dist2) (square 245760.0)) + (let ((f0-23 3276.8)) + (set! (-> s5-0 glow position w) f0-23) + (set! (-> s5-0 glow size-y) f0-23) ) + (set! (-> s5-0 glow fade-a) -0.00001356) + (set! (-> s5-0 glow fade-b) 2.3332994) + (set! (-> s5-0 glow color z) (rand-vu-float-range 128.0 160.0)) + (set! (-> s5-0 glow color w) (* (-> s5-0 float1) (rand-vu-float-range 32.0 36.0))) + (add! *simple-sprite-system* (-> s5-0 glow)) ) ) (quad-copy! @@ -209,10 +204,7 @@ (set! (-> *part-id-table* 923 init-specs 2 initial-valuef) (* 6.0 (+ 0.25 (-> this engine-power-factor)) (rand-vu)) ) - (let* ((f0-39 1.0) - (f1-12 (-> this engine-power-factor)) - (f0-40 (- f0-39 (* f1-12 f1-12))) - ) + (let ((f0-40 (- 1.0 (square (-> this engine-power-factor))))) (set! (-> *part-id-table* 923 init-specs 9 initial-valuef) (* 16.0 f0-40)) (set! (-> *part-id-table* 923 init-specs 9 random-rangef) (* 48.0 f0-40)) ) @@ -254,60 +246,65 @@ (set! (-> s5-0 vec3 y) f28-2) (set! (-> s5-0 vec3 z) (* f30-10 f26-0)) ) - (set! sv-224 (the-as sparticle-launcher #f)) - (set! sv-228 (the-as sparticle-launcher #f)) - (cond - ((< (-> this hit-points) 0.25) - (set! sv-224 (-> *part-id-table* 925)) - (set! sv-228 (-> *part-id-table* 921)) - ) - ((< (-> this hit-points) 0.5) - (set! sv-224 (-> *part-id-table* 928)) - ) - (else - (if (< (rand-vu) 0.05) - (set! sv-224 (-> *part-id-table* 930)) - ) - ) - ) - (when sv-224 - (set! (-> s5-0 byte0) 0) - (dotimes (s4-3 2) - (vector-matrix*! (-> s5-0 vec0) (-> this info particles smoke-local-pos s4-3) (-> s5-0 mat0)) - (vector-rotate*! (-> s5-0 vec2) (-> this info particles smoke-local-vel s4-3) (-> s5-0 mat0)) - (vector+! (-> s5-0 vec2) (-> s5-0 vec2) (-> this rbody lin-velocity)) - (vector+float*! (-> s5-0 vec2) (-> s5-0 vec2) (-> s5-0 vec3) (* 24576.0 (rand-vu))) - (let ((v1-155 (-> this info particle-common part-vel)) - (a0-50 (-> s5-0 vec2)) - (f0-63 300.0) - ) - (vector-float*! v1-155 a0-50 (/ 1.0 f0-63)) + (let ((sv-224 (the-as sparticle-launcher #f)) + (sv-228 (the-as sparticle-launcher #f)) ) - (when (and sv-228 (< (rand-vu) 0.005)) - (let ((t9-35 sp-launch-particles-var) - (a0-51 (-> this info particle-common sp-system2d)) - (a1-43 sv-228) - (a2-12 *launch-matrix*) + (set! sv-224 (cond + ((< (-> this hit-points) 0.25) + (set! sv-224 (-> *part-id-table* 925)) + (set! sv-228 (-> *part-id-table* 921)) + sv-224 + ) + ((< (-> this hit-points) 0.5) + (-> *part-id-table* 928) + ) + (else + (if (< (rand-vu) 0.05) + (set! sv-224 (-> *part-id-table* 930)) + ) + sv-224 + ) + ) + ) + (when sv-224 + (set! (-> s5-0 byte0) 0) + (dotimes (s4-3 2) + (vector-matrix*! (-> s5-0 vec0) (-> this info particles smoke-local-pos s4-3) (-> s5-0 mat0)) + (vector-rotate*! (-> s5-0 vec2) (-> this info particles smoke-local-vel s4-3) (-> s5-0 mat0)) + (vector+! (-> s5-0 vec2) (-> s5-0 vec2) (-> this rbody lin-velocity)) + (vector+float*! (-> s5-0 vec2) (-> s5-0 vec2) (-> s5-0 vec3) (* 24576.0 (rand-vu))) + (let ((v1-155 (-> this info particle-common part-vel)) + (a0-50 (-> s5-0 vec2)) + (f0-63 300.0) ) - (vector-copy! (-> a2-12 trans) (-> s5-0 vec0)) - (t9-35 a0-51 a1-43 a2-12 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0) + (vector-float*! v1-155 a0-50 (/ 1.0 f0-63)) ) - (+! (-> s5-0 byte0) 1) - ) - (set! (-> sv-224 birthaccum) (the-as float (-> this smoke-part-accum s4-3))) - (let ((t9-36 sp-launch-particles-var) - (a0-52 (-> this info particle-common sp-system2d)) - (a1-44 sv-224) - (a2-13 *launch-matrix*) + (when (and sv-228 (< (rand-vu) 0.005)) + (let ((t9-35 sp-launch-particles-var) + (a0-51 (-> this info particle-common sp-system2d)) + (a1-43 sv-228) + (a2-12 *launch-matrix*) + ) + (vector-copy! (-> a2-12 trans) (-> s5-0 vec0)) + (t9-35 a0-51 a1-43 a2-12 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0) ) - (vector-copy! (-> a2-13 trans) (-> s5-0 vec0)) - (t9-36 a0-52 a1-44 a2-13 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0) + (+! (-> s5-0 byte0) 1) + ) + (set! (-> sv-224 birthaccum) (the-as float (-> this smoke-part-accum s4-3))) + (let ((t9-36 sp-launch-particles-var) + (a0-52 (-> this info particle-common sp-system2d)) + (a1-44 sv-224) + (a2-13 *launch-matrix*) + ) + (vector-copy! (-> a2-13 trans) (-> s5-0 vec0)) + (t9-36 a0-52 a1-44 a2-13 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0) + ) + (set! (-> this smoke-part-accum s4-3) (the-as sparticle-launch-control (-> sv-224 birthaccum))) ) - (set! (-> this smoke-part-accum s4-3) (the-as sparticle-launch-control (-> sv-224 birthaccum))) + (if (> (-> s5-0 byte0) 0) + (sound-play "damage-zaps" :id (-> this damage-zap-sound-id)) + ) ) - (if (> (-> s5-0 byte0) 0) - (sound-play "damage-zaps" :id (-> this damage-zap-sound-id)) - ) ) ) (when (>= (-> this scrape-sound-envelope) 0.75) diff --git a/goal_src/jak3/levels/city/traffic/vehicle/vehicle-physics.gc b/goal_src/jak3/levels/city/traffic/vehicle/vehicle-physics.gc index 554478deb1..e840c744e4 100644 --- a/goal_src/jak3/levels/city/traffic/vehicle/vehicle-physics.gc +++ b/goal_src/jak3/levels/city/traffic/vehicle/vehicle-physics.gc @@ -21,11 +21,14 @@ ) (set! (-> s5-0 rvec y) (* 0.5 (+ f0-1 f1-3))) (rigid-body-control-method-23 (-> this rbody) (-> s5-0 rvec) (-> s5-0 fvec)) - (let* ((f0-8 - (* 0.025132721 (vector-length (-> s5-0 fvec)) (-> s3-0 handling water-drag-factor) (-> s3-0 info mass) f30-0) - ) - (f1-7 (-> arg0 w)) - (f0-9 (* f0-8 (* f1-7 f1-7))) + (let* ((f0-9 (* 0.025132721 + (vector-length (-> s5-0 fvec)) + (-> s3-0 handling water-drag-factor) + (-> s3-0 info mass) + f30-0 + (square (-> arg0 w)) + ) + ) (f1-10 68719480000.0) (f0-11 (fmin (* f0-9 (/ 1.0 f1-10)) (* 0.125 (/ 1.0 arg1) (-> s3-0 info mass)))) ) diff --git a/goal_src/jak3/levels/city/traffic/vehicle/vehicle-states.gc b/goal_src/jak3/levels/city/traffic/vehicle/vehicle-states.gc index 3a6a72965d..85cbe362b8 100644 --- a/goal_src/jak3/levels/city/traffic/vehicle/vehicle-states.gc +++ b/goal_src/jak3/levels/city/traffic/vehicle/vehicle-states.gc @@ -258,35 +258,28 @@ (let ((v1-7 (new 'stack-no-clear 'array 'uint32 1))) (set! (-> v1-7 0) (the-as uint (current-time))) (if (or (>= (- (-> v1-7 0) (-> self offscreen-time)) (the-as uint 1500)) - (let ((f0-2 409600.0)) - (< (* f0-2 f0-2) (-> self camera-dist2)) - ) + (< (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 flags) (rigid-body-flag enable-physics)) (vehicle-method-117 self) (when (and (logtest? (-> self v-flags) (vehicle-flag disturbed)) (logtest? (-> self v-flags) (vehicle-flag impact))) - (let* ((f0-9 (* 0.0033333334 (the float (- (current-time) (-> self disturbed-time))))) - (f0-12 (* f0-9 f0-9 (-> self camera-dist2))) - (f1-5 0.000016276043) - (f0-13 (* f0-12 (* f1-5 f1-5))) - ) - (if (and (< (vector-length-squared (-> self rbody ang-velocity)) f0-13) - (let ((f1-9 (vector-length-squared (-> self rbody lin-velocity))) - (f2-0 614.4) - ) - (< f1-9 (* f0-13 (* f2-0 f2-0))) + (let ((f0-13 (* (square (* 0.0033333334 (the float (- (current-time) (-> self disturbed-time))))) + (-> self camera-dist2) + (square 0.000016276043) + ) ) + ) + (if (and (< (vector-length-squared (-> self rbody ang-velocity)) f0-13) + (< (vector-length-squared (-> self rbody lin-velocity)) (* f0-13 (square 614.4))) ) (logclear! (-> self v-flags) (vehicle-flag disturbed)) ) diff --git a/goal_src/jak3/levels/city/traffic/vehicle/vehicle-util.gc b/goal_src/jak3/levels/city/traffic/vehicle/vehicle-util.gc index 9113170265..7436eaa5d5 100644 --- a/goal_src/jak3/levels/city/traffic/vehicle/vehicle-util.gc +++ b/goal_src/jak3/levels/city/traffic/vehicle/vehicle-util.gc @@ -187,146 +187,134 @@ ) (defmethod vehicle-method-129 ((this vehicle)) - (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-type0))) - (set! (-> s5-0 floats 4) (+ 8192.0 (-> this root root-prim local-sphere w))) - (if (logtest? (vehicle-flag ai-driving) (-> this v-flags)) - (set! (-> s5-0 floats 4) (* 1.5 (-> s5-0 floats 4))) - ) - (vector-copy! (-> s5-0 mat 0 uvec) (target-pos 0)) - (+! (-> s5-0 mat 0 uvec y) 8192.0) - (matrix-copy! (-> s5-0 mat 1) (-> this node-list data 0 bone transform)) - (vector-copy! (-> s5-0 mat 0 fvec) (-> s5-0 mat 1 trans)) - (set! (-> s5-0 floats 2) (- (-> s5-0 mat 0 uvec y) (-> s5-0 mat 0 fvec y))) - (let ((f0-9 (vector-vector-xz-distance-squared (-> s5-0 mat 0 uvec) (-> s5-0 mat 0 fvec))) - (f1-7 (-> s5-0 floats 4)) + (when (< (-> this player-dist2) (square 102400.0)) + (let ((s5-0 (new 'stack-no-clear 'mystery-vehicle-type0))) + (set! (-> s5-0 floats 4) (+ 8192.0 (-> this root root-prim local-sphere w))) + (if (logtest? (vehicle-flag ai-driving) (-> this v-flags)) + (set! (-> s5-0 floats 4) (* 1.5 (-> s5-0 floats 4))) + ) + (vector-copy! (-> s5-0 mat 0 uvec) (target-pos 0)) + (+! (-> s5-0 mat 0 uvec y) 8192.0) + (matrix-copy! (-> s5-0 mat 1) (-> this node-list data 0 bone transform)) + (vector-copy! (-> s5-0 mat 0 fvec) (-> s5-0 mat 1 trans)) + (set! (-> s5-0 floats 2) (- (-> s5-0 mat 0 uvec y) (-> s5-0 mat 0 fvec y))) + (when (and (< (vector-vector-xz-distance-squared (-> s5-0 mat 0 uvec) (-> s5-0 mat 0 fvec)) (square (-> s5-0 floats 4))) + (< -81920.0 (-> s5-0 floats 2)) + (and (< (-> s5-0 floats 2) 20480.0) *target* (check-player-get-on this *target*)) + ) + (let ((s2-0 #f) + (s4-1 #f) + (s3-0 #f) ) - (when (and (< f0-9 (* f1-7 f1-7)) - (< -81920.0 (-> s5-0 floats 2)) - (and (< (-> s5-0 floats 2) 20480.0) *target* (check-player-get-on this *target*)) - ) - (let ((s2-0 #f) - (s4-1 #f) - (s3-0 #f) - ) - (let ((a2-2 (get-best-seat this (-> s5-0 mat 0 uvec) (vehicle-seat-flag vsf0) 0))) - (when (!= a2-2 -1) - (vehicle-method-66 this (-> s5-0 mat 0 fvec) a2-2) - (vector+float*! (-> s5-0 mat 0 fvec) (-> s5-0 mat 0 fvec) (-> s5-0 mat 1 uvec) 4096.0) - ) - ) - (set! (-> s5-0 floats 1) (vector-vector-distance-squared (-> s5-0 mat 0 fvec) (-> s5-0 mat 0 uvec))) - (let ((f0-14 (-> s5-0 floats 1)) - (f1-12 81920.0) + (let ((a2-2 (get-best-seat this (-> s5-0 mat 0 uvec) (vehicle-seat-flag vsf0) 0))) + (when (!= a2-2 -1) + (vehicle-method-66 this (-> s5-0 mat 0 fvec) a2-2) + (vector+float*! (-> s5-0 mat 0 fvec) (-> s5-0 mat 0 fvec) (-> s5-0 mat 1 uvec) 4096.0) + ) + ) + (set! (-> s5-0 floats 1) (vector-vector-distance-squared (-> s5-0 mat 0 fvec) (-> s5-0 mat 0 uvec))) + (when (< (-> s5-0 floats 1) (square 81920.0)) + (vector-copy! (-> s5-0 cquery start-pos) (-> s5-0 mat 0 uvec)) + (vector-! (-> s5-0 cquery move-dist) (-> s5-0 mat 0 fvec) (-> s5-0 mat 0 uvec)) + (let ((v1-38 (-> s5-0 cquery))) + (set! (-> v1-38 radius) 4096.0) + (set! (-> v1-38 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 + shield + ) ) - (when (< f0-14 (* f1-12 f1-12)) - (vector-copy! (-> s5-0 cquery start-pos) (-> s5-0 mat 0 uvec)) - (vector-! (-> s5-0 cquery move-dist) (-> s5-0 mat 0 fvec) (-> s5-0 mat 0 uvec)) - (let ((v1-38 (-> s5-0 cquery))) - (set! (-> v1-38 radius) 4096.0) - (set! (-> v1-38 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 - shield - ) - ) - (set! (-> v1-38 ignore-process0) this) - (set! (-> v1-38 ignore-process1) #f) - (set! (-> v1-38 ignore-pat) - (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) - ) - (set! (-> v1-38 action-mask) (collide-action solid)) + (set! (-> v1-38 ignore-process0) this) + (set! (-> v1-38 ignore-process1) #f) + (set! (-> v1-38 ignore-pat) + (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) ) - (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 v-flags) (vehicle-flag player-edge-grabbing))) - (not (logtest? (vehicle-flag no-hijack gun-dark-2-zero-g) (-> this v-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 mat 2) (-> s5-0 mat 1)) - (vector-matrix*! (-> s5-0 mat 0 rvec) (-> s5-0 mat 0 uvec) (-> s5-0 mat 2)) - (set! (-> s5-0 floats 0) 81920.0) - (dotimes (s2-1 (-> this info rider grab-rail-count)) - (let ((s1-0 (-> this info rider grab-rail-array s2-1))) - (vector-! (-> s5-0 mat 0 trans) (-> s5-0 mat 0 rvec) (-> s1-0 local-pos 0)) - (when #t - (let ((f30-0 (vector-segment-distance-point! - (-> s5-0 mat 0 rvec) - (-> s1-0 local-pos 0) - (-> s1-0 local-pos 1) - (-> s5-0 mat 0 trans) - ) - ) - ) - (when (< f30-0 (-> s5-0 floats 0)) - (set! (-> s5-0 floats 0) f30-0) - (set! (-> s5-0 vec 0 quad) (-> s5-0 mat 0 trans quad)) - (vector-! (-> s5-0 vec 1) (-> s1-0 local-pos 1) (-> s1-0 local-pos 0)) - (vector-normalize! (-> s5-0 vec 1) 1.0) - (set! s3-0 #t) - (set! (-> s5-0 floats 3) (* (-> this hit-points) (/ 40960.0 f30-0))) - ) + (set! (-> v1-38 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 v-flags) (vehicle-flag player-edge-grabbing))) + (not (logtest? (vehicle-flag no-hijack gun-dark-2-zero-g) (-> this v-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 mat 2) (-> s5-0 mat 1)) + (vector-matrix*! (-> s5-0 mat 0 rvec) (-> s5-0 mat 0 uvec) (-> s5-0 mat 2)) + (set! (-> s5-0 floats 0) 81920.0) + (dotimes (s2-1 (-> this info rider grab-rail-count)) + (let ((s1-0 (-> this info rider grab-rail-array s2-1))) + (vector-! (-> s5-0 mat 0 trans) (-> s5-0 mat 0 rvec) (-> s1-0 local-pos 0)) + (when #t + (let ((f30-0 (vector-segment-distance-point! + (-> s5-0 mat 0 rvec) + (-> s1-0 local-pos 0) + (-> s1-0 local-pos 1) + (-> s5-0 mat 0 trans) + ) + ) ) + (when (< f30-0 (-> s5-0 floats 0)) + (set! (-> s5-0 floats 0) f30-0) + (set! (-> s5-0 vec 0 quad) (-> s5-0 mat 0 trans quad)) + (vector-! (-> s5-0 vec 1) (-> s1-0 local-pos 1) (-> s1-0 local-pos 0)) + (vector-normalize! (-> s5-0 vec 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 "vehicle" (/ 1.0 (-> s5-0 floats 3))) - ) - ) - (cond - ((vehicle-method-128 this) - (vehicle-method-144 this) - (when (cpad-pressed? 0 triangle) - (cond - (s4-1 - (when (send-event *target* 'change-mode 'pilot this 0 #f) - (logior! (-> this v-flags) (vehicle-flag player-driving)) - (logclear! (-> this v-flags) (vehicle-flag ai-driving)) - (vehicle-method-80 this) - ) - ) - (else - (set! (-> s5-0 proc 0) (process->handle this)) - (mem-copy! (the-as pointer *pilot-edge-grab-info*) (the-as pointer (-> s5-0 vec)) 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)~%") - ) - ) + 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 "vehicle" (/ 1.0 (-> s5-0 floats 3))) + ) + ) + (cond + ((vehicle-method-128 this) + (vehicle-method-144 this) + (when (cpad-pressed? 0 triangle) + (cond + (s4-1 + (when (send-event *target* 'change-mode 'pilot this 0 #f) + (logior! (-> this v-flags) (vehicle-flag player-driving)) + (logclear! (-> this v-flags) (vehicle-flag ai-driving)) + (vehicle-method-80 this) ) ) + (else + (set! (-> s5-0 proc 0) (process->handle this)) + (mem-copy! (the-as pointer *pilot-edge-grab-info*) (the-as pointer (-> s5-0 vec)) 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)~%") + ) + ) ) - (else - (vehicle-method-145 this) - ) - ) + ) + ) + (else + (vehicle-method-145 this) ) ) ) @@ -1118,16 +1106,9 @@ (defmethod vehicle-method-103 ((this vehicle)) (when (time-elapsed? (-> this disturbed-time) (seconds 2)) - (let* ((f0-0 (-> this camera-dist2)) - (f1-0 0.000024414063) - (f0-1 (* f0-0 (* f1-0 f1-0))) - ) + (let ((f0-1 (* (-> this camera-dist2) (square 0.000024414063)))) (when (and (< (vector-length-squared (-> this rbody ang-velocity)) f0-1) - (let ((f1-4 (vector-length-squared (-> this rbody lin-velocity))) - (f2-0 614.4) - ) - (< f1-4 (* f0-1 (* f2-0 f2-0))) - ) + (< (vector-length-squared (-> this rbody lin-velocity)) (* f0-1 (square 614.4))) ) (logclear! (-> this v-flags) (vehicle-flag disturbed)) (vehicle-method-142 this) diff --git a/goal_src/jak3/levels/city/traffic/vehicle/vehicle.gc b/goal_src/jak3/levels/city/traffic/vehicle/vehicle.gc index 7e719ff766..d859f37f5c 100644 --- a/goal_src/jak3/levels/city/traffic/vehicle/vehicle.gc +++ b/goal_src/jak3/levels/city/traffic/vehicle/vehicle.gc @@ -154,10 +154,8 @@ (-> arg0 normal) (- (vector-dot (-> arg0 velocity) (-> arg0 normal))) ) - (let ((f0-30 (vector-length-squared a0-39)) - (f1-18 12288.0) - ) - (when (< (* f1-18 f1-18) f0-30) + (let ((f0-30 (vector-length-squared a0-39))) + (when (< (square 12288.0) f0-30) (set! (-> this scrape-sound-envelope) 1.0) (if (logtest? (vehicle-flag player-driving) (-> this v-flags)) (cpad-set-buzz! (-> *cpad-list* cpads 0) 0 255 (seconds 0.05)) @@ -275,9 +273,7 @@ ) (let ((f1-6 0.0)) (when (logtest? (vehicle-flag ignition) (-> this v-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 v-flags) (vehicle-flag riding))) (set! f1-6 (/ f1-6 2)) ) @@ -784,27 +780,18 @@ :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-109 this) - ) - ) + (b! (>= (square 819200.0) f0-3) cfg-8) + (if (< (square 819200.0) f0-3) + (vehicle-method-109 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-109 this) ) ) diff --git a/goal_src/jak3/levels/city/vinroom/power-game.gc b/goal_src/jak3/levels/city/vinroom/power-game.gc index 73d23ee5f9..20ac37c61f 100644 --- a/goal_src/jak3/levels/city/vinroom/power-game.gc +++ b/goal_src/jak3/levels/city/vinroom/power-game.gc @@ -1627,7 +1627,6 @@ ) (defmethod power-game-method-44 ((this power-game) (arg0 float) (arg1 float) (arg2 int) (arg3 int)) - (local-vars (sv-128 int) (sv-144 vector)) (the int arg0) (the int arg1) (let ((s3-0 (new 'stack-no-clear 'vector))) @@ -1654,18 +1653,14 @@ (vector+! s3-0 s3-0 (power-game-method-38 this (new 'stack-no-clear 'vector) arg2)) ) ) - (let ((s1-3 add-debug-line) - (s0-6 #t) - ) - (set! sv-128 577) - (set! sv-144 (get-center-pos! this (new 'stack-no-clear 'vector) (-> s2-0 x) (-> s2-0 z))) - (let ((a3-6 (get-center-pos! this (new 'stack-no-clear 'vector) (-> s3-0 x) (-> s3-0 z))) - (t0-1 (the-as uint #x800000ff)) - (t1-0 #f) - (t2-0 -1) - ) - (s1-3 s0-6 (the-as bucket-id sv-128) sv-144 a3-6 (the-as rgba t0-1) t1-0 (the-as rgba t2-0)) - ) + (add-debug-line + #t + (bucket-id debug-no-zbuf1) + (get-center-pos! this (new 'stack-no-clear 'vector) (-> s2-0 x) (-> s2-0 z)) + (get-center-pos! this (new 'stack-no-clear 'vector) (-> s3-0 x) (-> s3-0 z)) + (new 'static 'rgba :r #xff :a #x80) + #f + (the-as rgba -1) ) (vector-copy! s2-0 s3-0) (+! arg3 -1) @@ -1687,15 +1682,14 @@ ) (defmethod update-cam ((this power-game)) - (local-vars (sv-48 vector) (sv-52 vector) (sv-56 power-game-cam-info)) (let ((s4-0 (the-as power-game-player (handle->process (-> this player))))) (when s4-0 - (let ((s5-0 (get-trans s4-0 9)) - (s4-1 (the int (-> (get-trans s4-0 2) x))) - ) - (set! sv-48 (vector-! (new 'stack-no-clear 'vector) s5-0 (new 'static 'vector :x 8.0 :z 7.0 :w 1.0))) - (set! sv-52 (get-center-pos! this (new 'stack-no-clear 'vector) (-> s5-0 x) (-> s5-0 z))) - (set! sv-56 (-> this cam-targ)) + (let* ((s5-0 (get-trans s4-0 9)) + (s4-1 (the int (-> (get-trans s4-0 2) x))) + (sv-48 (vector-! (new 'stack-no-clear 'vector) s5-0 (new 'static 'vector :x 8.0 :z 7.0 :w 1.0))) + (sv-52 (get-center-pos! this (new 'stack-no-clear 'vector) (-> s5-0 x) (-> s5-0 z))) + (sv-56 (-> this cam-targ)) + ) (* 16384.0 (the float (logand (- 6 (power-game-method-34 this (-> s5-0 x) (-> s5-0 z))) 3))) (let ((f30-1 (if (cpad-hold? 0 x) 131072.0 diff --git a/goal_src/jak3/levels/city/vinroom/vinroom-part.gc b/goal_src/jak3/levels/city/vinroom/vinroom-part.gc index 3c0ae8d397..561736052d 100644 --- a/goal_src/jak3/levels/city/vinroom/vinroom-part.gc +++ b/goal_src/jak3/levels/city/vinroom/vinroom-part.gc @@ -2076,7 +2076,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/goal_src/jak3/levels/comb/comb-field.gc b/goal_src/jak3/levels/comb/comb-field.gc index 606331473a..8617b2c990 100644 --- a/goal_src/jak3/levels/comb/comb-field.gc +++ b/goal_src/jak3/levels/comb/comb-field.gc @@ -50,21 +50,17 @@ (defmethod play-hum ((this comb-field)) (let ((v1-0 *target*)) (when v1-0 - (let ((f0-0 (vector-vector-distance-squared (-> this root trans) (-> v1-0 control trans))) - (f1-0 655360.0) - ) - (cond - ((< f0-0 (* f1-0 f1-0)) - (if (zero? (-> this hum-sound-id)) - (set! (-> this hum-sound-id) (new-sound-id)) - ) - (sound-play "barrier-loop" :id (-> this hum-sound-id)) - ) - (else - (sound-stop (-> this hum-sound-id)) - (set! (-> this hum-sound-id) (new 'static 'sound-id)) - 0 - ) + (cond + ((< (vector-vector-distance-squared (-> this root trans) (-> v1-0 control trans)) (square 655360.0)) + (if (zero? (-> this hum-sound-id)) + (set! (-> this hum-sound-id) (new-sound-id)) + ) + (sound-play "barrier-loop" :id (-> this hum-sound-id)) + ) + (else + (sound-stop (-> this hum-sound-id)) + (set! (-> this hum-sound-id) (new 'static 'sound-id)) + 0 ) ) ) @@ -251,16 +247,12 @@ (matrix->quaternion (-> s1-0 quat) s2-2) (set! (-> this plane quad) (-> s2-2 fvec quad)) (set! (-> this plane w) (- (vector-dot (-> s2-2 fvec) (-> this root trans)))) - (let ((v0-8 (-> this root root-prim local-sphere))) - (set! (-> v0-8 x) 0.0) - (set! (-> v0-8 y) (* 0.00024414062 (/ arg1 2))) - (set! (-> v0-8 z) 0.0) - (let ((f0-18 0.5) - (f1-5 (* f30-1 f30-1)) - (f2-1 arg1) - ) - (set! (-> v0-8 w) (* f0-18 (sqrtf (+ f1-5 (* f2-1 f2-1))))) - ) + (set-vector! + (-> this root root-prim local-sphere) + 0.0 + (* 0.00024414062 (/ arg1 2)) + 0.0 + (* 0.5 (sqrtf (+ (square f30-1) (square arg1)))) ) ) ) diff --git a/goal_src/jak3/levels/comb/comb-sentry.gc b/goal_src/jak3/levels/comb/comb-sentry.gc index 8cd19cc2da..40e4268866 100644 --- a/goal_src/jak3/levels/comb/comb-sentry.gc +++ b/goal_src/jak3/levels/comb/comb-sentry.gc @@ -426,11 +426,7 @@ (when s5-0 (if (and (not (focus-test? s5-0 dead)) (not (focus-test? s5-0 ignore)) - (let ((f0-0 (vector-vector-distance-squared (-> s5-0 root trans) (-> this root trans))) - (f1-0 409600.0) - ) - (< f0-0 (* f1-0 f1-0)) - ) + (< (vector-vector-distance-squared (-> s5-0 root trans) (-> this root trans)) (square 409600.0)) ) (set! (-> this should-attack) #t) ) @@ -441,10 +437,8 @@ (vector-copy! (-> v1-23 fvec) (-> s5-0 node-list data 0 bone transform fvec)) (vector-! (-> v1-23 trans) (-> this root trans) (-> v1-23 rvec)) (set! (-> this target-dist) (vector-dot (-> v1-23 fvec) (-> v1-23 trans))) - (let ((v1-24 (-> v1-23 trans)) - (f0-4 409600.0) - ) - (if (< (* f0-4 f0-4) (vector-length-squared v1-24)) + (let ((v1-24 (-> v1-23 trans))) + (if (< (square 409600.0) (vector-length-squared v1-24)) (set! (-> this target-dist) 4096000.0) ) ) diff --git a/goal_src/jak3/levels/comb/h-sled.gc b/goal_src/jak3/levels/comb/h-sled.gc index 1390771458..5d6bf6c375 100644 --- a/goal_src/jak3/levels/comb/h-sled.gc +++ b/goal_src/jak3/levels/comb/h-sled.gc @@ -1253,7 +1253,7 @@ (let ((v1-9 (-> v1-3 ang-velocity)) (f1-2 4.0) ) - (< (vector-length-squared v1-9) (* f1-2 f1-2)) + (< (vector-length-squared v1-9) (square f1-2)) ) ) (set! (-> this v-flags) (the-as vehicle-flag (logior (vehicle-flag overturned) (-> this v-flags)))) diff --git a/goal_src/jak3/levels/common/ai/ashelin/ash-shot.gc b/goal_src/jak3/levels/common/ai/ashelin/ash-shot.gc index 9153b83a0a..a52cd7ec11 100644 --- a/goal_src/jak3/levels/common/ai/ashelin/ash-shot.gc +++ b/goal_src/jak3/levels/common/ai/ashelin/ash-shot.gc @@ -273,7 +273,7 @@ (launch-particles (-> *part-id-table* 901) gp-1) (let ((f0-4 (vector-dot s5-1 (-> (camera-matrix) fvec)))) (when (< 0.0 f0-4) - (let ((f0-5 (* f0-4 f0-4)) + (let ((f0-5 (square f0-4)) (f30-1 (-> *part-id-table* 902 init-specs 8 initial-valuef)) (f28-0 (-> *part-id-table* 902 init-specs 8 random-rangef)) ) diff --git a/goal_src/jak3/levels/common/ai/ashelin/ash.gc b/goal_src/jak3/levels/common/ai/ashelin/ash.gc index dcb1c59c34..360404d230 100644 --- a/goal_src/jak3/levels/common/ai/ashelin/ash.gc +++ b/goal_src/jak3/levels/common/ai/ashelin/ash.gc @@ -1230,7 +1230,6 @@ ) (defmethod ashelin-method-248 ((this ashelin) (arg0 vector) (arg1 float) (arg2 float) (arg3 float) (arg4 float)) - (local-vars (sv-272 vector)) (let* ((v1-0 (-> this nav)) (a0-3 (-> v1-0 state mesh sphere-hash sphere-array)) (a1-1 (-> v1-0 sphere-id-array)) @@ -1250,11 +1249,12 @@ 0 (let ((s0-0 (new 'stack-no-clear 'nav-avoid-spheres-params))) (vector-! (-> s0-0 current-pos) (-> this root trans) (the-as vector (-> 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) (vector-copy! (-> s0-0 pref-dir) (-> s0-0 travel)) (avoid-spheres-1! (-> this nav) s0-0) @@ -1265,11 +1265,7 @@ (let ((t0-2 (new 'stack-no-clear 'clamp-travel-vector-to-mesh-return-info))) (clamp-vector-to-mesh-no-gaps (-> this nav) (-> this root trans) (-> this nav state current-poly) arg0 t0-2) ) - (let ((f0-11 (vector-length-squared arg0)) - (f1-1 arg4) - ) - (>= f0-11 (* f1-1 f1-1)) - ) + (>= (vector-length-squared arg0) (square arg4)) ) ) diff --git a/goal_src/jak3/levels/common/ai/bot-h.gc b/goal_src/jak3/levels/common/ai/bot-h.gc index 287132f46a..0e5c847bf4 100644 --- a/goal_src/jak3/levels/common/ai/bot-h.gc +++ b/goal_src/jak3/levels/common/ai/bot-h.gc @@ -675,50 +675,50 @@ ;; WARN: new jak 2 until loop case, check carefully (defmethod get-next-speech-idx ((this bot-speech-list-shuffle) (arg0 bot) (arg1 (inline-array bot-speech-info)) (arg2 bot-speech-info-flag)) - (local-vars (sv-16 int)) (let ((v1-1 (-> arg0 course retry-cookie))) (when (!= v1-1 (-> this retry-cookie)) (set! (-> this retry-cookie) (-> arg0 course retry-cookie)) (reset-index this #t) ) ) - (set! sv-16 (-> this last-local-index)) - (when (< sv-16 0) - (when (not (logtest? (-> this flags) (bot-speech-list-flag bsl0))) - (logior! (-> this flags) (bot-speech-list-flag bsl0)) - (set! arg2 (logior arg2 (bot-speech-info-flag sf02))) + (let ((sv-16 (-> this last-local-index))) + (when (< sv-16 0) + (when (not (logtest? (-> this flags) (bot-speech-list-flag bsl0))) + (logior! (-> this flags) (bot-speech-list-flag bsl0)) + (set! arg2 (logior arg2 (bot-speech-info-flag sf02))) + ) + (reset-index this #f) ) - (reset-index this #f) - ) - (let ((s2-0 0)) - (if (>= sv-16 0) - (set! s2-0 (ash 1 sv-16)) - ) - (if (logtest? (-> this flags) (bot-speech-list-flag bsl3)) - (set! s2-0 (logior s2-0 (-> this history-mask))) - ) - (until #f - (when (and (= s2-0 (-> this history-mask-full)) (logtest? (-> this flags) (bot-speech-list-flag bsl3))) - (if (not (logtest? (-> this flags) (bot-speech-list-flag bsl1))) - (return -1) + (let ((s2-0 0)) + (if (>= sv-16 0) + (set! s2-0 (ash 1 sv-16)) + ) + (if (logtest? (-> this flags) (bot-speech-list-flag bsl3)) + (set! s2-0 (logior s2-0 (-> this history-mask))) + ) + (until #f + (when (and (= s2-0 (-> this history-mask-full)) (logtest? (-> this flags) (bot-speech-list-flag bsl3))) + (if (not (logtest? (-> this flags) (bot-speech-list-flag bsl1))) + (return -1) + ) + (reset-index this #f) + (if (>= sv-16 0) + (set! s2-0 (ash 1 sv-16)) + (set! s2-0 0) + ) + ) + (let* ((s1-0 (rnd-int-excluding-masked arg0 (-> this speech-indexes length) s2-0)) + (s0-0 (-> this speech-indexes s1-0)) + (v1-47 (-> arg1 s0-0 flags)) + ) + (set! s2-0 (logior s2-0 (ash 1 s1-0))) + (when (and (not (logtest? arg2 v1-47)) + (or (not (logtest? v1-47 (bot-speech-info-flag sf11))) (not (course-speech-playing? arg0 s0-0))) + ) + (set! (-> this last-local-index) s1-0) + (logior! (-> this history-mask) (ash 1 s1-0)) + (return s0-0) ) - (reset-index this #f) - (if (>= sv-16 0) - (set! s2-0 (ash 1 sv-16)) - (set! s2-0 0) - ) - ) - (let* ((s1-0 (rnd-int-excluding-masked arg0 (-> this speech-indexes length) s2-0)) - (s0-0 (-> this speech-indexes s1-0)) - (v1-47 (-> arg1 s0-0 flags)) - ) - (set! s2-0 (logior s2-0 (ash 1 s1-0))) - (when (and (not (logtest? arg2 v1-47)) - (or (not (logtest? v1-47 (bot-speech-info-flag sf11))) (not (course-speech-playing? arg0 s0-0))) - ) - (set! (-> this last-local-index) s1-0) - (logior! (-> this history-mask) (ash 1 s1-0)) - (return s0-0) ) ) ) diff --git a/goal_src/jak3/levels/common/ai/bot.gc b/goal_src/jak3/levels/common/ai/bot.gc index 560765c88b..a1e3b0bb34 100644 --- a/goal_src/jak3/levels/common/ai/bot.gc +++ b/goal_src/jak3/levels/common/ai/bot.gc @@ -81,7 +81,7 @@ (defmethod player-blocking-spot? ((this bot) (arg0 bot-spot)) (let ((f0-0 (-> arg0 blocked-xz-dist))) - (and (!= f0-0 0.0) (>= (* f0-0 f0-0) (vector-vector-xz-distance-squared (target-pos 0) (-> arg0 center)))) + (and (!= f0-0 0.0) (>= (square f0-0) (vector-vector-xz-distance-squared (target-pos 0) (-> arg0 center)))) ) ) @@ -199,14 +199,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)) ) ) ) @@ -240,14 +236,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)) ) ) ) @@ -566,14 +558,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 (+ (-> a1-2 world-sphere w) (-> s3-0 w))) - ) - (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 (+ (-> a1-2 world-sphere w) (-> s3-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)) ) ) ) @@ -607,14 +595,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) (-> s3-0 w))) - ) - (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) (-> s3-0 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)) ) ) ) @@ -1532,9 +1516,8 @@ (when *target* (let ((a1-0 (-> *target* control trans)) (v1-4 (-> this root)) - (f0-0 14336.0) ) - (when (>= (* f0-0 f0-0) (vector-vector-distance-squared (-> v1-4 trans) a1-0)) + (when (>= (square 14336.0) (vector-vector-distance-squared (-> v1-4 trans) a1-0)) (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/goal_src/jak3/levels/common/battle.gc b/goal_src/jak3/levels/common/battle.gc index 60fa27bc59..367a423d6f 100644 --- a/goal_src/jak3/levels/common/battle.gc +++ b/goal_src/jak3/levels/common/battle.gc @@ -571,7 +571,6 @@ ) (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))) ) @@ -613,13 +612,7 @@ (s2-1 #t) (s1-1 577) ) - (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) @@ -648,7 +641,7 @@ (vector-copy! gp-0 (-> arg0 attack-pos)) (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)) @@ -675,14 +668,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)) ) ) ) @@ -716,14 +705,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)) ) ) ) @@ -754,7 +739,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) ) ) @@ -1355,13 +1340,13 @@ ) (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 :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (s1-0 (res-lump-data arg1 'spawn-types pointer :tag-ptr (& sv-16))) + ) (dotimes (s0-0 2) (set! s2-0 0) (when s1-0 @@ -1394,8 +1379,9 @@ ) ) (else - (set! sv-32 (new 'static 'res-tag)) - (let ((v1-18 (res-lump-data arg1 'spawn-percs pointer :tag-ptr (& sv-32)))) + (let* ((sv-32 (new 'static 'res-tag)) + (v1-18 (res-lump-data arg1 'spawn-percs pointer :tag-ptr (& sv-32))) + ) (when v1-18 (let ((a0-16 (min (the-as int (-> sv-32 elt-count)) s4-0)) (a1-14 0) @@ -1490,9 +1476,10 @@ ) (defmethod initialize-enemy-lists ((this battle)) - (local-vars (v0-4 battle-ally-array) (sv-16 res-tag) (sv-32 entity-actor)) - (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)) @@ -1502,33 +1489,34 @@ (s2-0 0) ) (dotimes (s0-0 s4-0) - (set! sv-32 (-> s5-0 data s0-0 actor)) - (when sv-32 - (let ((v0-1 (res-lump-value sv-32 'enemy-options uint128 :time -1000000000.0))) - (cond - ((logtest? #x80000 v0-1) - (+! s1-0 1) - (cond - ((zero? s3-0) - 0 - ) - (else - (let ((a1-2 (-> this spawners data (+ s1-0 -1)))) - (initialize-spawner this a1-2 sv-32) + (let ((sv-32 (-> s5-0 data s0-0 actor))) + (when sv-32 + (let ((v0-1 (res-lump-value sv-32 'enemy-options uint128 :time -1000000000.0))) + (cond + ((logtest? #x80000 v0-1) + (+! s1-0 1) + (cond + ((zero? s3-0) + 0 + ) + (else + (let ((a1-2 (-> this spawners data (+ s1-0 -1)))) + (initialize-spawner this a1-2 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 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 sv-32) + ) ) ) ) diff --git a/goal_src/jak3/levels/common/elec-gate.gc b/goal_src/jak3/levels/common/elec-gate.gc index c56b399d6c..1d067ebf3a 100644 --- a/goal_src/jak3/levels/common/elec-gate.gc +++ b/goal_src/jak3/levels/common/elec-gate.gc @@ -127,7 +127,6 @@ ) (defbehavior elec-gate-post elec-gate () - (local-vars (sv-96 lightning-control) (sv-112 vector)) (let ((gp-0 (-> self params))) (dotimes (s5-0 5) (let* ((s2-0 (-> self l-bolt s5-0)) @@ -147,9 +146,9 @@ (when (-> gp-0 ring-spec) (let ((s1-0 (-> gp-0 ring-spec num-points)) (s0-0 (-> s2-0 ring 0)) + (sv-96 (-> s2-0 ring 1)) + (sv-112 (new 'stack-no-clear 'vector)) ) - (set! sv-96 (-> s2-0 ring 1)) - (set! sv-112 (new 'stack-no-clear 'vector)) (set! (-> sv-112 x) 0.0) (set! (-> sv-112 y) 0.0) (set! (-> sv-112 z) (-> s2-0 ring-radius)) @@ -365,15 +364,6 @@ ) ) :trans (behavior () - (local-vars - (sv-176 lightning-spec) - (sv-192 int) - (sv-208 symbol) - (sv-224 symbol) - (sv-240 int) - (sv-256 symbol) - (sv-272 symbol) - ) (let ((gp-0 *target*)) (when gp-0 (when (not (focus-test? gp-0 disable dead ignore grabbed pilot-riding pilot mech teleporting invulnerable)) @@ -418,63 +408,31 @@ (get-point-at-percent-along-path! (-> self path-r) (new 'stack-no-clear 'vector) (-> s5-1 0 pos) 'interp) ) ) - (let ((s3-0 (get-process *default-dead-pool* lightning-tracker #x4000 0))) - (when s3-0 - (let ((t9-6 (method-of-type lightning-tracker activate))) - (t9-6 (the-as lightning-tracker s3-0) *entity-pool* "lightning-tracker" (the-as pointer #x70004000)) - ) - (let ((s2-0 run-function-in-process) - (s1-0 s3-0) - (s0-0 lightning-tracker-init) - ) - (set! sv-176 (-> self params bolt-spec)) - (set! sv-192 15) - (set! sv-208 (the-as symbol #f)) - (set! sv-224 (the-as symbol #f)) - (let ((t3-0 (get-trans gp-0 3))) - ((the-as (function object object object object object object object object none) s2-0) - s1-0 - s0-0 - sv-176 - sv-192 - sv-208 - sv-224 - s4-2 - t3-0 - ) - ) - ) - (-> s3-0 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 gp-0 3) + :name "lightning-tracker" + :to *entity-pool* + :unk 0 ) - (let ((s4-3 (get-process *default-dead-pool* lightning-tracker #x4000 0))) - (when s4-3 - (let ((t9-10 (method-of-type lightning-tracker activate))) - (t9-10 (the-as lightning-tracker s4-3) *entity-pool* "lightning-tracker" (the-as pointer #x70004000)) - ) - (let ((s3-1 run-function-in-process) - (s2-1 s4-3) - (s1-1 lightning-tracker-init) - (s0-1 (-> self params bolt-spec)) - ) - (set! sv-240 15) - (set! sv-256 (the-as symbol #f)) - (set! sv-272 (the-as symbol #f)) - (let ((t3-1 (get-trans gp-0 3))) - ((the-as (function object object object object object object object object none) s3-1) - s2-1 - s1-1 - s0-1 - sv-240 - sv-256 - sv-272 - s5-2 - t3-1 - ) - ) - ) - (-> s4-3 ppointer) - ) + (process-spawn + lightning-tracker + :init lightning-tracker-init + (-> self params bolt-spec) + 15 + (the-as symbol #f) + (the-as symbol #f) + s5-2 + (get-trans gp-0 3) + :name "lightning-tracker" + :to *entity-pool* + :unk 0 ) ) ) diff --git a/goal_src/jak3/levels/common/enemy/darkprec/dp-bipedal.gc b/goal_src/jak3/levels/common/enemy/darkprec/dp-bipedal.gc index e8bf104951..3fec9e43c8 100644 --- a/goal_src/jak3/levels/common/enemy/darkprec/dp-bipedal.gc +++ b/goal_src/jak3/levels/common/enemy/darkprec/dp-bipedal.gc @@ -1085,45 +1085,48 @@ ) (defun region-check-has-los ((arg0 vector) (arg1 vector) (arg2 float)) - (local-vars (sv-80 vector) (sv-84 vector) (sv-88 vector) (sv-92 vector)) - (set! sv-80 (new 'stack-no-clear 'vector)) - (set! sv-84 (new 'stack-no-clear 'vector)) - (set! sv-88 (new 'stack-no-clear 'vector)) - (set! sv-92 (new 'stack-no-clear 'vector)) - (vector-! sv-92 arg1 arg0) - (vector-normalize! sv-92 1.0) - (let ((f0-1 (+ 2048.0 arg2))) - (vector+float*! sv-84 arg0 sv-92 f0-1) - (vector+float*! sv-88 arg1 sv-92 (- f0-1)) - ) - (vector-average! sv-80 sv-84 sv-88) - (set! (-> sv-80 w) (+ (* 0.5 (vector-vector-distance sv-84 sv-88)) arg2)) - ;; og:preserve-this - (set! (-> (scratchpad-object region-prim-area) region-prim-list num-items) 0) - (set! (-> (scratchpad-object region-prim-area) region-enter-count) 0) - (set! (-> (scratchpad-object region-prim-area) region-exit-count) 0) - (set! (-> (scratchpad-object region-prim-area) region-inside-count) 0) - (set! (-> (scratchpad-object region-prim-area) region-start-count) 0) - (sphere<-vector+r! (the-as sphere (-> (scratchpad-object region-prim-area) pos)) sv-84 0.0) - (sphere<-vector+r! (the-as sphere (-> (scratchpad-object region-prim-area) exit-pos)) sv-88 0.0) - (vector-! (-> (scratchpad-object region-prim-area) ray) sv-88 sv-84) - (vector-! (-> (scratchpad-object region-prim-area) exit-ray) sv-84 sv-88) - (dotimes (s5-1 (-> *level* length)) - (let ((v1-26 (-> *level* level s5-1))) - (when (= (-> v1-26 status) 'active) - (let ((s4-1 (-> v1-26 bsp region-trees))) - (when (nonzero? s4-1) - (let* ((s3-0 (-> s4-1 length)) - (s2-0 0) - (a0-19 (-> s4-1 s2-0)) - ) - (while (< s2-0 s3-0) - (if (= (-> a0-19 name) 'data) - ;; og:preserve-this - (collect-regions a0-19 (the-as sphere sv-80) 0 (-> (scratchpad-object region-prim-area) region-prim-list)) - ) - (+! s2-0 1) - (set! a0-19 (-> s4-1 s2-0)) + (let ((sv-80 (new 'stack-no-clear 'vector))) + (let ((sv-84 (new 'stack-no-clear 'vector)) + (sv-88 (new 'stack-no-clear 'vector)) + ) + (let ((sv-92 (new 'stack-no-clear 'vector))) + (vector-! sv-92 arg1 arg0) + (vector-normalize! sv-92 1.0) + (let ((f0-1 (+ 2048.0 arg2))) + (vector+float*! sv-84 arg0 sv-92 f0-1) + (vector+float*! sv-88 arg1 sv-92 (- f0-1)) + ) + ) + (vector-average! sv-80 sv-84 sv-88) + (set! (-> sv-80 w) (+ (* 0.5 (vector-vector-distance sv-84 sv-88)) arg2)) + ;; og:preserve-this + (set! (-> (scratchpad-object region-prim-area) region-prim-list num-items) 0) + (set! (-> (scratchpad-object region-prim-area) region-enter-count) 0) + (set! (-> (scratchpad-object region-prim-area) region-exit-count) 0) + (set! (-> (scratchpad-object region-prim-area) region-inside-count) 0) + (set! (-> (scratchpad-object region-prim-area) region-start-count) 0) + (sphere<-vector+r! (the-as sphere (-> (scratchpad-object region-prim-area) pos)) sv-84 0.0) + (sphere<-vector+r! (the-as sphere (-> (scratchpad-object region-prim-area) exit-pos)) sv-88 0.0) + (vector-! (-> (scratchpad-object region-prim-area) ray) sv-88 sv-84) + (vector-! (-> (scratchpad-object region-prim-area) exit-ray) sv-84 sv-88) + ) + (dotimes (s5-1 (-> *level* length)) + (let ((v1-26 (-> *level* level s5-1))) + (when (= (-> v1-26 status) 'active) + (let ((s4-1 (-> v1-26 bsp region-trees))) + (when (nonzero? s4-1) + (let* ((s3-0 (-> s4-1 length)) + (s2-0 0) + (a0-19 (-> s4-1 s2-0)) + ) + (while (< s2-0 s3-0) + (if (= (-> a0-19 name) 'data) + ;; og:preserve-this + (collect-regions a0-19 (the-as sphere sv-80) 0 (-> (scratchpad-object region-prim-area) region-prim-list)) + ) + (+! s2-0 1) + (set! a0-19 (-> s4-1 s2-0)) + ) ) ) ) @@ -2527,18 +2530,10 @@ (vector-normalize-copy! (new 'stack-no-clear 'vector) (-> s2-0 1) 1.0) ) ) - (let ((f0-6 1.0) - (f1-1 (-> s2-0 2 y)) - ) - (set! (-> s2-0 2 w) (- f0-6 (* f1-1 f1-1))) - ) + (set! (-> s2-0 2 w) (- 1.0 (square (-> s2-0 2 y)))) (set! (-> s2-0 3 x) (* 2.0 (-> s2-0 2 z) (-> s2-0 2 y) (-> s2-0 2 x))) - (let ((f0-12 (-> s2-0 2 x))) - (set! (-> s2-0 3 y) (- (* f0-12 f0-12))) - ) - (let ((f0-16 (-> s2-0 3 x))) - (set! (-> s2-0 3 z) (- (* f0-16 f0-16) (* 4.0 (-> s2-0 3 y) (-> s2-0 2 w)))) - ) + (set! (-> s2-0 3 y) (- (square (-> s2-0 2 x)))) + (set! (-> s2-0 3 z) (- (square (-> s2-0 3 x)) (* 4.0 (-> s2-0 3 y) (-> s2-0 2 w)))) (cond ((>= (-> s2-0 3 z) 0.0) (let ((f0-22 (- (-> s2-0 3 x))) @@ -2551,7 +2546,7 @@ (set! (-> s2-0 4 x) (/ (-> s2-0 3 w) (+ (fmax 0.0 (vector-dot arg2 (-> s2-0 5))) arg5))) (vector+float*! arg0 (-> s2-0 0) (-> s2-0 1) (-> s2-0 4 x)) (let ((f1-19 (/ (-> s2-0 2 x) arg5))) - (set! (-> arg0 y) (+ 10240.0 (* (/ arg6 4) (* f1-19 f1-19)) (-> arg3 y))) + (set! (-> arg0 y) (+ 10240.0 (* (/ arg6 4) (square f1-19)) (-> arg3 y))) ) #t ) @@ -3078,7 +3073,6 @@ (defmethod init-enemy! ((this dp-bipedal)) "Typical place for shared init code. Runs from entity or process style init." - (local-vars (sv-16 res-tag)) (initialize-skeleton this (the-as skeleton-group (art-group-get-by-name *level* "skel-dp-bipedal" (the-as (pointer level) #f))) @@ -3104,12 +3098,13 @@ (set! (-> this shield-handle) (the-as handle #f)) (vector-reset! (-> this focus-formation-source)) (set! (-> this turret-entity) #f) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-23 (res-lump-data (-> this entity) 'actor-groups pointer :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-23 (res-lump-data (-> this entity) 'actor-groups (pointer actor-group) :tag-ptr (& sv-16))) + ) (cond ((and v1-23 (nonzero? (-> sv-16 elt-count))) (set! (-> this actor-group-count) (the-as int (-> sv-16 elt-count))) - (set! (-> this actor-group) (the-as (pointer actor-group) v1-23)) + (set! (-> this actor-group) v1-23) ) (else (set! (-> this actor-group-count) 0) diff --git a/goal_src/jak3/levels/common/enemy/darkprec/neo-wasp.gc b/goal_src/jak3/levels/common/enemy/darkprec/neo-wasp.gc index 101bc48f6f..19923d3853 100644 --- a/goal_src/jak3/levels/common/enemy/darkprec/neo-wasp.gc +++ b/goal_src/jak3/levels/common/enemy/darkprec/neo-wasp.gc @@ -866,21 +866,24 @@ ) (let ((s5-1 (lambda ((arg0 neo-wasp) (arg1 cspace) (arg2 transformq) (arg3 float) (arg4 float)) - (local-vars (sv-144 vector) (sv-148 matrix) (sv-152 quaternion) (sv-156 quaternion) (sv-160 vector)) - (set! sv-144 (vector<-cspace! (new 'stack-no-clear 'vector) arg1)) - (set! sv-148 (new 'stack-no-clear 'matrix)) - (set! sv-152 (matrix-with-scale->quaternion (new 'stack-no-clear 'quaternion) (-> arg1 bone transform))) - (set! sv-156 (new 'stack-no-clear 'quaternion)) - (let ((v1-3 (new 'stack-no-clear 'vector))) - (vector-copy! v1-3 (-> arg0 root scale)) - (set! sv-160 v1-3) + (let ((sv-144 (vector<-cspace! (new 'stack-no-clear 'vector) arg1)) + (sv-148 (new 'stack-no-clear 'matrix)) + ) + (let ((sv-152 (matrix-with-scale->quaternion (new 'stack-no-clear 'quaternion) (-> arg1 bone transform))) + (sv-156 (new 'stack-no-clear 'quaternion)) + (v1-3 (new 'stack-no-clear 'vector)) + ) + (vector-copy! v1-3 (-> arg0 root scale)) + (let ((sv-160 v1-3)) + (vector-float*! sv-160 sv-160 arg4) + (quaternion-rotate-local-x! sv-156 sv-152 (the-as float arg2)) + (quaternion->matrix sv-148 sv-156) + (scale-matrix! sv-148 sv-160 sv-148) + ) + ) + (vector-copy! (-> sv-148 trans) sv-144) + (spawn-from-mat (-> arg0 engine-part) sv-148) ) - (vector-float*! sv-160 sv-160 arg4) - (quaternion-rotate-local-x! sv-156 sv-152 (the-as float arg2)) - (quaternion->matrix sv-148 sv-156) - (scale-matrix! sv-148 sv-160 sv-148) - (vector-copy! (-> sv-148 trans) sv-144) - (spawn-from-mat (-> arg0 engine-part) sv-148) (none) ) ) @@ -1071,7 +1074,6 @@ (defmethod init-enemy! ((this neo-wasp)) "Typical place for shared init code. Runs from entity or process style init." - (local-vars (sv-16 res-tag) (sv-32 res-tag) (sv-48 res-tag) (sv-64 res-tag)) (when (= (level-status? *level* 'precura #f) 'active) (let ((v1-4 (level-get *level* 'lprenme))) (if (and v1-4 (= (-> v1-4 status) 'active)) @@ -1105,15 +1107,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-38 (res-lump-data (-> this entity) 'actor-groups (pointer actor-group) :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-38 (res-lump-data (-> this entity) 'actor-groups (pointer actor-group) :tag-ptr (& sv-16))) + ) (if (and v1-38 (= (-> sv-16 elt-count) 1)) (set! (-> this entity-group) (-> v1-38 0)) (set! (-> this entity-group) #f) ) ) - (set! sv-32 (new 'static 'res-tag)) - (let ((v1-42 (res-lump-data (-> this entity) 'timeout (pointer float) :tag-ptr (& sv-32)))) + (let* ((sv-32 (new 'static 'res-tag)) + (v1-42 (res-lump-data (-> this entity) 'timeout (pointer float) :tag-ptr (& sv-32))) + ) (cond ((and v1-42 (= (-> sv-32 elt-count) 2)) (set! (-> this attack-wait-min) (-> v1-42 0)) @@ -1130,27 +1134,27 @@ ) (set! (-> this draw force-lod) 1) ) - (let ((f30-0 4096.0)) - (set! sv-48 (new 'static 'res-tag)) - (let ((v1-52 (res-lump-data (-> this entity) 'min-max (pointer float) :tag-ptr (& sv-48)))) - (set! (-> this attack-miss-dist-min) (* f30-0 (if (and v1-52 (> (the-as int (-> sv-48 elt-count)) 0)) - (-> v1-52 0) - -10.0 - ) - ) - ) - ) + (let* ((f30-0 4096.0) + (sv-48 (new 'static 'res-tag)) + (v1-52 (res-lump-data (-> this entity) 'min-max (pointer float) :tag-ptr (& sv-48))) + ) + (set! (-> this attack-miss-dist-min) (* f30-0 (if (and v1-52 (> (the-as int (-> sv-48 elt-count)) 0)) + (-> v1-52 0) + -10.0 + ) + ) + ) ) - (let ((f30-1 4096.0)) - (set! sv-64 (new 'static 'res-tag)) - (let ((v1-56 (res-lump-data (-> this entity) 'min-max (pointer float) :tag-ptr (& sv-64)))) - (set! (-> this attack-miss-dist-max) (* f30-1 (if (and v1-56 (< 1 (the-as int (-> sv-64 elt-count)))) - (-> v1-56 1) - 8.0 - ) - ) - ) - ) + (let* ((f30-1 4096.0) + (sv-64 (new 'static 'res-tag)) + (v1-56 (res-lump-data (-> this entity) 'min-max (pointer float) :tag-ptr (& sv-64))) + ) + (set! (-> this attack-miss-dist-max) (* f30-1 (if (and v1-56 (< 1 (the-as int (-> sv-64 elt-count)))) + (-> v1-56 1) + 8.0 + ) + ) + ) ) (set! (-> this path) (new 'process 'curve-control this 'intro -1000000000.0)) (set! (-> this path-u) 0.0) diff --git a/goal_src/jak3/levels/common/enemy/grunt.gc b/goal_src/jak3/levels/common/enemy/grunt.gc index 3247a7c6c0..e54d5cab8c 100644 --- a/goal_src/jak3/levels/common/enemy/grunt.gc +++ b/goal_src/jak3/levels/common/enemy/grunt.gc @@ -894,11 +894,7 @@ ) ) (zero? (rnd-int this 3)) - (let ((f0-2 (vector-vector-distance-squared (-> this root trans) (target-pos 0))) - (f1-2 32768.0) - ) - (>= f0-2 (* f1-2 f1-2)) - ) + (>= (vector-vector-distance-squared (-> this root trans) (target-pos 0)) (square 32768.0)) ) (go-die this) ) @@ -1204,23 +1200,18 @@ (s4-0 (new 'stack-no-clear 'vector)) ) (vector-! s4-0 v1-3 (-> this root trans)) - (let* ((f30-0 (vector-length-squared s4-0)) - (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 (vector-length-squared s4-0)) + (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)) ) ) @@ -1247,10 +1238,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-time-frame self (seconds 1) (seconds 1.2)))) ) diff --git a/goal_src/jak3/levels/common/enemy/hover/hover-enemy.gc b/goal_src/jak3/levels/common/enemy/hover/hover-enemy.gc index c039e14e42..90abcdd4ff 100644 --- a/goal_src/jak3/levels/common/enemy/hover/hover-enemy.gc +++ b/goal_src/jak3/levels/common/enemy/hover/hover-enemy.gc @@ -300,54 +300,57 @@ ) (defmethod hover-enemy-method-169 ((this hover-enemy)) - (local-vars (sv-592 vector) (sv-596 vector) (sv-600 collide-query) (sv-604 vector) (sv-608 float)) (cond ((and (-> this draw shadow) (logtest? (-> this draw status) (draw-control-status on-screen))) (when (= (logand (-> this hover-id) 15) (logand (-> *display* frame-clock integral-frame-counter) 15)) - (set! sv-592 (new 'stack-no-clear 'vector)) - (set! sv-596 (new 'stack-no-clear 'vector)) - (set! sv-600 (new 'stack-no-clear 'collide-query)) - (set! sv-604 (-> this draw shadow-ctrl settings shadow-dir)) - (set! sv-608 (the-as float 61440.0)) - (vector-copy! (-> sv-600 start-pos) (-> this root trans)) - (vector-normalize-copy! (-> sv-600 move-dist) sv-604 sv-608) - (let ((v1-19 sv-600)) - (set! (-> v1-19 radius) 819.2) - (set! (-> v1-19 collide-with) (collide-spec backgnd)) - (set! (-> v1-19 ignore-process0) this) - (set! (-> v1-19 ignore-process1) #f) - (set! (-> v1-19 ignore-pat) - (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) - ) - (set! (-> v1-19 action-mask) (collide-action solid)) + (let ((sv-592 (new 'stack-no-clear 'vector))) ) - (let ((f0-3 (fill-and-probe-using-line-sphere *collide-cache* sv-600))) - (cond - ((>= f0-3 0.0) - (let ((v1-23 (-> this draw shadow-ctrl))) - (logclear! (-> v1-23 settings flags) (shadow-flags disable-draw)) - ) - 0 - (-> sv-600 best-other-tri intersect) - (let ((a1-3 (-> this root trans))) - (-> a1-3 y) - (let ((f0-4 (* f0-3 sv-608))) - (shadow-control-method-14 - (-> this draw shadow-ctrl) - a1-3 - sv-604 - (- (+ 81920.0 sv-608)) - (+ -12288.0 f0-4) - (+ 12288.0 f0-4) + (let ((sv-596 (new 'stack-no-clear 'vector))) + ) + (let ((sv-600 (new 'stack-no-clear 'collide-query)) + (sv-604 (-> this draw shadow-ctrl settings shadow-dir)) + (sv-608 (the-as float 61440.0)) + ) + (vector-copy! (-> sv-600 start-pos) (-> this root trans)) + (vector-normalize-copy! (-> sv-600 move-dist) sv-604 sv-608) + (let ((v1-19 sv-600)) + (set! (-> v1-19 radius) 819.2) + (set! (-> v1-19 collide-with) (collide-spec backgnd)) + (set! (-> v1-19 ignore-process0) this) + (set! (-> v1-19 ignore-process1) #f) + (set! (-> v1-19 ignore-pat) + (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) + ) + (set! (-> v1-19 action-mask) (collide-action solid)) + ) + (let ((f0-3 (fill-and-probe-using-line-sphere *collide-cache* sv-600))) + (cond + ((>= f0-3 0.0) + (let ((v1-23 (-> this draw shadow-ctrl))) + (logclear! (-> v1-23 settings flags) (shadow-flags disable-draw)) + ) + 0 + (-> sv-600 best-other-tri intersect) + (let ((a1-3 (-> this root trans))) + (-> a1-3 y) + (let ((f0-4 (* f0-3 sv-608))) + (shadow-control-method-14 + (-> this draw shadow-ctrl) + a1-3 + sv-604 + (- (+ 81920.0 sv-608)) + (+ -12288.0 f0-4) + (+ 12288.0 f0-4) + ) ) ) ) - ) - (else - (let ((v1-35 (-> this draw shadow-ctrl))) - (logior! (-> v1-35 settings flags) (shadow-flags disable-draw)) + (else + (let ((v1-35 (-> this draw shadow-ctrl))) + (logior! (-> v1-35 settings flags) (shadow-flags disable-draw)) + ) + 0 ) - 0 ) ) ) diff --git a/goal_src/jak3/levels/common/enemy/hover/hover-formation.gc b/goal_src/jak3/levels/common/enemy/hover/hover-formation.gc index 23ff8577ec..f461e316bc 100644 --- a/goal_src/jak3/levels/common/enemy/hover/hover-formation.gc +++ b/goal_src/jak3/levels/common/enemy/hover/hover-formation.gc @@ -232,7 +232,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) @@ -246,16 +245,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) @@ -716,7 +715,6 @@ (defmethod init-from-entity! ((this hover-formation) (arg0 entity-actor)) "Set up a newly created process from the entity that created it." - (local-vars (sv-32 vector)) (stack-size-set! (-> this main-thread) 32) (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)) @@ -731,25 +729,29 @@ ) ) (s0-0 (res-lump-float (-> this entity) 'notice-dist :default 225280.0)) + (t9-4 (method-of-type res-lump get-property-struct)) + (a0-6 (-> this entity)) + (a1-5 'trans-offset) + (a2-3 'interp) + (a3-2 -1000000000.0) + (t0-2 (new 'stack-no-clear 'vector)) ) - (let ((t9-4 (method-of-type res-lump get-property-struct)) - (a0-6 (-> this entity)) - (a1-5 '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-4 a0-6 a1-5 a2-3 a3-2 t0-2 (the-as (pointer res-tag) #f) *res-static-buf*)) + (res-lump-float (-> this entity) 'formation-rotinc :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 (the-as vector (t9-4 a0-6 a1-5 a2-3 a3-2 t0-2 (the-as (pointer res-tag) #f) *res-static-buf*))) - ) - (let ((t2-4 (res-lump-float (-> this entity) 'formation-rotinc :default 5461.3335)) - (t3-0 #f) - ) - (set! (-> this formation) (s5-0 s4-0 s3-0 s2-0 s1-0 s0-0 sv-32 t2-4 (the-as handle t3-0))) - ) ) (set-time! (-> this formation-timer)) (logclear! (-> this mask) (process-mask actor-pause)) diff --git a/goal_src/jak3/levels/common/enemy/hover/hover-nav-control.gc b/goal_src/jak3/levels/common/enemy/hover/hover-nav-control.gc index 75c68ea409..aadbcc008c 100644 --- a/goal_src/jak3/levels/common/enemy/hover/hover-nav-control.gc +++ b/goal_src/jak3/levels/common/enemy/hover/hover-nav-control.gc @@ -791,7 +791,6 @@ ) (defmethod nav-network-method-27 ((this nav-network) (arg0 vector) (arg1 process) (arg2 vector) (arg3 vector) (arg4 float)) - (local-vars (sv-32 sphere) (sv-36 vector)) (vector-reset! arg0) (let ((s1-0 (process->handle arg1)) (s2-0 0) @@ -800,16 +799,18 @@ (while v1-3 (let ((s0-0 (-> (the-as hover-nav-sphere v1-3) next))) (when (!= (-> (the-as hover-nav-sphere v1-3) handle) s1-0) - (set! sv-32 (-> (the-as hover-nav-sphere v1-3) sphere)) - (set! sv-36 (new 'stack-no-clear 'vector)) - (vector-segment-distance-point! sv-32 arg2 arg3 sv-36) - (when (and (>= (+ arg4 (-> sv-32 r)) (vector-vector-distance sv-32 sv-36)) - (< 0.0 (vector-vector-distance arg2 sv-36)) - ) - (let ((v1-11 (vector-! (new 'stack-no-clear 'vector) (the-as vector sv-32) arg2))) - (vector+! arg0 arg0 v1-11) + (let ((sv-32 (-> (the-as hover-nav-sphere v1-3) sphere)) + (sv-36 (new 'stack-no-clear 'vector)) + ) + (vector-segment-distance-point! sv-32 arg2 arg3 sv-36) + (when (and (>= (+ arg4 (-> sv-32 r)) (vector-vector-distance sv-32 sv-36)) + (< 0.0 (vector-vector-distance arg2 sv-36)) + ) + (let ((v1-11 (vector-! (new 'stack-no-clear 'vector) (the-as vector sv-32) arg2))) + (vector+! arg0 arg0 v1-11) + ) + (+! s2-0 1) ) - (+! s2-0 1) ) ) (set! v1-3 s0-0) @@ -843,7 +844,6 @@ ) (defmethod nav-network-method-33 ((this nav-network) (arg0 vector) (arg1 vector) (arg2 int)) - (local-vars (sv-32 vector)) (let ((s2-0 (-> this network)) (s1-0 (-> this edge)) (f30-0 0.0) @@ -854,14 +854,13 @@ (let* ((v1-6 (-> s1-0 s0-0)) (a1-1 (-> s2-0 (-> v1-6 start-index) pos)) (a2-1 (-> s2-0 (-> v1-6 end-index) pos)) + (sv-32 (new 'stack-no-clear 'vector)) + (f0-0 (vector-segment-distance-point! arg0 a1-1 a2-1 sv-32)) ) - (set! sv-32 (new 'stack-no-clear 'vector)) - (let ((f0-0 (vector-segment-distance-point! arg0 a1-1 a2-1 sv-32))) - (when (or (= gp-0 -1) (< f0-0 f30-0)) - (set! gp-0 s0-0) - (set! f30-0 f0-0) - (vector-copy! arg1 sv-32) - ) + (when (or (= gp-0 -1) (< f0-0 f30-0)) + (set! gp-0 s0-0) + (set! f30-0 f0-0) + (vector-copy! arg1 sv-32) ) ) ) @@ -871,25 +870,19 @@ ) (defmethod nav-network-method-34 ((this nav-network) (arg0 vector) (arg1 vector) (arg2 int)) - (local-vars - (sv-16 (array nav-network-info)) - (sv-20 (array nav-network-edge)) - (sv-24 number) - (sv-32 int) - (sv-64 vector) - ) - (set! sv-16 (-> this network)) - (set! sv-20 (-> this edge)) - (set! sv-24 0.0) - (set! sv-32 -1) - (dotimes (s3-0 (-> sv-20 length)) - (when (logtest? arg2 (ash 1 (-> sv-20 s3-0 sub-graph))) - (let* ((s2-0 (-> sv-20 s3-0)) - (a1-2 (-> sv-16 (-> s2-0 start-index) pos)) - (a2-1 (-> sv-16 (-> s2-0 end-index) pos)) - ) - (set! sv-64 (new 'stack-no-clear 'vector)) - (let ((f0-2 (- (vector-segment-distance-point! arg0 a1-2 a2-1 sv-64) (-> s2-0 radius)))) + (let ((sv-16 (-> this network)) + (sv-20 (-> this edge)) + (sv-24 0.0) + (sv-32 -1) + ) + (dotimes (s3-0 (-> sv-20 length)) + (when (logtest? arg2 (ash 1 (-> sv-20 s3-0 sub-graph))) + (let* ((s2-0 (-> sv-20 s3-0)) + (a1-2 (-> sv-16 (-> s2-0 start-index) pos)) + (a2-1 (-> sv-16 (-> s2-0 end-index) pos)) + (sv-64 (new 'stack-no-clear 'vector)) + (f0-2 (- (vector-segment-distance-point! arg0 a1-2 a2-1 sv-64) (-> s2-0 radius))) + ) (when (or (= sv-32 -1) (< f0-2 (the-as float sv-24))) (set! sv-32 s3-0) (set! sv-24 f0-2) @@ -898,8 +891,8 @@ ) ) ) + sv-32 ) - sv-32 ) (defmethod nav-network-method-35 ((this nav-network) (arg0 vector) (arg1 vector) (arg2 int)) @@ -1124,17 +1117,7 @@ ) (defmethod hover-nav-control-method-30 ((this hover-nav-control) (arg0 vector) (arg1 vector)) - (local-vars - (s0-0 int) - (sv-48 (array nav-network-info)) - (sv-52 (array nav-network-edge)) - (sv-56 int) - (sv-272 (pointer float)) - (sv-276 (inline-array vector)) - (sv-280 (inline-array vector)) - (sv-288 int) - (sv-304 vector) - ) + (local-vars (s0-0 int)) (rlet ((vf0 :class vf) (vf4 :class vf) (vf5 :class vf) @@ -1145,120 +1128,125 @@ (let ((s2-0 (new 'stack-no-clear 'vector)) (s3-0 (new 'stack-no-clear 'vector)) (s5-0 (-> this path-info)) + (sv-48 (-> this nav network)) ) - (set! sv-48 (-> this nav network)) (cond ((< (vector-vector-distance arg0 arg1) 13107.2) (nav-network-method-23 (-> this nav) s5-0 (-> (hover-nav-control-method-17 this) world-sphere) arg1 -1 -1) (hover-nav-control-method-31 this) ) (else - (set! sv-52 (-> this nav edge)) - (set! sv-56 (hover-nav-control-method-28 this arg0 s2-0)) - (let ((v1-13 - (and (!= sv-56 -1) - (begin (set! s0-0 (hover-nav-control-method-28 this arg1 s3-0)) (!= s0-0 -1)) - (begin - (when (< (-> sv-52 s0-0 radius) (vector-vector-distance arg1 s3-0)) - (set! sv-304 (new 'stack-no-clear 'vector)) - (let ((v1-21 arg1) - (a0-12 s3-0) + (let* ((sv-52 (-> this nav edge)) + (sv-56 (hover-nav-control-method-28 this arg0 s2-0)) + (v1-13 + (and (!= sv-56 -1) + (begin (set! s0-0 (hover-nav-control-method-28 this arg1 s3-0)) (!= s0-0 -1)) + (begin + (when (< (-> sv-52 s0-0 radius) (vector-vector-distance arg1 s3-0)) + (let ((sv-304 (new 'stack-no-clear 'vector))) + (let ((v1-21 arg1) + (a0-12 s3-0) + ) + (.lvf vf4 (&-> v1-21 quad)) + (.lvf vf5 (&-> a0-12 quad)) + ) + (.mov.vf.w vf6 vf0) + (.sub.vf.xyz vf6 vf4 vf5) + (.svf (&-> sv-304 quad) vf6) + (vector-normalize! sv-304 (-> sv-52 s0-0 radius)) + (let ((v1-26 arg1)) + (let ((a0-14 s3-0)) + (.mov.vf.w vf6 vf0) + (.lvf vf4 (&-> a0-14 quad)) + ) + (.lvf vf5 (&-> sv-304 quad)) + (.add.vf.xyz vf6 vf4 vf5) + (.svf (&-> v1-26 quad) vf6) + ) + ) + 0 + ) + (cond + ((= sv-56 s0-0) + (let ((sv-272 (new 'stack-no-clear 'array 'float 16)) + (v1-31 (new 'stack-no-clear 'inline-array 'vector 4)) + ) + (dotimes (a0-16 4) + (set! (-> v1-31 a0-16 quad) (the-as uint128 0)) ) - (.lvf vf4 (&-> v1-21 quad)) - (.lvf vf5 (&-> a0-12 quad)) - ) - (.mov.vf.w vf6 vf0) - (.sub.vf.xyz vf6 vf4 vf5) - (.svf (&-> sv-304 quad) vf6) - (vector-normalize! sv-304 (-> sv-52 s0-0 radius)) - (let ((v1-26 arg1)) - (let ((a0-14 s3-0)) - (.mov.vf.w vf6 vf0) - (.lvf vf4 (&-> a0-14 quad)) - ) - (.lvf vf5 (&-> sv-304 quad)) - (.add.vf.xyz vf6 vf4 vf5) - (.svf (&-> v1-26 quad) vf6) - ) - 0 - ) - (cond - ((= sv-56 s0-0) - (set! sv-272 (new 'stack-no-clear 'array 'float 16)) - (let ((v1-31 (new 'stack-no-clear 'inline-array 'vector 4))) - (dotimes (a0-16 4) - (set! (-> v1-31 a0-16 quad) (the-as uint128 0)) - ) - (set! sv-276 v1-31) - ) - (let ((v1-32 (new 'stack-no-clear 'inline-array 'vector 4))) - (dotimes (a0-19 4) - (set! (-> v1-32 a0-19 quad) (the-as uint128 0)) - ) - (set! sv-280 v1-32) - ) - (set! sv-288 0) - (vector-copy! (-> sv-276 0) arg0) - (vector-copy! (-> sv-276 1) s2-0) - (vector-copy! (-> sv-276 2) s3-0) - (vector-copy! (-> sv-276 3) arg1) - (dotimes (s4-1 4) - (let ((s3-2 (+ s4-1 1))) - (while (< s3-2 4) - ;; og:preserve-this - (set! (-> (&+ sv-272 (+ (* s4-1 16) (* s3-2 4))) 0) - (vector-vector-distance (-> sv-276 s4-1) (-> sv-276 s3-2)) - ) - (+! s3-2 1) - ) - ) - ) - (let ((v1-50 0) - (f0-4 (-> sv-52 sv-56 radius)) - ) - (while (begin (label cfg-30) (< v1-50 4)) - (vector-copy! (-> sv-280 sv-288) (-> sv-276 v1-50)) - (set! sv-288 (+ sv-288 1)) - (+! v1-50 1) - (while (< v1-50 4) - (if (< f0-4 - (-> (the-as (pointer float) (+ (+ (* v1-50 4) (* (+ v1-50 -1) 16)) (the-as int (the-as pointer sv-272))))) + (let ((sv-276 v1-31) + (v1-32 (new 'stack-no-clear 'inline-array 'vector 4)) + ) + (dotimes (a0-19 4) + (set! (-> v1-32 a0-19 quad) (the-as uint128 0)) + ) + (let ((sv-280 v1-32) + (sv-288 0) + ) + (vector-copy! (-> sv-276 0) arg0) + (vector-copy! (-> sv-276 1) s2-0) + (vector-copy! (-> sv-276 2) s3-0) + (vector-copy! (-> sv-276 3) arg1) + (dotimes (s4-1 4) + (let ((s3-2 (+ s4-1 1))) + (while (< s3-2 4) + ;; og:preserve-this + (set! (-> (&+ sv-272 (+ (* s4-1 16) (* s3-2 4))) 0) + (vector-vector-distance (-> sv-276 s4-1) (-> sv-276 s3-2)) + ) + (+! s3-2 1) ) - (goto cfg-30) - ) - (+! v1-50 1) - ) - (goto cfg-32) - ) - ) - (label cfg-32) - (when (< sv-288 4) - (vector-copy! (-> sv-280 sv-288) (-> sv-276 3)) - (set! sv-288 (+ sv-288 1)) - ) - (if (< 1 sv-288) - (nav-network-method-23 (-> this nav) s5-0 (-> sv-280 0) (-> sv-280 1) -1 -1) - ) - #t - ) - ((and (nav-network-method-23 (-> this nav) s5-0 s3-0 arg1 -1 -1) - (nav-network-method-25 (-> this nav) s5-0 sv-56 (the-as int s2-0) s0-0 s3-0) + ) + ) + (let ((v1-50 0) + (f0-4 (-> sv-52 sv-56 radius)) + ) + (while (begin (label cfg-30) (< v1-50 4)) + (vector-copy! (-> sv-280 sv-288) (-> sv-276 v1-50)) + (+! sv-288 1) + (+! v1-50 1) + (while (< v1-50 4) + (if (< f0-4 + (-> (the-as (pointer float) (+ (+ (* v1-50 4) (* (+ v1-50 -1) 16)) (the-as int (the-as pointer sv-272))))) + ) + (goto cfg-30) + ) + (+! v1-50 1) + ) + (goto cfg-32) + ) + ) + (label cfg-32) + (when (< sv-288 4) + (vector-copy! (-> sv-280 sv-288) (-> sv-276 3)) + (+! sv-288 1) + ) + (if (< 1 sv-288) + (nav-network-method-23 (-> this nav) s5-0 (-> sv-280 0) (-> sv-280 1) -1 -1) + ) + ) ) - (nav-network-method-23 - (-> this nav) - s5-0 - (-> (hover-nav-control-method-17 this) world-sphere) - (-> sv-48 (-> s5-0 segment-list pos-index 0) pos) - -1 - (-> s5-0 segment-list pos-index 0) - ) - #t + ) + #t + ) + ((and (nav-network-method-23 (-> this nav) s5-0 s3-0 arg1 -1 -1) + (nav-network-method-25 (-> this nav) s5-0 sv-56 (the-as int s2-0) s0-0 s3-0) + ) + (nav-network-method-23 + (-> this nav) + s5-0 + (-> (hover-nav-control-method-17 this) world-sphere) + (-> sv-48 (-> s5-0 segment-list pos-index 0) pos) + -1 + (-> s5-0 segment-list pos-index 0) + ) + #t + ) ) - ) - ) - ) - ) - ) + ) + ) + ) + ) (if v1-13 (hover-nav-control-method-31 this) 0 @@ -1387,18 +1375,19 @@ ) (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-33 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-33 this))) + ) ) (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-34 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-34 this))) + ) ) (defmethod hover-nav-control-method-10 ((this hover-nav-control) (arg0 vector) (arg1 vector) (arg2 vector)) @@ -1420,7 +1409,6 @@ ) (defmethod hover-nav-control-method-12 ((this hover-nav-control) (arg0 vector)) - (local-vars (sv-16 int) (sv-128 collide-prim-core)) (when *debug-hover* (if arg0 (add-debug-sphere #t (bucket-id debug) arg0 (meters 0.9) *color-yellow*) @@ -1432,8 +1420,7 @@ (let* ((s3-0 (-> this fixed-path-info)) (s5-1 (-> s3-0 path)) (s4-0 (hover-nav-control-method-17 this)) - ) - (set! sv-16 (cond + (sv-16 (cond ((>= (-> s3-0 current-index) (+ (-> s3-0 end-index) -2)) (-> s3-0 current-index) ) @@ -1460,20 +1447,17 @@ (-> s3-0 current-index) ) ) - ) + ) + ) (cond ((>= sv-16 (+ (-> s3-0 end-index) -2)) - (let* ((s2-2 (-> this nav)) - (s1-2 (method-of-object s2-2 nav-network-method-23)) - (s0-0 (-> this path-info)) - ) - (set! sv-128 s4-0) - (let ((a3-4 (get-point-in-path! s5-1 (new 'stack-no-clear 'vector) (the float (-> s3-0 end-index)) 'interp)) - (t0-1 -1) - (t1-0 -1) - ) - (s1-2 s2-2 s0-0 (-> sv-128 world-sphere) a3-4 t0-1 t1-0) - ) + (nav-network-method-23 + (-> this nav) + (-> this path-info) + (-> s4-0 world-sphere) + (get-point-in-path! s5-1 (new 'stack-no-clear 'vector) (the float (-> s3-0 end-index)) 'interp) + -1 + -1 ) (let ((s2-3 (new 'stack-no-clear 'vector))) (if (and (< (path-control-method-29 s5-1 (-> s4-0 world-sphere) (+ (-> s3-0 end-index) -1) (the-as float s2-3)) @@ -1586,42 +1570,39 @@ ;; ERROR: Stack slot load at 128 mismatch: defined as size 4, got size 16 ;; ERROR: Stack slot load at 144 mismatch: defined as size 4, got size 16 (defmethod hover-nav-control-method-11 ((this hover-nav-control)) - (local-vars (sv-48 vector) (sv-128 float) (sv-144 float)) - (let ((s5-0 (-> this root))) - (let ((s4-0 (hover-nav-control-method-17 this))) - (let ((v1-2 (vector-! (new 'stack-no-clear 'vector) (-> s4-0 world-sphere) (-> s5-0 trans)))) - (set! sv-48 (vector-! (new 'stack-no-clear 'vector) (-> this dest-pos) v1-2)) - ) - (when (not (logtest? (-> this flags) (hover-nav-flags hnf0))) - (let* ((s3-0 (-> this root transv)) - (f30-0 (vector-length s3-0)) - (s2-0 lerp-scale) - (s1-0 0.0) - (s0-0 (hover-nav-control-method-33 this)) - ) - (set! sv-128 (* 2.0 f30-0)) - (set! sv-144 (the-as float 0.0)) - (let* ((t0-0 (hover-nav-control-method-33 this)) - (f0-4 (s2-0 s1-0 s0-0 sv-128 sv-144 t0-0)) - (t0-2 (vector+float*! (new 'stack-no-clear 'vector) (-> s4-0 world-sphere) s3-0 (/ f0-4 f30-0))) - (s4-1 (nav-network-method-27 - (-> this nav) - (new 'stack-no-clear 'vector) - (-> this root process) - (-> s4-0 world-sphere) - t0-2 - (-> s4-0 world-sphere w) - ) - ) - ) - (let ((f0-7 (vector-length s4-1))) - (seek! (-> this nav-collide-impulse-len) f0-7 (* (hover-nav-control-method-34 this) (seconds-per-frame))) - ) - (vector-normalize-copy! (-> this nav-collide-impulse) s4-1 (- (-> this nav-collide-impulse-len))) - ) + (let* ((s5-0 (-> this root)) + (s4-0 (hover-nav-control-method-17 this)) + (v1-2 (vector-! (new 'stack-no-clear 'vector) (-> s4-0 world-sphere) (-> s5-0 trans))) + (sv-48 (vector-! (new 'stack-no-clear 'vector) (-> this dest-pos) v1-2)) + ) + (when (not (logtest? (-> this flags) (hover-nav-flags hnf0))) + (let* ((s3-0 (-> this root transv)) + (f30-0 (vector-length s3-0)) + (f0-4 (lerp-scale + 0.0 + (hover-nav-control-method-33 this) + (* 2.0 f30-0) + (the-as float 0.0) + (hover-nav-control-method-33 this) + ) + ) + (t0-2 (vector+float*! (new 'stack-no-clear 'vector) (-> s4-0 world-sphere) s3-0 (/ f0-4 f30-0))) + (s4-1 (nav-network-method-27 + (-> this nav) + (new 'stack-no-clear 'vector) + (-> this root process) + (-> s4-0 world-sphere) + t0-2 + (-> s4-0 world-sphere w) + ) + ) + ) + (let ((f0-7 (vector-length s4-1))) + (seek! (-> this nav-collide-impulse-len) f0-7 (* (hover-nav-control-method-34 this) (seconds-per-frame))) ) - 0 + (vector-normalize-copy! (-> this nav-collide-impulse) s4-1 (- (-> this nav-collide-impulse-len))) ) + 0 ) (let ((f30-1 (hover-nav-control-method-34 this)) (f28-0 (hover-nav-control-method-33 this)) diff --git a/goal_src/jak3/levels/common/enemy/hover/hover-nav-edit.gc b/goal_src/jak3/levels/common/enemy/hover/hover-nav-edit.gc index 162d6da37a..b1c90245bd 100644 --- a/goal_src/jak3/levels/common/enemy/hover/hover-nav-edit.gc +++ b/goal_src/jak3/levels/common/enemy/hover/hover-nav-edit.gc @@ -125,20 +125,6 @@ ;; WARN: Return type mismatch file-stream vs object. (defun hover-nav-graph-output ((arg0 string)) - (local-vars - (sv-96 vector) - (sv-112 vector) - (sv-128 int) - (sv-144 int) - (sv-160 (function _varargs_ object)) - (sv-176 string) - (sv-192 string) - (sv-208 int) - (sv-224 (function _varargs_ object)) - (sv-240 string) - (sv-256 string) - (sv-272 int) - ) (rlet ((vf0 :class vf) (vf4 :class vf) (vf5 :class vf) @@ -182,44 +168,37 @@ ) (dotimes (s0-0 s2-1) (when (nonzero? (-> s3-2 node-array data s0-0 nav_node_id)) - (set! sv-96 (new 'stack-no-clear 'vector)) - (let ((v1-22 (+ (the-as uint (-> s3-2 node-array data 0 position)) (* 80 s0-0))) - (a0-22 s4-0) - ) - (.mov.vf.w vf6 vf0) - (.lvf vf4 (&-> (the-as (pointer int128) v1-22))) - (.lvf vf5 (&-> a0-22 quad)) - ) - (.add.vf.xyz vf6 vf4 vf5) - (.svf (&-> sv-96 quad) vf6) - (set! sv-112 (new 'stack-no-clear 'vector)) - (format gp-0 " (~d (~m ~m ~m) (" s1-0 (-> sv-96 x) (-> sv-96 y) (-> sv-96 z)) - (set! sv-128 0) - (while (< sv-128 (-> s3-2 edge-array length)) - (let ((v1-32 (-> s3-2 edge-array data sv-128))) - (set! sv-272 (-> v1-32 runtime-node-id-1)) - (set! sv-144 (-> v1-32 runtime-node-id-2)) + (let ((sv-96 (new 'stack-no-clear 'vector))) + (let ((v1-22 (+ (the-as uint (-> s3-2 node-array data 0 position)) (* 80 s0-0))) + (a0-22 s4-0) + ) + (.mov.vf.w vf6 vf0) + (.lvf vf4 (&-> (the-as (pointer int128) v1-22))) + (.lvf vf5 (&-> a0-22 quad)) ) - (when (= s0-0 sv-272) - (vector+! sv-112 (the-as vector (+ (the-as uint (-> s3-2 node-array data 0 position)) (* 80 sv-144))) s4-0) - (set! sv-160 format) - (set! sv-176 gp-0) - (set! sv-192 "(~d ~m) ") - (set! sv-208 sv-144) - (let ((a3-3 (vector-vector-distance sv-96 sv-112))) - (sv-160 sv-176 sv-192 sv-208 a3-3) + (.add.vf.xyz vf6 vf4 vf5) + (.svf (&-> sv-96 quad) vf6) + (let ((sv-112 (new 'stack-no-clear 'vector))) + (format gp-0 " (~d (~m ~m ~m) (" s1-0 (-> sv-96 x) (-> sv-96 y) (-> sv-96 z)) + (let ((sv-128 0)) + (while (< sv-128 (-> s3-2 edge-array length)) + (let* ((v1-32 (-> s3-2 edge-array data sv-128)) + (sv-272 (-> v1-32 runtime-node-id-1)) + (sv-144 (-> v1-32 runtime-node-id-2)) + ) + (when (= s0-0 sv-272) + (vector+! sv-112 (the-as vector (+ (the-as uint (-> s3-2 node-array data 0 position)) (* 80 sv-144))) s4-0) + (format gp-0 "(~d ~m) " sv-144 (vector-vector-distance sv-96 sv-112)) + ) + (when (= s0-0 sv-144) + (vector+! sv-112 (the-as vector (+ (the-as uint (-> s3-2 node-array data 0 position)) (* 80 sv-272))) s4-0) + (format gp-0 "(~d ~m) " sv-272 (vector-vector-distance sv-96 sv-112)) + ) + ) + (+! sv-128 1) + ) ) ) - (when (= s0-0 sv-144) - (vector+! sv-112 (the-as vector (+ (the-as uint (-> s3-2 node-array data 0 position)) (* 80 sv-272))) s4-0) - (set! sv-224 format) - (set! sv-240 gp-0) - (set! sv-256 "(~d ~m) ") - (let ((a3-4 (vector-vector-distance sv-96 sv-112))) - (sv-224 sv-240 sv-256 sv-272 a3-4) - ) - ) - (set! sv-128 (+ sv-128 1)) ) (format gp-0 "))~%") (+! s1-0 1) diff --git a/goal_src/jak3/levels/common/enemy/hover/robo-hover.gc b/goal_src/jak3/levels/common/enemy/hover/robo-hover.gc index 1b8cd2badf..554d41233b 100644 --- a/goal_src/jak3/levels/common/enemy/hover/robo-hover.gc +++ b/goal_src/jak3/levels/common/enemy/hover/robo-hover.gc @@ -1184,7 +1184,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))) @@ -1260,78 +1260,72 @@ (s5-0 (-> this main-joint-movement 2)) (gp-0 (lambda ((arg0 robo-hover) (arg1 cspace) (arg2 float) (arg3 float) (arg4 vector) (arg5 vector) (arg6 int)) - (local-vars (sv-192 float) (sv-208 vector) (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 'vector)) - (let ((s2-1 (new 'stack-no-clear 'vector))) - (-> arg0 scale) - (quaternion-rotate-local-z! (the-as quaternion sv-208) a1-3 sv-192) - (quaternion->matrix s5-0 (the-as quaternion sv-208)) - (vector-copy! s2-1 (-> arg0 root scale)) - (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 (* 1146880.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 15564.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 'vector)) + (s2-1 (new 'stack-no-clear 'vector)) + ) + (-> arg0 scale) + (quaternion-rotate-local-z! (the-as quaternion sv-208) a1-3 sv-192) + (quaternion->matrix s5-0 (the-as quaternion sv-208)) + (vector-copy! s2-1 (-> arg0 root scale)) + (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 (* 1146880.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* 2210 init-specs 4 initial-valuef) (* f20-0 f2-6)) - (set! (-> *part-id-table* 2210 init-specs 5 initial-valuef) (* f26-0 f0-14)) - (set! (-> *part-id-table* 2214 init-specs 3 initial-valuef) (* f22-0 f2-6)) - (set! (-> *part-id-table* 2211 init-specs 1 initial-valuef) (* f24-0 f0-14)) - (set! (-> *part-id-table* 2212 init-specs 1 initial-valuef) (* f1-10 f0-14)) - (set! (-> *part-id-table* 2213 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 uvec) (/ 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 15564.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)) ) - (vector-copy! (-> s5-0 trans) s4-0) - (spawn-from-mat (-> 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) - #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* 2210 init-specs 4 initial-valuef) (* f20-0 f2-6)) + (set! (-> *part-id-table* 2210 init-specs 5 initial-valuef) (* f26-0 f0-14)) + (set! (-> *part-id-table* 2214 init-specs 3 initial-valuef) (* f22-0 f2-6)) + (set! (-> *part-id-table* 2211 init-specs 1 initial-valuef) (* f24-0 f0-14)) + (set! (-> *part-id-table* 2212 init-specs 1 initial-valuef) (* f1-10 f0-14)) + (set! (-> *part-id-table* 2213 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 uvec) (/ f0-15 -2)) ) ) ) + (vector-copy! (-> s5-0 trans) s4-0) + (spawn-from-mat (-> 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) + #t + ) + ) ) ) 0 @@ -1610,7 +1604,6 @@ ) (defun robo-hover-arm-jmod ((arg0 cspace) (arg1 transformq)) - (local-vars (sv-80 vector) (sv-96 quaternion)) (rlet ((vf0 :class vf) (vf4 :class vf) (vf5 :class vf) @@ -1618,37 +1611,34 @@ ) (init-vf0-vector) (cspace<-parented-transformq-joint! arg0 arg1) - (let ((s4-0 (-> arg0 param1)) - (s2-0 (the-as object (-> arg0 param2))) - ) - (set! sv-80 (vector<-cspace! (new 'stack-no-clear 'vector) arg0)) - (let ((s0-0 (-> (the-as robo-hover s4-0) aim-position)) - (s1-0 (new 'stack-no-clear 'vector)) - ) - (set! sv-96 (matrix->quat (-> arg0 bone transform) (new 'stack-no-clear 'quaternion))) - (let ((s3-0 (new 'stack-no-clear 'quaternion))) - (let ((v1-1 s1-0)) - (.lvf vf4 (&-> s0-0 quad)) - (.lvf vf5 (&-> sv-80 quad)) - (.mov.vf.w vf6 vf0) - (.sub.vf.xyz vf6 vf4 vf5) - (.svf (&-> v1-1 quad) vf6) - ) - (vector-normalize! s1-0 1.0) - (vector-inv-orient-by-quat! s1-0 s1-0 sv-96) - (quaternion-from-two-vectors-max-angle-partial! - s3-0 - *y-vector* - s1-0 - 16384.0 - (-> (the-as robo-hover s4-0) gun-blend) - ) - (quaternion-normalize! s3-0) - (quaternion*! s3-0 s3-0 (-> (the-as robo-hover s4-0) wrist-quat (the-as int s2-0))) - (quaternion-normalize! s3-0) - (quaternion*! (-> arg1 quat) (-> arg1 quat) s3-0) - ) + (let* ((s4-0 (-> arg0 param1)) + (s2-0 (the-as object (-> arg0 param2))) + (sv-80 (vector<-cspace! (new 'stack-no-clear 'vector) arg0)) + (s0-0 (-> (the-as robo-hover s4-0) aim-position)) + (s1-0 (new 'stack-no-clear 'vector)) + (sv-96 (matrix->quat (-> arg0 bone transform) (new 'stack-no-clear 'quaternion))) + (s3-0 (new 'stack-no-clear 'quaternion)) + ) + (let ((v1-1 s1-0)) + (.lvf vf4 (&-> s0-0 quad)) + (.lvf vf5 (&-> sv-80 quad)) + (.mov.vf.w vf6 vf0) + (.sub.vf.xyz vf6 vf4 vf5) + (.svf (&-> v1-1 quad) vf6) ) + (vector-normalize! s1-0 1.0) + (vector-inv-orient-by-quat! s1-0 s1-0 sv-96) + (quaternion-from-two-vectors-max-angle-partial! + s3-0 + *y-vector* + s1-0 + 16384.0 + (-> (the-as robo-hover s4-0) gun-blend) + ) + (quaternion-normalize! s3-0) + (quaternion*! s3-0 s3-0 (-> (the-as robo-hover s4-0) wrist-quat (the-as int s2-0))) + (quaternion-normalize! s3-0) + (quaternion*! (-> arg1 quat) (-> arg1 quat) s3-0) ) (quaternion-normalize! (-> arg1 quat)) (cspace<-parented-transformq-joint! arg0 arg1) @@ -1659,7 +1649,6 @@ (defmethod init-enemy! ((this robo-hover)) "Typical place for shared init code. Runs from entity or process style init." - (local-vars (sv-16 res-tag) (sv-32 res-tag) (sv-48 res-tag) (sv-64 res-tag)) (hover-enemy-method-170 this) (setup-enemy! this (get-enemy-info this)) (hover-enemy-method-176 this) @@ -1685,15 +1674,17 @@ (logior! (-> this mask) (process-mask kg-robot)) (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-31 (res-lump-data (-> this entity) 'actor-groups (pointer actor-group) :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-31 (res-lump-data (-> this entity) 'actor-groups (pointer actor-group) :tag-ptr (& sv-16))) + ) (if (and v1-31 (= (-> sv-16 elt-count) 1)) (set! (-> this entity-group) (-> v1-31 0)) (set! (-> this entity-group) #f) ) ) - (set! sv-32 (new 'static 'res-tag)) - (let ((v1-35 (res-lump-data (-> this entity) 'timeout (pointer float) :tag-ptr (& sv-32)))) + (let* ((sv-32 (new 'static 'res-tag)) + (v1-35 (res-lump-data (-> this entity) 'timeout (pointer float) :tag-ptr (& sv-32))) + ) (cond ((and v1-35 (= (-> sv-32 elt-count) 2)) (set! (-> this attack-wait-min) (-> v1-35 0)) @@ -1706,16 +1697,18 @@ ) ) (set! (-> this knocked-fall-dist) 0.0) - (set! sv-48 (new 'static 'res-tag)) - (let ((v1-41 (res-lump-data (-> this entity) 'min-max pointer :tag-ptr (& sv-48)))) + (let* ((sv-48 (new 'static 'res-tag)) + (v1-41 (res-lump-data (-> this entity) 'min-max pointer :tag-ptr (& sv-48))) + ) (set! (-> this attack-miss-dist-min) (if (and v1-41 (> (the-as int (-> sv-48 elt-count)) 0)) (-> (the-as (pointer float) v1-41)) -14336.0 ) ) ) - (set! sv-64 (new 'static 'res-tag)) - (let ((v1-44 (res-lump-data (-> this entity) 'min-max (pointer float) :tag-ptr (& sv-64)))) + (let* ((sv-64 (new 'static 'res-tag)) + (v1-44 (res-lump-data (-> this entity) 'min-max (pointer float) :tag-ptr (& sv-64))) + ) (set! (-> this attack-miss-dist-max) (if (and v1-44 (< 1 (the-as int (-> sv-64 elt-count)))) (-> v1-44 1) 14336.0 diff --git a/goal_src/jak3/levels/common/enemy/kg-grunt.gc b/goal_src/jak3/levels/common/enemy/kg-grunt.gc index 7253f380a3..c77192c6a1 100644 --- a/goal_src/jak3/levels/common/enemy/kg-grunt.gc +++ b/goal_src/jak3/levels/common/enemy/kg-grunt.gc @@ -1054,23 +1054,18 @@ (s4-0 (new 'stack-no-clear 'vector)) ) (vector-! s4-0 v1-3 (-> this root trans)) - (let* ((f30-0 (vector-length-squared s4-0)) - (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 (vector-length-squared s4-0)) + (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)) ) ) @@ -1097,10 +1092,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 "kg-grunt-warn") (set! (-> self next-warn-time) (+ gp-0 (rnd-time-frame self (seconds 1) (seconds 1.2)))) ) diff --git a/goal_src/jak3/levels/common/enemy/mantis.gc b/goal_src/jak3/levels/common/enemy/mantis.gc index 626e3304ee..840bbaece8 100644 --- a/goal_src/jak3/levels/common/enemy/mantis.gc +++ b/goal_src/jak3/levels/common/enemy/mantis.gc @@ -1443,11 +1443,7 @@ ) ) (zero? (rnd-int this 3)) - (let ((f0-2 (vector-vector-distance-squared (-> this root trans) (target-pos 0))) - (f1-2 32768.0) - ) - (>= f0-2 (* f1-2 f1-2)) - ) + (>= (vector-vector-distance-squared (-> this root trans) (target-pos 0)) (square 32768.0)) ) (go-die this) ) diff --git a/goal_src/jak3/levels/common/enemy/roboguard.gc b/goal_src/jak3/levels/common/enemy/roboguard.gc index 36816137d3..d28bd6ac3f 100644 --- a/goal_src/jak3/levels/common/enemy/roboguard.gc +++ b/goal_src/jak3/levels/common/enemy/roboguard.gc @@ -1367,9 +1367,7 @@ ) (else (if (or (not (closest-point-on-mesh (-> this nav) s5-0 (-> gp-0 trans) (-> s3-0 current-poly))) - (let ((f0-0 8192.0)) - (< (* f0-0 f0-0) (vector-vector-xz-distance-squared s5-0 (-> gp-0 trans))) - ) + (< (square 8192.0) (vector-vector-xz-distance-squared s5-0 (-> gp-0 trans))) (< (- (-> gp-0 trans y) (-> s5-0 y)) -4096.0) ) (return #t) @@ -1645,7 +1643,6 @@ (let ((v1-13 (-> this node-list data 4))) (set! (-> v1-13 param0) (lambda ((arg0 cspace) (arg1 transformq)) - (local-vars (sv-96 vector)) (let ((s3-0 (the-as roboguard (-> arg0 param1))) (gp-0 (new 'stack-no-clear 'quaternion)) ) @@ -1654,23 +1651,24 @@ (vector-copy! s2-0 (-> s3-0 rotation-matrix rvec)) (let ((s0-0 (new 'stack-no-clear 'vector))) (vector-copy! s0-0 (-> s3-0 rotation-matrix fvec)) - (let ((s1-0 (new 'stack-no-clear 'vector))) - (set! sv-96 (-> s3-0 focus-pos)) - (let* ((v0-1 (vector<-cspace! (new 'stack-no-clear 'vector) arg0)) - (s1-1 (vector-! s1-0 sv-96 v0-1)) - ) - (set! (-> s1-1 y) 0.0) - (set! (-> s2-0 y) 0.0) - (set! (-> s0-0 y) 0.0) - (vector-xz-normalize! s1-1 1.0) - (vector-xz-normalize! s2-0 1.0) - (vector-xz-normalize! s0-0 1.0) - (let ((f0-5 (fmin 18204.445 (acos (vector-dot s0-0 s1-1))))) - (if (< (vector-dot s2-0 s1-1) 0.0) - (set! f0-5 (* -1.0 f0-5)) - ) - (seek! (-> s3-0 torso-angle) f0-5 (* (-> s3-0 torso-seek-speed) (seconds-per-frame))) + (let ((s1-1 (vector-! + (new 'stack-no-clear 'vector) + (-> s3-0 focus-pos) + (vector<-cspace! (new 'stack-no-clear 'vector) arg0) + ) + ) ) + (set! (-> s1-1 y) 0.0) + (set! (-> s2-0 y) 0.0) + (set! (-> s0-0 y) 0.0) + (vector-xz-normalize! s1-1 1.0) + (vector-xz-normalize! s2-0 1.0) + (vector-xz-normalize! s0-0 1.0) + (let ((f0-5 (fmin 18204.445 (acos (vector-dot s0-0 s1-1))))) + (if (< (vector-dot s2-0 s1-1) 0.0) + (set! f0-5 (* -1.0 f0-5)) + ) + (seek! (-> s3-0 torso-angle) f0-5 (* (-> s3-0 torso-seek-speed) (seconds-per-frame))) ) ) ) diff --git a/goal_src/jak3/levels/common/enemy/spydroid-orig.gc b/goal_src/jak3/levels/common/enemy/spydroid-orig.gc index 75abe65210..6e7428c9b6 100644 --- a/goal_src/jak3/levels/common/enemy/spydroid-orig.gc +++ b/goal_src/jak3/levels/common/enemy/spydroid-orig.gc @@ -814,7 +814,7 @@ (defmethod event-handler ((this spydroid-orig) (arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) "Commmon handler for events." - (local-vars (v1-8 structure) (sv-144 vector)) + (local-vars (v1-8 structure)) (rlet ((vf0 :class vf) (vf4 :class vf) (vf5 :class vf) @@ -825,71 +825,77 @@ (('touch 'bonk 'attack) (cond ((logtest? (-> this flags) (spydroid-orig-flag sof0)) - (set! sv-144 (the-as vector (send-event (ppointer->process (-> this parent)) 'widow-get-center))) - (let ((s0-0 (as-type arg0 process-drawable))) - (let ((v1-7 sv-144)) - (b! (not v1-7) cfg-16 :likely-delay (set! v1-8 sv-144)) - ) - (set! v1-8 s0-0) - (label cfg-16) - (cond - (v1-8 - (let ((v1-12 (vector-! (new 'stack-no-clear 'vector) (-> this root trans) sv-144)) - (s1-1 (new 'stack-no-clear 'vector)) - ) - (set! (-> s1-1 x) (- (-> v1-12 z))) - (set! (-> s1-1 y) 0.0) - (set! (-> s1-1 z) (-> v1-12 x)) - (set! (-> s1-1 w) 1.0) - (let ((v1-15 - (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-15 y) 0.0) - (if (< (vector-dot v1-15 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-20 s1-1)) - (let ((a0-19 s1-1)) - (.mov.vf.w vf6 vf0) - (.lvf vf4 (&-> a0-19 quad)) - ) - (.lvf vf5 (&-> sv-144 quad)) - (.add.vf.xyz vf6 vf4 vf5) - (.svf (&-> v1-20 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 :mask (vehicle-impulse-factor) ((id (new-attack-id)) - (damage 2.0) - (vehicle-damage-factor 1.0) - (vehicle-impulse-factor 1.0) - (mode 'shock) - (vector s1-1) - ) - ) - ) + (let ((a1-3 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-3 from) (process->ppointer self)) + (set! (-> a1-3 num-params) 0) + (set! (-> a1-3 message) 'widow-get-center) + (let ((sv-144 (the-as vector (send-event-function (ppointer->process (-> this parent)) a1-3))) + (s0-0 (as-type arg0 process-drawable)) ) + (let ((v1-7 sv-144)) + (b! (not v1-7) cfg-16 :likely-delay (set! v1-8 sv-144)) + ) + (set! v1-8 s0-0) + (label cfg-16) + (cond + (v1-8 + (let ((v1-12 (vector-! (new 'stack-no-clear 'vector) (-> this root trans) sv-144)) + (s1-1 (new 'stack-no-clear 'vector)) + ) + (set! (-> s1-1 x) (- (-> v1-12 z))) + (set! (-> s1-1 y) 0.0) + (set! (-> s1-1 z) (-> v1-12 x)) + (set! (-> s1-1 w) 1.0) + (let ((v1-15 + (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-15 y) 0.0) + (if (< (vector-dot v1-15 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-20 s1-1)) + (let ((a0-19 s1-1)) + (.mov.vf.w vf6 vf0) + (.lvf vf4 (&-> a0-19 quad)) + ) + (.lvf vf5 (&-> sv-144 quad)) + (.add.vf.xyz vf6 vf4 vf5) + (.svf (&-> v1-20 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 :mask (vehicle-impulse-factor) ((id (new-attack-id)) + (damage 2.0) + (vehicle-damage-factor 1.0) + (vehicle-impulse-factor 1.0) + (mode 'shock) + (vector s1-1) + ) + ) + ) + ) + ) + ((and s0-0 (= (-> s0-0 type) target)) + (send-event arg0 'attack #f (static-attack-info :mask (vehicle-impulse-factor) ((id (new-attack-id)) + (damage 2.0) + (vehicle-damage-factor 1.0) + (vehicle-impulse-factor 1.0) + (mode 'shock) + (shove-up (meters 2)) + (shove-back (meters 4)) + ) + ) + ) + ) ) - ((and s0-0 (= (-> s0-0 type) target)) - (send-event arg0 'attack #f (static-attack-info :mask (vehicle-impulse-factor) ((id (new-attack-id)) - (damage 2.0) - (vehicle-damage-factor 1.0) - (vehicle-impulse-factor 1.0) - (mode 'shock) - (shove-up (meters 2)) - (shove-back (meters 4)) - ) - ) - ) - ) ) ) (let ((v1-36 (the-as object (-> arg3 param 1)))) @@ -1284,11 +1290,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/goal_src/jak3/levels/common/enemy/spydroid.gc b/goal_src/jak3/levels/common/enemy/spydroid.gc index a8eb7e21a1..2d335f3134 100644 --- a/goal_src/jak3/levels/common/enemy/spydroid.gc +++ b/goal_src/jak3/levels/common/enemy/spydroid.gc @@ -588,7 +588,7 @@ ) :trans (behavior () (let ((gp-0 (handle->process (-> self focus handle))) - ;; og:preserve-this + ;; og:preserve-this added (go? (the object #f))) (if (and (the-as process-focusable gp-0) (not (and (the-as process-focusable gp-0) @@ -982,11 +982,7 @@ ) :trans (behavior () (if (or (time-elapsed? (-> self state-time) (seconds 15)) - (let ((f0-0 (vector-vector-xz-distance-squared (-> self root trans) (-> self move-dest))) - (f1-0 20480.0) - ) - (< f0-0 (* f1-0 f1-0)) - ) + (< (vector-vector-xz-distance-squared (-> self root trans) (-> self move-dest)) (square 20480.0)) ) (go-virtual scan) ) @@ -1082,9 +1078,8 @@ (when (handle->process (-> self focus handle)) (let* ((a0-9 (the-as process-focusable (handle->process (-> self focus handle)))) (f0-0 (vector-vector-xz-distance-squared (get-trans a0-9 3) (-> self root trans))) - (f1-0 143360.0) ) - (when (< (* f1-0 f1-0) f0-0) + (when (< (square 143360.0) f0-0) (spydroid-method-231 self (the-as uint 3)) (go-virtual hostile) ) @@ -1394,7 +1389,7 @@ (and (< 0.98 (-> arg0 danger-level)) (and (or (= (-> arg0 danger-type) 0) (= (-> arg0 danger-type) 3) (= (-> arg0 danger-type) 5)) (< (fabs (- (-> arg0 sphere y) (-> this root trans y))) 61440.0) - (< (vector-vector-xz-distance-squared (-> this root trans) (-> arg0 sphere)) (* f30-0 f30-0)) + (< (vector-vector-xz-distance-squared (-> this root trans) (-> arg0 sphere)) (square f30-0)) ) ) ) @@ -1471,22 +1466,18 @@ (the-as enemy-aware #f) ) (update-focus this) - (let ((f0-0 (vector-vector-xz-distance-squared (-> this root trans) (-> this focus-pos))) - (f1-0 266240.0) - ) - (cond - ((< f0-0 (* f1-0 f1-0)) - (when (not (logtest? (-> this squad alert-state flags) (squad-alert-flag war))) - (set! v0-6 (logior (-> this flags) (citizen-flag persistent))) - (set! (-> this flags) (the-as citizen-flag v0-6)) - v0-6 - ) + (cond + ((< (vector-vector-xz-distance-squared (-> this root trans) (-> this focus-pos)) (square 266240.0)) + (when (not (logtest? (-> this squad alert-state flags) (squad-alert-flag war))) + (set! v0-6 (logior (-> this flags) (citizen-flag persistent))) + (set! (-> this flags) (the-as citizen-flag v0-6)) + v0-6 ) - (else - (set! v0-6 (logclear (-> this flags) (citizen-flag persistent))) - (set! (-> this flags) (the-as citizen-flag v0-6)) - v0-6 - ) + ) + (else + (set! v0-6 (logclear (-> this flags) (citizen-flag persistent))) + (set! (-> this flags) (the-as citizen-flag v0-6)) + v0-6 ) ) ) diff --git a/goal_src/jak3/levels/common/hvehicle/squad-control.gc b/goal_src/jak3/levels/common/hvehicle/squad-control.gc index 67ccc15348..f280f70cf6 100644 --- a/goal_src/jak3/levels/common/hvehicle/squad-control.gc +++ b/goal_src/jak3/levels/common/hvehicle/squad-control.gc @@ -359,10 +359,9 @@ ;; WARN: Return type mismatch process vs process-focusable. (defmethod get-focus-in-range ((this squad-control) (arg0 process-focusable)) - (let* ((f0-0 4915200.0) - (f30-0 (* f0-0 f0-0)) - (s4-0 (the-as process #f)) - ) + (let ((f30-0 (square 4915200.0)) + (s4-0 (the-as process #f)) + ) (dotimes (s3-0 3) (let ((s2-0 (as-type (handle->process (-> this alert-state target-status-array s3-0 handle)) process-focusable))) (when s2-0 @@ -382,92 +381,92 @@ ;; WARN: Return type mismatch vector vs none. (defmethod squad-control-method-31 ((this squad-control) (arg0 vector) (arg1 process-focusable) (arg2 handle) (arg3 float) (arg4 float)) - (local-vars (sv-672 float) (sv-688 vector) (sv-704 int)) (rlet ((vf0 :class vf) (vf4 :class vf) (vf5 :class vf) (vf6 :class vf) ) (init-vf0-vector) - (set! sv-672 arg4) - (let ((s5-0 (get-handle-pos this arg2 (new 'stack-no-clear 'vector)))) + (let ((sv-672 arg4) + (s5-0 (get-handle-pos this arg2 (new 'stack-no-clear 'vector))) + ) (let ((s3-1 (vector-! (new 'stack-no-clear 'vector) s5-0 (-> arg1 root trans)))) - (set! sv-688 s5-0) - (set! (-> s3-1 y) 0.0) - (vector-normalize! s3-1 1.0) - (let ((s2-0 (new 'stack-no-clear 'squad-control-stack-type0)) - (s1-0 (the-as nav-mesh #f)) - (f30-0 sv-672) - ) - (if (and (nonzero? (-> arg1 nav)) (-> arg1 nav)) - (set! s1-0 (-> arg1 nav state mesh)) - ) - (if (not s1-0) - (set! s1-0 (find-nearest-nav-mesh sv-688 (the-as float #x7f800000))) - ) - (when s1-0 - (nav-mesh-method-10 s1-0 sv-688 sv-688 (the-as nav-poly #f)) - (set! (-> s2-0 float0) 40960.0) - (set! (-> s2-0 byte0) 2) - (vector-! (-> s2-0 vec1) sv-688 (the-as vector (-> s1-0 bounds))) - (nav-mesh-method-46 s1-0 (the-as nav-poly (-> s2-0 vec1))) - (let ((s0-1 (-> s2-0 mesh))) - (when s0-1 - (project-point-into-poly-2d s1-0 (the-as nav-poly s0-1) (-> s2-0 vec1) (-> s2-0 vec1)) - (let ((v1-18 (-> s2-0 vec1)) - (a0-9 (-> s1-0 bounds)) - ) - (.mov.vf.w vf6 vf0) - (.lvf vf4 (&-> v1-18 quad)) - (.lvf vf5 (&-> a0-9 quad)) - ) - (.add.vf.xyz vf6 vf4 vf5) - (.svf (&-> sv-688 quad) vf6) - (set! sv-704 0) - (while (< sv-704 16) - (when #t - (set! (-> s2-0 float1) - (the float (sar (shl (the int (+ f30-0 (* 182.04445 (* 22.5 (the float sv-704))))) 48) 48)) + (let ((sv-688 s5-0)) + (set! (-> s3-1 y) 0.0) + (vector-normalize! s3-1 1.0) + (let ((s2-0 (new 'stack-no-clear 'squad-control-stack-type0)) + (s1-0 (the-as nav-mesh #f)) + (f30-0 sv-672) + ) + (if (and (nonzero? (-> arg1 nav)) (-> arg1 nav)) + (set! s1-0 (-> arg1 nav state mesh)) + ) + (if (not s1-0) + (set! s1-0 (find-nearest-nav-mesh sv-688 (the-as float #x7f800000))) + ) + (when s1-0 + (nav-mesh-method-10 s1-0 sv-688 sv-688 (the-as nav-poly #f)) + (set! (-> s2-0 float0) 40960.0) + (set! (-> s2-0 byte0) 2) + (vector-! (-> s2-0 vec1) sv-688 (the-as vector (-> s1-0 bounds))) + (nav-mesh-method-46 s1-0 (the-as nav-poly (-> s2-0 vec1))) + (let ((s0-1 (-> s2-0 mesh))) + (when s0-1 + (project-point-into-poly-2d s1-0 (the-as nav-poly s0-1) (-> s2-0 vec1) (-> s2-0 vec1)) + (let ((v1-18 (-> s2-0 vec1)) + (a0-9 (-> s1-0 bounds)) + ) + (.mov.vf.w vf6 vf0) + (.lvf vf4 (&-> v1-18 quad)) + (.lvf vf5 (&-> a0-9 quad)) + ) + (.add.vf.xyz vf6 vf4 vf5) + (.svf (&-> sv-688 quad) vf6) + (let ((sv-704 0)) + (while (< sv-704 16) + (when #t + (set! (-> s2-0 float1) + (the float (sar (shl (the int (+ f30-0 (* 182.04445 (* 22.5 (the float sv-704))))) 48) 48)) + ) + (set! (-> s2-0 float2) arg3) + (vector-rotate-around-y! (-> s2-0 vec0) s3-1 (-> s2-0 float1)) + (vector-float*! (-> s2-0 vec0) (-> s2-0 vec0) (-> s2-0 float2)) + (clamp-vector-to-mesh-cross-gaps + s1-0 + (-> s2-0 vec1) + (the-as nav-poly s0-1) + (-> s2-0 vec0) + (-> s2-0 float2) + #f + (the-as clamp-travel-vector-to-mesh-return-info #f) ) - (set! (-> s2-0 float2) arg3) - (vector-rotate-around-y! (-> s2-0 vec0) s3-1 (-> s2-0 float1)) - (vector-float*! (-> s2-0 vec0) (-> s2-0 vec0) (-> s2-0 float2)) - (clamp-vector-to-mesh-cross-gaps - s1-0 - (-> s2-0 vec1) - (the-as nav-poly s0-1) - (-> s2-0 vec0) - (-> s2-0 float2) - #f - (the-as clamp-travel-vector-to-mesh-return-info #f) - ) - (vector-copy! (-> s2-0 cquery start-pos) s5-0) - (vector-copy! (-> s2-0 cquery move-dist) (-> s2-0 vec0)) - (let ((v1-34 (-> s2-0 cquery))) - (set! (-> v1-34 radius) 2048.0) - (set! (-> v1-34 collide-with) (collide-spec backgnd)) - (set! (-> v1-34 ignore-process0) #f) - (set! (-> v1-34 ignore-process1) #f) - (set! (-> v1-34 ignore-pat) - (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) + (vector-copy! (-> s2-0 cquery start-pos) s5-0) + (vector-copy! (-> s2-0 cquery move-dist) (-> s2-0 vec0)) + (let ((v1-34 (-> s2-0 cquery))) + (set! (-> v1-34 radius) 2048.0) + (set! (-> v1-34 collide-with) (collide-spec backgnd)) + (set! (-> v1-34 ignore-process0) #f) + (set! (-> v1-34 ignore-process1) #f) + (set! (-> v1-34 ignore-pat) + (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) + ) + (set! (-> v1-34 action-mask) (collide-action solid)) + ) + (set! (-> s2-0 float3) (fill-and-probe-using-line-sphere *collide-cache* (-> s2-0 cquery))) + (if (< 0.0 (-> s2-0 float3)) + (vector-float*! (-> s2-0 vec0) (-> s2-0 vec0) (-> s2-0 float3)) + ) + (let ((f0-17 (vector-length-squared (-> s2-0 vec0)))) + (when (< (square (/ arg3 2)) f0-17) + (vector+! s5-0 s5-0 (-> s2-0 vec0)) + 0 + (goto cfg-19) ) - (set! (-> v1-34 action-mask) (collide-action solid)) - ) - (set! (-> s2-0 float3) (fill-and-probe-using-line-sphere *collide-cache* (-> s2-0 cquery))) - (if (< 0.0 (-> s2-0 float3)) - (vector-float*! (-> s2-0 vec0) (-> s2-0 vec0) (-> s2-0 float3)) - ) - (let ((f0-17 (vector-length-squared (-> s2-0 vec0))) - (f1-4 (/ arg3 2)) ) - (when (< (* f1-4 f1-4) f0-17) - (vector+! s5-0 s5-0 (-> s2-0 vec0)) - 0 - (goto cfg-19) ) + (+! sv-704 1) ) ) - (set! sv-704 (+ sv-704 1)) ) ) ) diff --git a/goal_src/jak3/levels/common/race/pilot-recorder.gc b/goal_src/jak3/levels/common/race/pilot-recorder.gc index 356d6c8062..234df50ac3 100644 --- a/goal_src/jak3/levels/common/race/pilot-recorder.gc +++ b/goal_src/jak3/levels/common/race/pilot-recorder.gc @@ -188,11 +188,9 @@ (a0-5 (new 'stack-no-clear 'vector)) ) (vector+float*! a0-5 arg0 s4-0 f0-4) - (let ((f0-5 184320.0)) - (if (>= (* f0-5 f0-5) (vector-vector-xz-distance-squared a0-5 (-> this start-record-center))) - #t - ) - ) + (if (>= (square 184320.0) (vector-vector-xz-distance-squared a0-5 (-> this start-record-center))) + #t + ) ) ) ) @@ -208,11 +206,9 @@ (a0-5 (new 'stack-no-clear 'vector)) ) (vector+float*! a0-5 arg0 s4-0 f0-4) - (let ((f0-5 184320.0)) - (if (>= (* f0-5 f0-5) (vector-vector-xz-distance-squared a0-5 (-> this finish-record-center))) - #t - ) - ) + (if (>= (square 184320.0) (vector-vector-xz-distance-squared a0-5 (-> this finish-record-center))) + #t + ) ) ) ) @@ -255,12 +251,10 @@ ) (vector-copy! s3-0 (math-camera-pos)) (while (< s2-0 s4-0) - (let* ((s2-1 (-> this samples s2-0)) - (s1-1 (-> this samples s5-0)) - (f0-0 (vector-vector-distance-squared (-> s2-1 pos) s3-0)) - (f1-0 819200.0) - ) - (if (< f0-0 (* f1-0 f1-0)) + (let ((s2-1 (-> this samples s2-0)) + (s1-1 (-> this samples s5-0)) + ) + (if (< (vector-vector-distance-squared (-> s2-1 pos) s3-0) (square 819200.0)) (add-debug-line #t (bucket-id debug) @@ -367,8 +361,8 @@ (v1-24 (-> this samples (+ s4-0 s1-0))) ) (vector+float*! (-> s0-0 1) (-> s3-0 pos) (-> s2-0 0) f0-8) - (vector+float*! (-> s0-0 1) (-> s0-0 1) (-> s2-0 2) (* f0-8 f0-8)) - (vector+float*! (-> s0-0 1) (-> s0-0 1) (-> s2-0 3) (* f0-8 f0-8 f0-8)) + (vector+float*! (-> s0-0 1) (-> s0-0 1) (-> s2-0 2) (square f0-8)) + (vector+float*! (-> s0-0 1) (-> s0-0 1) (-> s2-0 3) (* (square f0-8) f0-8)) (vector-copy! (-> v1-24 pos) (-> s0-0 1)) (quaternion-slerp! (-> v1-24 quat) (-> s3-0 quat) (-> s5-0 quat) f0-8) ) @@ -380,7 +374,6 @@ ) (defmethod save-to-db! ((this pilot-recorder)) - (local-vars (sv-16 pilrec-sample-flag)) (let ((gp-0 (clear *temp-string*)) (s4-0 (-> *race-info-array* *select-race* path-group-name)) (s3-0 *select-race-path*) @@ -405,8 +398,9 @@ (format gp-0 "quat_y=~f," (-> s1-0 quat y)) (format gp-0 "quat_z=~f," (-> s1-0 quat z)) (format gp-0 "quat_w=~f," (-> s1-0 quat w)) - (set! sv-16 (-> s1-0 flags)) - (let ((s0-0 #f)) + (let ((sv-16 (-> s1-0 flags)) + (s0-0 #f) + ) (format gp-0 "flags='") (when (logtest? sv-16 (pilrec-sample-flag square)) (set! s0-0 (cond diff --git a/goal_src/jak3/levels/common/race/race-hud.gc b/goal_src/jak3/levels/common/race/race-hud.gc index 691894b6cb..e9ec465492 100644 --- a/goal_src/jak3/levels/common/race/race-hud.gc +++ b/goal_src/jak3/levels/common/race/race-hud.gc @@ -285,7 +285,6 @@ ) (defmethod draw ((this hud-race-final-stats)) - (local-vars (sv-112 font-context) (sv-128 string) (sv-144 string)) (let* ((s1-0 *race-state*) (s5-0 (-> s1-0 racer-array (-> s1-0 i-player))) ) @@ -295,63 +294,55 @@ (let* ((s4-0 0) (s3-0 (+ s4-0 3)) ) - (set! sv-112 - (new 'stack 'font-context *font-default-matrix* 0 0 0.0 (font-color default) (font-flags shadow kerning)) - ) - (set! (-> this strings 0 scale) 0.0) - (set! (-> sv-112 origin x) 45.0) - (set! (-> sv-112 origin y) 20.0) - (set-width! sv-112 422) - (set-height! sv-112 80) - (let ((a0-6 sv-112)) - (set! (-> a0-6 color) (font-color red)) - ) - (let ((a0-7 sv-112)) - (set! (-> a0-7 flags) (font-flags kerning middle middle-vert large)) - ) - (let ((s0-0 80)) - (set-scale! sv-112 1.6) - (if (= (-> *setting-control* user-default language) (language-enum german)) - (set-scale! sv-112 1.0) - ) - (cond - ((-> s1-0 player-win?) - (let ((s1-1 print-game-text) - (a0-13 (lookup-text! *common-text* (text-id text-0076) #f)) - (a2-2 #f) - (a3-1 44) - (t0-1 579) - ) - (s1-1 a0-13 sv-112 a2-2 a3-1 (the-as bucket-id t0-1)) - ) - ) - (else - (print-game-text - (lookup-text! *common-text* (text-id text-0077) #f) - sv-112 - #f - 44 - (bucket-id hud-draw-hud-alpha) + (let ((sv-112 + (new 'stack 'font-context *font-default-matrix* 0 0 0.0 (font-color default) (font-flags shadow kerning)) ) ) + (set! (-> this strings 0 scale) 0.0) + (set! (-> sv-112 origin x) 45.0) + (set! (-> sv-112 origin y) 20.0) + (set-width! sv-112 422) + (set-height! sv-112 80) + (let ((a0-6 sv-112)) + (set! (-> a0-6 color) (font-color red)) ) - (set! (-> this strings 1 scale) 0.5) - (set! (-> this strings 1 flags) (font-flags shadow kerning large)) - (set-hud-piece-position! - (the-as hud-sprite (-> this strings 1 pos)) - 128 - (the int (+ (- 188.0 (the float s0-0)) (* -100.0 (-> this offset)))) + (let ((a0-7 sv-112)) + (set! (-> a0-7 flags) (font-flags kerning middle middle-vert large)) ) - (let ((s1-3 format)) - (set! sv-128 (clear (-> this strings 1 text))) - (let ((a1-7 (lookup-text! *common-text* (text-id text-0078) #f))) - (s1-3 sv-128 a1-7) + (let ((s0-0 80)) + (set-scale! sv-112 1.6) + (if (= (-> *setting-control* user-default language) (language-enum german)) + (set-scale! sv-112 1.0) + ) + (if (-> s1-0 player-win?) + (print-game-text + (lookup-text! *common-text* (text-id text-0076) #f) + sv-112 + #f + 44 + (bucket-id hud-draw-hud-alpha) + ) + (print-game-text + (lookup-text! *common-text* (text-id text-0077) #f) + sv-112 + #f + 44 + (bucket-id hud-draw-hud-alpha) + ) + ) + (set! (-> this strings 1 scale) 0.5) + (set! (-> this strings 1 flags) (font-flags shadow kerning large)) + (set-hud-piece-position! + (the-as hud-sprite (-> this strings 1 pos)) + 128 + (the int (+ (- 188.0 (the float s0-0)) (* -100.0 (-> this offset)))) + ) + (format (clear (-> this strings 1 text)) (lookup-text! *common-text* (text-id text-0078) #f)) + (set-hud-piece-position! + (the-as hud-sprite (-> this strings 2 pos)) + 384 + (the int (+ (- 188.0 (the float s0-0)) (* -100.0 (-> this offset)))) ) - ) - (set-hud-piece-position! - (the-as hud-sprite (-> this strings 2 pos)) - 384 - (the int (+ (- 188.0 (the float s0-0)) (* -100.0 (-> this offset)))) ) ) (set! (-> this strings 2 scale) 0.5) @@ -368,15 +359,11 @@ 5 (+ (* 28 s4-0) 40) ) - (let ((s1-5 format) - (s0-1 (clear (-> this strings s3-0 text))) - ) - (set! sv-144 "~S ~D") - (let ((a2-10 (lookup-text! *common-text* (text-id text-0079) #f)) - (a3-4 (+ s4-0 1)) - ) - (s1-5 s0-1 sv-144 a2-10 a3-4) - ) + (format + (clear (-> this strings s3-0 text)) + "~S ~D" + (lookup-text! *common-text* (text-id text-0079) #f) + (+ s4-0 1) ) (let ((s3-1 (+ s3-0 1))) (set! (-> this strings s3-1 scale) 0.5) diff --git a/goal_src/jak3/levels/common/race/race-manager.gc b/goal_src/jak3/levels/common/race/race-manager.gc index 43be0e8bd8..5091303985 100644 --- a/goal_src/jak3/levels/common/race/race-manager.gc +++ b/goal_src/jak3/levels/common/race/race-manager.gc @@ -81,14 +81,10 @@ ) ) (vector-normalize! (-> this finish-dir) 1.0) - (let ((f0-16 (vector-vector-xz-distance-squared (-> this start-sphere) (-> this finish-sphere))) - (f1-1 409600.0) - ) - (when (< f0-16 (* f1-1 f1-1)) - (logior! (-> s5-0 flags) (race-mesh-flag rmf0)) - (vector-copy! (-> this finish-dir) (-> this start-dir)) - (set! (-> this finish-sphere quad) (-> this start-sphere quad)) - ) + (when (< (vector-vector-xz-distance-squared (-> this start-sphere) (-> this finish-sphere)) (square 409600.0)) + (logior! (-> s5-0 flags) (race-mesh-flag rmf0)) + (vector-copy! (-> this finish-dir) (-> this start-dir)) + (set! (-> this finish-sphere quad) (-> this start-sphere quad)) ) ) ) @@ -235,13 +231,11 @@ ((logtest? (-> this flags) (racer-state-flags rsf0)) (let ((v1-39 (new 'stack-no-clear 'inline-array 'vector 1))) (vector-! (-> v1-39 0) (-> this position) (the-as vector (-> arg0 info finish-sphere))) - (let ((f0-7 (vector-length-squared (-> v1-39 0))) - (f1-1 (-> arg0 info finish-sphere r)) - ) - (if (and (< f0-7 (* f1-1 f1-1)) (< 0.0 (vector-dot (-> v1-39 0) (-> arg0 info finish-dir)))) - (end-lap this arg0) - ) - ) + (if (and (< (vector-length-squared (-> v1-39 0)) (square (-> arg0 info finish-sphere r))) + (< 0.0 (vector-dot (-> v1-39 0) (-> arg0 info finish-dir))) + ) + (end-lap this arg0) + ) ) ) (else @@ -993,47 +987,49 @@ ) (defmethod save-score ((this race-manager) (arg0 int)) - (local-vars (sv-16 uint) (sv-20 float) (sv-24 symbol) (sv-32 int)) - (set! sv-16 (-> this race-state info score)) - (set! sv-20 (the float arg0)) - (set! sv-24 (the-as symbol #f)) - (set! sv-32 -1) - (when (nonzero? sv-16) - (let ((gp-0 (game-info-method-29 *game-info* (the-as int sv-16))) - (s5-0 (get-highscore-rank *game-info* (the-as int sv-16) sv-20)) - ) - (let ((s4-0 (* (the-as uint (max 0 (- s5-0 gp-0))) (the-as uint (if (= sv-16 3) - 6 - 3 - ) - ) - ) - ) - ) - (when (> s4-0 0) - (set! (-> this finish-sound-id) (the-as sound-id 1)) - (set! sv-24 #t) - (case s5-0 - ((3) - (talker-spawn-func (-> *talker-speech* 51) *entity-pool* (target-pos 0) (the-as region #f)) - ) - ((2) - (talker-spawn-func (-> *talker-speech* 52) *entity-pool* (target-pos 0) (the-as region #f)) - ) - ((1) - (talker-spawn-func (-> *talker-speech* 53) *entity-pool* (target-pos 0) (the-as region #f)) - ) - ) - ) - (set! sv-32 (game-info-method-27 *game-info* (the-as game-score sv-16) sv-20)) - (give *game-info* 'skill (the float s4-0) (the-as handle #f)) + (let ((sv-16 (-> this race-state info score)) + (sv-20 (the float arg0)) + (sv-24 (the-as symbol #f)) ) - (if (and (= s5-0 3) (= gp-0 3) (zero? sv-32)) - (set! sv-24 #t) + (let ((sv-32 -1)) + (when (nonzero? sv-16) + (let ((gp-0 (game-info-method-29 *game-info* (the-as int sv-16))) + (s5-0 (get-highscore-rank *game-info* (the-as int sv-16) sv-20)) + ) + (let ((s4-0 (* (the-as uint (max 0 (- s5-0 gp-0))) (the-as uint (if (= sv-16 3) + 6 + 3 + ) + ) + ) + ) + ) + (when (> s4-0 0) + (set! (-> this finish-sound-id) (the-as sound-id 1)) + (set! sv-24 #t) + (case s5-0 + ((3) + (talker-spawn-func (-> *talker-speech* 51) *entity-pool* (target-pos 0) (the-as region #f)) + ) + ((2) + (talker-spawn-func (-> *talker-speech* 52) *entity-pool* (target-pos 0) (the-as region #f)) + ) + ((1) + (talker-spawn-func (-> *talker-speech* 53) *entity-pool* (target-pos 0) (the-as region #f)) + ) + ) + ) + (set! sv-32 (game-info-method-27 *game-info* (the-as game-score sv-16) sv-20)) + (give *game-info* 'skill (the float s4-0) (the-as handle #f)) + ) + (if (and (= s5-0 3) (= gp-0 3) (zero? sv-32)) + (set! sv-24 #t) + ) ) + ) ) + sv-24 ) - sv-24 ) (defmethod stop-speech ((this race-manager)) diff --git a/goal_src/jak3/levels/common/race/race-mesh.gc b/goal_src/jak3/levels/common/race/race-mesh.gc index 08f460bbff..7be18adc06 100644 --- a/goal_src/jak3/levels/common/race/race-mesh.gc +++ b/goal_src/jak3/levels/common/race/race-mesh.gc @@ -235,26 +235,19 @@ ) (defmethod draw-path-debug ((this race-path) (arg0 rgba) (arg1 rgba)) - (local-vars (sv-32 vector) (sv-48 race-path-sample)) (let ((s0-0 0) (s3-0 1) (s2-0 (+ (-> this sample-count) -1)) (s1-0 (new 'stack-no-clear 'vector)) ) - (set! sv-32 s1-0) - (let ((v1-1 (-> (math-camera-pos) quad))) - (set! (-> sv-32 quad) v1-1) - ) + (vector-copy! s1-0 (math-camera-pos)) (while (< s0-0 (the-as int s2-0)) - (let ((s0-1 (-> this samples s0-0))) - (set! sv-48 (-> this samples s3-0)) - (let ((f0-0 (vector-vector-distance-squared (-> s0-1 pos) s1-0)) - (f1-0 819200.0) - ) - (if (< f0-0 (* f1-0 f1-0)) - (add-debug-line #t (bucket-id debug) (-> s0-1 pos) (-> sv-48 pos) arg0 #f arg1) - ) - ) + (let ((s0-1 (-> this samples s0-0)) + (sv-48 (-> this samples s3-0)) + ) + (if (< (vector-vector-distance-squared (-> s0-1 pos) s1-0) (square 819200.0)) + (add-debug-line #t (bucket-id debug) (-> s0-1 pos) (-> sv-48 pos) arg0 #f arg1) + ) ) (set! s0-0 s3-0) (set! s3-0 (min (+ s3-0 1) (the-as int s2-0))) diff --git a/goal_src/jak3/levels/desert/artifact-race/artifact-race.gc b/goal_src/jak3/levels/desert/artifact-race/artifact-race.gc index a5d1b26799..1d42aee3ae 100644 --- a/goal_src/jak3/levels/desert/artifact-race/artifact-race.gc +++ b/goal_src/jak3/levels/desert/artifact-race/artifact-race.gc @@ -125,9 +125,8 @@ ) (let ((f0-1 (vector-vector-xz-distance-squared (-> this root trans) s5-0)) (f1-2 (fabs (- (-> s5-0 y) (-> this root trans y)))) - (f2-2 (+ 8192.0 (-> s5-0 w))) ) - (when (and (>= (* f2-2 f2-2) f0-1) (< f1-2 32768.0)) + (when (and (>= (square (+ 8192.0 (-> s5-0 w))) f0-1) (< f1-2 32768.0)) (sound-play "artifact-pickup") (+! (-> *game-info* counter) -1.0) (go (method-of-object this die)) @@ -768,7 +767,6 @@ ;; WARN: Return type mismatch object vs none. (defmethod set-time-limit ((this task-manager-desert-artifact-race)) - (local-vars (sv-16 res-tag)) (let ((t9-0 (method-of-type task-manager set-time-limit))) (t9-0 this) ) @@ -826,8 +824,9 @@ ) (let ((a0-18 (-> this ent))) (when a0-18 - (set! sv-16 (new 'static 'res-tag)) - (let ((s5-0 (res-lump-data a0-18 'actor-groups (pointer actor-group) :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (s5-0 (res-lump-data a0-18 'actor-groups (pointer actor-group) :tag-ptr (& sv-16))) + ) (cond ((and s5-0 (nonzero? (-> sv-16 elt-count))) (set! (-> this max-count) (-> s5-0 0 length)) @@ -902,9 +901,7 @@ ) (until (or v1-40 (and *target* (focus-test? *target* pilot))) (suspend) - (let ((f0-6 143360.0)) - (set! v1-40 (< (* f0-6 f0-6) (vector-vector-distance-squared (-> self begin-pos) (target-pos 0)))) - ) + (set! v1-40 (< (square 143360.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/goal_src/jak3/levels/desert/boss/deswalk-obs.gc b/goal_src/jak3/levels/desert/boss/deswalk-obs.gc index 96da254683..5f6f1afe6b 100644 --- a/goal_src/jak3/levels/desert/boss/deswalk-obs.gc +++ b/goal_src/jak3/levels/desert/boss/deswalk-obs.gc @@ -691,7 +691,7 @@ (defmethod ragdoll-method-19 ((this dm-tentacle-ragdoll) (arg0 vector) (arg1 int) (arg2 object) (arg3 matrix)) - (local-vars (f30-0 float) (sv-48 vector)) + (local-vars (f30-0 float)) (rlet ((vf0 :class vf)) (init-vf0-vector) (let ((a0-1 (-> this ragdoll-joints arg1))) @@ -736,14 +736,7 @@ (+ (- f0-13 (* (the float (the int (/ f0-13 65536.0))) 65536.0)) (* 3640.889 (the float (-> this chain-pos)))) ) ) - (let ((s1-0 arg0) - (s0-0 arg0) - ) - (set! sv-48 (-> arg3 rvec)) - (let ((f0-16 (* f30-0 (cos f28-0)))) - (vector+float*! s1-0 s0-0 sv-48 f0-16) - ) - ) + (vector+float*! arg0 arg0 (-> arg3 rvec) (* f30-0 (cos f28-0))) (vector+float*! arg0 arg0 (-> arg3 fvec) (* f30-0 (sin f28-0))) ) ) @@ -856,23 +849,17 @@ ) (set! (-> self ragdoll mode) (the-as uint 3)) ) - (else - (let ((f0-0 81920.0)) - (cond - ((< (* f0-0 f0-0) - (vector-vector-xz-distance-squared (target-pos 0) (-> self ragdoll ragdoll-joints 0 position)) - ) - (set! (-> self ragdoll mode) (the-as uint 0)) - 0 - ) - (else - (if (zero? (-> self ragdoll mode)) - (sound-play "snake-twist" :position (-> self ragdoll ragdoll-joints 0 position)) - ) - (set! (-> self ragdoll mode) (the-as uint 1)) - ) - ) + ((< (square 81920.0) + (vector-vector-xz-distance-squared (target-pos 0) (-> self ragdoll ragdoll-joints 0 position)) ) + (set! (-> self ragdoll mode) (the-as uint 0)) + 0 + ) + (else + (if (zero? (-> self ragdoll mode)) + (sound-play "snake-twist" :position (-> self ragdoll ragdoll-joints 0 position)) + ) + (set! (-> self ragdoll mode) (the-as uint 1)) ) ) (cond @@ -2071,50 +2058,25 @@ (remove-setting! 'target-height) ) :trans (behavior () - (local-vars (sv-16 float) (sv-32 meters)) (cond ((desw-snake-stump-should-be-up?) (ja :num! (seek! max 0.5)) (rider-trans) (rider-post) - (cond - ((< (ja-aframe-num 0) 6.0) - (let* ((gp-0 *setting-control*) - (s5-0 (method-of-object gp-0 set-setting)) - (s4-0 self) - (s3-0 'target-height) - (s2-0 'abs) - (s1-0 lerp-scale) - (s0-0 (-> *CAMERA_MASTER-bank* target-height)) - ) - (set! sv-16 (the-as float 14336.0)) - (let ((a2-1 (ja-aframe-num 0)) - (a3-0 2.0) - (t0-0 6.0) - ) - (s5-0 gp-0 s4-0 s3-0 s2-0 (s1-0 s0-0 sv-16 a2-1 a3-0 t0-0) 0) - ) - ) - ) - (else - (let* ((gp-1 *setting-control*) - (s5-1 (method-of-object gp-1 set-setting)) - (s4-1 self) - (s3-1 'target-height) - (s2-1 'abs) - (s1-1 lerp-scale) - (s0-1 14336.0) - ) - (set! sv-32 (-> *CAMERA_MASTER-bank* target-height)) - (let ((a2-3 (ja-aframe-num 0)) - (a3-2 11.0) - (t0-2 15.0) - ) - (s5-1 gp-1 s4-1 s3-1 s2-1 (s1-1 s0-1 sv-32 a2-3 a3-2 t0-2) 0) - ) + (if (< (ja-aframe-num 0) 6.0) + (set-setting! + 'target-height + 'abs + (lerp-scale (-> *CAMERA_MASTER-bank* target-height) (the-as float 14336.0) (ja-aframe-num 0) 2.0 6.0) + 0 + ) + (set-setting! + 'target-height + 'abs + (lerp-scale 14336.0 (-> *CAMERA_MASTER-bank* target-height) (ja-aframe-num 0) 11.0 15.0) + 0 ) ) - ) (if (ja-done? 0) (go-virtual up) ) @@ -2142,7 +2104,6 @@ (defmethod init-from-entity! ((this desw-snake-stump) (arg0 entity-actor)) "Set up a newly created process from the entity that created it." - (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) @@ -2173,8 +2134,9 @@ (the-as pair 0) ) (set! (-> this actor-group-count) 0) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-22 (res-lump-data arg0 'actor-groups pointer :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-22 (res-lump-data arg0 'actor-groups pointer :tag-ptr (& sv-16))) + ) (cond ((and v1-22 (nonzero? (-> sv-16 elt-count))) (set! (-> this actor-group-count) (the-as int (-> sv-16 elt-count))) diff --git a/goal_src/jak3/levels/desert/boss/terraformer-drone.gc b/goal_src/jak3/levels/desert/boss/terraformer-drone.gc index d3ca0864b7..ee24a82284 100644 --- a/goal_src/jak3/levels/desert/boss/terraformer-drone.gc +++ b/goal_src/jak3/levels/desert/boss/terraformer-drone.gc @@ -697,13 +697,11 @@ ) (let ((a0-6 (handle->process (-> this focus handle)))) (when a0-6 - (let ((f0-3 (vector-vector-distance-squared (-> this root trans) (get-trans (the-as process-focusable a0-6) 0))) - (f1-2 (* 18432.0 (-> this root scale x))) - ) - (if (< f0-3 (* f1-2 f1-2)) - (go (method-of-object this explode)) - ) - ) + (if (< (vector-vector-distance-squared (-> this root trans) (get-trans (the-as process-focusable a0-6) 0)) + (square (* 18432.0 (-> this root scale x))) + ) + (go (method-of-object this explode)) + ) ) ) (cond @@ -1075,19 +1073,11 @@ ) 0 ) + ((< (vector-vector-xz-distance-squared (-> self zigzag-target) (-> self root trans)) (square 40960.0)) + (set! (-> self zigzag-timer) 0) + 0 + ) (else - (let ((f0-9 (vector-vector-xz-distance-squared (-> self zigzag-target) (-> self root trans))) - (f1-3 40960.0) - ) - (cond - ((< f0-9 (* f1-3 f1-3)) - (set! (-> self zigzag-timer) 0) - 0 - ) - (else - ) - ) - ) ) ) ) diff --git a/goal_src/jak3/levels/desert/boss/terraformer-head.gc b/goal_src/jak3/levels/desert/boss/terraformer-head.gc index 3afc2b27a5..0a2fd3fb86 100644 --- a/goal_src/jak3/levels/desert/boss/terraformer-head.gc +++ b/goal_src/jak3/levels/desert/boss/terraformer-head.gc @@ -931,7 +931,6 @@ ) (defbehavior terraformer-head-always terraformer-head ((arg0 symbol) (arg1 float)) - (local-vars (sv-320 int)) (if (and *target* (focus-test? *target* hit)) (terraformer-head-play-speech 2 self) (terraformer-head-play-speech 0 self) @@ -1038,17 +1037,10 @@ ) (logior! (-> self flags) (terraformer-head-flag laser)) (when (not (logtest? (-> self flags) (terraformer-head-flag laser-sound-playing laser-warmup-sound-playing))) - (let ((s5-2 sound-play-by-name) - (sname (static-sound-name "laser-charge")) - (s3-2 (-> self warmup-sound-id)) - (s2-0 1024) - (s1-0 0) - (s0-0 0) - ) - (set! sv-320 0) - (let ((t2-1 (vector<-cspace! (new 'stack-no-clear 'vector) (joint-node terraformer-head-lod0-jg gun_main)))) - (s5-2 (the-as sound-name sname) s3-2 s2-0 s1-0 s0-0 (the-as sound-group sv-320) t2-1) - ) + (sound-play + "laser-charge" + :id (-> self warmup-sound-id) + :position (vector<-cspace! (new 'stack-no-clear 'vector) (joint-node terraformer-head-lod0-jg gun_main)) ) (logior! (-> self flags) (terraformer-head-flag laser-warmup-sound-playing)) ) @@ -2683,7 +2675,6 @@ (defmethod init-from-entity! ((this terraformer-head) (arg0 entity-actor)) "Set up a newly created process from the entity that created it." - (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 38) 0))) (set! (-> s4-0 total-prims) (the-as uint 39)) @@ -3004,12 +2995,13 @@ (set! (-> this very-vulnerable-timer) 0) (set! (-> this flags) (terraformer-head-flag)) (set! (-> this actor-group-count) 0) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-127 (res-lump-data arg0 'actor-groups pointer :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-127 (res-lump-data arg0 'actor-groups (pointer actor-group) :tag-ptr (& sv-16))) + ) (cond ((and v1-127 (nonzero? (-> sv-16 elt-count))) (set! (-> this actor-group-count) (the-as int (-> sv-16 elt-count))) - (set! (-> this actor-group) (the-as (pointer actor-group) v1-127)) + (set! (-> this actor-group) v1-127) ) (else (format 0 "ERROR: ~S: entity missing actor-group!~%" (-> this name)) diff --git a/goal_src/jak3/levels/desert/boss/terraformer-setup.gc b/goal_src/jak3/levels/desert/boss/terraformer-setup.gc index 264cb304d8..27d1b4c1b4 100644 --- a/goal_src/jak3/levels/desert/boss/terraformer-setup.gc +++ b/goal_src/jak3/levels/desert/boss/terraformer-setup.gc @@ -106,13 +106,9 @@ (vector-float*! (-> gp-0 move-dist) s3-1 -2.0) (let ((s3-2 (new 'stack-no-clear 'collide-query))) (let ((a1-20 (new 'stack-no-clear 'bounding-box))) - (let* ((f0-21 409.6) - (f1-9 3072.0) - (f1-11 (* f1-9 f1-9)) - (f2-0 10240.0) - (f0-22 (+ f0-21 (sqrtf (+ f1-11 (* f2-0 f2-0))))) - (v1-38 (new 'stack-no-clear 'vector)) - ) + (let ((f0-22 (+ 409.6 (sqrtf (+ (square 3072.0) (square 10240.0))))) + (v1-38 (new 'stack-no-clear 'vector)) + ) (set-vector! v1-38 f0-22 f0-22 f0-22 1.0) (vector+! (-> a1-20 max) (-> s5-0 collision-pt) v1-38) (vector-! (-> a1-20 min) (-> s5-0 collision-pt) v1-38) @@ -1223,17 +1219,16 @@ ;; WARN: Return type mismatch sound-id vs object. (defbehavior foot-impact terraformer-leg () - (local-vars (sv-256 entity-actor) (sv-272 entity-actor)) (set-zero! *camera-smush-control*) - (let* ((gp-0 lerp-scale) - (s5-0 3686.4) - (s4-0 0.0) - (a2-0 (vector-vector-distance-squared (-> self foot-lock old-position) (target-pos 0))) - (f0-0 204800.0) - (a3-0 (* f0-0 f0-0)) - (f0-2 1024000.0) - (f0-4 (gp-0 s5-0 s4-0 a2-0 a3-0 (* f0-2 f0-2))) - ) + (let ((f0-4 (lerp-scale + 3686.4 + 0.0 + (vector-vector-distance-squared (-> self foot-lock old-position) (target-pos 0)) + (square 204800.0) + (square 1024000.0) + ) + ) + ) (activate! *camera-smush-control* f0-4 75 600 1.1 1.07 (-> *display* camera-clock)) ) (let ((gp-1 (new 'stack-no-clear 'vector))) @@ -1317,26 +1312,14 @@ (let ((t9-24 (method-of-type manipy activate))) (t9-24 s3-4 self "manipy" (the-as pointer #x70004000)) ) - (let ((s4-6 run-function-in-process) - (s2-1 s3-4) - (s1-0 manipy-init) - (s0-0 gp-1) - ) - (set! sv-256 (-> self entity)) - (let ((t0-3 (art-group-get-by-name *level* "skel-bomb-blast" (the-as (pointer level) #f))) - (t1-2 #f) - (t2-2 0) - ) - ((the-as (function object object object object object object object none) s4-6) - s2-1 - s1-0 - s0-0 - sv-256 - t0-3 - t1-2 - t2-2 - ) - ) + (run-now-in-process + s3-4 + manipy-init + gp-1 + (-> self entity) + (art-group-get-by-name *level* "skel-bomb-blast" (the-as (pointer level) #f)) + #f + 0 ) (-> s3-4 ppointer) ) @@ -1384,36 +1367,20 @@ ) ) ) - (let* ((s3-5 (get-process *default-dead-pool* manipy #x20000 1)) - (s4-7 (when s3-5 - (let ((t9-32 (method-of-type manipy activate))) - (t9-32 (the-as manipy s3-5) self "manipy" (the-as pointer #x70004000)) - ) - (let ((s4-8 run-function-in-process) - (s2-2 s3-5) - (s1-1 manipy-init) - (s0-1 gp-1) - ) - (set! sv-272 (-> self entity)) - (let ((t0-4 (art-group-get-by-name *level* "skel-generic-blast" (the-as (pointer level) #f))) - (t1-3 #f) - (t2-3 0) - ) - ((the-as (function object object object object object object object none) s4-8) - s2-2 - s1-1 - s0-1 - sv-272 - t0-4 - t1-3 - t2-3 - ) - ) - ) - (-> s3-5 ppointer) - ) - ) - ) + (let ((s4-7 (process-spawn + manipy + :init manipy-init + gp-1 + (-> self entity) + (art-group-get-by-name *level* "skel-generic-blast" (the-as (pointer level) #f)) + #f + 0 + :name "manipy" + :to self + :stack-size #x20000 + ) + ) + ) (when s4-7 (send-event (ppointer->process s4-7) 'rot-quat s5-1) (send-event (ppointer->process s4-7) 'anim-mode 'play1) @@ -1479,7 +1446,6 @@ ;; WARN: Return type mismatch int vs object. (defbehavior terraformer-leg-update-ik terraformer-leg () - (local-vars (sv-720 int)) (let ((gp-0 (new 'stack-no-clear 'vector))) (cond ((nonzero? (-> self joint-ik)) @@ -1509,17 +1475,9 @@ (else (when (< (terraformer-leg-frames-till-down) 12.0) (set! (-> self last-effect) 0) - (let ((s5-2 sound-play-by-name) - (s4-1 (make-u128 (the-as uint #x6e642d6f7672) (the-as uint #x65732d746e696f6a))) - (s3-0 (new-sound-id)) - (s2-0 1024) - (s1-0 0) - (s0-0 0) - ) - (set! sv-720 0) - (let ((t2-1 (vector<-cspace! (new 'stack-no-clear 'vector) (-> self node-list data 6)))) - (s5-2 (the-as sound-name s4-1) s3-0 s2-0 s1-0 s0-0 (the-as sound-group sv-720) t2-1) - ) + (sound-play + "joint-servo-dn" + :position (vector<-cspace! (new 'stack-no-clear 'vector) (-> self node-list data 6)) ) ) ) @@ -1692,13 +1650,9 @@ ) (vector-! s4-0 (-> (the-as process-drawable s5-0) root trans) s4-0) (set! (-> s4-0 y) 0.0) - (let ((f0-1 (vector-length-squared s4-0)) - (f1-0 1.0) - ) - (if (< f0-1 (* f1-0 f1-0)) - (set! (-> s4-0 x) 1.0) - ) - ) + (if (< (vector-length-squared s4-0) (square 1.0)) + (set! (-> s4-0 x) 1.0) + ) (vector-normalize! s4-0 1.0) (set! (-> s4-0 y) 0.3) (vector-float*! s4-0 s4-0 4096.0) @@ -2044,11 +1998,9 @@ (dotimes (s3-0 s5-0) (let ((s2-0 (handle->process (-> self mines s3-0)))) (when (and (the-as terraformer-mine s2-0) - (let ((f0-0 (vector-vector-distance-squared (-> s4-0 root trans) (-> (the-as terraformer-mine s2-0) root trans))) - (f1-0 32768.0) - ) - (< f0-0 (* f1-0 f1-0)) - ) + (< (vector-vector-distance-squared (-> s4-0 root trans) (-> (the-as terraformer-mine s2-0) root trans)) + (square 32768.0) + ) ) (send-event s4-0 'explode) (send-event s2-0 'explode) @@ -2078,11 +2030,9 @@ ) ) ) - (let ((s5-3 (vector<-cspace! (new 'stack-no-clear 'vector) (joint-node terraformer-lod0-jg main))) - (f0-1 1433600.0) - ) + (let ((s5-3 (vector<-cspace! (new 'stack-no-clear 'vector) (joint-node terraformer-lod0-jg main)))) (cond - ((< (* f0-1 f0-1) (vector-vector-distance-squared s5-3 (target-pos 0))) + ((< (square 1433600.0) (vector-vector-distance-squared s5-3 (target-pos 0))) (set! (-> self mines-to-launch) 0) (set! v0-11 (current-time)) (set! (-> self mine-timer) (the-as time-frame v0-11)) @@ -2339,21 +2289,17 @@ (terraformer-update-mine-vars #f) (when (-> self graph) (let ((gp-0 (-> self graph node (-> self current-node)))) - (let ((f0-1 (vector-vector-distance-squared (-> self root trans) (-> gp-0 position))) - (f1-0 2048.0) + (when (< (vector-vector-distance-squared (-> self root trans) (-> gp-0 position)) (square 2048.0)) + (cond + ((> (-> gp-0 edge-count) 0) + (set! (-> self current-node) (-> self graph edge (-> gp-0 edge-index) dest-node-id)) + ) + (else + (set! (-> self current-node) (the-as uint 0)) + 0 ) - (when (< f0-1 (* f1-0 f1-0)) - (cond - ((> (-> gp-0 edge-count) 0) - (set! (-> self current-node) (-> self graph edge (-> gp-0 edge-index) dest-node-id)) - ) - (else - (set! (-> self current-node) (the-as uint 0)) - 0 - ) - ) - (set! gp-0 (-> self graph node (-> self current-node))) ) + (set! gp-0 (-> self graph node (-> self current-node))) ) (vector-seek! (-> self root trans) (-> gp-0 position) 2048.0) (let ((s5-0 (quaternion->matrix (new 'stack-no-clear 'matrix) (-> self root quat))) diff --git a/goal_src/jak3/levels/desert/chase/desert-chase.gc b/goal_src/jak3/levels/desert/chase/desert-chase.gc index ee637601b7..5659cbad23 100644 --- a/goal_src/jak3/levels/desert/chase/desert-chase.gc +++ b/goal_src/jak3/levels/desert/chase/desert-chase.gc @@ -468,9 +468,7 @@ (send-event (handle->process gp-5) 'ai-set-target-speed 122880.0) (send-event (handle->process gp-5) 'ai-set-target-position *stronghold-vehicle-stop-point*) ) - (while (let ((f0-1 81920.0)) - (< (* f0-1 f0-1) (vector-vector-distance-squared (target-pos 0) *stronghold-vehicle-stop-point*)) - ) + (while (< (square 81920.0) (vector-vector-distance-squared (target-pos 0) *stronghold-vehicle-stop-point*)) (suspend) ) (process-spawn @@ -1036,10 +1034,8 @@ (vector-copy! s5-0 (-> a1-4 root root-prim prim-core world-sphere)) ) ) - (let ((f0-1 (vector-vector-distance-squared (-> this root trans) s5-0)) - (f1-1 (+ 12288.0 (-> s5-0 w))) - ) - (when (>= (* f1-1 f1-1) f0-1) + (let ((f0-1 (vector-vector-distance-squared (-> this root trans) s5-0))) + (when (>= (square (+ 12288.0 (-> s5-0 w))) f0-1) (sound-play "artifact-pickup") (deactivate this) ) @@ -1234,11 +1230,8 @@ (defmethod deschase-vehicle-control-method-10 ((this deschase-vehicle-control)) (let ((v1-3 (as-type (handle->process (-> this vehicle)) process-focusable))) (when v1-3 - (let* ((s5-1 (-> this path node (-> this i-node))) - (f0-0 (vector-vector-distance-squared (-> v1-3 root trans) (-> s5-1 position))) - (f1-0 40960.0) - ) - (when (< f0-0 (* f1-0 f1-0)) + (let ((s5-1 (-> this path node (-> this i-node)))) + (when (< (vector-vector-distance-squared (-> v1-3 root trans) (-> s5-1 position)) (square 40960.0)) (let ((v1-7 (-> s5-1 next-node))) (if (!= v1-7 -1) (set! (-> this i-node) v1-7) diff --git a/goal_src/jak3/levels/desert/chase/desert-jump.gc b/goal_src/jak3/levels/desert/chase/desert-jump.gc index ae3c0f9a6d..9051d9bc08 100644 --- a/goal_src/jak3/levels/desert/chase/desert-jump.gc +++ b/goal_src/jak3/levels/desert/chase/desert-jump.gc @@ -317,10 +317,8 @@ (vector-copy! s5-0 (-> a1-4 root root-prim prim-core world-sphere)) ) ) - (let ((f0-1 (vector-vector-distance-squared (-> this root trans) s5-0)) - (f1-1 (+ 12288.0 (-> s5-0 w))) - ) - (when (>= (* f1-1 f1-1) f0-1) + (let ((f0-1 (vector-vector-distance-squared (-> this root trans) s5-0))) + (when (>= (square (+ 12288.0 (-> s5-0 w))) f0-1) (talker-spawn-func (-> *talker-speech* 128) *entity-pool* (target-pos 0) (the-as region #f)) (send-event (handle->process (-> this arrow)) 'die) (go (method-of-object this die)) @@ -643,12 +641,7 @@ (('notify) (when (= (-> arg3 param 0) 'attack) (let ((v1-2 (as-type arg0 projectile))) - (if (and v1-2 (let ((f0-0 (vector-vector-distance-squared (-> v1-2 root trans) *desjump-wasdoors-pos*)) - (f1-0 20480.0) - ) - (< f0-0 (* f1-0 f1-0)) - ) - ) + (if (and v1-2 (< (vector-vector-distance-squared (-> v1-2 root trans) *desjump-wasdoors-pos*) (square 20480.0))) (damage-airlock this 1) ) ) @@ -910,10 +903,7 @@ (s2-1 (= (+ (length (-> *desjump-vehicle-path* (-> s4-1 path-type))) -1) (-> s4-1 path-pos))) ) (let ((f30-0 (vector-vector-distance-squared (-> s1-0 pos) (-> s3-0 root trans)))) - (when (and (not s2-1) (let ((f0-1 81920.0)) - (< f30-0 (* f0-1 f0-1)) - ) - ) + (when (and (not s2-1) (< f30-0 (square 81920.0))) (+! (-> s4-1 path-pos) 1) (send-event s3-0 @@ -925,12 +915,7 @@ (send-event s3-0 'ai-set-target-process *target*) ) ) - (when (and s2-1 - (let ((f0-4 122880.0)) - (< f30-0 (* f0-4 f0-4)) - ) - (not (-> s4-1 ready?)) - ) + (when (and s2-1 (< f30-0 (square 122880.0)) (not (-> s4-1 ready?))) (send-event s3-0 'ai-set-mode 0) (send-event s3-0 'ai-set-target-speed 0) (set-time! (-> s4-1 wait-timer)) @@ -988,10 +973,7 @@ ) (cond ((-> s3-1 kamikaze?) - (when (and (not s2-3) (let ((f1-3 81920.0)) - (< f0-9 (* f1-3 f1-3)) - ) - ) + (when (and (not s2-3) (< f0-9 (square 81920.0))) (+! (-> s3-1 path-pos) 1) (send-event s4-3 diff --git a/goal_src/jak3/levels/desert/chase/wcar-catapult.gc b/goal_src/jak3/levels/desert/chase/wcar-catapult.gc index e205178f06..51110846f5 100644 --- a/goal_src/jak3/levels/desert/chase/wcar-catapult.gc +++ b/goal_src/jak3/levels/desert/chase/wcar-catapult.gc @@ -1408,14 +1408,10 @@ ) ) (((projectile-options po0 po1)) - (let ((f0-0 (vector-vector-distance-squared (-> this self root trans) (-> this desired-target-pos))) - (f1-0 614400.0) - ) - (when (< f0-0 (* f1-0 f1-0)) - (let ((a0-9 (static-sound-spec "incoming" :group 0 :volume 0.0))) - (set! (-> a0-9 volume) 1024) - (sound-play-by-spec a0-9 (-> this sound-id) (-> this root trans)) - ) + (when (< (vector-vector-distance-squared (-> this self root trans) (-> this desired-target-pos)) (square 614400.0)) + (let ((a0-9 (static-sound-spec "incoming" :group 0 :volume 0.0))) + (set! (-> a0-9 volume) 1024) + (sound-play-by-spec a0-9 (-> this sound-id) (-> this root trans)) ) ) ) diff --git a/goal_src/jak3/levels/desert/des-bush.gc b/goal_src/jak3/levels/desert/des-bush.gc index a314d721e1..1a4b066cae 100644 --- a/goal_src/jak3/levels/desert/des-bush.gc +++ b/goal_src/jak3/levels/desert/des-bush.gc @@ -595,7 +595,6 @@ ) (defmethod set-time-limit ((this task-manager-desert-bbush-ring)) - (local-vars (sv-16 res-tag)) (let ((t9-0 (method-of-type task-manager set-time-limit))) (t9-0 this) ) @@ -607,13 +606,14 @@ (let ((a0-8 (entity-by-name (get-mgr-name this)))) (when a0-8 (set! (-> this entity) (the-as entity-actor a0-8)) - (set! sv-16 (new 'static 'res-tag)) - (let ((s5-2 (res-lump-data a0-8 'actor-groups pointer :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (s5-2 (res-lump-data a0-8 'actor-groups (pointer actor-group) :tag-ptr (& sv-16))) + ) (format 0 "elt-count: ~d" (-> sv-16 elt-count)) (cond ((and s5-2 (nonzero? (-> sv-16 elt-count))) (set! (-> this actor-group-count) (the-as int (-> sv-16 elt-count))) - (set! (-> this actor-group) (the-as (pointer actor-group) s5-2)) + (set! (-> this actor-group) s5-2) ) (else (format 0 "ERROR: ~s: entity missing actor-group!~%" (game-task->string (-> this node-info task))) @@ -1427,7 +1427,6 @@ ;; WARN: Return type mismatch float vs none. (defmethod set-time-limit ((this task-manager-bbush-egg-spider)) - (local-vars (sv-16 res-tag)) (let ((t9-0 (method-of-type task-manager set-time-limit))) (t9-0 this) ) @@ -1449,12 +1448,13 @@ (set! (-> this goal-score) (res-lump-value s5-0 'goal-score uint :default (the-as uint128 80) :time -1000000000.0) ) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-20 (res-lump-data s5-0 'actor-groups pointer :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-20 (res-lump-data s5-0 'actor-groups (pointer actor-group) :tag-ptr (& sv-16))) + ) (cond ((and v1-20 (nonzero? (-> sv-16 elt-count))) (set! (-> this actor-group-count) (the-as int (-> sv-16 elt-count))) - (set! (-> this actor-group) (the-as (pointer actor-group) v1-20)) + (set! (-> this actor-group) v1-20) ) (else (format 0 "ERROR: ~s: entity missing actor-group!~%" (game-task->string (-> this node-info task))) @@ -1665,7 +1665,6 @@ ;; WARN: Return type mismatch object vs none. (defmethod set-time-limit ((this task-manager-bbush-spirit-chase)) - (local-vars (sv-16 res-tag)) (let ((t9-0 (method-of-type task-manager set-time-limit))) (t9-0 this) ) @@ -1683,12 +1682,13 @@ (set! (-> this start-offset-vel) (res-lump-float s5-2 'start-offset-vel :default 20480.0)) (format #t "new-vel: ~f~%" (/ (-> this start-offset-vel) METER_LENGTH)) (set! (-> this entity) (the-as entity-actor s5-2)) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-19 (res-lump-data s5-2 'actor-groups pointer :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-19 (res-lump-data s5-2 'actor-groups (pointer actor-group) :tag-ptr (& sv-16))) + ) (cond ((and v1-19 (nonzero? (-> sv-16 elt-count))) (set! (-> this actor-group-count) (the-as int (-> sv-16 elt-count))) - (set! (-> this actor-group) (the-as (pointer actor-group) v1-19)) + (set! (-> this actor-group) v1-19) ) (else (format 0 "ERROR: ~s: entity missing actor-group!~%" (game-task->string (-> this node-info task))) @@ -1723,7 +1723,6 @@ (set! (-> self current-curve-distance) 0.0) ) :trans (behavior () - (local-vars (sv-240 vector) (sv-256 vector) (sv-272 vector)) (rlet ((vf0 :class vf) (vf1 :class vf) (vf2 :class vf) @@ -1746,8 +1745,8 @@ (let ((s2-0 s4-0) (s1-0 (method-of-type cubic-curve cubic-curve-method-9)) (s0-0 (-> s3-0 trans)) + (sv-240 (new 'stack-no-clear 'vector)) ) - (set! sv-240 (new 'stack-no-clear 'vector)) (let ((v0-1 (vector-z-quaternion! (new 'stack-no-clear 'vector) (-> s3-0 quat))) (f0-3 204800.0) ) @@ -1759,20 +1758,22 @@ (.add.x.vf.w vf1 vf0 vf0) (.mul.x.vf.xyz vf1 vf1 vf2) (.svf (&-> sv-240 quad) vf1) - (set! sv-256 (-> s5-0 trans)) - (set! sv-272 (new 'stack-no-clear 'vector)) - (let ((v0-2 (vector-z-quaternion! (new 'stack-no-clear 'vector) (-> s5-0 quat))) - (f0-4 204800.0) + (let ((sv-256 (-> s5-0 trans)) + (sv-272 (new 'stack-no-clear 'vector)) + ) + (let ((v0-2 (vector-z-quaternion! (new 'stack-no-clear 'vector) (-> s5-0 quat))) + (f0-4 204800.0) + ) + (.lvf vf1 (&-> v0-2 quad)) + (let ((v1-19 f0-4)) + (.mov vf2 v1-19) ) - (.lvf vf1 (&-> v0-2 quad)) - (let ((v1-19 f0-4)) - (.mov vf2 v1-19) ) + (.add.x.vf.w vf1 vf0 vf0) + (.mul.x.vf.xyz vf1 vf1 vf2) + (.svf (&-> sv-272 quad) vf1) + (s1-0 s2-0 s0-0 sv-240 sv-256 sv-272) ) - (.add.x.vf.w vf1 vf0 vf0) - (.mul.x.vf.xyz vf1 vf1 vf2) - (.svf (&-> sv-272 quad) vf1) - (s1-0 s2-0 s0-0 sv-240 sv-256 sv-272) ) (set! (-> self current-curve-length) (vector-vector-distance (-> s3-0 trans) (-> s5-0 trans))) (cubic-curve-method-10 s4-0 (-> self trans) (- (-> self path-pos) (the float gp-0))) @@ -1824,22 +1825,16 @@ (send-event self 'complete) ) ) - (let ((f0-36 (-> self fail-radius))) - (if (< (* f0-36 f0-36) (vector-vector-distance-squared (target-pos 0) (-> self trans))) - (send-event self 'fail) - ) - ) + (if (< (square (-> self fail-radius)) (vector-vector-distance-squared (target-pos 0) (-> self trans))) + (send-event self 'fail) + ) ) (else (set-time! (-> self state-time)) - (let ((f0-39 (vector-vector-distance-squared (target-pos 0) (-> self trans))) - (f1-23 20480.0) - ) - (when (< f0-39 (* f1-23 f1-23)) - (set! (-> self touched) #t) - (sound-play "start-pickup") - (send-event (handle->process (-> self spirit)) 'play-pixie) - ) + (when (< (vector-vector-distance-squared (target-pos 0) (-> self trans)) (square 20480.0)) + (set! (-> self touched) #t) + (sound-play "start-pickup") + (send-event (handle->process (-> self spirit)) 'play-pixie) ) (if (< 409600.0 (vector-vector-distance (target-pos 0) (-> self trans))) (send-event self 'fail) @@ -1978,24 +1973,20 @@ :trans (behavior () (spawn (-> self part) (-> self root trans)) (/ (the float (- (current-time) (-> self state-time))) (-> self traj time)) - (let ((f0-3 (vector-vector-distance-squared (target-pos 0) (-> self root trans))) - (f1-1 (-> self pickup-radius)) - ) - (when (< f0-3 (* f1-1 f1-1)) - (send-event (ppointer->process (-> self parent)) 'score (-> self score)) - (case (-> self bb-score-type) - (((bb-score-type small)) - (sound-play "small-pickup") - ) - (((bb-score-type medium)) - (sound-play "medium-pickup") - ) - (((bb-score-type large)) - (sound-play "large-pickup") - ) - ) - (go-virtual die) + (when (< (vector-vector-distance-squared (target-pos 0) (-> self root trans)) (square (-> self pickup-radius))) + (send-event (ppointer->process (-> self parent)) 'score (-> self score)) + (case (-> self bb-score-type) + (((bb-score-type small)) + (sound-play "small-pickup") + ) + (((bb-score-type medium)) + (sound-play "medium-pickup") + ) + (((bb-score-type large)) + (sound-play "large-pickup") + ) ) + (go-virtual die) ) ) :code (behavior () @@ -2210,7 +2201,6 @@ ;; WARN: Return type mismatch object vs none. (defmethod set-time-limit ((this task-manager-bbush-spirit-drop)) - (local-vars (sv-16 res-tag)) (let ((t9-0 (method-of-type task-manager set-time-limit))) (t9-0 this) ) @@ -2231,12 +2221,13 @@ (set! (-> this min-spirit-vel) (res-lump-float s5-2 'min-spirit-vel :default 163840.0)) (set! (-> this high-spirit-vel) (res-lump-float s5-2 'high-spirit-vel :default 163840.0)) (set! (-> this fail-radius) (res-lump-float s5-2 'fail-radius :default 655360.0)) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-16 (res-lump-data s5-2 'actor-groups pointer :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-16 (res-lump-data s5-2 'actor-groups (pointer actor-group) :tag-ptr (& sv-16))) + ) (cond ((and v1-16 (nonzero? (-> sv-16 elt-count))) (set! (-> this actor-group-count) (the-as int (-> sv-16 elt-count))) - (set! (-> this actor-group) (the-as (pointer actor-group) v1-16)) + (set! (-> this actor-group) v1-16) (spawn-drops this) ) (else @@ -2296,7 +2287,6 @@ ) ) :trans (behavior () - (local-vars (sv-240 vector) (sv-256 vector) (sv-272 vector)) (rlet ((vf0 :class vf) (vf1 :class vf) (vf2 :class vf) @@ -2320,8 +2310,8 @@ (let ((s2-0 s4-0) (s1-0 (method-of-type cubic-curve cubic-curve-method-9)) (s0-0 (-> s3-0 trans)) + (sv-240 (new 'stack-no-clear 'vector)) ) - (set! sv-240 (new 'stack-no-clear 'vector)) (let ((v0-1 (vector-z-quaternion! (new 'stack-no-clear 'vector) (-> s3-0 quat))) (f0-5 204800.0) ) @@ -2333,20 +2323,22 @@ (.add.x.vf.w vf1 vf0 vf0) (.mul.x.vf.xyz vf1 vf1 vf2) (.svf (&-> sv-240 quad) vf1) - (set! sv-256 (-> s5-0 trans)) - (set! sv-272 (new 'stack-no-clear 'vector)) - (let ((v0-2 (vector-z-quaternion! (new 'stack-no-clear 'vector) (-> s5-0 quat))) - (f0-6 204800.0) + (let ((sv-256 (-> s5-0 trans)) + (sv-272 (new 'stack-no-clear 'vector)) + ) + (let ((v0-2 (vector-z-quaternion! (new 'stack-no-clear 'vector) (-> s5-0 quat))) + (f0-6 204800.0) + ) + (.lvf vf1 (&-> v0-2 quad)) + (let ((v1-21 f0-6)) + (.mov vf2 v1-21) ) - (.lvf vf1 (&-> v0-2 quad)) - (let ((v1-21 f0-6)) - (.mov vf2 v1-21) ) + (.add.x.vf.w vf1 vf0 vf0) + (.mul.x.vf.xyz vf1 vf1 vf2) + (.svf (&-> sv-272 quad) vf1) + (s1-0 s2-0 s0-0 sv-240 sv-256 sv-272) ) - (.add.x.vf.w vf1 vf0 vf0) - (.mul.x.vf.xyz vf1 vf1 vf2) - (.svf (&-> sv-272 quad) vf1) - (s1-0 s2-0 s0-0 sv-240 sv-256 sv-272) ) (set! (-> self current-curve-length) (vector-vector-distance (-> s3-0 trans) (-> s5-0 trans))) (cubic-curve-method-10 s4-0 (-> self trans) (- (-> self path-pos) (the float gp-0))) @@ -2395,13 +2387,9 @@ ) ) (else - (let ((f0-32 (vector-vector-distance-squared (target-pos 0) (-> self trans))) - (f1-17 20480.0) - ) - (when (< f0-32 (* f1-17 f1-17)) - (set! (-> self touched) #t) - (sound-play "start-pickup") - ) + (when (< (vector-vector-distance-squared (target-pos 0) (-> self trans)) (square 20480.0)) + (set! (-> self touched) #t) + (sound-play "start-pickup") ) ) ) diff --git a/goal_src/jak3/levels/desert/desert-dust-storm.gc b/goal_src/jak3/levels/desert/desert-dust-storm.gc index e39b590616..7f29018a7f 100644 --- a/goal_src/jak3/levels/desert/desert-dust-storm.gc +++ b/goal_src/jak3/levels/desert/desert-dust-storm.gc @@ -314,8 +314,7 @@ (set! f0-13 20.0) ) (let* ((f2-1 (/ f1-2 f2-0)) - (f1-4 (fmax 0.0 (fmin 1.0 f2-1))) - (f1-5 (* f1-4 f1-4)) + (f1-5 (square (fmax 0.0 (fmin 1.0 f2-1)))) (f2-3 *duststorm-intensity*) ) (set! (-> arg2 coneradius) (lerp (* 48.0 f2-3) (* f2-3 f0-13) f1-5)) @@ -462,7 +461,6 @@ ;; WARN: Return type mismatch symbol vs none. (defmethod desert-dust-storm-method-19 ((this desert-dust-storm)) - (local-vars (sv-80 vector) (sv-96 vector) (sv-112 vector)) (set! *duststorm-intensity* (fmax 0.0 (fmin 1.0 (-> this intensity)))) (set! *duststorm-wind-vel* (lerp 8192.0 20480.0 (-> this wind-speed))) (set! *duststorm-wind-vel* (* *duststorm-wind-vel* *duststorm-intensity*)) @@ -476,53 +474,45 @@ ) (dotimes (s2-0 15) (vector-copy! s3-0 (-> this origin)) - (let ((s1-0 s3-0) - (s0-0 s3-0) - ) - (set! sv-80 s5-0) - (let* ((f30-0 4096.0) - (f28-0 1.5) - (f26-0 -6.5) - (v1-11 (/ (the-as int (rand-uint31-gen *random-generator*)) 256)) - (v1-12 (the-as number (logior #x3f800000 v1-11))) - (f0-14 (* f30-0 (+ f28-0 (* f26-0 (+ -1.0 (the-as float v1-12)))))) - ) - (vector+float*! s1-0 s0-0 sv-80 f0-14) - ) + (let* ((s1-0 s3-0) + (s0-0 s3-0) + (sv-80 s5-0) + (f30-0 4096.0) + (f28-0 1.5) + (f26-0 -6.5) + (v1-11 (/ (the-as int (rand-uint31-gen *random-generator*)) 256)) + (v1-12 (the-as number (logior #x3f800000 v1-11))) + ) + (vector+float*! s1-0 s0-0 sv-80 (* f30-0 (+ f28-0 (* f26-0 (+ -1.0 (the-as float v1-12)))))) ) - (let ((s1-2 s3-0) - (s0-1 s3-0) - ) - (set! sv-96 s4-1) - (let* ((f30-1 4096.0) - (f28-1 -8.0) - (f26-1 16.0) - (v1-18 (/ (the-as int (rand-uint31-gen *random-generator*)) 256)) - (v1-19 (the-as number (logior #x3f800000 v1-18))) - (f0-20 (* f30-1 (+ f28-1 (* f26-1 (+ -1.0 (the-as float v1-19)))))) - ) - (vector+float*! s1-2 s0-1 sv-96 f0-20) - ) + (let* ((s1-2 s3-0) + (s0-1 s3-0) + (sv-96 s4-1) + (f30-1 4096.0) + (f28-1 -8.0) + (f26-1 16.0) + (v1-18 (/ (the-as int (rand-uint31-gen *random-generator*)) 256)) + (v1-19 (the-as number (logior #x3f800000 v1-18))) + ) + (vector+float*! s1-2 s0-1 sv-96 (* f30-1 (+ f28-1 (* f26-1 (+ -1.0 (the-as float v1-19)))))) ) - (let ((s1-4 s3-0) - (s0-2 s3-0) - ) - (set! sv-112 *up-vector*) - (let* ((f30-2 4096.0) - (f28-2 -1.0) - (f26-2 61.0) - (v1-26 (/ (the-as int (rand-uint31-gen *random-generator*)) 256)) - (v1-27 (the-as number (logior #x3f800000 v1-26))) - (f0-26 (* f30-2 (+ f28-2 (* f26-2 (+ -1.0 (the-as float v1-27)))))) - ) - (vector+float*! s1-4 s0-2 sv-112 f0-26) - ) + (let* ((s1-4 s3-0) + (s0-2 s3-0) + (sv-112 *up-vector*) + (f30-2 4096.0) + (f28-2 -1.0) + (f26-2 61.0) + (v1-26 (/ (the-as int (rand-uint31-gen *random-generator*)) 256)) + (v1-27 (the-as number (logior #x3f800000 v1-26))) + ) + (vector+float*! s1-4 s0-2 sv-112 (* f30-2 (+ f28-2 (* f26-2 (+ -1.0 (the-as float v1-27)))))) ) (set! (-> *part-id-table* 1421 init-specs 2 initial-valuef) 61440.0) (set! (-> *part-id-table* 1422 init-specs 2 initial-valuef) 61440.0) + ;; og:preserve-this fix particles spawning every frame no matter what (we know 5 ticks = 1/60 frame) (#cond (PC_PORT - (when (>= (- (-> this clock frame-counter) (-> *duststorm-helper* sparticle-time)) 5) ;; og:preserve-this fix particles spawning every frame no matter what (we know 5 ticks = 1/60 frame) + (when (>= (- (-> this clock frame-counter) (-> *duststorm-helper* sparticle-time)) 5) (set! (-> *duststorm-helper* sparticle-time) (-> this clock frame-counter)) (if (-> this is-intro?) (launch-particles (-> *part-id-table* 1422) s3-0) diff --git a/goal_src/jak3/levels/desert/desert-scenes.gc b/goal_src/jak3/levels/desert/desert-scenes.gc index 5607f98883..4babb5d2cb 100644 --- a/goal_src/jak3/levels/desert/desert-scenes.gc +++ b/goal_src/jak3/levels/desert/desert-scenes.gc @@ -1365,19 +1365,10 @@ (let ((s3-0 (new 'stack-no-clear 'vector))) (vector-segment-distance-point! (-> (the-as process-drawable gp-0) root trans) a1-1 s5-0 s3-0) (cond - ((and (= *nest-hunt-res-index* s4-0) (let ((f0-0 (vector-vector-distance-squared s3-0 s5-0)) - (f1-0 20480.0) - ) - (< f0-0 (* f1-0 f1-0)) - ) - ) + ((and (= *nest-hunt-res-index* s4-0) (< (vector-vector-distance-squared s3-0 s5-0) (square 20480.0))) (send-event gp-0 'ai-set-target-speed 40960.0) ) - ((let ((f0-1 (vector-vector-distance-squared s3-0 s5-0)) - (f1-3 20480.0) - ) - (< f0-1 (* f1-3 f1-3)) - ) + ((< (vector-vector-distance-squared s3-0 s5-0) (square 20480.0)) (if (< *nest-hunt-res-index* s4-0) (set! *nest-hunt-res-index* (+ *nest-hunt-res-index* 1)) ) diff --git a/goal_src/jak3/levels/desert/hover/des-beast-2.gc b/goal_src/jak3/levels/desert/hover/des-beast-2.gc index d3fdf56db4..8eb1678c0c 100644 --- a/goal_src/jak3/levels/desert/hover/des-beast-2.gc +++ b/goal_src/jak3/levels/desert/hover/des-beast-2.gc @@ -100,23 +100,19 @@ (set! (-> self minimap) #f) ) :trans (behavior () - (let ((f0-0 (vector-vector-xz-distance-squared (target-pos 0) (-> self root trans))) - (f1-0 24576.0) - ) - (when (< f0-0 (* f1-0 f1-0)) - (let* ((v1-5 (-> *game-info* sub-task-list (game-task-node desert-beast-battle-resolution))) - (a0-4 (handle->process (if (-> v1-5 manager) - (-> v1-5 manager manager) - (the-as handle #f) - ) - ) - ) - ) - (when a0-4 - (if (send-event a0-4 'complete) - (go-virtual die) - ) - ) + (when (< (vector-vector-xz-distance-squared (target-pos 0) (-> self root trans)) (square 24576.0)) + (let* ((v1-5 (-> *game-info* sub-task-list (game-task-node desert-beast-battle-resolution))) + (a0-4 (handle->process (if (-> v1-5 manager) + (-> v1-5 manager manager) + (the-as handle #f) + ) + ) + ) + ) + (when a0-4 + (if (send-event a0-4 'complete) + (go-virtual die) + ) ) ) ) @@ -570,14 +566,6 @@ #f ) :post (behavior () - (local-vars - (sv-336 float) - (sv-496 vector) - (sv-500 float) - (sv-504 int) - (sv-512 (inline-array desbeast-node)) - (sv-516 vector) - ) (cond (#f (let ((s3-0 (-> self target-gun-pos)) @@ -608,18 +596,10 @@ (vector-normalize-copy! (new 'stack-no-clear 'vector) (-> s5-1 1) 1.0) ) ) - (let ((f0-6 1.0) - (f1-1 (-> s5-1 2 y)) - ) - (set! (-> s5-1 2 w) (- f0-6 (* f1-1 f1-1))) - ) + (set! (-> s5-1 2 w) (- 1.0 (square (-> s5-1 2 y)))) (set! (-> s5-1 3 x) (* 2.0 (-> s5-1 2 z) (-> s5-1 2 y) (-> s5-1 2 x))) - (let ((f0-12 (-> s5-1 2 x))) - (set! (-> s5-1 3 y) (- (* f0-12 f0-12))) - ) - (let ((f0-16 (-> s5-1 3 x))) - (set! (-> s5-1 3 z) (- (* f0-16 f0-16) (* 4.0 (-> s5-1 3 y) (-> s5-1 2 w)))) - ) + (set! (-> s5-1 3 y) (- (square (-> s5-1 2 x)))) + (set! (-> s5-1 3 z) (- (square (-> s5-1 3 x)) (* 4.0 (-> s5-1 3 y) (-> s5-1 2 w)))) (when (>= (-> s5-1 3 z) 0.0) (let ((f0-22 (- (-> s5-1 3 x))) (f1-12 (sqrtf (-> s5-1 3 z))) @@ -635,7 +615,7 @@ ) (let ((f1-20 (/ (-> s5-1 2 x) (meters 30)))) (set! (-> gp-1 y) - (fmin (+ 327680.0 (-> self root trans y)) (+ 20480.0 (* 9216.0 (* f1-20 f1-20)) (-> gp-1 y))) + (fmin (+ 327680.0 (-> self root trans y)) (+ 20480.0 (* 9216.0 (square f1-20)) (-> gp-1 y))) ) ) ) @@ -648,14 +628,15 @@ (let ((s3-2 (vector-! (new 'stack-no-clear 'vector) (-> self target-gun-pos) s5-2)) (s4-3 (new 'stack-no-clear 'vector)) ) - (let ((f0-34 (vector-length s3-2))) - (set! sv-336 (the-as float 0.0)) + (let ((f0-34 (vector-length s3-2)) + (sv-336 (the-as float 0.0)) + ) (let ((f0-35 (fmin 819200.0 f0-34))) (vector-normalize! s3-2 f0-35) ) + (vector+! s4-3 s5-2 s3-2) + (set! sv-336 (the-as float 122880.0)) ) - (vector+! s4-3 s5-2 s3-2) - (set! sv-336 (the-as float 122880.0)) (setup-from-to-height! gp-2 s5-2 s4-3 32768.0 -36864.0) ) (vector-copy! (-> self shot-velocity) (-> gp-2 initial-velocity)) @@ -691,43 +672,47 @@ ) (let ((gp-7 *target*)) (when gp-7 - (set! sv-496 (new 'stack-no-clear 'vector)) - (set! sv-500 (the-as float 0.0)) - (set! sv-504 -1) - (set! sv-512 (-> self des-path node)) - (let ((s5-5 (new 'stack-no-clear 'vector))) - (vector-copy! s5-5 (get-trans gp-7 0)) - (set! sv-516 s5-5) - ) - (vector+float*! - sv-516 - sv-516 - (vector-z-quaternion! (new 'stack-no-clear 'vector) (get-quat gp-7 0)) - (-> self follow-distance) - ) - (dotimes (gp-8 (the-as int (+ (-> self des-path node-count) -1))) - (let* ((a1-30 (-> sv-512 gp-8)) - (a2-9 (-> sv-512 (+ gp-8 1))) - (s5-8 (new 'stack-no-clear 'vector)) - (f0-47 (vector-segment-distance-point! sv-516 (-> a1-30 position) (-> a2-9 position) s5-8)) - ) - (when (or (= sv-504 -1) (< f0-47 sv-500)) - (set! sv-500 f0-47) - (set! sv-504 gp-8) - (vector-copy! sv-496 s5-8) + (let ((sv-496 (new 'stack-no-clear 'vector)) + (sv-500 (the-as float 0.0)) + (sv-504 -1) + ) + (let ((sv-512 (-> self des-path node)) + (s5-5 (new 'stack-no-clear 'vector)) + ) + (vector-copy! s5-5 (get-trans gp-7 0)) + (let ((sv-516 s5-5)) + (vector+float*! + sv-516 + sv-516 + (vector-z-quaternion! (new 'stack-no-clear 'vector) (get-quat gp-7 0)) + (-> self follow-distance) + ) + (dotimes (gp-8 (the-as int (+ (-> self des-path node-count) -1))) + (let* ((a1-30 (-> sv-512 gp-8)) + (a2-9 (-> sv-512 (+ gp-8 1))) + (s5-8 (new 'stack-no-clear 'vector)) + (f0-47 (vector-segment-distance-point! sv-516 (-> a1-30 position) (-> a2-9 position) s5-8)) + ) + (when (or (= sv-504 -1) (< f0-47 sv-500)) + (set! sv-500 f0-47) + (set! sv-504 gp-8) + (vector-copy! sv-496 s5-8) + ) + ) + ) ) ) - ) - (when (!= sv-504 -1) - (let* ((s4-5 (-> self root trans)) - (s5-9 (new 'stack-no-clear 'inline-array 'vector 2)) - (f30-2 (vector-vector-distance s4-5 sv-496)) - ) - (if (< (vector-dot (vector-! (-> s5-9 0) sv-496 s4-5) (vector-z-quaternion! (-> s5-9 1) (-> self root quat))) 0.0) - (set! f30-2 (* -1.0 f30-2)) + (when (!= sv-504 -1) + (let* ((s4-5 (-> self root trans)) + (s5-9 (new 'stack-no-clear 'inline-array 'vector 2)) + (f30-2 (vector-vector-distance s4-5 sv-496)) + ) + (if (< (vector-dot (vector-! (-> s5-9 0) sv-496 s4-5) (vector-z-quaternion! (-> s5-9 1) (-> self root quat))) 0.0) + (set! f30-2 (* -1.0 f30-2)) + ) + (let ((f0-53 (* (lerp-scale -0.7 0.7 f30-2 -245760.0 245760.0) (lerp-scale 1.0 0.0 sv-500 122880.0 983040.0)))) + (seek! (-> self main-speed-factor-dest) (+ 0.8 f0-53) (* 0.6 (seconds-per-frame))) ) - (let ((f0-53 (* (lerp-scale -0.7 0.7 f30-2 -245760.0 245760.0) (lerp-scale 1.0 0.0 sv-500 122880.0 983040.0)))) - (seek! (-> self main-speed-factor-dest) (+ 0.8 f0-53) (* 0.6 (seconds-per-frame))) ) ) ) diff --git a/goal_src/jak3/levels/desert/hover/des-beast.gc b/goal_src/jak3/levels/desert/hover/des-beast.gc index 514a45258c..4d473b9f1a 100644 --- a/goal_src/jak3/levels/desert/hover/des-beast.gc +++ b/goal_src/jak3/levels/desert/hover/des-beast.gc @@ -2119,7 +2119,6 @@ ) (defun des-beast-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) @@ -2127,35 +2126,36 @@ ) (init-vf0-vector) (cspace<-parented-transformq-joint! arg0 arg1) - (let ((s3-0 (-> 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 (-> (the-as des-beast s3-0) target-gun-pos)) - (let ((v0-2 (matrix->trans (-> arg0 bone transform) (new 'stack-no-clear 'vector)))) + (let ((s3-0 (-> 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 (-> (the-as des-beast s3-0) target-gun-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 fvec)) - (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! (-> (the-as des-beast s3-0) angle-turret) - (deg-seek (-> (the-as des-beast s3-0) angle-turret) (-> s2-0 y) (* 7281.778 (seconds-per-frame))) - ) - (quaternion-vector-angle! s4-0 *up-vector* (-> (the-as des-beast s3-0) angle-turret)) - (quaternion->matrix (-> arg0 bone transform) s4-0) - (vector-copy! (-> arg0 bone transform trans) s5-0) ) + (rot-zxy-from-vector! s0-0 (-> arg0 bone transform fvec)) + (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! (-> (the-as des-beast s3-0) angle-turret) + (deg-seek (-> (the-as des-beast s3-0) angle-turret) (-> s2-0 y) (* 7281.778 (seconds-per-frame))) + ) + (quaternion-vector-angle! s4-0 *up-vector* (-> (the-as des-beast s3-0) angle-turret)) + (quaternion->matrix (-> arg0 bone transform) s4-0) + (vector-copy! (-> arg0 bone transform trans) s5-0) ) 0 (none) @@ -2163,7 +2163,6 @@ ) (defun des-beast-gun-callback ((arg0 cspace) (arg1 transformq)) - (local-vars (sv-112 vector) (sv-128 vector)) (rlet ((vf0 :class vf) (vf4 :class vf) (vf5 :class vf) @@ -2178,15 +2177,17 @@ (s1-0 (new 'stack-no-clear 'vector)) (s3-0 (new 'stack-no-clear 'vector)) ) - (set! sv-128 s0-0) - (set! sv-112 (-> (the-as des-beast s4-0) target-gun-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 (-> (the-as des-beast s4-0) target-gun-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 fvec)) (rot-zxy-from-vector! s1-0 s0-0) (set! (-> s3-0 x) (fmax -5461.3335 (fmin -5461.3335 (deg- (-> s1-0 x) (-> s2-0 x))))) diff --git a/goal_src/jak3/levels/desert/hover/desert-hover.gc b/goal_src/jak3/levels/desert/hover/desert-hover.gc index 72de320117..5902fc61d1 100644 --- a/goal_src/jak3/levels/desert/hover/desert-hover.gc +++ b/goal_src/jak3/levels/desert/hover/desert-hover.gc @@ -73,7 +73,6 @@ ;; WARN: Return type mismatch object vs none. (defmethod set-time-limit ((this task-manager-desert-hover)) - (local-vars (sv-16 res-tag)) (let ((t9-0 (method-of-type task-manager set-time-limit))) (t9-0 this) ) @@ -84,8 +83,9 @@ (let ((a0-9 (entity-by-name "tmanager-2"))) (when a0-9 (set! (-> this entity) (the-as entity-actor a0-9)) - (set! sv-16 (new 'static 'res-tag)) - (let ((v0-6 (res-lump-data a0-9 'actor-groups pointer :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v0-6 (res-lump-data a0-9 'actor-groups pointer :tag-ptr (& sv-16))) + ) (cond ((and v0-6 (nonzero? (-> sv-16 elt-count))) (set! (-> this actor-group-count) (the-as int (-> sv-16 elt-count))) diff --git a/goal_src/jak3/levels/desert/hover/mh-flyer.gc b/goal_src/jak3/levels/desert/hover/mh-flyer.gc index 0cbabae8a7..7ba17ecd6d 100644 --- a/goal_src/jak3/levels/desert/hover/mh-flyer.gc +++ b/goal_src/jak3/levels/desert/hover/mh-flyer.gc @@ -410,12 +410,6 @@ ;; ERROR: Stack slot load at 112 mismatch: defined as size 4, got size 16 ;; ERROR: Stack slot load at 128 mismatch: defined as size 4, got size 16 (defmethod init-proj-settings! ((this mh-flyer-shot)) - (local-vars - (sv-80 (function float float float float float float)) - (sv-96 float) - (sv-112 float) - (sv-128 float) - ) (with-pp (initialize-skeleton this @@ -476,20 +470,11 @@ (f0-9 (vector-dot s5-6 *y-vector*)) (s4-3 (new 'stack-no-clear 'vector)) ) - (let ((s3-1 vector-lerp!) - (s2-0 s4-3) - (s1-0 *y-vector*) - (s0-0 *x-vector*) - ) - (set! sv-80 lerp-scale) - (set! sv-96 (the-as float 0.0)) - (set! sv-112 (the-as float 1.0)) - (set! sv-128 f0-9) - (let ((a3-5 (cos 14563.556)) - (t0-2 0.0) - ) - (s3-1 s2-0 s1-0 s0-0 (sv-80 sv-96 sv-112 sv-128 a3-5 t0-2)) - ) + (vector-lerp! + s4-3 + *y-vector* + *x-vector* + (lerp-scale (the-as float 0.0) (the-as float 1.0) f0-9 (cos 14563.556) 0.0) ) (forward-up->quaternion (-> this root quat) s5-6 s4-3) ) diff --git a/goal_src/jak3/levels/desert/hover/scorpion-gun.gc b/goal_src/jak3/levels/desert/hover/scorpion-gun.gc index f36a8622a7..5765348cc8 100644 --- a/goal_src/jak3/levels/desert/hover/scorpion-gun.gc +++ b/goal_src/jak3/levels/desert/hover/scorpion-gun.gc @@ -893,7 +893,6 @@ ) (defbehavior scorpion-gun-handler scorpion-gun ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) - (local-vars (sv-32 vector) (sv-128 quaternion)) (case arg2 (('die) (go-virtual die) @@ -903,32 +902,34 @@ ) (('get-cam-info) (let ((s5-0 (joint-node scorpion-gun-lod0-jg main))) - (set! sv-32 (vector<-cspace! (new 'stack-no-clear 'vector) s5-0)) - (vector+float*! sv-32 sv-32 (-> s5-0 bone transform uvec) 7372.8) - (vector+float*! sv-32 sv-32 (-> s5-0 bone transform fvec) -24576.0) - (set! (-> sv-32 y) (fmax (-> sv-32 y) (-> s5-0 bone transform trans y))) - (let ((s4-0 (new 'stack-no-clear 'vector))) - (vector-copy! s4-0 (-> self root trans)) - (let ((s3-0 (new 'stack-no-clear 'vector))) - (set! (-> s3-0 x) 0.0) - (set! (-> s3-0 y) 0.0) - (set! (-> s3-0 z) -24576.0) - (set! (-> s3-0 w) 0.0) - (let ((s0-0 (matrix->quaternion (new 'stack-no-clear 'quaternion) (-> s5-0 bone transform)))) - (set! sv-128 (quaternion*! - (new 'stack-no-clear 'quaternion) - s0-0 - (quaternion-conjugate! (new 'stack-no-clear 'quaternion) (-> self scorp-quat)) + (let ((sv-32 (vector<-cspace! (new 'stack-no-clear 'vector) s5-0))) + (vector+float*! sv-32 sv-32 (-> s5-0 bone transform uvec) 7372.8) + (vector+float*! sv-32 sv-32 (-> s5-0 bone transform fvec) -24576.0) + (set! (-> sv-32 y) (fmax (-> sv-32 y) (-> s5-0 bone transform trans y))) + (let ((s4-0 (new 'stack-no-clear 'vector))) + (vector-copy! s4-0 (-> self root trans)) + (let ((s3-0 (new 'stack-no-clear 'vector))) + (set! (-> s3-0 x) 0.0) + (set! (-> s3-0 y) 0.0) + (set! (-> s3-0 z) -24576.0) + (set! (-> s3-0 w) 0.0) + (let* ((s0-0 (matrix->quaternion (new 'stack-no-clear 'quaternion) (-> s5-0 bone transform))) + (sv-128 (quaternion*! + (new 'stack-no-clear 'quaternion) + s0-0 + (quaternion-conjugate! (new 'stack-no-clear 'quaternion) (-> self scorp-quat)) + ) ) - ) + ) + (vector-rotate-around-y! s3-0 s3-0 (quaternion-y-angle sv-128)) + ) + (vector-orient-by-quat! s3-0 s3-0 (-> self scorp-quat)) + (vector+! s4-0 s4-0 s3-0) ) - (vector-rotate-around-y! s3-0 s3-0 (quaternion-y-angle sv-128)) - (vector-orient-by-quat! s3-0 s3-0 (-> self scorp-quat)) - (vector+! s4-0 s4-0 s3-0) + (set! (-> sv-32 y) (fmax (-> sv-32 y) (-> s4-0 y))) ) - (set! (-> sv-32 y) (fmax (-> sv-32 y) (-> s4-0 y))) + (set! (-> (the-as vector (-> arg3 param 0)) quad) (-> sv-32 quad)) ) - (set! (-> (the-as vector (-> arg3 param 0)) quad) (-> sv-32 quad)) (vector-normalize-copy! (the-as vector (-> arg3 param 1)) (-> s5-0 bone transform fvec) 1.0) ) ) @@ -956,7 +957,6 @@ ;; ERROR: Stack slot load at 80 mismatch: defined as size 4, got size 16 ;; ERROR: Stack slot load at 80 mismatch: defined as size 4, got size 16 (defbehavior control-post scorpion-gun ((arg0 symbol)) - (local-vars (sv-64 quaternion) (sv-68 vector) (sv-72 vector) (sv-80 float)) (cond (arg0 ;; og:preserve-this @@ -993,45 +993,31 @@ (set! (-> self rotxv) 0.0) ) ) - (set! sv-64 (new 'stack-no-clear 'quaternion)) - (set! sv-68 (vector-y-quaternion! (new 'stack-no-clear 'vector) (-> self scorp-quat))) - (set! sv-72 (vector-y-quaternion! (new 'stack-no-clear 'vector) (-> self root quat))) - (let ((gp-0 quaternion-slerp!) - (s5-0 (-> self scorp-smooth-quat)) - (s4-0 (-> self scorp-smooth-quat)) - (s3-0 (-> self scorp-quat)) - (s2-0 lerp-scale) - (s1-0 0.0) - (s0-0 2.0) - ) - (set! sv-80 (vector-dot sv-68 sv-72)) - (let ((a3-2 (cos 45.0)) - (t0-2 0.0) + (let ((sv-64 (new 'stack-no-clear 'quaternion))) + (let ((sv-68 (vector-y-quaternion! (new 'stack-no-clear 'vector) (-> self scorp-quat))) + (sv-72 (vector-y-quaternion! (new 'stack-no-clear 'vector) (-> self root quat))) ) - (gp-0 s5-0 s4-0 s3-0 (* (s2-0 s1-0 s0-0 sv-80 a3-2 t0-2) (seconds-per-frame))) + (quaternion-slerp! + (-> self scorp-smooth-quat) + (-> self scorp-smooth-quat) + (-> self scorp-quat) + (* (lerp-scale 0.0 2.0 (vector-dot sv-68 sv-72) (cos 45.0) 0.0) (seconds-per-frame)) + ) ) + (quaternion-rotate-local-y! sv-64 (-> self scorp-smooth-quat) (-> self roty)) + (quaternion-rotate-local-x! (-> self root quat) sv-64 (-> self rotx)) ) - (quaternion-rotate-local-y! sv-64 (-> self scorp-smooth-quat) (-> self roty)) - (quaternion-rotate-local-x! (-> self root quat) sv-64 (-> self rotx)) (ja-post) (none) ) (defbehavior aim-post scorpion-gun () - (local-vars - (sv-656 vector) - (sv-1296 cspace) - (sv-1300 collide-query) - (sv-1304 vector) - (sv-1308 vector) - (sv-1312 rgba) - ) (send-event (handle->process (-> self manager)) 'reset-arrows) (let ((gp-0 (-> (joint-node scorpion-gun-lod0-jg muzzle) bone transform)) (s4-0 (new 'stack-no-clear 'vector)) (s5-0 (the-as (array collide-shape) (new 'stack 'boxed-array collide-shape 128))) + (sv-656 (new 'stack-no-clear 'vector)) ) - (set! sv-656 (new 'stack-no-clear 'vector)) (vector-normalize-copy! sv-656 (-> gp-0 fvec) 1.0) (vector+float*! s4-0 (-> gp-0 trans) sv-656 512000.0) (set! (-> s4-0 w) 614400.0) @@ -1105,60 +1091,64 @@ ) ) ) - (set! sv-1296 (joint-node scorpion-gun-lod0-jg muzzle)) - (set! sv-1300 (new 'stack-no-clear 'collide-query)) - (set! sv-1304 (-> self aim-dir)) - (set! sv-1308 (new 'stack-no-clear 'vector)) - (set! sv-1312 (the-as rgba (new 'stack-no-clear 'array 'rgba 1))) - (vector-copy! (-> sv-1300 start-pos) (-> sv-1296 bone transform trans)) - (vector-float*! (-> sv-1300 move-dist) sv-1304 1024000.0) - (let ((v1-73 sv-1300)) - (set! (-> v1-73 radius) 819.2) - (set! (-> v1-73 collide-with) (collide-spec enemy obstacle hit-by-others-list)) - (set! (-> v1-73 ignore-process0) self) - (set! (-> v1-73 ignore-process1) #f) - (set! (-> v1-73 ignore-pat) - (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) - ) - (set! (-> v1-73 action-mask) (collide-action solid)) - ) - (fill-using-line-sphere *collide-cache* sv-1300) - (let ((f30-1 (probe-using-line-sphere *collide-cache* sv-1300))) - (cond - ((and (>= f30-1 0.0) - (type? (-> sv-1300 best-other-tri collide-ptr) collide-shape-prim) - (logtest? (process-mask enemy projectile) - (-> (the-as collide-shape-prim (-> sv-1300 best-other-tri collide-ptr)) cshape process mask) - ) + (let ((sv-1296 (joint-node scorpion-gun-lod0-jg muzzle)) + (sv-1300 (new 'stack-no-clear 'collide-query)) + (sv-1304 (-> self aim-dir)) + (sv-1308 (new 'stack-no-clear 'vector)) + (sv-1312 (the-as rgba (new 'stack-no-clear 'array 'rgba 1))) + ) + (vector-copy! (-> sv-1300 start-pos) (-> sv-1296 bone transform trans)) + (vector-float*! (-> sv-1300 move-dist) sv-1304 1024000.0) + (let ((v1-73 sv-1300)) + (set! (-> v1-73 radius) 819.2) + (set! (-> v1-73 collide-with) (collide-spec enemy obstacle hit-by-others-list)) + (set! (-> v1-73 ignore-process0) self) + (set! (-> v1-73 ignore-process1) #f) + (set! (-> v1-73 ignore-pat) + (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) ) - (if (>= (+ (current-time) (seconds -0.5)) (-> self valid-target-time)) - (set! (-> self valid-target-anim-time) (+ (current-time) (seconds 0.4))) - ) - (vector+float*! sv-1308 (-> sv-1300 start-pos) (-> sv-1300 move-dist) f30-1) - (set! sv-1312 - (rgba-lerp - (new 'static 'rgba :r #xf2 :a #x80) - (new 'static 'rgba :r #xff :g #xec :b #x48 :a #x10) - (the-as - rgba - (* 0.016666668 (fmax 0.0 (fmin 1.0 (the float (- (-> self valid-target-anim-time) (current-time)))))) - ) - ) - ) - (set-time! (-> self valid-target-time)) - ) - (else - (vector+float*! sv-1308 (-> sv-1300 start-pos) (-> sv-1300 move-dist) 1.0) - (set! sv-1312 *color-gray*) - (set! sv-1312 (copy-and-set-field sv-1312 a 16)) - ) + (set! (-> v1-73 action-mask) (collide-action solid)) + ) + (fill-using-line-sphere *collide-cache* sv-1300) + (let ((f30-1 (probe-using-line-sphere *collide-cache* sv-1300))) + (set! sv-1312 + (cond + ((and (>= f30-1 0.0) + (type? (-> sv-1300 best-other-tri collide-ptr) collide-shape-prim) + (logtest? (process-mask enemy projectile) + (-> (the-as collide-shape-prim (-> sv-1300 best-other-tri collide-ptr)) cshape process mask) + ) + ) + (if (>= (+ (current-time) (seconds -0.5)) (-> self valid-target-time)) + (set! (-> self valid-target-anim-time) (+ (current-time) (seconds 0.4))) + ) + (vector+float*! sv-1308 (-> sv-1300 start-pos) (-> sv-1300 move-dist) f30-1) + (set! sv-1312 + (rgba-lerp + (new 'static 'rgba :r #xf2 :a #x80) + (new 'static 'rgba :r #xff :g #xec :b #x48 :a #x10) + (the-as + rgba + (* 0.016666668 (fmax 0.0 (fmin 1.0 (the float (- (-> self valid-target-anim-time) (current-time)))))) + ) + ) + ) + (set-time! (-> self valid-target-time)) + sv-1312 + ) + (else + (vector+float*! sv-1308 (-> sv-1300 start-pos) (-> sv-1300 move-dist) 1.0) + (copy-and-set-field *color-gray* a 16) + ) + ) + ) + ) + (set! (-> sv-1308 w) 1.0) + (let ((gp-3 (new 'stack-no-clear 'vector))) + (if (transform-point-vector! gp-3 sv-1308) + (send-event (handle->process (-> self hud-aim)) 'draw gp-3 sv-1312) + ) ) - ) - (set! (-> sv-1308 w) 1.0) - (let ((gp-3 (new 'stack-no-clear 'vector))) - (if (transform-point-vector! gp-3 sv-1308) - (send-event (handle->process (-> self hud-aim)) 'draw gp-3 sv-1312) - ) ) 0 (none) @@ -2084,9 +2074,10 @@ ) (defmethod init-from-entity! ((this scorpion-gun-manager) (arg0 entity-actor)) + "Set up a newly created process from the entity that created it." ;; og:preserve-this added (stack-size-set! (-> this main-thread) 1024) - (set! (-> this trans quad) (-> arg0 extra trans quad)) + (vector-copy! (-> this trans) (-> arg0 extra trans)) (quaternion-copy! (-> this quat) (-> arg0 quat)) (logclear! (-> this mask) (process-mask actor-pause)) (let ((v1-3 (-> this path-info))) diff --git a/goal_src/jak3/levels/desert/lizard/desert-lizard-task.gc b/goal_src/jak3/levels/desert/lizard/desert-lizard-task.gc index a468000dbd..8ae6ffb8a9 100644 --- a/goal_src/jak3/levels/desert/lizard/desert-lizard-task.gc +++ b/goal_src/jak3/levels/desert/lizard/desert-lizard-task.gc @@ -635,7 +635,6 @@ ;; WARN: Return type mismatch symbol vs none. (defmethod task-manager-method-26 ((this task-manager-desert-catch-lizards)) - (local-vars (sv-192 res-tag)) (with-pp (let ((t9-0 (method-of-type task-manager task-manager-method-26))) (t9-0 this) @@ -684,11 +683,12 @@ ) (when (not (-> this manager-entity)) (set! (-> this manager-entity) (the-as entity-actor (entity-by-name "desert-lizard-manager-1"))) - (set! sv-192 (new 'static 'res-tag)) - (let ((v1-46 (res-lump-data (-> this manager-entity) 'actor-groups pointer :tag-ptr (& sv-192)))) + (let* ((sv-192 (new 'static 'res-tag)) + (v1-46 (res-lump-data (-> this manager-entity) 'actor-groups (pointer actor-group) :tag-ptr (& sv-192))) + ) (cond ((and v1-46 (nonzero? (-> sv-192 elt-count))) - (set! (-> this actor-group) (the-as (pointer actor-group) v1-46)) + (set! (-> this actor-group) v1-46) (set! (-> this actor-group-count) (the-as int (-> sv-192 elt-count))) ) (else diff --git a/goal_src/jak3/levels/desert/lizard/desert-lizard.gc b/goal_src/jak3/levels/desert/lizard/desert-lizard.gc index 36cc6345e5..830fdea0fe 100644 --- a/goal_src/jak3/levels/desert/lizard/desert-lizard.gc +++ b/goal_src/jak3/levels/desert/lizard/desert-lizard.gc @@ -929,7 +929,6 @@ ) (defmethod nav-enemy-method-165 ((this desert-lizard) (arg0 vector) (arg1 vector)) - (local-vars (sv-160 vector) (sv-176 int) (sv-192 vector)) (with-pp (let ((s5-0 (new 'stack-no-clear 'vector))) (vector-copy! s5-0 arg1) @@ -941,23 +940,24 @@ (let ((s1-0 -1) (s0-0 (new 'stack-no-clear 'vector)) ) - (set! sv-160 (-> this root trans)) - (set! sv-176 0) - (while (< sv-176 (-> this graph edge-count)) - (let ((v1-8 (-> this graph edge sv-176))) - (set! sv-192 (new 'stack-no-clear 'vector)) - (let ((f0-0 - (vector-segment-xz-distance-point! sv-160 (-> s2-0 (-> v1-8 index 0)) (-> s2-0 (-> v1-8 index 1)) sv-192) - ) - ) + (let ((sv-160 (-> this root trans)) + (sv-176 0) + ) + (while (< sv-176 (-> this graph edge-count)) + (let* ((v1-8 (-> this graph edge sv-176)) + (sv-192 (new 'stack-no-clear 'vector)) + (f0-0 + (vector-segment-xz-distance-point! sv-160 (-> s2-0 (-> v1-8 index 0)) (-> s2-0 (-> v1-8 index 1)) sv-192) + ) + ) (when (or (< f0-0 f30-0) (= s1-0 -1)) (set! f30-0 f0-0) (set! s1-0 sv-176) (vector-copy! s0-0 sv-192) ) ) + (+! sv-176 1) ) - (set! sv-176 (+ sv-176 1)) ) (when (!= s1-0 -1) (cond diff --git a/goal_src/jak3/levels/desert/oasis/ash-oasis-course.gc b/goal_src/jak3/levels/desert/oasis/ash-oasis-course.gc index d3a94f38c4..abd77c2d82 100644 --- a/goal_src/jak3/levels/desert/oasis/ash-oasis-course.gc +++ b/goal_src/jak3/levels/desert/oasis/ash-oasis-course.gc @@ -281,9 +281,7 @@ (local-vars (v0-5 bot-flag)) (set-frontline arg0) (let* ((a1-0 (target-pos 0)) - (f0-0 (vector-vector-xz-distance-squared (-> arg0 root trans) a1-0)) - (f1-0 409600.0) - (s5-0 (< f0-0 (* f1-0 f1-0))) + (s5-0 (< (vector-vector-xz-distance-squared (-> arg0 root trans) a1-0) (square 409600.0))) ) (if s5-0 (set-time! (-> arg0 player-in-bounds-time)) diff --git a/goal_src/jak3/levels/desert/oasis/oasis-defense.gc b/goal_src/jak3/levels/desert/oasis/oasis-defense.gc index c090c3d3e8..b2da44eb3b 100644 --- a/goal_src/jak3/levels/desert/oasis/oasis-defense.gc +++ b/goal_src/jak3/levels/desert/oasis/oasis-defense.gc @@ -437,31 +437,23 @@ (s1-0 (= (+ (length (-> *oasis-vehicle-path* (-> s4-0 path-type))) -1) (-> s4-0 path-pos))) (f30-0 (vector-vector-distance-squared (-> s2-0 pos) (-> (the-as process-drawable s3-0) root trans))) ) - (when (and (not s1-0) (let ((f0-0 81920.0)) - (< f30-0 (* f0-0 f0-0)) - ) - ) + (when (and (not s1-0) (< f30-0 (square 81920.0))) (+! (-> s4-0 path-pos) 1) (send-event s3-0 'ai-set-target-position (-> *oasis-vehicle-path* (-> s4-0 path-type) (-> s4-0 path-pos) pos)) (send-event s3-0 'ai-set-target-speed 163840.0) (send-event s3-0 'ai-set-target-process *target*) ) - (if (and s1-0 (let ((f0-3 122880.0)) - (< f30-0 (* f0-3 f0-3)) - ) - ) + (if (and s1-0 (< f30-0 (square 122880.0))) (send-event s3-0 'ai-set-target-speed 122880.0) ) (when (-> s4-0 spawned-marauder?) (send-event s3-0 'ai-set-target-speed 81920.0) (send-event s3-0 'ai-set-target-position (-> *oasis-vehicle-path* (-> s4-0 path-type) (-> s4-0 path-pos) pos)) ) - (when (and s1-0 (not (-> s4-0 spawned-marauder?)) (let ((f0-6 40960.0)) - (and (< f30-0 (* f0-6 f0-6)) - (< (-> this marauder-count) (the-as uint 7)) - (< (-> this total-spawned) (the-as uint 57)) - ) - ) + (when (and s1-0 (not (-> s4-0 spawned-marauder?)) (and (< f30-0 (square 40960.0)) + (< (-> this marauder-count) (the-as uint 7)) + (< (-> this total-spawned) (the-as uint 57)) + ) ) (let ((a1-10 (handle->process (spawn-marauder this s2-0 #t)))) (when a1-10 @@ -500,33 +492,29 @@ ) ) ) - (let ((f0-9 102400.0)) - (when (< f30-1 (* f0-9 f0-9)) - (let* ((s2-1 (-> (the-as process-drawable s4-2) root quat)) - (s3-2 (vector-normalize! (vector-x-quaternion! (new 'stack-no-clear 'vector) s2-1) 40960.0)) - (v1-109 (vector-normalize! (vector-y-quaternion! (new 'stack-no-clear 'vector) s2-1) 102400.0)) - ) - (vector+! s3-2 (-> (the-as process-drawable s4-2) root trans) s3-2) - (send-event s4-2 'apply-impulse s3-2 v1-109) - ) + (when (< f30-1 (square 102400.0)) + (let* ((s2-1 (-> (the-as process-drawable s4-2) root quat)) + (s3-2 (vector-normalize! (vector-x-quaternion! (new 'stack-no-clear 'vector) s2-1) 40960.0)) + (v1-109 (vector-normalize! (vector-y-quaternion! (new 'stack-no-clear 'vector) s2-1) 102400.0)) + ) + (vector+! s3-2 (-> (the-as process-drawable s4-2) root trans) s3-2) + (send-event s4-2 'apply-impulse s3-2 v1-109) ) ) - (let ((f0-12 40960.0)) - (when (< f30-1 (* f0-12 f0-12)) - (send-event - s4-2 - 'attack - #f - (static-attack-info :mask (vehicle-impulse-factor) ((id (new-attack-id)) - (damage 2000.0) - (vehicle-damage-factor 1.0) - (vehicle-impulse-factor 0.0) - (attacker-velocity (new 'static 'vector :w 1.0)) - ) - ) - ) - (set! (-> this veh-fx s5-1) (the-as handle #f)) + (when (< f30-1 (square 40960.0)) + (send-event + s4-2 + 'attack + #f + (static-attack-info :mask (vehicle-impulse-factor) ((id (new-attack-id)) + (damage 2000.0) + (vehicle-damage-factor 1.0) + (vehicle-impulse-factor 0.0) + (attacker-velocity (new 'static 'vector :w 1.0)) + ) + ) ) + (set! (-> this veh-fx s5-1) (the-as handle #f)) ) ) ) @@ -640,40 +628,38 @@ ) (defmethod spawn-v-marauder ((this task-manager-desert-oasis-defense) (arg0 int) (arg1 int)) - (local-vars (sv-240 mystery-traffic-object-spawn-params0)) (let ((s5-0 (-> this v-free-list)) (s4-0 (>= arg1 0)) ) (when (nonzero? (length s5-0)) - (let ((s3-0 (-> this vehicle (-> s5-0 (+ (length s5-0) -1))))) - (let ((s0-0 (if s4-0 - (-> *oasis-vehicle-start* arg1) - (-> *oasis-vehicle-path* arg0 0) + (let ((s3-0 (-> this vehicle (-> s5-0 (+ (length s5-0) -1)))) + (s0-0 (if s4-0 + (-> *oasis-vehicle-start* arg1) + (-> *oasis-vehicle-path* arg0 0) + ) + ) + (sv-240 (new 'stack-no-clear 'mystery-traffic-object-spawn-params0)) + ) + (vector-z-quaternion! (-> sv-240 vec) (-> s0-0 quat)) + (vector-float*! (-> sv-240 vec) (-> sv-240 vec) (if s4-0 + 0.0 + 204800.0 + ) ) - ) - ) - (set! sv-240 (new 'stack-no-clear 'mystery-traffic-object-spawn-params0)) - (vector-z-quaternion! (-> sv-240 vec) (-> s0-0 quat)) - (vector-float*! (-> sv-240 vec) (-> sv-240 vec) (if s4-0 - 0.0 - 204800.0 - ) - ) - (set! (-> sv-240 params object-type) (traffic-type guard-a)) - (set! (-> sv-240 params behavior) (the-as uint 3)) - (set! (-> sv-240 params id) (the-as uint 0)) - (set! (-> sv-240 params nav-mesh) (-> this nav-mesh)) - (set! (-> sv-240 params nav-branch) #f) - (set! (-> sv-240 params proc) #f) - (set! (-> sv-240 params handle) (the-as handle #f)) - (set! (-> sv-240 params user-data) (the-as uint 0)) - (set! (-> sv-240 params flags) (traffic-spawn-flags)) - (set! (-> sv-240 params guard-type) (the-as uint 11)) - (set! (-> sv-240 params entity) #f) - (vector-copy! (-> sv-240 params velocity) (-> sv-240 vec)) - (vector-copy! (-> sv-240 params position) (-> s0-0 pos)) - (quaternion-copy! (-> sv-240 params rotation) (-> s0-0 quat)) - ) + (set! (-> sv-240 params object-type) (traffic-type guard-a)) + (set! (-> sv-240 params behavior) (the-as uint 3)) + (set! (-> sv-240 params id) (the-as uint 0)) + (set! (-> sv-240 params nav-mesh) (-> this nav-mesh)) + (set! (-> sv-240 params nav-branch) #f) + (set! (-> sv-240 params proc) #f) + (set! (-> sv-240 params handle) (the-as handle #f)) + (set! (-> sv-240 params user-data) (the-as uint 0)) + (set! (-> sv-240 params flags) (traffic-spawn-flags)) + (set! (-> sv-240 params guard-type) (the-as uint 11)) + (set! (-> sv-240 params entity) #f) + (vector-copy! (-> sv-240 params velocity) (-> sv-240 vec)) + (vector-copy! (-> sv-240 params position) (-> s0-0 pos)) + (quaternion-copy! (-> sv-240 params rotation) (-> s0-0 quat)) (let ((s0-1 (vehicle-spawn (vehicle-type v-marauder) (-> sv-240 params)))) (when s0-1 (iterate-prims diff --git a/goal_src/jak3/levels/desert/race/turtle-training.gc b/goal_src/jak3/levels/desert/race/turtle-training.gc index 86168c59cb..53863b8d67 100644 --- a/goal_src/jak3/levels/desert/race/turtle-training.gc +++ b/goal_src/jak3/levels/desert/race/turtle-training.gc @@ -184,7 +184,6 @@ (defmethod set-time-limit ((this task-manager-desert-turtle-training)) - (local-vars (sv-16 res-tag)) (let ((t9-0 (method-of-type task-manager set-time-limit))) (t9-0 this) ) @@ -196,8 +195,9 @@ (set! (-> this max-count) 0) (let ((a0-8 (entity-by-name "training-1"))) (when a0-8 - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-7 (res-lump-data a0-8 'actor-groups (pointer actor-group) :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-7 (res-lump-data a0-8 'actor-groups (pointer actor-group) :tag-ptr (& sv-16))) + ) (cond ((and v1-7 (nonzero? (-> sv-16 elt-count))) (set! (-> this max-count) (-> v1-7 0 length)) diff --git a/goal_src/jak3/levels/desert/rescue/desert-rescue-bbush.gc b/goal_src/jak3/levels/desert/rescue/desert-rescue-bbush.gc index b97921514e..831563ed95 100644 --- a/goal_src/jak3/levels/desert/rescue/desert-rescue-bbush.gc +++ b/goal_src/jak3/levels/desert/rescue/desert-rescue-bbush.gc @@ -95,14 +95,14 @@ ;; WARN: Return type mismatch connection vs none. (defmethod set-time-limit ((this task-manager-desert-rescue-bbush)) - (local-vars (sv-16 res-tag)) (set-setting! 'pilot-exit #f 0.0 0) (let ((t1-1 2)) (set-setting! 'vehicles 'set (shr t1-1 32) t1-1) ) (set-setting! 'airlock #f 0.0 0) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-7 (res-lump-data (entity-by-name "desresc-bbush-info-1") 'actor-groups pointer :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-7 (res-lump-data (entity-by-name "desresc-bbush-info-1") 'actor-groups pointer :tag-ptr (& sv-16))) + ) (cond ((and v1-7 (nonzero? (-> sv-16 elt-count))) (set! (-> this actor-group) (the-as (pointer actor-group) v1-7)) diff --git a/goal_src/jak3/levels/desert/rescue/desert-rescue.gc b/goal_src/jak3/levels/desert/rescue/desert-rescue.gc index b03b96aff4..e56a037231 100644 --- a/goal_src/jak3/levels/desert/rescue/desert-rescue.gc +++ b/goal_src/jak3/levels/desert/rescue/desert-rescue.gc @@ -1684,11 +1684,7 @@ (when (< f0-5 81920.0) (when (not (-> self is-braking?)) (set! (-> self is-braking?) #t) - (let ((f1-6 0.5) - (f2-3 (-> self move-speed)) - ) - (set! (-> self seek-speed) (/ (* f1-6 (* f2-3 f2-3)) f0-5)) - ) + (set! (-> self seek-speed) (/ (* 0.5 (square (-> self move-speed))) f0-5)) ) (set! (-> self target-move-speed) 0.0) ) @@ -2438,7 +2434,7 @@ ) ) (if (-> this passenger-pos (-> this current-passenger-index) is-final?) - (set! f2-2 (* f2-2 f2-2)) + (set! f2-2 (square f2-2)) ) (set-setting! 'fog-special-interp-targ #f (lerp f1-1 f0-0 f2-2) 0) ) diff --git a/goal_src/jak3/levels/desert/rescue/neo-satellite.gc b/goal_src/jak3/levels/desert/rescue/neo-satellite.gc index 77551d5e6c..2db7347e82 100644 --- a/goal_src/jak3/levels/desert/rescue/neo-satellite.gc +++ b/goal_src/jak3/levels/desert/rescue/neo-satellite.gc @@ -2132,9 +2132,7 @@ (neo-sat-method-230 self) ) (neo-sat-method-201 self) - (let* ((f0-1 (* 0.0033333334 (the float (- (current-time) (-> self state-time))))) - (f30-0 (* f0-1 f0-1)) - ) + (let ((f30-0 (square (* 0.0033333334 (the float (- (current-time) (-> self state-time))))))) (set! (-> self bob-speed-scalar) (lerp 1.0 10.0 f30-0)) (set! (-> self spin-current) (lerp 49152.0 98304.0 f30-0)) ) @@ -2229,9 +2227,7 @@ (zero? (-> this sound-next-play-time s2-1)) ) (set-time! (-> this sound-last-snap-time s2-1)) - (let* ((f0-10 (* 0.000030517578 (fabs (-> this spin-speed)))) - (f0-11 (* f0-10 f0-10)) - ) + (let ((f0-11 (square (* 0.000030517578 (fabs (-> this spin-speed)))))) (set! (-> this sound-next-play-time s2-1) (+ (current-time) (the int (* 300.0 (lerp 0.3 0.0 f0-11))))) ) ) @@ -2248,7 +2244,7 @@ (let* ((f0-23 (acos (vector-dot s2-3 s3-0))) (f0-24 (/ f0-23 (meters 8))) (f22-0 (- 1.0 f0-24)) - (f1-10 (+ (lerp 0.0 0.75 (* f22-0 f22-0)) (lerp -0.25 0.25 f26-1))) + (f1-10 (+ (lerp 0.0 0.75 (square f22-0)) (lerp -0.25 0.25 f26-1))) (f24-1 (fmax 0.0 (fmin 1.0 f1-10))) (f0-29 (+ (lerp -0.5 0.5 f22-0) (lerp 0.0 0.5 f26-1))) (f0-30 (fmin 1.0 f0-29)) @@ -2429,11 +2425,9 @@ ) (defmethod neo-sat-method-210 ((this neo-sat)) - (let ((f0-0 143360.0)) - (if (< (* f0-0 f0-0) (vector-vector-xz-distance-squared (-> this root trans) (-> this focus-pos))) - (go (method-of-object this ground-burst)) - ) - ) + (if (< (square 143360.0) (vector-vector-xz-distance-squared (-> this root trans) (-> this focus-pos))) + (go (method-of-object this ground-burst)) + ) (-> this spin-current) 0.0 (let ((f0-5 1.0) @@ -3666,14 +3660,13 @@ ) (defmethod neo-sat-method-218 ((this neo-sat) (arg0 vector)) - (local-vars (sv-32 int) (sv-40 int) (sv-48 int) (sv-56 int)) (let ((s5-0 (new 'stack-no-clear 'vector))) (neo-sat-method-212 this arg0 s5-0) - (set! sv-32 (neo-sat-method-213 this (-> s5-0 x))) - (set! sv-40 (neo-sat-method-213 this (+ 9216.0 (-> s5-0 x)))) - (set! sv-48 (neo-sat-method-214 this (-> s5-0 y))) - (set! sv-56 (neo-sat-method-214 this (+ 9216.0 (-> s5-0 y)))) - (let* ((f26-0 (-> this hashed-heights (neo-sat-method-217 this sv-32 sv-48))) + (let* ((sv-32 (neo-sat-method-213 this (-> s5-0 x))) + (sv-40 (neo-sat-method-213 this (+ 9216.0 (-> s5-0 x)))) + (sv-48 (neo-sat-method-214 this (-> s5-0 y))) + (sv-56 (neo-sat-method-214 this (+ 9216.0 (-> s5-0 y)))) + (f26-0 (-> this hashed-heights (neo-sat-method-217 this sv-32 sv-48))) (f24-0 (-> this hashed-heights (neo-sat-method-217 this sv-32 sv-56))) (f30-0 (-> this hashed-heights (neo-sat-method-217 this sv-40 sv-48))) (f28-0 (-> this hashed-heights (neo-sat-method-217 this sv-40 sv-56))) @@ -3698,7 +3691,6 @@ ;; ERROR: Stack slot load at 48 mismatch: defined as size 4, got size 16 ;; ERROR: Stack slot load at 64 mismatch: defined as size 4, got size 16 (defmethod neo-sat-method-222 ((this neo-sat) (arg0 object) (arg1 vector)) - (local-vars (sv-16 float) (sv-32 float) (sv-48 float) (sv-64 float)) (let* ((s4-0 (neo-sat-method-213 this (-> arg1 x))) (s3-0 (neo-sat-method-213 this (+ 9216.0 (-> arg1 x)))) (s2-0 (neo-sat-method-214 this (-> arg1 y))) @@ -3707,26 +3699,10 @@ (f24-0 (-> this hashed-heights (neo-sat-method-217 this s4-0 s1-0))) (f30-0 (-> this hashed-heights (neo-sat-method-217 this s3-0 s2-0))) (f28-0 (-> this hashed-heights (neo-sat-method-217 this s3-0 s1-0))) - (s0-0 lerp-scale) + (f26-1 (lerp-scale f26-0 f24-0 (neo-sat-method-216 this (-> arg1 y)) (the float s2-0) (the float s1-0))) + (f0-20 (lerp-scale f30-0 f28-0 (neo-sat-method-216 this (-> arg1 y)) (the float s2-0) (the float s1-0))) ) - (set! sv-16 f26-0) - (set! sv-32 f24-0) - (let* ((a2-5 (neo-sat-method-216 this (-> arg1 y))) - (a3-0 (the float s2-0)) - (t0-0 (the float s1-0)) - (f26-1 (s0-0 sv-16 sv-32 a2-5 a3-0 t0-0)) - (s0-1 lerp-scale) - ) - (set! sv-48 f30-0) - (set! sv-64 f28-0) - (let* ((a2-6 (neo-sat-method-216 this (-> arg1 y))) - (a3-1 (the float s2-0)) - (t0-1 (the float s1-0)) - (f0-20 (s0-1 sv-48 sv-64 a2-6 a3-1 t0-1)) - ) - (lerp-scale f26-1 f0-20 (neo-sat-method-215 this (-> arg1 x)) (the float s4-0) (the float s3-0)) - ) - ) + (lerp-scale f26-1 f0-20 (neo-sat-method-215 this (-> arg1 x)) (the float s4-0) (the float s3-0)) ) ) diff --git a/goal_src/jak3/levels/desert/rescue/rope-prim-system.gc b/goal_src/jak3/levels/desert/rescue/rope-prim-system.gc index a25f54aca8..38ae641bf4 100644 --- a/goal_src/jak3/levels/desert/rescue/rope-prim-system.gc +++ b/goal_src/jak3/levels/desert/rescue/rope-prim-system.gc @@ -26,21 +26,6 @@ (define *rope-prim-alpha-blend* (new 'static 'gs-alpha :b #x1 :d #x1)) (defmethod rope-system-method-19 ((this rope-prim-system)) - (local-vars - (sv-112 vector) - (sv-116 vector) - (sv-120 matrix) - (sv-124 float) - (sv-128 float) - (sv-132 float) - (sv-136 float) - (sv-240 vector) - (sv-244 vector) - (sv-248 vector) - (sv-252 vector) - (sv-256 object) - (sv-260 rgbaf) - ) (let ((f30-0 0.0)) 0.0 (set! (-> this strip1 num-verts) (the-as uint 0)) @@ -54,45 +39,51 @@ (logior! (-> this strip1 flags) (prim-flags fog-enable)) (logior! (-> this strip2 flags) (prim-flags fog-enable)) (dotimes (s5-0 (-> this knots length)) - (set! sv-112 (new 'stack-no-clear 'vector)) - (set! sv-116 (new 'stack-no-clear 'vector)) - (set! sv-120 (new 'stack-no-clear 'matrix)) - (set! sv-124 (-> this width)) - (set! sv-128 (-> this alpha)) - (set! sv-132 (the-as float 0.0)) - (set! sv-136 (the-as float 0.0)) - (vector-copy! sv-112 (-> this knots data s5-0 pos)) - (cond - ((< s5-0 (+ (-> this knots length) -1)) - (vector-! sv-116 (-> this knots data (+ s5-0 1) pos) sv-112) - (set! sv-136 (vector-vector-distance sv-112 (-> this knots data (+ s5-0 1) pos))) - ) - (else - (vector-! sv-116 sv-112 (-> this knots data (+ s5-0 -1) pos)) + (let ((sv-112 (new 'stack-no-clear 'vector)) + (sv-116 (new 'stack-no-clear 'vector)) + (sv-120 (new 'stack-no-clear 'matrix)) + (sv-124 (-> this width)) + (sv-128 (-> this alpha)) + (sv-132 (the-as float 0.0)) + (sv-136 (the-as float 0.0)) + ) + (vector-copy! sv-112 (-> this knots data s5-0 pos)) + (cond + ((< s5-0 (+ (-> this knots length) -1)) + (vector-! sv-116 (-> this knots data (+ s5-0 1) pos) sv-112) + (set! sv-136 (vector-vector-distance sv-112 (-> this knots data (+ s5-0 1) pos))) + ) + (else + (vector-! sv-116 sv-112 (-> this knots data (+ s5-0 -1) pos)) + ) ) + (let ((f0-7 (/ f30-0 (-> this uv-repeat-dist)))) + (set! sv-132 (- f0-7 (* (the float (the int (/ f0-7 6.0))) 6.0))) + ) + (vector-normalize! sv-116 1.0) + (matrix-f-u-compose sv-120 sv-116 *up-vector*) + (let ((sv-240 (vector+float*! (new 'stack-no-clear 'vector) sv-112 (-> sv-120 rvec) (* 0.5 sv-124))) + (sv-244 (vector+float*! (new 'stack-no-clear 'vector) sv-112 (-> sv-120 rvec) (* -0.5 sv-124))) + (sv-248 (vector+float*! (new 'stack-no-clear 'vector) sv-112 (-> sv-120 uvec) (* 0.5 sv-124))) + (sv-252 (vector+float*! (new 'stack-no-clear 'vector) sv-112 (-> sv-120 uvec) (* -0.5 sv-124))) + ;; og:preserve-this + (sv-256 (new 'static 'rgba)) + ) + (let ((sv-260 (new 'stack-no-clear 'rgbaf))) + (set! (-> sv-260 x) 1.0) + (set! (-> sv-260 y) 1.0) + (set! (-> sv-260 z) 1.0) + (set! (-> sv-260 w) sv-128) + ;; og:preserve-this + (set! sv-256 (rgba<-rgbaf sv-256 sv-260)) + ) + (add-prim-vert this (-> this strip1) sv-240 (the-as rgba sv-256) 0.0 sv-132) + (add-prim-vert this (-> this strip1) sv-244 (the-as rgba sv-256) 1.0 sv-132) + (add-prim-vert this (-> this strip2) sv-248 (the-as rgba sv-256) 1.0 sv-132) + (add-prim-vert this (-> this strip2) sv-252 (the-as rgba sv-256) 0.0 sv-132) + ) + (+! f30-0 sv-136) ) - (let ((f0-7 (/ f30-0 (-> this uv-repeat-dist)))) - (set! sv-132 (- f0-7 (* (the float (the int (/ f0-7 6.0))) 6.0))) - ) - (vector-normalize! sv-116 1.0) - (matrix-f-u-compose sv-120 sv-116 *up-vector*) - (set! sv-240 (vector+float*! (new 'stack-no-clear 'vector) sv-112 (-> sv-120 rvec) (* 0.5 sv-124))) - (set! sv-244 (vector+float*! (new 'stack-no-clear 'vector) sv-112 (-> sv-120 rvec) (* -0.5 sv-124))) - (set! sv-248 (vector+float*! (new 'stack-no-clear 'vector) sv-112 (-> sv-120 uvec) (* 0.5 sv-124))) - (set! sv-252 (vector+float*! (new 'stack-no-clear 'vector) sv-112 (-> sv-120 uvec) (* -0.5 sv-124))) - (set! sv-256 (new 'stack-no-clear 'rgbaf)) - (set! sv-260 (new 'stack-no-clear 'rgbaf)) - (set! (-> sv-260 x) 1.0) - (set! (-> sv-260 y) 1.0) - (set! (-> sv-260 z) 1.0) - (set! (-> sv-260 w) sv-128) - (set! sv-256 (rgba<-rgbaf (the-as rgba sv-256) sv-260)) - ;; og:preserve-this - (add-prim-vert this (-> this strip1) sv-240 (the-as rgba sv-256) 0.0 sv-132) - (add-prim-vert this (-> this strip1) sv-244 (the-as rgba sv-256) 1.0 sv-132) - (add-prim-vert this (-> this strip2) sv-248 (the-as rgba sv-256) 1.0 sv-132) - (add-prim-vert this (-> this strip2) sv-252 (the-as rgba sv-256) 0.0 sv-132) - (+! f30-0 sv-136) ) ) 1 @@ -217,7 +208,6 @@ ) (defmethod rope-system-method-19 ((this rope-joint-system)) - (local-vars (sv-288 vector)) (call-parent-method this) (let* ((s5-0 (-> this joint-mods data)) (s4-0 (handle->process (-> this proc))) @@ -273,15 +263,14 @@ (vector-! s2-1 (-> a0-15 pos) (-> v1-18 pos)) (vector-normalize! s2-1 1.0) (let ((s3-1 (-> this joint-mods data s5-2))) - (let ((s1-0 matrix-u-f-compose) - (s0-0 (new 'stack-no-clear 'matrix)) + (let ((a1-28 (matrix-u-f-compose + (new 'stack-no-clear 'matrix) + s2-1 + (vector-z-quaternion! (new 'stack-no-clear 'vector) (-> s3-1 transform quat)) + ) + ) ) - (set! sv-288 s2-1) - (let* ((a2-4 (vector-z-quaternion! (new 'stack-no-clear 'vector) (-> s3-1 transform quat))) - (a1-28 (s1-0 s0-0 sv-288 a2-4)) - ) - (matrix->quaternion (-> s3-1 transform quat) a1-28) - ) + (matrix->quaternion (-> s3-1 transform quat) a1-28) ) (quaternion-normalize! (-> s3-1 transform quat)) (let* ((v1-24 (-> this joint-mods data (+ s5-2 -1))) diff --git a/goal_src/jak3/levels/desert/rescue/rope-system.gc b/goal_src/jak3/levels/desert/rescue/rope-system.gc index 20fafe3e6b..e69d5608ee 100644 --- a/goal_src/jak3/levels/desert/rescue/rope-system.gc +++ b/goal_src/jak3/levels/desert/rescue/rope-system.gc @@ -141,28 +141,7 @@ ) (defmethod rope-system-method-15 ((this rope-system)) - (local-vars - (f24-0 float) - (sv-144 symbol) - (sv-160 int) - (sv-176 (function _varargs_ object)) - (sv-192 symbol) - (sv-208 int) - (sv-224 (function _varargs_ object)) - (sv-240 vector) - (sv-256 vector) - (sv-272 symbol) - (sv-288 int) - (sv-304 (function _varargs_ object)) - (sv-320 symbol) - (sv-336 int) - (sv-352 (function _varargs_ object)) - (sv-368 vector) - (sv-384 int) - (sv-400 (function _varargs_ object)) - (sv-416 int) - (sv-432 (function _varargs_ object)) - ) + (local-vars (f24-0 float)) (rlet ((vf0 :class vf) (vf1 :class vf) (vf2 :class vf) @@ -207,173 +186,98 @@ (f1-5 (+ f0-7 f2-3)) (f28-0 (/ f2-3 f1-5)) (f26-0 (/ f0-7 f1-5)) + (s1-1 (new 'stack-no-clear 'vector)) ) - (let ((s1-1 (new 'stack-no-clear 'vector))) - (vector-copy! s1-1 (-> s3-0 pos)) - (set! sv-368 (new 'stack-no-clear 'vector)) - (let ((v1-35 (-> s2-0 pos quad))) - (set! (-> sv-368 quad) v1-35) - ) - (set! sv-240 (new 'stack-no-clear 'vector)) - (let ((v1-38 (-> s4-1 quad))) - (set! (-> sv-240 quad) v1-38) - ) - (set! sv-256 (new 'stack-no-clear 'vector)) - (let ((v1-40 s4-1) - (f0-8 -1.0) + (vector-copy! s1-1 (-> s3-0 pos)) + (let ((sv-368 (new 'stack-no-clear 'vector))) + (vector-copy! sv-368 (-> s2-0 pos)) + (let ((sv-240 (new 'stack-no-clear 'vector))) + (vector-copy! sv-240 s4-1) + (let ((sv-256 (new 'stack-no-clear 'vector))) + (let ((v1-40 s4-1) + (f0-8 -1.0) + ) + (.lvf vf1 (&-> v1-40 quad)) + (let ((v1-41 f0-8)) + (.mov vf2 v1-41) + ) ) - (.lvf vf1 (&-> v1-40 quad)) - (let ((v1-41 f0-8)) - (.mov vf2 v1-41) - ) - ) - (.add.x.vf.w vf1 vf0 vf0) - (.mul.x.vf.xyz vf1 vf1 vf2) - (.svf (&-> sv-256 quad) vf1) - (add-debug-line #f (bucket-id debug) s1-1 sv-368 *color-red* #f (the-as rgba -1)) - (vector-rotate-around-axis! sv-240 sv-240 f24-0 s0-0) - (vector-rotate-around-axis! sv-256 sv-256 f24-0 s0-0) - (vector-normalize! sv-240 1.0) - (vector-normalize! sv-256 1.0) - (add-debug-line - #f - (bucket-id debug) - s1-1 - (vector+float*! (new 'stack-no-clear 'vector) s1-1 sv-240 f30-0) - *color-yellow* - #f - (the-as rgba -1) - ) - (add-debug-line - #f - (bucket-id debug) - sv-368 - (vector+float*! (new 'stack-no-clear 'vector) sv-368 sv-256 f30-0) - *color-white* - #f - (the-as rgba -1) - ) - (let ((s0-1 add-debug-text-3d)) - (set! sv-144 (the-as symbol #f)) - (set! sv-160 583) - (set! sv-176 format) - (let ((a0-37 (clear *temp-string*)) - (a1-13 "p0") - ) - (sv-176 a0-37 a1-13) - ) - (let ((a2-8 *temp-string*) - (a3-7 s1-1) - (t0-5 3) - (t1-3 #f) - ) - (s0-1 sv-144 (the-as bucket-id sv-160) a2-8 a3-7 (the-as font-color t0-5) (the-as vector2h t1-3)) - ) - ) - (let ((s0-2 add-debug-text-3d)) - (set! sv-192 (the-as symbol #f)) - (set! sv-208 583) - (set! sv-224 format) - (let ((a0-40 (clear *temp-string*)) - (a1-15 "p1") - ) - (sv-224 a0-40 a1-15) - ) - (let ((a2-9 *temp-string*) - (a3-8 sv-368) - (t0-6 3) - (t1-4 #f) - ) - (s0-2 sv-192 (the-as bucket-id sv-208) a2-9 a3-8 (the-as font-color t0-6) (the-as vector2h t1-4)) - ) - ) - (let ((v1-49 sv-368) - (a0-42 s3-0) - (f0-11 f30-0) + (.add.x.vf.w vf1 vf0 vf0) + (.mul.x.vf.xyz vf1 vf1 vf2) + (.svf (&-> sv-256 quad) vf1) + (add-debug-line #f (bucket-id debug) s1-1 sv-368 *color-red* #f (the-as rgba -1)) + (vector-rotate-around-axis! sv-240 sv-240 f24-0 s0-0) + (vector-rotate-around-axis! sv-256 sv-256 f24-0 s0-0) + (vector-normalize! sv-240 1.0) + (vector-normalize! sv-256 1.0) + (add-debug-line + #f + (bucket-id debug) + s1-1 + (vector+float*! (new 'stack-no-clear 'vector) s1-1 sv-240 f30-0) + *color-yellow* + #f + (the-as rgba -1) ) - (vector+float*! v1-49 (-> a0-42 pos) sv-240 f0-11) - ) - (vector+float*! s1-1 (-> s2-0 pos) sv-256 f30-0) - (let ((s0-3 add-debug-text-3d)) - (set! sv-272 (the-as symbol #f)) - (set! sv-288 583) - (set! sv-304 format) - (let ((a0-45 (clear *temp-string*)) - (a1-19 "p0new") - ) - (sv-304 a0-45 a1-19) - ) - (let ((a2-10 *temp-string*) - (a3-9 s1-1) - (t0-7 7) - (t1-5 #f) - ) - (s0-3 sv-272 (the-as bucket-id sv-288) a2-10 a3-9 (the-as font-color t0-7) (the-as vector2h t1-5)) + (add-debug-line + #f + (bucket-id debug) + sv-368 + (vector+float*! (new 'stack-no-clear 'vector) sv-368 sv-256 f30-0) + *color-white* + #f + (the-as rgba -1) + ) + (let ((s0-1 add-debug-text-3d) + (sv-144 (the-as symbol #f)) + (sv-160 583) + ) + (format (clear *temp-string*) "p0") + (s0-1 sv-144 (the-as bucket-id sv-160) *temp-string* s1-1 (font-color red) (the-as vector2h #f)) + ) + (let ((s0-2 add-debug-text-3d) + (sv-192 (the-as symbol #f)) + (sv-208 583) + ) + (format (clear *temp-string*) "p1") + (s0-2 sv-192 (the-as bucket-id sv-208) *temp-string* sv-368 (font-color red) (the-as vector2h #f)) + ) + (vector+float*! sv-368 (-> s3-0 pos) sv-240 f30-0) + (vector+float*! s1-1 (-> s2-0 pos) sv-256 f30-0) ) ) - (let ((s0-4 add-debug-text-3d)) - (set! sv-320 (the-as symbol #f)) - (set! sv-336 583) - (set! sv-352 format) - (let ((a0-48 (clear *temp-string*)) - (a1-21 "p1new") - ) - (sv-352 a0-48 a1-21) - ) - (let ((a2-11 *temp-string*) - (a3-10 sv-368) - (t0-8 7) - (t1-6 #f) - ) - (s0-4 sv-320 (the-as bucket-id sv-336) a2-11 a3-10 (the-as font-color t0-8) (the-as vector2h t1-6)) - ) + (let ((s0-3 add-debug-text-3d) + (sv-272 (the-as symbol #f)) + (sv-288 583) + ) + (format (clear *temp-string*) "p0new") + (s0-3 sv-272 (the-as bucket-id sv-288) *temp-string* s1-1 (font-color blue) (the-as vector2h #f)) + ) + (let ((s0-4 add-debug-text-3d) + (sv-320 (the-as symbol #f)) + (sv-336 583) + ) + (format (clear *temp-string*) "p1new") + (s0-4 sv-320 (the-as bucket-id sv-336) *temp-string* sv-368 (font-color blue) (the-as vector2h #f)) ) (vector-lerp! (-> s3-0 pos) (-> s3-0 pos) s1-1 f28-0) - ) - (let ((t9-25 vector-lerp!) - (a0-51 s2-0) - (a1-24 s2-0) - (a3-12 f26-0) - ) - (t9-25 (-> a0-51 pos) (-> a1-24 pos) sv-368 a3-12) + (vector-lerp! (-> s2-0 pos) (-> s2-0 pos) sv-368 f26-0) ) ) ) (let ((s1-2 add-debug-text-3d) (s0-5 #f) + (sv-384 583) ) - (set! sv-384 583) - (set! sv-400 format) - (let ((a0-53 (clear *temp-string*)) - (a1-25 "p0f") - ) - (sv-400 a0-53 a1-25) - ) - (let ((a2-14 *temp-string*) - (a3-13 s3-0) - (t0-9 6) - (t1-7 #f) - ) - (s1-2 s0-5 (the-as bucket-id sv-384) a2-14 (-> a3-13 pos) (the-as font-color t0-9) (the-as vector2h t1-7)) - ) + (format (clear *temp-string*) "p0f") + (s1-2 s0-5 (the-as bucket-id sv-384) *temp-string* (-> s3-0 pos) (font-color green) (the-as vector2h #f)) ) (let ((s1-3 add-debug-text-3d) (s0-6 #f) + (sv-416 583) ) - (set! sv-416 583) - (set! sv-432 format) - (let ((a0-56 (clear *temp-string*)) - (a1-27 "p1f") - ) - (sv-432 a0-56 a1-27) - ) - (let ((a2-15 *temp-string*) - (a3-14 s2-0) - (t0-10 6) - (t1-8 #f) - ) - (s1-3 s0-6 (the-as bucket-id sv-416) a2-15 (-> a3-14 pos) (the-as font-color t0-10) (the-as vector2h t1-8)) - ) + (format (clear *temp-string*) "p1f") + (s1-3 s0-6 (the-as bucket-id sv-416) *temp-string* (-> s2-0 pos) (font-color green) (the-as vector2h #f)) ) (vector-! s4-1 (-> s2-0 pos) (-> s3-0 pos)) (vector-normalize! s4-1 1.0) diff --git a/goal_src/jak3/levels/desert/wvehicle/w-parking-spot.gc b/goal_src/jak3/levels/desert/wvehicle/w-parking-spot.gc index 32aec47dd3..3934784989 100644 --- a/goal_src/jak3/levels/desert/wvehicle/w-parking-spot.gc +++ b/goal_src/jak3/levels/desert/wvehicle/w-parking-spot.gc @@ -77,9 +77,9 @@ (if v1-1 (or (focus-test? (the-as vehicle v1-1) dead inactive) (not (logtest? (vehicle-flag waiting-for-player) (-> (the-as vehicle v1-1) v-flags))) - (let ((f0-0 (-> this test-sphere r))) - (< (* f0-0 f0-0) (vector-vector-distance-squared (-> (the-as vehicle v1-1) root trans) (-> this test-sphere))) - ) + (< (square (-> this test-sphere r)) + (vector-vector-distance-squared (-> (the-as vehicle v1-1) root trans) (-> this test-sphere)) + ) (let ((v1-5 *target*)) (when v1-5 (if (focus-test? v1-5 pilot-riding) @@ -249,15 +249,11 @@ ) (w-parking-spot-method-21 self) (when (-> self should-spawn?) - (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)) - (if (or (< (* f1-3 f1-3) f0-0) (not (sphere-in-view-frustum? (-> self test-sphere)))) - (w-parking-spot-method-23 self) - ) - ) + (let ((f0-0 (vector-vector-distance-squared (camera-pos) (-> self test-sphere)))) + (when (< (square 327680.0) f0-0) + (if (or (< (square 614400.0) f0-0) (not (sphere-in-view-frustum? (-> self test-sphere)))) + (w-parking-spot-method-23 self) + ) ) ) ) diff --git a/goal_src/jak3/levels/desert/wvehicle/was-squad-control.gc b/goal_src/jak3/levels/desert/wvehicle/was-squad-control.gc index 538754cc9a..d597103fcc 100644 --- a/goal_src/jak3/levels/desert/wvehicle/was-squad-control.gc +++ b/goal_src/jak3/levels/desert/wvehicle/was-squad-control.gc @@ -176,11 +176,8 @@ (vector-copy! (-> s5-1 1 fvec) (-> s5-1 0 trans)) (vector-copy! (-> s5-1 1 trans) (-> (the-as process-focusable s4-0) root transv)) (vector-copy! (-> s5-1 2 uvec) (-> s5-1 1 trans)) - (let* ((v1-8 (-> s5-1 1 trans)) - (f0-3 (+ (* (-> v1-8 x) (-> v1-8 x)) (* (-> v1-8 z) (-> v1-8 z)))) - (f1-3 4096.0) - ) - (if (< f0-3 (* f1-3 f1-3)) + (let ((v1-8 (-> s5-1 1 trans))) + (if (< (+ (* (-> v1-8 x) (-> v1-8 x)) (* (-> v1-8 z) (-> v1-8 z))) (square 4096.0)) (vector-copy! (-> s5-1 2 uvec) (-> (the-as process-focusable s4-0) node-list data 0 bone transform fvec)) ) ) @@ -255,18 +252,16 @@ (vector+float*! (-> s4-5 vec 0) (-> s4-5 cquery start-pos) (-> s4-5 cquery move-dist) f30-0) (set! (-> s5-1 3 rvec quad) (-> s4-5 vec 0 quad)) (set! (-> s5-1 3 rvec w) 20480.0) - (let ((f0-31 1024000.0)) - (when (or (< (* f0-31 f0-31) (vector-vector-distance-squared (-> s5-1 1 fvec) (-> s4-5 vec 0))) - (not (sphere-in-view-frustum? (the-as sphere (-> s5-1 3)))) - ) - (vector-copy! (-> s4-5 vec 1) (-> s4-5 cquery best-other-tri normal)) - (when (< (-> s4-5 vec 1 y) (cos 3640.889)) - (vector-reset! (-> s4-5 vec 1)) - (set! (-> s4-5 vec 1 y) 1.0) - ) - (forward-up-nopitch->quaternion (the-as quaternion (-> s5-1 2)) (-> s4-5 vec 2) (-> s4-5 vec 1)) - (spawn-unit this (-> s4-5 vec 0) (the-as quaternion (-> s5-1 2))) + (when (or (< (square 1024000.0) (vector-vector-distance-squared (-> s5-1 1 fvec) (-> s4-5 vec 0))) + (not (sphere-in-view-frustum? (the-as sphere (-> s5-1 3)))) + ) + (vector-copy! (-> s4-5 vec 1) (-> s4-5 cquery best-other-tri normal)) + (when (< (-> s4-5 vec 1 y) (cos 3640.889)) + (vector-reset! (-> s4-5 vec 1)) + (set! (-> s4-5 vec 1 y) 1.0) ) + (forward-up-nopitch->quaternion (the-as quaternion (-> s5-1 2)) (-> s4-5 vec 2) (-> s4-5 vec 1)) + (spawn-unit this (-> s4-5 vec 0) (the-as quaternion (-> s5-1 2))) ) ) (if (< f30-0 0.0) @@ -314,18 +309,16 @@ ) (set! (-> s5-1 0 rvec quad) (-> (the-as process-focusable s3-0) root trans quad)) (when (not (logtest? (-> (the-as process-focusable s3-0) draw status) (draw-control-status on-screen))) - (let ((f0-8 614400.0)) - (when (or (and (< (* f0-8 f0-8) (vector-vector-distance-squared (-> s5-1 0 uvec) (-> s5-1 0 rvec))) - (or (< (vector4-dot (-> s5-1 1 rvec) (-> s5-1 0 rvec)) 0.0) - (< (vector4-dot (-> s5-1 1 uvec) (-> s5-1 0 rvec)) 0.0) - ) - ) - (zero? (-> this target-count)) - ) - (when (send-event s3-0 'go-die) - (+! (-> this reserve-count) 1) - (set! (-> this units s4-1) (the-as handle #f)) - ) + (when (or (and (< (square 614400.0) (vector-vector-distance-squared (-> s5-1 0 uvec) (-> s5-1 0 rvec))) + (or (< (vector4-dot (-> s5-1 1 rvec) (-> s5-1 0 rvec)) 0.0) + (< (vector4-dot (-> s5-1 1 uvec) (-> s5-1 0 rvec)) 0.0) + ) + ) + (zero? (-> this target-count)) + ) + (when (send-event s3-0 'go-die) + (+! (-> this reserve-count) 1) + (set! (-> this units s4-1) (the-as handle #f)) ) ) ) diff --git a/goal_src/jak3/levels/desert/wvehicle/wcar-marauder.gc b/goal_src/jak3/levels/desert/wvehicle/wcar-marauder.gc index 0ba35a1ccb..7bdee5b87a 100644 --- a/goal_src/jak3/levels/desert/wvehicle/wcar-marauder.gc +++ b/goal_src/jak3/levels/desert/wvehicle/wcar-marauder.gc @@ -179,13 +179,9 @@ ((= v1-14 5) (let ((s5-3 (new 'stack-no-clear 'wcar-marauder-stack-var0))) (set! (-> s5-3 time) (the-as uint (current-time))) - (let ((f0-9 1.0) - (f1-7 1.0) - (f2-3 8.0) - (f3-2 (* 0.0033333334 (the float (- (-> s5-3 time) (-> this sub-state-time))))) + (set! (-> s5-3 float1) + (- 1.0 (fmin 1.0 (* 8.0 (square (* 0.0033333334 (the float (- (-> s5-3 time) (-> this sub-state-time)))))))) ) - (set! (-> s5-3 float1) (- f0-9 (fmin f1-7 (* f2-3 (* f3-2 f3-2))))) - ) (set! (-> s5-3 float0) (* 16384.0 (-> s5-3 float1))) (quaternion-axis-angle! (-> this jmod-hatch rotation) 1.0 0.0 0.0 (-> s5-3 float0)) (when (= (-> s5-3 float1) 0.0) diff --git a/goal_src/jak3/levels/desert/wvehicle/wcar-toad.gc b/goal_src/jak3/levels/desert/wvehicle/wcar-toad.gc index e7df19cdbc..c0c9fa8275 100644 --- a/goal_src/jak3/levels/desert/wvehicle/wcar-toad.gc +++ b/goal_src/jak3/levels/desert/wvehicle/wcar-toad.gc @@ -319,11 +319,7 @@ ) ) (set! (-> arg0 sin-susp-ang) (fmax -1.0 (fmin 1.0 (/ (- (-> gp-0 wsphere x)) (-> gp-0 wsphere z))))) - (let ((f0-52 1.0) - (f1-16 (-> arg0 sin-susp-ang)) - ) - (set! (-> arg0 cos-susp-ang) (sqrtf (- f0-52 (* f1-16 f1-16)))) - ) + (set! (-> arg0 cos-susp-ang) (sqrtf (- 1.0 (square (-> arg0 sin-susp-ang))))) (quaternion-identity! (the-as quaternion (-> gp-0 local-pos))) (set! (-> gp-0 local-pos z) (* (sin (-> arg1 camber)) (-> arg0 x-scale))) (set! (-> gp-0 local-pos w) (cos (-> arg1 camber))) diff --git a/goal_src/jak3/levels/desert/wvehicle/wcar.gc b/goal_src/jak3/levels/desert/wvehicle/wcar.gc index 386c932bd4..98a4e1ebf1 100644 --- a/goal_src/jak3/levels/desert/wvehicle/wcar.gc +++ b/goal_src/jak3/levels/desert/wvehicle/wcar.gc @@ -3872,19 +3872,11 @@ (cond ((< (-> s5-0 vec0 7 w) (-> s5-0 vec0 2 y)) (set! (-> s5-0 vec0 2 y) (-> s5-0 vec0 7 w)) - (let ((f0-16 1.0) - (f1-3 (-> s5-0 vec0 7 w)) - ) - (set! (-> s5-0 vec0 2 z) (sqrtf (- f0-16 (* f1-3 f1-3)))) - ) + (set! (-> s5-0 vec0 2 z) (sqrtf (- 1.0 (square (-> s5-0 vec0 7 w))))) ) ((< (-> s5-0 vec0 2 y) (-> s5-0 vec0 7 z)) (set! (-> s5-0 vec0 2 y) (-> s5-0 vec0 7 z)) - (let ((f0-21 1.0) - (f1-7 (-> s5-0 vec0 7 z)) - ) - (set! (-> s5-0 vec0 2 z) (sqrtf (- f0-21 (* f1-7 f1-7)))) - ) + (set! (-> s5-0 vec0 2 z) (sqrtf (- 1.0 (square (-> s5-0 vec0 7 z))))) ) ) (if (< 0.0 (-> s5-0 vec0 2 z)) diff --git a/goal_src/jak3/levels/desert/wvehicle/wvehicle-ai.gc b/goal_src/jak3/levels/desert/wvehicle/wvehicle-ai.gc index 3a1647d21b..09217b9e93 100644 --- a/goal_src/jak3/levels/desert/wvehicle/wvehicle-ai.gc +++ b/goal_src/jak3/levels/desert/wvehicle/wvehicle-ai.gc @@ -103,11 +103,9 @@ ) (vector-copy! (-> gp-0 mat fvec) (-> this target-status position)) (vector-copy! (-> gp-0 mat trans) (-> this target-status velocity)) - (let ((f0-11 40960.0)) - (if (< (* f0-11 f0-11) (vector-length-squared (-> gp-0 mat trans))) - (vector-copy! (-> gp-0 force) (-> gp-0 mat trans)) - ) - ) + (if (< (square 40960.0) (vector-length-squared (-> gp-0 mat trans))) + (vector-copy! (-> gp-0 force) (-> gp-0 mat trans)) + ) (set! (-> gp-0 wheel-axis x) (fmax (fmin (+ 20480.0 (vector-length (-> gp-0 mat trans))) (-> this ai-max-speed)) (-> this ai-min-speed)) ) @@ -131,17 +129,13 @@ 1.0 ) ) - (let ((f0-25 (-> gp-0 wsphere z)) - (f1-8 40960.0) - ) - (when (< f0-25 (* f1-8 f1-8)) - (vector+float*! (-> gp-0 p-body) (-> gp-0 ground-normal-sum) (-> gp-0 ground-pos) 0.0) - (vector-! (-> gp-0 world-normal) (-> gp-0 axis) (-> gp-0 p-body)) - (vector-normalize! (-> gp-0 world-normal) 1.0) - (vector+float*! (-> gp-0 velocity) (-> gp-0 mat rvec) (-> gp-0 world-normal) 163840.0) - (set! (-> gp-0 wheel-axis x) (/ (-> gp-0 wheel-axis x) 2)) - 0 - ) + (when (< (-> gp-0 wsphere z) (square 40960.0)) + (vector+float*! (-> gp-0 p-body) (-> gp-0 ground-normal-sum) (-> gp-0 ground-pos) 0.0) + (vector-! (-> gp-0 world-normal) (-> gp-0 axis) (-> gp-0 p-body)) + (vector-normalize! (-> gp-0 world-normal) 1.0) + (vector+float*! (-> gp-0 velocity) (-> gp-0 mat rvec) (-> gp-0 world-normal) 163840.0) + (set! (-> gp-0 wheel-axis x) (/ (-> gp-0 wheel-axis x) 2)) + 0 ) ) 0 diff --git a/goal_src/jak3/levels/desert/wvehicle/wvehicle-physics.gc b/goal_src/jak3/levels/desert/wvehicle/wvehicle-physics.gc index 32187cca8d..079eb41767 100644 --- a/goal_src/jak3/levels/desert/wvehicle/wvehicle-physics.gc +++ b/goal_src/jak3/levels/desert/wvehicle/wvehicle-physics.gc @@ -183,311 +183,306 @@ ) (defmethod vehicle-method-97 ((this wvehicle) (arg0 float) (arg1 vehicle-physics-work)) - (local-vars (sv-16 rigid-body-control)) - (set! sv-16 (-> this rbody)) - (dotimes (s3-0 (-> this info physics-model wheel-count)) - (let* ((s2-0 (-> this wheel s3-0)) - (s1-0 (-> s2-0 info)) - (f30-0 - (fmax - 0.0 - (- 1.0 (-> (the-as wvehicle-physics-work (+ (the-as uint arg1) (* 144 s3-0))) probe-work-array 0 probe-uu)) + (let ((sv-16 (-> this rbody))) + (dotimes (s3-0 (-> this info physics-model wheel-count)) + (let* ((s2-0 (-> this wheel s3-0)) + (s1-0 (-> s2-0 info)) + (f30-0 + (fmax + 0.0 + (- 1.0 (-> (the-as wvehicle-physics-work (+ (the-as uint arg1) (* 144 s3-0))) probe-work-array 0 probe-uu)) + ) ) ) - ) - (if (>= (-> this info handling cos-ground-effect-angle) (vector-dot (-> s2-0 ground-normal) (-> arg1 mat uvec))) - (set! f30-0 0.0) + (if (>= (-> this info handling cos-ground-effect-angle) (vector-dot (-> s2-0 ground-normal) (-> arg1 mat uvec))) + (set! f30-0 0.0) + ) + (set! (-> s2-0 up-force) 0.0) + (when (< 0.0 f30-0) + (rigid-body-control-method-23 sv-16 (-> s2-0 ground-pos) (-> arg1 velocity)) + (let* ((f0-4 0.0) + (f1-9 (* 2.0 + (-> this info info mass) + (-> this info extra gravity) + f30-0 + (-> this susp-spring-control) + (-> s1-0 suspension-spring) + ) + ) + (f2-5 0.25) + (f3-0 arg0) + (f0-5 (fmax f0-4 (+ f1-9 (* f2-5 + (/ 1.0 f3-0) + (-> this info info mass) + (-> s1-0 suspension-damping) + (fmax 0.0 (- (vector-dot (-> arg1 velocity) (-> s2-0 ground-normal)))) + ) + ) + ) + ) + ) + (set! (-> s2-0 up-force) f0-5) + (vector-float*! (-> arg1 force) (-> s2-0 ground-normal) f0-5) + ) + (apply-impact! sv-16 (-> s2-0 ground-pos) (-> arg1 force)) ) - (set! (-> s2-0 up-force) 0.0) - (when (< 0.0 f30-0) - (rigid-body-control-method-23 sv-16 (-> s2-0 ground-pos) (-> arg1 velocity)) - (let* ((f0-4 0.0) - (f1-9 (* 2.0 - (-> this info info mass) - (-> this info extra gravity) - f30-0 - (-> this susp-spring-control) - (-> s1-0 suspension-spring) + ) + ) + (dotimes (s3-1 (-> this info physics-model wheel-count)) + (let* ((s2-1 (-> this wheel s3-1)) + (s1-1 (-> s2-1 info)) + ) + (set! (-> arg1 probe-work-array 0 world-normal y) (* (-> s1-1 scale) (-> s1-1 radius))) + (set! (-> arg1 probe-work-array 0 ground-normal x) 1.0) + (when (< 0.0 (-> s2-1 up-force)) + (rigid-body-control-method-23 sv-16 (-> s2-1 ground-pos) (-> arg1 velocity)) + (if (logtest? (-> s2-1 surface flags) (vehicle-wheel-surface-flag moving)) + (vector-! (-> arg1 velocity) (-> arg1 velocity) (-> this surface-velocity)) + ) + (let ((s0-0 (the-as object (+ (+ (* 144 s3-1) 416) (the-as int arg1))))) + (vector-copy! (-> arg1 probe-work-array 0 local-normal) (-> (the-as wvehicle-physics-work s0-0) force)) + (vector+float*! + (-> (the-as wvehicle-physics-work s0-0) velocity) + (-> arg1 probe-work-array 0 local-normal) + (-> s2-1 ground-normal) + (- (vector-dot (-> arg1 probe-work-array 0 local-normal) (-> s2-1 ground-normal))) + ) + (vector-normalize! (the-as vector (+ (the-as int s0-0) 80)) 1.0) + (vector-cross! + (the-as vector (+ (the-as int s0-0) 96)) + (-> arg1 probe-work-array 0 local-normal) + (-> s2-1 ground-normal) + ) + (vector-normalize! (-> (the-as wvehicle-physics-work s0-0) world-pos) 1.0) + (vector-copy! + (-> (the-as wvehicle-physics-work arg1) forward-dir) + (-> (the-as wvehicle-physics-work s0-0) world-pos) + ) + (vector-copy! + (-> (the-as wvehicle-physics-work arg1) side-dir) + (-> (the-as wvehicle-physics-work s0-0) velocity) + ) + (vector-copy! + (-> (the-as wvehicle-physics-work s0-0) world-normal) + (-> (the-as wvehicle-physics-work arg1) velocity) + ) + ) + (set! (-> s2-1 side-vel) + (vector-dot + (-> (the-as wvehicle-physics-work arg1) velocity) + (-> (the-as wvehicle-physics-work arg1) side-dir) + ) + ) + (set! (-> s2-1 forward-vel) (vector-dot (-> arg1 velocity) (the-as vector (&-> arg1 impulse)))) + (set! (-> s2-1 up-vel) (vector-dot (-> arg1 velocity) (-> s2-1 ground-normal))) + (set! (-> s2-1 forward-slip-vel) + (+ (-> s2-1 forward-vel) (* -1.0 (-> arg1 probe-work-array 0 world-normal y) (-> s2-1 rev))) + ) + (let ((f0-25 (sqrtf (+ (square (-> s2-1 side-vel)) (square (-> s2-1 forward-slip-vel)))))) + (set! (-> s2-1 friction-coef) + (* (smooth-interp + (-> this info handling tire-static-friction) + (-> this info handling tire-dynamic-friction) + f0-25 + (-> this info handling tire-static-friction-speed) + (-> this info handling tire-dynamic-friction-speed) + ) + (-> s2-1 surface friction) + ) + ) + ) + (set! (-> arg1 probe-work-array 0 ground-normal x) (-> s2-1 surface drag)) + ) + (set! (-> arg1 probe-work-array 0 ground-pos y) (-> s2-1 torque)) + (when (< 0.0 (-> s2-1 up-force)) + (let ((f0-36 + (* (-> s2-1 up-force) + (-> s2-1 friction-coef) + (-> s1-1 forward-grip) + (-> arg1 probe-work-array 0 world-normal y) + ) + ) + (f1-29 + (/ (* (/ (-> s2-1 inertia) 2) (-> s2-1 forward-slip-vel)) + (* arg0 (-> arg1 probe-work-array 0 world-normal y)) + ) + ) + ) + (if (logtest? (-> s1-1 flags) (vehicle-wheel-flag vwf0)) + (set! f1-29 (* f1-29 (/ 1.0 (the float (-> this info physics-model drive-wheel-count))))) + ) + (set! (-> arg1 probe-work-array 0 probe-pos w) (fmax (fmin f1-29 f0-36) (- f0-36))) + ) + (+! (-> arg1 probe-work-array 0 ground-pos y) (-> arg1 probe-work-array 0 probe-pos w)) + ) + (set! (-> arg1 probe-work-array 0 ground-pos z) + (- (* -0.25 (/ 1.0 arg0) (-> s2-1 rev) (-> s2-1 inertia)) (-> arg1 probe-work-array 0 ground-pos y)) + ) + (set! (-> arg1 probe-work-array 0 ground-pos w) (fabs (-> s2-1 braking-torque))) + (set! (-> arg1 probe-work-array 0 ground-pos x) + (fmax + (fmin (-> arg1 probe-work-array 0 ground-pos z) (-> arg1 probe-work-array 0 ground-pos w)) + (- (-> arg1 probe-work-array 0 ground-pos w)) + ) + ) + (+! (-> arg1 probe-work-array 0 ground-pos y) (-> arg1 probe-work-array 0 ground-pos x)) + (let ((f0-57 (* -1.0 + (-> s2-1 rev) + (-> s2-1 inertia) + (-> arg1 probe-work-array 0 ground-normal x) + (-> this info handling rolling-resistance) ) ) - (f2-5 0.25) - (f3-0 arg0) - (f0-5 (fmax f0-4 (+ f1-9 (* f2-5 - (/ 1.0 f3-0) - (-> this info info mass) - (-> s1-0 suspension-damping) - (fmax 0.0 (- (vector-dot (-> arg1 velocity) (-> s2-0 ground-normal)))) - ) - ) - ) - ) - ) - (set! (-> s2-0 up-force) f0-5) - (vector-float*! (-> arg1 force) (-> s2-0 ground-normal) f0-5) + ) + (if (logtest? (vehicle-flag turbo-boost) (-> this v-flags)) + (set! f0-57 (/ f0-57 20)) + ) + (+! (-> arg1 probe-work-array 0 ground-pos y) f0-57) ) - (apply-impact! sv-16 (-> s2-0 ground-pos) (-> arg1 force)) + (cond + ((logtest? (-> s1-1 flags) (vehicle-wheel-flag vwf0)) + (+! (-> this wheel-torque) (-> arg1 probe-work-array 0 ground-pos y)) + ) + (else + (let ((f0-61 (-> s2-1 rev)) + (f1-49 (* (-> arg1 probe-work-array 0 ground-pos y) arg0)) + (f2-20 (-> s2-1 inertia)) + ) + (set! (-> s2-1 rev) (+ f0-61 (* f1-49 (/ 1.0 f2-20)))) + ) + (set! (-> s2-1 rev) (fmax -125.6637 (fmin 125.6637 (-> s2-1 rev)))) + ) + ) + ) + 0 + ) + (let ((f0-65 (-> this wheel-rev)) + (f1-54 (* arg0 (-> this wheel-torque))) + (f2-25 (-> this wheel-inertia)) + ) + (set! (-> this wheel-rev) (+ f0-65 (* f1-54 (/ 1.0 f2-25)))) + ) + (set! (-> this wheel-rev) (fmax -125.6637 (fmin 125.6637 (-> this wheel-rev)))) + (dotimes (v1-110 (-> this info physics-model wheel-count)) + (let ((a0-28 (-> this wheel v1-110))) + (if (logtest? (-> a0-28 info flags) (vehicle-wheel-flag vwf0)) + (set! (-> a0-28 rev) (* (-> this wheel-rev) (-> a0-28 drive-diff))) + ) ) ) - ) - (dotimes (s3-1 (-> this info physics-model wheel-count)) - (let* ((s2-1 (-> this wheel s3-1)) - (s1-1 (-> s2-1 info)) + (let* ((f0-71 (-> this info engine inertia)) + (f1-59 (-> this clutch-grab)) + (f2-29 (-> this clutch-inertia)) + (f3-12 (-> this gear-ratio)) + (f3-16 (square (/ 1.0 f3-12))) + (f4-5 (-> this info transmission inertia)) + (f5-0 (-> this final-drive-ratio)) ) - (set! (-> arg1 probe-work-array 0 world-normal y) (* (-> s1-1 scale) (-> s1-1 radius))) - (set! (-> arg1 probe-work-array 0 ground-normal x) 1.0) - (when (< 0.0 (-> s2-1 up-force)) - (rigid-body-control-method-23 sv-16 (-> s2-1 ground-pos) (-> arg1 velocity)) - (if (logtest? (-> s2-1 surface flags) (vehicle-wheel-surface-flag moving)) - (vector-! (-> arg1 velocity) (-> arg1 velocity) (-> this surface-velocity)) + (set! (-> arg1 probe-work-array 0 probe-pos z) + (+ f0-71 (* f1-59 (+ f2-29 (* f3-16 (+ f4-5 (* (square (/ 1.0 f5-0)) (-> this drive-wheel-inertia))))))) + ) + ) + (let* ((f3-18 (- (* (- (fmax 0.0 (* (-> this total-gear-ratio) (-> this wheel-rev))) (-> this engine-rev)) + (-> arg1 probe-work-array 0 probe-pos z) + (/ 1.0 arg0) + ) + (-> this engine-torque) + ) + ) + (f0-78 (-> this engine-rev)) + (f1-69 (* arg0 (+ (-> this engine-torque) (* f3-18 (-> this clutch-grab))))) + (f2-35 (-> arg1 probe-work-array 0 probe-pos z)) + ) + (set! (-> this engine-rev) (+ f0-78 (* f1-69 (/ 1.0 f2-35)))) + ) + (let* ((f0-80 (-> this engine-rev)) + (f1-71 (-> this info engine max-rpm)) + (f0-81 (fmin f0-80 (* 0.10471976 f1-71))) + (f1-74 (-> this info engine min-rpm)) + ) + (set! (-> this engine-rev) (fmax f0-81 (* 0.10471976 f1-74))) + ) + (dotimes (s3-2 (-> this info physics-model wheel-count)) + (let* ((s1-2 (-> this wheel s3-2)) + (s2-2 (-> s1-2 info)) + ) + (when (< 0.0 (-> s1-2 up-force)) + (set! (-> arg1 probe-work-array 0 world-normal y) (* (-> s2-2 scale) (-> s2-2 radius))) + (let ((v1-138 (-> (the-as wvehicle-physics-work arg1) probe-work-array s3-2))) + (vector-copy! (-> (the-as wvehicle-physics-work arg1) forward-dir) (-> v1-138 forward-dir)) + (vector-copy! (-> (the-as wvehicle-physics-work arg1) side-dir) (-> v1-138 side-dir)) + (vector-copy! (-> (the-as wvehicle-physics-work arg1) velocity) (-> v1-138 velocity)) + ) + (vector-copy! (-> (the-as wvehicle-physics-work arg1) ground-pos) (-> s1-2 ground-pos)) + (vector-! + (-> (the-as wvehicle-physics-work arg1) p-body) + (-> (the-as wvehicle-physics-work arg1) ground-pos) + (-> sv-16 position) + ) + (vector-cross! (-> arg1 normal) (-> arg1 tmp) (-> arg1 probe-work-array 0 local-pos)) + (vector-rotate*! (-> arg1 normal) (-> arg1 normal) (-> sv-16 inv-i-world)) + (vector-cross! (-> arg1 normal) (-> arg1 normal) (-> arg1 tmp)) + (set! (-> arg1 probe-work-array 0 world-normal z) + (/ (/ (-> s1-2 side-vel) -2) + (* arg0 (+ (-> sv-16 info inv-mass) (vector-dot (-> arg1 probe-work-array 0 local-pos) (-> arg1 normal)))) + ) + ) + (set! (-> arg1 probe-work-array 0 world-normal w) 0.0) + (set! (-> s1-2 forward-slip-vel) + (+ (-> s1-2 forward-vel) (* -1.0 (-> arg1 probe-work-array 0 world-normal y) (-> s1-2 rev))) + ) + (vector-cross! (-> arg1 normal) (-> arg1 tmp) (the-as vector (&-> arg1 impulse))) + (vector-rotate*! (-> arg1 normal) (-> arg1 normal) (-> sv-16 inv-i-world)) + (vector-cross! (-> arg1 normal) (-> arg1 normal) (-> arg1 tmp)) + (let ((f0-94 + (/ (/ (-> s1-2 forward-slip-vel) -4) + (* arg0 (+ (-> sv-16 info inv-mass) (vector-dot (the-as vector (&-> arg1 impulse)) (-> arg1 normal)))) + ) + ) + ) + (+! (-> arg1 probe-work-array 0 world-normal w) f0-94) + ) + (set! (-> arg1 probe-work-array 0 probe-pos y) + (* (-> s1-2 friction-coef) (-> s1-2 up-force) (-> s2-2 side-grip)) + ) + (set! (-> arg1 probe-work-array 0 probe-pos x) + (* (-> s1-2 friction-coef) (-> s1-2 up-force) (-> s2-2 forward-grip)) + ) + (let ((f0-106 + (+ (square (/ (-> arg1 probe-work-array 0 world-normal z) (-> arg1 probe-work-array 0 probe-pos y))) + (square (/ (-> arg1 probe-work-array 0 world-normal w) (-> arg1 probe-work-array 0 probe-pos x))) + ) + ) + ) + (when (< 1.0 f0-106) + (let ((f0-108 (/ 1.0 (sqrtf f0-106)))) + (set! (-> arg1 probe-work-array 0 world-normal z) (* (-> arg1 probe-work-array 0 world-normal z) f0-108)) + (set! (-> arg1 probe-work-array 0 world-normal w) (* (-> arg1 probe-work-array 0 world-normal w) f0-108)) + ) + ) + ) + (vector-float*! + (-> arg1 force) + (-> arg1 probe-work-array 0 local-pos) + (-> arg1 probe-work-array 0 world-normal z) ) - (let ((s0-0 (the-as object (+ (+ (* 144 s3-1) 416) (the-as int arg1))))) - (vector-copy! (-> arg1 probe-work-array 0 local-normal) (-> (the-as wvehicle-physics-work s0-0) force)) (vector+float*! - (-> (the-as wvehicle-physics-work s0-0) velocity) - (-> arg1 probe-work-array 0 local-normal) - (-> s2-1 ground-normal) - (- (vector-dot (-> arg1 probe-work-array 0 local-normal) (-> s2-1 ground-normal))) + (-> arg1 force) + (-> arg1 force) + (the-as vector (&-> arg1 impulse)) + (-> arg1 probe-work-array 0 world-normal w) ) - (vector-normalize! (the-as vector (+ (the-as int s0-0) 80)) 1.0) - (vector-cross! - (the-as vector (+ (the-as int s0-0) 96)) - (-> arg1 probe-work-array 0 local-normal) - (-> s2-1 ground-normal) - ) - (vector-normalize! (-> (the-as wvehicle-physics-work s0-0) world-pos) 1.0) - (vector-copy! - (-> (the-as wvehicle-physics-work arg1) forward-dir) - (-> (the-as wvehicle-physics-work s0-0) world-pos) - ) - (vector-copy! - (-> (the-as wvehicle-physics-work arg1) side-dir) - (-> (the-as wvehicle-physics-work s0-0) velocity) - ) - (vector-copy! - (-> (the-as wvehicle-physics-work s0-0) world-normal) - (-> (the-as wvehicle-physics-work arg1) velocity) - ) - ) - (set! (-> s2-1 side-vel) - (vector-dot - (-> (the-as wvehicle-physics-work arg1) velocity) - (-> (the-as wvehicle-physics-work arg1) side-dir) + (let ((f0-114 + (* (vector-dot (-> arg1 tmp) (-> arg1 mat uvec)) (+ -1.0 (-> this info handling ground-torque-scale))) + ) ) - ) - (set! (-> s2-1 forward-vel) (vector-dot (-> arg1 velocity) (the-as vector (&-> arg1 impulse)))) - (set! (-> s2-1 up-vel) (vector-dot (-> arg1 velocity) (-> s2-1 ground-normal))) - (set! (-> s2-1 forward-slip-vel) - (+ (-> s2-1 forward-vel) (* -1.0 (-> arg1 probe-work-array 0 world-normal y) (-> s2-1 rev))) - ) - (let* ((f0-21 (-> s2-1 side-vel)) - (f0-23 (* f0-21 f0-21)) - (f1-16 (-> s2-1 forward-slip-vel)) - (f0-25 (sqrtf (+ f0-23 (* f1-16 f1-16)))) - ) - (set! (-> s2-1 friction-coef) - (* (smooth-interp - (-> this info handling tire-static-friction) - (-> this info handling tire-dynamic-friction) - f0-25 - (-> this info handling tire-static-friction-speed) - (-> this info handling tire-dynamic-friction-speed) - ) - (-> s2-1 surface friction) - ) - ) - ) - (set! (-> arg1 probe-work-array 0 ground-normal x) (-> s2-1 surface drag)) - ) - (set! (-> arg1 probe-work-array 0 ground-pos y) (-> s2-1 torque)) - (when (< 0.0 (-> s2-1 up-force)) - (let ((f0-36 - (* (-> s2-1 up-force) - (-> s2-1 friction-coef) - (-> s1-1 forward-grip) - (-> arg1 probe-work-array 0 world-normal y) - ) - ) - (f1-29 - (/ (* (/ (-> s2-1 inertia) 2) (-> s2-1 forward-slip-vel)) - (* arg0 (-> arg1 probe-work-array 0 world-normal y)) - ) - ) - ) - (if (logtest? (-> s1-1 flags) (vehicle-wheel-flag vwf0)) - (set! f1-29 (* f1-29 (/ 1.0 (the float (-> this info physics-model drive-wheel-count))))) - ) - (set! (-> arg1 probe-work-array 0 probe-pos w) (fmax (fmin f1-29 f0-36) (- f0-36))) - ) - (+! (-> arg1 probe-work-array 0 ground-pos y) (-> arg1 probe-work-array 0 probe-pos w)) - ) - (set! (-> arg1 probe-work-array 0 ground-pos z) - (- (* -0.25 (/ 1.0 arg0) (-> s2-1 rev) (-> s2-1 inertia)) (-> arg1 probe-work-array 0 ground-pos y)) + (vector+float*! (-> arg1 ground-normal) (-> arg1 ground-normal) (-> arg1 mat uvec) f0-114) ) - (set! (-> arg1 probe-work-array 0 ground-pos w) (fabs (-> s2-1 braking-torque))) - (set! (-> arg1 probe-work-array 0 ground-pos x) - (fmax - (fmin (-> arg1 probe-work-array 0 ground-pos z) (-> arg1 probe-work-array 0 ground-pos w)) - (- (-> arg1 probe-work-array 0 ground-pos w)) - ) - ) - (+! (-> arg1 probe-work-array 0 ground-pos y) (-> arg1 probe-work-array 0 ground-pos x)) - (let ((f0-57 (* -1.0 - (-> s2-1 rev) - (-> s2-1 inertia) - (-> arg1 probe-work-array 0 ground-normal x) - (-> this info handling rolling-resistance) - ) - ) - ) - (if (logtest? (vehicle-flag turbo-boost) (-> this v-flags)) - (set! f0-57 (/ f0-57 20)) - ) - (+! (-> arg1 probe-work-array 0 ground-pos y) f0-57) - ) - (cond - ((logtest? (-> s1-1 flags) (vehicle-wheel-flag vwf0)) - (+! (-> this wheel-torque) (-> arg1 probe-work-array 0 ground-pos y)) - ) - (else - (let ((f0-61 (-> s2-1 rev)) - (f1-49 (* (-> arg1 probe-work-array 0 ground-pos y) arg0)) - (f2-20 (-> s2-1 inertia)) - ) - (set! (-> s2-1 rev) (+ f0-61 (* f1-49 (/ 1.0 f2-20)))) - ) - (set! (-> s2-1 rev) (fmax -125.6637 (fmin 125.6637 (-> s2-1 rev)))) + (apply-impact! sv-16 (-> arg1 ground-normal) (-> arg1 force)) + 0 ) ) ) - 0 - ) - (let ((f0-65 (-> this wheel-rev)) - (f1-54 (* arg0 (-> this wheel-torque))) - (f2-25 (-> this wheel-inertia)) - ) - (set! (-> this wheel-rev) (+ f0-65 (* f1-54 (/ 1.0 f2-25)))) - ) - (set! (-> this wheel-rev) (fmax -125.6637 (fmin 125.6637 (-> this wheel-rev)))) - (dotimes (v1-110 (-> this info physics-model wheel-count)) - (let ((a0-28 (-> this wheel v1-110))) - (if (logtest? (-> a0-28 info flags) (vehicle-wheel-flag vwf0)) - (set! (-> a0-28 rev) (* (-> this wheel-rev) (-> a0-28 drive-diff))) - ) - ) - ) - (let* ((f0-71 (-> this info engine inertia)) - (f1-59 (-> this clutch-grab)) - (f2-29 (-> this clutch-inertia)) - (f3-12 (-> this gear-ratio)) - (f3-14 (/ 1.0 f3-12)) - (f3-16 (* f3-14 f3-14)) - (f4-5 (-> this info transmission inertia)) - (f5-0 (-> this final-drive-ratio)) - (f5-2 (/ 1.0 f5-0)) - ) - (set! (-> arg1 probe-work-array 0 probe-pos z) - (+ f0-71 (* f1-59 (+ f2-29 (* f3-16 (+ f4-5 (* f5-2 f5-2 (-> this drive-wheel-inertia))))))) - ) - ) - (let* ((f3-18 (- (* (- (fmax 0.0 (* (-> this total-gear-ratio) (-> this wheel-rev))) (-> this engine-rev)) - (-> arg1 probe-work-array 0 probe-pos z) - (/ 1.0 arg0) - ) - (-> this engine-torque) - ) - ) - (f0-78 (-> this engine-rev)) - (f1-69 (* arg0 (+ (-> this engine-torque) (* f3-18 (-> this clutch-grab))))) - (f2-35 (-> arg1 probe-work-array 0 probe-pos z)) - ) - (set! (-> this engine-rev) (+ f0-78 (* f1-69 (/ 1.0 f2-35)))) - ) - (let* ((f0-80 (-> this engine-rev)) - (f1-71 (-> this info engine max-rpm)) - (f0-81 (fmin f0-80 (* 0.10471976 f1-71))) - (f1-74 (-> this info engine min-rpm)) - ) - (set! (-> this engine-rev) (fmax f0-81 (* 0.10471976 f1-74))) - ) - (dotimes (s3-2 (-> this info physics-model wheel-count)) - (let* ((s1-2 (-> this wheel s3-2)) - (s2-2 (-> s1-2 info)) - ) - (when (< 0.0 (-> s1-2 up-force)) - (set! (-> arg1 probe-work-array 0 world-normal y) (* (-> s2-2 scale) (-> s2-2 radius))) - (let ((v1-138 (-> (the-as wvehicle-physics-work arg1) probe-work-array s3-2))) - (vector-copy! (-> (the-as wvehicle-physics-work arg1) forward-dir) (-> v1-138 forward-dir)) - (vector-copy! (-> (the-as wvehicle-physics-work arg1) side-dir) (-> v1-138 side-dir)) - (vector-copy! (-> (the-as wvehicle-physics-work arg1) velocity) (-> v1-138 velocity)) - ) - (vector-copy! (-> (the-as wvehicle-physics-work arg1) ground-pos) (-> s1-2 ground-pos)) - (vector-! - (-> (the-as wvehicle-physics-work arg1) p-body) - (-> (the-as wvehicle-physics-work arg1) ground-pos) - (-> sv-16 position) - ) - (vector-cross! (-> arg1 normal) (-> arg1 tmp) (-> arg1 probe-work-array 0 local-pos)) - (vector-rotate*! (-> arg1 normal) (-> arg1 normal) (-> sv-16 inv-i-world)) - (vector-cross! (-> arg1 normal) (-> arg1 normal) (-> arg1 tmp)) - (set! (-> arg1 probe-work-array 0 world-normal z) - (/ (/ (-> s1-2 side-vel) -2) - (* arg0 (+ (-> sv-16 info inv-mass) (vector-dot (-> arg1 probe-work-array 0 local-pos) (-> arg1 normal)))) - ) - ) - (set! (-> arg1 probe-work-array 0 world-normal w) 0.0) - (set! (-> s1-2 forward-slip-vel) - (+ (-> s1-2 forward-vel) (* -1.0 (-> arg1 probe-work-array 0 world-normal y) (-> s1-2 rev))) - ) - (vector-cross! (-> arg1 normal) (-> arg1 tmp) (the-as vector (&-> arg1 impulse))) - (vector-rotate*! (-> arg1 normal) (-> arg1 normal) (-> sv-16 inv-i-world)) - (vector-cross! (-> arg1 normal) (-> arg1 normal) (-> arg1 tmp)) - (let ((f0-94 - (/ (/ (-> s1-2 forward-slip-vel) -4) - (* arg0 (+ (-> sv-16 info inv-mass) (vector-dot (the-as vector (&-> arg1 impulse)) (-> arg1 normal)))) - ) - ) - ) - (+! (-> arg1 probe-work-array 0 world-normal w) f0-94) - ) - (set! (-> arg1 probe-work-array 0 probe-pos y) - (* (-> s1-2 friction-coef) (-> s1-2 up-force) (-> s2-2 side-grip)) - ) - (set! (-> arg1 probe-work-array 0 probe-pos x) - (* (-> s1-2 friction-coef) (-> s1-2 up-force) (-> s2-2 forward-grip)) - ) - (let* ((f0-103 (/ (-> arg1 probe-work-array 0 world-normal z) (-> arg1 probe-work-array 0 probe-pos y))) - (f0-105 (* f0-103 f0-103)) - (f1-95 (/ (-> arg1 probe-work-array 0 world-normal w) (-> arg1 probe-work-array 0 probe-pos x))) - (f0-106 (+ f0-105 (* f1-95 f1-95))) - ) - (when (< 1.0 f0-106) - (let ((f0-108 (/ 1.0 (sqrtf f0-106)))) - (set! (-> arg1 probe-work-array 0 world-normal z) (* (-> arg1 probe-work-array 0 world-normal z) f0-108)) - (set! (-> arg1 probe-work-array 0 world-normal w) (* (-> arg1 probe-work-array 0 world-normal w) f0-108)) - ) - ) - ) - (vector-float*! - (-> arg1 force) - (-> arg1 probe-work-array 0 local-pos) - (-> arg1 probe-work-array 0 world-normal z) - ) - (vector+float*! - (-> arg1 force) - (-> arg1 force) - (the-as vector (&-> arg1 impulse)) - (-> arg1 probe-work-array 0 world-normal w) - ) - (let ((f0-114 - (* (vector-dot (-> arg1 tmp) (-> arg1 mat uvec)) (+ -1.0 (-> this info handling ground-torque-scale))) - ) - ) - (vector+float*! (-> arg1 ground-normal) (-> arg1 ground-normal) (-> arg1 mat uvec) f0-114) - ) - (apply-impact! sv-16 (-> arg1 ground-normal) (-> arg1 force)) - 0 - ) - ) ) 0 (none) @@ -531,12 +526,9 @@ ) (vector-float*! v1-29 a0-10 (fmax f0-7 (+ f1-5 (* f2-1 (/ 1.0 f3-3))))) ) - (let* ((v1-31 (-> s5-0 lin-velocity)) - (f0-13 (+ (* (-> v1-31 x) (-> v1-31 x)) (* (-> v1-31 z) (-> v1-31 z)))) - (f1-10 40960.0) - ) + (let ((v1-31 (-> s5-0 lin-velocity))) (cond - ((< f0-13 (* f1-10 f1-10)) + ((< (+ (* (-> v1-31 x) (-> v1-31 x)) (* (-> v1-31 z) (-> v1-31 z))) (square 40960.0)) (vector-copy! (-> gp-0 local-pos) (-> s4-0 info cm-offset-joint)) (+! (-> gp-0 local-pos z) 4096.0) (vector-matrix*! (-> gp-0 world-pos) (-> gp-0 local-pos) (-> gp-0 mat)) diff --git a/goal_src/jak3/levels/desert/wvehicle/wvehicle-race.gc b/goal_src/jak3/levels/desert/wvehicle/wvehicle-race.gc index 622a2af138..6ae9431fb9 100644 --- a/goal_src/jak3/levels/desert/wvehicle/wvehicle-race.gc +++ b/goal_src/jak3/levels/desert/wvehicle/wvehicle-race.gc @@ -87,19 +87,12 @@ (quaternion-copy! (the-as quaternion (-> s3-0 force)) (-> s5-0 path-sample quat)) (vector-float*! (-> s3-0 mat fvec) (-> s5-0 lin-velocity) f28-0) (vector-! (-> s3-0 mat trans) (-> s5-0 path-sample pos) (-> s4-0 position)) - (let ((f0-6 (vector-length-squared (-> s3-0 mat trans))) - (f1-5 1.0) - (f2-2 40960.0) - ) - (set! (-> this path-deviation) (* f0-6 (/ f1-5 (* f2-2 f2-2)))) - ) + (set! (-> this path-deviation) (* (vector-length-squared (-> s3-0 mat trans)) (/ 1.0 (square 40960.0)))) (vector+*! (-> s3-0 mat fvec) (-> s3-0 mat fvec) (-> s3-0 mat trans) 1.0) (vector-! (-> s3-0 mat rvec) (-> s3-0 mat fvec) (-> s4-0 lin-velocity)) (vector-float*! (-> s3-0 mat rvec) (-> s3-0 mat rvec) 16.0) - (let ((v1-31 (-> s3-0 mat)) - (f0-10 (-> s3-0 velocity x)) - ) - (if (< (* f0-10 f0-10) (vector-length-squared (-> v1-31 rvec))) + (let ((v1-31 (-> s3-0 mat))) + (if (< (square (-> s3-0 velocity x)) (vector-length-squared (-> v1-31 rvec))) (vector-normalize! (-> s3-0 mat rvec) (-> s3-0 velocity x)) ) ) @@ -186,9 +179,7 @@ (if (logtest? (vehicle-flag in-air turbo-boost) (-> this v-flags)) (set! (-> gp-0 vec13 w) (* 2.0 (-> gp-0 vec13 w))) ) - (let ((f0-18 (* 2.0 (-> this root root-prim local-sphere w)))) - (set! (-> gp-0 float7) (* f0-18 f0-18)) - ) + (set! (-> gp-0 float7) (square (* 2.0 (-> this root root-prim local-sphere w)))) (let ((s3-0 (-> this race state))) (dotimes (s2-0 (-> s3-0 racer-count)) (let ((v1-60 (handle->process (-> s3-0 racer-array s2-0 racer)))) @@ -235,20 +226,10 @@ (race-path-method-11 (-> s4-0 path) (-> gp-0 sample) (-> gp-0 vec12) f0-35) ) (vector-! (-> gp-0 vec6) (-> s4-0 path-sample pos) (-> gp-0 vec0)) - (let ((f0-36 (-> gp-0 float5)) - (f1-24 1.0) - (f2-8 40960.0) - ) - (set! (-> gp-0 float5) (+ f0-36 (* (/ f1-24 (* f2-8 f2-8)) (vector-length-squared (-> gp-0 vec6))))) - ) - (let ((f30-0 (-> gp-0 float5)) - (f0-38 1.0) - (f1-27 40960.0) - ) - (set! (-> gp-0 float5) - (+ f30-0 (* (/ f0-38 (* f1-27 f1-27)) (vector-vector-distance-squared (-> s4-0 lin-velocity) (-> gp-0 vec1)))) - ) - ) + (+! (-> gp-0 float5) (* (/ 1.0 (square 40960.0)) (vector-length-squared (-> gp-0 vec6)))) + (+! (-> gp-0 float5) + (* (/ 1.0 (square 40960.0)) (vector-vector-distance-squared (-> s4-0 lin-velocity) (-> gp-0 vec1))) + ) (set! (-> this path-deviation) (-> gp-0 float5)) (vector+*! (-> gp-0 vec5) (-> gp-0 vec12) (-> gp-0 vec6) 1.0) (vector-! (-> gp-0 vec7) (-> gp-0 vec5) (-> gp-0 vec1)) @@ -305,35 +286,24 @@ ((logtest? (-> this rbody flags) (rigid-body-flag enable-physics)) (if (and (logtest? (-> this v-flags) (vehicle-flag on-ground)) (not (logtest? (vehicle-flag turbo-boost) (-> this v-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))) + ) + ) ) (disable-physics! 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? (vehicle-flag turbo-boost) (-> this v-flags)) - ) - ) - ) - (apply-momentum! 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? (vehicle-flag turbo-boost) (-> this v-flags)) + ) + ) + (apply-momentum! this) + ) ) ) 0 diff --git a/goal_src/jak3/levels/desert/wvehicle/wvehicle-util.gc b/goal_src/jak3/levels/desert/wvehicle/wvehicle-util.gc index 6dd0a1498c..40cc2e113a 100644 --- a/goal_src/jak3/levels/desert/wvehicle/wvehicle-util.gc +++ b/goal_src/jak3/levels/desert/wvehicle/wvehicle-util.gc @@ -8,13 +8,19 @@ ;; DECOMP BEGINS (defmethod wvehicle-method-167 ((this wvehicle)) - (let* ((v1-0 (-> this info)) - (f0-1 (* (-> v1-0 engine drag) (-> v1-0 engine idle-rpm))) - (f1-2 (* (-> v1-0 engine peak-torque-rpm) (+ 1.0 (-> v1-0 engine drag)))) - (f2-2 1.0) - (f3-3 (/ (- (-> v1-0 engine idle-rpm) (-> v1-0 engine peak-torque-rpm)) (-> v1-0 engine powerband-width-rpm))) - ) - (set! (-> this idle-throttle) (/ f0-1 (* f1-2 (- f2-2 (* f3-3 f3-3))))) + (let ((v1-0 (-> this info))) + (set! (-> this idle-throttle) + (/ (* (-> v1-0 engine drag) (-> v1-0 engine idle-rpm)) + (* (-> v1-0 engine peak-torque-rpm) + (+ 1.0 (-> v1-0 engine drag)) + (- 1.0 + (square + (/ (- (-> v1-0 engine idle-rpm) (-> v1-0 engine peak-torque-rpm)) (-> v1-0 engine powerband-width-rpm)) + ) + ) + ) + ) + ) ) (set! (-> this idle-throttle) (fmax 0.0 (fmin 1.0 (-> this idle-throttle)))) 0 @@ -483,16 +489,9 @@ (defmethod vehicle-method-103 ((this wvehicle)) (when (time-elapsed? (-> this disturbed-time) (seconds 2)) - (let* ((f0-0 (-> this camera-dist2)) - (f1-0 0.000024414063) - (f0-1 (* f0-0 (* f1-0 f1-0))) - ) + (let ((f0-1 (* (-> this camera-dist2) (square 0.000024414063)))) (when (and (< (vector-length-squared (-> this rbody ang-velocity)) f0-1) - (let ((f1-4 (vector-length-squared (-> this rbody lin-velocity))) - (f2-0 614.4) - ) - (< f1-4 (* f0-1 (* f2-0 f2-0))) - ) + (< (vector-length-squared (-> this rbody lin-velocity)) (* f0-1 (square 614.4))) ) (logclear! (-> this v-flags) (vehicle-flag disturbed)) (vehicle-method-142 this) @@ -504,7 +503,6 @@ ) (defmethod spawn-wheels! ((this wvehicle) (arg0 skeleton-group) (arg1 skeleton-group) (arg2 skeleton-group) (arg3 skeleton-group)) - (local-vars (sv-96 vehicle-wheel-state)) (let ((s1-0 (new 'stack-no-clear 'vehicle-wheel-init-params))) (vector-copy! (-> s1-0 position) (-> this root trans)) (quaternion-identity! (-> s1-0 rotation)) @@ -526,23 +524,24 @@ (set! (-> s1-0 skel-blur) arg1) ) ) - (set! sv-96 (-> this wheel s0-0)) - (set! (-> s1-0 radius) (* 1.3 (-> sv-96 info scale) (-> sv-96 info radius))) - (vector-identity! (-> s1-0 scale)) - (set! (-> s1-0 scale x) (-> sv-96 x-scale)) - (vector-float*! (-> s1-0 scale) (-> s1-0 scale) (-> sv-96 info scale)) - (if (logtest? (-> this info flags) #x4000) - (set! (-> s1-0 collision-mesh-index) (if (>= (-> sv-96 x-scale) 0.0) - 0 - 1 - ) - ) - ) - (set! (-> sv-96 handle) - (process->handle (vehicle-wheel-spawn this (the-as vehicle-wheel-init-params (&-> s1-0 skel)))) + (let ((sv-96 (-> this wheel s0-0))) + (set! (-> s1-0 radius) (* 1.3 (-> sv-96 info scale) (-> sv-96 info radius))) + (vector-identity! (-> s1-0 scale)) + (set! (-> s1-0 scale x) (-> sv-96 x-scale)) + (vector-float*! (-> s1-0 scale) (-> s1-0 scale) (-> sv-96 info scale)) + (if (logtest? (-> this info flags) #x4000) + (set! (-> s1-0 collision-mesh-index) (if (>= (-> sv-96 x-scale) 0.0) + 0 + 1 + ) + ) ) - (set! (-> sv-96 pos) (-> sv-96 info settle-pos)) - (set! (-> sv-96 pos2) (-> sv-96 pos)) + (set! (-> sv-96 handle) + (process->handle (vehicle-wheel-spawn this (the-as vehicle-wheel-init-params (&-> s1-0 skel)))) + ) + (set! (-> sv-96 pos) (-> sv-96 info settle-pos)) + (set! (-> sv-96 pos2) (-> sv-96 pos)) + ) ) ) (wvehicle-method-165 this) diff --git a/goal_src/jak3/levels/desert/wvehicle/wvehicle.gc b/goal_src/jak3/levels/desert/wvehicle/wvehicle.gc index a32a120dca..1fd93a993e 100644 --- a/goal_src/jak3/levels/desert/wvehicle/wvehicle.gc +++ b/goal_src/jak3/levels/desert/wvehicle/wvehicle.gc @@ -8,23 +8,18 @@ ;; DECOMP BEGINS (defmethod wvehicle-method-166 ((this wvehicle) (arg0 float) (arg1 float)) - (let* ((v1-0 (-> this info)) - (f0-0 (-> this engine-max-torque)) - (f1-3 (* (+ 1.0 (-> v1-0 engine drag)) - (if (< arg0 (-> v1-0 engine max-rpm)) - 1.0 - 0.0 - ) - (fmax (-> this idle-throttle) arg1) - ) - ) - (f2-5 0.2) - (f3-2 1.0) - (f4-2 (/ (- arg0 (-> v1-0 engine peak-torque-rpm)) (-> v1-0 engine powerband-width-rpm))) - ) - (* f0-0 (+ (* f1-3 (fmax f2-5 (- f3-2 (* f4-2 f4-2)))) - (* -1.0 (/ arg0 (-> v1-0 engine peak-torque-rpm)) (-> v1-0 engine drag)) - ) + (let ((v1-0 (-> this info))) + (* (-> this engine-max-torque) + (+ (* (+ 1.0 (-> v1-0 engine drag)) + (if (< arg0 (-> v1-0 engine max-rpm)) + 1.0 + 0.0 + ) + (fmax (-> this idle-throttle) arg1) + (fmax 0.2 (- 1.0 (square (/ (- arg0 (-> v1-0 engine peak-torque-rpm)) (-> v1-0 engine powerband-width-rpm))))) + ) + (* -1.0 (/ arg0 (-> v1-0 engine peak-torque-rpm)) (-> v1-0 engine drag)) + ) ) ) ) @@ -49,11 +44,7 @@ (+ (-> arg1 probe-y-offset) (* (-> arg1 radius) (-> arg1 scale)) (* -1.0 (-> arg0 pos2) (-> arg1 travel))) ) (set! (-> arg0 sin-susp-ang) (fmax -1.0 (fmin 1.0 (/ (-> gp-0 float0) (-> arg1 susp-arm-length))))) - (let ((f0-21 1.0) - (f1-11 (-> arg0 sin-susp-ang)) - ) - (set! (-> arg0 cos-susp-ang) (sqrtf (- f0-21 (* f1-11 f1-11)))) - ) + (set! (-> arg0 cos-susp-ang) (sqrtf (- 1.0 (square (-> arg0 sin-susp-ang))))) (quaternion-identity! (-> gp-0 quat4)) (set! (-> gp-0 quat4 z) (* (sin (-> arg1 camber)) (-> arg0 x-scale))) (set! (-> gp-0 quat4 w) (cos (-> arg1 camber))) @@ -97,21 +88,17 @@ (let* ((a1-0 (-> this wheel s4-0)) (a2-0 (-> a1-0 info)) ) - (let* ((f0-1 (-> a1-0 pos2)) - (f1-1 (- (-> a1-0 pos) (-> a1-0 pos2))) - (f2-1 1.0) - (f3-0 (-> s5-0 steering)) - (f4-0 (-> a1-0 forward-vel)) - (f4-2 (* f4-0 f4-0)) - (f5-0 (-> a1-0 up-vel)) - (f4-3 (+ f4-2 (* f5-0 f5-0))) - (f5-3 8192.0) - (f3-1 (* f3-0 (fmin f4-3 (* f5-3 f5-3)))) - (f4-5 15.0) - (f5-6 8192.0) + (+! (-> a1-0 pos2) + (* (- (-> a1-0 pos) (-> a1-0 pos2)) + (fmin + 1.0 + (* (-> s5-0 steering) + (fmin (+ (square (-> a1-0 forward-vel)) (square (-> a1-0 up-vel))) (square 8192.0)) + (/ 15.0 (square 8192.0)) + ) + ) ) - (set! (-> a1-0 pos2) (+ f0-1 (* f1-1 (fmin f2-1 (* f3-1 (/ f4-5 (* f5-6 f5-6))))))) - ) + ) (set! (-> a1-0 angle) (the float (sar (shl (the int (+ (-> a1-0 angle) (* 10430.379 (-> a1-0 rev) (-> s5-0 steering)))) 48) 48)) ) @@ -232,12 +219,12 @@ (let ((a0-18 (-> v1-16 lin-velocity)) (f1-2 16384.0) ) - (< (vector-length-squared a0-18) (* f1-2 f1-2)) + (< (vector-length-squared a0-18) (square f1-2)) ) (let ((a0-22 (-> v1-16 ang-velocity)) (f1-5 4.0) ) - (< (vector-length-squared a0-22) (* f1-5 f1-5)) + (< (vector-length-squared a0-22) (square f1-5)) ) ) (set! (-> this v-flags) (the-as vehicle-flag (logior (vehicle-flag overturned) (-> this v-flags)))) @@ -283,13 +270,9 @@ ;; WARN: Return type mismatch symbol vs object. (defmethod rigid-body-object-method-30 ((this wvehicle)) (set! (-> this v-flags) (the-as vehicle-flag (logclear (-> this v-flags) (vehicle-flag sounds)))) - (let ((f0-0 (-> this player-dist2)) - (f1-0 245760.0) - ) - (if (< f0-0 (* f1-0 f1-0)) - (set! (-> this v-flags) (the-as vehicle-flag (logior (vehicle-flag sounds) (-> this v-flags)))) - ) - ) + (if (< (-> this player-dist2) (square 245760.0)) + (set! (-> this v-flags) (the-as vehicle-flag (logior (vehicle-flag sounds) (-> this v-flags)))) + ) (let ((v1-8 (new 'stack-no-clear 'matrix))) (set! (-> v1-8 fvec x) (seconds-per-frame)) (vector-copy! (-> v1-8 uvec) (-> this draw color-emissive)) @@ -455,19 +438,16 @@ ) ) (set! (-> this drive-wheel-inertia) f0-13) - (let* ((f1-6 (-> this final-drive-ratio)) - (f1-8 (* f1-6 f1-6)) - (f2-1 (-> s5-0 transmission inertia)) - (f3-0 (-> this gear-ratio)) - ) - (set! (-> this wheel-inertia) - (+ f0-13 - (* f1-8 - (+ f2-1 (* f3-0 f3-0 (+ (-> this clutch-inertia) (* (-> s5-0 engine inertia) (-> this clutch-grab))))) - ) - ) - ) - ) + (set! (-> this wheel-inertia) + (+ f0-13 (* (square (-> this final-drive-ratio)) + (+ (-> s5-0 transmission inertia) + (* (square (-> this gear-ratio)) + (+ (-> this clutch-inertia) (* (-> s5-0 engine inertia) (-> this clutch-grab))) + ) + ) + ) + ) + ) ) (set! (-> s4-0 rvec x) (* (/ 1.0 (the float (-> s5-0 physics-model drive-wheel-count))) (-> this engine-torque) @@ -652,14 +632,10 @@ (remove-setting! 'butt-handle) ) ) - (let ((f0-2 (vector-vector-distance-squared (-> this draw origin) (math-camera-pos))) - (f1-1 (-> this draw origin w)) - ) - (if (< f0-2 (* f1-1 f1-1)) - (logclear! (-> this draw status) (draw-control-status force-vu1)) - (logior! (-> this draw status) (draw-control-status force-vu1)) - ) - ) + (if (< (vector-vector-distance-squared (-> this draw origin) (math-camera-pos)) (square (-> this draw origin w))) + (logclear! (-> this draw status) (draw-control-status force-vu1)) + (logior! (-> this draw status) (draw-control-status force-vu1)) + ) 0 (none) ) @@ -706,9 +682,8 @@ (* 2.0 (+ (-> s4-0 physics-model rear-wheel local-pos x) (-> s4-0 physics-model rear-wheel susp-arm-length))) ) ) - (f1-22 (/ (-> s5-0 1 uvec z) 2)) ) - (set! (-> s5-0 1 rvec z) (sqrtf (+ (* f1-22 f1-22) (* f0-32 f0-32)))) + (set! (-> s5-0 1 rvec z) (sqrtf (+ (square (/ (-> s5-0 1 uvec z) 2)) (square f0-32)))) ) (+! (-> s5-0 1 rvec w) (-> s4-0 physics-model rear-wheel steer-arm-length)) (set! (-> s5-0 1 rvec z) (- (-> s5-0 1 rvec z) (-> s4-0 physics-model rear-wheel steer-arm-length))) diff --git a/goal_src/jak3/levels/factory/car/hvehicle-physics.gc b/goal_src/jak3/levels/factory/car/hvehicle-physics.gc index 2624d14810..d1d5e95f0a 100644 --- a/goal_src/jak3/levels/factory/car/hvehicle-physics.gc +++ b/goal_src/jak3/levels/factory/car/hvehicle-physics.gc @@ -32,14 +32,7 @@ ) (when (logtest? (-> this info flags) 1) (vector-float*! (-> arg1 tmp) (-> arg1 mat uvec) -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)) @@ -290,7 +283,6 @@ ) (defmethod apply-gravity! ((this hvehicle) (arg0 float)) - (local-vars (sv-944 float) (sv-1040 float) (sv-1044 float)) (let ((gp-0 (new 'stack-no-clear 'vehicle-physics-work)) (s5-0 (-> this rbody)) (s4-0 (-> this info)) @@ -299,36 +291,37 @@ (when (not (logtest? (vehicle-flag dead gun-dark-2-zero-g) (-> this v-flags))) (vehicle-method-97 this arg0 gp-0) (when (>= 1 (-> this force-level)) - (set! sv-944 (* (-> s4-0 info mass) (-> s4-0 extra gravity))) - (when (!= (-> s4-0 handling pitch-control-factor) 0.0) - (vector-copy! (-> gp-0 axis) (-> gp-0 mat rvec)) - (set! (-> gp-0 axis y) 0.0) - (let ((f30-0 (vector-dot (-> gp-0 axis) (-> s5-0 ang-velocity)))) - (dotimes (s1-0 (-> s4-0 physics-model lift-thruster-count)) - (let ((s0-0 (-> s4-0 physics-model lift-thruster-array s1-0))) - (vector-matrix*! (-> gp-0 world-pos) (-> s0-0 local-pos) (-> gp-0 mat)) - (vector-rotate*! (-> gp-0 world-normal) (-> s0-0 rot) (-> gp-0 mat)) - (let* ((f0-5 -1.0) - (f1-2 1.0) - (f2-0 0.2) - (a0-10 (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 int a0-10) a1-5) v1-16)) - (-> s4-0 handling pitch-control-factor) - f30-0 - ) - ) - ) - sv-944 - ) - ) - ) - (vector-float*! (-> gp-0 force) (-> gp-0 world-normal) (* -1.0 f0-7)) + (let ((sv-944 (* (-> s4-0 info mass) (-> s4-0 extra gravity)))) + (when (!= (-> s4-0 handling pitch-control-factor) 0.0) + (vector-copy! (-> gp-0 axis) (-> gp-0 mat rvec)) + (set! (-> gp-0 axis y) 0.0) + (let ((f30-0 (vector-dot (-> gp-0 axis) (-> s5-0 ang-velocity)))) + (dotimes (s1-0 (-> s4-0 physics-model lift-thruster-count)) + (let ((s0-0 (-> s4-0 physics-model lift-thruster-array s1-0))) + (vector-matrix*! (-> gp-0 world-pos) (-> s0-0 local-pos) (-> gp-0 mat)) + (vector-rotate*! (-> gp-0 world-normal) (-> s0-0 rot) (-> gp-0 mat)) + (let* ((f0-5 -1.0) + (f1-2 1.0) + (f2-0 0.2) + (a0-10 (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 int a0-10) a1-5) v1-16)) + (-> s4-0 handling pitch-control-factor) + f30-0 + ) + ) + ) + sv-944 + ) + ) + ) + (vector-float*! (-> gp-0 force) (-> gp-0 world-normal) (* -1.0 f0-7)) + ) ) + (apply-impact! s5-0 (-> gp-0 world-pos) (-> gp-0 force)) ) - (apply-impact! s5-0 (-> gp-0 world-pos) (-> gp-0 force)) ) ) ) @@ -342,39 +335,38 @@ (quaternion->matrix (the-as matrix (-> s1-1 1)) (the-as quaternion (-> s1-1 0))) (vector-copy! (-> gp-0 dir) (-> s1-1 2)) ) - (let ((f0-14 (vector-dot (-> gp-0 mat rvec) (-> gp-0 dir)))) - (set! sv-1040 (* (-> s4-0 info mass) (-> s4-0 extra gravity))) - (let ((f1-11 f0-14)) - (set! sv-1044 (+ (* f1-11 f1-11 f0-14) (* 0.075 (vector-dot (-> gp-0 mat fvec) (-> s5-0 ang-velocity))))) - ) - ) - (dotimes (s1-2 (-> s4-0 physics-model roll-thruster-count)) - (let* ((s0-1 (-> s4-0 physics-model roll-thruster-array s1-2)) - (f0-17 0.0) - (f1-16 1.0) - (f2-7 -1.0) - (a0-20 (the-as number (-> s0-1 local-pos x))) - (a1-10 #xffffffff80000000) - (v1-42 #x3f800000) - (f30-1 - (fmax f0-17 (fmin f1-16 (* f2-7 (the-as float (logior (logand (the-as int a0-20) a1-10) v1-42)) sv-1044))) + (let* ((f0-14 (vector-dot (-> gp-0 mat rvec) (-> gp-0 dir))) + (sv-1040 (* (-> s4-0 info mass) (-> s4-0 extra gravity))) + (sv-1044 (+ (* (square f0-14) f0-14) (* 0.075 (vector-dot (-> gp-0 mat fvec) (-> s5-0 ang-velocity))))) + ) + (dotimes (s1-2 (-> s4-0 physics-model roll-thruster-count)) + (let* ((s0-1 (-> s4-0 physics-model roll-thruster-array s1-2)) + (f0-17 0.0) + (f1-16 1.0) + (f2-7 -1.0) + (a0-20 (the-as number (-> s0-1 local-pos x))) + (a1-10 #xffffffff80000000) + (v1-42 #x3f800000) + (f30-1 + (fmax f0-17 (fmin f1-16 (* f2-7 (the-as float (logior (logand (the-as int a0-20) a1-10) v1-42)) sv-1044))) + ) ) - ) - (when (< 0.0 f30-1) - (let ((f30-2 - (* (+ f30-1 (+ (- (-> this power-fluctuation-factor)) (* 2.0 (rand-vu) (-> this power-fluctuation-factor)))) - (-> s4-0 handling roll-control-factor) - sv-1040 - ) + (when (< 0.0 f30-1) + (let ((f30-2 + (* (+ f30-1 (+ (- (-> this power-fluctuation-factor)) (* 2.0 (rand-vu) (-> this power-fluctuation-factor)))) + (-> s4-0 handling roll-control-factor) + sv-1040 + ) + ) ) - ) - (+! (-> this roll-thrust s1-2) (fmax 0.0 f30-2)) - (vector-matrix*! (-> gp-0 world-pos) (-> s0-1 local-pos) (-> gp-0 mat)) - (vector-rotate*! (-> gp-0 world-normal) (-> s0-1 rot) (-> gp-0 mat)) - (vector-float*! (-> gp-0 force) (-> gp-0 world-normal) (* -1.0 f30-2)) + (+! (-> this roll-thrust s1-2) (fmax 0.0 f30-2)) + (vector-matrix*! (-> gp-0 world-pos) (-> s0-1 local-pos) (-> gp-0 mat)) + (vector-rotate*! (-> gp-0 world-normal) (-> s0-1 rot) (-> gp-0 mat)) + (vector-float*! (-> gp-0 force) (-> gp-0 world-normal) (* -1.0 f30-2)) + ) + (apply-impact! s5-0 (-> gp-0 world-pos) (-> gp-0 force)) + 0 ) - (apply-impact! s5-0 (-> gp-0 world-pos) (-> gp-0 force)) - 0 ) ) ) @@ -536,22 +528,26 @@ (set! (-> gp-0 world-normal y) 0.0) (vector-normalize! (-> gp-0 world-normal) 1.0) (let* ((v1-161 (-> s5-0 lin-velocity)) - (f0-90 (/ (sqrtf (+ (* (-> v1-161 x) (-> v1-161 x)) (* (-> v1-161 z) (-> v1-161 z)))) - (-> s4-0 handling max-xz-speed) - ) - ) - (v1-163 (-> gp-0 force)) - (a0-76 (-> gp-0 world-normal)) - (f1-73 -1.0) - (f2-35 (* (-> s4-0 handling speed-limiting-drag) (vector-dot (-> s5-0 force) (-> gp-0 world-normal)))) - (f3-20 (* (fabs (-> this engine-thrust)) - (-> s4-0 handling speed-scrubbing-drag) - (vector-length (-> s5-0 lin-momentum)) - ) - ) - (f4-6 (- 1.0 (fabs (vector-dot (-> s5-0 matrix fvec) (-> gp-0 world-normal))))) + (f0-90 + (/ (sqrtf (+ (* (-> v1-161 x) (-> v1-161 x)) (* (-> v1-161 z) (-> v1-161 z)))) + (-> s4-0 handling max-xz-speed) + ) + ) ) - (vector-float*! v1-163 a0-76 (* f1-73 (+ f2-35 (* f3-20 (* f4-6 f4-6))) (sqrtf f0-90))) + (vector-float*! + (-> gp-0 force) + (-> gp-0 world-normal) + (* -1.0 + (+ (* (-> s4-0 handling speed-limiting-drag) (vector-dot (-> s5-0 force) (-> gp-0 world-normal))) + (* (fabs (-> this engine-thrust)) + (-> s4-0 handling speed-scrubbing-drag) + (vector-length (-> s5-0 lin-momentum)) + (square (- 1.0 (fabs (vector-dot (-> s5-0 matrix fvec) (-> gp-0 world-normal))))) + ) + ) + (sqrtf f0-90) + ) + ) ) (add-force! s5-0 (-> gp-0 force)) ) diff --git a/goal_src/jak3/levels/factory/car/hvehicle-util.gc b/goal_src/jak3/levels/factory/car/hvehicle-util.gc index f61dcf7c94..24af05a246 100644 --- a/goal_src/jak3/levels/factory/car/hvehicle-util.gc +++ b/goal_src/jak3/levels/factory/car/hvehicle-util.gc @@ -8,7 +8,7 @@ ;; DECOMP BEGINS (defmethod vehicle-controller-method-18 ((this vehicle-controller) (arg0 vector) (arg1 vector) (arg2 vehicle) (arg3 float)) - (local-vars (a0-95 int) (a0-97 int) (sv-16 vector) (sv-20 float) (sv-24 float)) + (local-vars (a0-95 int) (a0-97 int)) (let* ((v1-1 (-> *perf-stats* data 21)) (a0-1 (-> v1-1 ctrl)) ) @@ -27,10 +27,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 'vehicle-physics-work))) + (let ((sv-16 arg0) + (sv-20 arg3) + (sv-24 (-> arg2 info info inv-mass)) + (gp-0 (new 'stack-no-clear 'vehicle-physics-work)) + ) (set! (-> gp-0 dir x) (+ (-> this target-speed) (-> this target-speed-offset))) (vector-copy! (-> gp-0 mat uvec) arg1) (set! (-> gp-0 mat rvec quad) (-> arg2 root trans quad)) @@ -46,14 +47,11 @@ (logclear! (-> this flags) (vehicle-controller-flag on-straightaway)) ) (when (not (logtest? (-> this flags) (vehicle-controller-flag no-slowing-for-turns))) - (let ((f1-4 (* 0.5 (/ 1.0 (-> this turn-accel)))) - (f2-2 (vector-length-squared arg1)) - (f3-1 (-> this max-turn-speed)) - ) - (if (>= (* f1-4 (- f2-2 (* f3-1 f3-1))) f0-5) - (set! (-> gp-0 dir x) (fmin (-> gp-0 dir x) (-> this max-turn-speed))) - ) - ) + (if (>= (* 0.5 (/ 1.0 (-> this turn-accel)) (- (vector-length-squared arg1) (square (-> this max-turn-speed)))) + f0-5 + ) + (set! (-> gp-0 dir x) (fmin (-> gp-0 dir x) (-> this max-turn-speed))) + ) ) ) ) @@ -86,11 +84,7 @@ (set! (-> gp-0 force y) (-> gp-0 mat rvec 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 10)) (f30-1 (-> arg2 root root-prim prim-core world-sphere w)) @@ -113,9 +107,7 @@ (let ((f1-12 (vector-length-squared (-> gp-0 tmp)))) (vector-float*! (-> gp-0 axis) (-> gp-0 tmp) (/ 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? (vehicle-flag player-driving) (-> v1-70 v-flags))) (when (and (< 0.0 sv-20) (< f1-12 f28-0)) @@ -163,18 +155,10 @@ (vector-! (-> gp-0 world-pos) (-> gp-0 force) (-> gp-0 mat rvec)) (let ((f0-39 (vector-length-squared (-> gp-0 world-pos)))) (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-68 (-> gp-0 world-pos)) - (f1-26 12288.0) - (f2-12 4096.0) - ) - (t9-8 a0-68 (fmin f1-26 (- f0-39 (* f2-12 f2-12)))) - ) - (vector+! (-> gp-0 mat fvec) (-> gp-0 mat fvec) (-> gp-0 world-pos)) - ) + (when (< (square 4096.0) f0-39) + (logior! (-> this flags) (vehicle-controller-flag off-path)) + (vector-normalize! (-> gp-0 world-pos) (fmin 12288.0 (- f0-39 (square 4096.0)))) + (vector+! (-> gp-0 mat fvec) (-> gp-0 mat fvec) (-> gp-0 world-pos)) ) ) (vector+float*! diff --git a/goal_src/jak3/levels/factory/car/hvehicle.gc b/goal_src/jak3/levels/factory/car/hvehicle.gc index 704ab3ebd7..0b28e8d6ee 100644 --- a/goal_src/jak3/levels/factory/car/hvehicle.gc +++ b/goal_src/jak3/levels/factory/car/hvehicle.gc @@ -124,27 +124,16 @@ (when (and (not (logtest? (-> this controller flags) (vehicle-controller-flag off-path))) (>= (-> this rbody matrix uvec y) (cos 910.2222)) ) - (let ((f0-1 (vector-length-squared (-> this rbody ang-velocity))) - (f1-0 0.5) - ) - (if (< f0-1 (* f1-0 f1-0)) - (logclear! (-> this v-flags) (vehicle-flag disturbed)) - ) - ) + (if (< (vector-length-squared (-> this rbody ang-velocity)) (square 0.5)) + (logclear! (-> this v-flags) (vehicle-flag disturbed)) + ) ) ) (else (when (>= (-> this rbody matrix uvec 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)))) (when (and (< (vector-length-squared (-> this rbody ang-velocity)) f0-4) - (let ((f1-7 (vector-length-squared (-> this rbody lin-velocity))) - (f2-0 614.4) - ) - (< f1-7 (* f0-4 (* f2-0 f2-0))) - ) + (< (vector-length-squared (-> this rbody lin-velocity)) (* f0-4 (square 614.4))) ) (logclear! (-> this v-flags) (vehicle-flag disturbed)) (vehicle-method-142 this) @@ -197,57 +186,55 @@ (#when PC_PORT (if (not (-> *pc-settings* ps2-shadow?)) (set! (-> s4-0 0 y) 0.0))) - (let ((f0-1 245760.0)) - (cond - ((< (* f0-1 f0-1) (-> s4-0 0 y)) - (logior! (-> s5-0 settings flags) (shadow-flags disable-draw)) - 0 - (set! (-> this draw bounds w) (-> this bound-radius)) - ) - (else - (-> this root) - (if (or (logtest? (-> s5-0 settings flags) (shadow-flags disable-draw)) - (let ((a1-1 (-> this clock)) - (a0-2 (-> this traffic-priority-id)) - ) - (not (logtest? (logxor a0-2 (-> a1-1 integral-frame-counter)) 7)) - ) + (cond + ((< (square 245760.0) (-> s4-0 0 y)) + (logior! (-> s5-0 settings flags) (shadow-flags disable-draw)) + 0 + (set! (-> this draw bounds w) (-> this bound-radius)) + ) + (else + (-> this root) + (if (or (logtest? (-> s5-0 settings flags) (shadow-flags disable-draw)) + (let ((a1-1 (-> this clock)) + (a0-2 (-> this traffic-priority-id)) + ) + (not (logtest? (logxor a0-2 (-> a1-1 integral-frame-counter)) 7)) ) - (vehicle-method-101 this) + ) + (vehicle-method-101 this) + ) + (set! (-> s4-0 0 x) (sqrtf (-> s4-0 0 y))) + (when (not (logtest? #x40000 (-> this info flags))) + (set! (-> this draw bounds w) + (lerp-scale + (- (-> s5-0 settings center y) (-> this root gspot-pos y)) + (-> this bound-radius) + (-> s4-0 0 x) + 81920.0 + 122880.0 + ) + ) + (if (< (-> this draw bounds w) (-> this bound-radius)) + (set! (-> this draw bounds w) (-> this bound-radius)) ) - (set! (-> s4-0 0 x) (sqrtf (-> s4-0 0 y))) - (when (not (logtest? #x40000 (-> this info flags))) - (set! (-> this draw bounds w) - (lerp-scale - (- (-> s5-0 settings center y) (-> this root gspot-pos y)) - (-> this bound-radius) - (-> s4-0 0 x) - 81920.0 - 122880.0 - ) - ) - (if (< (-> this draw bounds w) (-> this bound-radius)) - (set! (-> this draw bounds w) (-> this bound-radius)) - ) - ) - (set! (-> s4-0 0 z) (lerp-scale 0.0 1.0 (-> s4-0 0 x) 245760.0 40960.0)) - (set! (-> s4-0 0 z) - (fmax 0.01 (+ (* -2.0 (-> s4-0 0 z) (-> s4-0 0 z) (-> s4-0 0 z)) (* 3.0 (-> s4-0 0 z) (-> s4-0 0 z)))) - ) - (set! (-> s4-0 0 w) (* 4096.0 (+ 5.0 (* 5.0 (- 1.0 (-> this root gspot-normal y)))))) - (set! (-> s4-0 1 x) (- (-> s5-0 settings center y) (-> this root gspot-pos y))) - (set! (-> s5-0 settings shadow-dir w) (+ 20480.0 (* 409600.0 (-> s4-0 0 z)) (-> s4-0 1 x))) - (+! (-> s4-0 0 z) 0.5) - (seek! - (-> s5-0 settings top-plane w) - (+ (-> s4-0 1 x) (* (-> s4-0 0 z) (- (-> s4-0 0 w)))) - (* 81920.0 (seconds-per-frame)) - ) - (seek! - (-> s5-0 settings bot-plane w) - (+ (-> s4-0 1 x) (* (-> s4-0 0 z) (-> s4-0 0 w))) - (* 81920.0 (seconds-per-frame)) - ) + ) + (set! (-> s4-0 0 z) (lerp-scale 0.0 1.0 (-> s4-0 0 x) 245760.0 40960.0)) + (set! (-> s4-0 0 z) + (fmax 0.01 (+ (* -2.0 (-> s4-0 0 z) (-> s4-0 0 z) (-> s4-0 0 z)) (* 3.0 (-> s4-0 0 z) (-> s4-0 0 z)))) + ) + (set! (-> s4-0 0 w) (* 4096.0 (+ 5.0 (* 5.0 (- 1.0 (-> this root gspot-normal y)))))) + (set! (-> s4-0 1 x) (- (-> s5-0 settings center y) (-> this root gspot-pos y))) + (set! (-> s5-0 settings shadow-dir w) (+ 20480.0 (* 409600.0 (-> s4-0 0 z)) (-> s4-0 1 x))) + (+! (-> s4-0 0 z) 0.5) + (seek! + (-> s5-0 settings top-plane w) + (+ (-> s4-0 1 x) (* (-> s4-0 0 z) (- (-> s4-0 0 w)))) + (* 81920.0 (seconds-per-frame)) + ) + (seek! + (-> s5-0 settings bot-plane w) + (+ (-> s4-0 1 x) (* (-> s4-0 0 z) (-> s4-0 0 w))) + (* 81920.0 (seconds-per-frame)) ) ) ) @@ -393,11 +380,8 @@ 0.0 ) (else - (let* ((v1-22 (-> this rbody lin-velocity)) - (f1-10 (+ (* (-> v1-22 x) (-> v1-22 x)) (* (-> v1-22 z) (-> v1-22 z)))) - (f2-8 8192.0) - ) - (if (< f1-10 (* f2-8 f2-8)) + (let ((v1-22 (-> this rbody lin-velocity))) + (if (< (+ (* (-> v1-22 x) (-> v1-22 x)) (* (-> v1-22 z) (-> v1-22 z))) (square 8192.0)) (logior! (-> this v-flags) (vehicle-flag reverse-gear)) ) ) @@ -516,20 +500,14 @@ ) (cond ((logtest? (vehicle-flag camera-rapid-tracking-mode) (-> this v-flags)) - (let ((f0-1 (vector-length-squared (-> this root transv))) - (f1-2 122880.0) - ) - (if (< f0-1 (* f1-2 f1-2)) - (vehicle-method-87 this) - ) - ) + (if (< (vector-length-squared (-> this root transv)) (square 122880.0)) + (vehicle-method-87 this) + ) ) (else - (let ((f0-2 143360.0)) - (if (< (* f0-2 f0-2) (vector-length-squared (-> this root transv))) - (vehicle-method-86 this) - ) - ) + (if (< (square 143360.0) (vector-length-squared (-> this root transv))) + (vehicle-method-86 this) + ) ) ) (let ((t9-3 (method-of-type vehicle vehicle-method-94))) @@ -736,22 +714,14 @@ (set! (-> this v-flags) (the-as vehicle-flag (logclear (-> this v-flags) (vehicle-flag sounds particles joints))) ) - (let ((f0-0 (-> this player-dist2)) - (f1-0 245760.0) - ) - (if (< f0-0 (* f1-0 f1-0)) - (set! (-> this v-flags) (the-as vehicle-flag (logior (vehicle-flag sounds) (-> this v-flags)))) - ) - ) + (if (< (-> this player-dist2) (square 245760.0)) + (set! (-> this v-flags) (the-as vehicle-flag (logior (vehicle-flag sounds) (-> this v-flags)))) + ) (when (logtest? (-> this draw status) (draw-control-status on-screen)) (set! (-> this v-flags) (the-as vehicle-flag (logior (vehicle-flag particles) (-> this v-flags)))) - (let ((f0-1 (-> this camera-dist2)) - (f1-3 245760.0) - ) - (if (< f0-1 (* f1-3 f1-3)) - (set! (-> this v-flags) (the-as vehicle-flag (logior (vehicle-flag joints) (-> this v-flags)))) - ) - ) + (if (< (-> this camera-dist2) (square 245760.0)) + (set! (-> this v-flags) (the-as vehicle-flag (logior (vehicle-flag joints) (-> this v-flags)))) + ) ) (let ((a1-0 (-> this rbody position))) (set! (-> this flight-level) (get-height-at-point *traffic-height-map* a1-0)) @@ -835,22 +805,18 @@ (set! (-> this v-flags) (the-as vehicle-flag (logclear (-> this v-flags) (vehicle-flag sounds particles joints))) ) - (let ((f0-9 (-> this player-dist2)) - (f1-8 245760.0) - ) - (cond - ((< 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))) - ) - (set! (-> this v-flags) (the-as vehicle-flag (logior (vehicle-flag sounds) (-> this v-flags)))) - (rigid-body-object-method-38 this) + (cond + ((< (-> 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))) ) - (else - (if (logtest? (vehicle-flag sounds) (-> this unknown-flags)) - (vehicle-method-106 this) - ) - ) + (set! (-> this v-flags) (the-as vehicle-flag (logior (vehicle-flag sounds) (-> this v-flags)))) + (rigid-body-object-method-38 this) + ) + (else + (if (logtest? (vehicle-flag sounds) (-> this unknown-flags)) + (vehicle-method-106 this) + ) ) ) (when (logtest? (-> this draw status) (draw-control-status on-screen)) diff --git a/goal_src/jak3/levels/factory/conveyor.gc b/goal_src/jak3/levels/factory/conveyor.gc index 0fb58d7c21..58007f7b85 100644 --- a/goal_src/jak3/levels/factory/conveyor.gc +++ b/goal_src/jak3/levels/factory/conveyor.gc @@ -67,19 +67,18 @@ ) (defmethod init-fields! ((this conveyor)) - (local-vars (sv-16 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) (the-as (pointer float) #f)) (set! (-> this speed-mult-array-len) 0) - (let ((a0-1 (-> this entity))) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-4 (res-lump-data a0-1 'scale-factor (pointer float) :tag-ptr (& sv-16)))) - (when v1-4 - (set! (-> this speed-mult-array) v1-4) - (set! (-> this speed-mult-array-len) (the-as int (-> sv-16 elt-count))) - ) + (let* ((a0-1 (-> this entity)) + (sv-16 (new 'static 'res-tag)) + (v1-4 (res-lump-data a0-1 'scale-factor (pointer float) :tag-ptr (& sv-16))) + ) + (when v1-4 + (set! (-> this speed-mult-array) v1-4) + (set! (-> this speed-mult-array-len) (the-as int (-> sv-16 elt-count))) ) ) 0 @@ -182,14 +181,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)) ) ) ) @@ -225,14 +220,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) (-> this collide-bounds r))) - ) - (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) (-> this collide-bounds 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)) ) ) ) @@ -284,7 +275,6 @@ ) (defmethod conveyor-method-21 ((this conveyor)) - (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)) @@ -294,30 +284,32 @@ (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)) - (vector-copy! (-> sv-48 start) s3-0) - (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 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 conveyor-section #f)) + ) + (dotimes (s0-0 s1-0) + (let ((sv-48 (-> s2-0 data s0-0))) + (vector-copy! (-> sv-48 start) s3-0) + (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 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/goal_src/jak3/levels/factory/fac-robotank-turret.gc b/goal_src/jak3/levels/factory/fac-robotank-turret.gc index 1bb6192846..8ac85c38ff 100644 --- a/goal_src/jak3/levels/factory/fac-robotank-turret.gc +++ b/goal_src/jak3/levels/factory/fac-robotank-turret.gc @@ -296,7 +296,6 @@ ;; WARN: Return type mismatch (pointer ftank-shot) vs none. (defmethod fac-robotank-turret-method-33 ((this fac-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 2)) ) @@ -312,13 +311,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 fvec) 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)))) (vector-copy! (-> s5-0 0) (-> s3-0 0)) (vector+float*! (-> s5-0 1) (-> s5-0 0) s4-0 512000.0) (set! (-> this shot-range) (fmin 204800.0 f28-0)) diff --git a/goal_src/jak3/levels/factory/factory-boss-setup.gc b/goal_src/jak3/levels/factory/factory-boss-setup.gc index 118bf1c1c1..01f6858421 100644 --- a/goal_src/jak3/levels/factory/factory-boss-setup.gc +++ b/goal_src/jak3/levels/factory/factory-boss-setup.gc @@ -333,9 +333,8 @@ ) (defmethod factory-boss-reticle-info-method-10 ((this factory-boss-reticle-info) (arg0 vector) (arg1 vector) (arg2 int) (arg3 int)) - (local-vars (sv-160 vector)) - (set! sv-160 arg0) - (let ((s4-0 arg1) + (let ((sv-160 arg0) + (s4-0 arg1) (s2-0 arg2) (s1-0 arg3) ) @@ -818,7 +817,6 @@ (defstate impact (factory-boss-shockwave-bomb) :virtual #t :enter (behavior () - (local-vars (sv-272 entity-actor)) (stop-reticle-sound self) (sound-play "erol-proj-expls" :position (-> self root trans)) (let ((v1-4 (-> self root root-prim))) @@ -853,36 +851,20 @@ (matrix-identity! s4-0) (vector-copy! (-> s4-0 trans) s5-1) ) - (let* ((s3-0 (get-process *default-dead-pool* manipy #x20000 1)) - (s4-1 (when s3-0 - (let ((t9-9 (method-of-type manipy activate))) - (t9-9 (the-as manipy s3-0) self "manipy" (the-as pointer #x70004000)) - ) - (let ((s4-2 run-function-in-process) - (s2-0 s3-0) - (s1-0 manipy-init) - (s0-0 s5-1) - ) - (set! sv-272 (-> self entity)) - (let ((t0-2 (art-group-get-by-name *level* "skel-bomb-blast" (the-as (pointer level) #f))) - (t1-1 #f) - (t2-1 0) - ) - ((the-as (function object object object object object object object none) s4-2) - s2-0 - s1-0 - s0-0 - sv-272 - t0-2 - t1-1 - t2-1 - ) - ) - ) - (-> s3-0 ppointer) - ) - ) - ) + (let ((s4-1 (process-spawn + manipy + :init manipy-init + s5-1 + (-> self entity) + (art-group-get-by-name *level* "skel-bomb-blast" (the-as (pointer level) #f)) + #f + 0 + :name "manipy" + :to self + :stack-size #x20000 + ) + ) + ) (when s4-1 (send-event (ppointer->process s4-1) 'rot-quat gp-2) (send-event (ppointer->process s4-1) 'anim-mode 'play1) @@ -1158,28 +1140,21 @@ ;; ERROR: Stack slot load at 64 mismatch: defined as size 4, got size 16 ;; WARN: Return type mismatch quaternion vs object. (defbehavior fac-drop-plat-rot-once fac-drop-plat ((arg0 degrees)) - (local-vars (sv-48 float) (sv-64 float)) (let ((gp-0 (new 'stack-no-clear 'quaternion))) (let ((s5-0 (new 'stack-no-clear 'quaternion))) - (let ((s3-0 quaternion-set!) - (s2-0 gp-0) - (s1-0 (sin (* arg0 (-> self x-rotation-speed)))) - (s0-0 0.0) - ) - (set! sv-48 (the-as float 0.0)) - (let ((t0-0 (cos (* arg0 (-> self x-rotation-speed))))) - (s3-0 s2-0 s1-0 s0-0 sv-48 t0-0) - ) + (quaternion-set! + gp-0 + (sin (* arg0 (-> self x-rotation-speed))) + 0.0 + (the-as float 0.0) + (cos (* arg0 (-> self x-rotation-speed))) ) - (let ((s3-1 quaternion-set!) - (s2-1 s5-0) - (s1-1 0.0) - (s0-1 (sin (* arg0 (-> self y-rotation-speed)))) - ) - (set! sv-64 (the-as float 0.0)) - (let ((t0-1 (cos (* arg0 (-> self y-rotation-speed))))) - (s3-1 s2-1 s1-1 s0-1 sv-64 t0-1) - ) + (quaternion-set! + s5-0 + 0.0 + (sin (* arg0 (-> self y-rotation-speed))) + (the-as float 0.0) + (cos (* arg0 (-> self y-rotation-speed))) ) (quaternion-normalize! (quaternion*! gp-0 gp-0 s5-0)) ) @@ -1245,7 +1220,6 @@ (defmethod init-from-entity! ((this fac-drop-plat) (arg0 entity-actor)) "Set up a newly created process from the entity that created it." - (local-vars (sv-16 res-tag)) (with-pp (stack-size-set! (-> this main-thread) 32) (let ((s4-0 (new 'process 'collide-shape this (collide-list-enum usually-hit-by-player)))) @@ -1273,8 +1247,9 @@ (the-as pair 0) ) (set! (-> this draw light-index) (the-as uint 17)) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-16 (res-lump-data arg0 'actor-groups (pointer actor-group) :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-16 (res-lump-data arg0 'actor-groups (pointer actor-group) :tag-ptr (& sv-16))) + ) (cond ((and v1-16 (nonzero? (-> sv-16 elt-count)) (nonzero? (-> v1-16 0 length))) (set! (-> this boss) (-> v1-16 0 data 0 actor)) @@ -1718,7 +1693,6 @@ (defmethod init-from-entity! ((this factory-boss) (arg0 entity-actor)) "Set up a newly created process from the entity that created it." - (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-sphere s4-0 (the-as uint 0)))) (set! (-> v1-2 prim-core collide-as) (collide-spec enemy)) @@ -1921,8 +1895,9 @@ (set! (-> this root-angle) (+ 32768.0 (-> this catwalk-angle))) (set! (-> this hits-taken) 0) (set! (-> this camera-timer) 0) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-76 (res-lump-data arg0 'actor-groups pointer :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-76 (res-lump-data arg0 'actor-groups pointer :tag-ptr (& sv-16))) + ) (cond ((and v1-76 (nonzero? (-> sv-16 elt-count))) (set! (-> this actor-group-count) (the-as int (-> sv-16 elt-count))) diff --git a/goal_src/jak3/levels/factory/factory-boss-states.gc b/goal_src/jak3/levels/factory/factory-boss-states.gc index e3cd684d0d..267ca5b06f 100644 --- a/goal_src/jak3/levels/factory/factory-boss-states.gc +++ b/goal_src/jak3/levels/factory/factory-boss-states.gc @@ -547,18 +547,6 @@ ;; ERROR: Stack slot load at 336 mismatch: defined as size 4, got size 16 ;; WARN: Return type mismatch symbol vs none. (defbehavior factory-boss-always factory-boss () - (local-vars - (sv-256 (function float float float float float float)) - (sv-272 float) - (sv-288 float) - (sv-304 (function float float float float float float)) - (sv-320 float) - (sv-336 float) - (sv-352 float) - (sv-368 float) - (sv-384 float) - (sv-400 float) - ) (factory-boss-play-speech 0 self) (if (and (nonzero? (-> self camera-timer)) (time-elapsed? (-> self camera-timer) (seconds 3))) (factory-boss-end-cutscene) @@ -674,38 +662,32 @@ ((< (- (current-time) (-> s5-0 ring-timer)) 0) ) ((logtest? (-> s5-0 flags) (facboss-machine-state-flag fms1)) - (let ((s0-1 (current-time)) - (f30-0 300.0) - ) - (set! sv-256 lerp-scale) - (set! sv-272 (the-as float 0.05)) - (set! sv-288 (the-as float 0.15)) - (let* ((v1-73 (/ (the-as int (rand-uint31-gen *random-generator*)) 256)) - (v1-74 (the-as number (logior #x3f800000 v1-73))) - (a2-6 (+ -1.0 (the-as float v1-74))) - (a3-5 0.0) - (t0-0 1.0) - ) - (set! (-> s5-0 ring-timer) (+ s0-1 (the int (* f30-0 (sv-256 sv-272 sv-288 a2-6 a3-5 t0-0))))) - ) + (let* ((s0-1 (current-time)) + (f30-0 300.0) + (sv-256 lerp-scale) + (sv-272 (the-as float 0.05)) + (sv-288 (the-as float 0.15)) + (v1-73 (/ (the-as int (rand-uint31-gen *random-generator*)) 256)) + (v1-74 (the-as number (logior #x3f800000 v1-73))) + ) + (set! (-> s5-0 ring-timer) + (+ s0-1 (the int (* f30-0 (sv-256 sv-272 sv-288 (+ -1.0 (the-as float v1-74)) 0.0 1.0)))) + ) ) (logclear! (-> s5-0 flags) (facboss-machine-state-flag fms1)) ) (else - (let ((s0-2 (current-time)) - (f30-1 300.0) - ) - (set! sv-304 lerp-scale) - (set! sv-320 (the-as float 0.01)) - (set! sv-336 (the-as float 0.2)) - (let* ((v1-84 (/ (the-as int (rand-uint31-gen *random-generator*)) 256)) - (v1-85 (the-as number (logior #x3f800000 v1-84))) - (a2-7 (+ -1.0 (the-as float v1-85))) - (a3-6 0.0) - (t0-1 1.0) - ) - (set! (-> s5-0 ring-timer) (+ s0-2 (the int (* f30-1 (sv-304 sv-320 sv-336 a2-7 a3-6 t0-1))))) - ) + (let* ((s0-2 (current-time)) + (f30-1 300.0) + (sv-304 lerp-scale) + (sv-320 (the-as float 0.01)) + (sv-336 (the-as float 0.2)) + (v1-84 (/ (the-as int (rand-uint31-gen *random-generator*)) 256)) + (v1-85 (the-as number (logior #x3f800000 v1-84))) + ) + (set! (-> s5-0 ring-timer) + (+ s0-2 (the int (* f30-1 (sv-304 sv-320 sv-336 (+ -1.0 (the-as float v1-85)) 0.0 1.0)))) + ) ) (logior! (-> s5-0 flags) (facboss-machine-state-flag fms1)) ) @@ -715,39 +697,33 @@ (vector-copy! (-> s2-0 trans) s1-0) (spawn-from-mat (-> s5-0 damaged-left-spark-part) s2-0) (when (>= (- (current-time) (-> s5-0 left-spark-timer)) 0) - (let ((s1-1 (current-time)) - (f30-2 300.0) - (s0-3 lerp-scale) - ) - (set! sv-352 (the-as float 0.3)) - (set! sv-368 (the-as float 0.7)) - (let* ((v1-103 (/ (the-as int (rand-uint31-gen *random-generator*)) 256)) - (v1-104 (the-as number (logior #x3f800000 v1-103))) - (a2-8 (+ -1.0 (the-as float v1-104))) - (a3-7 0.0) - (t0-2 1.0) - ) - (set! (-> s5-0 left-spark-timer) (+ s1-1 (the int (* f30-2 (s0-3 sv-352 sv-368 a2-8 a3-7 t0-2))))) - ) + (let* ((s1-1 (current-time)) + (f30-2 300.0) + (s0-3 lerp-scale) + (sv-352 (the-as float 0.3)) + (sv-368 (the-as float 0.7)) + (v1-103 (/ (the-as int (rand-uint31-gen *random-generator*)) 256)) + (v1-104 (the-as number (logior #x3f800000 v1-103))) + ) + (set! (-> s5-0 left-spark-timer) + (+ s1-1 (the int (* f30-2 (s0-3 sv-352 sv-368 (+ -1.0 (the-as float v1-104)) 0.0 1.0)))) + ) ) (logclear! (-> s5-0 flags) (facboss-machine-state-flag fms2)) ) ) ((>= (- (current-time) (-> s5-0 left-spark-timer)) 0) - (let ((s1-2 (current-time)) - (f30-3 300.0) - (s0-4 lerp-scale) - ) - (set! sv-384 (the-as float 0.2)) - (set! sv-400 (the-as float 0.4)) - (let* ((v1-117 (/ (the-as int (rand-uint31-gen *random-generator*)) 256)) - (v1-118 (the-as number (logior #x3f800000 v1-117))) - (a2-9 (+ -1.0 (the-as float v1-118))) - (a3-8 0.0) - (t0-3 1.0) - ) - (set! (-> s5-0 left-spark-timer) (+ s1-2 (the int (* f30-3 (s0-4 sv-384 sv-400 a2-9 a3-8 t0-3))))) - ) + (let* ((s1-2 (current-time)) + (f30-3 300.0) + (s0-4 lerp-scale) + (sv-384 (the-as float 0.2)) + (sv-400 (the-as float 0.4)) + (v1-117 (/ (the-as int (rand-uint31-gen *random-generator*)) 256)) + (v1-118 (the-as number (logior #x3f800000 v1-117))) + ) + (set! (-> s5-0 left-spark-timer) + (+ s1-2 (the int (* f30-3 (s0-4 sv-384 sv-400 (+ -1.0 (the-as float v1-118)) 0.0 1.0)))) + ) ) (logior! (-> s5-0 flags) (facboss-machine-state-flag fms2)) ) diff --git a/goal_src/jak3/levels/factory/factory-manager.gc b/goal_src/jak3/levels/factory/factory-manager.gc index 8b9d6081f4..811e73c27f 100644 --- a/goal_src/jak3/levels/factory/factory-manager.gc +++ b/goal_src/jak3/levels/factory/factory-manager.gc @@ -129,28 +129,6 @@ ;; ERROR: Stack slot load at 448 mismatch: defined as size 4, got size 16 ;; ERROR: Stack slot load at 448 mismatch: defined as size 4, got size 16 (defmethod init-paths-for-list! ((this factory-manager) (arg0 factory-pathlist) (arg1 string)) - (local-vars - (sv-144 entity) - (sv-160 int) - (sv-176 int) - (sv-192 int) - (sv-208 (function _varargs_ object)) - (sv-224 int) - (sv-240 string) - (sv-256 int) - (sv-272 (function _varargs_ object)) - (sv-288 int) - (sv-304 string) - (sv-320 int) - (sv-336 vector) - (sv-352 vector) - (sv-368 vector) - (sv-384 int) - (sv-400 (function _varargs_ object)) - (sv-416 int) - (sv-432 string) - (sv-448 float) - ) (set! (-> arg0 npath) 0) (set! (-> arg0 nloop) 0) (let ((s3-0 (new 'stack 'curve))) @@ -166,59 +144,53 @@ (if #f (format 0 "String: ~A~%" *fac-tmp-str*) ) - (set! sv-144 (entity-by-name *fac-tmp-str*)) - (+! s2-0 1) - (if (not sv-144) - (set! s1-0 #t) - ) - (set! sv-160 0) - (when sv-144 - (set! (-> this entity) (the-as entity-actor sv-144)) - (set! sv-160 (fac-count-curves (the-as entity-actor sv-144))) - (set! sv-176 0) - (while (< sv-176 sv-160) - (set! sv-192 (+ sv-176 (-> arg0 npath))) - (while (not (get-curve-data! sv-144 s3-0 'path 'path-k (the float s0-0))) - (+! s0-0 1) + (let ((sv-144 (entity-by-name *fac-tmp-str*))) + (+! s2-0 1) + (if (not sv-144) + (set! s1-0 #t) ) - (set! (-> arg0 path sv-192) (new 'process 'curve-control this 'path (the float s0-0))) - (+! s0-0 1) - (logior! (-> arg0 path sv-192 flags) (path-control-flag display draw-line draw-point draw-text)) - (when #f - (set! sv-208 format) - (set! sv-224 0) - (set! sv-240 "Path ~d length ~M~%") - (set! sv-256 sv-192) - (let ((a3-3 (total-distance (-> arg0 path sv-192)))) - (sv-208 sv-224 sv-240 sv-256 a3-3) - ) - ) - (set! sv-336 (new 'stack-no-clear 'vector)) - (set! sv-352 (new 'stack-no-clear 'vector)) - (get-point-at-percent-along-path! (-> arg0 path sv-192) sv-336 0.0 'interp) - (get-point-at-percent-along-path! (-> arg0 path sv-192) sv-352 1.0 'interp) - (when #f - (set! sv-272 format) - (set! sv-288 0) - (set! sv-304 "Begin to end of path ~d is ~M~%") - (set! sv-320 sv-192) - (let ((a3-6 (vector-vector-distance sv-336 sv-352))) - (sv-272 sv-288 sv-304 sv-320 a3-6) - ) - ) - (when (>= 4.096 (vector-vector-distance-squared sv-336 sv-352)) - (if #f - (format 0 "Path idx ~d is a loop~%" sv-192) + (let ((sv-160 0)) + (when sv-144 + (set! (-> this entity) (the-as entity-actor sv-144)) + (set! sv-160 (fac-count-curves (the-as entity-actor sv-144))) + (let ((sv-176 0)) + (while (< sv-176 sv-160) + (let ((sv-192 (+ sv-176 (-> arg0 npath)))) + (while (not (get-curve-data! sv-144 s3-0 'path 'path-k (the float s0-0))) + (+! s0-0 1) + ) + (set! (-> arg0 path sv-192) (new 'process 'curve-control this 'path (the float s0-0))) + (+! s0-0 1) + (logior! (-> arg0 path sv-192 flags) (path-control-flag display draw-line draw-point draw-text)) + (if #f + (format 0 "Path ~d length ~M~%" sv-192 (total-distance (-> arg0 path sv-192))) + ) + (let ((sv-336 (new 'stack-no-clear 'vector)) + (sv-352 (new 'stack-no-clear 'vector)) + ) + (get-point-at-percent-along-path! (-> arg0 path sv-192) sv-336 0.0 'interp) + (get-point-at-percent-along-path! (-> arg0 path sv-192) sv-352 1.0 'interp) + (if #f + (format 0 "Begin to end of path ~d is ~M~%" sv-192 (vector-vector-distance sv-336 sv-352)) + ) + (when (>= 4.096 (vector-vector-distance-squared sv-336 sv-352)) + (if #f + (format 0 "Path idx ~d is a loop~%" sv-192) + ) + (logior! (-> arg0 inout sv-192 flags) (factory-inout-flag fi0)) + (set! (-> arg0 loops (-> arg0 nloop)) sv-192) + (+! (-> arg0 nloop) 1) + ) + ) + ) + (+! sv-176 1) ) - (logior! (-> arg0 inout sv-192 flags) (factory-inout-flag fi0)) - (set! (-> arg0 loops (-> arg0 nloop)) sv-192) - (+! (-> arg0 nloop) 1) + ) ) - (set! sv-176 (+ sv-176 1)) + (+! (-> arg0 npath) sv-160) ) ) ) - (+! (-> arg0 npath) sv-160) ) ) ) @@ -240,9 +212,9 @@ (let ((s2-1 (new 'stack-no-clear 'vector)) (s1-1 (new 'stack-no-clear 'vector)) (s0-1 (new 'stack-no-clear 'vector)) + (sv-368 (new 'stack-no-clear 'vector)) + (sv-384 0) ) - (set! sv-368 (new 'stack-no-clear 'vector)) - (set! sv-384 0) (while (< sv-384 (-> arg0 npath)) (when (logtest? (-> arg0 inout sv-384 flags) (factory-inout-flag fi0)) (get-point-at-percent-along-path! (-> arg0 path s5-1) s2-1 0.0 'interp) @@ -258,15 +230,9 @@ ) (get-point-at-percent-along-path! (-> arg0 path sv-384) s0-1 f26-0 'interp) (get-point-at-percent-along-path! (-> arg0 path sv-384) sv-368 f24-0 'interp) - (when #f - (set! sv-400 format) - (set! sv-416 0) - (set! sv-432 "Dist1: ~M Dist2: ~M~%") - (set! sv-448 (vector-vector-distance s2-1 s0-1)) - (let ((a3-12 (vector-vector-distance s1-1 sv-368))) - (sv-400 sv-416 sv-432 sv-448 a3-12) + (if #f + (format 0 "Dist1: ~M Dist2: ~M~%" (vector-vector-distance s2-1 s0-1) (vector-vector-distance s1-1 sv-368)) ) - ) (when (< (vector-vector-distance s2-1 s0-1) f28-0) (set! s4-1 1) (set! f28-0 (vector-vector-distance s2-1 s0-1)) @@ -281,7 +247,7 @@ ) ) ) - (set! sv-384 (+ sv-384 1)) + (+! sv-384 1) ) ) (if #f @@ -1532,12 +1498,12 @@ ) (defmethod task-manager-factory-sky-battle-method-32 ((this task-manager-factory-sky-battle)) - (local-vars (sv-16 res-tag)) (let ((a0-2 (entity-by-name "factory-sky-battle-manager-1"))) (when a0-2 (set! (-> this factory-sky-battle-entity) (the-as entity-actor a0-2)) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-1 (res-lump-data a0-2 'actor-groups pointer :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-1 (res-lump-data a0-2 'actor-groups pointer :tag-ptr (& sv-16))) + ) (cond ((and v1-1 (nonzero? (-> sv-16 elt-count))) (set! (-> this actor-group-count) (the-as int (-> sv-16 elt-count))) diff --git a/goal_src/jak3/levels/factory/factoryc-obs.gc b/goal_src/jak3/levels/factory/factoryc-obs.gc index a23ac151b0..233c93a8b6 100644 --- a/goal_src/jak3/levels/factory/factoryc-obs.gc +++ b/goal_src/jak3/levels/factory/factoryc-obs.gc @@ -364,6 +364,7 @@ ) (defmethod init-from-entity! ((this fac-zapper) (arg0 entity-actor)) + "Set up a newly created process from the entity that created it." ;; og:preserve-this added (stack-size-set! (-> this main-thread) 512) (set! (-> this entity) arg0) @@ -1151,7 +1152,6 @@ (defmethod init-from-entity! ((this factory-elec-gate) (arg0 entity-actor)) "Set up a newly created process from the entity that created it." - (local-vars (sv-16 res-tag)) (when (task-node-closed? (game-task-node factory-assault-get-vehicle)) (process-entity-status! this (entity-perm-status dead) #t) (deactivate this) @@ -1171,8 +1171,9 @@ (+! s4-0 1) ) ) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-20 (res-lump-data arg0 'actor-groups (pointer actor-group) :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-20 (res-lump-data arg0 'actor-groups (pointer actor-group) :tag-ptr (& sv-16))) + ) (cond ((and v1-20 (nonzero? (-> sv-16 elt-count))) (set! (-> this actor-group-count) (the-as int (-> sv-16 elt-count))) diff --git a/goal_src/jak3/levels/factory/factoryc-obs2.gc b/goal_src/jak3/levels/factory/factoryc-obs2.gc index 2cee47f5b2..01eb423aec 100644 --- a/goal_src/jak3/levels/factory/factoryc-obs2.gc +++ b/goal_src/jak3/levels/factory/factoryc-obs2.gc @@ -855,7 +855,6 @@ (defmethod init-from-entity! ((this fac-switch) (arg0 entity-actor)) "Set up a newly created process from the entity that created it." - (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) @@ -901,8 +900,9 @@ (the-as skeleton-group (art-group-get-by-name *level* "skel-fac-switch" (the-as (pointer level) #f))) (the-as pair 0) ) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-26 (res-lump-data arg0 'actor-groups pointer :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-26 (res-lump-data arg0 'actor-groups pointer :tag-ptr (& sv-16))) + ) (cond ((and v1-26 (nonzero? (-> sv-16 elt-count))) (set! (-> this actor-group-count) (the-as int (-> sv-16 elt-count))) @@ -1535,18 +1535,17 @@ (defmethod init-fields! ((this factory-conveyor)) - (local-vars (sv-16 res-tag)) (set! (-> this speed) 22528.0) (set! (-> this pull-y-threshold) 10240.0) (set! (-> this speed-mult-array) (the-as (pointer float) #f)) (set! (-> this speed-mult-array-len) 0) - (let ((a0-1 (-> this entity))) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-3 (res-lump-data a0-1 'scale-factor pointer :tag-ptr (& sv-16)))) - (when v1-3 - (set! (-> this speed-mult-array) (the-as (pointer float) v1-3)) - (set! (-> this speed-mult-array-len) (the-as int (-> sv-16 elt-count))) - ) + (let* ((a0-1 (-> this entity)) + (sv-16 (new 'static 'res-tag)) + (v1-3 (res-lump-data a0-1 'scale-factor (pointer float) :tag-ptr (& sv-16))) + ) + (when v1-3 + (set! (-> this speed-mult-array) v1-3) + (set! (-> this speed-mult-array-len) (the-as int (-> sv-16 elt-count))) ) ) (set! (-> this belt-radius) (* 4096.0 (the-as float ((method-of-type res-lump get-property-struct) diff --git a/goal_src/jak3/levels/factory/h-warf.gc b/goal_src/jak3/levels/factory/h-warf.gc index f77f983904..e9c8cdebee 100644 --- a/goal_src/jak3/levels/factory/h-warf.gc +++ b/goal_src/jak3/levels/factory/h-warf.gc @@ -460,9 +460,7 @@ (defun steer-attenuation ((arg0 int)) 0.0 - (let ((f0-2 (- 1.0 (fmax 0.0 (fmin 1.0 (* 0.0033333334 (the float (+ (- -90 arg0) (current-time))))))))) - (* f0-2 f0-2) - ) + (square (- 1.0 (fmax 0.0 (fmin 1.0 (* 0.0033333334 (the float (+ (- -90 arg0) (current-time)))))))) ) (deftype warf-asc (structure) @@ -594,7 +592,6 @@ ) (defmethod control-hook-player ((this h-warf)) - (local-vars (sv-1040 vector)) (b! (focus-test? *target* dead grabbed) cfg-39 :delay (nop!)) (let ((s5-0 (new 'stack-no-clear 'matrix))) (matrix-rotate-y! s5-0 (* 182.04445 (seconds-per-frame) (* 180.0 (-> this controls steering)))) @@ -633,24 +630,25 @@ (let ((s1-1 (new 'stack 'boxed-array collide-shape 128)) (s0-1 (new 'stack-no-clear 'vector)) ) - (set! sv-1040 (new 'stack-no-clear 'vector)) - 0 - (set-vector! s2-0 0.0 0.0 204800.0 1.0) - (vector-matrix*! s0-1 s2-0 s3-0) - (set-vector! s2-0 0.0 0.0 1658880.0 1.0) - (vector-rotate*! sv-1040 s2-0 s3-0) - (set! (-> s0-1 w) 32768.0) - (set! (-> sv-1040 w) 32768.0) - (set! (-> s1-1 length) (fill-actor-list-for-sphere - *actor-hash* - s0-1 - sv-1040 - (-> sv-1040 w) - (the-as (pointer collide-shape) (-> s1-1 data)) - (-> s1-1 allocated-length) - -1 - ) - ) + (let ((sv-1040 (new 'stack-no-clear 'vector))) + 0 + (set-vector! s2-0 0.0 0.0 204800.0 1.0) + (vector-matrix*! s0-1 s2-0 s3-0) + (set-vector! s2-0 0.0 0.0 1658880.0 1.0) + (vector-rotate*! sv-1040 s2-0 s3-0) + (set! (-> s0-1 w) 32768.0) + (set! (-> sv-1040 w) 32768.0) + (set! (-> s1-1 length) (fill-actor-list-for-sphere + *actor-hash* + s0-1 + sv-1040 + (-> sv-1040 w) + (the-as (pointer collide-shape) (-> s1-1 data)) + (-> s1-1 allocated-length) + -1 + ) + ) + ) (let ((a0-41 (find-nearest-focusable (the-as (array collide-shape) s1-1) s0-1 @@ -951,14 +949,7 @@ ) (when (logtest? (-> this info flags) 1) (vector-float*! (-> arg1 tmp) (-> arg1 mat uvec) -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)) diff --git a/goal_src/jak3/levels/factory/lfaccity-mood.gc b/goal_src/jak3/levels/factory/lfaccity-mood.gc index 881958c288..1a221180d4 100644 --- a/goal_src/jak3/levels/factory/lfaccity-mood.gc +++ b/goal_src/jak3/levels/factory/lfaccity-mood.gc @@ -113,9 +113,9 @@ (defmethod init-from-entity! ((this lfaccity-pparticle-mover) (arg0 entity-actor)) "Set up a newly created process from the entity that created it." - (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/goal_src/jak3/levels/factory/missile-bot.gc b/goal_src/jak3/levels/factory/missile-bot.gc index 96b75c3c70..88576f4cb3 100644 --- a/goal_src/jak3/levels/factory/missile-bot.gc +++ b/goal_src/jak3/levels/factory/missile-bot.gc @@ -315,13 +315,7 @@ (set! (-> s0-0 y) 0.0) (vector-float*! s2-1 s5-1 (vector-dot s5-1 s0-0)) (vector-! s1-0 s2-1 s0-0) - (let ((v1-10 arg0) - (a0-11 s2-1) - (a1-7 s5-1) - (f0-4 110592.0) - ) - (vector+float*! v1-10 a0-11 a1-7 (sqrtf (- (* f0-4 f0-4) (vector-length-squared s1-0)))) - ) + (vector+float*! arg0 s2-1 s5-1 (sqrtf (- (square 110592.0) (vector-length-squared s1-0)))) (if (< (vector-dot s5-1 arg0) 0.0) (vector-reset! arg0) ) @@ -331,10 +325,8 @@ 0.0 (let ((f0-13 (* -0.5 (vector-vector-distance arg0 s4-0)))) (set! (-> s2-3 y) 0.0) - (let ((f1-3 (vector-length-squared s2-3)) - (f2-0 20480.0) - ) - (if (< (* f2-0 f2-0) f1-3) + (let ((f1-3 (vector-length-squared s2-3))) + (if (< (square 20480.0) f1-3) (vector-float*! s2-3 s2-3 (/ 20480.0 (sqrtf f1-3))) ) ) @@ -461,34 +453,24 @@ ) ) (let ((f30-0 (vector-vector-xz-distance-squared (-> self root trans) (target-pos 0)))) - (let* ((gp-2 (-> self nav)) - (t9-11 lerp-scale) - (a0-13 0.0) - (a1-2 (-> self enemy-info run-travel-speed)) - (a2-0 f30-0) - (f0-1 12288.0) - (a3-0 (* f0-1 f0-1)) - (f0-3 16384.0) - ) - (set! (-> gp-2 target-speed) (t9-11 a0-13 a1-2 a2-0 a3-0 (* f0-3 f0-3))) + (let ((gp-2 (-> self nav))) + (set! (-> gp-2 target-speed) + (lerp-scale 0.0 (-> self enemy-info run-travel-speed) f30-0 (square 12288.0) (square 16384.0)) + ) ) 0 - (let ((f0-6 16384.0)) - (cond - ((< f30-0 (* f0-6 f0-6)) - (when (zero? (-> self lightning-timer)) - (set! (-> self lightning-mode) (the-as uint 1)) - (set-time! (-> self lightning-timer)) - ) + (cond + ((< f30-0 (square 16384.0)) + (when (zero? (-> self lightning-timer)) + (set! (-> self lightning-mode) (the-as uint 1)) + (set-time! (-> self lightning-timer)) ) - ((let ((f0-9 24576.0)) - (and (< (* f0-9 f0-9) f30-0) (>= (+ (current-time) (seconds -1)) (-> self lightning-timer))) - ) - (set! (-> self lightning-mode) (the-as uint 0)) - (set! (-> self lightning-timer) 0) - 0 - ) - ) + ) + ((and (< (square 24576.0) f30-0) (>= (+ (current-time) (seconds -1)) (-> self lightning-timer))) + (set! (-> self lightning-mode) (the-as uint 0)) + (set! (-> self lightning-timer) 0) + 0 + ) ) ) ) @@ -669,13 +651,11 @@ (set! (-> self explosion-sound-index) 0) (set! (-> self will-hit-errol) #f) (let ((v1-3 (as-type (ppointer->process (-> self parent)) factory-boss))) - (when v1-3 - (let ((f0-2 (vector-vector-xz-distance-squared (-> self root trans) (-> v1-3 root trans))) - (f1-0 20480.0) - ) - (set! (-> self will-hit-errol) (< f0-2 (* f1-0 f1-0))) + (if v1-3 + (set! (-> self will-hit-errol) + (< (vector-vector-xz-distance-squared (-> self root trans) (-> v1-3 root trans)) (square 20480.0)) + ) ) - ) ) ) :trans (behavior () @@ -778,7 +758,6 @@ ;; WARN: Return type mismatch symbol vs none. (defmethod enemy-common-post ((this missile-bot)) "Common implementation of post. Runs ja-post." - (local-vars (sv-272 vector) (sv-288 vector) (sv-304 vector)) (with-pp (cond ((stunned?) @@ -874,22 +853,13 @@ (let ((v0-33 (vector-normalize-copy! (new 'stack-no-clear 'vector) (-> this lightning-wobble 0 value) 819.2))) (vector+! s5-1 s5-1 v0-33) ) - (set! sv-304 s4-0) - (let ((v1-90 (-> s2-0 quad))) - (set! (-> sv-304 quad) v1-90) - ) + (vector-copy! s4-0 s2-0) ) ((= v1-85 1) - (set! sv-304 s4-0) - (let ((v1-92 (-> s1-0 quad))) - (set! (-> sv-304 quad) v1-92) - ) + (vector-copy! s4-0 s1-0) ) ((= v1-85 2) - (set! sv-272 s3-0) - (let ((v1-93 (-> (target-pos 8) quad))) - (set! (-> sv-272 quad) v1-93) - ) + (vector-copy! s3-0 (target-pos 8)) (vector-! s5-1 s3-0 s2-0) (set! (-> s5-1 y) 0.0) (vector-normalize! s5-1 4096.0) @@ -898,22 +868,13 @@ (let ((v0-36 (vector-normalize-copy! (new 'stack-no-clear 'vector) (-> this lightning-wobble 1 value) 819.2))) (vector+! s5-1 s5-1 v0-36) ) - (set! sv-304 s4-0) - (let ((v1-99 (-> s2-0 quad))) - (set! (-> sv-304 quad) v1-99) - ) + (vector-copy! s4-0 s2-0) ) ((= v1-85 3) - (set! sv-304 s4-0) - (let ((v1-101 (-> s3-0 quad))) - (set! (-> sv-304 quad) v1-101) - ) + (vector-copy! s4-0 s3-0) ) ((= v1-85 4) - (set! sv-288 s3-0) - (let ((v1-102 (-> (target-pos 8) quad))) - (set! (-> sv-288 quad) v1-102) - ) + (vector-copy! s3-0 (target-pos 8)) (vector-! s5-1 s3-0 s1-0) (set! (-> s5-1 y) 0.0) (vector-normalize! s5-1 4096.0) @@ -922,16 +883,10 @@ (let ((v0-39 (vector-normalize-copy! (new 'stack-no-clear 'vector) (-> this lightning-wobble 2 value) 819.2))) (vector+! s5-1 s5-1 v0-39) ) - (set! sv-304 s4-0) - (let ((v1-108 (-> s1-0 quad))) - (set! (-> sv-304 quad) v1-108) - ) + (vector-copy! s4-0 s1-0) ) (else - (set! sv-304 s4-0) - (let ((v1-109 (-> (target-pos 6) quad))) - (set! (-> sv-304 quad) v1-109) - ) + (vector-copy! s4-0 (target-pos 6)) ) ) ) diff --git a/goal_src/jak3/levels/factory/warf-projectile.gc b/goal_src/jak3/levels/factory/warf-projectile.gc index a2c1811c0a..c4669f4ba5 100644 --- a/goal_src/jak3/levels/factory/warf-projectile.gc +++ b/goal_src/jak3/levels/factory/warf-projectile.gc @@ -562,23 +562,11 @@ (defstate impact (warf-projectile) :virtual #t :enter (behavior () - (local-vars (sv-32 int)) (set! (-> self hit-pos w) 0.0) (kill-particles (-> self part)) (let ((gp-0 (new 'stack-no-clear 'warf-explosion-sphere-init-params))) (vector-copy! (-> gp-0 pos) (-> self hit-pos)) - (let ((s5-0 sound-play-by-name) - (sname (static-sound-name "impact-trigger2")) - (s3-0 (new-sound-id)) - (s2-0 1024) - (s1-0 0) - (s0-0 0) - ) - (set! sv-32 0) - (let ((t2-0 (target-pos 0))) - (s5-0 (the-as sound-name sname) s3-0 s2-0 s1-0 s0-0 (the-as sound-group sv-32) t2-0) - ) - ) + (sound-play "impact-trigger2" :position (target-pos 0)) (process-spawn warf-explosion-sphere gp-0 :name "warf-explosion-sphere" :to self) ) (call-parent-state-handler enter) diff --git a/goal_src/jak3/levels/forest/for-turret.gc b/goal_src/jak3/levels/forest/for-turret.gc index 873fe075f1..1a9c33f23e 100644 --- a/goal_src/jak3/levels/forest/for-turret.gc +++ b/goal_src/jak3/levels/forest/for-turret.gc @@ -57,27 +57,6 @@ ;; ERROR: Stack slot load at 352 mismatch: defined as size 4, got size 16 ;; ERROR: Stack slot load at 368 mismatch: defined as size 4, got size 16 (defmethod draw ((this hud-for-turret-health)) - (local-vars - (sv-80 float) - (sv-84 vector) - (sv-88 vector) - (sv-92 vector) - (sv-96 vector) - (sv-100 process-focusable) - (sv-128 vector) - (sv-132 vector) - (sv-136 vector) - (sv-140 vector) - (sv-240 float) - (sv-304 vector) - (sv-308 vector) - (sv-312 vector) - (sv-320 vector) - (sv-336 (function float float float float float float)) - (sv-352 float) - (sv-368 float) - (sv-384 int) - ) (with-pp (seek! (-> this fade-interp) @@ -93,34 +72,39 @@ (set-as-offset-from! (-> this sprites 1) (-> this sprites 0 pos) 44 0) (set-as-offset-from! (-> this sprites 2) (-> this sprites 0 pos) 0 44) (set-as-offset-from! (-> this sprites 3) (-> this sprites 0 pos) 44 44) - (set! sv-80 (* 0.5 (- 1.0 (-> this offset)) (-> this fade-interp))) - (let ((v1-8 (new 'stack-no-clear 'vector))) + (let ((sv-80 (* 0.5 (- 1.0 (-> this offset)) (-> this fade-interp))) + (v1-8 (new 'stack-no-clear 'vector)) + ) (set! (-> v1-8 x) 255.0) (set! (-> v1-8 y) 32.0) (set! (-> v1-8 z) 0.0) (set! (-> v1-8 w) 0.0) - (set! sv-84 v1-8) - ) - (let ((v1-9 (new 'stack-no-clear 'vector))) - (set! (-> v1-9 x) 32.0) - (set! (-> v1-9 y) 230.0) - (set! (-> v1-9 z) 32.0) - (set! (-> v1-9 w) 0.0) - (set! sv-88 v1-9) - ) - (set! sv-92 (new 'stack-no-clear 'vector)) - (set! sv-96 (new 'stack-no-clear 'vector)) - (vector-lerp! sv-96 sv-84 sv-88 (lerp-scale 0.0 1.0 (the float (-> this values 0 current)) 2.0 12.0)) - (set! (-> sv-96 w) (lerp 96.0 sv-80 (lerp-scale 0.0 1.0 (the float (-> this values 0 current)) 4.0 8.0))) - (vector-cvt.w.s! sv-92 sv-96) - (dotimes (v1-15 16) - (let ((a0-23 (-> this sprites (- 19 v1-15)))) - (set! (-> a0-23 scale-x) (if (< v1-15 (-> this values 0 current)) - 0.7 - 0.0 - ) + (let ((sv-84 v1-8) + (v1-9 (new 'stack-no-clear 'vector)) + ) + (set! (-> v1-9 x) 32.0) + (set! (-> v1-9 y) 230.0) + (set! (-> v1-9 z) 32.0) + (set! (-> v1-9 w) 0.0) + (let ((sv-88 v1-9) + (sv-92 (new 'stack-no-clear 'vector)) ) - (set! (-> a0-23 color quad) (-> sv-92 quad)) + (let ((sv-96 (new 'stack-no-clear 'vector))) + (vector-lerp! sv-96 sv-84 sv-88 (lerp-scale 0.0 1.0 (the float (-> this values 0 current)) 2.0 12.0)) + (set! (-> sv-96 w) (lerp 96.0 sv-80 (lerp-scale 0.0 1.0 (the float (-> this values 0 current)) 4.0 8.0))) + (vector-cvt.w.s! sv-92 sv-96) + ) + (dotimes (v1-15 16) + (let ((a0-23 (-> this sprites (- 19 v1-15)))) + (set! (-> a0-23 scale-x) (if (< v1-15 (-> this values 0 current)) + 0.7 + 0.0 + ) + ) + (set! (-> a0-23 color quad) (-> sv-92 quad)) + ) + ) + ) ) ) (set-as-offset-from! (-> this sprites 4) (-> this sprites 0 pos) 13 6) @@ -216,86 +200,79 @@ ) (let ((s3-2 (-> *minimap* engine alive-list))) (while s3-2 - (set! sv-100 (as-type (handle->process (-> s3-2 handle)) process-focusable)) - (when (and sv-100 - (logtest? (process-mask enemy) (-> sv-100 mask)) - (not (focus-test? sv-100 disable dead ignore inactive turret)) - (!= sv-100 *target*) - ) - (set! sv-128 (get-trans sv-100 3)) - (set! sv-132 (new 'stack-no-clear 'vector)) - (set! sv-136 (-> this aim-vector-source)) - (set! sv-140 (-> this aim-vector)) - (vector-line-distance-point! - sv-128 - sv-136 - (vector+float*! (new 'stack-no-clear 'vector) sv-136 sv-140 4096.0) - sv-132 - ) - (let* ((s2-3 (vector-! (new 'stack-no-clear 'vector) sv-128 sv-132)) - (a1-46 - (vector-flatten! - (new 'stack-no-clear 'vector) - s2-3 - (vector-normalize-copy! (new 'stack-no-clear 'vector) sv-140 1.0) + (let ((sv-100 (as-type (handle->process (-> s3-2 handle)) process-focusable))) + (when (and sv-100 + (logtest? (process-mask enemy) (-> sv-100 mask)) + (not (focus-test? sv-100 disable dead ignore inactive turret)) + (!= sv-100 *target*) ) - ) - (s2-4 (vector-rotate*! (new 'stack-no-clear 'vector) a1-46 (-> *math-camera* camera-rot))) - (f30-0 (vector-vector-angle-safe sv-140 (vector-! (new 'stack-no-clear 'vector) sv-128 sv-136))) - ) - (set! sv-240 (atan (-> s2-4 x) (-> s2-4 y))) - ;; og:preserve-this mirror mode - (if (or (logtest? (-> *game-info* secrets) (game-secrets hflip-screen)) - *PC-MIRROR-MODE-SET*) - (set! sv-240 (* -1.0 sv-240)) - ) - (let ((v1-105 (new 'stack-no-clear 'vector))) - (set! (-> v1-105 x) 128.0) - (set! (-> v1-105 y) 128.0) - (set! (-> v1-105 z) 128.0) - (set! (-> v1-105 w) 0.0) - (set! sv-304 v1-105) - ) - (let ((v1-106 (new 'stack-no-clear 'vector))) - (set! (-> v1-106 x) 255.0) - (set! (-> v1-106 y) 24.0) - (set! (-> v1-106 z) 32.0) - (set! (-> v1-106 w) 0.0) - (set! sv-308 v1-106) - ) - (set! sv-312 (new 'stack-no-clear 'vector)) - (let ((s2-5 vector-lerp!) - (s1-1 sv-312) - (s0-1 sv-304) + (let ((sv-128 (get-trans sv-100 3)) + (sv-132 (new 'stack-no-clear 'vector)) + (sv-136 (-> this aim-vector-source)) + (sv-140 (-> this aim-vector)) ) - (set! sv-320 sv-308) - (set! sv-336 lerp-scale) - (set! sv-352 (the-as float 1.0)) - (set! sv-368 (the-as float 0.0)) - (let* ((a2-39 (vector-vector-distance sv-128 sv-136)) - (a3-33 20480.0) - (t0-3 122880.0) - (a3-34 (sv-336 sv-352 sv-368 a2-39 a3-33 t0-3)) + (vector-line-distance-point! + sv-128 + sv-136 + (vector+float*! (new 'stack-no-clear 'vector) sv-136 sv-140 4096.0) + sv-132 + ) + (let* ((s2-3 (vector-! (new 'stack-no-clear 'vector) sv-128 sv-132)) + (a1-46 + (vector-flatten! + (new 'stack-no-clear 'vector) + s2-3 + (vector-normalize-copy! (new 'stack-no-clear 'vector) sv-140 1.0) + ) + ) + (s2-4 (vector-rotate*! (new 'stack-no-clear 'vector) a1-46 (-> *math-camera* camera-rot))) + (f30-0 (vector-vector-angle-safe sv-140 (vector-! (new 'stack-no-clear 'vector) sv-128 sv-136))) + (sv-240 (atan (-> s2-4 x) (-> s2-4 y))) ) - (s2-5 s1-1 s0-1 sv-320 a3-34) - ) - ) - (vector-cvt.w.s! (the-as vector (-> this sprites 28 color-ptr)) sv-312) - (set! (-> this sprites 28 color w) - (the int (* (/ (-> this fade-interp) 128) (lerp-scale 0.0 128.0 f30-0 1820.4445 3640.889))) + ;; og:preserve-this mirror mode + (if (or (logtest? (-> *game-info* secrets) (game-secrets hflip-screen)) + *PC-MIRROR-MODE-SET*) + (set! sv-240 (* -1.0 sv-240)) ) - ) - (let ((s2-6 set-as-offset-from!) - (s1-2 (-> this sprites 28)) - (s0-2 (-> this sprites)) + (let ((v1-105 (new 'stack-no-clear 'vector))) + (set! (-> v1-105 x) 128.0) + (set! (-> v1-105 y) 128.0) + (set! (-> v1-105 z) 128.0) + (set! (-> v1-105 w) 0.0) + (let ((sv-304 v1-105) + (v1-106 (new 'stack-no-clear 'vector)) + ) + (set! (-> v1-106 x) 255.0) + (set! (-> v1-106 y) 24.0) + (set! (-> v1-106 z) 32.0) + (set! (-> v1-106 w) 0.0) + (let ((sv-308 v1-106) + (sv-312 (new 'stack-no-clear 'vector)) + ) + (vector-lerp! + sv-312 + sv-304 + sv-308 + (lerp-scale (the-as float 1.0) (the-as float 0.0) (vector-vector-distance sv-128 sv-136) 20480.0 122880.0) + ) + (vector-cvt.w.s! (the-as vector (-> this sprites 28 color-ptr)) sv-312) + ) + ) + ) + (set! (-> this sprites 28 color w) + (the int (* (/ (-> this fade-interp) 128) (lerp-scale 0.0 128.0 f30-0 1820.4445 3640.889))) + ) + (set-as-offset-from! + (-> this sprites 28) + (-> this sprites 0 pos) + (the int (* -70.0 (sin sv-240))) + (+ (the int (* -70.0 (cos sv-240))) 44) + ) + (set! (-> this sprites 28 angle) (+ -8192.0 sv-240)) ) - (set! sv-384 (the int (* -70.0 (sin sv-240)))) - (let ((a3-36 (+ (the int (* -70.0 (cos sv-240))) 44))) - (s2-6 s1-2 (-> s0-2 0 pos) sv-384 a3-36) ) + (draw (-> this sprites 28) s4-2 (-> this level) #f) ) - (set! (-> this sprites 28 angle) (+ -8192.0 sv-240)) - (draw (-> this sprites 28) s4-2 (-> this level) #f) ) (set! s3-2 (-> s3-2 next)) ) @@ -1007,61 +984,62 @@ ) (defmethod explode-turret ((this for-turret)) - (local-vars (sv-112 matrix) (sv-116 vector) (sv-120 vector)) (sound-play "cannon-explode") - (set! sv-112 (new 'stack-no-clear 'matrix)) - (set! sv-116 (vector-z-quaternion! (new 'stack-no-clear 'vector) (-> this root quat))) - (set! sv-120 (new 'stack-no-clear 'vector)) - (set! (-> sv-116 y) 0.0) - (vector-normalize! sv-116 1.0) - (let ((f30-0 0.0)) - (dotimes (s5-1 8) - (let ((s4-1 (vector-rotate-y! (new 'stack-no-clear 'vector) sv-116 f30-0))) - (+! f30-0 (* 182.04445 (rand-vu-float-range 40.0 50.0))) - (vector-normalize! s4-1 1.0) - (vector+float*! sv-120 (-> this root trans) s4-1 (* 4096.0 (rand-vu-float-range 1.5 2.5))) + (let ((sv-112 (new 'stack-no-clear 'matrix)) + (sv-116 (vector-z-quaternion! (new 'stack-no-clear 'vector) (-> this root quat))) + (sv-120 (new 'stack-no-clear 'vector)) ) - (let ((s4-2 (new 'stack-no-clear 'vector))) - (vector-copy! s4-2 *y-vector*) - (let ((s3-2 (new 'stack-no-clear 'collide-query))) - (vector-copy! (-> s3-2 start-pos) sv-120) - (+! (-> s3-2 start-pos y) 12288.0) - (set-vector! (-> s3-2 move-dist) 0.0 -12288.0 0.0 0.0) - (let ((v1-13 s3-2)) - (set! (-> v1-13 radius) 819.2) - (set! (-> v1-13 collide-with) (collide-spec backgnd)) - (set! (-> v1-13 ignore-process0) #f) - (set! (-> v1-13 ignore-process1) #f) - (set! (-> v1-13 ignore-pat) - (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) - ) - (set! (-> v1-13 action-mask) (collide-action solid)) - ) - (let ((f0-12 (fill-and-probe-using-line-sphere *collide-cache* s3-2))) - (when (>= f0-12 0.0) - (vector+float*! sv-120 (-> s3-2 start-pos) (-> s3-2 move-dist) f0-12) - (vector-! s4-2 sv-120 (-> s3-2 best-other-tri intersect)) - (vector-normalize! s4-2 1.0) - ) - ) + (set! (-> sv-116 y) 0.0) + (vector-normalize! sv-116 1.0) + (let ((f30-0 0.0)) + (dotimes (s5-1 8) + (let ((s4-1 (vector-rotate-y! (new 'stack-no-clear 'vector) sv-116 f30-0))) + (+! f30-0 (* 182.04445 (rand-vu-float-range 40.0 50.0))) + (vector-normalize! s4-1 1.0) + (vector+float*! sv-120 (-> this root trans) s4-1 (* 4096.0 (rand-vu-float-range 1.5 2.5))) ) - (matrix-u-f-compose sv-112 s4-2 sv-116) - ) - (+! (-> sv-120 y) 819.2) - (vector-copy! (-> sv-112 trans) sv-120) - (let ((v1-32 - (if (logtest? (-> group-for-turret-scorched-earth flags) (sp-group-flag sp13)) - (part-tracker-spawn - part-tracker-subsampler - :to *entity-pool* - :group group-for-turret-scorched-earth - :mat-joint sv-112 + (let ((s4-2 (new 'stack-no-clear 'vector))) + (vector-copy! s4-2 *y-vector*) + (let ((s3-2 (new 'stack-no-clear 'collide-query))) + (vector-copy! (-> s3-2 start-pos) sv-120) + (+! (-> s3-2 start-pos y) 12288.0) + (set-vector! (-> s3-2 move-dist) 0.0 -12288.0 0.0 0.0) + (let ((v1-13 s3-2)) + (set! (-> v1-13 radius) 819.2) + (set! (-> v1-13 collide-with) (collide-spec backgnd)) + (set! (-> v1-13 ignore-process0) #f) + (set! (-> v1-13 ignore-process1) #f) + (set! (-> v1-13 ignore-pat) + (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) ) - (part-tracker-spawn part-tracker :to *entity-pool* :group group-for-turret-scorched-earth :mat-joint sv-112) - ) + (set! (-> v1-13 action-mask) (collide-action solid)) + ) + (let ((f0-12 (fill-and-probe-using-line-sphere *collide-cache* s3-2))) + (when (>= f0-12 0.0) + (vector+float*! sv-120 (-> s3-2 start-pos) (-> s3-2 move-dist) f0-12) + (vector-! s4-2 sv-120 (-> s3-2 best-other-tri intersect)) + (vector-normalize! s4-2 1.0) + ) ) ) - (send-event (ppointer->process v1-32) 'clock this) + (matrix-u-f-compose sv-112 s4-2 sv-116) + ) + (+! (-> sv-120 y) 819.2) + (vector-copy! (-> sv-112 trans) sv-120) + (let ((v1-32 + (if (logtest? (-> group-for-turret-scorched-earth flags) (sp-group-flag sp13)) + (part-tracker-spawn + part-tracker-subsampler + :to *entity-pool* + :group group-for-turret-scorched-earth + :mat-joint sv-112 + ) + (part-tracker-spawn part-tracker :to *entity-pool* :group group-for-turret-scorched-earth :mat-joint sv-112) + ) + ) + ) + (send-event (ppointer->process v1-32) 'clock this) + ) ) ) ) @@ -1437,16 +1415,16 @@ ) (defmethod init-fields! ((this for-turret)) - (local-vars (sv-16 res-tag)) (set! (-> this focus-handle) (the-as handle #f)) (set! (-> this current-barrel) 0) (set! (-> this barrel-recoil-offset 0) 0.0) (set! (-> this barrel-recoil-offset 1) 0.0) - (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 actor-group) :tag-ptr (& sv-16))) + ) (cond ((and v1-1 (nonzero? (-> sv-16 elt-count))) - (set! (-> this actor-group) (the-as (pointer actor-group) v1-1)) + (set! (-> this actor-group) v1-1) (set! (-> this actor-group-count) (the-as int (-> sv-16 elt-count))) ) (else diff --git a/goal_src/jak3/levels/forest/forest-kill-plants.gc b/goal_src/jak3/levels/forest/forest-kill-plants.gc index f3e943cff0..1f58f98938 100644 --- a/goal_src/jak3/levels/forest/forest-kill-plants.gc +++ b/goal_src/jak3/levels/forest/forest-kill-plants.gc @@ -453,11 +453,9 @@ (set! (-> s5-3 map-icon) (the-as uint 13)) (set! (-> self arrow) (process->handle (task-arrow-spawn s5-3 self))) ) - (while (let ((f0-0 (vector-vector-distance-squared gp-5 (target-pos 0))) - (f1-0 24576.0) - ) - (and (>= f0-0 (* f1-0 f1-0)) (handle->process (-> self arrow))) - ) + (while (and (>= (vector-vector-distance-squared gp-5 (target-pos 0)) (square 24576.0)) + (handle->process (-> self arrow)) + ) (suspend) ) ) @@ -596,11 +594,7 @@ ) (task-node-close! (game-task-node forest-kill-plants-pillars) 'event) ) - (while (let ((f0-7 (vector-vector-distance-squared gp-7 (target-pos 0))) - (f1-7 49152.0) - ) - (>= f0-7 (* f1-7 f1-7)) - ) + (while (>= (vector-vector-distance-squared gp-7 (target-pos 0)) (square 49152.0)) (suspend) ) (let ((v1-194 (get-status *gui-control* s4-9))) @@ -620,11 +614,7 @@ (suspend) ) ) - (while (let ((f0-8 (vector-vector-distance-squared gp-7 (target-pos 0))) - (f1-10 24576.0) - ) - (>= f0-8 (* f1-10 f1-10)) - ) + (while (>= (vector-vector-distance-squared gp-7 (target-pos 0)) (square 24576.0)) (suspend) ) (send-event (handle->process (-> self arrow)) 'die) @@ -645,9 +635,7 @@ (let ((s5-10 (new 'stack-no-clear 'vector))) (vector-copy! s5-10 (-> gp-11 extra trans)) (+! (-> s5-10 y) 65536.0) - (while (let ((f0-11 102400.0)) - (>= (* f0-11 f0-11) (vector-vector-distance-squared s5-10 (target-pos 0))) - ) + (while (>= (square 102400.0) (vector-vector-distance-squared s5-10 (target-pos 0))) (suspend) ) ) @@ -752,12 +740,12 @@ ) (defmethod init-actor-group! ((this task-manager-forest-plants)) - (local-vars (sv-16 res-tag)) (let ((a0-2 (entity-by-name "for-plant-manager-1"))) (when a0-2 (set! (-> this plant-manager-entity) a0-2) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-1 (res-lump-data a0-2 'actor-groups pointer :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-1 (res-lump-data a0-2 'actor-groups pointer :tag-ptr (& sv-16))) + ) (cond ((and v1-1 (>= (-> sv-16 elt-count) (the-as uint 2))) (set! (-> this actor-group-count) (the-as int (-> sv-16 elt-count))) diff --git a/goal_src/jak3/levels/forest/forest-part.gc b/goal_src/jak3/levels/forest/forest-part.gc index 6c8048b169..613b3d647c 100644 --- a/goal_src/jak3/levels/forest/forest-part.gc +++ b/goal_src/jak3/levels/forest/forest-part.gc @@ -514,7 +514,7 @@ (set! (-> v1-9 x) f0-2) (set! (-> v1-9 y) f1-3) (set! (-> v1-9 z) f2-0) - (set! (-> v1-9 w) (sqrtf (- (- (- 1.0 (* f2-0 f2-0)) (* f1-3 f1-3)) (* f0-2 f0-2)))) + (set! (-> v1-9 w) (sqrtf (- (- (- 1.0 (square f2-0)) (square f1-3)) (square f0-2)))) ) (matrix-u-f-compose s3-0 *y-vector* (vector-z-quaternion! (new 'stack-no-clear 'vector) s4-0)) (matrix->quaternion s4-0 s3-0) @@ -555,7 +555,7 @@ (set! (-> v1-14 x) f0-8) (set! (-> v1-14 y) f1-7) (set! (-> v1-14 z) f2-3) - (set! (-> v1-14 w) (sqrtf (- (- (- 1.0 (* f2-3 f2-3)) (* f1-7 f1-7)) (* f0-8 f0-8)))) + (set! (-> v1-14 w) (sqrtf (- (- (- 1.0 (square f2-3)) (square f1-7)) (square f0-8)))) ) (matrix-u-f-compose s3-1 *y-vector* (vector-z-quaternion! (new 'stack-no-clear 'vector) s5-1)) (matrix->quaternion s4-1 s3-1) @@ -693,7 +693,7 @@ (set! (-> v1-9 x) f0-2) (set! (-> v1-9 y) f1-3) (set! (-> v1-9 z) f2-0) - (set! (-> v1-9 w) (sqrtf (- (- (- 1.0 (* f2-0 f2-0)) (* f1-3 f1-3)) (* f0-2 f0-2)))) + (set! (-> v1-9 w) (sqrtf (- (- (- 1.0 (square f2-0)) (square f1-3)) (square f0-2)))) ) (matrix-u-f-compose s3-0 *y-vector* (vector-z-quaternion! (new 'stack-no-clear 'vector) s4-0)) (matrix->quaternion s4-0 s3-0) @@ -760,7 +760,7 @@ (set! (-> v1-46 x) f0-17) (set! (-> v1-46 y) f1-7) (set! (-> v1-46 z) f2-3) - (set! (-> v1-46 w) (sqrtf (- (- (- 1.0 (* f2-3 f2-3)) (* f1-7 f1-7)) (* f0-17 f0-17)))) + (set! (-> v1-46 w) (sqrtf (- (- (- 1.0 (square f2-3)) (square f1-7)) (square f0-17)))) ) (matrix-u-f-compose s3-1 *y-vector* (vector-z-quaternion! (new 'stack-no-clear 'vector) s5-1)) (matrix->quaternion s4-3 s3-1) diff --git a/goal_src/jak3/levels/forest/forest-ring-chase.gc b/goal_src/jak3/levels/forest/forest-ring-chase.gc index a600ac5c7c..368c6f1488 100644 --- a/goal_src/jak3/levels/forest/forest-ring-chase.gc +++ b/goal_src/jak3/levels/forest/forest-ring-chase.gc @@ -399,10 +399,7 @@ (set! (-> this path-pos) (path-control-method-26 s5-0 (-> this path-pos) (* f30-1 (seconds-per-frame)))) (let ((s5-1 (get-point-at-percent-along-path! s5-0 (new 'stack-no-clear 'vector) (-> this path-pos) 'interp))) (let ((f0-11 (vector-vector-distance-squared s5-1 (-> this root trans)))) - (when (and (= (-> this path-pos) 1.0) (let ((f1-4 4096.0)) - (< f0-11 (* f1-4 f1-4)) - ) - ) + (when (and (= (-> this path-pos) 1.0) (< f0-11 (square 4096.0))) (send-event (ppointer->process (-> this parent)) 'found-ring) (let ((a1-5 (new 'stack-no-clear 'event-message-block))) (set! (-> a1-5 from) (process->ppointer pp)) @@ -2291,16 +2288,16 @@ ) (defmethod init-actor-group! ((this task-manager-forest-ring-chase)) - (local-vars (sv-16 res-tag)) (let ((a0-2 (entity-by-name "for-ring-chase-manager-1"))) (when a0-2 (set! (-> this ring-manager-entity) a0-2) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-1 (res-lump-data a0-2 'actor-groups pointer :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-1 (res-lump-data a0-2 'actor-groups (pointer actor-group) :tag-ptr (& sv-16))) + ) (cond ((and v1-1 (>= (-> sv-16 elt-count) 0)) (set! (-> this actor-group-count) (the-as int (-> sv-16 elt-count))) - (set! (-> this actor-group) (the-as (pointer actor-group) v1-1)) + (set! (-> this actor-group) v1-1) ) (else (format 0 "ERROR: ~s: entity missing actor-group!~%" (game-task->string (-> this node-info task))) diff --git a/goal_src/jak3/levels/forest/forest-tasks.gc b/goal_src/jak3/levels/forest/forest-tasks.gc index 3664bbb115..49e0b3f11a 100644 --- a/goal_src/jak3/levels/forest/forest-tasks.gc +++ b/goal_src/jak3/levels/forest/forest-tasks.gc @@ -167,16 +167,16 @@ ;; WARN: Return type mismatch object vs none. (defmethod init-actor-group! ((this task-manager-forest-machine)) - (local-vars (sv-16 res-tag)) (let ((a0-2 (entity-by-name "neo-spawner-manager-1"))) (when a0-2 (set! (-> this manager-entity) a0-2) - (set! sv-16 (new 'static 'res-tag)) - (let ((v0-2 (res-lump-data a0-2 'actor-groups pointer :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v0-2 (res-lump-data a0-2 'actor-groups (pointer actor-group) :tag-ptr (& sv-16))) + ) (cond ((and v0-2 (nonzero? (-> sv-16 elt-count))) (set! (-> this actor-group-count) (the-as int (-> sv-16 elt-count))) - (set! (-> this actor-group) (the-as (pointer actor-group) v0-2)) + (set! (-> this actor-group) v0-2) ) (else (format 0 "ERROR: ~s: entity missing actor-group!~%" (game-task->string (-> this node-info task))) @@ -262,7 +262,6 @@ (defstate active (task-manager-forest-machine-resolution) :virtual #t :code (behavior () - (local-vars (sv-16 res-tag)) (set-setting! 'pilot #f 0.0 0) (while *scene-player* (suspend) @@ -292,11 +291,12 @@ ) (suspend-for (seconds 1) ) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-33 (res-lump-data (-> self manager-entity) 'actor-groups pointer :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-33 (res-lump-data (-> self manager-entity) 'actor-groups (pointer actor-group) :tag-ptr (& sv-16))) + ) (cond ((and v1-33 (nonzero? (-> sv-16 elt-count))) - (set! (-> self actor-group) (the-as (pointer actor-group) v1-33)) + (set! (-> self actor-group) v1-33) (set! (-> self actor-group-count) (the-as int (-> sv-16 elt-count))) ) (else diff --git a/goal_src/jak3/levels/forest/neo-spawner.gc b/goal_src/jak3/levels/forest/neo-spawner.gc index 1b2395a18a..a47ff147b7 100644 --- a/goal_src/jak3/levels/forest/neo-spawner.gc +++ b/goal_src/jak3/levels/forest/neo-spawner.gc @@ -163,15 +163,15 @@ (defmethod init-from-entity! ((this neo-spawner-manager) (arg0 entity-actor)) "Set up a newly created process from the entity that created it." - (local-vars (sv-16 res-tag)) (set! (-> this total-spawned) 0) (set! (-> this max-spawned) 0) (set! (-> this suppress-spawn) #f) - (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 actor-group) :tag-ptr (& sv-16))) + ) (cond ((and v1-1 (nonzero? (-> sv-16 elt-count))) - (set! (-> this actor-group) (the-as (pointer actor-group) v1-1)) + (set! (-> this actor-group) v1-1) (set! (-> this actor-group-count) (the-as int (-> sv-16 elt-count))) ) (else @@ -750,7 +750,6 @@ (defmethod init-from-entity! ((this neo-spawner) (arg0 entity-actor)) "Set up a newly created process from the entity that created it." - (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) @@ -788,11 +787,12 @@ (the-as skeleton-group (art-group-get-by-name *level* "skel-neo-spawner" (the-as (pointer level) #f))) (the-as pair 0) ) - (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 actor-group) :tag-ptr (& sv-16))) + ) (cond ((and v1-22 (nonzero? (-> sv-16 elt-count))) - (set! (-> this actor-group) (the-as (pointer actor-group) v1-22)) + (set! (-> this actor-group) v1-22) (set! (-> this actor-group-count) (the-as int (-> sv-16 elt-count))) ) (else diff --git a/goal_src/jak3/levels/glider/glider-manager.gc b/goal_src/jak3/levels/glider/glider-manager.gc index 6dd89d5d41..372896da37 100644 --- a/goal_src/jak3/levels/glider/glider-manager.gc +++ b/goal_src/jak3/levels/glider/glider-manager.gc @@ -919,9 +919,7 @@ (vector-copy! s5-0 (target-pos 0)) (while (< (-> this count) (-> this max-count)) (let ((s3-1 (-> s4-0 (-> this count)))) - (let ((f0-0 8192000.0)) - (b! (< (* f0-0 f0-0) (vector-vector-distance-squared s5-0 (-> s3-1 pos))) cfg-8) - ) + (b! (< (square 8192000.0) (vector-vector-distance-squared s5-0 (-> s3-1 pos))) cfg-8) (if (glider-ring-spawn this s3-1 (-> this count) #f) (+! (-> this count) 1) ) @@ -1151,9 +1149,7 @@ (when (and *target* (focus-test? *target* pilot)) (let ((v1-8 (as-type (handle->process (-> *target* pilot vehicle)) hvehicle))) 0.0 - (let* ((f0-1 81920000.0) - (f30-0 (* f0-1 f0-1)) - ) + (let ((f30-0 (square 81920000.0))) (let ((s4-1 (-> arg0 root trans))) (b! (not v1-8) cfg-46 :delay (nop!)) (let ((s2-0 0)) @@ -1312,13 +1308,9 @@ (when (and *target* (focus-test? *target* pilot)) (let ((s5-1 (as-type (handle->process (-> *target* pilot vehicle)) hvehicle))) (when (and s5-1 - (let ((f0-0 - (vector-vector-distance-squared (-> (the-as hvehicle s5-1) rbody matrix trans) *desert-glide-finish-sphere*) - ) - (f1-0 (-> *desert-glide-finish-sphere* r)) - ) - (< f0-0 (* f1-0 f1-0)) - ) + (< (vector-vector-distance-squared (-> (the-as hvehicle s5-1) rbody matrix trans) *desert-glide-finish-sphere*) + (square (-> *desert-glide-finish-sphere* r)) + ) ) (if (not (-> this editing?)) (send-event this 'complete) @@ -1338,13 +1330,9 @@ ) (when (and s5-1 (not (-> this did-want-load?)) - (let ((f0-1 - (vector-vector-distance-squared (-> (the-as hvehicle s5-1) rbody matrix trans) *desert-glide-finish-sphere*) - ) - (f1-4 (+ 1228800.0 (-> *desert-glide-finish-sphere* r))) - ) - (< f0-1 (* f1-4 f1-4)) - ) + (< (vector-vector-distance-squared (-> (the-as hvehicle s5-1) rbody matrix trans) *desert-glide-finish-sphere*) + (square (+ 1228800.0 (-> *desert-glide-finish-sphere* r))) + ) ) (let ((a1-13 (new 'stack-no-clear 'array 'symbol 10))) (set! (-> a1-13 9) #f) @@ -1413,16 +1401,16 @@ ) (defmethod task-manager-desert-glide-method-33 ((this task-manager-desert-glide)) - (local-vars (sv-16 res-tag)) (let ((a0-2 (entity-by-name "desert-glide-manager-1"))) (when a0-2 (set! (-> this desert-glide-entity) a0-2) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-2 (res-lump-data a0-2 'actor-groups pointer :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-2 (res-lump-data a0-2 'actor-groups (pointer actor-group) :tag-ptr (& sv-16))) + ) (cond ((and v1-2 (nonzero? (-> sv-16 elt-count))) (set! (-> this actor-group-count) (the-as int (-> sv-16 elt-count))) - (set! (-> this actor-group) (the-as (pointer actor-group) v1-2)) + (set! (-> this actor-group) v1-2) ) (else ) diff --git a/goal_src/jak3/levels/glider/glider-ring.gc b/goal_src/jak3/levels/glider/glider-ring.gc index 711f5ac063..c03de17a21 100644 --- a/goal_src/jak3/levels/glider/glider-ring.gc +++ b/goal_src/jak3/levels/glider/glider-ring.gc @@ -275,14 +275,15 @@ (set! (-> s4-1 1 w) 1.0) (let ((f30-0 (vector4-dot (-> self plane) (-> s4-1 0))) (f28-0 (vector4-dot (-> self plane) (-> s4-1 1))) - (f0-6 (fmax - (vector-vector-distance-squared (-> self root trans) (-> s4-1 0)) - (vector-vector-distance-squared (-> self root trans) (-> s4-1 1)) - ) - ) - (f1-0 61440.0) ) - (when (and (< f0-6 (* f1-0 f1-0)) (or (not (-> self shootable)) (-> self shot))) + (when (and (< (fmax + (vector-vector-distance-squared (-> self root trans) (-> s4-1 0)) + (vector-vector-distance-squared (-> self root trans) (-> s4-1 1)) + ) + (square 61440.0) + ) + (or (not (-> self shootable)) (-> self shot)) + ) (when (or (and (< f30-0 0.0) (>= f28-0 0.0)) (and (< f28-0 0.0) (>= f30-0 0.0))) (if (-> self lastring) (sound-play "ring-final") @@ -657,16 +658,14 @@ ;; WARN: Return type mismatch process vs glider-ring. (defun glider-ring-spawn ((arg0 process) (arg1 glider-ring-info) (arg2 int) (arg3 symbol)) - (local-vars (sv-16 type) (sv-32 int)) (let ((gp-0 (the-as process #f))) (let* ((s1-0 *default-dead-pool*) (s0-0 (method-of-object s1-0 get-process)) + (sv-16 glider-ring) ) - (set! sv-16 glider-ring) - (set! sv-32 5) - (let* ((a2-1 (+ (* 0 (estimate-light-trail-mem-usage (the-as uint 12) (the-as uint #f))) #x4000)) - (a3-1 1) - (s1-1 (s0-0 s1-0 sv-16 a2-1 a3-1)) + (let ((sv-32 5)) + ) + (let* ((s1-1 (s0-0 s1-0 sv-16 (+ (* 0 (estimate-light-trail-mem-usage (the-as uint 12) (the-as uint #f))) #x4000) 1)) (v1-4 (when s1-1 (let ((t9-2 (method-of-type glider-ring activate))) (t9-2 (the-as glider-ring s1-1) arg0 "glider-ring" (the-as pointer #x70004000)) diff --git a/goal_src/jak3/levels/glider/h-glider.gc b/goal_src/jak3/levels/glider/h-glider.gc index dbe6e0148f..73f4d33ec0 100644 --- a/goal_src/jak3/levels/glider/h-glider.gc +++ b/goal_src/jak3/levels/glider/h-glider.gc @@ -636,14 +636,7 @@ ) (when (logtest? (-> this info flags) 1) (vector-float*! (-> arg1 tmp) (-> arg1 mat uvec) -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)) @@ -1249,20 +1242,14 @@ (defmethod vehicle-method-94 ((this h-glider)) (cond (#f - (let ((f0-0 (vector-length-squared (-> this root transv))) - (f1-0 122880.0) - ) - (if (< f0-0 (* f1-0 f1-0)) - (vehicle-method-87 this) - ) - ) + (if (< (vector-length-squared (-> this root transv)) (square 122880.0)) + (vehicle-method-87 this) + ) ) (else - (let ((f0-1 143360.0)) - (if (< (* f0-1 f0-1) (vector-length-squared (-> this root transv))) - (vehicle-method-86 this) - ) - ) + (if (< (square 143360.0) (vector-length-squared (-> this root transv))) + (vehicle-method-86 this) + ) ) ) ((method-of-type vehicle vehicle-method-94) this) diff --git a/goal_src/jak3/levels/gungame/gun-dummy.gc b/goal_src/jak3/levels/gungame/gun-dummy.gc index b6e6e35ea6..abec3c54f3 100644 --- a/goal_src/jak3/levels/gungame/gun-dummy.gc +++ b/goal_src/jak3/levels/gungame/gun-dummy.gc @@ -369,7 +369,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/goal_src/jak3/levels/gungame/gungame-manager.gc b/goal_src/jak3/levels/gungame/gungame-manager.gc index d1793dcc61..1fdbf8cd5a 100644 --- a/goal_src/jak3/levels/gungame/gungame-manager.gc +++ b/goal_src/jak3/levels/gungame/gungame-manager.gc @@ -213,12 +213,12 @@ ) (defmethod init-actor-group ((this gungame-manager) (arg0 entity)) - (local-vars (sv-16 res-tag)) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-1 (res-lump-data arg0 'actor-groups pointer :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-1 (res-lump-data arg0 'actor-groups (pointer actor-group) :tag-ptr (& sv-16))) + ) (cond ((and v1-1 (nonzero? (-> sv-16 elt-count))) - (set! (-> this actor-group) (the-as (pointer actor-group) v1-1)) + (set! (-> this actor-group) v1-1) (let ((v0-1 (the-as object (-> sv-16 elt-count)))) (set! (-> this actor-group-count) (the-as int v0-1)) v0-1 @@ -234,12 +234,12 @@ ) (defmethod init-actor-group ((this gungame-task-manager) (arg0 entity)) - (local-vars (sv-16 res-tag)) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-1 (res-lump-data arg0 'actor-groups pointer :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-1 (res-lump-data arg0 'actor-groups (pointer actor-group) :tag-ptr (& sv-16))) + ) (cond ((and v1-1 (nonzero? (-> sv-16 elt-count))) - (set! (-> this actor-group) (the-as (pointer actor-group) v1-1)) + (set! (-> this actor-group) v1-1) (let ((v0-1 (the-as object (-> sv-16 elt-count)))) (set! (-> this actor-group-count) (the-as int v0-1)) v0-1 diff --git a/goal_src/jak3/levels/hiphog/hiphog-part.gc b/goal_src/jak3/levels/hiphog/hiphog-part.gc index ded478086a..bae89d9a6a 100644 --- a/goal_src/jak3/levels/hiphog/hiphog-part.gc +++ b/goal_src/jak3/levels/hiphog/hiphog-part.gc @@ -641,7 +641,7 @@ (let ((v1-1 (-> arg4 sprite key))) (when (nonzero? v1-1) (let ((f0-2 (+ (- 5120.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/goal_src/jak3/levels/mhcity/destroy-dark-eco.gc b/goal_src/jak3/levels/mhcity/destroy-dark-eco.gc index f05e55531e..b7e572409c 100644 --- a/goal_src/jak3/levels/mhcity/destroy-dark-eco.gc +++ b/goal_src/jak3/levels/mhcity/destroy-dark-eco.gc @@ -289,83 +289,79 @@ (arg5 time-frame) (arg6 float) ) - (local-vars - (sv-640 (pointer lightning-tracker)) - (sv-656 float) - (sv-672 matrix) - (sv-688 collide-query) - (sv-704 symbol) - (sv-720 vector) - (sv-736 int) - (sv-752 process) - (sv-768 vector) - ) - (set! sv-656 arg6) - (let ((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)) - (set! sv-768 (new 'stack-no-clear 'vector)) - (vector-copy! (-> sv-688 start-pos) arg1) - (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-656) - (let ((v1-19 sv-688)) - (set! (-> v1-19 radius) 409.6) - (set! (-> v1-19 collide-with) (collide-spec backgnd crate obstacle hit-by-others-list pusher)) - (set! (-> v1-19 ignore-process0) arg0) - (set! (-> v1-19 ignore-process1) #f) - (set! (-> v1-19 ignore-pat) - (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) - ) - (set! (-> v1-19 action-mask) (collide-action solid)) + (let ((sv-656 arg6) + (s5-0 *lightning-probe-vars*) + (sv-672 (new 'stack-no-clear 'matrix)) + (sv-688 (new 'stack-no-clear 'collide-query)) + (sv-704 (the-as symbol #f)) + (sv-768 (new 'stack-no-clear 'vector)) ) - (when (>= (fill-and-probe-using-line-sphere *collide-cache* sv-688) 0.0) - (set-time! (-> s5-0 last-valid-time)) - (vector-copy! sv-768 (-> sv-688 best-other-tri intersect)) - (when (< 16384.0 (vector-vector-distance sv-768 (-> sv-688 start-pos))) - (set! sv-704 #t) - (goto cfg-7) + (vector-copy! (-> sv-688 start-pos) arg1) + (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-656) + (let ((v1-19 sv-688)) + (set! (-> v1-19 radius) 409.6) + (set! (-> v1-19 collide-with) (collide-spec backgnd crate obstacle hit-by-others-list pusher)) + (set! (-> v1-19 ignore-process0) arg0) + (set! (-> v1-19 ignore-process1) #f) + (set! (-> v1-19 ignore-pat) + (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) + ) + (set! (-> v1-19 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)) + (vector-copy! sv-768 (-> sv-688 best-other-tri intersect)) + (when (< 16384.0 (vector-vector-distance sv-768 (-> sv-688 start-pos))) + (set! sv-704 #t) + (goto cfg-7) + ) ) ) ) (label cfg-7) (when sv-704 - (set! sv-752 (get-process *default-dead-pool* lightning-tracker #x4000 0)) - (set! sv-640 - (the-as - (pointer lightning-tracker) - (when sv-752 - (let ((t9-9 (method-of-type lightning-tracker activate))) - (t9-9 (the-as lightning-tracker sv-752) arg0 "lightning-tracker" (the-as pointer #x70004000)) + (let* ((sv-752 (get-process *default-dead-pool* lightning-tracker #x4000 0)) + (sv-640 (the-as + (pointer lightning-tracker) + (when sv-752 + ((method-of-type lightning-tracker activate) + (the-as lightning-tracker sv-752) + arg0 + "lightning-tracker" + (the-as pointer #x70004000) + ) + (run-now-in-process sv-752 lightning-tracker-init arg2 arg5 arg3 arg0 arg1 sv-768) + (-> sv-752 ppointer) + ) + ) + ) + ) + (when sv-640 + (set! (-> sv-640 0 user-time 0) 0) + (when arg4 + (let ((v1-47 (get-field-spec-by-id arg4 (sp-field-id spt-timer)))) + (if v1-47 + (set! (-> v1-47 initial-valuef) (the-as float (-> sv-640 0 duration))) ) - (run-now-in-process sv-752 lightning-tracker-init arg2 arg5 arg3 arg0 arg1 sv-768) - (-> sv-752 ppointer) - ) ) - ) - (when sv-640 - (set! (-> sv-640 0 user-time 0) 0) - (when arg4 - (let ((v1-47 (get-field-spec-by-id arg4 (sp-field-id spt-timer)))) - (if v1-47 - (set! (-> v1-47 initial-valuef) (the-as float (-> sv-640 0 duration))) - ) - ) - (let ((t9-12 sp-launch-particles-var) - (a0-26 *sp-particle-system-2d*) - (a2-5 *launch-matrix*) - ) - (vector-copy! (-> a2-5 trans) (-> s5-0 end-pos)) - (t9-12 a0-26 arg4 a2-5 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0) + (let ((t9-12 sp-launch-particles-var) + (a0-26 *sp-particle-system-2d*) + (a2-5 *launch-matrix*) + ) + (vector-copy! (-> a2-5 trans) (-> s5-0 end-pos)) + (t9-12 a0-26 arg4 a2-5 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0) + ) ) ) ) @@ -982,12 +978,12 @@ (defmethod set-time-limit ((this task-manager-destroy-darkeco)) - (local-vars (sv-16 res-tag)) (let ((a0-2 (entity-by-name "tmanager-7"))) (when a0-2 (set! (-> this entity) (the-as entity-actor a0-2)) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-2 (res-lump-data a0-2 'actor-groups pointer :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-2 (res-lump-data a0-2 'actor-groups pointer :tag-ptr (& sv-16))) + ) (cond ((and v1-2 (nonzero? (-> sv-16 elt-count))) (set! (-> this actor-group-count) (the-as int (-> sv-16 elt-count))) diff --git a/goal_src/jak3/levels/mhcity/mhcity-obs2.gc b/goal_src/jak3/levels/mhcity/mhcity-obs2.gc index 7d3be507e1..b77fe44d60 100644 --- a/goal_src/jak3/levels/mhcity/mhcity-obs2.gc +++ b/goal_src/jak3/levels/mhcity/mhcity-obs2.gc @@ -178,11 +178,9 @@ 0.0 0.0 (let ((f0-7 (vector-dot s5-2 v1-19))) - (when (and (< f0-7 32768.0) (>= f0-7 0.0)) - (let ((f1-4 (vector-length s5-2))) - (< (sqrtf (- (* f1-4 f1-4) (* f0-7 f0-7))) 8192.0) + (if (and (< f0-7 32768.0) (>= f0-7 0.0)) + (< (sqrtf (- (square (vector-length s5-2)) (square f0-7))) 8192.0) ) - ) ) ) ) diff --git a/goal_src/jak3/levels/mine/gekko.gc b/goal_src/jak3/levels/mine/gekko.gc index bf9b351db8..76889dfda2 100644 --- a/goal_src/jak3/levels/mine/gekko.gc +++ b/goal_src/jak3/levels/mine/gekko.gc @@ -1278,12 +1278,8 @@ (until (or (>= gp-0 3) (and (logtest? (-> s4-0 status) (collide-status on-ground)) (>= 16384.0 (-> s4-0 transv y))) (and (>= s5-0 3) - (let ((f0-7 40.96)) - (>= (* f0-7 f0-7) (vector-vector-distance-squared (-> s4-0 trans-old) (-> s4-0 trans-old-old))) - ) - (let ((f0-10 40.96)) - (>= (* f0-10 f0-10) (vector-vector-distance-squared (-> s4-0 trans-old-old) (-> s4-0 trans-old-old-old))) - ) + (>= (square 40.96) (vector-vector-distance-squared (-> s4-0 trans-old) (-> s4-0 trans-old-old))) + (>= (square 40.96) (vector-vector-distance-squared (-> s4-0 trans-old-old) (-> s4-0 trans-old-old-old))) ) ) (if (time-elapsed? (-> self state-time) (seconds 2)) @@ -1974,24 +1970,6 @@ ) (defun gekko-postbind ((arg0 draw-control) (arg1 cspace-array)) - (local-vars - (sv-560 float) - (sv-640 vector) - (sv-688 float) - (sv-692 vector) - (sv-696 vector) - (sv-976 cspace) - (sv-980 gekko-foot-info) - (sv-984 vector) - (sv-988 vector) - (sv-992 (function vector vector vector vector float)) - (sv-1008 vector) - (sv-1024 vector) - (sv-1040 vector) - (sv-1056 joint-mod-ik) - (sv-1072 vector) - (sv-1088 vector) - ) (rlet ((acc :class vf) (vf0 :class vf) (vf1 :class vf) @@ -2006,8 +1984,8 @@ (let ((s3-0 (-> gp-0 root))) (let ((s2-0 (new 'stack-no-clear 'collide-query)) (f30-0 (-> gp-0 probe-len)) + (sv-560 (the-as float 2048.0)) ) - (set! sv-560 (the-as float 2048.0)) (quaternion->matrix (-> gp-0 rot-matrix) (-> gp-0 root quat)) (let ((v1-2 1) (a0-2 (new 'stack-no-clear 'inline-array 'vector 1)) @@ -2029,106 +2007,107 @@ ) (fill-using-spheres *collide-cache* s2-0) (dotimes (s1-0 4) - (let ((s0-0 (-> gp-0 foot s1-0))) - (set! sv-1056 (-> s0-0 leg-ik)) - (set! sv-1008 - (vector<-cspace! (new 'stack-no-clear 'vector) (-> arg1 data (-> *gekko-ik-setup* s1-0 hand-index))) - ) - (let ((v0-3 - (vector<-cspace! (new 'stack-no-clear 'vector) (-> arg1 data (-> *gekko-ik-setup* s1-0 effector-index))) - ) - ) - (set! sv-640 (vector-! (new 'stack-no-clear 'vector) v0-3 sv-1008)) - ) - (let ((v1-28 (if (logtest? (-> gp-0 flags) (gekko-flag on-wall?)) - (-> gp-0 rot-matrix uvec) - *y-vector* - ) - ) - ) - (vector+float*! (-> s2-0 start-pos) sv-1008 v1-28 (/ f30-0 2)) - (vector-float*! (-> s2-0 move-dist) v1-28 (- f30-0)) - ) - (let ((v1-29 s2-0)) - (set! (-> v1-29 radius) sv-560) - (set! (-> v1-29 collide-with) (collide-spec backgnd)) - (set! (-> v1-29 ignore-process0) #f) - (set! (-> v1-29 ignore-process1) #f) - (set! (-> v1-29 ignore-pat) (-> gp-0 root pat-ignore-mask)) - (set! (-> v1-29 action-mask) (collide-action solid)) - ) - (set! sv-688 (probe-using-line-sphere *collide-cache* s2-0)) - (set! sv-692 (new 'stack-no-clear 'vector)) - (set! sv-696 (new 'stack-no-clear 'vector)) - (cond - ((>= sv-688 0.0) - (let ((v0-5 (vector-normalize-copy! (new 'stack-no-clear 'vector) (-> s2-0 move-dist) 1.0))) - (vector+float*! sv-692 (-> s2-0 start-pos) (-> s2-0 move-dist) sv-688) - (vector-! sv-696 sv-692 (-> s2-0 best-other-tri intersect)) - (vector+float*! sv-692 sv-692 v0-5 (-> s2-0 radius)) + (let* ((s0-0 (-> gp-0 foot s1-0)) + (sv-1056 (-> s0-0 leg-ik)) ) - (vector-normalize! sv-696 1.0) - ) - (else - (vector-copy! sv-692 sv-1008) - (set! (-> sv-692 y) (-> gp-0 root gspot-pos y)) - (vector-copy! sv-696 (-> gp-0 rot-matrix uvec)) - ) - ) - (if (logtest? (-> gp-0 flags) (gekko-flag on-wall?)) - (vector-copy! (-> s0-0 ground-normal) sv-696) - (vector-copy! (-> s0-0 ground-normal) *y-vector*) - ) - (when (logtest? (-> gp-0 flags) (gekko-flag update-foot-position?)) - (set! sv-992 intersect-ray-plane) - (let* ((a1-22 (vector-negate! (new 'stack-no-clear 'vector) (-> gp-0 rot-matrix uvec))) - (a2-4 (-> gp-0 root trans)) - (a3-1 (-> gp-0 rot-matrix uvec)) - (f0-13 (sv-992 sv-1008 a1-22 a2-4 a3-1)) + (let* ((sv-1008 (vector<-cspace! (new 'stack-no-clear 'vector) (-> arg1 data (-> *gekko-ik-setup* s1-0 hand-index)))) + (v0-3 + (vector<-cspace! (new 'stack-no-clear 'vector) (-> arg1 data (-> *gekko-ik-setup* s1-0 effector-index))) ) - (vector+float*! sv-692 sv-692 (-> s0-0 ground-normal) f0-13) - ) - (vector+! sv-692 sv-692 sv-640) - ) - 0.0 - (let ((f28-0 (* 2457.6 (-> gp-0 scale))) - (v0-9 (vector<-cspace! (new 'stack-no-clear 'vector) (-> gp-0 node-list data 3))) - ) - (set! sv-1024 (new 'stack-no-clear 'vector)) - (set! sv-1040 (new 'stack-no-clear 'vector)) - (vector+float*! v0-9 v0-9 (-> gp-0 rot-matrix uvec) 3072.0) - (let ((f28-1 (+ 3072.0 f28-0))) - (when (< (vector-line-distance-point! - sv-692 - v0-9 - (vector+! (new 'stack-no-clear 'vector) v0-9 (-> gp-0 rot-matrix fvec)) - sv-1024 + (sv-640 (vector-! (new 'stack-no-clear 'vector) v0-3 sv-1008)) + ) + (let ((v1-28 (if (logtest? (-> gp-0 flags) (gekko-flag on-wall?)) + (-> gp-0 rot-matrix uvec) + *y-vector* + ) ) - f28-1 - ) - (vector-! sv-1040 sv-692 sv-1024) - (vector-normalize! sv-1040 f28-1) - (let ((v1-64 sv-692)) - (.mov.vf.w vf6 vf0) - (.lvf vf4 (&-> sv-1024 quad)) - (.lvf vf5 (&-> sv-1040 quad)) - (.add.vf.xyz vf6 vf4 vf5) - (.svf (&-> v1-64 quad) vf6) ) - 0 + (vector+float*! (-> s2-0 start-pos) sv-1008 v1-28 (/ f30-0 2)) + (vector-float*! (-> s2-0 move-dist) v1-28 (- f30-0)) + ) + (let ((v1-29 s2-0)) + (set! (-> v1-29 radius) sv-560) + (set! (-> v1-29 collide-with) (collide-spec backgnd)) + (set! (-> v1-29 ignore-process0) #f) + (set! (-> v1-29 ignore-process1) #f) + (set! (-> v1-29 ignore-pat) (-> gp-0 root pat-ignore-mask)) + (set! (-> v1-29 action-mask) (collide-action solid)) + ) + (let ((sv-688 (probe-using-line-sphere *collide-cache* s2-0)) + (sv-692 (new 'stack-no-clear 'vector)) + ) + (let ((sv-696 (new 'stack-no-clear 'vector))) + (cond + ((>= sv-688 0.0) + (let ((v0-5 (vector-normalize-copy! (new 'stack-no-clear 'vector) (-> s2-0 move-dist) 1.0))) + (vector+float*! sv-692 (-> s2-0 start-pos) (-> s2-0 move-dist) sv-688) + (vector-! sv-696 sv-692 (-> s2-0 best-other-tri intersect)) + (vector+float*! sv-692 sv-692 v0-5 (-> s2-0 radius)) + ) + (vector-normalize! sv-696 1.0) + ) + (else + (vector-copy! sv-692 sv-1008) + (set! (-> sv-692 y) (-> gp-0 root gspot-pos y)) + (vector-copy! sv-696 (-> gp-0 rot-matrix uvec)) + ) + ) + (if (logtest? (-> gp-0 flags) (gekko-flag on-wall?)) + (vector-copy! (-> s0-0 ground-normal) sv-696) + (vector-copy! (-> s0-0 ground-normal) *y-vector*) + ) + ) + (when (logtest? (-> gp-0 flags) (gekko-flag update-foot-position?)) + (let ((f0-13 + (intersect-ray-plane + sv-1008 + (vector-negate! (new 'stack-no-clear 'vector) (-> gp-0 rot-matrix uvec)) + (-> gp-0 root trans) + (-> gp-0 rot-matrix uvec) + ) + ) + ) + (vector+float*! sv-692 sv-692 (-> s0-0 ground-normal) f0-13) + ) + (vector+! sv-692 sv-692 sv-640) + ) + 0.0 + (let ((f28-0 (* 2457.6 (-> gp-0 scale))) + (v0-9 (vector<-cspace! (new 'stack-no-clear 'vector) (-> gp-0 node-list data 3))) + (sv-1024 (new 'stack-no-clear 'vector)) + (sv-1040 (new 'stack-no-clear 'vector)) + ) + (vector+float*! v0-9 v0-9 (-> gp-0 rot-matrix uvec) 3072.0) + (let ((f28-1 (+ 3072.0 f28-0))) + (when (< (vector-line-distance-point! + sv-692 + v0-9 + (vector+! (new 'stack-no-clear 'vector) v0-9 (-> gp-0 rot-matrix fvec)) + sv-1024 + ) + f28-1 + ) + (vector-! sv-1040 sv-692 sv-1024) + (vector-normalize! sv-1040 f28-1) + (let ((v1-64 sv-692)) + (.mov.vf.w vf6 vf0) + (.lvf vf4 (&-> sv-1024 quad)) + (.lvf vf5 (&-> sv-1040 quad)) + (.add.vf.xyz vf6 vf4 vf5) + (.svf (&-> v1-64 quad) vf6) + ) + 0 + ) + ) + ) + (vector-seek! + (-> s0-0 ground-pos) + sv-692 + (* (fmax 61440.0 (* 1.2 (vector-length (-> s3-0 transv)))) (seconds-per-frame)) ) ) ) - (vector-seek! - (-> s0-0 ground-pos) - sv-692 - (* (fmax 61440.0 (* 1.2 (vector-length (-> s3-0 transv)))) (seconds-per-frame)) - ) - (let ((t9-13 (method-of-object sv-1056 set-ik-target!)) - (a1-33 (-> s0-0 ground-pos)) - ) - (t9-13 sv-1056 a1-33) - ) + (set-ik-target! sv-1056 (-> s0-0 ground-pos)) ) ) ) @@ -2139,33 +2118,33 @@ (dotimes (s0-1 4) (vector+! s2-1 s2-1 (-> gp-0 foot s0-1 ground-pos)) (when (> s0-1 0) - (set! sv-1072 - (vector-normalize! - (vector-! (new 'stack-no-clear 'vector) (-> gp-0 foot s0-1 ground-pos) (-> gp-0 foot 0 ground-pos)) - 1.0 + (let ((sv-1072 + (vector-normalize! + (vector-! (new 'stack-no-clear 'vector) (-> gp-0 foot s0-1 ground-pos) (-> gp-0 foot 0 ground-pos)) + 1.0 + ) ) + (sv-1088 (new 'stack-no-clear 'vector)) ) - (set! sv-1088 (new 'stack-no-clear 'vector)) - (let ((v1-83 (-> gp-0 rot-matrix uvec)) - (a0-46 sv-1072) - ) - (.lvf vf1 (&-> v1-83 quad)) - (.lvf vf2 (&-> a0-46 quad)) - ) - (.outer.product.a.vf acc vf1 vf2) - (.outer.product.b.vf vf3 vf2 vf1 acc) - (.svf (&-> sv-1088 quad) vf3) - (vector-normalize! sv-1088 1.0) - (let ((a1-41 s1-1) - (v1-85 s1-1) - (a0-48 (new 'stack-no-clear 'vector)) - ) - (.lvf vf1 (&-> sv-1072 quad)) - (.lvf vf2 (&-> sv-1088 quad)) + (let ((a0-46 sv-1072)) + (.lvf vf1 (&-> (-> gp-0 rot-matrix uvec) quad)) + (.lvf vf2 (&-> a0-46 quad)) + ) (.outer.product.a.vf acc vf1 vf2) (.outer.product.b.vf vf3 vf2 vf1 acc) - (.svf (&-> a0-48 quad) vf3) - (vector+! a1-41 v1-85 a0-48) + (.svf (&-> sv-1088 quad) vf3) + (vector-normalize! sv-1088 1.0) + (let ((a1-41 s1-1) + (v1-85 s1-1) + (a0-48 (new 'stack-no-clear 'vector)) + ) + (.lvf vf1 (&-> sv-1072 quad)) + (.lvf vf2 (&-> sv-1088 quad)) + (.outer.product.a.vf acc vf1 vf2) + (.outer.product.b.vf vf3 vf2 vf1 acc) + (.svf (&-> a0-48 quad) vf3) + (vector+! a1-41 v1-85 a0-48) + ) ) ) ) @@ -2203,21 +2182,23 @@ ) ) (dotimes (s3-1 4) - (set! sv-976 (-> arg1 data (-> *gekko-ik-setup* s3-1 effector-index))) - (set! sv-980 (the-as gekko-foot-info (+ (the-as uint (-> gp-0 foot 0 foot-transform)) (* 96 s3-1)))) - (set! sv-984 (new 'stack-no-clear 'vector)) - (set! sv-988 (new 'stack-no-clear 'vector)) - (quaternion-from-two-vectors! - (the-as quaternion sv-988) - (-> gp-0 rot-matrix uvec) - (the-as vector (+ (the-as uint (-> gp-0 foot 0 ground-normal)) (* 96 s3-1))) - ) - (vector<-cspace! (-> sv-980 ground-pos) sv-976) - (matrix->quaternion (the-as quaternion sv-984) (-> sv-976 bone transform)) - (quaternion*! - (the-as quaternion (-> sv-980 ground-normal)) - (the-as quaternion sv-988) - (the-as quaternion sv-984) + (let ((sv-976 (-> arg1 data (-> *gekko-ik-setup* s3-1 effector-index))) + (sv-980 (the-as gekko-foot-info (+ (the-as uint (-> gp-0 foot 0 foot-transform)) (* 96 s3-1)))) + (sv-984 (new 'stack-no-clear 'vector)) + (sv-988 (new 'stack-no-clear 'vector)) + ) + (quaternion-from-two-vectors! + (the-as quaternion sv-988) + (-> gp-0 rot-matrix uvec) + (the-as vector (+ (the-as uint (-> gp-0 foot 0 ground-normal)) (* 96 s3-1))) + ) + (vector<-cspace! (-> sv-980 ground-pos) sv-976) + (matrix->quaternion (the-as quaternion sv-984) (-> sv-976 bone transform)) + (quaternion*! + (the-as quaternion (-> sv-980 ground-normal)) + (the-as quaternion sv-988) + (the-as quaternion sv-984) + ) ) ) (logclear! (-> gp-0 skel status) (joint-control-status no-joint-callbacks)) @@ -2299,14 +2280,13 @@ (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 (if (logtest? (-> this flags) (gekko-flag on-wall?)) - (-> this enemy-info notice-nav-radius) - 8192.0 - ) - ) - (f0-2 f30-0) - ) - (or (>= (* f0-2 f0-2) (vector-vector-xz-distance-squared (-> v1-4 trans) arg1)) + (let ((f30-0 (if (logtest? (-> this flags) (gekko-flag on-wall?)) + (-> this enemy-info notice-nav-radius) + 8192.0 + ) + ) + ) + (or (>= (square f30-0) (vector-vector-xz-distance-squared (-> v1-4 trans) arg1)) (is-in-mesh? (-> this nav) arg1 f30-0) ) ) @@ -2329,9 +2309,7 @@ ) (else (if (or (not (closest-point-on-mesh (-> this nav) s5-0 (-> gp-0 trans) (-> s3-0 current-poly))) - (let ((f0-0 16384.0)) - (< (* f0-0 f0-0) (vector-vector-xz-distance-squared s5-0 (-> gp-0 trans))) - ) + (< (square 16384.0) (vector-vector-xz-distance-squared s5-0 (-> gp-0 trans))) (and (and (-> this next-state) (= (-> this next-state name) 'knocked-recover)) (< (-> gp-0 trans y) (+ -8192.0 (-> s5-0 y))) (< (+ 12288.0 (-> s5-0 y)) (-> gp-0 trans y)) @@ -2538,84 +2516,77 @@ (f30-0 0.0) ) (let ((v1-2 (-> this incoming knocked-type))) - (set! f30-0 (cond - ((= v1-2 (knocked-type explode-or-darkjak)) - (let ((f30-1 (rnd-float-range this 0.0 1.0))) - (set! f28-0 (lerp (-> s4-0 knocked-hard-vxz-lo) (-> s4-0 knocked-hard-vxz-hi) f30-1)) - (lerp (-> s4-0 knocked-hard-vy-lo) (-> s4-0 knocked-hard-vy-hi) f30-1) - ) + (set! f30-0 + (cond + ((= v1-2 (knocked-type explode-or-darkjak)) + (let ((f30-1 (rnd-float-range this 0.0 1.0))) + (set! f28-0 (lerp (-> s4-0 knocked-hard-vxz-lo) (-> s4-0 knocked-hard-vxz-hi) f30-1)) + (lerp (-> s4-0 knocked-hard-vy-lo) (-> s4-0 knocked-hard-vy-hi) f30-1) + ) + ) + ((= v1-2 (knocked-type mech-punch)) + (let ((f30-2 (rnd-float-range this 0.0 1.0))) + (set! f28-0 (lerp (-> s4-0 knocked-medium-vxz-lo) (-> s4-0 knocked-medium-vxz-hi) f30-2)) + (lerp (-> s4-0 knocked-medium-vy-lo) (-> s4-0 knocked-medium-vy-hi) f30-2) + ) + ) + ((= v1-2 (knocked-type dark-shot)) + (let ((f30-3 (rnd-float-range this 0.0 1.0))) + (set! f28-0 (lerp (-> s4-0 knocked-huge-vxz-lo) (-> s4-0 knocked-huge-vxz-hi) f30-3)) + (lerp (-> s4-0 knocked-huge-vy-lo) (-> s4-0 knocked-huge-vy-hi) f30-3) + ) + ) + ((= v1-2 (knocked-type yellow-shot)) + (vector-rotate90-around-y! arg0 arg0) + (let ((v1-12 (new 'stack-no-clear 'vector))) + (vector-! v1-12 (-> this incoming attacker-pos) (-> this root trans)) + (set! (-> v1-12 y) 0.0) + (if (< 0.0 (vector-dot v1-12 arg0)) + (vector-negate! arg0 arg0) ) - ((= v1-2 (knocked-type mech-punch)) - (let ((f30-2 (rnd-float-range this 0.0 1.0))) - (set! f28-0 (lerp (-> s4-0 knocked-medium-vxz-lo) (-> s4-0 knocked-medium-vxz-hi) f30-2)) - (lerp (-> s4-0 knocked-medium-vy-lo) (-> s4-0 knocked-medium-vy-hi) f30-2) - ) - ) - ((= v1-2 (knocked-type dark-shot)) - (let ((f30-3 (rnd-float-range this 0.0 1.0))) - (set! f28-0 (lerp (-> s4-0 knocked-huge-vxz-lo) (-> s4-0 knocked-huge-vxz-hi) f30-3)) - (lerp (-> s4-0 knocked-huge-vy-lo) (-> s4-0 knocked-huge-vy-hi) f30-3) - ) - ) - ((= v1-2 (knocked-type yellow-shot)) - (vector-rotate90-around-y! arg0 arg0) - (let ((v1-12 (new 'stack-no-clear 'vector))) - (vector-! v1-12 (-> this incoming attacker-pos) (-> this root trans)) - (set! (-> v1-12 y) 0.0) - (if (< 0.0 (vector-dot v1-12 arg0)) - (vector-negate! arg0 arg0) - ) - ) - (let ((f30-4 (rnd-float-range this 0.0 1.0))) - (set! f28-0 (lerp (-> s4-0 knocked-yellow-vxz-lo) (-> s4-0 knocked-yellow-vxz-hi) f30-4)) - (lerp (-> s4-0 knocked-yellow-vy-lo) (-> s4-0 knocked-yellow-vy-hi) f30-4) - ) - ) - ((= v1-2 (knocked-type red-shot)) - (let* ((f1-2 (vector-vector-xz-distance-squared (target-pos 0) (-> this root trans))) - (f0-18 1.0) - (f2-0 61440.0) - (f1-3 (fmin f1-2 (* f2-0 f2-0))) - (f2-3 61440.0) - (f30-6 (* (- f0-18 (/ f1-3 (* f2-3 f2-3))) (rnd-float-range this 0.8 1.0))) - ) - (set! f28-0 (lerp (-> s4-0 knocked-red-vxz-lo) (-> s4-0 knocked-red-vxz-hi) f30-6)) - (lerp (-> s4-0 knocked-red-vy-lo) (-> s4-0 knocked-red-vy-hi) f30-6) - ) - ) - ((= v1-2 (knocked-type blue-shot)) - (let* ((f1-5 (vector-vector-xz-distance-squared (target-pos 0) (-> this root trans))) - (f0-24 1.0) - (f2-6 122880.0) - (f1-6 (fmin f1-5 (* f2-6 f2-6))) - (f2-9 122880.0) - (f26-0 (* (- f0-24 (/ f1-6 (* f2-9 f2-9))) (rnd-float-range this 0.8 1.0))) - ) - (set! f28-0 (lerp (-> s4-0 knocked-blue-vxz-lo) (-> s4-0 knocked-blue-vxz-hi) f26-0)) - (cond - ((>= (the-as uint 4) (-> this incoming blue-juggle-count)) - (lerp (-> s4-0 knocked-blue-vy-lo) (-> s4-0 knocked-blue-vy-hi) f26-0) - ) - (else - (if (zero? (rnd-int this 3)) - (set! f30-0 40960.0) - ) - f30-0 - ) + ) + (let ((f30-4 (rnd-float-range this 0.0 1.0))) + (set! f28-0 (lerp (-> s4-0 knocked-yellow-vxz-lo) (-> s4-0 knocked-yellow-vxz-hi) f30-4)) + (lerp (-> s4-0 knocked-yellow-vy-lo) (-> s4-0 knocked-yellow-vy-hi) f30-4) + ) + ) + ((= v1-2 (knocked-type red-shot)) + (let* ((f1-2 (vector-vector-xz-distance-squared (target-pos 0) (-> this root trans))) + (f30-6 (* (- 1.0 (/ (fmin f1-2 (square 61440.0)) (square 61440.0))) (rnd-float-range this 0.8 1.0))) + ) + (set! f28-0 (lerp (-> s4-0 knocked-red-vxz-lo) (-> s4-0 knocked-red-vxz-hi) f30-6)) + (lerp (-> s4-0 knocked-red-vy-lo) (-> s4-0 knocked-red-vy-hi) f30-6) + ) + ) + ((= v1-2 (knocked-type blue-shot)) + (let* ((f1-5 (vector-vector-xz-distance-squared (target-pos 0) (-> this root trans))) + (f26-0 (* (- 1.0 (/ (fmin f1-5 (square 122880.0)) (square 122880.0))) (rnd-float-range this 0.8 1.0))) + ) + (set! f28-0 (lerp (-> s4-0 knocked-blue-vxz-lo) (-> s4-0 knocked-blue-vxz-hi) f26-0)) + (cond + ((>= (the-as uint 4) (-> this incoming blue-juggle-count)) + (lerp (-> s4-0 knocked-blue-vy-lo) (-> s4-0 knocked-blue-vy-hi) f26-0) + ) + (else + (if (zero? (rnd-int this 3)) + (set! f30-0 40960.0) ) - ) - ) - ((= v1-2 (knocked-type vehicle)) - (vector-copy! arg0 (-> this incoming attack-direction)) f30-0 ) - (else - (let ((f30-7 (rnd-float-range this 0.0 1.0))) - (set! f28-0 (lerp (-> s4-0 knocked-soft-vxz-lo) (-> s4-0 knocked-soft-vxz-hi) f30-7)) - (lerp (-> s4-0 knocked-soft-vy-lo) (-> s4-0 knocked-soft-vy-hi) f30-7) - ) - ) - ) + ) + ) + ) + ((= v1-2 (knocked-type vehicle)) + (vector-copy! arg0 (-> this incoming attack-direction)) + f30-0 + ) + (else + (let ((f30-7 (rnd-float-range this 0.0 1.0))) + (set! f28-0 (lerp (-> s4-0 knocked-soft-vxz-lo) (-> s4-0 knocked-soft-vxz-hi) f30-7)) + (lerp (-> s4-0 knocked-soft-vy-lo) (-> s4-0 knocked-soft-vy-hi) f30-7) + ) + ) + ) ) ) (vector-float*! arg0 arg0 f28-0) diff --git a/goal_src/jak3/levels/mine/manta.gc b/goal_src/jak3/levels/mine/manta.gc index 0c7e214ee8..18118e1455 100644 --- a/goal_src/jak3/levels/mine/manta.gc +++ b/goal_src/jak3/levels/mine/manta.gc @@ -373,7 +373,7 @@ (set! (-> s5-0 y) 0.0) (set! (-> s5-0 z) 4096.0) (set! (-> s5-0 w) 1.0) - (set-vector! a1-0 (* f0-2 f0-2 f0-2) (* f0-2 f0-2) f0-2 1.0) + (set-vector! a1-0 (* (square f0-2) f0-2) (square f0-2) f0-2 1.0) (set-vector! s3-0 (* 3.0 f0-2 f0-2) (* 2.0 f0-2) 1.0 0.0) (vector-matrix*! a0-4 a1-0 s2-0) (vector-matrix*! s4-0 s3-0 s2-0) @@ -1337,14 +1337,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) (-> s3-0 w))) - ) - (when (< f0-1 (* f1-1 f1-1)) - (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-2 world-sphere w) (-> s3-0 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)) ) ) ) @@ -1378,14 +1374,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) (-> s3-0 w))) - ) - (when (< f0-2 (* f1-5 f1-5)) - (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-14 world-sphere w) (-> s3-0 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)) ) ) ) @@ -1923,7 +1915,6 @@ (defmethod init-enemy! ((this manta)) "Typical place for shared init code. Runs from entity or process style init." - (local-vars (sv-16 res-tag)) (initialize-skeleton this (the-as skeleton-group (art-group-get-by-name *level* "skel-manta" (the-as (pointer level) #f))) @@ -1943,11 +1934,12 @@ (set-vector! (-> v1-13 twist-max) 11832.889 11832.889 0.0 1.0) (set! (-> v1-13 ignore-angle) 30947.555) ) - (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 actor-group) :tag-ptr (& sv-16))) + ) (cond ((and v1-16 (nonzero? (-> sv-16 elt-count))) - (set! (-> this actor-group) (the-as (pointer actor-group) v1-16)) + (set! (-> this actor-group) v1-16) (set! (-> this actor-group-count) (the-as int (-> sv-16 elt-count))) ) (else diff --git a/goal_src/jak3/levels/mine/mine-obs.gc b/goal_src/jak3/levels/mine/mine-obs.gc index 778c400cf4..278e07c822 100644 --- a/goal_src/jak3/levels/mine/mine-obs.gc +++ b/goal_src/jak3/levels/mine/mine-obs.gc @@ -8,14 +8,14 @@ ;; DECOMP BEGINS (defun mineb-activate () - (local-vars (sv-16 res-tag)) (let ((a0-1 (entity-by-name "minb-part-1"))) (when a0-1 (let ((gp-0 (the-as (pointer actor-group) #f)) (s5-0 0) ) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-2 (res-lump-data a0-1 'actor-groups (pointer actor-group) :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-2 (res-lump-data a0-1 'actor-groups (pointer actor-group) :tag-ptr (& sv-16))) + ) (when (and v1-2 (nonzero? (-> sv-16 elt-count))) (set! gp-0 v1-2) (set! s5-0 (the-as int (-> sv-16 elt-count))) @@ -141,12 +141,12 @@ (defmethod init-from-entity! ((this rat-light-manager) (arg0 entity-actor)) "Set up a newly created process from the entity that created it." - (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 actor-group) :tag-ptr (& sv-16))) + ) (cond ((and v1-1 (nonzero? (-> sv-16 elt-count))) - (set! (-> this actor-group) (the-as (pointer actor-group) v1-1)) + (set! (-> this actor-group) v1-1) (set! (-> this actor-group-count) (the-as int (-> sv-16 elt-count))) ) (else @@ -676,7 +676,6 @@ (defmethod init-from-entity! ((this min-rat-engine) (arg0 entity-actor)) "Set up a newly created process from the entity that created it." - (local-vars (sv-16 res-tag)) (min-rat-engine-method-24 this) (process-drawable-from-entity! this arg0) (initialize-skeleton @@ -691,11 +690,12 @@ ) (transform-post) (set! (-> this notify-actor) (entity-actor-lookup (-> this entity) 'alt-actor 0)) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-14 (res-lump-data (-> this entity) 'actor-groups pointer :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-14 (res-lump-data (-> this entity) 'actor-groups (pointer actor-group) :tag-ptr (& sv-16))) + ) (cond ((and v1-14 (nonzero? (-> sv-16 elt-count))) - (set! (-> this actor-group) (the-as (pointer actor-group) v1-14)) + (set! (-> this actor-group) v1-14) (set! (-> this actor-group-count) (the-as int (-> sv-16 elt-count))) ) (else diff --git a/goal_src/jak3/levels/mine/mine-platforms.gc b/goal_src/jak3/levels/mine/mine-platforms.gc index 61b14ca418..78d8485d00 100644 --- a/goal_src/jak3/levels/mine/mine-platforms.gc +++ b/goal_src/jak3/levels/mine/mine-platforms.gc @@ -1085,16 +1085,16 @@ (defmethod init-from-entity! ((this min-falling-step) (arg0 entity-actor)) "Set up a newly created process from the entity that created it." - (local-vars (sv-16 res-tag)) (let ((t9-0 (method-of-type mine-platform-base init-from-entity!))) (t9-0 this arg0) ) (set! (-> this bounce-scale) 204.8) - (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 actor-group) :tag-ptr (& sv-16))) + ) (cond ((and v1-3 (nonzero? (-> sv-16 elt-count))) - (set! (-> this actor-group) (the-as (pointer actor-group) v1-3)) + (set! (-> this actor-group) v1-3) (set! (-> this actor-group-count) (the-as int (-> sv-16 elt-count))) ) (else diff --git a/goal_src/jak3/levels/mine/mine-train.gc b/goal_src/jak3/levels/mine/mine-train.gc index 1f96e3a5fe..9a95886667 100644 --- a/goal_src/jak3/levels/mine/mine-train.gc +++ b/goal_src/jak3/levels/mine/mine-train.gc @@ -382,7 +382,7 @@ (set! f0-10 (-> self suck-level)) (set! f1-1 (* f1-1 f0-10)) ) - (let ((f0-14 (seek (-> self speed) f1-1 (* 7168.0 (seconds-per-frame) (* f0-10 f0-10))))) + (let ((f0-14 (seek (-> self speed) f1-1 (* 7168.0 (seconds-per-frame) (square f0-10))))) (set! (-> self speed) f0-14) (set! (-> self speed) f0-14) ) @@ -799,7 +799,6 @@ (defmethod init-from-entity! ((this min-bomb-train) (arg0 entity-actor)) "Set up a newly created process from the entity that created it." - (local-vars (sv-16 res-tag)) (when (task-node-closed? (game-task-node mine-blow-resolution)) (cleanup-for-death this) (return #f) @@ -855,11 +854,12 @@ (if (nonzero? (-> this path)) (set! (-> this path-length) (total-distance (-> this path))) ) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-44 (res-lump-data (-> this entity) 'actor-groups pointer :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-44 (res-lump-data (-> this entity) 'actor-groups (pointer actor-group) :tag-ptr (& sv-16))) + ) (cond ((and v1-44 (nonzero? (-> sv-16 elt-count))) - (set! (-> this actor-group) (the-as (pointer actor-group) v1-44)) + (set! (-> this actor-group) v1-44) (set! (-> this actor-group-count) (the-as int (-> sv-16 elt-count))) (when (>= (-> this actor-group-count) 3) (let ((s5-1 (-> this actor-group 3 length))) diff --git a/goal_src/jak3/levels/mine/prebot-extras.gc b/goal_src/jak3/levels/mine/prebot-extras.gc index 542a3f1a21..c5a8642c87 100644 --- a/goal_src/jak3/levels/mine/prebot-extras.gc +++ b/goal_src/jak3/levels/mine/prebot-extras.gc @@ -279,7 +279,6 @@ (defmethod init-from-entity! ((this cav-railblocker) (arg0 entity-actor)) "Set up a newly created process from the entity that created it." - (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-sphere s4-0 (the-as uint 0)))) (set! (-> v1-2 prim-core collide-as) (collide-spec enemy)) @@ -310,8 +309,9 @@ (set! (-> this trackable) #t) (set! (-> this notify-on-die) #f) (set! (-> this notify-on-die-2) #f) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-17 (res-lump-data arg0 'actor-groups (pointer actor-group) :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-17 (res-lump-data arg0 'actor-groups (pointer actor-group) :tag-ptr (& sv-16))) + ) (when (and v1-17 (nonzero? (-> sv-16 elt-count))) (let ((v1-18 (-> v1-17 0))) (if (> (-> v1-18 length) 0) @@ -1261,13 +1261,9 @@ (transform-post) ) :trans (behavior () - (let ((f0-0 (vector-vector-distance-squared (-> self root trans) (target-pos 0))) - (f1-0 16384.0) - ) - (if (< f0-0 (* f1-0 f1-0)) - (go-virtual rise) - ) - ) + (if (< (vector-vector-distance-squared (-> self root trans) (target-pos 0)) (square 16384.0)) + (go-virtual rise) + ) ) :code sleep-code ) diff --git a/goal_src/jak3/levels/mine/prebot-states.gc b/goal_src/jak3/levels/mine/prebot-states.gc index d4f5451c1e..50ecd756d8 100644 --- a/goal_src/jak3/levels/mine/prebot-states.gc +++ b/goal_src/jak3/levels/mine/prebot-states.gc @@ -185,7 +185,7 @@ ;; WARN: Return type mismatch int vs object. (defbehavior prebot-go-next-stage prebot () - (local-vars (v1-4 (pointer actor-group)) (sv-16 res-tag)) + (local-vars (v1-4 (pointer actor-group))) (cond ((not (task-node-closed? (game-task-node mine-boss-introduction))) (set! (-> self stage) 0) @@ -196,9 +196,10 @@ ) ((begin (set! (-> self stage) 1) - (set! sv-16 (new 'static 'res-tag)) - (set! v1-4 (res-lump-data (-> self entity) 'actor-groups (pointer actor-group) :tag-ptr (& sv-16))) - (and v1-4 (nonzero? (-> sv-16 elt-count))) + (let ((sv-16 (new 'static 'res-tag))) + (set! v1-4 (res-lump-data (-> self entity) 'actor-groups (pointer actor-group) :tag-ptr (& sv-16))) + (and v1-4 (nonzero? (-> sv-16 elt-count))) + ) ) (let ((v1-5 (-> v1-4 0))) (dotimes (a0-5 (-> v1-5 length)) @@ -1392,13 +1393,9 @@ ) ) (else - (let ((f0-14 (vector-vector-distance-squared (-> self position target) (-> self position value))) - (f1-0 1024.0) - ) - (if (< f0-14 (* f1-0 f1-0)) - (go-virtual launch-critters) - ) - ) + (if (< (vector-vector-distance-squared (-> self position target) (-> self position value)) (square 1024.0)) + (go-virtual launch-critters) + ) (ja :num! (loop!)) ) ) @@ -1571,58 +1568,54 @@ (dotimes (gp-12 2) (send-event (handle->process (-> self swords gp-12)) 'scale #x3ff33333) ) - (let ((f0-46 (vector-vector-distance-squared (-> self position target) (-> self position value))) - (f1-15 1024.0) + (when (< (vector-vector-distance-squared (-> self position target) (-> self position value)) (square 1024.0)) + (dotimes (gp-13 2) + (send-event (handle->process (-> self swords gp-13)) 'scale #x3f800000) + ) + (+! (-> self num-attacks) -1) + (if (<= (-> self num-attacks) 0) + (go-virtual sweep-done) ) - (when (< f0-46 (* f1-15 f1-15)) - (dotimes (gp-13 2) - (send-event (handle->process (-> self swords gp-13)) 'scale #x3f800000) - ) - (+! (-> self num-attacks) -1) - (if (<= (-> self num-attacks) 0) - (go-virtual sweep-done) - ) - (let ((v1-258 (ja-group))) - (cond - ((and v1-258 (= v1-258 prebot-swords-horizontal-R2L-hold-ja)) - (ja-channel-push! 1 (seconds 0.2)) - (ja :group! prebot-swords-horizontal-R2L-return-ja :num! min) - (set! (-> self position target y) (+ -34816.0 (-> self original-position y))) + (let ((v1-258 (ja-group))) + (cond + ((and v1-258 (= v1-258 prebot-swords-horizontal-R2L-hold-ja)) + (ja-channel-push! 1 (seconds 0.2)) + (ja :group! prebot-swords-horizontal-R2L-return-ja :num! min) + (set! (-> self position target y) (+ -34816.0 (-> self original-position y))) + ) + ((let ((v1-270 (ja-group))) + (and v1-270 (= v1-270 prebot-swords-horizontal-L2R-hold-ja)) ) - ((let ((v1-270 (ja-group))) - (and v1-270 (= v1-270 prebot-swords-horizontal-L2R-hold-ja)) - ) - (ja-channel-push! 1 (seconds 0.2)) - (ja :group! prebot-swords-horizontal-L2R-return-ja :num! min) - (set! (-> self position target y) (+ -34816.0 (-> self original-position y))) + (ja-channel-push! 1 (seconds 0.2)) + (ja :group! prebot-swords-horizontal-L2R-return-ja :num! min) + (set! (-> self position target y) (+ -34816.0 (-> self original-position y))) + ) + ((let ((v1-282 (ja-group))) + (and v1-282 (= v1-282 prebot-sword-R-horizontal-R2L-hold-ja)) ) - ((let ((v1-282 (ja-group))) - (and v1-282 (= v1-282 prebot-sword-R-horizontal-R2L-hold-ja)) - ) - (ja-channel-push! 1 (seconds 0.2)) - (ja :group! prebot-sword-R-horizontal-R2L-return-ja :num! min) - (set! (-> self position target y) (+ -36864.0 (-> self original-position y))) + (ja-channel-push! 1 (seconds 0.2)) + (ja :group! prebot-sword-R-horizontal-R2L-return-ja :num! min) + (set! (-> self position target y) (+ -36864.0 (-> self original-position y))) + ) + ((let ((v1-294 (ja-group))) + (and v1-294 (= v1-294 prebot-sword-R-horizontal-L2R-hold-ja)) ) - ((let ((v1-294 (ja-group))) - (and v1-294 (= v1-294 prebot-sword-R-horizontal-L2R-hold-ja)) - ) - (ja-channel-push! 1 (seconds 0.2)) - (ja :group! prebot-sword-R-horizontal-L2R-return-ja :num! min) - (set! (-> self position target y) (+ -36864.0 (-> self original-position y))) - ) - (else - (let ((v1-306 (ja-group))) - (cond - ((and v1-306 (= v1-306 prebot-sword-L-horizontal-R2L-hold-ja)) - (ja-channel-push! 1 (seconds 0.2)) - (ja :group! prebot-sword-L-horizontal-R2L-return-ja :num! min) - (set! (-> self position target y) (+ -36864.0 (-> self original-position y))) - ) - (else - (ja-channel-push! 1 (seconds 0.2)) - (ja :group! prebot-sword-L-horizontal-L2R-return-ja :num! min) - (set! (-> self position target y) (+ -36864.0 (-> self original-position y))) - ) + (ja-channel-push! 1 (seconds 0.2)) + (ja :group! prebot-sword-R-horizontal-L2R-return-ja :num! min) + (set! (-> self position target y) (+ -36864.0 (-> self original-position y))) + ) + (else + (let ((v1-306 (ja-group))) + (cond + ((and v1-306 (= v1-306 prebot-sword-L-horizontal-R2L-hold-ja)) + (ja-channel-push! 1 (seconds 0.2)) + (ja :group! prebot-sword-L-horizontal-R2L-return-ja :num! min) + (set! (-> self position target y) (+ -36864.0 (-> self original-position y))) + ) + (else + (ja-channel-push! 1 (seconds 0.2)) + (ja :group! prebot-sword-L-horizontal-L2R-return-ja :num! min) + (set! (-> self position target y) (+ -36864.0 (-> self original-position y))) ) ) ) @@ -2038,51 +2031,47 @@ ) (ja :num! (seek!)) (when (ja-done? 0) - (let ((f0-18 (vector-vector-distance-squared (-> self position target) (-> self position value))) - (f1-0 1024.0) - ) - (cond - ((< f0-18 (* f1-0 f1-0)) - (let ((v1-124 (ja-group))) - (cond - ((and v1-124 (= v1-124 prebot-swords-vertical-pre-ja)) - (ja-channel-push! 1 (seconds 0.02)) - (ja :group! prebot-swords-R-vertical-strike-ja :num! min) - ) - (else - (let ((v1-134 (ja-group))) - (cond - ((and v1-134 (= v1-134 prebot-sword-R-vertical-pre-ja)) - (ja-channel-push! 1 (seconds 0.02)) - (ja :group! prebot-sword-R-vertical-strike-ja :num! min) - ) - (else - (ja-channel-push! 1 (seconds 0.02)) - (ja :group! prebot-sword-L-vertical-strike-ja :num! min) - ) + (cond + ((< (vector-vector-distance-squared (-> self position target) (-> self position value)) (square 1024.0)) + (let ((v1-124 (ja-group))) + (cond + ((and v1-124 (= v1-124 prebot-swords-vertical-pre-ja)) + (ja-channel-push! 1 (seconds 0.02)) + (ja :group! prebot-swords-R-vertical-strike-ja :num! min) + ) + (else + (let ((v1-134 (ja-group))) + (cond + ((and v1-134 (= v1-134 prebot-sword-R-vertical-pre-ja)) + (ja-channel-push! 1 (seconds 0.02)) + (ja :group! prebot-sword-R-vertical-strike-ja :num! min) + ) + (else + (ja-channel-push! 1 (seconds 0.02)) + (ja :group! prebot-sword-L-vertical-strike-ja :num! min) ) ) ) ) ) ) - ((let ((v1-149 (ja-group))) - (and v1-149 (= v1-149 prebot-swords-vertical-pre-ja)) - ) - (ja-channel-push! 1 (seconds 0.02)) - (ja :group! prebot-swords-vertical-hold-ja :num! min) + ) + ((let ((v1-149 (ja-group))) + (and v1-149 (= v1-149 prebot-swords-vertical-pre-ja)) ) - (else - (let ((v1-159 (ja-group))) - (cond - ((and v1-159 (= v1-159 prebot-sword-R-vertical-pre-ja)) - (ja-channel-push! 1 (seconds 0.02)) - (ja :group! prebot-sword-R-vertical-hold-ja :num! min) - ) - (else - (ja-channel-push! 1 (seconds 0.02)) - (ja :group! prebot-sword-R-vertical-hold-ja :num! min) - ) + (ja-channel-push! 1 (seconds 0.02)) + (ja :group! prebot-swords-vertical-hold-ja :num! min) + ) + (else + (let ((v1-159 (ja-group))) + (cond + ((and v1-159 (= v1-159 prebot-sword-R-vertical-pre-ja)) + (ja-channel-push! 1 (seconds 0.02)) + (ja :group! prebot-sword-R-vertical-hold-ja :num! min) + ) + (else + (ja-channel-push! 1 (seconds 0.02)) + (ja :group! prebot-sword-R-vertical-hold-ja :num! min) ) ) ) @@ -2096,11 +2085,7 @@ (= v1-174 prebot-swords-vertical-hold-ja) ) ) - (let ((f0-25 (vector-vector-distance-squared (-> self position target) (-> self position value))) - (f1-3 1024.0) - ) - (< f0-25 (* f1-3 f1-3)) - ) + (< (vector-vector-distance-squared (-> self position target) (-> self position value)) (square 1024.0)) ) ) (let ((v1-182 (ja-group))) diff --git a/goal_src/jak3/levels/mine/rat.gc b/goal_src/jak3/levels/mine/rat.gc index f8f7c7efb3..ee3da45bc2 100644 --- a/goal_src/jak3/levels/mine/rat.gc +++ b/goal_src/jak3/levels/mine/rat.gc @@ -2025,17 +2025,17 @@ (defmethod init-from-entity! ((this rat-spawner) (arg0 entity-actor)) "Set up a newly created process from the entity that created it." - (local-vars (sv-16 res-tag)) (set! (-> this wheel-entity) (entity-actor-lookup (-> this entity) 'alt-actor 0)) (set! (-> this rats-spawned) (the-as uint 0)) (set! (-> this rats-to-spawn) (res-lump-value (-> this entity) 'extra-id uint :default (the-as uint128 1) :time -1000000000.0) ) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-2 (res-lump-data (-> this entity) 'actor-groups pointer :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-2 (res-lump-data (-> this entity) 'actor-groups (pointer actor-group) :tag-ptr (& sv-16))) + ) (cond ((and v1-2 (nonzero? (-> sv-16 elt-count))) - (set! (-> this actor-group) (the-as (pointer actor-group) v1-2)) + (set! (-> this actor-group) v1-2) (set! (-> this actor-group-count) (the-as int (-> sv-16 elt-count))) ) (else diff --git a/goal_src/jak3/levels/nest/egg-spider.gc b/goal_src/jak3/levels/nest/egg-spider.gc index 1689deaedc..17355f2fc9 100644 --- a/goal_src/jak3/levels/nest/egg-spider.gc +++ b/goal_src/jak3/levels/nest/egg-spider.gc @@ -660,7 +660,6 @@ ;; ERROR: Stack slot load at 32 mismatch: defined as size 4, got size 16 (defmethod event-handler ((this egg-spider) (arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) "Commmon handler for events." - (local-vars (sv-16 float) (sv-32 float)) (case arg2 (('attack) (let ((s1-0 (the-as attack-info (-> arg3 param 1)))) @@ -668,13 +667,7 @@ (when (= (-> s1-0 mode) 'vehicle) (set! (-> this vehicle-attack?) #t) (vector-float*! (-> s1-0 vector) (-> s1-0 vector) 1.0) - (let ((s0-0 lerp)) - (set! sv-16 (the-as float 40960.0)) - (set! sv-32 (the-as float 81920.0)) - (let ((a2-2 (rnd-float-range this 0.0 1.0))) - (set! (-> s1-0 vector y) (s0-0 sv-16 sv-32 a2-2)) - ) - ) + (set! (-> s1-0 vector y) (lerp (the-as float 40960.0) (the-as float 81920.0) (rnd-float-range this 0.0 1.0))) ) ) ((method-of-type nav-enemy event-handler) this arg0 arg1 arg2 arg3) @@ -1438,7 +1431,6 @@ (defmethod check-can-rid ((this spider-manager)) - (local-vars (sv-16 process-tree)) (let ((s2-0 (the-as (pointer process-tree) (-> this child))) (s5-0 0) ) @@ -1447,18 +1439,19 @@ ) (set! (-> this can-rid) (the-as handle #f)) (while s2-0 - (set! sv-16 (as-type (-> s2-0 0) egg-spider)) - (when sv-16 - (when (not (logtest? (-> (the-as egg-spider sv-16) draw status) (draw-control-status on-screen))) - (let ((f0-0 (vector-vector-xz-distance (-> (the-as egg-spider sv-16) root trans) (target-pos 0)))) - (when (< (the float dist) f0-0) - (set! dist f0-0) - (set! (-> this can-rid) (process->handle (the-as process sv-16))) + (let ((sv-16 (as-type (-> s2-0 0) egg-spider))) + (when sv-16 + (when (not (logtest? (-> (the-as egg-spider sv-16) draw status) (draw-control-status on-screen))) + (let ((f0-0 (vector-vector-xz-distance (-> (the-as egg-spider sv-16) root trans) (target-pos 0)))) + (when (< (the float dist) f0-0) + (set! dist f0-0) + (set! (-> this can-rid) (process->handle (the-as process sv-16))) + ) ) + (+! s4-0 1) ) - (+! s4-0 1) + (+! s5-0 1) ) - (+! s5-0 1) ) (set! s2-0 (-> s2-0 0 brother)) ) @@ -1668,7 +1661,6 @@ (defmethod init-from-entity! ((this spider-manager) (arg0 entity-actor)) "Set up a newly created process from the entity that created it." - (local-vars (sv-16 res-tag) (sv-32 res-tag)) (logior! (-> this mask) (process-mask enemy)) (let ((s4-0 (new 'process 'trsqv))) (set! (-> this root) s4-0) @@ -1680,14 +1672,16 @@ (set! (-> this max-spawn-delay) 60) (set! (-> this min-spot-delay) 150) (set! (-> this max-spot-delay) 300) - (set! sv-16 (new 'static 'res-tag)) - (res-lump-data (-> this entity) 'nav-mesh-actor pointer :tag-ptr (& sv-16)) - (set! (-> this num-nav-mesh) (the-as int (-> sv-16 elt-count))) - (set! sv-32 (new 'static 'res-tag)) - (let ((v1-16 (res-lump-data (-> this entity) 'actor-groups pointer :tag-ptr (& sv-32)))) + (let ((sv-16 (new 'static 'res-tag))) + (res-lump-data (-> this entity) 'nav-mesh-actor pointer :tag-ptr (& sv-16)) + (set! (-> this num-nav-mesh) (the-as int (-> sv-16 elt-count))) + ) + (let* ((sv-32 (new 'static 'res-tag)) + (v1-16 (res-lump-data (-> this entity) 'actor-groups (pointer actor-group) :tag-ptr (& sv-32))) + ) (cond ((and v1-16 (nonzero? (-> sv-32 elt-count))) - (set! (-> this actor-group) (the-as (pointer actor-group) v1-16)) + (set! (-> this actor-group) v1-16) (set! (-> this actor-group-count) (the-as int (-> sv-32 elt-count))) ) (else diff --git a/goal_src/jak3/levels/nest/mh-centipede.gc b/goal_src/jak3/levels/nest/mh-centipede.gc index ae634e36b6..7efe69a0d4 100644 --- a/goal_src/jak3/levels/nest/mh-centipede.gc +++ b/goal_src/jak3/levels/nest/mh-centipede.gc @@ -695,24 +695,20 @@ (set! (-> self minimap) #f) ) :trans (behavior () - (let ((f0-0 (vector-vector-xz-distance-squared (target-pos 0) (-> self root trans))) - (f1-0 28672.0) - ) - (when (< f0-0 (* f1-0 f1-0)) - (let* ((v1-6 (-> *game-info* sub-task-list (game-task-node nest-hunt-get-crystal))) - (a0-4 (handle->process (if (-> v1-6 manager) - (-> v1-6 manager manager) - (the-as handle #f) - ) - ) - ) - ) - (when a0-4 - (when (send-event a0-4 'complete) - (talker-spawn-func (-> *talker-speech* 133) *entity-pool* (target-pos 0) (the-as region #f)) - (cleanup-for-death self) - (go-virtual wait-for-children) - ) + (when (< (vector-vector-xz-distance-squared (target-pos 0) (-> self root trans)) (square 28672.0)) + (let* ((v1-6 (-> *game-info* sub-task-list (game-task-node nest-hunt-get-crystal))) + (a0-4 (handle->process (if (-> v1-6 manager) + (-> v1-6 manager manager) + (the-as handle #f) + ) + ) + ) + ) + (when a0-4 + (when (send-event a0-4 'complete) + (talker-spawn-func (-> *talker-speech* 133) *entity-pool* (target-pos 0) (the-as region #f)) + (cleanup-for-death self) + (go-virtual wait-for-children) ) ) ) @@ -1040,13 +1036,9 @@ (vector-float*! (-> gp-0 move-dist) s3-1 -2.0) (let ((s3-2 (new 'stack-no-clear 'collide-query))) (let ((a1-20 (new 'stack-no-clear 'bounding-box))) - (let* ((f0-21 409.6) - (f1-9 3072.0) - (f1-11 (* f1-9 f1-9)) - (f2-0 10240.0) - (f0-22 (+ f0-21 (sqrtf (+ f1-11 (* f2-0 f2-0))))) - (v1-38 (new 'stack-no-clear 'vector)) - ) + (let ((f0-22 (+ 409.6 (sqrtf (+ (square 3072.0) (square 10240.0))))) + (v1-38 (new 'stack-no-clear 'vector)) + ) (set-vector! v1-38 f0-22 f0-22 f0-22 1.0) (vector+! (-> a1-20 max) (-> s5-0 collision-pt) v1-38) (vector-! (-> a1-20 min) (-> s5-0 collision-pt) v1-38) @@ -1330,7 +1322,6 @@ ) (defmethod mh-centipede-method-38 ((this mh-centipede) (arg0 symbol)) - (local-vars (sv-288 nav-control) (sv-304 vector) (sv-320 vector) (sv-336 nav-control)) (rlet ((acc :class vf) (vf0 :class vf) (vf1 :class vf) @@ -1363,13 +1354,11 @@ (s1-0 (new 'stack-no-clear 'vector)) (s2-2 (new 'stack-no-clear 'vector)) ) - (let ((f0-6 10240.0)) - (if (< (* f0-6 f0-6) (vector-vector-xz-distance-squared (-> s4-0 fvec) (-> this landing-position))) - (return #f) - ) - ) - (set! sv-288 (-> this nav)) - (let ((a1-7 s3-3) + (if (< (square 10240.0) (vector-vector-xz-distance-squared (-> s4-0 fvec) (-> this landing-position))) + (return #f) + ) + (let ((sv-288 (-> this nav)) + (a1-7 s3-3) (s0-0 s1-0) ) (let ((a3-1 s2-2) @@ -1390,9 +1379,9 @@ (when (or (probe-ground this (-> this landing-position)) (not arg0)) (dotimes (s1-1 10) (let ((s0-1 (-> s4-0 fvec))) - (set! sv-304 (-> s4-0 rvec)) - (set! sv-320 (-> s4-0 uvec)) - (let* ((f30-2 (- (tan 0.0))) + (let* ((sv-304 (-> s4-0 rvec)) + (sv-320 (-> s4-0 uvec)) + (f30-2 (- (tan 0.0))) (v1-39 (/ (the-as int (rand-uint31-gen *random-generator*)) 256)) (v1-40 (the-as number (logior #x3f800000 v1-39))) (f0-16 (+ f30-2 (* (+ -1.0 (the-as float v1-40)) (+ (tan 0.0) (tan 0.0))))) @@ -1415,8 +1404,8 @@ (clamp-vector-to-mesh-no-gaps (-> this nav) (-> this landing-position) (-> s0-2 poly) (-> s4-0 fvec) s0-2) (when (not (-> s0-2 found-boundary)) (vector+! (-> s4-0 fvec) (-> this landing-position) (-> s4-0 fvec)) - (set! sv-336 (-> this nav)) - (let ((a1-13 (-> s0-2 poly)) + (let ((sv-336 (-> this nav)) + (a1-13 (-> s0-2 poly)) (s0-3 (-> this launch-position)) ) (let ((a3-3 s2-2) @@ -1452,7 +1441,6 @@ ) (defmethod mh-centipede-method-39 ((this mh-centipede)) - (local-vars (sv-288 vector)) (logclear! (-> this flags) (mh-centipede-flag mc8)) (when (nonzero? (-> this nav)) (let ((s5-0 (new 'stack-no-clear 'matrix))) @@ -1479,19 +1467,11 @@ (s2-1 (new 'stack-no-clear 'vector)) (s3-3 (new 'stack-no-clear 'vector)) ) - (let ((f0-12 (vector-vector-xz-distance-squared (camera-pos) (-> this landing-position))) - (f1-1 245760.0) - ) - (if (or (< f0-12 (* f1-1 f1-1)) - (let ((f0-13 (vector-vector-xz-distance-squared (target-pos 0) (-> this landing-position))) - (f1-4 245760.0) - ) - (< f0-13 (* f1-4 f1-4)) - ) - ) - (return #f) - ) - ) + (if (or (< (vector-vector-xz-distance-squared (camera-pos) (-> this landing-position)) (square 245760.0)) + (< (vector-vector-xz-distance-squared (target-pos 0) (-> this landing-position)) (square 245760.0)) + ) + (return #f) + ) (let ((s0-0 (-> this nav)) (a1-7 s4-5) (s1-2 s2-1) @@ -1522,18 +1502,15 @@ ) (vector-float*! s1-3 s0-1 (+ f30-2 (* f28-1 (+ -1.0 (the-as float v1-36))))) ) - (let ((s1-5 (-> s5-0 fvec)) - (s0-2 (-> s5-0 fvec)) - ) - (set! sv-288 (-> s5-0 rvec)) - (let* ((f30-3 -1.0) - (f28-2 2.0) - (v1-41 (/ (the-as int (rand-uint31-gen *random-generator*)) 256)) - (v1-42 (the-as number (logior #x3f800000 v1-41))) - (f0-24 (+ f30-3 (* f28-2 (+ -1.0 (the-as float v1-42))))) - ) - (vector+float*! s1-5 s0-2 sv-288 f0-24) - ) + (let* ((s1-5 (-> s5-0 fvec)) + (s0-2 (-> s5-0 fvec)) + (sv-288 (-> s5-0 rvec)) + (f30-3 -1.0) + (f28-2 2.0) + (v1-41 (/ (the-as int (rand-uint31-gen *random-generator*)) 256)) + (v1-42 (the-as number (logior #x3f800000 v1-41))) + ) + (vector+float*! s1-5 s0-2 sv-288 (+ f30-3 (* f28-2 (+ -1.0 (the-as float v1-42))))) ) (vector-normalize! (-> s5-0 fvec) (* 3.0 (-> this current-anim radius))) (let ((s1-7 (new 'stack-no-clear 'clamp-travel-vector-to-mesh-return-info))) @@ -1573,12 +1550,6 @@ ) (defmethod death-explosion ((this mh-centipede) (arg0 int)) - (local-vars - (sv-848 process) - (sv-864 - (function skeleton-group int joint-exploder-tuning joint-exploder-static-params object :behavior joint-exploder) - ) - ) (let ((s4-0 (get-field-spec-by-id (-> *part-id-table* 2512) (sp-field-id spt-omega))) (s5-0 (new 'stack-no-clear 'matrix)) ) @@ -1649,23 +1620,15 @@ (vector-copy! s3-2 (-> this root scale)) (vector-copy! (-> this root trans) (-> s5-0 trans)) (set-vector! (-> this root scale) 2.0 2.0 2.0 1.0) - (let ((s5-1 (get-process *default-dead-pool* joint-exploder #x4000 0))) - (when s5-1 - (let ((t9-16 (method-of-type joint-exploder activate))) - (t9-16 (the-as joint-exploder s5-1) this "joint-exploder" (the-as pointer #x70004000)) - ) - (let ((s0-0 run-function-in-process)) - (set! sv-848 s5-1) - (set! sv-864 joint-exploder-init-by-other) - (let ((a2-16 (art-group-get-by-name *level* "skel-mh-centipede-explode" (the-as (pointer level) #f))) - (a3-10 10) - (t1-0 *mh-centipede-exploder-params*) - ) - ((the-as (function object object object object object object none) s0-0) sv-848 sv-864 a2-16 a3-10 s2-0 t1-0) - ) - ) - (-> s5-1 ppointer) - ) + (process-spawn + joint-exploder + (art-group-get-by-name *level* "skel-mh-centipede-explode" (the-as (pointer level) #f)) + 10 + s2-0 + *mh-centipede-exploder-params* + :name "joint-exploder" + :to this + :unk 0 ) (quaternion-copy! (-> this root quat) s1-0) (vector-copy! (-> this root trans) s4-3) @@ -1696,13 +1659,9 @@ (get-intersect-point s5-1 s2-0 (-> self root) s4-0) (vector-! s5-1 s5-1 (-> s3-0 prim-core world-sphere)) (set! (-> s5-1 y) 0.0) - (let ((f0-1 (vector-length-squared s5-1)) - (f1-0 1.0) - ) - (if (< f0-1 (* f1-0 f1-0)) - (set! (-> s5-1 x) 1.0) - ) - ) + (if (< (vector-length-squared s5-1) (square 1.0)) + (set! (-> s5-1 x) 1.0) + ) (vector-normalize! s5-1 1.0) (set! (-> s5-1 y) 0.1) (when (send-event arg0 'attack #f (static-attack-info @@ -1801,7 +1760,6 @@ ) (defmethod fire-shot ((this mh-centipede)) - (local-vars (sv-192 sound-id)) (with-pp (let ((gp-0 (new 'stack-no-clear 'projectile-init-by-other-params))) (let ((s3-0 (new 'stack-no-clear 'vector)) @@ -1810,18 +1768,14 @@ (let ((s2-0 (new 'stack-no-clear 'vector))) (vector-copy! s2-0 (target-pos 0)) (vector<-cspace! s3-0 (-> this node-list data 77)) - (let ((s1-0 sound-play-by-name) - (sname (static-sound-name "cent-fire-spit")) - ) - (set! sv-192 (new-sound-id)) - (let ((a2-0 (the int (* 1024.0 (nest-hunt-volume (-> this effect-sphere))))) - (a3-0 0) - (t0-0 0) - (t1-0 0) - (t2-0 s3-0) - ) - (s1-0 (the-as sound-name sname) sv-192 a2-0 a3-0 t0-0 (the-as sound-group t1-0) t2-0) - ) + (sound-play-by-name + (static-sound-name "cent-fire-spit") + (new-sound-id) + (the int (* 1024.0 (nest-hunt-volume (-> this effect-sphere)))) + 0 + 0 + (sound-group) + s3-0 ) (vector-! s4-0 (-> this current-target-position) (-> this prev-target-position)) (set! (-> s4-0 y) 0.0) @@ -1988,15 +1942,17 @@ (set! (-> v1-6 prim-core collide-with) (collide-spec)) ) 0 - (let* ((gp-0 lerp-scale) - (s5-0 819.2) - (s4-0 0.0) - (a2-0 (vector-vector-distance-squared (-> self launch-position) (target-pos 0))) - (f0-0 204800.0) - (a3-0 (* f0-0 f0-0)) - (f0-2 2048000.0) - (f0-5 (* (gp-0 s5-0 s4-0 a2-0 a3-0 (* f0-2 f0-2)) (nest-hunt-shake-amp (-> self effect-sphere)))) - ) + (let ((f0-5 (* (lerp-scale + 819.2 + 0.0 + (vector-vector-distance-squared (-> self launch-position) (target-pos 0)) + (square 204800.0) + (square 2048000.0) + ) + (nest-hunt-shake-amp (-> self effect-sphere)) + ) + ) + ) (activate! *camera-smush-control* f0-5 37 600 1.0 1.1 (-> *display* camera-clock)) ) (init! (-> self out-of-ground-crater) (-> self launch-position) 32768.0) @@ -2032,7 +1988,7 @@ (-> self launch-position) ) (set! (-> self rumble-sound-playing) #t) - (let ((f30-1 (* f30-0 f30-0))) + (let ((f30-1 (square f30-0))) (sound-play-by-name (static-sound-name "cent-ground") (-> self ground-sound) @@ -2069,15 +2025,18 @@ (quaternion-set! (-> self root quat) 0.0 (-> gp-1 x) 0.0 (+ 1.0 (-> gp-1 z))) ) (quaternion-normalize! (-> self root quat)) - (let* ((gp-2 lerp-scale) - (s5-0 1638.4) - (s4-0 0.0) - (a2-1 (vector-vector-distance-squared (-> self launch-position) (target-pos 0))) - (f0-4 204800.0) - (a3-1 (* f0-4 f0-4)) - (f0-6 2048000.0) - (f30-1 (* (gp-2 s5-0 s4-0 a2-1 a3-1 (* f0-6 f0-6)) (nest-hunt-shake-amp (-> self effect-sphere)))) - ) + (let ((f30-1 + (* (lerp-scale + 1638.4 + 0.0 + (vector-vector-distance-squared (-> self launch-position) (target-pos 0)) + (square 204800.0) + (square 2048000.0) + ) + (nest-hunt-shake-amp (-> self effect-sphere)) + ) + ) + ) (set-zero! *camera-smush-control*) (activate! *camera-smush-control* f30-1 75 900 1.1 1.07 (-> *display* camera-clock)) ) @@ -2233,15 +2192,17 @@ (-> self landing-position) ) (set! (-> self ground-sound-playing) #t) - (let* ((gp-5 lerp-scale) - (s5-6 1638.4) - (s4-6 0.0) - (a2-9 (vector-vector-distance-squared (-> self landing-position) (target-pos 0))) - (f0-33 204800.0) - (a3-7 (* f0-33 f0-33)) - (f0-35 2048000.0) - (f30-8 (* (gp-5 s5-6 s4-6 a2-9 a3-7 (* f0-35 f0-35)) (nest-hunt-shake-amp (-> self effect-sphere)))) - ) + (let ((f30-8 (* (lerp-scale + 1638.4 + 0.0 + (vector-vector-distance-squared (-> self landing-position) (target-pos 0)) + (square 204800.0) + (square 2048000.0) + ) + (nest-hunt-shake-amp (-> self effect-sphere)) + ) + ) + ) (set-zero! *camera-smush-control*) (activate! *camera-smush-control* f30-8 60 600 0.995 1.07 (-> *display* camera-clock)) ) @@ -2339,15 +2300,18 @@ (nest-hunt-play-speech 0 (-> self effect-sphere)) (set-time! (-> self state-time)) (vector-copy! (-> self root trans) (-> self launch-position)) - (let* ((gp-0 lerp-scale) - (s5-0 1638.4) - (s4-0 0.0) - (a2-0 (vector-vector-distance-squared (-> self launch-position) (target-pos 0))) - (f0-0 204800.0) - (a3-0 (* f0-0 f0-0)) - (f0-2 2048000.0) - (f30-1 (* (gp-0 s5-0 s4-0 a2-0 a3-0 (* f0-2 f0-2)) (nest-hunt-shake-amp (-> self effect-sphere)))) - ) + (let ((f30-1 + (* (lerp-scale + 1638.4 + 0.0 + (vector-vector-distance-squared (-> self launch-position) (target-pos 0)) + (square 204800.0) + (square 2048000.0) + ) + (nest-hunt-shake-amp (-> self effect-sphere)) + ) + ) + ) (set-zero! *camera-smush-control*) (activate! *camera-smush-control* f30-1 75 900 1.1 1.07 (-> *display* camera-clock)) ) @@ -2517,15 +2481,17 @@ (-> self landing-position) ) (set! (-> self ground-sound-playing) #t) - (let* ((gp-7 lerp-scale) - (s5-6 1638.4) - (s4-6 0.0) - (a2-10 (vector-vector-distance-squared (-> self landing-position) (target-pos 0))) - (f0-43 204800.0) - (a3-8 (* f0-43 f0-43)) - (f0-45 2048000.0) - (f30-9 (* (gp-7 s5-6 s4-6 a2-10 a3-8 (* f0-45 f0-45)) (nest-hunt-shake-amp (-> self effect-sphere)))) - ) + (let ((f30-9 (* (lerp-scale + 1638.4 + 0.0 + (vector-vector-distance-squared (-> self landing-position) (target-pos 0)) + (square 204800.0) + (square 2048000.0) + ) + (nest-hunt-shake-amp (-> self effect-sphere)) + ) + ) + ) (set-zero! *camera-smush-control*) (activate! *camera-smush-control* f30-9 60 600 0.995 1.07 (-> *display* camera-clock)) ) @@ -2632,15 +2598,18 @@ ) ) (set-time! (-> self state-time)) - (let* ((gp-0 lerp-scale) - (s5-0 1638.4) - (s4-0 0.0) - (a2-1 (vector-vector-distance-squared (-> self launch-position) (target-pos 0))) - (f0-0 204800.0) - (a3-0 (* f0-0 f0-0)) - (f0-2 2048000.0) - (f30-1 (* (gp-0 s5-0 s4-0 a2-1 a3-0 (* f0-2 f0-2)) (nest-hunt-shake-amp (-> self effect-sphere)))) - ) + (let ((f30-1 + (* (lerp-scale + 1638.4 + 0.0 + (vector-vector-distance-squared (-> self launch-position) (target-pos 0)) + (square 204800.0) + (square 2048000.0) + ) + (nest-hunt-shake-amp (-> self effect-sphere)) + ) + ) + ) (set-zero! *camera-smush-control*) (activate! *camera-smush-control* f30-1 75 900 1.1 1.07 (-> *display* camera-clock)) ) @@ -2807,7 +2776,6 @@ ;; WARN: Return type mismatch int vs object. (defmethod init-from-entity! ((this mh-centipede) (arg0 entity-actor)) "Set up a newly created process from the entity that created it." - (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) @@ -2962,8 +2930,9 @@ ) (set! (-> this current-anim) (-> this breach-anims 0)) (set! (-> this appearance-order) 0) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-74 (res-lump-data arg0 'actor-groups (pointer actor-group) :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-74 (res-lump-data arg0 'actor-groups (pointer actor-group) :tag-ptr (& sv-16))) + ) (cond ((and v1-74 (nonzero? (-> sv-16 elt-count))) (let ((v1-75 (-> v1-74 0))) @@ -3211,19 +3180,19 @@ ) (defmethod init-actor-group! ((this task-manager-mh-centipede)) - (local-vars (sv-16 res-tag)) (let* ((s5-0 "mh-centipede-7") (a0-2 (entity-by-name s5-0)) ) (cond (a0-2 (set! (-> this manager-entity) (the-as entity-actor a0-2)) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-1 (res-lump-data a0-2 'actor-groups pointer :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-1 (res-lump-data a0-2 'actor-groups (pointer actor-group) :tag-ptr (& sv-16))) + ) (cond ((and v1-1 (nonzero? (-> sv-16 elt-count))) (set! (-> this actor-group-count) (the-as int (-> sv-16 elt-count))) - (set! (-> this actor-group) (the-as (pointer actor-group) v1-1)) + (set! (-> this actor-group) v1-1) ) (else (format 0 "ERROR: ~S: ~S entity missing actor-group!~%" (game-task->string (-> this node-info task)) s5-0) diff --git a/goal_src/jak3/levels/nest/nst-obs.gc b/goal_src/jak3/levels/nest/nst-obs.gc index 9e53d44b4e..554d10f45e 100644 --- a/goal_src/jak3/levels/nest/nst-obs.gc +++ b/goal_src/jak3/levels/nest/nst-obs.gc @@ -167,14 +167,14 @@ (defmethod init-from-entity! ((this nst-metalhead-eggs) (arg0 entity-actor)) "Set up a newly created process from the entity that created it." - (local-vars (sv-16 res-tag)) (init-collision! this) (process-drawable-from-entity! this arg0) (init-skel-and-jcontrol! this) (set! (-> this notify-actor) (entity-actor-lookup arg0 'alt-actor 0)) (set! (-> this root pause-adjust-distance) 204800.0) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-7 (res-lump-data (-> this entity) 'actor-groups pointer :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-7 (res-lump-data (-> this entity) 'actor-groups pointer :tag-ptr (& sv-16))) + ) (if (and v1-7 (= (-> sv-16 elt-count) 1)) (set! (-> this actor-group) (the-as actor-group (-> (the-as (pointer uint32) v1-7)))) (set! (-> this actor-group) #f) @@ -951,7 +951,6 @@ (defmethod init-from-entity! ((this nst-falling-stone-bridge) (arg0 entity-actor)) "Set up a newly created process from the entity that created it." - (local-vars (sv-16 res-tag)) (stack-size-set! (-> this main-thread) 512) (let ((t9-1 (method-of-type nst-bridge-base init-from-entity!))) (t9-1 this arg0) @@ -980,8 +979,9 @@ (set! (-> this fall-anim) 3) ) ) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-10 (res-lump-data (-> this entity) 'actor-groups pointer :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-10 (res-lump-data (-> this entity) 'actor-groups pointer :tag-ptr (& sv-16))) + ) (if (and v1-10 (= (-> sv-16 elt-count) 1)) (set! (-> this actor-group) (the-as actor-group (-> (the-as (pointer uint32) v1-10)))) (set! (-> this actor-group) #f) @@ -1193,7 +1193,6 @@ ) (defmethod init-collision! ((this nst-collapsing-stone-bridge)) - (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) @@ -1255,29 +1254,29 @@ (s2-0 (-> 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 (-> s3-0 car)) @@ -1920,7 +1919,6 @@ ;; WARN: Return type mismatch sound-id vs none. (defmethod fire-shot! ((this nst-cocoon-a) (arg0 symbol)) - (local-vars (sv-192 int) (sv-208 int) (sv-224 (function vector vector float))) (let ((s3-0 (new 'stack-no-clear 'traj2d-params)) (s5-0 (new 'stack-no-clear 'vector)) ) @@ -1932,21 +1930,18 @@ (s1-0 -1) (s2-0 (new 'stack-no-clear 'projectile-init-by-other-params)) ) - (let ((s0-0 (-> *nst-cocoon-a-goop-joints* length))) - (set! sv-192 0) - (set! sv-208 (-> *nst-cocoon-a-goop-joints* sv-192)) + (let* ((s0-0 (-> *nst-cocoon-a-goop-joints* length)) + (sv-192 0) + (sv-208 (-> *nst-cocoon-a-goop-joints* sv-192)) + ) (while (< sv-192 s0-0) - (set! sv-224 vector-vector-xz-distance) - (let* ((a0-8 (target-pos 0)) - (a1-3 (-> this node-list data sv-208 bone transform trans)) - (f0-4 (sv-224 a0-8 a1-3)) - ) + (let ((f0-4 (vector-vector-xz-distance (target-pos 0) (-> this node-list data sv-208 bone transform trans)))) (when (< f0-4 f30-0) (set! f30-0 f0-4) (set! s1-0 sv-208) ) ) - (set! sv-192 (+ sv-192 1)) + (+! sv-192 1) (set! sv-208 (-> *nst-cocoon-a-goop-joints* sv-192)) ) ) diff --git a/goal_src/jak3/levels/precursor/precura-obs.gc b/goal_src/jak3/levels/precursor/precura-obs.gc index 61c0902dda..fc733ffd14 100644 --- a/goal_src/jak3/levels/precursor/precura-obs.gc +++ b/goal_src/jak3/levels/precursor/precura-obs.gc @@ -444,7 +444,6 @@ ) ) :trans (behavior () - (local-vars (sv-128 symbol) (sv-144 vector)) (sound-play "prec-generator" :id (-> self sound-id) :position (-> self root trans)) (when (< (the-as time-frame (-> self next-lightning-time)) (current-time)) (process-drawable-shock-effect @@ -500,9 +499,9 @@ (s2-0 (-> *lightning-spec-id-table* 37)) (s1-0 90) (s0-0 #f) + (sv-128 (the-as symbol #f)) + (sv-144 (new 'stack-no-clear 'vector)) ) - (set! sv-128 (the-as symbol #f)) - (set! sv-144 (new 'stack-no-clear 'vector)) (set! (-> sv-144 x) (-> (target-pos 0) x)) (let* ((f30-0 (-> (target-pos 0) y)) (f28-0 4096.0) @@ -515,18 +514,16 @@ ) (set! (-> sv-144 z) (-> (target-pos 0) z)) (set! (-> sv-144 w) 1.0) - (let ((t3-0 (-> self root trans))) - ((the-as (function object object object object object object object object none) s5-2) - s4-0 - s3-0 - s2-0 - s1-0 - s0-0 - sv-128 - sv-144 - t3-0 - ) - ) + ((the-as (function object object object object object object object object none) s5-2) + s4-0 + s3-0 + s2-0 + s1-0 + s0-0 + sv-128 + sv-144 + (-> self root trans) + ) ) (-> gp-2 ppointer) ) @@ -1071,7 +1068,6 @@ (defmethod init-from-entity! ((this precur-generator-c) (arg0 entity-actor)) "Set up a newly created process from the entity that created it." - (local-vars (sv-16 res-tag)) (stack-size-set! (-> this main-thread) 512) (let ((s4-0 (new 'process 'collide-shape this (collide-list-enum usually-hit-by-player)))) (set! (-> s4-0 penetrated-by) (penetrate)) @@ -1106,12 +1102,13 @@ ) (set! (-> this next-lightning-time) (the-as uint 0)) (set! (-> this entity) arg0) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-19 (res-lump-data arg0 'actor-groups pointer :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-19 (res-lump-data arg0 'actor-groups (pointer actor-group) :tag-ptr (& sv-16))) + ) (cond ((and v1-19 (nonzero? (-> sv-16 elt-count))) (set! (-> this actor-group-count) (the-as int (-> sv-16 elt-count))) - (set! (-> this actor-group) (the-as (pointer actor-group) v1-19)) + (set! (-> this actor-group) v1-19) ) (else (format 0 "ERROR: entity missing actor-group!~%") @@ -1626,7 +1623,6 @@ (defmethod init-from-entity! ((this precur-generator-d) (arg0 entity-actor)) "Set up a newly created process from the entity that created it." - (local-vars (sv-16 res-tag)) (let ((s4-0 (new 'process 'collide-shape this (collide-list-enum usually-hit-by-player)))) (set! (-> s4-0 penetrated-by) (penetrate)) (let ((s3-0 (new 'process 'collide-shape-prim-group s4-0 (the-as uint 1) 0))) @@ -1661,12 +1657,13 @@ (set! (-> this entity) arg0) (set! (-> this sound-id) (new-sound-id)) (set! (-> this animation-speed) 0.5) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-18 (res-lump-data arg0 'actor-groups pointer :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-18 (res-lump-data arg0 'actor-groups (pointer actor-group) :tag-ptr (& sv-16))) + ) (cond ((and v1-18 (nonzero? (-> sv-16 elt-count))) (set! (-> this actor-group-count) (the-as int (-> sv-16 elt-count))) - (set! (-> this actor-group) (the-as (pointer actor-group) v1-18)) + (set! (-> this actor-group) v1-18) ) (else (format 0 "ERROR: entity missing actor-group!~%") diff --git a/goal_src/jak3/levels/precursor/precura-obs2.gc b/goal_src/jak3/levels/precursor/precura-obs2.gc index a97854831e..894a70fe2b 100644 --- a/goal_src/jak3/levels/precursor/precura-obs2.gc +++ b/goal_src/jak3/levels/precursor/precura-obs2.gc @@ -567,8 +567,7 @@ 0.0 (let ((f30-0 (vector-length arg3))) 0.0 - (let* ((f0-5 (fabs (vector-dot (-> arg0 surface-normal) *up-vector*))) - (f0-6 (* f0-5 f0-5)) + (let* ((f0-6 (square (fabs (vector-dot (-> arg0 surface-normal) *up-vector*)))) (f0-7 (- 1.0 f0-6)) ) (vector-copy! s3-0 (-> arg0 surface-normal)) @@ -1477,72 +1476,73 @@ ) (defmethod fire-beam ((this precur-laser-beam) (arg0 vector) (arg1 vector)) - (local-vars (sv-560 collide-query) (sv-564 float)) - (set! sv-560 (new 'stack-no-clear 'collide-query)) - (set! sv-564 83968.0) - (vector-copy! (-> sv-560 start-pos) arg0) - (vector-normalize-copy! arg1 arg1 sv-564) - (vector-normalize-copy! (-> sv-560 move-dist) arg1 sv-564) - (let ((v1-5 sv-560)) - (set! (-> v1-5 radius) 40.96) - (set! (-> v1-5 collide-with) (collide-spec backgnd)) - (set! (-> v1-5 ignore-process0) #f) - (set! (-> v1-5 ignore-process1) #f) - (set! (-> v1-5 ignore-pat) - (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) + (let ((sv-560 (new 'stack-no-clear 'collide-query))) + (let ((sv-564 83968.0)) + (vector-copy! (-> sv-560 start-pos) arg0) + (vector-normalize-copy! arg1 arg1 sv-564) + (vector-normalize-copy! (-> sv-560 move-dist) arg1 sv-564) + (let ((v1-5 sv-560)) + (set! (-> v1-5 radius) 40.96) + (set! (-> v1-5 collide-with) (collide-spec backgnd)) + (set! (-> v1-5 ignore-process0) #f) + (set! (-> v1-5 ignore-process1) #f) + (set! (-> v1-5 ignore-pat) + (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) + ) + (set! (-> v1-5 action-mask) (collide-action solid)) + ) + (let ((f0-4 (fill-and-probe-using-line-sphere *collide-cache* sv-560))) + (cond + ((>= f0-4 0.0) + (vector-float*! (-> sv-560 move-dist) (-> sv-560 move-dist) f0-4) + (set! sv-564 (* sv-564 f0-4)) + ) + (else + (set! (-> sv-560 best-other-tri collide-ptr) #f) + ) ) - (set! (-> v1-5 action-mask) (collide-action solid)) - ) - (let ((f0-4 (fill-and-probe-using-line-sphere *collide-cache* sv-560))) - (cond - ((>= f0-4 0.0) - (vector-float*! (-> sv-560 move-dist) (-> sv-560 move-dist) f0-4) - (set! sv-564 (* sv-564 f0-4)) - ) - (else - (set! (-> sv-560 best-other-tri collide-ptr) #f) ) - ) - ) - (set! (-> *part-id-table* 4452 init-specs 4 initial-valuef) sv-564) - (draw-beam (-> *part-id-table* 4452) arg0 arg1 #t) - (let ((v1-19 sv-560)) - (set! (-> v1-19 radius) 40.96) - (set! (-> v1-19 collide-with) (collide-spec jak enemy player-list)) - (set! (-> v1-19 ignore-process0) #f) - (set! (-> v1-19 ignore-process1) #f) - (set! (-> v1-19 ignore-pat) - (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) + (set! (-> *part-id-table* 4452 init-specs 4 initial-valuef) sv-564) + (draw-beam (-> *part-id-table* 4452) arg0 arg1 #t) + (let ((v1-19 sv-560)) + (set! (-> v1-19 radius) 40.96) + (set! (-> v1-19 collide-with) (collide-spec jak enemy player-list)) + (set! (-> v1-19 ignore-process0) #f) + (set! (-> v1-19 ignore-process1) #f) + (set! (-> v1-19 ignore-pat) + (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) + ) + (set! (-> v1-19 action-mask) (collide-action solid)) + ) + (let ((f30-0 (fill-and-probe-using-line-sphere *collide-cache* sv-560)) + (s3-0 (new 'stack-no-clear 'vector)) + ) + (vector-! s3-0 (target-pos 0) arg0) + (set! (-> s3-0 y) 0.0) + (vector-normalize! s3-0 1.0) + (when (and (>= f30-0 0.0) + (>= (the-as uint (- (current-time) (the-as int (-> this last-attack-time)))) (the-as uint 600)) + ) + (elec-mech s3-0 (-> this attack-id)) + (set! (-> this last-attack-time) (the-as uint (current-time))) ) - (set! (-> v1-19 action-mask) (collide-action solid)) - ) - (let ((f30-0 (fill-and-probe-using-line-sphere *collide-cache* sv-560)) - (s3-0 (new 'stack-no-clear 'vector)) ) - (vector-! s3-0 (target-pos 0) arg0) - (set! (-> s3-0 y) 0.0) - (vector-normalize! s3-0 1.0) - (when (and (>= f30-0 0.0) - (>= (the-as uint (- (current-time) (the-as int (-> this last-attack-time)))) (the-as uint 600)) - ) - (elec-mech s3-0 (-> this attack-id)) - (set! (-> this last-attack-time) (the-as uint (current-time))) + (vector-float*! arg1 arg1 -1.0) + (vector-normalize-copy! (-> sv-560 move-dist) arg1 sv-564) ) - ) - (vector-float*! arg1 arg1 -1.0) - (vector-normalize-copy! (-> sv-560 move-dist) arg1 sv-564) - (let ((f30-1 (fill-and-probe-using-line-sphere *collide-cache* sv-560)) - (s3-1 (new 'stack-no-clear 'vector)) + (let ((f30-1 (fill-and-probe-using-line-sphere *collide-cache* sv-560)) + (s3-1 (new 'stack-no-clear 'vector)) + ) + (vector-! s3-1 (target-pos 0) arg0) + (set! (-> s3-1 y) 0.0) + (vector-normalize! s3-1 1.0) + (when (and (>= f30-1 0.0) + (>= (the-as uint (- (current-time) (the-as int (-> this last-attack-time)))) (the-as uint 600)) + ) + (format 0 "attack-time: ~d~%" (-> this last-attack-time)) + (elec-mech s3-1 (-> this attack-id)) + (set! (-> this last-attack-time) (the-as uint (current-time))) ) - (vector-! s3-1 (target-pos 0) arg0) - (set! (-> s3-1 y) 0.0) - (vector-normalize! s3-1 1.0) - (when (and (>= f30-1 0.0) - (>= (the-as uint (- (current-time) (the-as int (-> this last-attack-time)))) (the-as uint 600)) - ) - (format 0 "attack-time: ~d~%" (-> this last-attack-time)) - (elec-mech s3-1 (-> this attack-id)) - (set! (-> this last-attack-time) (the-as uint (current-time))) ) ) (draw-beam (-> *part-id-table* 4452) arg0 arg1 #t) @@ -1552,60 +1552,61 @@ ;; WARN: Return type mismatch (pointer process) vs none. (defmethod fire-beam0 ((this precur-laser-beam) (arg0 vector) (arg1 vector)) "Unused." - (local-vars (sv-560 collide-query) (sv-564 float)) - (set! sv-560 (new 'stack-no-clear 'collide-query)) - (set! sv-564 83968.0) - (vector-copy! (-> sv-560 start-pos) arg0) - (vector-float*! (-> sv-560 move-dist) arg1 sv-564) - (let ((v1-7 sv-560)) - (set! (-> v1-7 radius) 40.96) - (set! (-> v1-7 collide-with) (collide-spec backgnd)) - (set! (-> v1-7 ignore-process0) #f) - (set! (-> v1-7 ignore-process1) #f) - (set! (-> v1-7 ignore-pat) - (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) + (let ((sv-560 (new 'stack-no-clear 'collide-query)) + (sv-564 83968.0) + ) + (vector-copy! (-> sv-560 start-pos) arg0) + (vector-float*! (-> sv-560 move-dist) arg1 sv-564) + (let ((v1-7 sv-560)) + (set! (-> v1-7 radius) 40.96) + (set! (-> v1-7 collide-with) (collide-spec backgnd)) + (set! (-> v1-7 ignore-process0) #f) + (set! (-> v1-7 ignore-process1) #f) + (set! (-> v1-7 ignore-pat) + (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) + ) + (set! (-> v1-7 action-mask) (collide-action solid)) + ) + (let ((f0-3 (fill-and-probe-using-line-sphere *collide-cache* sv-560))) + (cond + ((>= f0-3 0.0) + (vector-float*! (-> sv-560 move-dist) (-> sv-560 move-dist) f0-3) + (set! sv-564 (* sv-564 f0-3)) + ) + (else + (set! (-> sv-560 best-other-tri collide-ptr) #f) ) - (set! (-> v1-7 action-mask) (collide-action solid)) - ) - (let ((f0-3 (fill-and-probe-using-line-sphere *collide-cache* sv-560))) - (cond - ((>= f0-3 0.0) - (vector-float*! (-> sv-560 move-dist) (-> sv-560 move-dist) f0-3) - (set! sv-564 (* sv-564 f0-3)) - ) - (else - (set! (-> sv-560 best-other-tri collide-ptr) #f) ) ) - ) - (set! (-> *part-id-table* 4452 init-specs 4 initial-valuef) sv-564) - (let ((s3-0 (new 'stack-no-clear 'vector)) - (s4-0 (new 'stack-no-clear 'matrix)) - ) - (vector+float*! s3-0 arg0 arg1 sv-564) - (matrix-f-compose s4-0 arg1) - (vector-copy! (-> s4-0 trans) s3-0) - (if (logtest? (-> group-placeholder-single-laser flags) (sp-group-flag sp13)) - (part-tracker-spawn - part-tracker-subsampler - :to *entity-pool* - :group group-placeholder-single-laser - :mat-joint s4-0 + (set! (-> *part-id-table* 4452 init-specs 4 initial-valuef) sv-564) + (let ((s3-0 (new 'stack-no-clear 'vector)) + (s4-0 (new 'stack-no-clear 'matrix)) ) - (part-tracker-spawn part-tracker :to *entity-pool* :group group-placeholder-single-laser :mat-joint s4-0) - ) - (vector+float*! s3-0 arg0 arg1 (- sv-564)) - (matrix-f-compose s4-0 (vector-float*! (new 'stack-no-clear 'vector) arg1 -1.0)) - (vector-copy! (-> s4-0 trans) s3-0) - (if (logtest? (-> group-placeholder-single-laser flags) (sp-group-flag sp13)) - (part-tracker-spawn - part-tracker-subsampler - :to *entity-pool* - :group group-placeholder-single-laser - :mat-joint s4-0 + (vector+float*! s3-0 arg0 arg1 sv-564) + (matrix-f-compose s4-0 arg1) + (vector-copy! (-> s4-0 trans) s3-0) + (if (logtest? (-> group-placeholder-single-laser flags) (sp-group-flag sp13)) + (part-tracker-spawn + part-tracker-subsampler + :to *entity-pool* + :group group-placeholder-single-laser + :mat-joint s4-0 + ) + (part-tracker-spawn part-tracker :to *entity-pool* :group group-placeholder-single-laser :mat-joint s4-0) ) - (part-tracker-spawn part-tracker :to *entity-pool* :group group-placeholder-single-laser :mat-joint s4-0) - ) + (vector+float*! s3-0 arg0 arg1 (- sv-564)) + (matrix-f-compose s4-0 (vector-float*! (new 'stack-no-clear 'vector) arg1 -1.0)) + (vector-copy! (-> s4-0 trans) s3-0) + (if (logtest? (-> group-placeholder-single-laser flags) (sp-group-flag sp13)) + (part-tracker-spawn + part-tracker-subsampler + :to *entity-pool* + :group group-placeholder-single-laser + :mat-joint s4-0 + ) + (part-tracker-spawn part-tracker :to *entity-pool* :group group-placeholder-single-laser :mat-joint s4-0) + ) + ) ) (none) ) @@ -1646,9 +1647,9 @@ ) ) :code (behavior () - (local-vars (sv-16 res-tag)) - (set! sv-16 (new 'static 'res-tag)) - (let ((gp-0 (res-lump-data (-> self entity) 'actor-groups pointer :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (gp-0 (res-lump-data (-> self entity) 'actor-groups pointer :tag-ptr (& sv-16))) + ) (cond ((and gp-0 (nonzero? (-> sv-16 elt-count))) (suspend-for (seconds 1) @@ -1884,20 +1885,18 @@ (if (and (movie?) (not (-> this movie-played?))) (set! (-> this movie-played?) #t) ) - (let ((f0-14 (vector-vector-distance-squared (target-pos 0) *precura-continue2-sphere*)) - (f1-5 (-> *precura-continue2-sphere* r)) - ) - (if (and (< f0-14 (* f1-5 f1-5)) (not (task-node-closed? (game-task-node precursor-destroy-ship-escape)))) - (task-node-close! (game-task-node precursor-destroy-ship-escape) 'event) - ) - ) + (if (and (< (vector-vector-distance-squared (target-pos 0) *precura-continue2-sphere*) + (square (-> *precura-continue2-sphere* r)) + ) + (not (task-node-closed? (game-task-node precursor-destroy-ship-escape))) + ) + (task-node-close! (game-task-node precursor-destroy-ship-escape) 'event) + ) (when (and (not (time-elapsed? (-> this start-time) (seconds 1))) (< (seconds 150) (-> this time-limit)) - (let ((f0-15 (vector-vector-distance-squared (target-pos 0) *precura-continue-sphere*)) - (f1-8 (-> *precura-continue-sphere* r)) - ) - (< f0-15 (* f1-8 f1-8)) - ) + (< (vector-vector-distance-squared (target-pos 0) *precura-continue-sphere*) + (square (-> *precura-continue-sphere* r)) + ) ) (set! (-> this time-limit) (seconds 150)) (send-event (process-by-name "dp-bipedal-104" *active-pool*) 'die-fast) @@ -1978,81 +1977,78 @@ (arg5 int) (arg6 float) ) - (local-vars - (sv-624 (pointer lightning-tracker)) - (sv-640 float) - (sv-656 matrix) - (sv-672 collide-query) - (sv-688 symbol) - (sv-704 vector) - (sv-720 int) - (sv-736 process) - ) - (set! sv-640 arg6) - (let ((s5-0 *lightning-probe-vars*)) - (set! sv-656 (new 'stack-no-clear 'matrix)) - (set! sv-672 (new 'stack-no-clear 'collide-query)) - (set! sv-688 (the-as symbol #f)) - (vector-copy! (-> sv-672 start-pos) arg4) - (set! sv-704 (-> sv-672 move-dist)) - (set! (-> sv-704 x) (rand-vu-float-range 0.0 65536.0)) - (set! (-> sv-704 y) (rand-vu-float-range 0.0 65536.0)) - (set! (-> sv-704 z) (rand-vu-float-range 0.0 65536.0)) - (set! (-> sv-704 w) 1.0) - (matrix-rotate-zyx! sv-656 (-> sv-672 move-dist)) - (set! sv-720 6) - (while (nonzero? sv-720) - (set! sv-720 (+ sv-720 -1)) - (vector-rotate*! (-> sv-672 move-dist) (-> s5-0 probe-dirs sv-720) sv-656) - (vector-normalize! (-> sv-672 move-dist) sv-640) - (let ((v1-18 sv-672)) - (set! (-> v1-18 radius) 409.6) - (set! (-> v1-18 collide-with) (collide-spec backgnd crate obstacle hit-by-others-list pusher)) - (set! (-> v1-18 ignore-process0) arg0) - (set! (-> v1-18 ignore-process1) #f) - (set! (-> v1-18 ignore-pat) - (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) - ) - (set! (-> v1-18 action-mask) (collide-action solid)) + (let ((sv-640 arg6) + (s5-0 *lightning-probe-vars*) + (sv-656 (new 'stack-no-clear 'matrix)) + (sv-672 (new 'stack-no-clear 'collide-query)) + (sv-688 (the-as symbol #f)) ) - (when (>= (fill-and-probe-using-line-sphere *collide-cache* sv-672) 0.0) - (set-time! (-> s5-0 last-valid-time)) - (vector-copy! (-> s5-0 end-pos) (-> sv-672 best-other-tri intersect)) - (when (< 8192.0 (vector-vector-distance (-> s5-0 end-pos) (-> sv-672 start-pos))) - (set! sv-688 #t) - (goto cfg-7) + (vector-copy! (-> sv-672 start-pos) arg4) + (let ((sv-704 (-> sv-672 move-dist))) + (set! (-> sv-704 x) (rand-vu-float-range 0.0 65536.0)) + (set! (-> sv-704 y) (rand-vu-float-range 0.0 65536.0)) + (set! (-> sv-704 z) (rand-vu-float-range 0.0 65536.0)) + (set! (-> sv-704 w) 1.0) + ) + (matrix-rotate-zyx! sv-656 (-> sv-672 move-dist)) + (let ((sv-720 6)) + (while (nonzero? sv-720) + (+! sv-720 -1) + (vector-rotate*! (-> sv-672 move-dist) (-> s5-0 probe-dirs sv-720) sv-656) + (vector-normalize! (-> sv-672 move-dist) sv-640) + (let ((v1-18 sv-672)) + (set! (-> v1-18 radius) 409.6) + (set! (-> v1-18 collide-with) (collide-spec backgnd crate obstacle hit-by-others-list pusher)) + (set! (-> v1-18 ignore-process0) arg0) + (set! (-> v1-18 ignore-process1) #f) + (set! (-> v1-18 ignore-pat) + (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) + ) + (set! (-> v1-18 action-mask) (collide-action solid)) + ) + (when (>= (fill-and-probe-using-line-sphere *collide-cache* sv-672) 0.0) + (set-time! (-> s5-0 last-valid-time)) + (vector-copy! (-> s5-0 end-pos) (-> sv-672 best-other-tri intersect)) + (when (< 8192.0 (vector-vector-distance (-> s5-0 end-pos) (-> sv-672 start-pos))) + (set! sv-688 #t) + (goto cfg-7) + ) ) ) ) (label cfg-7) (when sv-688 - (set! sv-736 (get-process *default-dead-pool* lightning-tracker #x4000 0)) - (set! sv-624 - (the-as - (pointer lightning-tracker) - (when sv-736 - (let ((t9-9 (method-of-type lightning-tracker activate))) - (t9-9 (the-as lightning-tracker sv-736) arg0 "lightning-tracker" (the-as pointer #x70004000)) + (let* ((sv-736 (get-process *default-dead-pool* lightning-tracker #x4000 0)) + (sv-624 (the-as + (pointer lightning-tracker) + (when sv-736 + ((method-of-type lightning-tracker activate) + (the-as lightning-tracker sv-736) + arg0 + "lightning-tracker" + (the-as pointer #x70004000) + ) + (run-now-in-process sv-736 lightning-tracker-init arg1 arg5 arg2 arg0 arg4 (-> s5-0 end-pos)) + (-> sv-736 ppointer) + ) + ) + ) + ) + (when sv-624 + (set! (-> sv-624 0 user-time 0) 0) + (when arg3 + (let ((v1-46 (get-field-spec-by-id arg3 (sp-field-id spt-timer)))) + (if v1-46 + (set! (-> v1-46 initial-valuef) (the-as float (-> sv-624 0 duration))) ) - (run-now-in-process sv-736 lightning-tracker-init arg1 arg5 arg2 arg0 arg4 (-> s5-0 end-pos)) - (-> sv-736 ppointer) - ) ) - ) - (when sv-624 - (set! (-> sv-624 0 user-time 0) 0) - (when arg3 - (let ((v1-46 (get-field-spec-by-id arg3 (sp-field-id spt-timer)))) - (if v1-46 - (set! (-> v1-46 initial-valuef) (the-as float (-> sv-624 0 duration))) - ) - ) - (let ((t9-12 sp-launch-particles-var) - (a0-26 *sp-particle-system-2d*) - (a2-5 *launch-matrix*) - ) - (vector-copy! (-> a2-5 trans) (-> s5-0 end-pos)) - (t9-12 a0-26 arg3 a2-5 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0) + (let ((t9-12 sp-launch-particles-var) + (a0-26 *sp-particle-system-2d*) + (a2-5 *launch-matrix*) + ) + (vector-copy! (-> a2-5 trans) (-> s5-0 end-pos)) + (t9-12 a0-26 arg3 a2-5 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0) + ) ) ) ) @@ -2253,32 +2249,34 @@ ;; WARN: Return type mismatch time-frame vs none. (defmethod probe-for-player-collision ((this precur-path) (arg0 vector) (arg1 vector)) - (local-vars (sv-576 collide-query) (sv-580 vector) (sv-584 float)) - (set! sv-576 (new 'stack-no-clear 'collide-query)) - (set! sv-580 (vector-! (new 'stack-no-clear 'vector) arg1 arg0)) - (set! sv-584 (vector-vector-distance arg0 arg1)) - (vector-copy! (-> sv-576 start-pos) arg0) - (vector-normalize-copy! (-> sv-576 move-dist) sv-580 sv-584) - (let ((v1-5 sv-576)) - (set! (-> v1-5 radius) 40.96) - (set! (-> v1-5 collide-with) (collide-spec jak enemy player-list)) - (set! (-> v1-5 ignore-process0) #f) - (set! (-> v1-5 ignore-process1) #f) - (set! (-> v1-5 ignore-pat) - (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) + (let ((sv-576 (new 'stack-no-clear 'collide-query))) + (let ((sv-580 (vector-! (new 'stack-no-clear 'vector) arg1 arg0)) + (sv-584 (vector-vector-distance arg0 arg1)) ) - (set! (-> v1-5 action-mask) (collide-action solid)) - ) - (let ((f30-0 (fill-and-probe-using-line-sphere *collide-cache* sv-576)) - (s5-1 (new 'stack-no-clear 'vector)) + (vector-copy! (-> sv-576 start-pos) arg0) + (vector-normalize-copy! (-> sv-576 move-dist) sv-580 sv-584) + ) + (let ((v1-5 sv-576)) + (set! (-> v1-5 radius) 40.96) + (set! (-> v1-5 collide-with) (collide-spec jak enemy player-list)) + (set! (-> v1-5 ignore-process0) #f) + (set! (-> v1-5 ignore-process1) #f) + (set! (-> v1-5 ignore-pat) + (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) + ) + (set! (-> v1-5 action-mask) (collide-action solid)) + ) + (let ((f30-0 (fill-and-probe-using-line-sphere *collide-cache* sv-576)) + (s5-1 (new 'stack-no-clear 'vector)) + ) + (set! (-> s5-1 y) 0.0) + (vector-normalize! s5-1 1.0) + (when (and (>= f30-0 0.0) + (>= (the-as uint (- (current-time) (the-as int (-> this last-attack-time)))) (the-as uint 600)) + ) + (elec-mech s5-1 (-> this attack-id)) + (set! (-> this last-attack-time) (the-as uint (current-time))) ) - (set! (-> s5-1 y) 0.0) - (vector-normalize! s5-1 1.0) - (when (and (>= f30-0 0.0) - (>= (the-as uint (- (current-time) (the-as int (-> this last-attack-time)))) (the-as uint 600)) - ) - (elec-mech s5-1 (-> this attack-id)) - (set! (-> this last-attack-time) (the-as uint (current-time))) ) ) (none) diff --git a/goal_src/jak3/levels/precursor/precurd-obs.gc b/goal_src/jak3/levels/precursor/precurd-obs.gc index 18afc445fa..160abcf69f 100644 --- a/goal_src/jak3/levels/precursor/precurd-obs.gc +++ b/goal_src/jak3/levels/precursor/precurd-obs.gc @@ -1263,7 +1263,6 @@ (defmethod init-from-entity! ((this precur-bridge-path-break) (arg0 entity-actor)) "Set up a newly created process from the entity that created it." - (local-vars (sv-16 res-tag)) (set-idx-by-name this) (init-collision! this) (process-drawable-from-entity! this arg0) @@ -1274,12 +1273,13 @@ ) (set! (-> this debris-handle) (the-as handle #f)) (precur-bridge-reset) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-13 (res-lump-data arg0 'actor-groups pointer :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-13 (res-lump-data arg0 'actor-groups (pointer actor-group) :tag-ptr (& sv-16))) + ) (cond ((and v1-13 (nonzero? (-> sv-16 elt-count))) (set! (-> this actor-group-count) (the-as int (-> sv-16 elt-count))) - (set! (-> this actor-group) (the-as (pointer actor-group) v1-13)) + (set! (-> this actor-group) v1-13) ) (else (format 0 "ERROR: ~S: entity missing actor-group!~%" (-> this name)) diff --git a/goal_src/jak3/levels/sewer/flyingsaw.gc b/goal_src/jak3/levels/sewer/flyingsaw.gc index 125a6a5bbd..dacb2cf9bc 100644 --- a/goal_src/jak3/levels/sewer/flyingsaw.gc +++ b/goal_src/jak3/levels/sewer/flyingsaw.gc @@ -249,26 +249,22 @@ (ja :num! (loop!)) (when (-> self graph) (let ((gp-0 (-> self graph node (-> self current-node)))) - (let ((f0-1 (vector-vector-distance-squared (-> self root trans) (-> gp-0 position))) - (f1-0 512.0) + (when (< (vector-vector-distance-squared (-> self root trans) (-> gp-0 position)) (square 512.0)) + (when (-> gp-0 make-spark) + (let ((s5-1 (vector-! (new 'stack-no-clear 'vector) (-> gp-0 spark) (-> gp-0 position)))) + (vector-normalize! s5-1 1.0) + (forward-down->inv-matrix (-> self spark-mat) s5-1 (new 'static 'vector :y -1.0)) ) - (when (< f0-1 (* f1-0 f1-0)) - (when (-> gp-0 make-spark) - (let ((s5-1 (vector-! (new 'stack-no-clear 'vector) (-> gp-0 spark) (-> gp-0 position)))) - (vector-normalize! s5-1 1.0) - (forward-down->inv-matrix (-> self spark-mat) s5-1 (new 'static 'vector :y -1.0)) - ) - (vector-copy! (-> self spark-mat trans) (-> gp-0 spark)) - (set-time! (-> self spark-timer)) - (sound-play "flysaw-hit-wall" :position (-> self root trans)) - ) - (+! (-> self current-node) 1) - (when (>= (-> self current-node) (-> self graph node-count)) - (set! (-> self current-node) (the-as uint 0)) - 0 - ) - (set! gp-0 (-> self graph node (-> self current-node))) + (vector-copy! (-> self spark-mat trans) (-> gp-0 spark)) + (set-time! (-> self spark-timer)) + (sound-play "flysaw-hit-wall" :position (-> self root trans)) ) + (+! (-> self current-node) 1) + (when (>= (-> self current-node) (-> self graph node-count)) + (set! (-> self current-node) (the-as uint 0)) + 0 + ) + (set! gp-0 (-> self graph node (-> self current-node))) ) (if (not (time-elapsed? (-> self spark-timer) (seconds 0.3))) (spawn-from-mat (-> self part) (-> self spark-mat)) diff --git a/goal_src/jak3/levels/sewer/kg-hopper.gc b/goal_src/jak3/levels/sewer/kg-hopper.gc index 6391c80d87..9966330afa 100644 --- a/goal_src/jak3/levels/sewer/kg-hopper.gc +++ b/goal_src/jak3/levels/sewer/kg-hopper.gc @@ -589,7 +589,6 @@ ) (defmethod kg-hopper-method-191 ((this kg-hopper)) - (local-vars (sv-752 collide-query)) (+! (-> this step-num) -1) (cond ((>= (-> this step-num) 0) @@ -619,28 +618,29 @@ (when (not (check-sphere-blocked! (-> this nav) a1-4 #x10006c)) (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 'collide-query)) - (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-4 s1-0) - (t0-1 (vector-! (new 'stack-no-clear 'vector) v1-21 (the-as vector (-> s0-0 state mesh bounds)))) - ) - (t9-4 a0-10 s4-0 a2-4 (the-as vector sv-752) t0-1) - ) - (vector+! s1-0 s1-0 (the-as vector (-> s0-0 state mesh bounds))) + (let ((s2-0 (new 'stack-no-clear 'vector)) + (sv-752 (new 'stack-no-clear 'collide-query)) + (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 + (the-as vector sv-752) + (vector-! (new 'stack-no-clear 'vector) v1-21 (the-as vector (-> s0-0 state mesh bounds))) + ) + ) + (vector+! s1-0 s1-0 (the-as vector (-> 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)) + ) ) (vector-copy! (-> this best-point) s5-0) ) @@ -737,7 +737,7 @@ ) ) (set! (-> self best-score) -2.0) - (set! (-> self origin quad) (-> self root trans quad)) + (vector-copy! (-> self origin) (-> self root trans)) ;; og:preserve-this ;; (b! #t cfg-17) (until (not (kg-hopper-method-191 self)) diff --git a/goal_src/jak3/levels/sewer/mh-wasp.gc b/goal_src/jak3/levels/sewer/mh-wasp.gc index fce0ef9870..74692fa0a5 100644 --- a/goal_src/jak3/levels/sewer/mh-wasp.gc +++ b/goal_src/jak3/levels/sewer/mh-wasp.gc @@ -957,79 +957,73 @@ (s5-0 (-> this main-joint-movement 2)) (gp-0 (lambda ((arg0 mh-wasp) (arg1 cspace) (arg2 float) (arg3 float) (arg4 vector) (arg5 vector) (arg6 int)) - (local-vars (sv-192 float) (sv-208 vector) (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 'vector)) - (let ((s2-1 (new 'stack-no-clear 'vector))) - (-> arg0 scale) - (quaternion-rotate-local-z! (the-as quaternion sv-208) a1-3 sv-192) - (quaternion->matrix s5-0 (the-as quaternion sv-208)) - (vector-copy! s2-1 (-> arg0 root scale)) - (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 (* 1638400.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 'vector)) + (s2-1 (new 'stack-no-clear 'vector)) + ) + (-> arg0 scale) + (quaternion-rotate-local-z! (the-as quaternion sv-208) a1-3 sv-192) + (quaternion->matrix s5-0 (the-as quaternion sv-208)) + (vector-copy! s2-1 (-> arg0 root scale)) + (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 (* 1638400.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* 5029 init-specs 4 initial-valuef) (* f20-0 f2-6)) - (set! (-> *part-id-table* 5029 init-specs 5 initial-valuef) (* f26-0 f0-15)) - (set! (-> *part-id-table* 5033 init-specs 3 initial-valuef) (* f22-0 f2-6)) - (set! (-> *part-id-table* 5030 init-specs 1 initial-valuef) (* f24-0 f0-15)) - (set! (-> *part-id-table* 5031 init-specs 1 initial-valuef) (* f1-10 f0-15)) - (set! (-> *part-id-table* 5032 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 uvec) (/ 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* 5029 init-specs 4 initial-valuef) (* f20-0 f2-6)) + (set! (-> *part-id-table* 5029 init-specs 5 initial-valuef) (* f26-0 f0-15)) + (set! (-> *part-id-table* 5033 init-specs 3 initial-valuef) (* f22-0 f2-6)) + (set! (-> *part-id-table* 5030 init-specs 1 initial-valuef) (* f24-0 f0-15)) + (set! (-> *part-id-table* 5031 init-specs 1 initial-valuef) (* f1-10 f0-15)) + (set! (-> *part-id-table* 5032 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 uvec) (/ f0-16 -2)) ) ) - (vector-copy! (-> s5-0 trans) s4-0) - (spawn-from-mat (-> 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) - (-> arg0 root trans) - ) - ) + ) + ) + (vector-copy! (-> s5-0 trans) s4-0) + (spawn-from-mat (-> 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) + (-> arg0 root trans) ) ) ) @@ -1242,7 +1236,6 @@ (defmethod init-enemy! ((this mh-wasp)) "Typical place for shared init code. Runs from entity or process style init." - (local-vars (sv-16 res-tag) (sv-32 res-tag) (sv-48 res-tag) (sv-64 res-tag)) (hover-enemy-method-170 this) (setup-enemy! this (get-enemy-info this)) (hover-enemy-method-176 this) @@ -1259,15 +1252,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-29 (res-lump-data (-> this entity) 'actor-groups pointer :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-29 (res-lump-data (-> this entity) 'actor-groups pointer :tag-ptr (& sv-16))) + ) (if (and v1-29 (= (-> sv-16 elt-count) 1)) (set! (-> this entity-group) (the-as actor-group (-> (the-as (pointer uint32) v1-29)))) (set! (-> this entity-group) #f) ) ) - (set! sv-32 (new 'static 'res-tag)) - (let ((v1-33 (res-lump-data (-> this entity) 'timeout (pointer float) :tag-ptr (& sv-32)))) + (let* ((sv-32 (new 'static 'res-tag)) + (v1-33 (res-lump-data (-> this entity) 'timeout (pointer float) :tag-ptr (& sv-32))) + ) (cond ((and v1-33 (= (-> sv-32 elt-count) 2)) (set! (-> this attack-wait-min) (-> v1-33 0)) @@ -1279,27 +1274,27 @@ ) ) ) - (let ((f30-0 4096.0)) - (set! sv-48 (new 'static 'res-tag)) - (let ((v1-40 (res-lump-data (-> this entity) 'min-max pointer :tag-ptr (& sv-48)))) - (set! (-> this attack-miss-dist-min) (* f30-0 (if (and v1-40 (> (the-as int (-> sv-48 elt-count)) 0)) - (-> (the-as (pointer float) v1-40)) - -1.0 - ) - ) - ) - ) + (let* ((f30-0 4096.0) + (sv-48 (new 'static 'res-tag)) + (v1-40 (res-lump-data (-> this entity) 'min-max pointer :tag-ptr (& sv-48))) + ) + (set! (-> this attack-miss-dist-min) (* f30-0 (if (and v1-40 (> (the-as int (-> sv-48 elt-count)) 0)) + (-> (the-as (pointer float) v1-40)) + -1.0 + ) + ) + ) ) - (let ((f30-1 4096.0)) - (set! sv-64 (new 'static 'res-tag)) - (let ((v1-44 (res-lump-data (-> this entity) 'min-max (pointer float) :tag-ptr (& sv-64)))) - (set! (-> this attack-miss-dist-max) (* f30-1 (if (and v1-44 (< 1 (the-as int (-> sv-64 elt-count)))) - (-> v1-44 1) - 1.0 - ) - ) - ) - ) + (let* ((f30-1 4096.0) + (sv-64 (new 'static 'res-tag)) + (v1-44 (res-lump-data (-> this entity) 'min-max (pointer float) :tag-ptr (& sv-64))) + ) + (set! (-> this attack-miss-dist-max) (* f30-1 (if (and v1-44 (< 1 (the-as int (-> sv-64 elt-count)))) + (-> v1-44 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/goal_src/jak3/levels/sewer/neo-juicer.gc b/goal_src/jak3/levels/sewer/neo-juicer.gc index ebf8ff4ebb..7a4b5391cb 100644 --- a/goal_src/jak3/levels/sewer/neo-juicer.gc +++ b/goal_src/jak3/levels/sewer/neo-juicer.gc @@ -697,11 +697,7 @@ ) ) (zero? (rnd-int 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)) ) (go-die this) (go (method-of-object this knocked)) diff --git a/goal_src/jak3/levels/sewer/saberfish-spawner.gc b/goal_src/jak3/levels/sewer/saberfish-spawner.gc index cb744306c2..79f7cb2b51 100644 --- a/goal_src/jak3/levels/sewer/saberfish-spawner.gc +++ b/goal_src/jak3/levels/sewer/saberfish-spawner.gc @@ -71,7 +71,6 @@ (defmethod init-from-entity! ((this saberfish-spawner) (arg0 entity-actor)) "Set up a newly created process from the entity that created it." - (local-vars (sv-16 res-tag)) (process-entity-set! this arg0) (set! (-> this root) (new 'process 'trsqv)) (process-drawable-from-entity! this arg0) @@ -105,15 +104,16 @@ (logior! (-> this jump-paths s5-2 flags) (path-control-flag display draw-line draw-point draw-text)) ) 0 - (set! sv-16 (new 'static 'res-tag)) - (res-lump-struct (-> this entity) 'nav-mesh-actor structure :tag-ptr (& sv-16)) - (let ((s5-3 (-> sv-16 elt-count))) - (set! (-> this nav-mesh-jumps) (new 'process 'nav-mesh-jump-array (the-as int s5-3))) - (dotimes (s4-1 (the-as int s5-3)) - (let ((v1-38 (nav-mesh-from-res-tag (-> this entity) 'nav-mesh-actor s4-1))) - (if v1-38 - (set! (-> this nav-mesh-jumps data s4-1 mesh) v1-38) - ) + (let ((sv-16 (new 'static 'res-tag))) + (res-lump-struct (-> this entity) 'nav-mesh-actor structure :tag-ptr (& sv-16)) + (let ((s5-3 (-> sv-16 elt-count))) + (set! (-> this nav-mesh-jumps) (new 'process 'nav-mesh-jump-array (the-as int s5-3))) + (dotimes (s4-1 (the-as int s5-3)) + (let ((v1-38 (nav-mesh-from-res-tag (-> this entity) 'nav-mesh-actor s4-1))) + (if v1-38 + (set! (-> this nav-mesh-jumps data s4-1 mesh) v1-38) + ) + ) ) ) ) @@ -334,35 +334,34 @@ ) (defmethod saberfish-spawner-method-22 ((this saberfish-spawner) (arg0 vector) (arg1 saberfish-find-behavior)) - (local-vars (sv-64 nav-poly) (sv-72 int) (sv-80 number) (sv-84 vector) (sv-88 symbol)) - (set! sv-64 (new 'stack-no-clear 'nav-poly)) - (set! sv-72 -1) - (set! sv-80 24576.0) - (set! sv-84 arg0) - (set! sv-88 (in-water<-find-behavior arg1)) - (set! (-> sv-64 data 20) (the-as uint 7)) - (dotimes (s4-0 (-> this nav-mesh-jumps length)) - (let ((a0-4 (-> this nav-mesh-jumps data s4-0 mesh))) - (when a0-4 - (when (or (= arg1 (saberfish-find-behavior none)) (= (-> this nav-mesh-jumps data s4-0 in-water?) sv-88)) - (vector-! (-> sv-64 vertex 0) sv-84 (the-as vector (-> a0-4 bounds))) - (let ((f0-1 (vector-length-squared (-> sv-64 vertex 0))) - (f1-0 (-> a0-4 bounds r)) - ) - (when (< f0-1 (* f1-0 f1-0)) - (set! (-> sv-64 vertex1 x) 409600.0) - (nav-mesh-method-46 a0-4 sv-64) - (when (>= (the-as float sv-80) (-> sv-64 vertex1 w)) - (set! sv-80 (-> sv-64 vertex1 w)) - (set! sv-72 s4-0) + (let ((sv-64 (new 'stack-no-clear 'nav-poly)) + (sv-72 -1) + ) + (let ((sv-80 24576.0) + (sv-84 arg0) + (sv-88 (in-water<-find-behavior arg1)) + ) + (set! (-> sv-64 data 20) (the-as uint 7)) + (dotimes (s4-0 (-> this nav-mesh-jumps length)) + (let ((a0-4 (-> this nav-mesh-jumps data s4-0 mesh))) + (when a0-4 + (when (or (= arg1 (saberfish-find-behavior none)) (= (-> this nav-mesh-jumps data s4-0 in-water?) sv-88)) + (vector-! (-> sv-64 vertex 0) sv-84 (the-as vector (-> a0-4 bounds))) + (when (< (vector-length-squared (-> sv-64 vertex 0)) (square (-> a0-4 bounds r))) + (set! (-> sv-64 vertex1 x) 409600.0) + (nav-mesh-method-46 a0-4 sv-64) + (when (>= (the-as float sv-80) (-> sv-64 vertex1 w)) + (set! sv-80 (-> sv-64 vertex1 w)) + (set! sv-72 s4-0) + ) ) ) ) ) ) ) + sv-72 ) - sv-72 ) (defmethod relocate ((this saberfish-spawner) (offset int)) @@ -398,143 +397,133 @@ ) (defmethod saberfish-spawner-method-24 ((this saberfish-spawner) (arg0 saberfish)) - (local-vars - (sv-48 float) - (sv-56 int) - (sv-64 number) - (sv-68 vector) - (sv-72 vector) - (sv-160 (function path-control vector vector symbol float)) - (sv-176 vector) - (sv-192 vector) - (sv-208 vector) - ) (set! (-> arg0 dest-nav-mesh-index) (-> arg0 desired-dest-mesh-index)) - (set! sv-48 (the-as float -1.0)) - (set! sv-56 -1) - (set! sv-64 40960000000.0) - (let ((v1-4 (new 'stack-no-clear 'vector))) + (let ((sv-48 (the-as float -1.0)) + (sv-56 -1) + (sv-64 40960000000.0) + (v1-4 (new 'stack-no-clear 'vector)) + ) (vector-copy! v1-4 (-> arg0 root trans)) - (set! sv-68 v1-4) - ) - (set! sv-72 (new 'stack-no-clear 'vector)) - (cond - ((saberfish-method-243 arg0) - (vector-! sv-72 (-> arg0 desired-dest-nav-point) (-> arg0 root trans)) - (set! (-> sv-72 y) 0.0) - ) - (else - (vector-z-quaternion! sv-72 (-> arg0 root quat)) - (set! (-> sv-72 y) 0.0) - (vector-normalize! sv-72 61440.0) - ) - ) - (set! sv-56 -1) - (when (>= (-> arg0 current-nav-mesh-index) 0) - (let ((s4-0 (-> this nav-mesh-jumps data (-> arg0 current-nav-mesh-index)))) - (dotimes (s3-0 (-> s4-0 paths length)) - (let* ((s2-0 (-> s4-0 paths data s3-0)) - (s1-0 (-> this jump-paths s2-0)) - ) - 0.0 - 0.0 - (let* ((f0-6 (cond - (#f - (path-control-method-23 s1-0 sv-68) - ) - (else - (let ((s0-0 s1-0)) - (set! sv-160 (method-of-object s0-0 path-control-method-28)) - (set! sv-176 sv-68) - (set! sv-192 sv-72) - (let ((a3-0 (not (saberfish-method-243 arg0)))) - (sv-160 s0-0 sv-176 sv-192 a3-0) + (let ((sv-68 v1-4) + (sv-72 (new 'stack-no-clear 'vector)) + ) + (cond + ((saberfish-method-243 arg0) + (vector-! sv-72 (-> arg0 desired-dest-nav-point) (-> arg0 root trans)) + (set! (-> sv-72 y) 0.0) + ) + (else + (vector-z-quaternion! sv-72 (-> arg0 root quat)) + (set! (-> sv-72 y) 0.0) + (vector-normalize! sv-72 61440.0) + ) + ) + (set! sv-56 -1) + (when (>= (-> arg0 current-nav-mesh-index) 0) + (let ((s4-0 (-> this nav-mesh-jumps data (-> arg0 current-nav-mesh-index)))) + (dotimes (s3-0 (-> s4-0 paths length)) + (let* ((s2-0 (-> s4-0 paths data s3-0)) + (s1-0 (-> this jump-paths s2-0)) + ) + 0.0 + 0.0 + (let* ((f0-6 (cond + (#f + (path-control-method-23 s1-0 sv-68) + ) + (else + (let* ((s0-0 s1-0) + (sv-160 (method-of-object s0-0 path-control-method-28)) + (sv-176 sv-68) + (sv-192 sv-72) + ) + (sv-160 s0-0 sv-176 sv-192 (not (saberfish-method-243 arg0))) + ) ) ) ) - ) - ) - (f30-0 (fmax 0.0 (fmin 1.0 f0-6))) - (s0-1 vector-vector-xz-distance) - ) - (set! sv-208 sv-68) - (let* ((a1-8 (get-point-at-percent-along-path! s1-0 (new 'stack-no-clear 'vector) f30-0 'interp)) - (f0-8 (s0-1 sv-208 a1-8)) - ) - (when (< f0-8 (the-as float sv-64)) - (set! sv-64 f0-8) - (set! sv-56 s2-0) - (set! sv-48 f30-0) + (f30-0 (fmax 0.0 (fmin 1.0 f0-6))) + (f0-8 (vector-vector-xz-distance + sv-68 + (get-point-at-percent-along-path! s1-0 (new 'stack-no-clear 'vector) f30-0 'interp) + ) + ) + ) + (when (< f0-8 (the-as float sv-64)) + (set! sv-64 f0-8) + (set! sv-56 s2-0) + (set! sv-48 f30-0) + ) ) ) ) ) ) - ) - ) - (cond - ((>= sv-56 0) - (let* ((v1-41 (if (saberfish-method-243 arg0) - -1 - 1 + (cond + ((>= sv-56 0) + (let* ((v1-41 (if (saberfish-method-243 arg0) + -1 + 1 + ) ) + (s3-1 (-> this jump-paths sv-56)) + (s4-1 (-> this jump-paths (+ sv-56 v1-41))) + ) + (if (or (< (+ sv-56 v1-41) 0) (>= (+ sv-56 v1-41) (-> this jump-paths length))) + (return 0) + ) + (let ((s2-1 (new 'stack-no-clear 'vector)) + (s5-1 (new 'stack-no-clear 'vector)) + ) + (let ((s0-2 (new 'stack-no-clear 'vector)) + (s1-1 (new 'stack-no-clear 'vector)) + (f30-1 0.4) ) - (s3-1 (-> this jump-paths sv-56)) - (s4-1 (-> this jump-paths (+ sv-56 v1-41))) - ) - (if (or (< (+ sv-56 v1-41) 0) (>= (+ sv-56 v1-41) (-> this jump-paths length))) - (return 0) - ) - (let ((s2-1 (new 'stack-no-clear 'vector)) - (s5-1 (new 'stack-no-clear 'vector)) - ) - (let ((s0-2 (new 'stack-no-clear 'vector)) - (s1-1 (new 'stack-no-clear 'vector)) - (f30-1 0.4) + (get-point-at-percent-along-path! s3-1 (-> arg0 jump-point-start) sv-48 'interp) + (if (saberfish-method-243 arg0) + (set! f30-1 0.24) + ) + (vector-! s5-1 (-> arg0 jump-point-start) (-> arg0 root trans)) + (get-point-at-percent-along-path! s3-1 s0-2 (+ -0.05 sv-48) 'interp) + (get-point-at-percent-along-path! s3-1 s1-1 (+ 0.05 sv-48) 'interp) + (vector-! s2-1 s1-1 s0-2) + (vector-normalize! s2-1 1.0) + (set! (-> s5-1 y) 0.0) + (vector-normalize! s5-1 1.0) + (when (< f30-1 (fabs (vector-dot s5-1 s2-1))) + (set! sv-48 (path-control-method-23 s3-1 sv-68)) + (get-point-at-percent-along-path! s3-1 (-> arg0 jump-point-start) sv-48 'interp) + ) ) - (get-point-at-percent-along-path! s3-1 (-> arg0 jump-point-start) sv-48 'interp) - (if (saberfish-method-243 arg0) - (set! f30-1 0.24) + (cond + ((saberfish-method-243 arg0) + (let ((f0-20 (path-control-method-28 s4-1 (-> arg0 jump-point-start) sv-72 #f))) + (get-point-at-percent-along-path! s4-1 (-> arg0 jump-point-end) f0-20 'interp) + ) + ) + (else + (let ((f0-21 (path-control-method-23 s4-1 (-> arg0 jump-point-start)))) + (get-point-at-percent-along-path! s4-1 (-> arg0 jump-point-end) f0-21 'interp) + ) + ) ) - (vector-! s5-1 (-> arg0 jump-point-start) (-> arg0 root trans)) - (get-point-at-percent-along-path! s3-1 s0-2 (+ -0.05 sv-48) 'interp) - (get-point-at-percent-along-path! s3-1 s1-1 (+ 0.05 sv-48) 'interp) - (vector-! s2-1 s1-1 s0-2) - (vector-normalize! s2-1 1.0) - (set! (-> s5-1 y) 0.0) - (vector-normalize! s5-1 1.0) - (when (< f30-1 (fabs (vector-dot s5-1 s2-1))) - (set! sv-48 (path-control-method-23 s3-1 sv-68)) - (get-point-at-percent-along-path! s3-1 (-> arg0 jump-point-start) sv-48 'interp) + (vector-! s5-1 (-> arg0 jump-point-end) (-> arg0 jump-point-start)) + (set! (-> s5-1 y) 0.0) + (vector-normalize! s5-1 1.0) ) ) - (cond - ((saberfish-method-243 arg0) - (let ((f0-20 (path-control-method-28 s4-1 (-> arg0 jump-point-start) sv-72 #f))) - (get-point-at-percent-along-path! s4-1 (-> arg0 jump-point-end) f0-20 'interp) - ) - ) - (else - (let ((f0-21 (path-control-method-23 s4-1 (-> arg0 jump-point-start)))) - (get-point-at-percent-along-path! s4-1 (-> arg0 jump-point-end) f0-21 'interp) + (let ((v1-74 (-> arg0 nav state)) + (a0-46 (-> arg0 jump-point-start)) ) - ) + (logclear! (-> v1-74 flags) (nav-state-flag directional-mode)) + (logior! (-> v1-74 flags) (nav-state-flag target-poly-dirty)) + (vector-copy! (-> v1-74 target-pos) a0-46) ) - (vector-! s5-1 (-> arg0 jump-point-end) (-> arg0 jump-point-start)) - (set! (-> s5-1 y) 0.0) - (vector-normalize! s5-1 1.0) + 0 ) - ) - (let ((v1-74 (-> arg0 nav state)) - (a0-46 (-> arg0 jump-point-start)) - ) - (logclear! (-> v1-74 flags) (nav-state-flag directional-mode)) - (logior! (-> v1-74 flags) (nav-state-flag target-poly-dirty)) - (vector-copy! (-> v1-74 target-pos) a0-46) - ) - 0 - ) - (else + (else + ) + ) ) ) 0 @@ -684,15 +673,15 @@ (defmethod init-from-entity! ((this saberfish-spawn-manager-base) (arg0 entity-actor)) "Set up a newly created process from the entity that created it." - (local-vars (sv-16 res-tag)) ;; og:preserve-this added (stack-size-set! (-> this main-thread) 2048) (set-setting! 'gem-pool-index #f 0.0 2) - (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 actor-group) :tag-ptr (& sv-16))) + ) (cond ((and v1-3 (nonzero? (-> sv-16 elt-count))) - (set! (-> this actor-group) (the-as (pointer actor-group) v1-3)) + (set! (-> this actor-group) v1-3) (set! (-> this actor-group-count) (the-as int (-> sv-16 elt-count))) ) (else diff --git a/goal_src/jak3/levels/sewer/saberfish.gc b/goal_src/jak3/levels/sewer/saberfish.gc index 4acd38899e..ae6b4c800e 100644 --- a/goal_src/jak3/levels/sewer/saberfish.gc +++ b/goal_src/jak3/levels/sewer/saberfish.gc @@ -1432,7 +1432,6 @@ (set! (-> self saberfish-y-rotate) 0.0) ) :code (behavior () - (local-vars (sv-144 vector)) (ja-channel-push! 1 (seconds 0.2)) (ja :group! saberfish-swim-180-turn-ja) (set! (-> self doing-180-spin?) #t) @@ -1482,13 +1481,11 @@ (vector-normalize! s0-0 1.0) (vector-lerp! s1-0 s0-0 s2-0 f30-5) ) - (let ((s1-1 (-> self root trans)) - (s0-1 (-> self root trans)) - ) - (set! sv-144 s2-0) - (let ((f0-13 (* (lerp 0.0 57344.0 f30-5) (seconds-per-frame)))) - (vector+float*! s1-1 s0-1 sv-144 f0-13) - ) + (vector+float*! + (-> self root trans) + (-> self root trans) + s2-0 + (* (lerp 0.0 57344.0 f30-5) (seconds-per-frame)) ) ) ) @@ -2355,28 +2352,7 @@ ;; ERROR: Unsupported inline assembly instruction kind - [madda.s f2, f5] ;; ERROR: Unsupported inline assembly instruction kind - [madd.s f1, f3, f6] (defmethod saberfish-method-238 ((this saberfish) (arg0 symbol) (arg1 float) (arg2 float)) - (local-vars - (f1-5 float) - (sv-192 vector) - (sv-196 float) - (sv-200 vector) - (sv-204 vector) - (sv-240 vector) - (sv-244 vector) - (sv-248 vector) - (sv-252 float) - (sv-256 float) - (sv-512 vector) - (sv-516 vector) - (sv-520 vector) - (sv-524 vector) - (sv-528 float) - (sv-532 float) - (sv-536 vector) - (sv-540 vector) - (sv-592 vector) - (sv-608 vector) - ) + (local-vars (f1-5 float) (sv-516 vector) (sv-524 vector) (sv-532 float) (sv-536 vector) (sv-540 vector)) (rlet ((vf0 :class vf) (vf4 :class vf) (vf5 :class vf) @@ -2398,177 +2374,162 @@ ) (arg0 (set! s3-1 #t) - (set! sv-192 (new 'stack-no-clear 'vector)) - (set! sv-196 (the-as float 30720.0)) - (set! sv-200 (vector-z-quaternion! (new 'stack-no-clear 'vector) (-> this root quat))) - (set! sv-204 (vector-x-quaternion! (new 'stack-no-clear 'vector) (-> this root quat))) - (set! (-> sv-204 y) 0.0) - (vector-normalize! sv-204 1.0) - (set! sv-240 (vector-! (new 'stack-no-clear 'vector) (-> this jump-point-start) (-> this root trans))) - (set! sv-244 sv-204) - (set! sv-248 (vector-float*! (new 'stack-no-clear 'vector) sv-204 -1.0)) - (set! sv-252 (the-as float 0.0)) - (set! sv-256 (the-as float 0.0)) - (set! (-> sv-240 y) 0.0) - (vector-normalize! sv-240 1.0) - (set! sv-252 (vector-dot sv-244 sv-240)) - (set! sv-256 (vector-dot sv-248 sv-240)) - (cond - ((< sv-256 sv-252) - (vector+float*! sv-192 (-> this root trans) sv-244 sv-196) - (vector-copy! sv-204 sv-244) - ) - (else - (vector+float*! sv-192 (-> this root trans) sv-248 sv-196) - (vector-copy! sv-204 sv-248) - ) - ) - (when (< (* sv-196 sv-196) (vector-vector-xz-distance-squared sv-192 (-> this jump-point-start))) - (set! sv-592 (new 'stack-no-clear 'vector)) - (let ((v1-33 (-> this jump-point-start)) - (a0-22 sv-192) - ) - (.lvf vf4 (&-> v1-33 quad)) - (.lvf vf5 (&-> a0-22 quad)) - ) - (.mov.vf.w vf6 vf0) - (.sub.vf.xyz vf6 vf4 vf5) - (.svf (&-> sv-592 quad) vf6) - (set! sv-608 (new 'stack-no-clear 'vector)) - (let ((s0-1 (new 'stack-no-clear 'vector)) - (s2-1 (new 'stack-no-clear 'vector)) - ) - (let ((s3-2 (new 'stack-no-clear 'vector)) - (s1-1 (new 'stack-no-clear 'vector)) - ) - 0.0 - 0.0 - (set! (-> sv-592 y) 0.0) - (let* ((f0-19 (vector-length sv-592)) - (f30-1 (sqrtf (- (* f0-19 f0-19) (* sv-196 sv-196)))) - ) - (let ((f28-0 (atan sv-196 f30-1))) - (vector-normalize! sv-592 -1.0) - (vector-rotate-y! sv-608 sv-592 f28-0) - (let ((t9-10 vector-rotate-y!) - (a0-26 s0-1) - (a2-2 (- f28-0)) - ) - (t9-10 a0-26 sv-592 a2-2) - ) - ) - (vector-normalize! sv-608 f30-1) - (vector-normalize! s0-1 f30-1) - ) - (vector+float*! s3-2 (-> this jump-point-start) sv-608 1.0) - (vector+float*! s1-1 (-> this jump-point-start) s0-1 1.0) - (vector-! sv-608 s3-2 (-> this root trans)) - (vector-! s0-1 s1-1 (-> this root trans)) - (set! (-> sv-608 y) 0.0) - (set! (-> s0-1 y) 0.0) - (let ((f30-2 (vector-normalize-ret-len! sv-608 1.0)) - (f0-28 (vector-normalize-ret-len! s0-1 1.0)) - ) - (let* ((v1-47 sv-200) - ; (f1-4 (-> sv-608 x)) - ; (f2-1 (-> sv-608 y)) - ; (f3-0 (-> sv-608 z)) - ; (f4-0 (-> v1-47 x)) - ; (f5-0 (-> v1-47 y)) - ; (f6-0 (-> v1-47 z)) - ) - ;; og:preserve-this - ; (.mula.s f1-4 f4-0) - ; (.madda.s f2-1 f5-0) - ; (.madd.s f1-5 f3-0 f6-0) - (set! f1-5 (vector-dot sv-608 v1-47)) - ) - (set! sv-252 f1-5) - (set! sv-256 (vector-dot s0-1 sv-200)) - (cond - ((< f30-2 40.96) - (vector-copy! s2-1 s3-2) - ) - ((< f0-28 40.96) - (vector-copy! s2-1 s1-1) - ) - ((< sv-256 sv-252) - (vector-copy! s2-1 s3-2) - ) - (else - (vector-copy! s2-1 s1-1) - ) - ) - ) + (let ((sv-192 (new 'stack-no-clear 'vector)) + (sv-196 (the-as float 30720.0)) + (sv-200 (vector-z-quaternion! (new 'stack-no-clear 'vector) (-> this root quat))) + (sv-204 (vector-x-quaternion! (new 'stack-no-clear 'vector) (-> this root quat))) ) - (set! (-> s2-1 y) (-> this root trans y)) + (set! (-> sv-204 y) 0.0) + (vector-normalize! sv-204 1.0) + (let ((sv-240 (vector-! (new 'stack-no-clear 'vector) (-> this jump-point-start) (-> this root trans))) + (sv-244 sv-204) + (sv-248 (vector-float*! (new 'stack-no-clear 'vector) sv-204 -1.0)) + (sv-252 (the-as float 0.0)) + (sv-256 (the-as float 0.0)) + ) + (set! (-> sv-240 y) 0.0) + (vector-normalize! sv-240 1.0) + (set! sv-252 (vector-dot sv-244 sv-240)) (cond - ((< (vector-vector-xz-distance-squared (-> this jump-point-start) s2-1) 822083600.0) - (if (< 8192.0 arg1) - (set! s3-1 #t) - (set! s3-1 #f) - ) - ) - ((begin - (let ((s3-4 (vector-! (new 'stack-no-clear 'vector) (-> this jump-point-start) (-> this jump-point-end))) - (s0-2 (new 'stack-no-clear 'vector)) - (s1-2 (new 'stack-no-clear 'vector)) - ) - (set! (-> s3-4 y) 0.0) - (vector-normalize! s3-4 1.0) - (vector-rotate-y! s0-2 s3-4 -8192.0) - (vector-rotate-y! s1-2 s3-4 8192.0) - (vector-normalize! s0-2 arg2) - (vector-normalize! s1-2 arg2) - (set! s3-1 #f) - (set! sv-512 (vector+! (new 'stack-no-clear 'vector) (-> this jump-point-start) s0-2)) - (set! sv-516 (vector+! (new 'stack-no-clear 'vector) (-> this jump-point-start) s1-2)) - (set! sv-520 (new 'stack-no-clear 'vector)) - (set! sv-524 (new 'stack-no-clear 'vector)) - (set! sv-528 (the-as float 0.0)) - (set! sv-532 (the-as float 0.0)) - (set! sv-536 (new 'stack-no-clear 'vector)) - (set! sv-540 (new 'stack-no-clear 'vector)) - (vector-copy! sv-536 (-> this root trans)) - (vector-copy! sv-540 s2-1) - (set! (-> sv-536 y) (-> sv-512 y)) - (set! (-> sv-540 y) (-> sv-512 y)) - (let ((a1-37 (vector-! (new 'stack-no-clear 'vector) sv-516 sv-512)) - (a0-60 (new 'stack-no-clear 'vector)) - (v1-76 (new 'stack-no-clear 'vector)) - ) - (set-vector! a0-60 (-> s0-2 z) 0.0 (- (-> s0-2 x)) 1.0) - (set-vector! v1-76 (- (-> s0-2 z)) 0.0 (-> s0-2 x) 1.0) - (set! sv-252 (vector-dot a0-60 a1-37)) - (if (< 0.0 sv-252) - (vector-copy! sv-520 a0-60) - (vector-copy! sv-520 v1-76) - ) - (set-vector! a0-60 (-> s1-2 z) 0.0 (- (-> s1-2 x)) 1.0) - (set-vector! v1-76 (- (-> s1-2 z)) 0.0 (-> s1-2 x) 1.0) - (set! sv-252 (vector-dot a0-60 a1-37)) - (if (< 0.0 sv-252) - (vector-copy! sv-524 v1-76) - (vector-copy! sv-524 a0-60) - ) - ) - ) - (vector-normalize! sv-520 1.0) - (vector-normalize! sv-524 1.0) - (set! sv-528 (vector-dot sv-520 sv-512)) - (set! sv-252 (vector-dot sv-520 sv-536)) - (set! sv-256 (vector-dot sv-520 sv-540)) - (or (< sv-252 sv-528) (< sv-256 sv-528)) - ) - (set! s3-1 #t) + ((< (vector-dot sv-248 sv-240) sv-252) + (vector+float*! sv-192 (-> this root trans) sv-244 sv-196) + (vector-copy! sv-204 sv-244) ) (else - (set! sv-532 (vector-dot sv-524 sv-516)) - (set! sv-252 (vector-dot sv-524 sv-536)) - (set! sv-256 (vector-dot sv-524 sv-540)) - (if (or (< sv-252 sv-532) (< sv-256 sv-532)) - (set! s3-1 #t) + (vector+float*! sv-192 (-> this root trans) sv-248 sv-196) + (vector-copy! sv-204 sv-248) + ) + ) + (when (< (* sv-196 sv-196) (vector-vector-xz-distance-squared sv-192 (-> this jump-point-start))) + (let ((sv-592 (new 'stack-no-clear 'vector))) + (let ((a0-22 sv-192)) + (.lvf vf4 (&-> (-> this jump-point-start) quad)) + (.lvf vf5 (&-> a0-22 quad)) + ) + (.mov.vf.w vf6 vf0) + (.sub.vf.xyz vf6 vf4 vf5) + (.svf (&-> sv-592 quad) vf6) + (let ((sv-608 (new 'stack-no-clear 'vector)) + (s0-1 (new 'stack-no-clear 'vector)) + (s2-1 (new 'stack-no-clear 'vector)) + ) + (let ((s3-2 (new 'stack-no-clear 'vector)) + (s1-1 (new 'stack-no-clear 'vector)) + ) + 0.0 + 0.0 + (set! (-> sv-592 y) 0.0) + (let ((f30-1 (sqrtf (- (square (vector-length sv-592)) (* sv-196 sv-196))))) + (let ((f28-0 (atan sv-196 f30-1))) + (vector-normalize! sv-592 -1.0) + (vector-rotate-y! sv-608 sv-592 f28-0) + (vector-rotate-y! s0-1 sv-592 (- f28-0)) + ) + (vector-normalize! sv-608 f30-1) + (vector-normalize! s0-1 f30-1) + ) + (vector+float*! s3-2 (-> this jump-point-start) sv-608 1.0) + (vector+float*! s1-1 (-> this jump-point-start) s0-1 1.0) + (vector-! sv-608 s3-2 (-> this root trans)) + (vector-! s0-1 s1-1 (-> this root trans)) + (set! (-> sv-608 y) 0.0) + (set! (-> s0-1 y) 0.0) + (let ((f30-2 (vector-normalize-ret-len! sv-608 1.0)) + (f0-28 (vector-normalize-ret-len! s0-1 1.0)) + ) + (let* ((v1-47 sv-200)) + (set! f1-5 (vector-dot sv-608 v1-47)) + ) + (set! sv-252 f1-5) + (set! sv-256 (vector-dot s0-1 sv-200)) + (cond + ((< f30-2 40.96) + (vector-copy! s2-1 s3-2) + ) + ((< f0-28 40.96) + (vector-copy! s2-1 s1-1) + ) + ((< sv-256 sv-252) + (vector-copy! s2-1 s3-2) + ) + (else + (vector-copy! s2-1 s1-1) + ) + ) + ) ) + (set! (-> s2-1 y) (-> this root trans y)) + (cond + ((< (vector-vector-xz-distance-squared (-> this jump-point-start) s2-1) 822083600.0) + (if (< 8192.0 arg1) + (set! s3-1 #t) + (set! s3-1 #f) + ) + ) + ((let ((s3-4 (vector-! (new 'stack-no-clear 'vector) (-> this jump-point-start) (-> this jump-point-end))) + (s0-2 (new 'stack-no-clear 'vector)) + (s1-2 (new 'stack-no-clear 'vector)) + ) + (set! (-> s3-4 y) 0.0) + (vector-normalize! s3-4 1.0) + (vector-rotate-y! s0-2 s3-4 -8192.0) + (vector-rotate-y! s1-2 s3-4 8192.0) + (vector-normalize! s0-2 arg2) + (vector-normalize! s1-2 arg2) + (set! s3-1 #f) + (let ((sv-512 (vector+! (new 'stack-no-clear 'vector) (-> this jump-point-start) s0-2))) + (set! sv-516 (vector+! (new 'stack-no-clear 'vector) (-> this jump-point-start) s1-2)) + (let ((sv-520 (new 'stack-no-clear 'vector))) + (set! sv-524 (new 'stack-no-clear 'vector)) + (let ((sv-528 (the-as float 0.0))) + (set! sv-532 (the-as float 0.0)) + (set! sv-536 (new 'stack-no-clear 'vector)) + (set! sv-540 (new 'stack-no-clear 'vector)) + (vector-copy! sv-536 (-> this root trans)) + (vector-copy! sv-540 s2-1) + (set! (-> sv-536 y) (-> sv-512 y)) + (set! (-> sv-540 y) (-> sv-512 y)) + (let ((a1-37 (vector-! (new 'stack-no-clear 'vector) sv-516 sv-512)) + (a0-60 (new 'stack-no-clear 'vector)) + (v1-76 (new 'stack-no-clear 'vector)) + ) + (set-vector! a0-60 (-> s0-2 z) 0.0 (- (-> s0-2 x)) 1.0) + (set-vector! v1-76 (- (-> s0-2 z)) 0.0 (-> s0-2 x) 1.0) + (set! sv-252 (vector-dot a0-60 a1-37)) + (if (< 0.0 sv-252) + (vector-copy! sv-520 a0-60) + (vector-copy! sv-520 v1-76) + ) + (set-vector! a0-60 (-> s1-2 z) 0.0 (- (-> s1-2 x)) 1.0) + (set-vector! v1-76 (- (-> s1-2 z)) 0.0 (-> s1-2 x) 1.0) + (set! sv-252 (vector-dot a0-60 a1-37)) + (if (< 0.0 sv-252) + (vector-copy! sv-524 v1-76) + (vector-copy! sv-524 a0-60) + ) + ) + (vector-normalize! sv-520 1.0) + (vector-normalize! sv-524 1.0) + (set! sv-528 (vector-dot sv-520 sv-512)) + (set! sv-252 (vector-dot sv-520 sv-536)) + (set! sv-256 (vector-dot sv-520 sv-540)) + (or (< sv-252 sv-528) (< sv-256 sv-528)) + ) + ) + ) + ) + (set! s3-1 #t) + ) + (else + (set! sv-532 (vector-dot sv-524 sv-516)) + (set! sv-252 (vector-dot sv-524 sv-536)) + (set! sv-256 (vector-dot sv-524 sv-540)) + (if (or (< sv-252 sv-532) (< sv-256 sv-532)) + (set! s3-1 #t) + ) + ) + ) + ) ) ) ) @@ -2656,50 +2617,57 @@ ) (defmethod saberfish-method-231 ((this saberfish) (arg0 vector) (arg1 float) (arg2 symbol) (arg3 vector)) - (local-vars (sv-64 vector) (sv-68 vector) (sv-72 float) (sv-76 float) (sv-80 vector) (sv-84 float)) - (set! sv-64 (new 'stack-no-clear 'vector)) - (set! sv-68 (new 'stack-no-clear 'vector)) - (set! sv-72 (the-as float 0.0)) - (set! sv-76 (the-as float 0.0)) - (set! sv-80 (new 'stack-no-clear 'vector)) - (set! sv-84 (the-as float -1.0)) - (if arg2 - (vector-copy! sv-64 arg3) - (vector-! sv-64 (-> this jump-point-start) (-> this jump-point-end)) - ) - (set! (-> sv-64 y) 0.0) - (set! sv-76 arg1) - (vector-normalize-copy! sv-68 sv-64 1.0) - (let ((s3-0 (saberfish-method-236 this (-> this current-nav-mesh-index))) - (s2-0 (new 'stack-no-clear 'clamp-travel-vector-to-mesh-return-info)) - (s1-0 (saberfish-method-233 this)) + (let ((sv-64 (new 'stack-no-clear 'vector)) + (sv-68 (new 'stack-no-clear 'vector)) + (sv-72 (the-as float 0.0)) + (sv-76 (the-as float 0.0)) + (sv-80 (new 'stack-no-clear 'vector)) + (sv-84 (the-as float -1.0)) ) - 0.0 - (when s1-0 - (dotimes (s0-0 13) - (vector-rotate-y! sv-64 sv-68 sv-72) - (vector-normalize! sv-64 94208.0) - (clamp-vector-to-mesh-no-gaps s3-0 (-> this root trans) s1-0 sv-64 s2-0) - (vector+! arg0 (-> this root trans) sv-64) - (let ((f0-7 (vector-length sv-64))) - (when (< 84787.195 f0-7) - (set! (-> arg0 y) (-> this water surface-height)) - (return #t) - ) - (when (< sv-84 f0-7) - (set! sv-84 f0-7) - (vector-copy! sv-80 arg0) - ) + (if arg2 + (vector-copy! sv-64 arg3) + (vector-! sv-64 (-> this jump-point-start) (-> this jump-point-end)) + ) + (set! (-> sv-64 y) 0.0) + (set! sv-76 arg1) + (vector-normalize-copy! sv-68 sv-64 1.0) + (let ((s3-0 (saberfish-method-236 this (-> this current-nav-mesh-index))) + (s2-0 (new 'stack-no-clear 'clamp-travel-vector-to-mesh-return-info)) + (s1-0 (saberfish-method-233 this)) ) - (if (= (logand s0-0 1) 1) - (set! sv-72 (+ sv-72 sv-76)) - (set! sv-72 (- sv-72 sv-76)) + 0.0 + (when s1-0 + (dotimes (s0-0 13) + (vector-rotate-y! sv-64 sv-68 sv-72) + (vector-normalize! sv-64 94208.0) + (clamp-vector-to-mesh-no-gaps s3-0 (-> this root trans) s1-0 sv-64 s2-0) + (vector+! arg0 (-> this root trans) sv-64) + (let ((f0-7 (vector-length sv-64))) + (when (< 84787.195 f0-7) + (set! (-> arg0 y) (-> this water surface-height)) + (return #t) + ) + (when (< sv-84 f0-7) + (set! sv-84 f0-7) + (vector-copy! sv-80 arg0) + ) ) - (set! sv-76 (+ sv-76 arg1)) + (set! sv-72 (cond + ((= (logand s0-0 1) 1) + (+! sv-72 sv-76) + sv-72 + ) + (else + (- sv-72 sv-76) + ) + ) + ) + (+! sv-76 arg1) + ) + (vector-copy! arg0 sv-80) + (set! (-> arg0 y) (-> this water surface-height)) + (return #t) ) - (vector-copy! arg0 sv-80) - (set! (-> arg0 y) (-> this water surface-height)) - (return #t) ) ) #f @@ -2993,13 +2961,11 @@ (f1-0 (-> v1-4 trans y)) (a0-2 (-> this fact)) ) - (when (and (< f0-0 (+ f1-0 (-> a0-2 notice-top))) (< (- f1-0 (-> a0-2 notice-bottom)) f0-0)) - (let ((f0-1 (-> this enemy-info notice-nav-radius))) - (or (>= (* f0-1 f0-1) (vector-vector-xz-distance-squared (-> v1-4 trans) arg1)) + (if (and (< f0-0 (+ f1-0 (-> a0-2 notice-top))) (< (- f1-0 (-> a0-2 notice-bottom)) f0-0)) + (or (>= (square (-> this enemy-info notice-nav-radius)) (vector-vector-xz-distance-squared (-> v1-4 trans) arg1)) (>= (get-nav-mesh-idx this arg1 (saberfish-find-behavior none)) 0) ) ) - ) ) ) ) diff --git a/goal_src/jak3/levels/sewer/sewer-obs.gc b/goal_src/jak3/levels/sewer/sewer-obs.gc index 0a86da67e1..fd3c80b7b2 100644 --- a/goal_src/jak3/levels/sewer/sewer-obs.gc +++ b/goal_src/jak3/levels/sewer/sewer-obs.gc @@ -1383,7 +1383,6 @@ (defmethod init-from-entity! ((this sew-wall-switch) (arg0 entity-actor)) "Set up a newly created process from the entity that created it." - (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-sphere s4-0 (the-as uint 0)))) (set! (-> v1-2 prim-core collide-as) (collide-spec obstacle)) @@ -1407,11 +1406,12 @@ (the-as skeleton-group (art-group-get-by-name *level* "skel-sew-wall-switch" (the-as (pointer level) #f))) (the-as pair 0) ) - (set! sv-16 (new 'static 'res-tag)) - (set! (-> this actor-group) - (res-lump-data (-> this entity) 'actor-groups (pointer actor-group) :tag-ptr (& sv-16)) - ) - (set! (-> this actor-group-count) (the-as int (-> sv-16 elt-count))) + (let ((sv-16 (new 'static 'res-tag))) + (set! (-> this actor-group) + (res-lump-data (-> this entity) 'actor-groups (pointer actor-group) :tag-ptr (& sv-16)) + ) + (set! (-> this actor-group-count) (the-as int (-> sv-16 elt-count))) + ) (cond ((and (-> this entity) (logtest? (-> this entity extra perm status) (entity-perm-status subtask-complete))) (go (method-of-object this opened)) @@ -1889,27 +1889,23 @@ (-> self part) (vector<-cspace! (new 'stack-no-clear 'vector) (joint-node sew-gas-step-lod0-jg poison_gas)) ) - (let ((f0-7 (vector-vector-xz-distance-squared (target-pos 0) (-> self root trans))) - (f1-0 14336.0) - ) - (when (< f0-7 (* f1-0 f1-0)) - (let ((a0-9 (the-as target (as-type *target* process-focusable)))) - (if a0-9 - (send-event - a0-9 - 'attack - #f - (static-attack-info :mask (vehicle-impulse-factor) ((id (the-as uint (-> self attack-id))) - (damage 2.0) - (vehicle-damage-factor 1.0) - (vehicle-impulse-factor 1.0) - (shove-back (meters 3)) - (shove-up (meters 3)) - ) - ) - ) + (when (< (vector-vector-xz-distance-squared (target-pos 0) (-> self root trans)) (square 14336.0)) + (let ((a0-9 (the-as target (as-type *target* process-focusable)))) + (if a0-9 + (send-event + a0-9 + 'attack + #f + (static-attack-info :mask (vehicle-impulse-factor) ((id (the-as uint (-> self attack-id))) + (damage 2.0) + (vehicle-damage-factor 1.0) + (vehicle-impulse-factor 1.0) + (shove-back (meters 3)) + (shove-up (meters 3)) + ) + ) ) - ) + ) ) ) (suspend) diff --git a/goal_src/jak3/levels/sewer/sewer-obs2.gc b/goal_src/jak3/levels/sewer/sewer-obs2.gc index e0ee4baa53..9abfa71245 100644 --- a/goal_src/jak3/levels/sewer/sewer-obs2.gc +++ b/goal_src/jak3/levels/sewer/sewer-obs2.gc @@ -253,7 +253,6 @@ (defmethod init-from-entity! ((this sew-m-gate) (arg0 entity-actor)) "Set up a newly created process from the entity that created it." - (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)) @@ -278,11 +277,12 @@ (the-as pair 0) ) (logclear! (-> this mask) (process-mask actor-pause)) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-13 (res-lump-data (-> this entity) 'actor-groups pointer :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-13 (res-lump-data (-> this entity) 'actor-groups (pointer actor-group) :tag-ptr (& sv-16))) + ) (cond ((and v1-13 (nonzero? (-> sv-16 elt-count))) - (set! (-> this actor-group) (the-as (pointer actor-group) v1-13)) + (set! (-> this actor-group) v1-13) (set! (-> this actor-group-count) (the-as int (-> sv-16 elt-count))) ) (else @@ -401,7 +401,6 @@ (defmethod init-from-entity! ((this sew-pipe) (arg0 entity-actor)) "Set up a newly created process from the entity that created it." - (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)) @@ -426,11 +425,12 @@ (the-as pair 0) ) (logclear! (-> this mask) (process-mask actor-pause)) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-13 (res-lump-data (-> this entity) 'actor-groups pointer :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-13 (res-lump-data (-> this entity) 'actor-groups (pointer actor-group) :tag-ptr (& sv-16))) + ) (cond ((and v1-13 (nonzero? (-> sv-16 elt-count))) - (set! (-> this actor-group) (the-as (pointer actor-group) v1-13)) + (set! (-> this actor-group) v1-13) (set! (-> this actor-group-count) (the-as int (-> sv-16 elt-count))) ) (else diff --git a/goal_src/jak3/levels/stadium/dm-mine-spider.gc b/goal_src/jak3/levels/stadium/dm-mine-spider.gc index c18f402dfe..b9305b42fb 100644 --- a/goal_src/jak3/levels/stadium/dm-mine-spider.gc +++ b/goal_src/jak3/levels/stadium/dm-mine-spider.gc @@ -1200,7 +1200,6 @@ ) (defmethod dm-mine-spider-spawner-method-31 ((this dm-mine-spider-spawner)) - (local-vars (sv-16 process-tree)) (let ((s2-0 (-> this child)) (s5-0 0) ) @@ -1208,17 +1207,18 @@ (s3-0 0.0) ) (while s2-0 - (set! sv-16 (as-type (-> s2-0 0) dm-mine-spider)) - (when sv-16 - (when (not (logtest? (-> (the-as dm-mine-spider sv-16) draw status) (draw-control-status on-screen))) - (let ((f0-0 (vector-vector-xz-distance (-> (the-as dm-mine-spider sv-16) root trans) (target-pos 0)))) - (if (< (the float s3-0) f0-0) - (set! s3-0 f0-0) - ) + (let ((sv-16 (as-type (-> s2-0 0) dm-mine-spider))) + (when sv-16 + (when (not (logtest? (-> (the-as dm-mine-spider sv-16) draw status) (draw-control-status on-screen))) + (let ((f0-0 (vector-vector-xz-distance (-> (the-as dm-mine-spider sv-16) root trans) (target-pos 0)))) + (if (< (the float s3-0) f0-0) + (set! s3-0 f0-0) + ) + ) + (+! s4-0 1) ) - (+! s4-0 1) + (+! s5-0 1) ) - (+! s5-0 1) ) (set! s2-0 (-> s2-0 0 brother)) ) @@ -1366,7 +1366,6 @@ ) ) :trans (behavior () - (local-vars (sv-112 vector)) (dm-mine-spider-spawner-method-31 self) (when (and (< (-> self count-alive) (-> self count-max)) *target* @@ -1386,16 +1385,11 @@ (when (dm-mine-spider-spawner-method-33 self s5-1) (let ((gp-1 (new 'stack-no-clear 'enemy-init-by-other-params))) (vector-copy! (-> gp-1 trans) s5-1) - (let ((s5-2 quaternion-copy!) - (s4-0 (-> gp-1 quat)) - (s3-0 quaternion<-rotate-y-vector) - (s2-0 (new 'stack-no-clear 'quaternion)) - (s1-0 vector-normalize!) - (s0-0 (new 'stack-no-clear 'vector)) - ) - (set! sv-112 (-> self root trans)) - (let ((v0-7 (target-pos 0))) - (s5-2 s4-0 (s3-0 s2-0 (s1-0 (vector-! s0-0 sv-112 v0-7) 1.0))) + (quaternion-copy! + (-> gp-1 quat) + (quaternion<-rotate-y-vector + (new 'stack-no-clear 'quaternion) + (vector-normalize! (vector-! (new 'stack-no-clear 'vector) (-> self root trans) (target-pos 0)) 1.0) ) ) (set! (-> gp-1 entity) (-> self alt-actor)) @@ -1505,7 +1499,6 @@ ;; WARN: Return type mismatch none vs object. (defmethod init-from-entity! ((this dm-mine-spider-spawner) (arg0 entity-actor)) "Set up a newly created process from the entity that created it." - (local-vars (sv-16 res-tag) (sv-32 vector)) (logior! (-> this mask) (process-mask enemy)) (let ((s4-0 (new 'process 'collide-shape this (collide-list-enum usually-hit-by-player)))) (let ((v0-1 (new 'process 'collide-shape-prim-sphere s4-0 (the-as uint 0)))) @@ -1533,35 +1526,25 @@ ) (the-as pair 0) ) - (set! sv-16 (new 'static 'res-tag)) - (res-lump-data (-> this entity) 'nav-mesh-actor pointer :tag-ptr (& sv-16)) - (set! (-> this num-nav-mesh) (the-as int (-> sv-16 elt-count))) - (when (> (-> this num-nav-mesh) 0) - (let ((s4-2 (get-process *default-dead-pool* simple-nav-sphere #x4000 1))) + (let ((sv-16 (new 'static 'res-tag))) + (res-lump-data (-> this entity) 'nav-mesh-actor pointer :tag-ptr (& sv-16)) + (set! (-> this num-nav-mesh) (the-as int (-> sv-16 elt-count))) + ) + (if (> (-> this num-nav-mesh) 0) (set! (-> this nav-sphere) (ppointer->handle - (when s4-2 - (let ((t9-7 (method-of-type simple-nav-sphere activate))) - (t9-7 (the-as simple-nav-sphere s4-2) this "simple-nav-sphere" (the-as pointer #x70004000)) - ) - (let ((s3-1 run-function-in-process) - (s2-0 s4-2) - (s1-0 simple-nav-sphere-init-by-other) - (s0-0 #x46800000) - ) - (set! sv-32 (-> this root trans)) - (let ((t0-1 (nav-mesh-from-res-tag (-> this entity) 'nav-mesh-actor 0)) - (t1-1 -1) - ) - ((the-as (function object object object object object object none) s3-1) s2-0 s1-0 s0-0 sv-32 t0-1 t1-1) - ) - ) - (-> s4-2 ppointer) + (process-spawn + simple-nav-sphere + #x46800000 + (-> this root trans) + (nav-mesh-from-res-tag (-> this entity) 'nav-mesh-actor 0) + -1 + :name "simple-nav-sphere" + :to this ) ) ) ) - ) (set! (-> this alt-actor) (entity-actor-lookup arg0 'alt-actor 0)) (set! (-> this count-max) (res-lump-value (-> this entity) 'max-count int :default (the-as uint128 5) :time -1000000000.0) diff --git a/goal_src/jak3/levels/stadium/king-rider.gc b/goal_src/jak3/levels/stadium/king-rider.gc index f2a6a3cc3f..0b056ef220 100644 --- a/goal_src/jak3/levels/stadium/king-rider.gc +++ b/goal_src/jak3/levels/stadium/king-rider.gc @@ -123,10 +123,9 @@ ) (let ((v1-14 (-> *target* pilot))) (when (time-elapsed? (-> self complain-time) (seconds 3)) - (let* ((f0-0 1228800.0) - (f0-2 (* f0-0 f0-0)) - (a0-7 (-> v1-14 accel-array)) - ) + (let ((f0-2 (square 1228800.0)) + (a0-7 (-> v1-14 accel-array)) + ) (when (or (< f0-2 (+ (* (-> a0-7 0 x) (-> a0-7 0 x)) (* (-> a0-7 0 z) (-> a0-7 0 z)))) (< 4915200.0 (fabs (-> v1-14 accel-array 0 y))) ) @@ -136,11 +135,9 @@ ) ) ) - (let ((f0-4 20480.0)) - (if (< (* f0-4 f0-4) (vector-length-squared (-> *target* control transv))) - (set-time! (-> self last-moved-time)) - ) - ) + (if (< (square 20480.0) (vector-length-squared (-> *target* control transv))) + (set-time! (-> self last-moved-time)) + ) (if (time-elapsed? (-> self last-moved-time) (seconds 8)) (set! (-> self last-moved-time) (+ (current-time) (seconds 24))) ) diff --git a/goal_src/jak3/levels/stadium/rubble-attack.gc b/goal_src/jak3/levels/stadium/rubble-attack.gc index a0fbca77f2..cc4cece663 100644 --- a/goal_src/jak3/levels/stadium/rubble-attack.gc +++ b/goal_src/jak3/levels/stadium/rubble-attack.gc @@ -59,14 +59,10 @@ (sound-play "firebomb") ) (((projectile-options po0 po1)) - (let ((f0-0 (vector-vector-distance-squared (-> this root trans) (-> this desired-target-pos))) - (f1-0 614400.0) - ) - (when (< f0-0 (* f1-0 f1-0)) - (let ((a0-6 (static-sound-spec "incoming" :group 0 :volume 0.0))) - (set! (-> a0-6 volume) 1024) - (sound-play-by-spec a0-6 (-> this sound-id) (-> this root trans)) - ) + (when (< (vector-vector-distance-squared (-> this root trans) (-> this desired-target-pos)) (square 614400.0)) + (let ((a0-6 (static-sound-spec "incoming" :group 0 :volume 0.0))) + (set! (-> a0-6 volume) 1024) + (sound-play-by-spec a0-6 (-> this sound-id) (-> this root trans)) ) ) ) @@ -137,20 +133,16 @@ ) (set-vector! (-> self root scale) f0-2 1.0 f0-2 1.0) ) - (let ((f0-4 (vector-vector-distance-squared (-> self root trans) (the-as vector gp-0))) - (f1-2 409600.0) + (when (< (vector-vector-distance-squared (-> self root trans) (the-as vector gp-0)) (square 409600.0)) + (if (not (and (-> self next-state) (= (-> self next-state name) 'lock))) + (go-virtual lock) ) - (when (< f0-4 (* f1-2 f1-2)) - (if (not (and (-> self next-state) (= (-> self next-state name) 'lock))) - (go-virtual lock) + (when (time-elapsed? (-> self blink-timer) (seconds 0.05)) + (if (logtest? (-> self draw status) (draw-control-status no-draw)) + (send-event self 'on) + (send-event self 'off) ) - (when (time-elapsed? (-> self blink-timer) (seconds 0.05)) - (if (logtest? (-> self draw status) (draw-control-status no-draw)) - (send-event self 'on) - (send-event self 'off) - ) - (set-time! (-> self blink-timer)) - ) + (set-time! (-> self blink-timer)) ) ) ) @@ -452,7 +444,6 @@ ;; WARN: Function (method 32 rubble-attack-manager) has a return type of none, but the expression builder found a return statement. (defmethod spawn-missile ((this rubble-attack-manager)) - (local-vars (sv-816 vector) (sv-832 (function vector quaternion vector)) (sv-848 vector)) (when *target* (let ((s5-0 (new 'stack-no-clear 'vector)) (s3-0 (target-pos 0)) @@ -461,17 +452,12 @@ (when (-> this missile-spawners) (let ((f30-0 0.0)) (dotimes (s4-0 (length (-> this missile-spawners))) - (let ((s1-0 (-> this missile-spawners s4-0)) - (s0-0 vector-vector-xz-distance) - ) - (set! sv-816 s1-0) - (let* ((a1-0 (target-pos 0)) - (f28-0 (s0-0 sv-816 a1-0)) - ) - (when (and (sphere-in-view-frustum? (sphere<-vector+r! (new 'stack-no-clear 'sphere) s1-0 81920.0)) (< f30-0 f28-0)) - (set! f30-0 f28-0) - (set! s2-0 s1-0) - ) + (let* ((s1-0 (-> this missile-spawners s4-0)) + (f28-0 (vector-vector-xz-distance s1-0 (target-pos 0))) + ) + (when (and (sphere-in-view-frustum? (sphere<-vector+r! (new 'stack-no-clear 'sphere) s1-0 81920.0)) (< f30-0 f28-0)) + (set! f30-0 f28-0) + (set! s2-0 s1-0) ) ) ) @@ -510,15 +496,7 @@ (vector-copy! s1-1 s2-0) ) (else - (let ((s0-2 s1-1) - (s2-1 vector-normalize!) - ) - (set! sv-832 vector-z-quaternion!) - (set! sv-848 s1-1) - (let ((a1-8 (target-rot))) - (vector+! s0-2 s3-0 (s2-1 (sv-832 sv-848 a1-8) 409600.0)) - ) - ) + (vector+! s1-1 s3-0 (vector-normalize! (vector-z-quaternion! s1-1 (target-rot)) 409600.0)) (+! (-> s1-1 y) 1228800.0) ) ) diff --git a/goal_src/jak3/levels/stadium/rubble-obs.gc b/goal_src/jak3/levels/stadium/rubble-obs.gc index 69977a71cf..f514ea55b0 100644 --- a/goal_src/jak3/levels/stadium/rubble-obs.gc +++ b/goal_src/jak3/levels/stadium/rubble-obs.gc @@ -728,7 +728,6 @@ (defmethod init-from-entity! ((this rub-elec-gate) (arg0 entity-actor)) "Set up a newly created process from the entity that created it." - (local-vars (sv-16 res-tag)) (set! (-> this root) (new 'process 'trsqv)) (process-drawable-from-entity! this arg0) (logclear! (-> this mask) (process-mask actor-pause)) @@ -762,12 +761,13 @@ (set! (-> this sound) (new 'process 'ambient-sound "ruins-gate-hum" (-> this root trans) 0.0)) (set! (-> this hit-sound-id) (new-sound-id)) (set! (-> this entity) arg0) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-31 (res-lump-data arg0 'actor-groups pointer :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-31 (res-lump-data arg0 'actor-groups (pointer actor-group) :tag-ptr (& sv-16))) + ) (cond ((and v1-31 (nonzero? (-> sv-16 elt-count))) (set! (-> this actor-group-count) (the-as int (-> sv-16 elt-count))) - (set! (-> this actor-group) (the-as (pointer actor-group) v1-31)) + (set! (-> this actor-group) v1-31) ) (else (format 0 "ERROR: entity missing actor-group!~%") diff --git a/goal_src/jak3/levels/temple/hover-training.gc b/goal_src/jak3/levels/temple/hover-training.gc index 392469ecde..494ee86fb9 100644 --- a/goal_src/jak3/levels/temple/hover-training.gc +++ b/goal_src/jak3/levels/temple/hover-training.gc @@ -410,12 +410,6 @@ (sound-stop (-> self sound-id)) ) :trans (behavior () - (local-vars - (sv-752 (function cubic-curve vector vector vector vector none)) - (sv-768 vector) - (sv-784 vector) - (sv-800 vector) - ) (let ((s3-0 (res-lump-value (-> self entity) 'extra-id uint128 :default (the-as uint128 -1) :time -1000000000.0))) (if (>= (the-as int s3-0) 0) (sound-play-by-name @@ -507,14 +501,12 @@ ) (dotimes (s1-2 (+ s3-1 -1)) (when (and (>= (-> self path-pos) (the float s1-2)) (>= (the float (+ s1-2 1)) (-> self path-pos))) - (let ((s0-0 s2-2)) - (set! sv-752 (method-of-type cubic-curve cubic-curve-method-9)) - (set! sv-768 (-> gp-4 s1-2)) - (set! sv-784 (vector-normalize-copy! (new 'stack-no-clear 'vector) (-> s5-4 s1-2) 40960.0)) - (set! sv-800 (-> gp-4 (+ s1-2 1))) - (let ((t0-7 (vector-normalize-copy! (new 'stack-no-clear 'vector) (-> s5-4 (+ s1-2 1)) 40960.0))) - (sv-752 s0-0 sv-768 sv-784 sv-800 t0-7) - ) + (cubic-curve-method-9 + s2-2 + (-> gp-4 s1-2) + (vector-normalize-copy! (new 'stack-no-clear 'vector) (-> s5-4 s1-2) 40960.0) + (-> gp-4 (+ s1-2 1)) + (vector-normalize-copy! (new 'stack-no-clear 'vector) (-> s5-4 (+ s1-2 1)) 40960.0) ) (vector-lerp! (-> self dest) (-> gp-4 s1-2) (-> gp-4 (+ s1-2 1)) (- (-> self path-pos) (the float s1-2))) (+! (-> self path-pos) (/ (* f30-2 (seconds-per-frame)) @@ -574,7 +566,6 @@ (defmethod init-from-entity! ((this tpl-token) (arg0 entity-actor)) "Set up a newly created process from the entity that created it." - (local-vars (sv-16 res-tag)) (with-pp (let ((s4-0 (new 'process 'collide-shape-moving this (collide-list-enum usually-hit-by-player)))) (set! (-> s4-0 dynam) (copy *standard-dynamics* 'process)) @@ -607,12 +598,13 @@ ) (set! (-> this path-pos) 0.0) (transform-post) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-23 (res-lump-data arg0 'actor-groups pointer :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-23 (res-lump-data arg0 'actor-groups (pointer actor-group) :tag-ptr (& sv-16))) + ) (cond ((and v1-23 (nonzero? (-> sv-16 elt-count))) (set! (-> this actor-group-count) (the-as int (-> sv-16 elt-count))) - (set! (-> this actor-group) (the-as (pointer actor-group) v1-23)) + (set! (-> this actor-group) v1-23) ) (else (set! (-> this actor-group-count) 0) @@ -895,16 +887,16 @@ (defmethod init-from-entity! ((this hover-training-manager) (arg0 entity-actor)) "Set up a newly created process from the entity that created it." - (local-vars (sv-16 res-tag)) (process-entity-set! this arg0) (logclear! (-> this mask) (process-mask actor-pause)) (set! (-> this gui-id) (new 'static 'sound-id)) (set! (-> this hud-counter) (the-as handle #f)) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-3 (res-lump-data arg0 'actor-groups pointer :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-3 (res-lump-data arg0 'actor-groups (pointer actor-group) :tag-ptr (& sv-16))) + ) (when (and v1-3 (nonzero? (-> sv-16 elt-count))) (set! (-> this actor-group-count) (the-as int (-> sv-16 elt-count))) - (set! (-> this actor-group) (the-as (pointer actor-group) v1-3)) + (set! (-> this actor-group) v1-3) ) ) (if (task-node-closed? (game-task-node temple-tests-hover-training)) diff --git a/goal_src/jak3/levels/temple/temple-obs.gc b/goal_src/jak3/levels/temple/temple-obs.gc index a262494cf4..3dcf8f6f70 100644 --- a/goal_src/jak3/levels/temple/temple-obs.gc +++ b/goal_src/jak3/levels/temple/temple-obs.gc @@ -930,11 +930,9 @@ ) (vector-copy! (-> self other-eyeball-jmod transform scale) (-> self root scale)) (vector-copy! (-> self eyeball-jmod transform scale) (-> self root scale)) - (let* ((f0-9 (lerp-scale 1.0 0.0 (the float (- (current-time) (-> self state-time))) 0.0 60.0)) - (f0-11 (* f0-9 f0-9)) - ) - (set! (-> self root scale x) (* f0-11 f0-11)) - ) + (set! (-> self root scale x) + (square (square (lerp-scale 1.0 0.0 (the float (- (current-time) (-> self state-time))) 0.0 60.0))) + ) (set! (-> self root scale y) (+ 1.0 (/ (-> self root scale x) 2))) (set! (-> self root scale z) (-> self root scale x)) (when (= (-> self root scale x) 0.0) @@ -992,8 +990,7 @@ (defmethod init-from-entity! ((this tpl-holo-eye) (arg0 entity-actor)) "Set up a newly created process from the entity that created it." - (local-vars (sv-16 res-tag)) - (stack-size-set! (-> this main-thread) 320) + (stack-size-set! (-> this main-thread) 384) (set! (-> this root) (new 'process 'trsqv)) (process-drawable-from-entity! this arg0) (initialize-skeleton @@ -1002,12 +999,13 @@ (the-as pair 0) ) (set! (-> this trigger-radius) (res-lump-float (-> this entity) 'holo-eye-activate-radius :default 77824.0)) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-8 (res-lump-data arg0 'actor-groups pointer :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-8 (res-lump-data arg0 'actor-groups (pointer actor-group) :tag-ptr (& sv-16))) + ) (cond ((and v1-8 (nonzero? (-> sv-16 elt-count))) (set! (-> this actor-group-count) (the-as int (-> sv-16 elt-count))) - (set! (-> this actor-group) (the-as (pointer actor-group) v1-8)) + (set! (-> this actor-group) v1-8) ) (else (format 0 "ERROR: ~s: entity missing actor-group!~%" (-> this name)) @@ -1702,7 +1700,6 @@ (defmethod init-from-entity! ((this tpl-spindle) (arg0 entity-actor)) "Set up a newly created process from the entity that created it." - (local-vars (sv-16 int)) (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)) @@ -1746,8 +1743,9 @@ (let ((f28-0 0.4) (f30-0 0.0) ) - (set! sv-16 0) - (let ((v1-30 (res-lump-data arg0 'cycle-speed (pointer float) :tag-ptr (the-as (pointer res-tag) (& sv-16))))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-30 (res-lump-data arg0 'cycle-speed (pointer float) :tag-ptr (& sv-16))) + ) (when v1-30 (set! f28-0 (-> v1-30 0)) (set! f30-0 (-> v1-30 1)) @@ -1840,7 +1838,6 @@ (defmethod init-from-entity! ((this tpl-fan-two) (arg0 entity-actor)) "Set up a newly created process from the entity that created it." - (local-vars (sv-16 int)) (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)) @@ -1870,8 +1867,9 @@ (let ((f28-0 720.0) (f30-0 0.0) ) - (set! sv-16 0) - (let ((v1-22 (res-lump-data arg0 'cycle-speed (pointer float) :tag-ptr (the-as (pointer res-tag) (& sv-16))))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-22 (res-lump-data arg0 'cycle-speed (pointer float) :tag-ptr (& sv-16))) + ) (when v1-22 (set! f28-0 (-> v1-22 0)) (set! f30-0 (-> v1-22 1)) @@ -1964,7 +1962,6 @@ (defmethod init-from-entity! ((this tpl-fan-three) (arg0 entity-actor)) "Set up a newly created process from the entity that created it." - (local-vars (sv-16 int)) (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)) @@ -1994,8 +1991,9 @@ (let ((f28-0 720.0) (f30-0 0.0) ) - (set! sv-16 0) - (let ((v1-22 (res-lump-data arg0 'cycle-speed (pointer float) :tag-ptr (the-as (pointer res-tag) (& sv-16))))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-22 (res-lump-data arg0 'cycle-speed (pointer float) :tag-ptr (& sv-16))) + ) (when v1-22 (set! f28-0 (-> v1-22 0)) (set! f30-0 (-> v1-22 1)) diff --git a/goal_src/jak3/levels/temple/temple-obs2.gc b/goal_src/jak3/levels/temple/temple-obs2.gc index 9626a49a2d..fd08403838 100644 --- a/goal_src/jak3/levels/temple/temple-obs2.gc +++ b/goal_src/jak3/levels/temple/temple-obs2.gc @@ -510,18 +510,18 @@ (defmethod init-from-entity! ((this tpl-watcher-manager) (arg0 entity-actor)) "Set up a newly created process from the entity that created it." - (local-vars (sv-16 res-tag)) (set! (-> this within-outer-ring) #f) (set! (-> this within-inner-ring) #f) (set! (-> this ouched) #f) (vector-copy! (-> this trans) (-> arg0 trans)) (logclear! (-> this mask) (process-mask actor-pause)) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-4 (res-lump-data arg0 'actor-groups pointer :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-4 (res-lump-data arg0 'actor-groups (pointer actor-group) :tag-ptr (& sv-16))) + ) (cond ((and v1-4 (nonzero? (-> sv-16 elt-count))) (set! (-> this actor-group-count) (the-as int (-> sv-16 elt-count))) - (set! (-> this actor-group) (the-as (pointer actor-group) v1-4)) + (set! (-> this actor-group) v1-4) ) (else (set! (-> this actor-group-count) 0) @@ -867,36 +867,18 @@ ) ((lambda :behavior tpl-watcher () - (local-vars (sv-96 symbol) (sv-112 vector)) - (let ((gp-0 (get-process *default-dead-pool* lightning-tracker #x4000 0))) - (when gp-0 - (let ((t9-1 (method-of-type lightning-tracker activate))) - (t9-1 (the-as lightning-tracker gp-0) *entity-pool* "lightning-tracker" (the-as pointer #x70004000)) - ) - (let ((s5-0 run-function-in-process) - (s4-0 gp-0) - (s3-0 lightning-tracker-init) - (s2-0 (-> *lightning-spec-id-table* 26)) - (s1-0 150) - (s0-0 #f) - ) - (set! sv-96 (the-as symbol #f)) - (set! sv-112 (-> self node-list data 4 bone transform trans)) - (let ((t3-0 (get-trans *target* 3))) - ((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-96 - sv-112 - t3-0 - ) - ) - ) - (-> gp-0 ppointer) - ) + (process-spawn + lightning-tracker + :init lightning-tracker-init + (-> *lightning-spec-id-table* 26) + 150 + #f + (the-as symbol #f) + (-> self node-list data 4 bone transform trans) + (get-trans *target* 3) + :name "lightning-tracker" + :to *entity-pool* + :unk 0 ) (send-event *target* @@ -1085,7 +1067,6 @@ (defmethod init-from-entity! ((this tpl-watcher) (arg0 entity-actor)) "Set up a newly created process from the entity that created it." - (local-vars (sv-16 res-tag)) (stack-size-set! (-> this main-thread) 384) (init-collision! this) (process-drawable-from-entity! this arg0) @@ -1096,8 +1077,9 @@ (the-as pair 0) ) (logclear! (-> this mask) (process-mask actor-pause)) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-12 (res-lump-data arg0 'actor-groups (pointer actor-group) :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-12 (res-lump-data arg0 'actor-groups (pointer actor-group) :tag-ptr (& sv-16))) + ) (if (and v1-12 (> (-> sv-16 elt-count) 0)) (set! (-> this manager) (the-as tpl-watcher-manager (-> v1-12 0 data 0 actor))) (set! (-> this manager) #f) @@ -1178,7 +1160,6 @@ (setup-masks (-> self draw) 0 2) ) :code (behavior () - (local-vars (sv-96 res-tag)) (sound-play "stone-lower") (ja-no-eval :group! tpl-door-switch-press-ja :num! (seek!) :frame-num 0.0) (until (ja-done? 0) @@ -1187,8 +1168,9 @@ ) (process-entity-status! self (entity-perm-status subtask-complete) #t) (send-event *target* 'change-mode 'normal self) - (set! sv-96 (new 'static 'res-tag)) - (let ((gp-1 (res-lump-data (-> self entity) 'actor-groups (pointer actor-group) :tag-ptr (& sv-96)))) + (let* ((sv-96 (new 'static 'res-tag)) + (gp-1 (res-lump-data (-> self entity) 'actor-groups (pointer actor-group) :tag-ptr (& sv-96))) + ) (cond ((and gp-1 (< (the-as uint 1) (-> sv-96 elt-count))) (let ((s5-1 (new 'stack-no-clear 'event-message-block))) @@ -1255,6 +1237,7 @@ ) (defmethod init-from-entity! ((this tpl-door-switch) (arg0 entity-actor)) + "Set up a newly created process from the entity that created it." ;; og:preserve-this added (stack-size-set! (-> this main-thread) 512) (let ((s4-0 (new 'process 'collide-shape-moving this (collide-list-enum usually-hit-by-player)))) diff --git a/goal_src/jak3/levels/temple/templed-obs.gc b/goal_src/jak3/levels/temple/templed-obs.gc index 8b51043d0e..07ac8e4116 100644 --- a/goal_src/jak3/levels/temple/templed-obs.gc +++ b/goal_src/jak3/levels/temple/templed-obs.gc @@ -676,30 +676,32 @@ ) (defmethod tpl-break-bridge-method-25 ((this tpl-break-bridge) (arg0 int)) - (local-vars (sv-16 tpl-break-bridge) (sv-24 int) (sv-32 vector)) - (set! sv-16 this) - (set! sv-24 arg0) - (set! sv-32 (-> this node-list data (tpl-bbridge-panel arg0) bone transform trans)) - (cond - ((logtest? (-> group-temple-bridge-break-kaboom flags) (sp-group-flag sp13)) - (vector-copy! (-> *launch-matrix* trans) sv-32) - (part-tracker-spawn part-tracker-subsampler :to *entity-pool* :group group-temple-bridge-break-kaboom) - ) - (else - (vector-copy! (-> *launch-matrix* trans) sv-32) - (part-tracker-spawn part-tracker :to *entity-pool* :group group-temple-bridge-break-kaboom) + (let ((sv-16 this) + (sv-24 arg0) + ) + (let ((sv-32 (-> this node-list data (tpl-bbridge-panel arg0) bone transform trans))) + (cond + ((logtest? (-> group-temple-bridge-break-kaboom flags) (sp-group-flag sp13)) + (vector-copy! (-> *launch-matrix* trans) sv-32) + (part-tracker-spawn part-tracker-subsampler :to *entity-pool* :group group-temple-bridge-break-kaboom) + ) + (else + (vector-copy! (-> *launch-matrix* trans) sv-32) + (part-tracker-spawn part-tracker :to *entity-pool* :group group-temple-bridge-break-kaboom) + ) + ) ) + (set-vector! (-> sv-16 panel-jmods sv-24 transform scale) 0.0 0.0 0.0 1.0) + (let ((a1-8 (new 'stack 'debris-tuning (the-as uint 0)))) + (set! (-> a1-8 duration) (seconds 8)) + (set-vector! (-> a1-8 fountain-rand-transv-lo) -98304.0 32768.0 -98304.0 1.0) + (set-vector! (-> a1-8 fountain-rand-transv-hi) 98304.0 163840.0 98304.0 1.0) + (set! (-> a1-8 hit-xz-reaction) 0.95) + (set! (-> a1-8 hit-y-reaction) 0.6) + (debris-spawn sv-16 a1-8 (-> *tpl-bridge-debris-params-arr* sv-24) (the-as process-drawable #f)) + ) + (set! (-> sv-16 panel-quashed sv-24) #t) ) - (set-vector! (-> sv-16 panel-jmods sv-24 transform scale) 0.0 0.0 0.0 1.0) - (let ((a1-8 (new 'stack 'debris-tuning (the-as uint 0)))) - (set! (-> a1-8 duration) (seconds 8)) - (set-vector! (-> a1-8 fountain-rand-transv-lo) -98304.0 32768.0 -98304.0 1.0) - (set-vector! (-> a1-8 fountain-rand-transv-hi) 98304.0 163840.0 98304.0 1.0) - (set! (-> a1-8 hit-xz-reaction) 0.95) - (set! (-> a1-8 hit-y-reaction) 0.6) - (debris-spawn sv-16 a1-8 (-> *tpl-bridge-debris-params-arr* sv-24) (the-as process-drawable #f)) - ) - (set! (-> sv-16 panel-quashed sv-24) #t) 0 (none) ) diff --git a/goal_src/jak3/levels/title/title-obs.gc b/goal_src/jak3/levels/title/title-obs.gc index bb520f802f..415e1371ce 100644 --- a/goal_src/jak3/levels/title/title-obs.gc +++ b/goal_src/jak3/levels/title/title-obs.gc @@ -179,7 +179,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 text-id (text-id progress-start-button))) (s5-1 (current-time)) @@ -214,20 +213,22 @@ ) ) (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 (s4-2 (-> gp-1 length)) - (if (= (-> self selected) s4-2) - (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 s4-2) #f) sv-112 #f 44 (bucket-id hud-draw-hud-alpha)) - (+! (-> 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 (s4-2 (-> gp-1 length)) + (if (= (-> self selected) s4-2) + (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 s4-2) #f) sv-112 #f 44 (bucket-id hud-draw-hud-alpha)) + (+! (-> sv-112 origin y) 22.0) + ) ) ) ) diff --git a/goal_src/jak3/levels/tower/tower-obs.gc b/goal_src/jak3/levels/tower/tower-obs.gc index 8f9e429f17..c13cb587dc 100644 --- a/goal_src/jak3/levels/tower/tower-obs.gc +++ b/goal_src/jak3/levels/tower/tower-obs.gc @@ -93,12 +93,12 @@ (defmethod init-from-entity! ((this actor-group-watcher) (arg0 entity-actor)) "Set up a newly created process from the entity that created it." - (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 actor-group) :tag-ptr (& sv-16))) + ) (cond ((and v1-1 (nonzero? (-> sv-16 elt-count))) - (set! (-> this actor-group) (the-as (pointer actor-group) v1-1)) + (set! (-> this actor-group) v1-1) (set! (-> this actor-group-count) (the-as int (-> sv-16 elt-count))) ) (else @@ -383,7 +383,6 @@ (defmethod init-from-entity! ((this tow-large-plat) (arg0 entity-actor)) "Set up a newly created process from the entity that created it." - (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) @@ -430,11 +429,12 @@ ) (set! (-> this final-y) (- f30-0 v1-17)) ) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-19 (res-lump-data (-> this entity) 'actor-groups pointer :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))) + ) (cond ((and v1-19 (nonzero? (-> sv-16 elt-count))) - (set! (-> this actor-group) (the-as (pointer actor-group) v1-19)) + (set! (-> this actor-group) v1-19) (set! (-> this actor-group-count) (the-as int (-> sv-16 elt-count))) ) (else @@ -911,7 +911,6 @@ (defmethod init-from-entity! ((this tow-tentacle) (arg0 entity-actor)) "Set up a newly created process from the entity that created it." - (local-vars (sv-16 collide-shape-prim-sphere) (sv-32 collide-shape-prim-sphere) (sv-48 vector)) (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) @@ -933,19 +932,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-32 sv-16) - (set! (-> sv-32 prim-core collide-as) (-> s3-0 prim-core collide-as)) - (set! (-> sv-32 prim-core collide-with) (-> s3-0 prim-core collide-with)) - (set! (-> sv-32 prim-core action) (-> s3-0 prim-core action)) - (set! (-> sv-32 transform-index) (command-get-int (car s0-0) 0)) - (set! (-> sv-32 prim-id) (the-as uint s2-0)) - (+! s2-0 1) - (set! sv-48 (-> sv-16 local-sphere)) - (set! (-> sv-48 x) 0.0) - (set! (-> sv-48 y) 0.0) - (set! (-> sv-48 z) 0.0) - (set! (-> sv-48 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-32 sv-16)) + (set! (-> sv-32 prim-core collide-as) (-> s3-0 prim-core collide-as)) + (set! (-> sv-32 prim-core collide-with) (-> s3-0 prim-core collide-with)) + (set! (-> sv-32 prim-core action) (-> s3-0 prim-core action)) + (set! (-> sv-32 transform-index) (command-get-int (car s0-0) 0)) + (set! (-> sv-32 prim-id) (the-as uint s2-0)) + ) + (+! s2-0 1) + (let ((sv-48 (-> sv-16 local-sphere))) + (set! (-> sv-48 x) 0.0) + (set! (-> sv-48 y) 0.0) + (set! (-> sv-48 z) 0.0) + (set! (-> sv-48 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/goal_src/jak3/levels/volcano/volcano-obs.gc b/goal_src/jak3/levels/volcano/volcano-obs.gc index 836c55be86..b7bb0e4fc2 100644 --- a/goal_src/jak3/levels/volcano/volcano-obs.gc +++ b/goal_src/jak3/levels/volcano/volcano-obs.gc @@ -68,15 +68,14 @@ ) (set! (-> self root trans y) (- (- (-> self init-y) f1-1) (* f0-0 f1-1))) ) - (let* ((gp-1 sound-play-by-name) - (s5-0 (make-u128 101 (the-as uint #x766f6d2d74616c70))) - (s4-0 (-> self sound-id)) - (f30-0 1024.0) - (f28-0 1.0) - (f0-6 (fabs (* 2.0 (- 0.5 (get-norm! (-> self sync) 0))))) - (f0-8 (* f0-6 f0-6)) - ) - (gp-1 (the-as sound-name s5-0) s4-0 (the int (* f30-0 (- f28-0 (* f0-8 f0-8)))) 0 0 (sound-group) #t) + (sound-play-by-name + (static-sound-name "plat-move") + (-> self sound-id) + (the int (* 1024.0 (- 1.0 (square (square (fabs (* 2.0 (- 0.5 (get-norm! (-> self sync) 0))))))))) + 0 + 0 + (sound-group) + #t ) (rider-post) ) diff --git a/goal_src/jak3/levels/volcano/volcano-part.gc b/goal_src/jak3/levels/volcano/volcano-part.gc index 7f0d2f4851..8e200820f8 100644 --- a/goal_src/jak3/levels/volcano/volcano-part.gc +++ b/goal_src/jak3/levels/volcano/volcano-part.gc @@ -557,7 +557,7 @@ (set! (-> v1-7 x) f0-2) (set! (-> v1-7 y) f1-3) (set! (-> v1-7 z) f2-0) - (set! (-> v1-7 w) (sqrtf (- (- (- 1.0 (* f2-0 f2-0)) (* f1-3 f1-3)) (* f0-2 f0-2)))) + (set! (-> v1-7 w) (sqrtf (- (- (- 1.0 (square f2-0)) (square f1-3)) (square f0-2)))) ) (matrix-u-f-compose s3-0 *y-vector* (vector-z-quaternion! (new 'stack-no-clear 'vector) s4-0)) (matrix->quaternion s4-0 s3-0) @@ -598,7 +598,7 @@ (set! (-> v1-12 x) f0-8) (set! (-> v1-12 y) f1-7) (set! (-> v1-12 z) f2-3) - (set! (-> v1-12 w) (sqrtf (- (- (- 1.0 (* f2-3 f2-3)) (* f1-7 f1-7)) (* f0-8 f0-8)))) + (set! (-> v1-12 w) (sqrtf (- (- (- 1.0 (square f2-3)) (square f1-7)) (square f0-8)))) ) (matrix-u-f-compose s3-1 *y-vector* (vector-z-quaternion! (new 'stack-no-clear 'vector) s5-1)) (matrix->quaternion s4-1 s3-1) diff --git a/goal_src/jak3/levels/volcano/volcanox-obs.gc b/goal_src/jak3/levels/volcano/volcanox-obs.gc index 034f96a02d..0a1c293a99 100644 --- a/goal_src/jak3/levels/volcano/volcanox-obs.gc +++ b/goal_src/jak3/levels/volcano/volcanox-obs.gc @@ -373,11 +373,9 @@ ) (vector-copy! (-> self other-eyeball-jmod transform scale) (-> self root scale)) (vector-copy! (-> self eyeball-jmod transform scale) (-> self root scale)) - (let* ((f0-9 (lerp-scale 1.0 0.0 (the float (- (current-time) (-> self state-time))) 0.0 60.0)) - (f0-11 (* f0-9 f0-9)) - ) - (set! (-> self root scale x) (* f0-11 f0-11)) - ) + (set! (-> self root scale x) + (square (square (lerp-scale 1.0 0.0 (the float (- (current-time) (-> self state-time))) 0.0 60.0))) + ) (set! (-> self root scale y) (+ 1.0 (/ (-> self root scale x) 2))) (set! (-> self root scale z) (-> self root scale x)) (when (= (-> self root scale x) 0.0) @@ -430,7 +428,6 @@ (defmethod init-from-entity! ((this vol-holo-eye) (arg0 entity-actor)) "Set up a newly created process from the entity that created it." - (local-vars (sv-16 res-tag)) (set! (-> this root) (new 'process 'trsqv)) (process-drawable-from-entity! this arg0) (initialize-skeleton @@ -439,12 +436,13 @@ (the-as pair 0) ) (set! (-> this trigger-radius) 110592.0) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-6 (res-lump-data arg0 'actor-groups pointer :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-6 (res-lump-data arg0 'actor-groups (pointer actor-group) :tag-ptr (& sv-16))) + ) (cond ((and v1-6 (nonzero? (-> sv-16 elt-count))) (set! (-> this actor-group-count) (the-as int (-> sv-16 elt-count))) - (set! (-> this actor-group) (the-as (pointer actor-group) v1-6)) + (set! (-> this actor-group) v1-6) ) (else (format 0 "ERROR: ~s: entity missing actor-group!~%" (-> this name)) diff --git a/goal_src/jak3/levels/wascity/bbush/des-bush-time-chase.gc b/goal_src/jak3/levels/wascity/bbush/des-bush-time-chase.gc index 7622661a10..f8ffa08dcc 100644 --- a/goal_src/jak3/levels/wascity/bbush/des-bush-time-chase.gc +++ b/goal_src/jak3/levels/wascity/bbush/des-bush-time-chase.gc @@ -513,23 +513,19 @@ (add-process *gui-control* self (gui-channel bbush) (gui-action queue) "miss001" -99.0 0) ) ) - (let ((f0-1 (vector-vector-distance-squared (target-pos 0) (-> self root trans))) - (f1-1 (-> self activate-radius)) - ) - (when (< f0-1 (* f1-1 f1-1)) - (send-event (ppointer->process (-> self parent)) 'goal) - (set-action! - *gui-control* - (gui-action play) - (-> self sound-id) - (gui-channel none) - (gui-action none) - (the-as string #f) - (the-as (function gui-connection symbol) #f) - (the-as process #f) - ) - (go-virtual die) + (when (< (vector-vector-distance-squared (target-pos 0) (-> self root trans)) (square (-> self activate-radius))) + (send-event (ppointer->process (-> self parent)) 'goal) + (set-action! + *gui-control* + (gui-action play) + (-> self sound-id) + (gui-channel none) + (gui-action none) + (the-as string #f) + (the-as (function gui-connection symbol) #f) + (the-as process #f) ) + (go-virtual die) ) ) :code sleep-code @@ -1201,13 +1197,9 @@ (defstate dormant (bb-freeze) :virtual #t :trans (behavior () - (let ((f0-0 (vector-vector-distance-squared (target-pos 0) (-> self root trans))) - (f1-0 (-> self activate-radius)) - ) - (if (< f0-0 (* f1-0 f1-0)) - (go-virtual idle) - ) - ) + (if (< (vector-vector-distance-squared (target-pos 0) (-> self root trans)) (square (-> self activate-radius))) + (go-virtual idle) + ) ) :code sleep-code ) @@ -1223,30 +1215,26 @@ ) ) :trans (behavior () - (let ((f0-0 (-> self activate-radius))) - (if (< (* f0-0 f0-0) (vector-vector-distance-squared (target-pos 0) (-> self root trans))) - (go-virtual dormant) - ) - ) - (spawn (-> self part) (-> self root trans)) - (let ((f0-3 (vector-vector-distance-squared (target-pos 0) (-> self root trans))) - (f1-0 (-> self freeze-pickup-radius)) - ) - (when (< f0-3 (* f1-0 f1-0)) - (send-event (ppointer->process (-> self parent)) 'freeze (-> self freeze-time)) - (case (-> self bb-pickup-type) - (((bb-pickup-type small)) - (sound-play "small-pickup") - ) - (((bb-pickup-type medium)) - (sound-play "medium-pickup") - ) - (((bb-pickup-type large)) - (sound-play "large-pickup") - ) - ) - (go-virtual die) + (if (< (square (-> self activate-radius)) (vector-vector-distance-squared (target-pos 0) (-> self root trans))) + (go-virtual dormant) ) + (spawn (-> self part) (-> self root trans)) + (when (< (vector-vector-distance-squared (target-pos 0) (-> self root trans)) + (square (-> self freeze-pickup-radius)) + ) + (send-event (ppointer->process (-> self parent)) 'freeze (-> self freeze-time)) + (case (-> self bb-pickup-type) + (((bb-pickup-type small)) + (sound-play "small-pickup") + ) + (((bb-pickup-type medium)) + (sound-play "medium-pickup") + ) + (((bb-pickup-type large)) + (sound-play "large-pickup") + ) + ) + (go-virtual die) ) ) :code sleep-code @@ -1522,7 +1510,7 @@ ;; WARN: Return type mismatch object vs none. (defmethod set-time-limit ((this task-manager-bbush-timer-chase)) - (local-vars (s4-0 object) (sv-96 res-tag)) + (local-vars (s4-0 object)) (let ((t9-0 (method-of-type task-manager set-time-limit))) (t9-0 this) ) @@ -1553,18 +1541,19 @@ (set! (-> this freeze-time-1) (res-lump-float s5-3 'freeze-time :default 10.0)) (set! (-> this freeze-time-2) (res-lump-float s5-3 'a-freeze-time :default 10.0)) (set! (-> this freeze-time-3) (res-lump-float s5-3 'b-freeze-time :default 10.0)) - (set! sv-96 (new 'static 'res-tag)) - (set! s4-0 (res-lump-data s5-3 'actor-groups pointer :tag-ptr (& sv-96))) - (cond - ((and (the-as pointer s4-0) (nonzero? (-> sv-96 elt-count))) - (format 0 "elt: ~d~%" (the-as pointer s4-0)) - (format 0 "elt2: ~d~%" (-> sv-96 elt-count)) - (set! (-> this actor-group-count) (the-as int (-> sv-96 elt-count))) - (set! (-> this actor-group) (the-as (pointer actor-group) s4-0)) - s4-0 - ) - (else - (format 0 "ERROR: ~s: entity missing actor-group!~%" (game-task->string (-> this node-info task))) + (let ((sv-96 (new 'static 'res-tag))) + (set! s4-0 (res-lump-data s5-3 'actor-groups (pointer actor-group) :tag-ptr (& sv-96))) + (cond + ((and (the-as (pointer actor-group) s4-0) (nonzero? (-> sv-96 elt-count))) + (format 0 "elt: ~d~%" (the-as (pointer actor-group) s4-0)) + (format 0 "elt2: ~d~%" (-> sv-96 elt-count)) + (set! (-> this actor-group-count) (the-as int (-> sv-96 elt-count))) + (set! (-> this actor-group) (the-as (pointer actor-group) s4-0)) + s4-0 + ) + (else + (format 0 "ERROR: ~s: entity missing actor-group!~%" (game-task->string (-> this node-info task))) + ) ) ) ) @@ -1711,7 +1700,6 @@ '() ) :trans (behavior () - (local-vars (sv-208 (function vector float vector)) (sv-224 vector) (sv-240 (function vector float vector))) (seek! (-> self freeze-time) 0.0 (seconds-per-frame)) (when (time-elapsed? (-> self color-flash-time) (seconds 1)) (set! (-> (the-as freeze-time-hud (handle->process (-> self freeze-time-hud))) strings 0 color) @@ -1743,24 +1731,12 @@ ) (new 'stack-no-clear 'vector) (when (and s3-0 s4-0) - (let ((s2-0 s5-0) - (s1-0 (method-of-type cubic-curve cubic-curve-method-9)) - (s0-0 (-> s3-0 trans)) - ) - (set! sv-208 vector-normalize!) - (let* ((a0-26 (vector-z-quaternion! (new 'stack-no-clear 'vector) (-> s3-0 quat))) - (a1-26 204800.0) - (s3-1 (sv-208 a0-26 a1-26)) - ) - (set! sv-224 (-> s4-0 trans)) - (set! sv-240 vector-normalize!) - (let* ((a0-28 (vector-z-quaternion! (new 'stack-no-clear 'vector) (-> s4-0 quat))) - (a1-28 204800.0) - (t0-0 (sv-240 a0-28 a1-28)) - ) - (s1-0 s2-0 s0-0 s3-1 sv-224 t0-0) - ) - ) + (cubic-curve-method-9 + s5-0 + (-> s3-0 trans) + (vector-normalize! (vector-z-quaternion! (new 'stack-no-clear 'vector) (-> s3-0 quat)) 204800.0) + (-> s4-0 trans) + (vector-normalize! (vector-z-quaternion! (new 'stack-no-clear 'vector) (-> s4-0 quat)) 204800.0) ) (cubic-curve-method-10 s5-0 (-> self trans) (- (-> self path-pos) (the float gp-0))) ) diff --git a/goal_src/jak3/levels/wascity/chase/kanga-lizard.gc b/goal_src/jak3/levels/wascity/chase/kanga-lizard.gc index 898edbd6ed..800f4ae849 100644 --- a/goal_src/jak3/levels/wascity/chase/kanga-lizard.gc +++ b/goal_src/jak3/levels/wascity/chase/kanga-lizard.gc @@ -1185,11 +1185,7 @@ (set! (-> self being-attacked) #f) ) ((and (focus-test? *target* dangerous) - (let ((f0-4 (vector-vector-distance-squared (-> self root trans) (target-pos 0))) - (f1-1 61440.0) - ) - (< f0-4 (* f1-1 f1-1)) - ) + (< (vector-vector-distance-squared (-> self root trans) (target-pos 0)) (square 61440.0)) ) (set! (-> self being-attacked) #t) ) @@ -1519,18 +1515,18 @@ ;; WARN: Return type mismatch object vs none. (defmethod init-actor-group! ((this task-manager-kanga-lizard)) - (local-vars (sv-16 res-tag)) (when (not (-> this manager-entity)) (let ((a0-2 (entity-by-name "flut-1"))) (cond (a0-2 (set! (-> this manager-entity) a0-2) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-2 (res-lump-data a0-2 'actor-groups pointer :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-2 (res-lump-data a0-2 'actor-groups (pointer actor-group) :tag-ptr (& sv-16))) + ) (cond ((and v1-2 (nonzero? (-> sv-16 elt-count))) (set! (-> this actor-group-count) (the-as int (-> sv-16 elt-count))) - (set! (-> this actor-group) (the-as (pointer actor-group) v1-2)) + (set! (-> this actor-group) v1-2) ) (else (format 0 "ERROR: ~S: entity missing actor-group!~%" (game-task->string (-> this node-info task))) diff --git a/goal_src/jak3/levels/wascity/cty-faction.gc b/goal_src/jak3/levels/wascity/cty-faction.gc index 82c03097b1..b372c591da 100644 --- a/goal_src/jak3/levels/wascity/cty-faction.gc +++ b/goal_src/jak3/levels/wascity/cty-faction.gc @@ -484,7 +484,6 @@ ) (defmethod cty-faction-manager-method-20 ((this cty-faction-manager) (arg0 uint)) - (local-vars (sv-16 int) (sv-17 int) (sv-18 int)) (if (= arg0 (-> this last-active-territories)) (return 0) ) @@ -498,38 +497,40 @@ (dotimes (s1-0 30) (let ((s0-0 s1-0)) (when (and (logtest? (-> this territory-flags s0-0) 2) (logtest? arg0 (ash 1 s0-0))) - (set! sv-16 (cty-faction-manager-method-14 this (the-as nav-territory-type s0-0) 0 0)) - (set! sv-17 (cty-faction-manager-method-14 this (the-as nav-territory-type s0-0) 2 1)) - (set! sv-18 (cty-faction-manager-method-14 this (the-as nav-territory-type s0-0) 4 2)) - (when (and (logtest? sv-17 2) (not (logtest? s2-0 2))) - (when (!= (car s4-0) #f) - (set! (cdr s4-0) (-> *territory-list* s3-0)) - (+! s3-0 1) - (set! s4-0 (cdr s4-0)) + (let ((sv-16 (cty-faction-manager-method-14 this (the-as nav-territory-type s0-0) 0 0)) + (sv-17 (cty-faction-manager-method-14 this (the-as nav-territory-type s0-0) 2 1)) + (sv-18 (cty-faction-manager-method-14 this (the-as nav-territory-type s0-0) 4 2)) + ) + (when (and (logtest? sv-17 2) (not (logtest? s2-0 2))) + (when (!= (car s4-0) #f) + (set! (cdr s4-0) (-> *territory-list* s3-0)) + (+! s3-0 1) + (set! s4-0 (cdr s4-0)) + ) + (set! s2-0 (logior s2-0 2)) + (set! (car s4-0) (cty-faction-manager-method-21 this 1)) + (set! (cdr s4-0) '()) ) - (set! s2-0 (logior s2-0 2)) - (set! (car s4-0) (cty-faction-manager-method-21 this 1)) - (set! (cdr s4-0) '()) - ) - (when (and (logtest? sv-16 2) (not (logtest? s2-0 1))) - (when (!= (car s4-0) #f) - (set! (cdr s4-0) (-> *territory-list* s3-0)) - (+! s3-0 1) - (set! s4-0 (cdr s4-0)) + (when (and (logtest? sv-16 2) (not (logtest? s2-0 1))) + (when (!= (car s4-0) #f) + (set! (cdr s4-0) (-> *territory-list* s3-0)) + (+! s3-0 1) + (set! s4-0 (cdr s4-0)) + ) + (set! s2-0 (logior s2-0 1)) + (set! (car s4-0) (cty-faction-manager-method-21 this 0)) + (set! (cdr s4-0) '()) ) - (set! s2-0 (logior s2-0 1)) - (set! (car s4-0) (cty-faction-manager-method-21 this 0)) - (set! (cdr s4-0) '()) - ) - (when (and (logtest? sv-18 2) (not (logtest? s2-0 4))) - (when (!= (car s4-0) #f) - (set! (cdr s4-0) (-> *territory-list* s3-0)) - (+! s3-0 1) - (set! s4-0 (cdr s4-0)) + (when (and (logtest? sv-18 2) (not (logtest? s2-0 4))) + (when (!= (car s4-0) #f) + (set! (cdr s4-0) (-> *territory-list* s3-0)) + (+! s3-0 1) + (set! s4-0 (cdr s4-0)) + ) + (set! s2-0 (logior s2-0 4)) + (set! (car s4-0) (cty-faction-manager-method-21 this 2)) + (set! (cdr s4-0) '()) ) - (set! s2-0 (logior s2-0 4)) - (set! (car s4-0) (cty-faction-manager-method-21 this 2)) - (set! (cdr s4-0) '()) ) (logior! (-> this update-flags) (cty-faction-update-flag cfu0)) ) diff --git a/goal_src/jak3/levels/wascity/defend/was-pre-game.gc b/goal_src/jak3/levels/wascity/defend/was-pre-game.gc index 87610f7cac..8c270060e1 100644 --- a/goal_src/jak3/levels/wascity/defend/was-pre-game.gc +++ b/goal_src/jak3/levels/wascity/defend/was-pre-game.gc @@ -2238,13 +2238,6 @@ ) (defmethod update-game-state ((this was-pre-game)) - (local-vars - (sv-32 function) - (sv-48 process) - (sv-64 (function entity-actor vector int time-frame float object :behavior pre-game-bubble)) - (sv-80 entity-actor) - (sv-96 int) - ) (+! (-> this beam-clock) (* 300.0 (seconds-per-frame))) (dotimes (s5-0 4) (set! (-> this beam s5-0 min) (+ 0.4 (* 0.2 (sin (* 36.40889 (-> this beam-clock)))))) @@ -2313,29 +2306,16 @@ ) ) ) - (let ((s0-0 (get-process *default-dead-pool* pre-game-bubble #x4000 1))) - (when s0-0 - (let ((t9-8 (method-of-type pre-game-bubble activate))) - (t9-8 (the-as pre-game-bubble s0-0) this "pre-game-bubble" (the-as pointer #x70004000)) - ) - (set! sv-32 run-function-in-process) - (set! sv-48 s0-0) - (set! sv-64 pre-game-bubble-init) - (set! sv-80 (-> this entity)) - (set! sv-96 0) - (let ((t2-1 (rand-vu-float-range (-> s5-2 gravity-min) (-> s5-2 gravity-max)))) - ((the-as (function object object object object object object object none) sv-32) - sv-48 - sv-64 - sv-80 - s2-0 - s1-0 - sv-96 - t2-1 - ) - ) - (-> s0-0 ppointer) - ) + (process-spawn + pre-game-bubble + :init pre-game-bubble-init + (-> this entity) + s2-0 + s1-0 + 0 + (rand-vu-float-range (-> s5-2 gravity-min) (-> s5-2 gravity-max)) + :name "pre-game-bubble" + :to this ) ) ) diff --git a/goal_src/jak3/levels/wascity/dm-flyer.gc b/goal_src/jak3/levels/wascity/dm-flyer.gc index d7747b1b75..81e89eaa27 100644 --- a/goal_src/jak3/levels/wascity/dm-flyer.gc +++ b/goal_src/jak3/levels/wascity/dm-flyer.gc @@ -191,41 +191,39 @@ (set! (-> s5-0 ignore-proc) (process->handle #f)) (explosion-spawn s5-0 (the-as process-drawable *default-pool*)) ) - (let ((f0-6 81920.0)) - (cond - ((< (* f0-6 f0-6) (vector-vector-distance-squared (-> self root trans) (target-pos 0))) - (forward-up->inv-matrix gp-0 (-> self pre-move-transv) *up-vector*) - (vector-copy! (-> gp-0 trans) (-> self root trans)) - (if (logtest? (-> group-maker-grenade-explosion flags) (sp-group-flag sp13)) - (part-tracker-spawn - part-tracker-subsampler - :to *entity-pool* - :group group-maker-grenade-explosion - :mat-joint gp-0 - ) - (part-tracker-spawn part-tracker :to *entity-pool* :group group-maker-grenade-explosion :mat-joint gp-0) + (cond + ((< (square 81920.0) (vector-vector-distance-squared (-> self root trans) (target-pos 0))) + (forward-up->inv-matrix gp-0 (-> self pre-move-transv) *up-vector*) + (vector-copy! (-> gp-0 trans) (-> self root trans)) + (if (logtest? (-> group-maker-grenade-explosion flags) (sp-group-flag sp13)) + (part-tracker-spawn + part-tracker-subsampler + :to *entity-pool* + :group group-maker-grenade-explosion + :mat-joint gp-0 ) - (sound-play "ball-explode") - ) - (else - (quaternion->matrix gp-0 (-> *target* control quat)) - (vector-copy! (-> gp-0 trans) (-> *target* control trans)) - (if (logtest? (-> group-maker-grenade-explosion-bottom flags) (sp-group-flag sp13)) - (part-tracker-spawn - part-tracker-subsampler - :to *entity-pool* - :group group-maker-grenade-explosion-bottom - :mat-joint gp-0 - ) - (part-tracker-spawn - part-tracker - :to *entity-pool* - :group group-maker-grenade-explosion-bottom - :mat-joint gp-0 - ) + (part-tracker-spawn part-tracker :to *entity-pool* :group group-maker-grenade-explosion :mat-joint gp-0) + ) + (sound-play "ball-explode") + ) + (else + (quaternion->matrix gp-0 (-> *target* control quat)) + (vector-copy! (-> gp-0 trans) (-> *target* control trans)) + (if (logtest? (-> group-maker-grenade-explosion-bottom flags) (sp-group-flag sp13)) + (part-tracker-spawn + part-tracker-subsampler + :to *entity-pool* + :group group-maker-grenade-explosion-bottom + :mat-joint gp-0 ) - (sound-play "ball-hit-turret") - ) + (part-tracker-spawn + part-tracker + :to *entity-pool* + :group group-maker-grenade-explosion-bottom + :mat-joint gp-0 + ) + ) + (sound-play "ball-hit-turret") ) ) ) @@ -501,12 +499,6 @@ ;; ERROR: Stack slot load at 112 mismatch: defined as size 4, got size 16 ;; ERROR: Stack slot load at 128 mismatch: defined as size 4, got size 16 (defmethod init-proj-settings! ((this dm-flyer-shot)) - (local-vars - (sv-80 (function float float float float float float)) - (sv-96 float) - (sv-112 float) - (sv-128 float) - ) (with-pp (initialize-skeleton this @@ -577,20 +569,11 @@ (f0-12 (vector-dot s5-6 *y-vector*)) (s4-3 (new 'stack-no-clear 'vector)) ) - (let ((s3-1 vector-lerp!) - (s2-0 s4-3) - (s1-0 *y-vector*) - (s0-0 *x-vector*) - ) - (set! sv-80 lerp-scale) - (set! sv-96 (the-as float 0.0)) - (set! sv-112 (the-as float 1.0)) - (set! sv-128 f0-12) - (let ((a3-5 (cos 14563.556)) - (t0-2 0.0) - ) - (s3-1 s2-0 s1-0 s0-0 (sv-80 sv-96 sv-112 sv-128 a3-5 t0-2)) - ) + (vector-lerp! + s4-3 + *y-vector* + *x-vector* + (lerp-scale (the-as float 0.0) (the-as float 1.0) f0-12 (cos 14563.556) 0.0) ) (forward-up->quaternion (-> this root quat) s5-6 s4-3) ) diff --git a/goal_src/jak3/levels/wascity/flee-info.gc b/goal_src/jak3/levels/wascity/flee-info.gc index 31d6c029d2..e2cb865cd6 100644 --- a/goal_src/jak3/levels/wascity/flee-info.gc +++ b/goal_src/jak3/levels/wascity/flee-info.gc @@ -22,7 +22,6 @@ (defmethod flee-info-method-9 ((this flee-info) (arg0 citizen) (arg1 nav-branch) (arg2 int) (arg3 vector) (arg4 float)) - (local-vars (sv-32 int)) (when (nonzero? arg2) (-> arg1 src-node) (let* ((s2-0 (-> arg1 dest-node)) @@ -37,10 +36,11 @@ (s1-0 (-> s2-0 branch-count)) (f30-0 0.0) ) - (set! sv-32 0) - (while (< sv-32 s1-0) - (+! f30-0 (flee-info-method-9 this arg0 (-> s2-0 branch-array sv-32) (+ arg2 -1) arg3 s0-0)) - (set! sv-32 (+ sv-32 1)) + (let ((sv-32 0)) + (while (< sv-32 s1-0) + (+! f30-0 (flee-info-method-9 this arg0 (-> s2-0 branch-array sv-32) (+ arg2 -1) arg3 s0-0)) + (+! sv-32 1) + ) ) ;; og:preserve-this fix divide by zero (set! arg4 (+ s0-0 (the float (/-signed-0-guard (the int f30-0) s1-0)))) @@ -79,7 +79,6 @@ ) (defmethod flee-info-method-13 ((this flee-info) (arg0 citizen)) - (local-vars (sv-80 nav-branch)) (let* ((s5-0 (-> arg0 controller)) (s2-0 (-> s5-0 branch dest-node)) (s4-0 (the-as nav-branch #f)) @@ -100,8 +99,9 @@ (f30-0 0.0) ) (dotimes (s0-2 s1-2) - (set! sv-80 (-> s2-0 branch-array s0-2)) - (let ((f0-5 (flee-info-method-9 this arg0 sv-80 4 (-> arg0 danger-pos) 0.0))) + (let* ((sv-80 (-> s2-0 branch-array s0-2)) + (f0-5 (flee-info-method-9 this arg0 sv-80 4 (-> arg0 danger-pos) 0.0)) + ) (when (< f30-0 f0-5) (set! f30-0 f0-5) (set! s4-0 sv-80) diff --git a/goal_src/jak3/levels/wascity/formation-object.gc b/goal_src/jak3/levels/wascity/formation-object.gc index bf31ccad5e..3326c03577 100644 --- a/goal_src/jak3/levels/wascity/formation-object.gc +++ b/goal_src/jak3/levels/wascity/formation-object.gc @@ -319,7 +319,7 @@ (formation-object-method-34 self) (let ((f30-0 (formation-object-method-33 self))) (when (and (nonzero? (-> self controller branch)) - (< (vector-vector-xz-distance-squared (-> self root trans) (-> self dest-position)) (* f30-0 f30-0)) + (< (vector-vector-xz-distance-squared (-> self root trans) (-> self dest-position)) (square f30-0)) ) (let ((s5-0 (new 'stack-no-clear 'vector)) (gp-0 (new 'stack-no-clear 'vector)) diff --git a/goal_src/jak3/levels/wascity/leaper/was-leaper-race.gc b/goal_src/jak3/levels/wascity/leaper/was-leaper-race.gc index 2b06b16733..8d9c9a9bd8 100644 --- a/goal_src/jak3/levels/wascity/leaper/was-leaper-race.gc +++ b/goal_src/jak3/levels/wascity/leaper/was-leaper-race.gc @@ -1197,16 +1197,16 @@ ) (defmethod init-actor-group! ((this task-manager-wascity-leaper-race)) - (local-vars (sv-16 res-tag)) (let ((a0-2 (entity-by-name "wascity-leaper-race-manager-1"))) (when a0-2 (set! (-> this ring-manager-entity) a0-2) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-1 (res-lump-data a0-2 'actor-groups pointer :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-1 (res-lump-data a0-2 'actor-groups (pointer actor-group) :tag-ptr (& sv-16))) + ) (cond ((and v1-1 (>= (-> sv-16 elt-count) 0)) (set! (-> this actor-group-count) (the-as int (-> sv-16 elt-count))) - (set! (-> this actor-group) (the-as (pointer actor-group) v1-1)) + (set! (-> this actor-group) v1-1) (when (> (-> this actor-group-count) 0) (let* ((s5-0 (-> this actor-group 0 length)) (s4-0 0) diff --git a/goal_src/jak3/levels/wascity/maker-projectile.gc b/goal_src/jak3/levels/wascity/maker-projectile.gc index 52af318270..8b59b52afe 100644 --- a/goal_src/jak3/levels/wascity/maker-projectile.gc +++ b/goal_src/jak3/levels/wascity/maker-projectile.gc @@ -721,41 +721,39 @@ (set! (-> s5-0 ignore-proc) (process->handle #f)) (explosion-spawn s5-0 (the-as process-drawable *default-pool*)) ) - (let ((f0-6 81920.0)) - (cond - ((< (* f0-6 f0-6) (vector-vector-distance-squared (-> self root trans) (target-pos 0))) - (forward-up->inv-matrix gp-0 (-> self pre-move-transv) *up-vector*) - (vector-copy! (-> gp-0 trans) (-> self root trans)) - (if (logtest? (-> group-maker-grenade-explosion flags) (sp-group-flag sp13)) - (part-tracker-spawn - part-tracker-subsampler - :to *entity-pool* - :group group-maker-grenade-explosion - :mat-joint gp-0 - ) - (part-tracker-spawn part-tracker :to *entity-pool* :group group-maker-grenade-explosion :mat-joint gp-0) + (cond + ((< (square 81920.0) (vector-vector-distance-squared (-> self root trans) (target-pos 0))) + (forward-up->inv-matrix gp-0 (-> self pre-move-transv) *up-vector*) + (vector-copy! (-> gp-0 trans) (-> self root trans)) + (if (logtest? (-> group-maker-grenade-explosion flags) (sp-group-flag sp13)) + (part-tracker-spawn + part-tracker-subsampler + :to *entity-pool* + :group group-maker-grenade-explosion + :mat-joint gp-0 ) - (sound-play "ball-explode") - ) - (else - (quaternion->matrix gp-0 (-> *target* control quat)) - (vector-copy! (-> gp-0 trans) (-> *target* control trans)) - (if (logtest? (-> group-maker-grenade-explosion-bottom flags) (sp-group-flag sp13)) - (part-tracker-spawn - part-tracker-subsampler - :to *entity-pool* - :group group-maker-grenade-explosion-bottom - :mat-joint gp-0 - ) - (part-tracker-spawn - part-tracker - :to *entity-pool* - :group group-maker-grenade-explosion-bottom - :mat-joint gp-0 - ) + (part-tracker-spawn part-tracker :to *entity-pool* :group group-maker-grenade-explosion :mat-joint gp-0) + ) + (sound-play "ball-explode") + ) + (else + (quaternion->matrix gp-0 (-> *target* control quat)) + (vector-copy! (-> gp-0 trans) (-> *target* control trans)) + (if (logtest? (-> group-maker-grenade-explosion-bottom flags) (sp-group-flag sp13)) + (part-tracker-spawn + part-tracker-subsampler + :to *entity-pool* + :group group-maker-grenade-explosion-bottom + :mat-joint gp-0 ) - (sound-play "ball-hit-turret") - ) + (part-tracker-spawn + part-tracker + :to *entity-pool* + :group group-maker-grenade-explosion-bottom + :mat-joint gp-0 + ) + ) + (sound-play "ball-hit-turret") ) ) ) diff --git a/goal_src/jak3/levels/wascity/squad-control-city.gc b/goal_src/jak3/levels/wascity/squad-control-city.gc index 0d4ff8c322..7bf3deece0 100644 --- a/goal_src/jak3/levels/wascity/squad-control-city.gc +++ b/goal_src/jak3/levels/wascity/squad-control-city.gc @@ -66,11 +66,10 @@ ) (defmethod squad-control-city-method-38 ((this squad-control-city) (arg0 process-focusable) (arg1 process-focusable)) - (let* ((s5-0 (get-trans arg1 0)) - (f0-0 (vector-vector-xz-distance-squared (-> arg0 root trans) s5-0)) - (f1-0 245760.0) - ) - (or (< f0-0 (* f1-0 f1-0)) (< (fabs (- (-> s5-0 y) (-> arg0 root trans y))) 61440.0)) + (let ((s5-0 (get-trans arg1 0))) + (or (< (vector-vector-xz-distance-squared (-> arg0 root trans) s5-0) (square 245760.0)) + (< (fabs (- (-> s5-0 y) (-> arg0 root trans y))) 61440.0) + ) ) ) @@ -97,7 +96,6 @@ ;; WARN: Return type mismatch process-drawable vs process-focusable. (defmethod squad-control-city-method-35 ((this squad-control-city) (arg0 citizen) (arg1 handle)) - (local-vars (sv-16 vector) (sv-32 vector) (sv-48 vector)) (let ((s2-0 (as-type (handle->process arg1) process-focusable)) (s1-0 #f) (s4-1 arg0) @@ -123,10 +121,9 @@ (set! s3-0 (get-focus-in-range this s4-1)) (goto cfg-121) ) - (let* ((f30-0 0.0) - (f0-0 40960000.0) - (f28-0 (* f0-0 f0-0)) - ) + (let ((f30-0 0.0) + (f28-0 (square 40960000.0)) + ) (when #t (let ((v1-22 (-> *collide-player-list* alive-list next0))) *collide-player-list* @@ -161,15 +158,15 @@ (set! s3-0 s1-1) ) ((= f26-0 f30-0) - (let ((s0-2 vector-vector-xz-distance-squared)) - (set! sv-16 (-> arg0 root trans)) - (let* ((a1-25 (get-trans (the-as process-focusable s1-1) 3)) - (f0-4 (* (s0-2 sv-16 a1-25) (squad-control-city-method-42 this))) - ) - (when (< f0-4 f28-0) - (set! f28-0 f0-4) - (set! s3-0 s1-1) + (let ((f0-4 + (* (vector-vector-xz-distance-squared (-> arg0 root trans) (get-trans (the-as process-focusable s1-1) 3)) + (squad-control-city-method-42 this) + ) + ) ) + (when (< f0-4 f28-0) + (set! f28-0 f0-4) + (set! s3-0 s1-1) ) ) ) @@ -222,15 +219,15 @@ (set! s3-0 s1-2) ) ((= f26-2 f30-0) - (let ((s0-5 vector-vector-xz-distance-squared)) - (set! sv-32 (-> arg0 root trans)) - (let* ((a1-41 (get-trans (the-as process-focusable s1-2) 3)) - (f0-7 (* (s0-5 sv-32 a1-41) (squad-control-city-method-42 this))) - ) - (when (< f0-7 f28-0) - (set! f28-0 f0-7) - (set! s3-0 s1-2) + (let ((f0-7 + (* (vector-vector-xz-distance-squared (-> arg0 root trans) (get-trans (the-as process-focusable s1-2) 3)) + (squad-control-city-method-42 this) + ) + ) ) + (when (< f0-7 f28-0) + (set! f28-0 f0-7) + (set! s3-0 s1-2) ) ) ) @@ -282,15 +279,15 @@ (set! s3-0 s1-3) ) ((= f26-4 f30-0) - (let ((s0-8 vector-vector-xz-distance-squared)) - (set! sv-48 (-> arg0 root trans)) - (let* ((a1-57 (get-trans (the-as process-focusable s1-3) 3)) - (f0-10 (* (s0-8 sv-48 a1-57) (squad-control-city-method-42 this))) - ) - (when (< f0-10 f28-0) - (set! f28-0 f0-10) - (set! s3-0 s1-3) + (let ((f0-10 + (* (vector-vector-xz-distance-squared (-> arg0 root trans) (get-trans (the-as process-focusable s1-3) 3)) + (squad-control-city-method-42 this) + ) + ) ) + (when (< f0-10 f28-0) + (set! f28-0 f0-10) + (set! s3-0 s1-3) ) ) ) diff --git a/goal_src/jak3/levels/wascity/tizard.gc b/goal_src/jak3/levels/wascity/tizard.gc index 1d4d4bf493..704daf1e28 100644 --- a/goal_src/jak3/levels/wascity/tizard.gc +++ b/goal_src/jak3/levels/wascity/tizard.gc @@ -278,80 +278,76 @@ ) (defmethod tizard-method-34 ((this tizard)) - (local-vars - (sv-592 collide-query) - (sv-596 (inline-array sphere)) - (sv-600 vector) - (sv-604 matrix) - (sv-608 pat-surface) - ) - (set! sv-592 (new 'stack-no-clear 'collide-query)) - (let ((s5-0 (new 'stack-no-clear 'inline-array 'sphere 2))) + (let ((sv-592 (new 'stack-no-clear 'collide-query)) + (s5-0 (new 'stack-no-clear 'inline-array 'sphere 2)) + ) (dotimes (s4-0 2) ((method-of-type sphere new) (the-as symbol (-> s5-0 s4-0)) sphere) ) - (set! sv-596 s5-0) - ) - (set! sv-600 (-> this root trans)) - (set! sv-604 (-> this rotation-matrix)) - (set! sv-608 (new 'static 'pat-surface :noentity #x1 :probe #x1 :noendlessfall #x1)) - (vector+float*! (the-as vector (-> sv-596 0)) sv-600 (-> sv-604 fvec) 4096.0) - (set! (-> sv-596 0 r) 10240.0) - (vector+float*! (the-as vector (-> sv-596 1)) sv-600 (-> sv-604 fvec) -4096.0) - (set! (-> sv-596 1 r) 10240.0) - (let ((v1-19 sv-592)) - (set! (-> v1-19 best-dist) (the-as float sv-596)) - (set! (-> v1-19 best-other-prim) (the-as collide-shape-prim 2)) - (set! (-> v1-19 collide-with) (collide-spec backgnd obstacle)) - (set! (-> v1-19 ignore-process0) this) - (set! (-> v1-19 ignore-process1) #f) - (set! (-> v1-19 ignore-pat) sv-608) - (set! (-> v1-19 best-my-prim) (the-as collide-shape-prim #t)) - (set! (-> v1-19 action-mask) (collide-action solid)) - ) - (fill-using-spheres *collide-cache* sv-592) - (vector-reset! (-> this path-dir)) - (dotimes (s5-1 2) - (let ((f0-4 819.2)) - (let ((v1-26 (-> this ground-normal s5-1))) - (vector+float*! (-> sv-592 start-pos) (the-as vector (-> sv-596 s5-1)) (-> this ground-normal s5-1) 8192.0) - (vector-float*! (-> sv-592 move-dist) v1-26 -16384.0) + (let ((sv-596 s5-0) + (sv-600 (-> this root trans)) + (sv-604 (-> this rotation-matrix)) + (sv-608 (new 'static 'pat-surface :noentity #x1 :probe #x1 :noendlessfall #x1)) + ) + (vector+float*! (the-as vector (-> sv-596 0)) sv-600 (-> sv-604 fvec) 4096.0) + (set! (-> sv-596 0 r) 10240.0) + (vector+float*! (the-as vector (-> sv-596 1)) sv-600 (-> sv-604 fvec) -4096.0) + (set! (-> sv-596 1 r) 10240.0) + (let ((v1-19 sv-592)) + (set! (-> v1-19 best-dist) (the-as float sv-596)) + (set! (-> v1-19 best-other-prim) (the-as collide-shape-prim 2)) + (set! (-> v1-19 collide-with) (collide-spec backgnd obstacle)) + (set! (-> v1-19 ignore-process0) this) + (set! (-> v1-19 ignore-process1) #f) + (set! (-> v1-19 ignore-pat) sv-608) + (set! (-> v1-19 best-my-prim) (the-as collide-shape-prim #t)) + (set! (-> v1-19 action-mask) (collide-action solid)) ) - (let ((v1-27 sv-592)) - (set! (-> v1-27 radius) f0-4) - (set! (-> v1-27 collide-with) (collide-spec backgnd obstacle)) - (set! (-> v1-27 ignore-process0) #f) - (set! (-> v1-27 ignore-process1) #f) - (set! (-> v1-27 ignore-pat) sv-608) - (set! (-> v1-27 action-mask) (collide-action solid)) - ) - ) - (let ((f0-5 (probe-using-line-sphere *collide-cache* sv-592))) - (when (>= f0-5 0.0) - (let ((v1-31 (new 'stack-no-clear 'vector)) - (s4-1 (new 'stack-no-clear 'vector)) - ) - (vector+float*! v1-31 (-> sv-592 start-pos) (-> sv-592 move-dist) f0-5) - (vector-! s4-1 v1-31 (-> sv-592 best-other-tri intersect)) - (vector-normalize! s4-1 1.0) - (let ((s3-0 (new 'stack-no-clear 'quaternion))) - (quaternion-from-two-vectors-partial! s3-0 (-> this ground-normal s5-1) s4-1 (* 4.0 (seconds-per-frame))) - (vector-orient-by-quat! (-> this ground-normal s5-1) (-> this ground-normal s5-1) s3-0) + (fill-using-spheres *collide-cache* sv-592) + (vector-reset! (-> this path-dir)) + (dotimes (s5-1 2) + (let ((f0-4 819.2)) + (let ((v1-26 (-> this ground-normal s5-1))) + (vector+float*! (-> sv-592 start-pos) (the-as vector (-> sv-596 s5-1)) (-> this ground-normal s5-1) 8192.0) + (vector-float*! (-> sv-592 move-dist) v1-26 -16384.0) + ) + (let ((v1-27 sv-592)) + (set! (-> v1-27 radius) f0-4) + (set! (-> v1-27 collide-with) (collide-spec backgnd obstacle)) + (set! (-> v1-27 ignore-process0) #f) + (set! (-> v1-27 ignore-process1) #f) + (set! (-> v1-27 ignore-pat) sv-608) + (set! (-> v1-27 action-mask) (collide-action solid)) ) ) - 0 + (let ((f0-5 (probe-using-line-sphere *collide-cache* sv-592))) + (when (>= f0-5 0.0) + (let ((v1-31 (new 'stack-no-clear 'vector)) + (s4-1 (new 'stack-no-clear 'vector)) + ) + (vector+float*! v1-31 (-> sv-592 start-pos) (-> sv-592 move-dist) f0-5) + (vector-! s4-1 v1-31 (-> sv-592 best-other-tri intersect)) + (vector-normalize! s4-1 1.0) + (let ((s3-0 (new 'stack-no-clear 'quaternion))) + (quaternion-from-two-vectors-partial! s3-0 (-> this ground-normal s5-1) s4-1 (* 4.0 (seconds-per-frame))) + (vector-orient-by-quat! (-> this ground-normal s5-1) (-> this ground-normal s5-1) s3-0) + ) + ) + 0 + ) + ) + (let ((s4-2 (new 'stack-no-clear 'quaternion))) + (quaternion-from-two-vectors-partial! + s4-2 + (-> this ground-normal s5-1) + (-> sv-604 uvec) + (* 3.0 (seconds-per-frame)) + ) + (vector-orient-by-quat! (-> this ground-normal s5-1) (-> this ground-normal s5-1) s4-2) + ) + (vector+! (-> this path-dir) (-> this path-dir) (-> this ground-normal s5-1)) ) ) - (let ((s4-2 (new 'stack-no-clear 'quaternion))) - (quaternion-from-two-vectors-partial! - s4-2 - (-> this ground-normal s5-1) - (-> sv-604 uvec) - (* 3.0 (seconds-per-frame)) - ) - (vector-orient-by-quat! (-> this ground-normal s5-1) (-> this ground-normal s5-1) s4-2) - ) - (vector+! (-> this path-dir) (-> this path-dir) (-> this ground-normal s5-1)) ) (vector-normalize! (-> this path-dir) 1.0) 0 @@ -387,21 +383,22 @@ ) (defun tizard-tilt-jmod-func ((arg0 cspace) (arg1 transformq)) - (local-vars (sv-32 tizard) (sv-36 int) (sv-40 quaternion)) - (set! sv-32 (the-as tizard (-> arg0 param1))) - (set! sv-36 (the-as int (-> arg0 param2))) - (set! sv-40 (new 'stack-no-clear 'quaternion)) - (let ((s4-0 (new 'stack-no-clear 'vector)) - (s3-0 (new 'stack-no-clear 'vector)) + (let ((sv-32 (the-as tizard (-> arg0 param1))) + (sv-36 (the-as int (-> arg0 param2))) + (sv-40 (new 'stack-no-clear 'quaternion)) ) - (let ((s2-0 (-> (the-as tizard sv-32) root quat))) - (vector-inv-orient-by-quat! s4-0 (-> (the-as tizard sv-32) rotation-matrix uvec) s2-0) - (vector-inv-orient-by-quat! s3-0 (-> (the-as tizard sv-32) ground-normal sv-36) s2-0) + (let ((s4-0 (new 'stack-no-clear 'vector)) + (s3-0 (new 'stack-no-clear 'vector)) + ) + (let ((s2-0 (-> (the-as tizard sv-32) root quat))) + (vector-inv-orient-by-quat! s4-0 (-> (the-as tizard sv-32) rotation-matrix uvec) s2-0) + (vector-inv-orient-by-quat! s3-0 (-> (the-as tizard sv-32) ground-normal sv-36) s2-0) + ) + (quaternion-from-two-vectors! sv-40 s4-0 s3-0) ) - (quaternion-from-two-vectors! sv-40 s4-0 s3-0) + (quaternion-normalize! sv-40) + (quaternion*! (-> arg1 quat) (-> arg1 quat) sv-40) ) - (quaternion-normalize! sv-40) - (quaternion*! (-> arg1 quat) (-> arg1 quat) sv-40) (quaternion-normalize! (-> arg1 quat)) (cspace<-parented-transformq-joint! arg0 arg1) 0 diff --git a/goal_src/jak3/levels/wascity/traffic-util.gc b/goal_src/jak3/levels/wascity/traffic-util.gc index 9384ebbc11..8c021f24cc 100644 --- a/goal_src/jak3/levels/wascity/traffic-util.gc +++ b/goal_src/jak3/levels/wascity/traffic-util.gc @@ -13,7 +13,6 @@ ) (defmethod debug-draw ((this vis-cell)) - (local-vars (sv-48 (function _varargs_ object))) (dotimes (s5-0 (-> this segment-count)) (let ((s4-0 (-> this segment-array s5-0))) (add-debug-line #t (bucket-id debug) (-> s4-0 vertex 0) (-> s4-0 vertex 1) *color-white* #f *color-black*) @@ -27,13 +26,7 @@ (s1-0 #t) (s0-0 583) ) - (set! sv-48 format) - (let ((a0-7 (clear *temp-string*)) - (a1-2 "~d") - (a2-1 (-> s4-0 branch clock-type)) - ) - (sv-48 a0-7 a1-2 a2-1) - ) + (format (clear *temp-string*) "~d" (-> s4-0 branch clock-type)) (s2-0 s1-0 (the-as bucket-id s0-0) *temp-string* s3-1 (font-color red) (the-as vector2h #f)) ) (add-debug-x #t (bucket-id debug) (-> s4-0 vertex 1) *color-red*) @@ -366,54 +359,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) @@ -617,13 +603,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))) (vector-copy! arg2 arg0) (vector+*! arg2 arg2 (-> s5-0 0) f1-15) ) @@ -636,11 +619,10 @@ ) (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)) @@ -679,25 +661,6 @@ ) (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) @@ -712,173 +675,180 @@ (format 0 "segments not generates~%") (return #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) - ) - (vector-copy! v1-26 (-> a1-1 position)) - (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) - ) - (vector-copy! v1-29 (-> a1-4 position)) - (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) - ) - (vector-copy! v1-72 (-> a1-16 position)) - (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) ) - (vector-copy! v1-76 (-> a1-19 position)) - (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) + ) + (vector-copy! v1-26 (-> a1-1 position)) + (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) + ) + (vector-copy! v1-29 (-> a1-4 position)) + (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)) - (vector-copy! sv-248 (-> sv-104 pos)) - (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 #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)) - (vector-copy! (-> s2-1 vertex 1) (-> sv-104 pos)) - (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) + ) + (vector-copy! v1-72 (-> a1-16 position)) + (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) + ) + (vector-copy! v1-76 (-> a1-19 position)) + (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)) + (vector-copy! sv-248 (-> sv-104 pos)) + (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 #f) + ) + (let ((s2-1 (-> sv-260 segment-array a2-14))) + (set! (-> s2-1 vertex 0 quad) (-> sv-248 quad)) + (vector-copy! (-> s2-1 vertex 1) (-> sv-104 pos)) + (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)) ) ) ) @@ -943,19 +913,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))) ) @@ -1017,7 +982,6 @@ ) (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))) @@ -1036,50 +1000,55 @@ (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) - ) - (vector-copy! v1-35 (-> a1-7 position)) - (set! (-> v1-35 w) 1.0) - ) - (let ((a1-10 sv-80) - (v1-36 sv-92) - ) - (vector-copy! v1-36 (-> a1-10 position)) - (set! (-> v1-36 w) 1.0) - ) - (vector-! sv-84 sv-92 sv-88) - (vector+float*! sv-84 sv-88 sv-84 0.5) - (let ((s4-1 add-debug-text-3d) - (s3-0 #t) - (s2-0 583) - ) - (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) + ) + (vector-copy! v1-35 (-> a1-7 position)) + (set! (-> v1-35 w) 1.0) + ) + (let ((a1-10 sv-80) + (v1-36 sv-92) + ) + (vector-copy! v1-36 (-> a1-10 position)) + (set! (-> v1-36 w) 1.0) + ) + (vector-! sv-84 sv-92 sv-88) ) - (the-as vector2h #f) + (vector+float*! sv-84 sv-88 sv-84 0.5) + ) + (let ((s4-1 add-debug-text-3d) + (s3-0 #t) + (s2-0 583) + ) + (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)) ) ) ) diff --git a/goal_src/jak3/levels/wascity/wascity-turret.gc b/goal_src/jak3/levels/wascity/wascity-turret.gc index 376291197b..755b8f874a 100644 --- a/goal_src/jak3/levels/wascity/wascity-turret.gc +++ b/goal_src/jak3/levels/wascity/wascity-turret.gc @@ -1090,19 +1090,7 @@ ;; ERROR: Unsupported inline assembly instruction kind - [madda.s f1, f4] ;; ERROR: Unsupported inline assembly instruction kind - [madd.s f0, f2, f5] (defmethod wascity-turret-method-62 ((this wascity-turret)) - (local-vars - (f0-30 float) - (sv-896 collide-prim-core) - (sv-912 vector) - (sv-928 vector) - (sv-944 int) - (sv-960 process) - (sv-976 collide-shape-prim) - (sv-992 int) - (sv-1008 vector) - (sv-1024 vector) - (sv-1040 vector) - ) + (local-vars (f0-30 float)) (with-pp (rlet ((vf0 :class vf) (vf4 :class vf) @@ -1130,9 +1118,10 @@ (set! (-> s4-0 length) s2-1) (let ((s3-1 (the-as process #f))) (dotimes (s1-0 s2-1) - (set! sv-896 (-> s4-0 s1-0 root-prim prim-core)) - (let ((s0-0 (-> s4-0 s1-0 root-prim cshape process))) - (set! sv-912 (new 'stack-no-clear 'vector)) + (let ((sv-896 (-> s4-0 s1-0 root-prim prim-core)) + (s0-0 (-> s4-0 s1-0 root-prim cshape process)) + (sv-912 (new 'stack-no-clear 'vector)) + ) (let ((v1-21 sv-896) (a0-8 (-> s5-0 trans)) ) @@ -1165,12 +1154,9 @@ (if #f (add-debug-sphere #t (bucket-id debug) (-> sv-896 world-sphere) (-> sv-896 world-sphere w) *color-red*) ) - (let* ((t9-8 vector-normalize-copy!) - (a0-22 (new 'stack-no-clear 'vector)) - (a2-7 1.0) - (f22-0 (vector-dot (t9-8 a0-22 sv-912 a2-7) (-> s5-0 fvec))) - ) - (set! sv-928 (new 'stack-no-clear 'vector)) + (let ((f22-0 (vector-dot (vector-normalize-copy! (new 'stack-no-clear 'vector) sv-912 1.0) (-> s5-0 fvec))) + (sv-928 (new 'stack-no-clear 'vector)) + ) (set-vector! sv-928 f24-0 0.0 (-> sv-896 world-sphere w) 1.0) (vector-normalize! sv-928 1.0) (let ((f0-17 (/ f22-0 (-> sv-928 x)))) @@ -1197,69 +1183,70 @@ (when (and s2-2 (as-type (-> (the-as process-drawable s2-2) root) collide-shape)) (let ((s0-1 (new 'stack-no-clear 'vector)) (s1-1 (new 'stack-no-clear 'vector)) + (sv-1024 (new 'stack-no-clear 'vector)) + (s3-2 (new 'stack-no-clear 'vector)) + (s4-3 (new 'stack-no-clear 'vector)) + (sv-1040 (new 'stack-no-clear 'vector)) + (sv-976 (-> (the-as collide-shape (-> (the-as process-drawable s2-2) root)) root-prim)) + (sv-944 -1) ) - (set! sv-1024 (new 'stack-no-clear 'vector)) - (let ((s3-2 (new 'stack-no-clear 'vector)) - (s4-3 (new 'stack-no-clear 'vector)) - ) - (set! sv-1040 (new 'stack-no-clear 'vector)) - (set! sv-976 (-> (the-as collide-shape (-> (the-as process-drawable s2-2) root)) root-prim)) - (set! sv-944 -1) - (vector-copy! s1-1 (-> sv-976 prim-core world-sphere)) - (vector-copy! sv-1024 s1-1) - (vector-copy! s0-1 s1-1) - (when (= (-> s2-2 type) skeet) - (set! sv-960 s2-2) - (let ((f28-1 (/ f28-0 (meters 1800)))) - (if #f - (add-debug-sphere #t (bucket-id debug) s1-1 (meters 12) *color-red*) - ) - (vector+*! s0-1 s1-1 (-> (the-as skeet sv-960) pvel) f28-1) - ) - (if #f - (add-debug-sphere #t (bucket-id debug) s0-1 (meters 12) *color-green*) + (vector-copy! s1-1 (-> sv-976 prim-core world-sphere)) + (vector-copy! sv-1024 s1-1) + (vector-copy! s0-1 s1-1) + (when (= (-> s2-2 type) skeet) + (let ((sv-960 s2-2) + (f28-1 (/ f28-0 (meters 1800))) ) + (if #f + (add-debug-sphere #t (bucket-id debug) s1-1 (meters 12) *color-red*) + ) + (vector+*! s0-1 s1-1 (-> (the-as skeet sv-960) pvel) f28-1) ) - (when (and (= (-> s2-2 type) maker) (= (-> sv-976 type) collide-shape-prim-group)) - (if #f - (add-debug-sphere #t (bucket-id debug) s1-1 (-> s1-1 w) *color-red*) + (if #f + (add-debug-sphere #t (bucket-id debug) s0-1 (meters 12) *color-green*) + ) + ) + (when (and (= (-> s2-2 type) maker) (= (-> sv-976 type) collide-shape-prim-group)) + (if #f + (add-debug-sphere #t (bucket-id debug) s1-1 (-> s1-1 w) *color-red*) + ) + (let ((f28-2 1.0) + (sv-992 0) ) - (let ((f28-2 1.0)) - (set! sv-992 0) - (while (< sv-992 (the-as int (-> sv-976 specific 0))) - (let* ((a1-19 - (vector-! - (new 'stack-no-clear 'vector) - (-> (the-as collide-shape-prim-group sv-976) child sv-992 prim-core world-sphere) - (-> s5-0 trans) - ) + (while (< sv-992 (the-as int (-> sv-976 specific 0))) + (let* ((a1-19 + (vector-! + (new 'stack-no-clear 'vector) + (-> (the-as collide-shape-prim-group sv-976) child sv-992 prim-core world-sphere) + (-> s5-0 trans) ) - (f26-2 - (- 1.0 (vector-dot (vector-normalize-copy! (new 'stack-no-clear 'vector) a1-19 1.0) (-> this aim-dir))) - ) - (a1-20 (new 'stack-no-clear 'event-message-block)) ) - (set! (-> a1-20 from) (process->ppointer pp)) - (set! (-> a1-20 num-params) 1) - (set! (-> a1-20 message) 'is-section-shot) - (set! (-> a1-20 param 0) (-> (the-as collide-shape-prim-group sv-976) child sv-992 prim-id)) - (when (and (not (send-event-function s2-2 a1-20)) (< f26-2 f28-2)) - (vector-copy! s0-1 (-> (the-as collide-shape-prim-group sv-976) child sv-992 prim-core world-sphere)) - (vector-copy! sv-1024 s0-1) - (vector-copy! s1-1 s0-1) - (if #f - (add-debug-sphere #t (bucket-id debug) s0-1 (-> s0-1 w) *color-blue*) - ) - (set! f28-2 f26-2) - (set! sv-944 (the-as int (-> (the-as collide-shape-prim-group sv-976) child sv-992 prim-id))) - (the-as uint sv-944) - ) + (f26-2 + (- 1.0 (vector-dot (vector-normalize-copy! (new 'stack-no-clear 'vector) a1-19 1.0) (-> this aim-dir))) + ) + (a1-20 (new 'stack-no-clear 'event-message-block)) + ) + (set! (-> a1-20 from) (process->ppointer pp)) + (set! (-> a1-20 num-params) 1) + (set! (-> a1-20 message) 'is-section-shot) + (set! (-> a1-20 param 0) (-> (the-as collide-shape-prim-group sv-976) child sv-992 prim-id)) + (when (and (not (send-event-function s2-2 a1-20)) (< f26-2 f28-2)) + (vector-copy! s0-1 (-> (the-as collide-shape-prim-group sv-976) child sv-992 prim-core world-sphere)) + (vector-copy! sv-1024 s0-1) + (vector-copy! s1-1 s0-1) + (if #f + (add-debug-sphere #t (bucket-id debug) s0-1 (-> s0-1 w) *color-blue*) + ) + (set! f28-2 f26-2) + (set! sv-944 (the-as int (-> (the-as collide-shape-prim-group sv-976) child sv-992 prim-id))) + (the-as uint (the-as uint sv-944)) ) - (set! sv-992 (+ sv-992 1)) ) + (+! sv-992 1) ) ) - (set! sv-1008 (new 'stack-no-clear 'vector)) + ) + (let ((sv-1008 (new 'stack-no-clear 'vector))) (let ((f0-23 (vector-vector-distance s1-1 (-> s5-0 trans)))) (set! (-> sv-1008 x) (-> s1-1 w)) (set! (-> sv-1008 y) 0.0) @@ -1272,11 +1259,7 @@ ) (vector-! s3-2 s0-1 (-> s5-0 trans)) (vector-! s4-3 s1-1 (-> s5-0 trans)) - (let ((a1-32 sv-1040) - (v1-138 (-> s5-0 trans)) - ) - (vector-! a1-32 sv-1024 v1-138) - ) + (vector-! sv-1040 sv-1024 (-> s5-0 trans)) (vector-normalize! s3-2 1.0) (vector-normalize! s4-3 1.0) (vector-normalize! sv-1040 1.0) @@ -1284,18 +1267,7 @@ (f26-3 (acos (vector-dot s4-3 (-> s5-0 fvec)))) (t9-27 acos) ) - (let* ((v1-141 (-> s5-0 fvec)) - ; (f0-29 (-> sv-1040 x)) - ; (f1-3 (-> sv-1040 y)) - ; (f2-0 (-> sv-1040 z)) - ; (f3-0 (-> v1-141 x)) - ; (f4-0 (-> v1-141 y)) - ; (f5-0 (-> v1-141 z)) - ) - ;; og:preserve-this - ; (.mula.s f0-29 f3-0) - ; (.madda.s f1-3 f4-0) - ; (.madd.s f0-30 f2-0 f5-0) + (let* ((v1-141 (-> s5-0 fvec))) (set! f0-30 (vector-dot sv-1040 v1-141)) ) (let ((f24-1 (t9-27 f0-30)) diff --git a/goal_src/jak3/levels/wascity/wasdef-manager.gc b/goal_src/jak3/levels/wascity/wasdef-manager.gc index 067fc1c0a9..7985dfde83 100644 --- a/goal_src/jak3/levels/wascity/wasdef-manager.gc +++ b/goal_src/jak3/levels/wascity/wasdef-manager.gc @@ -2232,7 +2232,7 @@ (set! (-> self prim-targeted) -1) (set! (-> self damage-idx) 0) (dotimes (s4-2 5) - (set! (-> self damage-info s4-2 part) (create-launch-control (-> *part-group-id-table* 543) self)) + (set! (-> self damage-info s4-2 part) (create-launch-control group-maker-damage-sparks self)) ;; og:preserve-this (vector-reset! (-> self damage-info s4-2 pos)) (set! (-> self damage-info s4-2 jnt) (the-as uint (-> *maker-damage-joint-array* s4-2))) @@ -2403,10 +2403,8 @@ (let ((s5-0 (new 'stack-no-clear 'vector))) 0.0 (set-vector! s5-0 6585594.5 263189.94 -1938929.1 1.0) - (let ((f0-5 (vector-vector-distance-squared s5-0 (target-pos 0))) - (f1-0 409600.0) - ) - (if (and (< (* f1-0 f1-0) f0-5) (!= (-> this info index) 1)) + (let ((f0-5 (vector-vector-distance-squared s5-0 (target-pos 0)))) + (if (and (< (square 409600.0) f0-5) (!= (-> this info index) 1)) (send-event this 'fail) ) ) diff --git a/goal_src/jak3/levels/wascity/wasgun-manager.gc b/goal_src/jak3/levels/wascity/wasgun-manager.gc index 717960944e..8207d89120 100644 --- a/goal_src/jak3/levels/wascity/wasgun-manager.gc +++ b/goal_src/jak3/levels/wascity/wasgun-manager.gc @@ -1774,7 +1774,7 @@ ;; WARN: disable def twice: 88. This may happen when a cond (no else) is nested inside of another conditional, but it should be rare. ;; WARN: Function (method 26 task-manager-wascity-gungame) has a return type of none, but the expression builder found a return statement. (defmethod task-manager-method-26 ((this task-manager-wascity-gungame)) - (local-vars (a0-16 symbol) (sv-160 int)) + (local-vars (a0-16 symbol)) (if (not (handle->process (-> this wct))) (set! (-> this wct) (process->handle (process-by-name "wascity-turret-1" *active-pool*))) ) @@ -1786,34 +1786,30 @@ (set! (-> a1-3 y) 262144.0) (set! (-> a1-3 z) -1955430.4) (set! (-> a1-3 w) 1.0) - (set! a0-16 (cond - ((and (< 184320.0 (-> s5-0 y)) (let ((f0-5 (vector-vector-xz-distance-squared s5-0 a1-3)) - (f1-1 163840.0) - ) - (< f0-5 (* f1-1 f1-1)) - ) - ) - (when (not (-> this halfway-up?)) - (set! (-> this halfway-up?) #t) - (if (or (task-node-open? (game-task-node wascity-defend-get-to)) - (task-node-open? (game-task-node wascity-defend-introduction)) - ) - (set-setting! 'extra-bank '((wascity1 wasdef1)) 0.0 0) - (set-setting! 'extra-bank '((wascity3 wasgun2)) 0.0 0) - ) - (set! a0-16 #t) - (set! (-> *sky-work* disable-day-star) (the-as basic a0-16)) - a0-16 - ) + (set! a0-16 + (cond + ((and (< 184320.0 (-> s5-0 y)) (< (vector-vector-xz-distance-squared s5-0 a1-3) (square 163840.0))) + (when (not (-> this halfway-up?)) + (set! (-> this halfway-up?) #t) + (if (or (task-node-open? (game-task-node wascity-defend-get-to)) + (task-node-open? (game-task-node wascity-defend-introduction)) + ) + (set-setting! 'extra-bank '((wascity1 wasdef1)) 0.0 0) + (set-setting! 'extra-bank '((wascity3 wasgun2)) 0.0 0) ) - (else - (when (-> this halfway-up?) - (set! (-> this halfway-up?) #f) - (set! (-> *sky-work* disable-day-star) #f) - #f - ) - ) - ) + (set! a0-16 #t) + (set! (-> *sky-work* disable-day-star) (the-as basic a0-16)) + a0-16 + ) + ) + (else + (when (-> this halfway-up?) + (set! (-> this halfway-up?) #f) + (set! (-> *sky-work* disable-day-star) #f) + #f + ) + ) + ) ) ) ) @@ -1854,10 +1850,8 @@ (let ((s5-1 (new 'stack-no-clear 'vector))) 0.0 (set-vector! s5-1 6585594.5 263189.94 -1938929.1 1.0) - (let ((f0-11 (vector-vector-distance-squared s5-1 (target-pos 0))) - (f1-4 409600.0) - ) - (if (and (< (* f1-4 f1-4) f0-11) (!= (-> this info index) 1)) + (let ((f0-11 (vector-vector-distance-squared s5-1 (target-pos 0)))) + (if (and (< (square 409600.0) f0-11) (!= (-> this info index) 1)) (send-event this 'fail) ) ) @@ -1868,18 +1862,7 @@ (> (-> this point-queue) 0) ) (set! (-> this last-miss-count) (-> this miss-count)) - (let ((s5-2 sound-play-by-name) - (sname (static-sound-name "point-gained")) - (s3-0 (new-sound-id)) - (s2-0 1024) - (s1-0 0) - (s0-0 0) - ) - (set! sv-160 0) - (let ((t2-0 (wascity-turret-gun-pos))) - (s5-2 (the-as sound-name sname) s3-0 s2-0 s1-0 s0-0 (the-as sound-group sv-160) t2-0) - ) - ) + (sound-play "point-gained" :position (wascity-turret-gun-pos)) (set-time! (-> this added-points-time)) (cond ((< 33 (-> this point-queue)) @@ -2339,17 +2322,17 @@ ) (defmethod task-manager-wascity-gungame-method-33 ((this task-manager-wascity-gungame)) - (local-vars (sv-16 res-tag)) (let ((s5-0 (entity-by-name "wascity-gungame-manager-1"))) (when #f (format 0 "***** Found entity for wascity-gungame~%") (set! (-> this wascity-gungame-entity) s5-0) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-1 (res-lump-data s5-0 'actor-groups pointer :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-1 (res-lump-data s5-0 'actor-groups (pointer actor-group) :tag-ptr (& sv-16))) + ) (cond ((and v1-1 (nonzero? (-> sv-16 elt-count))) (set! (-> this actor-group-count) (the-as int (-> sv-16 elt-count))) - (set! (-> this actor-group) (the-as (pointer actor-group) v1-1)) + (set! (-> this actor-group) v1-1) ) (else (format 0 "ERROR: task-manager-glider glider-manager entity missing actor-group!~%") diff --git a/goal_src/jak3/levels/wascity/wasstadium/nst-gas.gc b/goal_src/jak3/levels/wascity/wasstadium/nst-gas.gc index c3abce831b..879ce2a871 100644 --- a/goal_src/jak3/levels/wascity/wasstadium/nst-gas.gc +++ b/goal_src/jak3/levels/wascity/wasstadium/nst-gas.gc @@ -358,7 +358,7 @@ ) (when v1-5 (let ((f0-0 (-> (the-as task-manager-nest-cocoon-gas v1-5) poison-level))) - (set! (-> arg1 fade w) (* 0.006666667 (lerp 4.0 12.0 (* f0-0 f0-0)))) + (set! (-> arg1 fade w) (* 0.006666667 (lerp 4.0 12.0 (square f0-0)))) ) ) ) diff --git a/goal_src/jak3/levels/wascity/wasstadium/nst-tasks.gc b/goal_src/jak3/levels/wascity/wasstadium/nst-tasks.gc index 238df48409..54e89670ca 100644 --- a/goal_src/jak3/levels/wascity/wasstadium/nst-tasks.gc +++ b/goal_src/jak3/levels/wascity/wasstadium/nst-tasks.gc @@ -397,16 +397,16 @@ ;; WARN: Return type mismatch object vs none. (defmethod init-actor-group! ((this task-manager-nest-cocoons)) - (local-vars (sv-16 res-tag)) (let ((a0-2 (entity-by-name "nst-cocoon-manager-1"))) (when a0-2 (set! (-> this cocoon-manager-entity) (the-as entity-actor a0-2)) - (set! sv-16 (new 'static 'res-tag)) - (let ((v0-2 (res-lump-data a0-2 'actor-groups pointer :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v0-2 (res-lump-data a0-2 'actor-groups (pointer actor-group) :tag-ptr (& sv-16))) + ) (cond ((and v0-2 (nonzero? (-> sv-16 elt-count))) (set! (-> this actor-group-count) (the-as int (-> sv-16 elt-count))) - (set! (-> this actor-group) (the-as (pointer actor-group) v0-2)) + (set! (-> this actor-group) v0-2) ) (else (format 0 "ERROR: ~s: entity missing actor-group!~%" (game-task->string (-> this node-info task))) diff --git a/goal_src/jak3/levels/wascity/wasstadium/sig-rider.gc b/goal_src/jak3/levels/wascity/wasstadium/sig-rider.gc index 53c17bafe9..5f44f2059b 100644 --- a/goal_src/jak3/levels/wascity/wasstadium/sig-rider.gc +++ b/goal_src/jak3/levels/wascity/wasstadium/sig-rider.gc @@ -124,10 +124,9 @@ ) (let ((v1-14 (-> *target* pilot))) (when (time-elapsed? (-> self complain-time) (seconds 3)) - (let* ((f0-0 1228800.0) - (f0-2 (* f0-0 f0-0)) - (a0-7 (-> v1-14 accel-array)) - ) + (let ((f0-2 (square 1228800.0)) + (a0-7 (-> v1-14 accel-array)) + ) (when (or (< f0-2 (+ (* (-> a0-7 0 x) (-> a0-7 0 x)) (* (-> a0-7 0 z) (-> a0-7 0 z)))) (< 4915200.0 (fabs (-> v1-14 accel-array 0 y))) ) @@ -171,11 +170,9 @@ ) ) ) - (let ((f0-4 20480.0)) - (if (< (* f0-4 f0-4) (vector-length-squared (-> *target* control transv))) - (set-time! (-> self last-moved-time)) - ) - ) + (if (< (square 20480.0) (vector-length-squared (-> *target* control transv))) + (set-time! (-> self last-moved-time)) + ) (when (time-elapsed? (-> self last-moved-time) (seconds 8)) (talker-spawn-func (-> *nest-eggs-speech-list* 20) *entity-pool* (target-pos 0) (the-as region #f)) (set! (-> self last-moved-time) (+ (current-time) (seconds 24))) diff --git a/goal_src/jak3/levels/wascity/wasstadium/wasstadb-obs.gc b/goal_src/jak3/levels/wascity/wasstadium/wasstadb-obs.gc index 12673c8779..ea9ee678f2 100644 --- a/goal_src/jak3/levels/wascity/wasstadium/wasstadb-obs.gc +++ b/goal_src/jak3/levels/wascity/wasstadium/wasstadb-obs.gc @@ -1136,7 +1136,6 @@ ;; WARN: Return type mismatch object vs none. (defmethod set-time-limit ((this task-manager-arena-training)) - (local-vars (sv-16 res-tag)) (when (not *arena-trainer-checkpoint-valid*) (set! *arena-trainer-checkpoint-time* 0.0) (set! (-> *arena-trainer-checkpoint-tokens* 0) (the-as uint -1)) @@ -1150,12 +1149,13 @@ (let ((a0-6 (entity-by-name "arena-trainer-1"))) (when a0-6 (set! (-> this entity) (the-as entity-actor a0-6)) - (set! sv-16 (new 'static 'res-tag)) - (let ((v0-5 (res-lump-data a0-6 'actor-groups pointer :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v0-5 (res-lump-data a0-6 'actor-groups (pointer actor-group) :tag-ptr (& sv-16))) + ) (cond ((and v0-5 (nonzero? (-> sv-16 elt-count))) (set! (-> this actor-group-count) (the-as int (-> sv-16 elt-count))) - (set! (-> this actor-group) (the-as (pointer actor-group) v0-5)) + (set! (-> this actor-group) v0-5) ) (else (format 0 "ERROR: ~s: entity missing actor-group!~%" (game-task->string (-> this node-info task))) diff --git a/goal_src/jak3/levels/wascity/wasstadium/wasstadc-obs.gc b/goal_src/jak3/levels/wascity/wasstadium/wasstadc-obs.gc index 74cce5f5e6..afd2164b7a 100644 --- a/goal_src/jak3/levels/wascity/wasstadium/wasstadc-obs.gc +++ b/goal_src/jak3/levels/wascity/wasstadium/wasstadc-obs.gc @@ -145,12 +145,6 @@ ) (defmethod wstd-fight-plat-box-method-40 ((this wstd-fight-plat-box)) - (local-vars - (sv-144 (function sparticle-launch-control vector object)) - (sv-160 vector) - (sv-176 vector) - (sv-192 vector) - ) (rlet ((acc :class vf) (vf0 :class vf) (vf4 :class vf) @@ -185,16 +179,19 @@ (vector-normalize! s0-0 1.0) (when (< (vector-dot s0-0 (vector-! (new 'stack-no-clear 'vector) (camera-pos) (-> s5-0 s4-0))) 16384.0) (dotimes (s1-2 5) - (let ((s0-1 (-> this part))) - (set! sv-144 (method-of-object s0-1 spawn)) - (set! sv-192 (new 'stack-no-clear 'vector)) - (set! sv-160 (-> s5-0 s4-0)) - (set! sv-176 s2-1) - (let ((v1-39 (rand-vu))) - (.mov vf7 v1-39) + (let* ((s0-1 (-> this part)) + (sv-144 (method-of-object s0-1 spawn)) + (sv-192 (new 'stack-no-clear 'vector)) + ) + (let ((sv-160 (-> s5-0 s4-0))) + (let ((sv-176 s2-1)) + (let ((v1-39 (rand-vu))) + (.mov vf7 v1-39) + ) + (.lvf vf5 (&-> sv-176 quad)) + ) + (.lvf vf4 (&-> sv-160 quad)) ) - (.lvf vf5 (&-> sv-176 quad)) - (.lvf vf4 (&-> sv-160 quad)) (.add.x.vf.w vf6 vf0 vf0) (.mul.x.vf.xyz acc vf5 vf7) (.add.mul.w.vf.xyz vf6 vf4 vf0 acc) @@ -1172,7 +1169,7 @@ (ja-no-eval :group! (ja-group) :num! (loop!) :frame-num 0.0) (ja-post) (logclear! (-> self mask) (process-mask actor-pause)) - (set! (-> self part) (create-launch-control (-> *part-group-id-table* 487) self)) + (set! (-> self part) (create-launch-control group-wasstada-lava-sploop self)) ;; og:preserve-this ; (set! (-> self translate) arg2) (set! (-> self translate) 1.0) @@ -2386,19 +2383,19 @@ ;; WARN: Return type mismatch object vs none. (defmethod set-time-limit ((this task-manager-arena-fight)) - (local-vars (sv-16 res-tag)) (let ((t9-0 (method-of-type task-manager set-time-limit))) (t9-0 this) ) (let ((a0-3 (entity-by-name "arena-fight-1"))) (when a0-3 (set! (-> this entity) (the-as entity-actor a0-3)) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-3 (res-lump-data a0-3 'actor-groups pointer :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-3 (res-lump-data a0-3 'actor-groups (pointer actor-group) :tag-ptr (& sv-16))) + ) (cond ((and v1-3 (nonzero? (-> sv-16 elt-count))) (set! (-> this actor-group-count) (the-as int (-> sv-16 elt-count))) - (set! (-> this actor-group) (the-as (pointer actor-group) v1-3)) + (set! (-> this actor-group) v1-3) ) (else (format 0 "ERROR: ~s: entity missing actor-group!~%" (game-task->string (-> this node-info task))) @@ -2854,7 +2851,6 @@ ;; WARN: Return type mismatch object vs none. (defmethod set-time-limit ((this task-manager-arena-fight-2)) - (local-vars (sv-16 res-tag)) (let ((t9-0 (method-of-type task-manager set-time-limit))) (t9-0 this) ) @@ -2873,12 +2869,13 @@ (let ((a0-8 (entity-by-name "arena-fight-1"))) (when a0-8 (set! (-> this entity) (the-as entity-actor a0-8)) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-10 (res-lump-data a0-8 'actor-groups pointer :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-10 (res-lump-data a0-8 'actor-groups (pointer actor-group) :tag-ptr (& sv-16))) + ) (cond ((and v1-10 (nonzero? (-> sv-16 elt-count))) (set! (-> this actor-group-count) (the-as int (-> sv-16 elt-count))) - (set! (-> this actor-group) (the-as (pointer actor-group) v1-10)) + (set! (-> this actor-group) v1-10) ) (else (format 0 "ERROR: ~s: entity missing actor-group!~%" (game-task->string (-> this node-info task))) @@ -3123,7 +3120,6 @@ ;; WARN: Return type mismatch object vs none. (defmethod set-time-limit ((this task-manager-arena-fight-3)) - (local-vars (sv-16 res-tag)) (let ((t9-0 (method-of-type task-manager set-time-limit))) (t9-0 this) ) @@ -3139,12 +3135,13 @@ (let ((a0-8 (entity-by-name "arena-fight-1"))) (when a0-8 (set! (-> this entity) (the-as entity-actor a0-8)) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-10 (res-lump-data a0-8 'actor-groups pointer :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-10 (res-lump-data a0-8 'actor-groups (pointer actor-group) :tag-ptr (& sv-16))) + ) (cond ((and v1-10 (nonzero? (-> sv-16 elt-count))) (set! (-> this actor-group-count) (the-as int (-> sv-16 elt-count))) - (set! (-> this actor-group) (the-as (pointer actor-group) v1-10)) + (set! (-> this actor-group) v1-10) ) (else (format 0 "ERROR: ~s: entity missing actor-group!~%" (game-task->string (-> this node-info task))) diff --git a/scripts/gsrc/update-from-decomp.py b/scripts/gsrc/update-from-decomp.py index c728ce089e..086b7a6e1f 100644 --- a/scripts/gsrc/update-from-decomp.py +++ b/scripts/gsrc/update-from-decomp.py @@ -153,6 +153,8 @@ with open(decomp_file_path) as f: decomp_form_paren_stack = [] i = i + 1 break + if i + 1 == len(lines): + break else: decomp_lines.append(line) i = i + 1 diff --git a/test/decompiler/reference/jak1/decompiler-macros.gc b/test/decompiler/reference/jak1/decompiler-macros.gc index 2e55a9bd5c..ad4eb792a2 100644 --- a/test/decompiler/reference/jak1/decompiler-macros.gc +++ b/test/decompiler/reference/jak1/decompiler-macros.gc @@ -1729,6 +1729,10 @@ ) ) +(defmacro square (x) + `(* ,x ,x) + ) + (import "goal_src/jak1/engine/data/tpages.gc") (import "goal_src/jak1/engine/data/textures.gc") \ No newline at end of file diff --git a/test/decompiler/reference/jak1/engine/anim/joint-exploder_REF.gc b/test/decompiler/reference/jak1/engine/anim/joint-exploder_REF.gc index 730ff6e588..5ff5a467a2 100644 --- a/test/decompiler/reference/jak1/engine/anim/joint-exploder_REF.gc +++ b/test/decompiler/reference/jak1/engine/anim/joint-exploder_REF.gc @@ -301,7 +301,6 @@ ;; definition for method 27 of type joint-exploder ;; INFO: Used lq/sq (defmethod joint-exploder-method-27 ((this joint-exploder) (arg0 joint-exploder-list) (arg1 int)) - (local-vars (sv-16 int) (sv-32 int) (sv-48 int)) (let ((s4-0 (the-as joint-exploder-list #f))) (let ((v1-0 1)) (until (= v1-0 5) @@ -336,9 +335,10 @@ (let ((s0-0 (-> s2-0 joint s1-0))) (cond ((>= (-> s0-0 mat vector 3 x) f30-0) - (set! sv-16 (joint-exploder-method-26 this arg0 s1-0)) - (joint-exploder-method-20 this (the-as joint-exploder-list s3-0) s1-0) - (set! s1-0 sv-16) + (let ((sv-16 (joint-exploder-method-26 this arg0 s1-0))) + (joint-exploder-method-20 this (the-as joint-exploder-list s3-0) s1-0) + (set! s1-0 sv-16) + ) (joint-exploder-method-21 this (the-as joint-exploder-list s3-0) s0-0) ) (else @@ -356,9 +356,10 @@ (let ((s0-1 (-> s2-0 joint s1-0))) (cond ((>= (-> s0-1 mat vector 3 y) f30-1) - (set! sv-32 (joint-exploder-method-26 this arg0 s1-0)) - (joint-exploder-method-20 this (the-as joint-exploder-list s3-0) s1-0) - (set! s1-0 sv-32) + (let ((sv-32 (joint-exploder-method-26 this arg0 s1-0))) + (joint-exploder-method-20 this (the-as joint-exploder-list s3-0) s1-0) + (set! s1-0 sv-32) + ) (joint-exploder-method-21 this (the-as joint-exploder-list s3-0) s0-1) ) (else @@ -376,9 +377,10 @@ (let ((s0-2 (-> s2-0 joint s1-0))) (cond ((>= (-> s0-2 mat vector 3 z) f30-2) - (set! sv-48 (joint-exploder-method-26 this arg0 s1-0)) - (joint-exploder-method-20 this (the-as joint-exploder-list s3-0) s1-0) - (set! s1-0 sv-48) + (let ((sv-48 (joint-exploder-method-26 this arg0 s1-0))) + (joint-exploder-method-20 this (the-as joint-exploder-list s3-0) s1-0) + (set! s1-0 sv-48) + ) (joint-exploder-method-21 this (the-as joint-exploder-list s3-0) s0-2) ) (else diff --git a/test/decompiler/reference/jak1/engine/anim/joint-mod-h_REF.gc b/test/decompiler/reference/jak1/engine/anim/joint-mod-h_REF.gc index dfead6c5ab..df1486c36b 100644 --- a/test/decompiler/reference/jak1/engine/anim/joint-mod-h_REF.gc +++ b/test/decompiler/reference/jak1/engine/anim/joint-mod-h_REF.gc @@ -291,71 +291,72 @@ ;; INFO: Used lq/sq ;; INFO: Return type mismatch int vs none. (defun joint-mod-look-at-handler ((csp cspace) (xform transformq)) - (local-vars (sv-48 vector) (sv-52 vector) (sv-56 vector)) (let ((gp-0 (the-as joint-mod (-> csp param1)))) (cspace<-parented-transformq-joint! csp xform) - (set! sv-48 (vector-normalize-copy! - (new 'stack-no-clear 'vector) - (-> gp-0 process node-list data 0 bone transform vector 1) - 1.0 - ) - ) - (set! sv-52 (vector-normalize! (-> csp bone transform vector (-> gp-0 nose)) 1.0)) - (set! sv-56 (vector-normalize! - (vector-! (new 'stack-no-clear 'vector) (-> gp-0 target) (-> csp bone transform vector 3)) - 1.0 - ) - ) - (let* ((f30-0 (vector-y-angle sv-52)) - (a0-9 (vector-flatten! (new-stack-vector0) sv-56 sv-48)) - (f0-0 (vector-y-angle a0-9)) - (f0-1 (deg-diff f30-0 f0-0)) - ) - (if (< (-> gp-0 ignore-angle) (fabs f0-1)) - (set! f0-1 0.0) - ) - (let ((f30-1 - (fmax (fmin (* f0-1 (-> gp-0 blend) (-> gp-0 flex-blend)) (-> gp-0 twist-max y)) (- (-> gp-0 twist-max y))) - ) - ) - (if (and (-> gp-0 shutting-down?) (= (-> gp-0 twist y) f30-1)) - (set-mode! gp-0 (joint-mod-handler-mode reset)) - ) - (set! (-> gp-0 twist y) (deg-seek (-> gp-0 twist y) f30-1 (* 0.1 (fabs (deg-diff f30-1 (-> gp-0 twist y)))))) - ) - ) - (let ((v1-15 (-> gp-0 up))) - (cond - ((zero? v1-15) - (quaternion-rotate-x! (-> xform quat) (-> xform quat) (-> gp-0 twist y)) - ) - ((= v1-15 1) - (quaternion-rotate-local-y! (-> xform quat) (-> xform quat) (-> gp-0 twist y)) - ) - (else - (quaternion-rotate-z! (-> xform quat) (-> xform quat) (-> gp-0 twist y)) - ) - ) - ) - (let* ((s3-1 (vector-normalize-copy! + (let ((sv-48 (vector-normalize-copy! (new 'stack-no-clear 'vector) - (the-as vector (-> gp-0 process node-list data 0 bone transform)) + (-> gp-0 process node-list data 0 bone transform vector 1) + 1.0 + ) + ) + (sv-52 (vector-normalize! (-> csp bone transform vector (-> gp-0 nose)) 1.0)) + (sv-56 (vector-normalize! + (vector-! (new 'stack-no-clear 'vector) (-> gp-0 target) (-> csp bone transform vector 3)) 1.0 ) ) - (f30-2 (vector-x-angle sv-52)) - (s3-2 (vector-flatten! (new-stack-vector0) sv-56 s3-1)) - (f0-15 (vector-x-angle s3-2)) - (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 s3-2 sv-52) 0.1) - (set! f0-21 0.0) ) - (set! (-> gp-0 twist x) (deg-seek (-> gp-0 twist x) f0-21 (* 0.1 (fabs (deg-diff f0-21 (-> gp-0 twist x)))))) + (let* ((f30-0 (vector-y-angle sv-52)) + (a0-9 (vector-flatten! (new-stack-vector0) sv-56 sv-48)) + (f0-0 (vector-y-angle a0-9)) + (f0-1 (deg-diff f30-0 f0-0)) + ) + (if (< (-> gp-0 ignore-angle) (fabs f0-1)) + (set! f0-1 0.0) + ) + (let ((f30-1 + (fmax (fmin (* f0-1 (-> gp-0 blend) (-> gp-0 flex-blend)) (-> gp-0 twist-max y)) (- (-> gp-0 twist-max y))) + ) + ) + (if (and (-> gp-0 shutting-down?) (= (-> gp-0 twist y) f30-1)) + (set-mode! gp-0 (joint-mod-handler-mode reset)) + ) + (set! (-> gp-0 twist y) (deg-seek (-> gp-0 twist y) f30-1 (* 0.1 (fabs (deg-diff f30-1 (-> gp-0 twist y)))))) + ) + ) + (let ((v1-15 (-> gp-0 up))) + (cond + ((zero? v1-15) + (quaternion-rotate-x! (-> xform quat) (-> xform quat) (-> gp-0 twist y)) + ) + ((= v1-15 1) + (quaternion-rotate-local-y! (-> xform quat) (-> xform quat) (-> gp-0 twist y)) + ) + (else + (quaternion-rotate-z! (-> xform quat) (-> xform quat) (-> gp-0 twist y)) + ) + ) + ) + (let* ((s3-1 (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)) + (s3-2 (vector-flatten! (new-stack-vector0) sv-56 s3-1)) + (f0-15 (vector-x-angle s3-2)) + (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 s3-2 sv-52) 0.1) + (set! f0-21 0.0) + ) + (set! (-> gp-0 twist x) (deg-seek (-> gp-0 twist x) f0-21 (* 0.1 (fabs (deg-diff f0-21 (-> gp-0 twist x)))))) + ) ) (let ((v1-27 (-> gp-0 ear))) (cond @@ -390,69 +391,67 @@ ;; INFO: Used lq/sq ;; INFO: Return type mismatch int vs none. (defun joint-mod-world-look-at-handler ((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 vector 3)) 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) ) - ) - (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 vector 3)) 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 ((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 (* 0.1 (fabs (deg-diff f0-5 (-> gp-0 twist y)))))) + (set! (-> gp-0 twist y) + (deg-seek (-> gp-0 twist y) f0-5 (fmax 1.0 (* 0.1 (fabs (deg-diff f0-5 (-> gp-0 twist y)))))) + ) + ) + ) + (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 vector 3 quad)) ) + (matrix*! s5-0 s5-0 a2-3) + (set! (-> s5-0 vector 3 quad) s4-2) + ) ) - ) - (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 vector 3 quad)) - ) - (matrix*! s5-0 s5-0 a2-3) - (set! (-> s5-0 vector 3 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 + (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-14 (vector-x-angle s4-4)) + (f0-20 + (fmax + (fmin (* (- (deg-diff f30-2 f0-14)) (-> gp-0 blend) (-> gp-0 flex-blend)) (-> gp-0 twist-max x)) + (- (-> gp-0 twist-max x)) + ) ) ) - (f30-2 (vector-x-angle sv-52)) - (s4-4 (vector-flatten! (new-stack-vector0) sv-56 s4-3)) - (f0-14 (vector-x-angle s4-4)) - (f0-20 - (fmax - (fmin (* (- (deg-diff f30-2 f0-14)) (-> 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-20 0.0) - ) - (set! (-> gp-0 twist x) - (deg-seek (-> gp-0 twist x) f0-20 (fmax 1.0 (* 0.1 (fabs (deg-diff f0-20 (-> gp-0 twist x)))))) + (if (< (vector-dot s4-4 sv-52) 0.1) + (set! f0-20 0.0) ) + (set! (-> gp-0 twist x) + (deg-seek (-> gp-0 twist x) f0-20 (fmax 1.0 (* 0.1 (fabs (deg-diff f0-20 (-> gp-0 twist x)))))) + ) + ) ) (when (!= (-> gp-0 twist x) 0.0) (let* ((v1-20 (-> gp-0 ear)) diff --git a/test/decompiler/reference/jak1/engine/anim/joint_REF.gc b/test/decompiler/reference/jak1/engine/anim/joint_REF.gc index 55be394eac..43976582d7 100644 --- a/test/decompiler/reference/jak1/engine/anim/joint_REF.gc +++ b/test/decompiler/reference/jak1/engine/anim/joint_REF.gc @@ -742,60 +742,48 @@ ;; INFO: Used lq/sq ;; ERROR: Failed load: (set! v1-29 (l.wu (+ a0-9 -4))) at op 75 (defun joint-control-remap! ((arg0 joint-control) (arg1 art-group) (arg2 art-group) (arg3 pair) (arg4 int) (arg5 string)) - (local-vars - (sv-16 int) - (sv-24 symbol) - (sv-32 int) - (sv-40 int) - (sv-48 joint-control-channel) - (sv-52 object) - (sv-56 int) - (sv-64 joint) - (sv-80 string) - ) - (set! sv-16 (+ (length (-> arg2 name)) 1)) - (set! sv-24 #t) - (set! sv-32 arg4) - (set! sv-40 2) - (while (and (< sv-40 (-> arg1 length)) (!= (-> arg1 data sv-40 type) art-joint-anim)) - (set! sv-40 (+ sv-40 1)) - ) - (dotimes (s2-1 (-> arg0 active-channels)) - (set! sv-48 (-> arg0 channel s2-1)) - (when (-> sv-48 frame-group) - (format (clear *temp-string*) "~S~G" arg5 (&+ (-> sv-48 frame-group name data) sv-16)) - (when (not (null? arg3)) - (set! sv-52 (nassoc *temp-string* arg3)) - (when sv-52 - (let ((s1-1 sv-32) - (a0-9 sv-52) + (let ((sv-16 (+ (length (-> arg2 name)) 1)) + (sv-24 #t) + ) + (let ((sv-32 arg4) + (sv-40 2) + ) + (while (and (< sv-40 (-> arg1 length)) (!= (-> arg1 data sv-40 type) art-joint-anim)) + (+! sv-40 1) + ) + (dotimes (s2-1 (-> arg0 active-channels)) + (let ((sv-48 (-> arg0 channel s2-1))) + (when (-> sv-48 frame-group) + (format (clear *temp-string*) "~S~G" arg5 (&+ (-> sv-48 frame-group name data) sv-16)) + (when (not (null? arg3)) + (let ((sv-52 (nassoc *temp-string* arg3))) + (when sv-52 + (let* ((a0-9 sv-52) + (sv-56 (mod sv-32 (+ ((method-of-type (rtype-of a0-9) length) a0-9) -1))) + ) + (format (clear *temp-string*) "~S" (ref sv-52 (+ sv-56 1))) + ) + ) ) - (set! sv-56 (mod s1-1 (+ ((method-of-type (rtype-of a0-9) length) a0-9) -1))) - ) - (let ((s1-2 format) - (s0-0 (clear *temp-string*)) + ) + (let ((sv-64 (lookup-art arg1 *temp-string* art-joint-anim))) + (cond + (sv-64 + (set! (-> sv-48 frame-group) (the-as art-joint-anim sv-64)) + ) + (else + (set! (-> sv-48 frame-group) (the-as art-joint-anim (-> arg1 data sv-40))) + (set! (-> sv-48 frame-num) 0.0) + (set! sv-24 (the-as symbol #f)) + ) ) - (set! sv-80 "~S") - (let ((a2-2 (ref sv-52 (+ sv-56 1)))) - (s1-2 s0-0 sv-80 a2-2) ) ) ) ) - (set! sv-64 (lookup-art arg1 *temp-string* art-joint-anim)) - (cond - (sv-64 - (set! (-> sv-48 frame-group) (the-as art-joint-anim sv-64)) - ) - (else - (set! (-> sv-48 frame-group) (the-as art-joint-anim (-> arg1 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/jak1/engine/camera/cam-combiner_REF.gc b/test/decompiler/reference/jak1/engine/camera/cam-combiner_REF.gc index d71302ad50..22b28c844c 100644 --- a/test/decompiler/reference/jak1/engine/camera/cam-combiner_REF.gc +++ b/test/decompiler/reference/jak1/engine/camera/cam-combiner_REF.gc @@ -156,7 +156,6 @@ ) ) :code (behavior () - (local-vars (sv-160 cam-rotation-tracker)) (loop (when (and (not (logtest? (-> *camera* master-options) 2)) (!= (-> self tracking-status) 0)) (set! (-> self tracking-status) (the-as uint 0)) @@ -200,8 +199,8 @@ ) ) (else - (set! sv-160 (-> s5-0 0 tracking)) - (let ((s2-0 (-> s5-0 0 trans)) + (let ((sv-160 (-> s5-0 0 tracking)) + (s2-0 (-> s5-0 0 trans)) (s5-1 (-> s4-0 0 tracking)) (s0-0 (-> s4-0 0 trans)) ) diff --git a/test/decompiler/reference/jak1/engine/camera/cam-layout_REF.gc b/test/decompiler/reference/jak1/engine/camera/cam-layout_REF.gc index a3e06fb202..c4608f01fa 100644 --- a/test/decompiler/reference/jak1/engine/camera/cam-layout_REF.gc +++ b/test/decompiler/reference/jak1/engine/camera/cam-layout_REF.gc @@ -272,35 +272,21 @@ ;; WARN: Stack slot offset 164 signed mismatch ;; WARN: Stack slot offset 164 signed mismatch (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 float) - (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)) (loop - (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) @@ -316,121 +302,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 (the-as float 1.0)) - (vector-cross! sv-224 sv-208 (-> s3-0 sv-272)) - (vector-normalize! sv-224 (the-as float 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 ((f30-0 (cam-layout-intersect-dist (-> s3-0 sv-288) sv-160 sv-208))) - (cond - ((= f30-0 409600000.0) - ) - ((zero? sv-168) - (vector+float*! sv-160 sv-160 sv-208 f30-0) - (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 f30-0) (>= (vector-dot sv-240 sv-176) 0.0)) - ) - ((>= (vector-dot sv-240 (-> s3-0 sv-288)) 0.0) - (when (< (fabs f30-0) (fabs sv-164)) - (set! sv-164 f30-0) - (set! sv-168 (+ sv-168 1)) - ) - ) - (else - (vector+float*! sv-160 sv-160 sv-208 f30-0) - (set! (-> sv-176 quad) (-> s3-0 sv-288 quad)) - (set! sv-168 (+ sv-168 1)) - (if (< (fabs f30-0) (fabs sv-164)) - (set! sv-164 (- sv-164 f30-0)) - (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 (the-as float 1.0)) + (vector-cross! sv-224 sv-208 (-> s3-0 sv-272)) + (vector-normalize! sv-224 (the-as float 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 ((f30-0 (cam-layout-intersect-dist (-> s3-0 sv-288) sv-160 sv-208))) + (cond + ((= f30-0 409600000.0) + ) + ((zero? sv-168) + (vector+float*! sv-160 sv-160 sv-208 f30-0) + (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 f30-0) (>= (vector-dot sv-240 sv-176) 0.0)) + ) + ((>= (vector-dot sv-240 (-> s3-0 sv-288)) 0.0) + (when (< (fabs f30-0) (fabs sv-164)) + (set! sv-164 f30-0) + (+! sv-168 1) + ) + ) + (else + (vector+float*! sv-160 sv-160 sv-208 f30-0) + (set! (-> sv-176 quad) (-> s3-0 sv-288 quad)) + (+! sv-168 1) + (set! sv-164 (cond + ((< (fabs f30-0) (fabs sv-164)) + (set! sv-164 (- sv-164 f30-0)) + sv-164 + ) + (else + 0.0 + ) + ) + ) + ) + ) + ) + ) + (+! sv-288 1) + ) + ) ) + (cond + ((zero? sv-168) + ) + ((= sv-164 0.0) + ) + (else + (dotimes (v1-87 (the-as int (-> sv-16 elt-count))) + (when (and (!= v1-87 s1-0) (!= v1-87 sv-272)) + (if (< 4096.0 (- (vector-dot sv-160 (-> s3-0 v1-87)) (-> s3-0 v1-87 w))) + (goto cfg-47) + ) + ) + ) + (vector+float*! sv-240 sv-160 sv-208 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) - ) - ((= sv-164 0.0) - ) - (else - (dotimes (v1-87 (the-as int (-> sv-16 elt-count))) - (when (and (!= v1-87 s1-0) (!= v1-87 sv-272)) - (if (< 4096.0 (- (vector-dot sv-160 (-> s3-0 v1-87)) (-> s3-0 v1-87 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 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)) - ) - ) ) ) ) @@ -974,7 +976,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 structure) (sv-192 matrix)) + (local-vars (s2-0 structure) (s3-1 structure)) (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* 8)) (when (and arg1 (nonzero? arg1)) @@ -1032,35 +1034,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*! (the-as vector s3-1) (the-as vector s3-1) s4-0 (the-as float 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*! (the-as vector s3-1) (the-as vector s3-1) s4-0 (the-as float 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)) ) ) ) @@ -2685,11 +2687,10 @@ ;; definition for function clmf-cam-string ;; INFO: Used lq/sq (defbehavior clmf-cam-string cam-layout ((arg0 string) (arg1 symbol)) - (local-vars (sv-16 res-tag)) (format arg0 ":") - (set! sv-16 (new 'static 'res-tag)) - (let ((s5-1 (res-lump-data (-> self cam-entity) arg1 pointer :tag-ptr (& sv-16) :time (the-as float -1000000000.0))) - ) + (let* ((sv-16 (new 'static 'res-tag)) + (s5-1 (res-lump-data (-> self cam-entity) arg1 pointer :tag-ptr (& sv-16) :time (the-as float -1000000000.0))) + ) (when s5-1 (dotimes (s4-0 (the-as int (-> sv-16 elt-count))) (format arg0 " ~S" (-> (the-as (pointer uint32) (&+ s5-1 (* s4-0 4))))) diff --git a/test/decompiler/reference/jak1/engine/camera/cam-master_REF.gc b/test/decompiler/reference/jak1/engine/camera/cam-master_REF.gc index 1d3d7a771d..0325ffa18c 100644 --- a/test/decompiler/reference/jak1/engine/camera/cam-master_REF.gc +++ b/test/decompiler/reference/jak1/engine/camera/cam-master_REF.gc @@ -534,22 +534,21 @@ ;; definition for function in-cam-entity-volume? ;; INFO: Used lq/sq (defun in-cam-entity-volume? ((arg0 vector) (arg1 entity) (arg2 float) (arg3 symbol)) - (local-vars (sv-16 res-tag)) (let ((s2-0 0)) (loop - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-1 (the-as object ((method-of-type res-lump get-property-data) - arg1 - arg3 - 'exact - (the float s2-0) - (the-as pointer #f) - (& sv-16) - *res-static-buf* - ) - ) - ) - ) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-1 (the-as object ((method-of-type res-lump get-property-data) + arg1 + arg3 + 'exact + (the float s2-0) + (the-as pointer #f) + (& sv-16) + *res-static-buf* + ) + ) + ) + ) (cond ((not (the-as pointer v1-1)) (return #f) @@ -651,14 +650,7 @@ ;; definition for function master-switch-to-entity ;; INFO: Used lq/sq (defbehavior master-switch-to-entity camera-master ((arg0 entity)) - (local-vars - (v0-21 object) - (gp-0 (pointer process)) - (sv-16 res-tag) - (sv-112 process) - (sv-128 string) - (sv-144 string) - ) + (local-vars (v0-21 object) (gp-0 (pointer process))) (set! (-> self cam-entity) arg0) 10 (let ((s4-0 (cam-state-from-entity arg0))) @@ -690,81 +682,78 @@ ) ) ) - (set! sv-16 (new 'static 'res-tag)) - (let ((s4-2 (res-lump-data arg0 'alternates (pointer string) :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (s4-2 (res-lump-data arg0 'alternates (pointer string) :tag-ptr (& sv-16))) + ) (when s4-2 (dotimes (s3-2 (the-as int (-> sv-16 elt-count))) (let ((s2-0 (entity-by-name (-> s4-2 s3-2)))) - (set! v0-21 - (cond - (s2-0 - (let ((s0-0 (cam-state-from-entity s2-0))) - (cond - ((= s0-0 *camera-base-mode*) - (deactivate (-> gp-0 0)) - (master-base-region s2-0) - (return #t) - v0-21 - ) - (s0-0 - (set! sv-112 (get-process *camera-dead-pool* camera-slave #x4000)) - (let ((s1-0 (when sv-112 - (let ((t9-15 (method-of-type camera-slave activate))) - (t9-15 (the-as camera-slave sv-112) self 'camera-slave (the-as pointer #x70004000)) + (set! v0-21 (cond + (s2-0 + (let ((s0-0 (cam-state-from-entity s2-0))) + (cond + ((= s0-0 *camera-base-mode*) + (deactivate (-> gp-0 0)) + (master-base-region s2-0) + (return #t) + v0-21 + ) + (s0-0 + (let* ((sv-112 (get-process *camera-dead-pool* camera-slave #x4000)) + (s1-0 (when sv-112 + ((method-of-type camera-slave activate) + (the-as camera-slave sv-112) + self + 'camera-slave + (the-as pointer #x70004000) + ) + (run-now-in-process sv-112 cam-slave-init s0-0 s2-0) + (-> sv-112 ppointer) + ) + ) + ) + (cond + (s1-0 + (setup-slave-for-hopefull (the-as camera-slave (ppointer->process s1-0))) + (cond + ((master-is-hopeful-better? + (the-as camera-slave (ppointer->process gp-0)) + (the-as camera-slave (ppointer->process s1-0)) + ) + (deactivate (-> gp-0 0)) + (set! gp-0 s1-0) + gp-0 + ) + (else + (deactivate (-> s1-0 0)) ) - (run-now-in-process sv-112 cam-slave-init s0-0 s2-0) - (-> sv-112 ppointer) ) ) - ) - (cond - (s1-0 - (setup-slave-for-hopefull (the-as camera-slave (ppointer->process s1-0))) - (cond - ((master-is-hopeful-better? - (the-as camera-slave (ppointer->process gp-0)) - (the-as camera-slave (ppointer->process s1-0)) - ) - (deactivate (-> gp-0 0)) - (set! gp-0 s1-0) - gp-0 - ) - (else - (deactivate (-> s1-0 0)) + (else + (format 0 "ERROR : alternate region activate failed~%") + ) ) ) ) (else - (format 0 "ERROR : alternate region activate failed~%") + (format + 0 + "ERROR : alternate camera region '~S' didn't produce a state~%" + (res-lump-struct s2-0 'name structure) + ) ) ) ) ) (else - (let ((s1-1 format) - (s0-1 0) - ) - (set! sv-128 "ERROR : alternate camera region '~S' didn't produce a state~%") - (let ((a2-10 (res-lump-struct s2-0 'name structure))) - (s1-1 s0-1 sv-128 a2-10) - ) + (format + 0 + "ERROR : alternate '~S' not found for '~S'~%" + (-> s4-2 s3-2) + (res-lump-struct arg0 'name structure) ) ) ) - ) - ) - (else - (let ((s2-1 format) - (s1-2 0) - (s0-2 "ERROR : alternate '~S' not found for '~S'~%") - ) - (set! sv-144 (-> s4-2 s3-2)) - (let ((a3-8 (res-lump-struct arg0 'name structure))) - (s2-1 s1-2 s0-2 sv-144 a3-8) - ) - ) - ) - ) ) ) ) diff --git a/test/decompiler/reference/jak1/engine/camera/cam-states_REF.gc b/test/decompiler/reference/jak1/engine/camera/cam-states_REF.gc index 90e51ef512..db922051c5 100644 --- a/test/decompiler/reference/jak1/engine/camera/cam-states_REF.gc +++ b/test/decompiler/reference/jak1/engine/camera/cam-states_REF.gc @@ -1490,96 +1490,93 @@ (arg5 vector) (arg6 float) ) - (local-vars (sv-128 float) (sv-144 vector) (sv-160 vector) (sv-176 vector) (sv-192 vector) (sv-208 int)) (with-pp - (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 (the-as vector (&-> pp stack 368))) - (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) (the-as vector (&-> pp stack 368))) - ) - ) - (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 (the-as vector (&-> pp stack 368))) - (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 (!= s4-0 -100000000.0)) - (dotimes (s4-1 4) - (dist-info-append - (the-as collide-los-dist-info (-> gp-0 vert-0)) - (the-as vector (+ (the-as uint s5-0) (* s4-1 16))) - ) - ) - #f - ) - ((< (-> s5-0 vector 3 y) 0.0) - (dotimes (s4-2 4) - (when (>= (-> s5-0 vector 3 y) (-> s5-0 vector s4-2 y)) - (set! (-> s5-0 vector s4-2 y) (- (-> s5-0 vector s4-2 y))) - (dist-info-append - (the-as collide-los-dist-info (-> gp-0 next-normal)) - (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 vector 3 y)) - (dist-info-append - (the-as collide-los-dist-info (-> gp-0 intersection)) - (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 (the-as vector (&-> pp stack 368))) + (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) (the-as vector (&-> pp stack 368))) ) ) + (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 (the-as vector (&-> pp stack 368))) + (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 (!= s4-0 -100000000.0)) + (dotimes (s4-1 4) + (dist-info-append + (the-as collide-los-dist-info (-> gp-0 vert-0)) + (the-as vector (+ (the-as uint s5-0) (* s4-1 16))) + ) + ) + #f + ) + ((< (-> s5-0 vector 3 y) 0.0) + (dotimes (s4-2 4) + (when (>= (-> s5-0 vector 3 y) (-> s5-0 vector s4-2 y)) + (set! (-> s5-0 vector s4-2 y) (- (-> s5-0 vector s4-2 y))) + (dist-info-append + (the-as collide-los-dist-info (-> gp-0 next-normal)) + (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 vector 3 y)) + (dist-info-append + (the-as collide-los-dist-info (-> gp-0 intersection)) + (the-as vector (+ (the-as uint s5-0) (* s4-3 16))) + ) + ) + ) + #f ) ) ) @@ -1808,7 +1805,7 @@ ;; 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 clip-travel-vector-to-mesh-return-info) (arg3 pat-surface)) - (local-vars (s1-3 int) (s2-2 int) (f2-1 float) (sv-224 vector) (sv-240 vector)) + (local-vars (s1-3 int) (s2-2 int) (f2-1 float)) (dist-info-init (the-as collide-los-dist-info (-> arg2 intersection))) (dist-info-init (the-as collide-los-dist-info (-> arg2 next-normal))) (dist-info-init (the-as collide-los-dist-info (-> arg2 vert-0))) @@ -1841,27 +1838,18 @@ (set! f28-0 1.0) ) (countdown (s0-1 (-> s0-0 num-tris)) - (set! sv-240 (new 'stack-no-clear 'vector)) - (set! sv-224 (new 'stack-no-clear 'vector)) - (let ((f0-7 - (moving-sphere-triangle-intersect arg0 arg1 (-> *CAM_STRING-bank* los-coll-rad) (-> s1-1 0) sv-240 sv-224) - ) - ) + (let* ((sv-240 (new 'stack-no-clear 'vector)) + (sv-224 (new 'stack-no-clear 'vector)) + (f0-7 + (moving-sphere-triangle-intersect arg0 arg1 (-> *CAM_STRING-bank* los-coll-rad) (-> s1-1 0) sv-240 sv-224) + ) + ) (cond ((or (< f0-7 0.0) (< 1.0 f0-7)) ) ((let ((f1-2 0.0)) - (let* ((v1-21 arg1) - (f2-0 (-> v1-21 x)) - (f3-0 (-> v1-21 y)) - (f4-0 (-> v1-21 z)) - (f5-0 (-> sv-224 x)) - (f6-0 (-> sv-224 y)) - (f7-0 (-> sv-224 z)) - ) - (.mula.s f2-0 f5-0) - (.madda.s f3-0 f6-0) - (.madd.s f2-1 f4-0 f7-0) + (let* ((v1-21 arg1)) + (set! f2-1 (vector-dot v1-21 sv-224)) ) (< f1-2 f2-1) ) @@ -1874,23 +1862,14 @@ ) (los-cw-ccw s1-1 s2-0 s4-0 f30-0 arg2 sv-240 f24-0) (when *debug-segment* - (cond - ((= f24-0 -100000000.0) - (let ((t9-11 cam-debug-add-los-tri) - (a0-13 s1-1) - (a2-7 (new 'static 'vector :x (the-as float #x80) :w (the-as float #x80))) - ) - (t9-11 a0-13 sv-240 a2-7) - ) - ) - (else + (if (= f24-0 -100000000.0) + (cam-debug-add-los-tri s1-1 sv-240 (new 'static 'vector :x (the-as float #x80) :w (the-as float #x80))) (cam-debug-add-los-tri s1-1 sv-240 (new 'static 'vector :x (the-as float #x80) :y (the-as float #x80) :w (the-as float #x80)) ) ) - ) ) ) ) @@ -2527,7 +2506,6 @@ ;; WARN: Stack slot load at 240 mismatch: defined as size 4, got size 16 ;; WARN: Stack slot load at 256 mismatch: defined as size 4, got size 16 (defbehavior cam-string-move camera-slave () - (local-vars (sv-240 float) (sv-256 float)) (vector-! (-> self velocity) (-> self desired-pos) (-> self string-trans)) (if *display-cam-los-debug* (format *stdcon* "vel ~M~%" (vector-length (-> self velocity))) @@ -2604,20 +2582,9 @@ ) ) ) - (when *display-cam-los-debug* - (let ((s2-0 format) - (s1-0 *stdcon*) - (s0-0 "vp ~f vr ~f r ~f ta ~f~%") - ) - (set! sv-240 (vector-length s5-2)) - (set! sv-256 f30-2) - (let ((t0-3 (/ (vector-length s5-2) f30-2)) - (t1-1 f28-1) - ) - (s2-0 s1-0 s0-0 sv-240 sv-256 t0-3 t1-1) - ) + (if *display-cam-los-debug* + (format *stdcon* "vp ~f vr ~f r ~f ta ~f~%" (vector-length s5-2) f30-2 (/ (vector-length s5-2) f30-2) f28-1) ) - ) (cond ((>= f28-1 0.0) (let* ((f1-7 (fmax 0.01 (/ 40.96 (vector-length s5-2)))) diff --git a/test/decompiler/reference/jak1/engine/camera/cam-update_REF.gc b/test/decompiler/reference/jak1/engine/camera/cam-update_REF.gc index 35291b5126..92ce5df40c 100644 --- a/test/decompiler/reference/jak1/engine/camera/cam-update_REF.gc +++ b/test/decompiler/reference/jak1/engine/camera/cam-update_REF.gc @@ -29,7 +29,6 @@ ;; definition for function update-view-planes ;; INFO: Used lq/sq (defun update-view-planes ((arg0 math-camera) (arg1 (inline-array plane)) (arg2 float)) - (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))) @@ -60,22 +59,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-5 (-> arg0 inv-camera-rot vector 3 quad))) - (set! (-> sv-240 quad) v1-5) - ) - (vector-! s2-0 (-> 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-0 s1-0 sv-240 0) - (plane-from-points arg1 s0-0 s3-1 sv-240 1) - (plane-from-points arg1 s3-1 s2-0 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) (-> arg0 inv-camera-rot vector 3 quad)) + (vector-! s2-0 (-> 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-0 s1-0 sv-240 0) + (plane-from-points arg1 s0-0 s3-1 sv-240 1) + (plane-from-points arg1 s3-1 s2-0 sv-240 2) + (plane-from-points arg1 s1-0 s0-0 sv-240 3) ) ) ) diff --git a/test/decompiler/reference/jak1/engine/camera/camera_REF.gc b/test/decompiler/reference/jak1/engine/camera/camera_REF.gc index 82e3632d4e..f6e936be45 100644 --- a/test/decompiler/reference/jak1/engine/camera/camera_REF.gc +++ b/test/decompiler/reference/jak1/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))))) ) ) ) @@ -358,19 +347,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 *res-key-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*) @@ -1275,10 +1257,7 @@ ((< (-> *camera* ease-t) 1.0) ) ((< (-> arg0 follow-blend) 1.0) - (let* ((f0-18 (-> arg0 follow-blend)) - (f0-19 (* f0-18 f0-18)) - (f0-20 (* f0-19 f0-19)) - ) + (let ((f0-20 (square (square (-> arg0 follow-blend))))) (vector-! s5-1 s5-1 (-> arg0 follow-off)) (vector-float*! s5-1 s5-1 f0-20) ) @@ -1315,10 +1294,10 @@ 1.0 ) (else - (let* ((f0-29 (* f0-28 f0-28)) + (let* ((f0-29 (square f0-28)) (f0-30 (- 1.0 f0-29)) ) - (* f0-30 (* f0-30 f0-30)) + (* f0-30 (square f0-30)) ) ) ) @@ -1439,7 +1418,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) @@ -1458,17 +1436,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-6 (* 0.8 (tan (/ arg2 2))))) - (.lvf vf1 (&-> sv-112 0 quad)) - (let ((v1-6 f0-6)) - (.mov vf2 v1-6) + (let ((sv-128 s2-0)) + (let ((sv-112 (-> arg0 vector)) + (f0-6 (* 0.8 (tan (/ arg2 2)))) + ) + (.lvf vf1 (&-> sv-112 0 quad)) + (let ((v1-6 f0-6)) + (.mov vf2 v1-6) + ) ) + (.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 1.0) (let ((f0-8 (vector-dot s2-0 (-> arg0 vector 0)))) @@ -1488,17 +1468,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-15 (* 0.525 (tan (/ arg2 2))))) - (.lvf vf1 (&-> sv-144 quad)) - (let ((v1-23 f0-15)) - (.mov vf2 v1-23) + (let ((sv-160 s2-0)) + (let ((sv-144 (-> arg0 vector 1)) + (f0-15 (* 0.525 (tan (/ arg2 2)))) + ) + (.lvf vf1 (&-> sv-144 quad)) + (let ((v1-23 f0-15)) + (.mov vf2 v1-23) + ) ) + (.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-17 (vector-dot s2-0 (-> arg0 vector 1)))) @@ -1514,12 +1496,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-25 (* 0.525 (tan (/ arg2 2))))) - (vector-float*! s0-1 sv-176 f0-25) - ) - ) + (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-27 (vector-dot s2-0 (-> arg0 vector 1)))) @@ -1561,14 +1538,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 float) (arg3 float) (arg4 symbol)) - (local-vars - (f0-8 float) - (sv-192 vector) - (sv-208 vector) - (sv-224 matrix) - (sv-240 (function matrix vector float vector)) - (sv-256 matrix) - ) + (local-vars (f0-8 float)) (rlet ((vf0 :class vf) (vf4 :class vf) (vf5 :class vf) @@ -1581,22 +1551,23 @@ (let ((f30-0 (-> arg0 tilt-adjust value))) (cond ((< 0.0001 (-> arg0 point-of-interest-blend value)) - (set! sv-192 (new 'stack-no-clear 'vector)) - 0.0 - (vector-! s1-0 (-> arg0 follow-pt) arg1) - (let ((f28-0 (vector-length s1-0))) - (vector-! sv-192 (-> arg0 point-of-interest) arg1) - (vector-normalize! sv-192 (* f28-0 (-> arg0 point-of-interest-blend value))) - (let ((v1-3 s1-0)) - (let ((a0-5 s1-0)) - (.mov.vf.w vf6 vf0) - (.lvf vf4 (&-> a0-5 quad)) + (let ((sv-192 (new 'stack-no-clear 'vector))) + 0.0 + (vector-! s1-0 (-> arg0 follow-pt) arg1) + (let ((f28-0 (vector-length s1-0))) + (vector-! sv-192 (-> arg0 point-of-interest) arg1) + (vector-normalize! sv-192 (* f28-0 (-> arg0 point-of-interest-blend value))) + (let ((v1-3 s1-0)) + (let ((a0-5 s1-0)) + (.mov.vf.w vf6 vf0) + (.lvf vf4 (&-> a0-5 quad)) + ) + (.lvf vf5 (&-> sv-192 quad)) + (.add.vf.xyz vf6 vf4 vf5) + (.svf (&-> v1-3 quad) vf6) ) - (.lvf vf5 (&-> sv-192 quad)) - (.add.vf.xyz vf6 vf4 vf5) - (.svf (&-> v1-3 quad) vf6) + (vector-normalize! s1-0 f28-0) ) - (vector-normalize! s1-0 f28-0) ) ) (else @@ -1607,47 +1578,35 @@ (when (!= f30-0 0.0) 0.0 0.0 - (set! sv-224 (new 'stack-no-clear 'matrix)) - (set! sv-208 (new 'stack-no-clear 'vector)) - (vector-normalize-copy! sv-208 s1-0 1.0) - (let* ((v1-11 (-> *camera* local-down)) - (f0-7 (-> sv-208 x)) - (f1-1 (-> sv-208 y)) - (f2-0 (-> sv-208 z)) - (f3-0 (-> v1-11 x)) - (f4-0 (-> v1-11 y)) - (f5-0 (-> v1-11 z)) - ) - (.mula.s f0-7 f3-0) - (.madda.s f1-1 f4-0) - (.madd.s f0-8 f2-0 f5-0) - ) - (let* ((f28-1 f0-8) - (f0-10 (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-10))) - (fmin f30-0 (fmax 0.0 (- 32768.0 (+ 2730.6667 f0-10)))) - ) - ) - ) - ((< f30-0 0.0) - (set! f30-0 (if (< 0.0 f28-1) - (fmax f30-0 (- (fmax 0.0 (- 32768.0 (+ 2730.6667 f0-10))))) - (fmax f30-0 (- (fmax 0.0 (+ -2730.6667 f0-10)))) - ) - ) - ) - ) - ) - (matrix-rotate-x! sv-224 f30-0) - (let ((t9-7 matrix*!) - (a0-16 s5-0) - (a2-3 s5-0) + (let ((sv-224 (new 'stack-no-clear 'matrix))) + (let ((sv-208 (new 'stack-no-clear 'vector))) + (vector-normalize-copy! sv-208 s1-0 1.0) + (let* ((v1-11 (-> *camera* local-down))) + (set! f0-8 (vector-dot sv-208 v1-11)) ) - (t9-7 a0-16 sv-224 a2-3) + ) + (let* ((f28-1 f0-8) + (f0-10 (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-10))) + (fmin f30-0 (fmax 0.0 (- 32768.0 (+ 2730.6667 f0-10)))) + ) + ) + ) + ((< f30-0 0.0) + (set! f30-0 (if (< 0.0 f28-1) + (fmax f30-0 (- (fmax 0.0 (- 32768.0 (+ 2730.6667 f0-10))))) + (fmax f30-0 (- (fmax 0.0 (+ -2730.6667 f0-10)))) + ) + ) + ) + ) + ) + (matrix-rotate-x! sv-224 f30-0) + (matrix*! s5-0 sv-224 s5-0) ) ) ) @@ -1655,11 +1614,7 @@ (set! (-> arg0 underwater-blend target) 1.0) (set! (-> arg0 underwater-blend target) 0.0) ) - (set! sv-240 vector-into-frustum-nosmooth!) - (set! sv-256 s5-0) - (let ((a2-5 (lerp-clamp arg3 (/ arg3 4) (-> arg0 underwater-blend value)))) - (sv-240 sv-256 arg1 a2-5) - ) + (vector-into-frustum-nosmooth! s5-0 arg1 (lerp-clamp arg3 (/ arg3 4) (-> arg0 underwater-blend value))) (cond (arg4 (slave-matrix-blend-2 (-> arg0 inv-mat) arg2 s1-0 s5-0) @@ -1694,97 +1649,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 vector 0 quad) (the-as uint128 0)) - (set! (-> sv-176 vector 1 quad) (the-as uint128 0)) - (set! (-> sv-176 vector 2 quad) (the-as uint128 0)) - (set! (-> sv-176 vector 3 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 vector 0 quad) (the-as uint128 0)) + (set! (-> sv-176 vector 1 quad) (the-as uint128 0)) + (set! (-> sv-176 vector 2 quad) (the-as uint128 0)) + (set! (-> sv-176 vector 3 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-18 s0-0) - (f0-9 (-> v1-18 x)) - (f1-2 (-> v1-18 y)) - (f2-0 (-> v1-18 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-18 s0-0)) + (set! f0-10 (vector-dot v1-18 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))) @@ -1802,10 +1731,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 @@ -1837,31 +1767,16 @@ ) ) (let ((t9-10 acos)) - (let* ((v1-9 s1-0) - (f0-6 (-> v1-9 x)) - (f1-0 (-> v1-9 y)) - (f2-0 (-> v1-9 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-9 s1-0)) + (set! f0-7 (vector-dot v1-9 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/jak1/engine/collide/collide-edge-grab_REF.gc b/test/decompiler/reference/jak1/engine/collide/collide-edge-grab_REF.gc index 54de669039..d004f8b000 100644 --- a/test/decompiler/reference/jak1/engine/collide/collide-edge-grab_REF.gc +++ b/test/decompiler/reference/jak1/engine/collide/collide-edge-grab_REF.gc @@ -128,7 +128,6 @@ ;; definition for method 19 of type collide-edge-work ;; INFO: Used lq/sq (defmethod check-grab-for-collisions ((this collide-edge-work) (arg0 collide-edge-hold-item) (arg1 edge-grab-info)) - (local-vars (sv-144 (function vector vector vector float vector)) (sv-160 vector) (sv-176 vector)) (let* ((s3-0 (-> arg0 edge)) (s1-0 (-> s3-0 etri ctri)) (s4-0 (-> s1-0 prim-index)) @@ -140,13 +139,11 @@ (return #f) ) ) - (set! sv-144 vector+*!) - (set! sv-160 s0-0) - (set! sv-176 (-> arg0 center-pt)) - (let ((a2-3 (vector-negate! (new 'stack-no-clear 'vector) (-> s3-0 edge-vec-norm))) - (a3-2 1105.92) - ) - (sv-144 sv-160 sv-176 a2-3 a3-2) + (vector+*! + s0-0 + (-> arg0 center-pt) + (vector-negate! (new 'stack-no-clear 'vector) (-> s3-0 edge-vec-norm)) + 1105.92 ) (let ((f0-1 (collide-edge-work-method-14 this (-> arg1 left-hand-hold) s0-0 (the-as int s4-0)))) (if (< 491.52 f0-1) diff --git a/test/decompiler/reference/jak1/engine/collide/collide-probe_REF.gc b/test/decompiler/reference/jak1/engine/collide/collide-probe_REF.gc index c1eec9ce98..ce30210169 100644 --- a/test/decompiler/reference/jak1/engine/collide/collide-probe_REF.gc +++ b/test/decompiler/reference/jak1/engine/collide/collide-probe_REF.gc @@ -299,12 +299,7 @@ ;; definition for function distc (defun distc ((arg0 vector) (arg1 vector)) - (let* ((f0-1 (- (-> arg0 x) (-> arg1 x))) - (f0-3 (* f0-1 f0-1)) - (f1-2 (- (-> arg0 z) (-> arg1 z))) - ) - (sqrtf (+ f0-3 (* f1-2 f1-2))) - ) + (sqrtf (+ (square (- (-> arg0 x) (-> arg1 x))) (square (- (-> arg0 z) (-> arg1 z))))) ) ;; definition for function interpolate diff --git a/test/decompiler/reference/jak1/engine/collide/collide-shape-rider_REF.gc b/test/decompiler/reference/jak1/engine/collide/collide-shape-rider_REF.gc index cccbe39f44..37bd0c43b9 100644 --- a/test/decompiler/reference/jak1/engine/collide/collide-shape-rider_REF.gc +++ b/test/decompiler/reference/jak1/engine/collide/collide-shape-rider_REF.gc @@ -406,7 +406,7 @@ ;; INFO: Used lq/sq ;; INFO: Return type mismatch object vs none. (defmethod pull-rider! ((this collide-shape) (arg0 pull-rider-info)) - (local-vars (at-0 int) (sv-160 (function collide-shape-moving float collide-kind none))) + (local-vars (at-0 int)) (rlet ((vf0 :class vf) (vf1 :class vf) (vf2 :class vf) @@ -422,14 +422,7 @@ ((logtest? (-> this root-prim prim-core action) (collide-action rider-plat)) (let ((s1-0 (-> this root-prim prim-core collide-as))) (set! (-> this root-prim prim-core collide-as) (collide-kind)) - (let ((s0-0 gp-0)) - (set! sv-160 (method-of-object s0-0 fill-cache-for-shape!)) - (let ((a1-3 (+ 8192.0 (vector-length s3-0))) - (a2-0 (-> gp-0 root-prim collide-with)) - ) - (sv-160 s0-0 a1-3 a2-0) - ) - ) + (fill-cache-for-shape! gp-0 (+ 8192.0 (vector-length s3-0)) (-> gp-0 root-prim collide-with)) (set! (-> this root-prim prim-core collide-as) s1-0) ) (let ((s2-1 (new 'stack-no-clear 'vector))) diff --git a/test/decompiler/reference/jak1/engine/collide/surface-h_REF.gc b/test/decompiler/reference/jak1/engine/collide/surface-h_REF.gc index bc57ab23e2..621987ba67 100644 --- a/test/decompiler/reference/jak1/engine/collide/surface-h_REF.gc +++ b/test/decompiler/reference/jak1/engine/collide/surface-h_REF.gc @@ -84,14 +84,14 @@ ;; 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/jak1/engine/common-obs/collectables_REF.gc b/test/decompiler/reference/jak1/engine/common-obs/collectables_REF.gc index 64114798fe..9e1ef5b0ac 100644 --- a/test/decompiler/reference/jak1/engine/common-obs/collectables_REF.gc +++ b/test/decompiler/reference/jak1/engine/common-obs/collectables_REF.gc @@ -1638,7 +1638,6 @@ ) ) :code (behavior ((arg0 object) (arg1 handle)) - (local-vars (sv-96 res-tag)) (sound-play "pu-powercell") (clear-collide-with-as (-> self root)) (logclear! (-> self mask) (process-mask actor-pause)) @@ -1661,8 +1660,8 @@ (format #t "WARNING: fuel-cell stall on not cloning.~%") (suspend) ) - (set! sv-96 (new 'static 'res-tag)) - (let* ((v1-34 + (let* ((sv-96 (new 'static 'res-tag)) + (v1-34 (res-lump-data (-> self entity) 'movie-pos @@ -2441,20 +2440,9 @@ (v1-58 symbol) (v1-64 symbol) (v1-71 symbol) - (sv-32 fact-info) - (sv-48 int) - (sv-64 process) - (sv-80 process) - (sv-96 process) - (sv-112 process) - (sv-128 process) - (sv-144 process) - (sv-160 process) - (sv-176 process) - (sv-192 (pointer process)) ) - (set! sv-32 arg5) - (let ((s1-0 (new-stack-vector0)) + (let ((sv-32 arg5) + (s1-0 (new-stack-vector0)) (t9-0 (method-of-type res-lump get-property-value-float)) ) (let ((v1-1 sv-32)) @@ -2485,10 +2473,11 @@ *res-static-buf* ) ) + (sv-192 (the-as (pointer process) #f)) ) - (set! sv-192 (the-as (pointer process) #f)) - (set! sv-48 (the int arg2)) - (let ((s0-0 (new 'static 'fact-info))) + (let ((sv-48 (the int arg2)) + (s0-0 (new 'static 'fact-info)) + ) (set! (-> s0-0 options) (fact-options)) (if sv-32 (mem-copy! (&-> s0-0 type) (&-> sv-32 type) 40) @@ -2496,7 +2485,7 @@ (set! (-> s0-0 pickup-type) arg1) (set! (-> s0-0 pickup-spawn-amount) 1.0) (while (> sv-48 0) - (set! sv-48 (+ sv-48 -1)) + (+! sv-48 -1) (when arg3 (set-vector! s1-0 0.0 57001.605 f30-0 1.0) (vector-rotate-around-y! s1-0 s1-0 (/ (* 65536.0 (the float sv-48)) arg2)) @@ -2504,118 +2493,117 @@ (let ((v1-25 arg1)) (cond ((= v1-25 (pickup-type eco-yellow)) - (set! sv-64 (get-process *pickup-dead-pool* eco-yellow #x4000)) - (set! v1-28 (when sv-64 - (set! sv-192 (the-as (pointer process) v1-28)) - (let ((t9-4 (method-of-type eco-yellow activate))) - (t9-4 (the-as eco-yellow sv-64) arg4 'eco-yellow (the-as pointer #x70004000)) - ) - (run-now-in-process sv-64 initialize-eco-by-other arg0 s1-0 s0-0) - (set! sv-192 (-> sv-64 ppointer)) - v1-28 - ) - ) + (let ((sv-64 (get-process *pickup-dead-pool* eco-yellow #x4000))) + (set! v1-28 + (when sv-64 + (set! sv-192 (the-as (pointer process) v1-28)) + ((method-of-type eco-yellow activate) (the-as eco-yellow sv-64) arg4 'eco-yellow (the-as pointer #x70004000)) + (run-now-in-process sv-64 initialize-eco-by-other arg0 s1-0 s0-0) + (set! sv-192 (-> sv-64 ppointer)) + v1-28 + ) + ) + ) sv-192 ) ((= v1-25 (pickup-type eco-red)) - (set! sv-80 (get-process *pickup-dead-pool* eco-red #x4000)) - (set! v1-34 (when sv-80 - (set! sv-192 (the-as (pointer process) v1-34)) - (let ((t9-7 (method-of-type eco-red activate))) - (t9-7 (the-as eco-red sv-80) arg4 'eco-red (the-as pointer #x70004000)) - ) - (run-now-in-process sv-80 initialize-eco-by-other arg0 s1-0 s0-0) - (set! sv-192 (-> sv-80 ppointer)) - v1-34 - ) - ) + (let ((sv-80 (get-process *pickup-dead-pool* eco-red #x4000))) + (set! v1-34 + (when sv-80 + (set! sv-192 (the-as (pointer process) v1-34)) + ((method-of-type eco-red activate) (the-as eco-red sv-80) arg4 'eco-red (the-as pointer #x70004000)) + (run-now-in-process sv-80 initialize-eco-by-other arg0 s1-0 s0-0) + (set! sv-192 (-> sv-80 ppointer)) + v1-34 + ) + ) + ) (level-hint-spawn (text-id misty-eco-red-hint) "sksp0071" (the-as entity #f) *entity-pool* (game-task none)) ) ((= v1-25 (pickup-type eco-blue)) - (set! sv-96 (get-process *pickup-dead-pool* eco-blue #x4000)) - (set! v1-40 (when sv-96 - (set! sv-192 (the-as (pointer process) v1-40)) - (let ((t9-11 (method-of-type eco-blue activate))) - (t9-11 (the-as eco-blue sv-96) arg4 'eco-blue (the-as pointer #x70004000)) - ) - (run-now-in-process sv-96 initialize-eco-by-other arg0 s1-0 s0-0) - (set! sv-192 (-> sv-96 ppointer)) - v1-40 - ) - ) + (let ((sv-96 (get-process *pickup-dead-pool* eco-blue #x4000))) + (set! v1-40 + (when sv-96 + (set! sv-192 (the-as (pointer process) v1-40)) + ((method-of-type eco-blue activate) (the-as eco-blue sv-96) arg4 'eco-blue (the-as pointer #x70004000)) + (run-now-in-process sv-96 initialize-eco-by-other arg0 s1-0 s0-0) + (set! sv-192 (-> sv-96 ppointer)) + v1-40 + ) + ) + ) sv-192 ) ((= v1-25 (pickup-type eco-green)) - (set! sv-112 (get-process *pickup-dead-pool* health #x4000)) - (set! v1-46 (when sv-112 - (set! sv-192 (the-as (pointer process) v1-46)) - (let ((t9-14 (method-of-type health activate))) - (t9-14 (the-as health sv-112) arg4 'health (the-as pointer #x70004000)) - ) - (run-now-in-process sv-112 initialize-eco-by-other arg0 s1-0 s0-0) - (set! sv-192 (-> sv-112 ppointer)) - v1-46 - ) - ) + (let ((sv-112 (get-process *pickup-dead-pool* health #x4000))) + (set! v1-46 + (when sv-112 + (set! sv-192 (the-as (pointer process) v1-46)) + ((method-of-type health activate) (the-as health sv-112) arg4 'health (the-as pointer #x70004000)) + (run-now-in-process sv-112 initialize-eco-by-other arg0 s1-0 s0-0) + (set! sv-192 (-> sv-112 ppointer)) + v1-46 + ) + ) + ) sv-192 ) ((= v1-25 (pickup-type eco-pill)) - (set! sv-128 (get-process *pickup-dead-pool* eco-pill #x4000)) - (set! v1-52 (when sv-128 - (set! sv-192 (the-as (pointer process) v1-52)) - (let ((t9-17 (method-of-type eco-pill activate))) - (t9-17 (the-as eco-pill sv-128) arg4 'eco-pill (the-as pointer #x70004000)) - ) - (run-now-in-process sv-128 initialize-eco-by-other arg0 s1-0 s0-0) - (set! sv-192 (-> sv-128 ppointer)) - v1-52 - ) - ) + (let ((sv-128 (get-process *pickup-dead-pool* eco-pill #x4000))) + (set! v1-52 + (when sv-128 + (set! sv-192 (the-as (pointer process) v1-52)) + ((method-of-type eco-pill activate) (the-as eco-pill sv-128) arg4 'eco-pill (the-as pointer #x70004000)) + (run-now-in-process sv-128 initialize-eco-by-other arg0 s1-0 s0-0) + (set! sv-192 (-> sv-128 ppointer)) + v1-52 + ) + ) + ) sv-192 ) ((= v1-25 (pickup-type money)) - (set! sv-144 (get-process *pickup-dead-pool* money #x4000)) - (set! v1-58 (when sv-144 - (set! sv-192 (the-as (pointer process) v1-58)) - (let ((t9-20 (method-of-type money activate))) - (t9-20 (the-as money sv-144) arg4 'money (the-as pointer #x70004000)) + (let ((sv-144 (get-process *pickup-dead-pool* money #x4000))) + (set! v1-58 (when sv-144 + (set! sv-192 (the-as (pointer process) v1-58)) + ((method-of-type money activate) (the-as money sv-144) arg4 'money (the-as pointer #x70004000)) + (run-now-in-process sv-144 money-init-by-other arg0 s1-0 s0-0 (-> self entity)) + (set! sv-192 (-> sv-144 ppointer)) + v1-58 ) - (run-now-in-process sv-144 money-init-by-other arg0 s1-0 s0-0 (-> self entity)) - (set! sv-192 (-> sv-144 ppointer)) - v1-58 - ) - ) + ) + ) sv-192 ) ((= v1-25 (pickup-type fuel-cell)) (set! (-> s0-0 pickup-spawn-amount) arg2) - (set! sv-160 (get-process *pickup-dead-pool* fuel-cell #x4000)) - (set! v1-64 (when sv-160 - (set! sv-192 (the-as (pointer process) v1-64)) - (let ((t9-23 (method-of-type fuel-cell activate))) - (t9-23 (the-as fuel-cell sv-160) arg4 'fuel-cell (the-as pointer #x70004000)) - ) - (run-now-in-process sv-160 fuel-cell-init-by-other arg0 s1-0 s0-0 (-> self entity)) - (set! sv-192 (-> sv-160 ppointer)) - v1-64 - ) - ) + (let ((sv-160 (get-process *pickup-dead-pool* fuel-cell #x4000))) + (set! v1-64 + (when sv-160 + (set! sv-192 (the-as (pointer process) v1-64)) + ((method-of-type fuel-cell activate) (the-as fuel-cell sv-160) arg4 'fuel-cell (the-as pointer #x70004000)) + (run-now-in-process sv-160 fuel-cell-init-by-other arg0 s1-0 s0-0 (-> self entity)) + (set! sv-192 (-> sv-160 ppointer)) + v1-64 + ) + ) + ) (set! sv-48 0) sv-48 ) ((= v1-25 (pickup-type buzzer)) (set! (-> s0-0 pickup-spawn-amount) arg2) - (set! sv-176 (get-process *pickup-dead-pool* buzzer #x4000)) - (set! v1-71 (when sv-176 - (set! sv-192 (the-as (pointer process) v1-71)) - (let ((t9-26 (method-of-type buzzer activate))) - (t9-26 (the-as buzzer sv-176) arg4 'buzzer (the-as pointer #x70004000)) - ) - (run-now-in-process sv-176 buzzer-init-by-other arg0 s1-0 s0-0 (-> self entity)) - (set! sv-192 (-> sv-176 ppointer)) - v1-71 - ) - ) + (let ((sv-176 (get-process *pickup-dead-pool* buzzer #x4000))) + (set! v1-71 + (when sv-176 + (set! sv-192 (the-as (pointer process) v1-71)) + ((method-of-type buzzer activate) (the-as buzzer sv-176) arg4 'buzzer (the-as pointer #x70004000)) + (run-now-in-process sv-176 buzzer-init-by-other arg0 s1-0 s0-0 (-> self entity)) + (set! sv-192 (-> sv-176 ppointer)) + v1-71 + ) + ) + ) (set! sv-48 0) sv-48 ) @@ -2627,9 +2615,9 @@ ) ) ) + sv-192 ) ) - sv-192 ) ;; definition for method 9 of type fact-info diff --git a/test/decompiler/reference/jak1/engine/common-obs/dark-eco-pool_REF.gc b/test/decompiler/reference/jak1/engine/common-obs/dark-eco-pool_REF.gc index 80e192a126..7df0f99471 100644 --- a/test/decompiler/reference/jak1/engine/common-obs/dark-eco-pool_REF.gc +++ b/test/decompiler/reference/jak1/engine/common-obs/dark-eco-pool_REF.gc @@ -363,8 +363,7 @@ ) (let* ((gp-0 (-> self draw ripple)) (f0-1 (the float (logand (current-time) #xffff))) - (f0-3 (cos (* 5.0 f0-1))) - (f30-0 (* f0-3 f0-3)) + (f30-0 (square (cos (* 5.0 f0-1)))) ) (let ((s5-0 (-> self draw ripple query))) (set! (-> self draw ripple send-query) #t) diff --git a/test/decompiler/reference/jak1/engine/common-obs/generic-obs_REF.gc b/test/decompiler/reference/jak1/engine/common-obs/generic-obs_REF.gc index 9891b3a92c..acb4805e44 100644 --- a/test/decompiler/reference/jak1/engine/common-obs/generic-obs_REF.gc +++ b/test/decompiler/reference/jak1/engine/common-obs/generic-obs_REF.gc @@ -1321,12 +1321,11 @@ ;; INFO: Used lq/sq ;; INFO: Return type mismatch object vs none. (defmethod init-from-entity! ((this med-res-level) (arg0 entity-actor)) - (local-vars (sv-16 res-tag)) (stack-size-set! (-> this main-thread) 128) "#f" (let ((s4-0 (the-as (pointer sparticle-launch-group) #f))) - (set! sv-16 (new 'static 'res-tag)) - (let* ((s3-0 (res-lump-data arg0 'art-name (pointer symbol) :tag-ptr (& sv-16))) + (let* ((sv-16 (new 'static 'res-tag)) + (s3-0 (res-lump-data arg0 'art-name (pointer symbol) :tag-ptr (& sv-16))) (s2-0 (-> s3-0 0)) ) (cond @@ -1429,7 +1428,6 @@ ;; INFO: Used lq/sq ;; INFO: Return type mismatch object vs none. (defmethod init-from-entity! ((this part-spawner) (arg0 entity-actor)) - (local-vars (sv-16 res-tag)) (stack-size-set! (-> this main-thread) 128) (logior! (-> this mask) (process-mask ambient)) (set! (-> this root) (new 'process 'trsqv)) @@ -1442,8 +1440,8 @@ (set! (-> this sound) (new 'process 'ambient-sound (-> this entity) (-> this root trans))) (let ((s4-0 (the-as object "#f"))) (let ((s3-0 (the-as (pointer sparticle-launch-group) #f))) - (set! sv-16 (new 'static 'res-tag)) - (let* ((s5-1 (res-lump-data arg0 'art-name (pointer (pointer sparticle-launch-group)) :tag-ptr (& sv-16))) + (let* ((sv-16 (new 'static 'res-tag)) + (s5-1 (res-lump-data arg0 'art-name (pointer (pointer sparticle-launch-group)) :tag-ptr (& sv-16))) (s2-0 (-> s5-1 0)) ) (cond diff --git a/test/decompiler/reference/jak1/engine/common-obs/nav-enemy_REF.gc b/test/decompiler/reference/jak1/engine/common-obs/nav-enemy_REF.gc index f914643330..dea55ff6ae 100644 --- a/test/decompiler/reference/jak1/engine/common-obs/nav-enemy_REF.gc +++ b/test/decompiler/reference/jak1/engine/common-obs/nav-enemy_REF.gc @@ -1876,9 +1876,8 @@ nav-enemy-default-event-handler (let* ((a0-10 (-> gp-0 sphere v1-9)) (f2-2 (- (-> a0-10 x) f0-1)) (f3-1 (- (-> a0-10 z) f1-2)) - (f4-0 (-> a0-10 w)) ) - (if (>= (* f4-0 f4-0) (+ (* f2-2 f2-2) (* f3-1 f3-1))) + (if (>= (square (-> a0-10 w)) (+ (square f2-2) (square f3-1))) (return #t) ) ) diff --git a/test/decompiler/reference/jak1/engine/draw/process-drawable_REF.gc b/test/decompiler/reference/jak1/engine/common-obs/process-drawable_REF.gc similarity index 87% rename from test/decompiler/reference/jak1/engine/draw/process-drawable_REF.gc rename to test/decompiler/reference/jak1/engine/common-obs/process-drawable_REF.gc index e950895df3..b734475b29 100644 --- a/test/decompiler/reference/jak1/engine/draw/process-drawable_REF.gc +++ b/test/decompiler/reference/jak1/engine/common-obs/process-drawable_REF.gc @@ -114,7 +114,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 ((s4-0 arg0) (s5-0 arg1) ) @@ -138,13 +137,13 @@ (set! (-> this lod s3-0 dist) (res-lump-float arg2 'vis-dist :default 4095996000.0)) ) ) - (let ((v1-13 (-> s5-0 data (-> s4-0 jgeo)))) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-14 (res-lump-data (-> v1-13 extra) 'lod-dist pointer :tag-ptr (& sv-16)))) - (when v1-14 - (dotimes (a0-6 (the-as int (-> sv-16 elt-count))) - (set! (-> this lod a0-6 dist) (-> (the-as (pointer float) (&+ v1-14 (* a0-6 4))))) - ) + (let* ((v1-13 (-> s5-0 data (-> s4-0 jgeo))) + (sv-16 (new 'static 'res-tag)) + (v1-14 (res-lump-data (-> v1-13 extra) 'lod-dist pointer :tag-ptr (& sv-16))) + ) + (when v1-14 + (dotimes (a0-6 (the-as int (-> sv-16 elt-count))) + (set! (-> this lod a0-6 dist) (-> (the-as (pointer float) (&+ v1-14 (* a0-6 4))))) ) ) ) @@ -428,7 +427,7 @@ ;; WARN: Stack slot offset 20 signed mismatch ;; INFO: Return type mismatch draw-control vs none. (defmethod initialize-skeleton ((this process-drawable) (arg0 skeleton-group) (arg1 pair)) - (local-vars (s3-0 draw-control) (sv-16 art-element) (sv-20 int)) + (local-vars (s3-0 draw-control)) (let ((s1-0 (cond ((= (-> arg0 texture-level) 2) (-> *level* level-default) @@ -448,122 +447,124 @@ (set! s3-0 (the-as draw-control #f)) (goto cfg-59) ) - (set! sv-16 (-> s4-0 data (-> arg0 jgeo))) - (set! sv-20 (-> s4-0 length)) - (when (or (>= (-> arg0 jgeo) sv-20) (!= (-> sv-16 type) art-joint-geo)) - (go process-drawable-art-error "joint-geo") - (set! s3-0 (the-as draw-control #f)) - (goto cfg-59) - ) - (let ((v0-3 (new 'process 'draw-control this (the-as art-joint-geo sv-16)))) - (set! (-> this draw) v0-3) - (set! s3-0 v0-3) - ) - (let ((v1-26 s3-0)) - (set! (-> v1-26 status) (draw-status no-skeleton-update)) - (set! (-> v1-26 art-group) s4-0) - (set! (-> v1-26 jgeo) (the-as art-joint-geo sv-16)) - (set! (-> v1-26 force-lod) -1) - (set! (-> v1-26 cur-lod) -1) - (set! (-> v1-26 shadow) #f) - (set! (-> v1-26 shadow-ctrl) #f) - (set! (-> v1-26 data-format) (the-as uint 1)) - (set! (-> v1-26 color-mult quad) (-> (new 'static 'vector :x 1.0 :y 1.0 :z 1.0 :w 1.0) quad)) - (set! (-> v1-26 color-emissive quad) (-> (new 'static 'vector) quad)) - (set! (-> v1-26 level-index) (the-as uint (-> (if (-> this entity) - (-> this entity extra level) - (-> *level* level-default) - ) - index - ) - ) + (let ((sv-16 (-> s4-0 data (-> arg0 jgeo))) + (sv-20 (-> s4-0 length)) + ) + (when (or (>= (-> arg0 jgeo) sv-20) (!= (-> sv-16 type) art-joint-geo)) + (go process-drawable-art-error "joint-geo") + (set! s3-0 (the-as draw-control #f)) + (goto cfg-59) + ) + (let ((v0-3 (new 'process 'draw-control this (the-as art-joint-geo sv-16)))) + (set! (-> this draw) v0-3) + (set! s3-0 v0-3) + ) + (let ((v1-26 s3-0)) + (set! (-> v1-26 status) (draw-status no-skeleton-update)) + (set! (-> v1-26 art-group) s4-0) + (set! (-> v1-26 jgeo) (the-as art-joint-geo sv-16)) + (set! (-> v1-26 force-lod) -1) + (set! (-> v1-26 cur-lod) -1) + (set! (-> v1-26 shadow) #f) + (set! (-> v1-26 shadow-ctrl) #f) + (set! (-> v1-26 data-format) (the-as uint 1)) + (set! (-> v1-26 color-mult quad) (-> (new 'static 'vector :x 1.0 :y 1.0 :z 1.0 :w 1.0) quad)) + (set! (-> v1-26 color-emissive quad) (-> (new 'static 'vector) quad)) + (set! (-> v1-26 level-index) (the-as uint (-> (if (-> this entity) + (-> this entity extra level) + (-> *level* level-default) + ) + index + ) + ) + ) + (set! (-> v1-26 longest-edge) (-> arg0 longest-edge)) + (set! (-> v1-26 ripple) #f) + ) + (set! (-> s3-0 bounds quad) (-> arg0 bounds quad)) + (let ((v1-28 (-> arg0 shadow))) + (when (and (> v1-28 0) (< v1-28 sv-20)) + (let ((s0-0 (-> s4-0 data v1-28)) + (v1-32 (res-lump-value (-> this entity) 'options uint128)) + ) + (if (and (not (logtest? #x20000 v1-32)) (= (-> s0-0 type) shadow-geo)) + (set! (-> s3-0 shadow) (the-as shadow-geo s0-0)) + ) ) - (set! (-> v1-26 longest-edge) (-> arg0 longest-edge)) - (set! (-> v1-26 ripple) #f) - ) - (set! (-> s3-0 bounds quad) (-> arg0 bounds quad)) - (let ((v1-28 (-> arg0 shadow))) - (when (and (> v1-28 0) (< v1-28 sv-20)) - (let ((s0-0 (-> s4-0 data v1-28)) - (v1-32 (res-lump-value (-> this entity) 'options uint128)) - ) - (if (and (not (logtest? #x20000 v1-32)) (= (-> s0-0 type) shadow-geo)) - (set! (-> s3-0 shadow) (the-as shadow-geo s0-0)) - ) ) ) - ) - (if (not (setup-lods! (-> s3-0 lod-set) arg0 s4-0 (-> this entity))) - (go process-drawable-art-error "mesh") + (if (not (setup-lods! (-> s3-0 lod-set) arg0 s4-0 (-> this entity))) + (go process-drawable-art-error "mesh") + ) + (let ((v1-43 (res-lump-value (-> sv-16 extra) 'texture-bucket int :default (the-as uint128 1)))) + (let ((a0-39 (if (= (-> arg0 texture-level) 2) + 2 + (-> s1-0 index) + ) + ) + ) + (if (= (the-as uint v1-43) 4) + (set! v1-43 2) + ) + (if (= a0-39 2) + (set! v1-43 (-> arg0 sort)) + ) + ) + (set! (-> s3-0 sink-group) (-> s1-0 foreground-sink-group v1-43)) ) - (let ((v1-43 (res-lump-value (-> sv-16 extra) 'texture-bucket int :default (the-as uint128 1)))) - (let ((a0-39 (if (= (-> arg0 texture-level) 2) - 2 - (-> s1-0 index) - ) - ) - ) - (if (= (the-as uint v1-43) 4) - (set! v1-43 2) - ) - (if (= a0-39 2) - (set! v1-43 (-> arg0 sort)) - ) - ) - (set! (-> s3-0 sink-group) (-> s1-0 foreground-sink-group v1-43)) - ) - (set! (-> s3-0 dma-add-func) (the-as (function process-drawable draw-control symbol object none) nothing)) - (set! (-> this node-list) (make-nodes-from-jg (the-as art-joint-geo sv-16) arg1 'process)) - (set! (-> s3-0 dma-add-func) dma-add-process-drawable) - (set! (-> s3-0 shadow-mask) (res-lump-value (-> this entity) 'shadow-mask uint)) - (set! (-> s3-0 light-index) (res-lump-value (-> this entity) 'light-index uint)) - (lod-set! s3-0 0) - (let ((a2-10 (res-lump-value (-> sv-16 extra) 'joint-channel int :default (the-as uint128 6)))) - (cond - ((> a2-10 0) - (logior! (-> s3-0 status) (draw-status has-joint-channels)) - (let ((v0-13 (new 'process 'joint-control a2-10))) - (set! (-> this skel) v0-13) - (let ((s2-1 v0-13)) - (cond - ((>= (-> arg0 janim) 0) - (when (or (>= (-> arg0 janim) sv-20) (!= (-> s4-0 data (-> arg0 janim) type) art-joint-anim)) - (go process-drawable-art-error "initial joint-anim") - (set! s3-0 (the-as draw-control #f)) - (goto cfg-59) - ) - (ja-channel-set! 1) - (let ((s1-1 (-> this skel root-channel 0))) - (joint-control-channel-group-eval! - s1-1 - (the-as art-joint-anim (-> s4-0 data (-> arg0 janim))) - num-func-identity + (set! (-> s3-0 dma-add-func) (the-as (function process-drawable draw-control symbol object none) nothing)) + (set! (-> this node-list) (make-nodes-from-jg (the-as art-joint-geo sv-16) arg1 'process)) + (set! (-> s3-0 dma-add-func) dma-add-process-drawable) + (set! (-> s3-0 shadow-mask) (res-lump-value (-> this entity) 'shadow-mask uint)) + (set! (-> s3-0 light-index) (res-lump-value (-> this entity) 'light-index uint)) + (lod-set! s3-0 0) + (let ((a2-10 (res-lump-value (-> sv-16 extra) 'joint-channel int :default (the-as uint128 6)))) + (cond + ((> a2-10 0) + (logior! (-> s3-0 status) (draw-status has-joint-channels)) + (let ((v0-13 (new 'process 'joint-control a2-10))) + (set! (-> this skel) v0-13) + (let ((s2-1 v0-13)) + (cond + ((>= (-> arg0 janim) 0) + (when (or (>= (-> arg0 janim) sv-20) (!= (-> s4-0 data (-> arg0 janim) type) art-joint-anim)) + (go process-drawable-art-error "initial joint-anim") + (set! s3-0 (the-as draw-control #f)) + (goto cfg-59) + ) + (ja-channel-set! 1) + (let ((s1-1 (-> this skel root-channel 0))) + (joint-control-channel-group-eval! + s1-1 + (the-as art-joint-anim (-> s4-0 data (-> arg0 janim))) + num-func-identity + ) + (set! (-> s1-1 frame-num) 0.0) ) - (set! (-> s1-1 frame-num) 0.0) ) - ) - (else - (ja-channel-set! 0) + (else + (ja-channel-set! 0) + ) ) + (set! (-> s2-1 effect) (new 'process 'effect-control this)) ) - (set! (-> s2-1 effect) (new 'process 'effect-control this)) ) ) - ) - (else - (set! (-> s3-0 skeleton bones 0 transform vector 3 quad) (-> (the-as vector (get-property-struct - (-> sv-16 extra) - 'trans-offset - 'interp - -1000000000.0 - *null-vector* - (the-as (pointer res-tag) #f) - *res-static-buf* - ) - ) - quad - ) - ) + (else + (set! (-> s3-0 skeleton bones 0 transform vector 3 quad) (-> (the-as vector (get-property-struct + (-> sv-16 extra) + 'trans-offset + 'interp + -1000000000.0 + *null-vector* + (the-as (pointer res-tag) #f) + *res-static-buf* + ) + ) + quad + ) + ) + ) ) ) ) diff --git a/test/decompiler/reference/jak1/engine/common-obs/rigid-body_REF.gc b/test/decompiler/reference/jak1/engine/common-obs/rigid-body_REF.gc index f2797a3cd5..8250d8488b 100644 --- a/test/decompiler/reference/jak1/engine/common-obs/rigid-body_REF.gc +++ b/test/decompiler/reference/jak1/engine/common-obs/rigid-body_REF.gc @@ -67,24 +67,9 @@ (f1-1 12.0) (f0-5 (* f0-4 (/ 1.0 f1-1))) ) - (let* ((f1-4 arg2) - (f1-6 (* f1-4 f1-4)) - (f2-1 arg3) - ) - (set! (-> this inertial-tensor vector 0 x) (* f0-5 (+ f1-6 (* f2-1 f2-1)))) - ) - (let* ((f1-9 arg1) - (f1-11 (* f1-9 f1-9)) - (f2-4 arg3) - ) - (set! (-> this inertial-tensor vector 1 y) (* f0-5 (+ f1-11 (* f2-4 f2-4)))) - ) - (let* ((f1-14 arg1) - (f1-16 (* f1-14 f1-14)) - (f2-7 arg2) - ) - (set! (-> this inertial-tensor vector 2 z) (* f0-5 (+ f1-16 (* f2-7 f2-7)))) - ) + (set! (-> this inertial-tensor vector 0 x) (* f0-5 (+ (square arg2) (square arg3)))) + (set! (-> this inertial-tensor vector 1 y) (* f0-5 (+ (square arg1) (square arg3)))) + (set! (-> this inertial-tensor vector 2 z) (* f0-5 (+ (square arg1) (square arg2)))) ) (let ((f0-7 (-> this inertial-tensor vector 0 x))) (set! (-> this inv-inertial-tensor vector 0 x) (/ 1.0 f0-7)) diff --git a/test/decompiler/reference/jak1/engine/common-obs/water-anim_REF.gc b/test/decompiler/reference/jak1/engine/common-obs/water-anim_REF.gc index a0774effcd..e2e2ac3940 100644 --- a/test/decompiler/reference/jak1/engine/common-obs/water-anim_REF.gc +++ b/test/decompiler/reference/jak1/engine/common-obs/water-anim_REF.gc @@ -582,11 +582,11 @@ ;; INFO: Used lq/sq ;; INFO: Return type mismatch quaternion vs none. (defmethod water-vol-method-25 ((this water-anim)) - (local-vars (sv-16 res-tag)) (set! (-> this play-ambient-sound?) #t) (set! (-> this look) (res-lump-value (-> this entity) 'look int :default (the-as uint128 -1))) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-3 (res-lump-data (-> this entity) 'trans-offset (pointer float) :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-3 (res-lump-data (-> this entity) 'trans-offset (pointer float) :tag-ptr (& sv-16))) + ) (when v1-3 (+! (-> this root trans x) (-> v1-3 0)) (+! (-> this root trans y) (-> v1-3 1)) diff --git a/test/decompiler/reference/jak1/engine/common-obs/water_REF.gc b/test/decompiler/reference/jak1/engine/common-obs/water_REF.gc index e7a5e78629..dc53f380d2 100644 --- a/test/decompiler/reference/jak1/engine/common-obs/water_REF.gc +++ b/test/decompiler/reference/jak1/engine/common-obs/water_REF.gc @@ -1335,7 +1335,6 @@ ;; INFO: Used lq/sq ;; INFO: Return type mismatch water-flags vs none. (defmethod init! ((this water-vol)) - (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 @@ -1353,19 +1352,19 @@ (logior! (-> this vol flags) 3) (set! (-> this bottom-height) 32768.0) (set! (-> this target) (the-as handle #f)) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-8 (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-8 (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-8 (set! (-> this water-height) (-> v1-8 0)) (set! (-> this wade-height) (-> v1-8 1)) diff --git a/test/decompiler/reference/jak1/engine/debug/anim-tester_REF.gc b/test/decompiler/reference/jak1/engine/debug/anim-tester_REF.gc index a2b60df8da..79498a4d88 100644 --- a/test/decompiler/reference/jak1/engine/debug/anim-tester_REF.gc +++ b/test/decompiler/reference/jak1/engine/debug/anim-tester_REF.gc @@ -1016,7 +1016,6 @@ ;; definition for function anim-tester-disp-frame-num ;; INFO: Used lq/sq (defun anim-tester-disp-frame-num ((arg0 string) (arg1 float) (arg2 float) (arg3 font-context)) - (local-vars (sv-16 (function _varargs_ object))) (let* ((s3-0 (-> *display* frames (-> *display* on-screen) frame debug-buf)) (gp-0 (-> s3-0 base)) ) @@ -1035,14 +1034,7 @@ ) (else (let ((s0-0 draw-string-adv)) - (set! sv-16 format) - (let ((a0-11 (clear *temp-string*)) - (a1-5 "~S~3,,0f") - (a2-5 arg0) - (a3-1 (+ arg1 arg2)) - ) - (sv-16 a0-11 a1-5 a2-5 a3-1) - ) + (format (clear *temp-string*) "~S~3,,0f" arg0 (+ arg1 arg2)) (s0-0 *temp-string* s3-0 arg3) ) ) @@ -1700,10 +1692,6 @@ ;; definition for function anim-test-edit-sequence-list-handler ;; INFO: Used lq/sq (defun anim-test-edit-sequence-list-handler ((arg0 int) (arg1 list-control)) - (local-vars - (sv-192 (function string dma-buffer int int font-color font-flags float)) - (sv-208 (function _varargs_ object)) - ) (let ((gp-0 (-> arg1 the-node)) (s4-0 (the-as object (-> arg1 list-owner))) (s2-0 (and (logtest? (-> *anim-tester* 0 flags) (anim-tester-flags fanimt3)) @@ -1763,36 +1751,33 @@ (let* ((s0-1 (-> *display* frames (-> *display* on-screen) frame debug-buf)) (s1-1 (-> s0-1 base)) ) - (set! sv-192 draw-string-xy) - (set! sv-208 format) - (let ((a0-18 (clear *temp-string*)) - (a1-7 "~S~S~-27S") - (a2-11 (if (= (-> arg1 the-index) (-> arg1 highlight-index)) - ">" - " " - ) - ) - (a3-6 (if (= (-> arg1 the-index) (-> (the-as anim-test-sequence s4-0) playing-item)) - "*" - " " - ) - ) - (t0-2 (-> (the-as anim-test-seq-item gp-0) privname)) + (let ((sv-192 draw-string-xy)) + (let ((sv-208 format)) + (sv-208 + (clear *temp-string*) + "~S~S~-27S" + (if (= (-> arg1 the-index) (-> arg1 highlight-index)) + ">" + " " + ) + (if (= (-> arg1 the-index) (-> (the-as anim-test-sequence s4-0) playing-item)) + "*" + " " + ) + (-> (the-as anim-test-seq-item gp-0) privname) ) - (sv-208 a0-18 a1-7 a2-11 a3-6 t0-2) - ) - (let ((a0-19 *temp-string*) - (a1-8 s0-1) - (a2-12 (-> arg1 xpos)) - (a3-7 (-> arg1 ypos)) - (t0-4 (if (= (-> arg1 the-index) (-> arg1 current-index)) - 15 - 12 - ) - ) - (t1-2 3) - ) - (sv-192 a0-19 a1-8 a2-12 a3-7 (the-as font-color t0-4) (the-as font-flags t1-2)) + ) + (sv-192 + *temp-string* + s0-1 + (-> arg1 xpos) + (-> arg1 ypos) + (if (= (-> arg1 the-index) (-> arg1 current-index)) + (font-color menu-flag-on) + (font-color menu) + ) + (font-flags shadow kerning) + ) ) (let ((a3-8 (-> s0-1 base))) (let ((v1-44 (the-as object (-> s0-1 base)))) @@ -2782,7 +2767,6 @@ ;; definition for function anim-tester-add-newobj ;; INFO: Used lq/sq (defun anim-tester-add-newobj ((arg0 anim-tester) (arg1 string) (arg2 art-group)) - (local-vars (sv-96 art-element) (sv-112 art-element) (sv-128 anim-test-obj)) (let ((s2-0 (the-as anim-test-obj #f)) (s5-0 (the-as anim-test-obj #f)) ) @@ -2792,29 +2776,30 @@ (dotimes (s3-0 (-> arg2 length)) (cond ((and (= (-> arg2 data s3-0 type) merc-ctrl) (not s2-0)) - (set! sv-96 (-> arg2 data s3-0)) - (set! s0-0 (and s2-0 s0-0)) - (if s0-0 - (anim-test-obj-remove-invalid s2-0) - ) - (anim-tester-load-object-seqs arg0 (-> sv-96 name)) - (set! s2-0 (the-as anim-test-obj (glst-find-node-by-name (-> arg0 obj-list) (-> sv-96 name)))) - (set! s0-0 (if s2-0 - #t - #f - ) + (let ((sv-96 (-> arg2 data s3-0))) + (set! s0-0 (and s2-0 s0-0)) + (if s0-0 + (anim-test-obj-remove-invalid s2-0) + ) + (anim-tester-load-object-seqs arg0 (-> sv-96 name)) + (set! s2-0 (the-as anim-test-obj (glst-find-node-by-name (-> arg0 obj-list) (-> sv-96 name)))) + (set! s0-0 (if s2-0 + #t + #f + ) + ) + (cond + ((the-as symbol s0-0) + ) + (else + (set! s2-0 (new 'global 'anim-test-obj 1 (-> sv-96 name) arg2)) + (glst-add-tail (-> arg0 obj-list) s2-0) ) - (cond - ((the-as symbol s0-0) - ) - (else - (set! s2-0 (new 'global 'anim-test-obj 1 (-> sv-96 name) arg2)) - (glst-add-tail (-> arg0 obj-list) s2-0) ) + (anim-test-obj-init s2-0 (the-as list-control arg0)) + (set! (-> s2-0 obj-art-group) arg2) + (set! (-> s2-0 mesh-geo) (the-as merc-ctrl sv-96)) ) - (anim-test-obj-init s2-0 (the-as list-control arg0)) - (set! (-> s2-0 obj-art-group) arg2) - (set! (-> s2-0 mesh-geo) (the-as merc-ctrl sv-96)) (set! (-> s2-0 joint-geo) (the-as art-joint-geo s1-0)) (if (not s5-0) (set! s5-0 s2-0) @@ -2830,32 +2815,34 @@ ) ((= (-> arg2 data s3-0 type) art-joint-anim) (when s2-0 - (set! sv-112 (-> arg2 data s3-0)) - (set! sv-128 (the-as anim-test-obj (glst-find-node-by-name (-> s2-0 seq-list) (-> sv-112 name)))) - (when (not sv-128) - (set! sv-128 (the-as anim-test-obj (new 'debug 'anim-test-sequence 1 (-> sv-112 name)))) - (glst-add-tail (-> s2-0 seq-list) sv-128) - (anim-test-sequence-init (the-as anim-test-sequence sv-128) s2-0) - (let ((a1-11 (new 'debug 'anim-test-seq-item 1 (-> sv-112 name)))) - (glst-add-tail (the-as glst-list (&-> sv-128 obj-art-group)) a1-11) - ) - ) - (set! (-> sv-128 list-con user-info) (the-as int s2-0)) - (set! (-> sv-128 flags) (logior (-> (the-as anim-test-sequence sv-128) flags) 2)) - (let ((v1-48 (-> (the-as anim-test-sequence sv-128) item-list))) - "is the list empty, #t = empty" - (when (not (= (-> v1-48 tailpred) v1-48)) - (let ((v1-51 (-> (the-as anim-test-sequence sv-128) item-list))) - "return the start of the list" - (let ((v1-52 (-> v1-51 head))) - (set! (-> (the-as anim-test-seq-item v1-52) num-frames) - (the float (-> (the-as art-joint-anim sv-112) data 0 length)) - ) - (set! (-> (the-as anim-test-seq-item v1-52) artist-base) (-> (the-as art-joint-anim sv-112) artist-base)) - (set! (-> (the-as anim-test-seq-item v1-52) parent) (the-as anim-test-sequence sv-128)) - ) + (let* ((sv-112 (-> arg2 data s3-0)) + (sv-128 (the-as anim-test-obj (glst-find-node-by-name (-> s2-0 seq-list) (-> sv-112 name)))) + ) + (when (not sv-128) + (set! sv-128 (the-as anim-test-obj (new 'debug 'anim-test-sequence 1 (-> sv-112 name)))) + (glst-add-tail (-> s2-0 seq-list) sv-128) + (anim-test-sequence-init (the-as anim-test-sequence sv-128) s2-0) + (let ((a1-11 (new 'debug 'anim-test-seq-item 1 (-> sv-112 name)))) + (glst-add-tail (the-as glst-list (&-> sv-128 obj-art-group)) a1-11) + ) + ) + (set! (-> sv-128 list-con user-info) (the-as int s2-0)) + (set! (-> sv-128 flags) (logior (-> (the-as anim-test-sequence sv-128) flags) 2)) + (let ((v1-48 (-> (the-as anim-test-sequence sv-128) item-list))) + "is the list empty, #t = empty" + (when (not (= (-> v1-48 tailpred) v1-48)) + (let ((v1-51 (-> (the-as anim-test-sequence sv-128) item-list))) + "return the start of the list" + (let ((v1-52 (-> v1-51 head))) + (set! (-> (the-as anim-test-seq-item v1-52) num-frames) + (the float (-> (the-as art-joint-anim sv-112) data 0 length)) + ) + (set! (-> (the-as anim-test-seq-item v1-52) artist-base) (-> (the-as art-joint-anim sv-112) artist-base)) + (set! (-> (the-as anim-test-seq-item v1-52) parent) (the-as anim-test-sequence sv-128)) + ) + ) + sv-128 ) - sv-128 ) ) ) diff --git a/test/decompiler/reference/jak1/engine/debug/debug-sphere_REF.gc b/test/decompiler/reference/jak1/engine/debug/debug-sphere_REF.gc index 9486e8bca9..283758ad07 100644 --- a/test/decompiler/reference/jak1/engine/debug/debug-sphere_REF.gc +++ b/test/decompiler/reference/jak1/engine/debug/debug-sphere_REF.gc @@ -18,7 +18,6 @@ ;; INFO: Used lq/sq ;; INFO: Return type mismatch int vs none. (defun make-debug-sphere-table ((arg0 debug-sphere-table)) - (local-vars (sv-80 int)) (let ((s5-0 (new-stack-vector0)) (f30-0 1.0) (s4-0 0) @@ -34,19 +33,20 @@ (set! (-> s2-0 y) (+ (-> s5-0 y) (* (cos (* 3276.8 (the float s3-0))) f30-0))) (set! (-> s1-0 y) (-> s2-0 y)) (set! (-> s0-0 y) (+ (-> s5-0 y) (* (cos (* 3276.8 (the float (+ s3-0 1)))) f30-0))) - (set! sv-80 0) - (while (< sv-80 10) - (set! (-> s2-0 x) (+ (-> s5-0 x) (* (cos (* 6553.6 (the float sv-80))) f28-0))) - (set! (-> s2-0 z) (+ (-> s5-0 z) (* (sin (* 6553.6 (the float sv-80))) f28-0))) - (set! (-> s1-0 x) (+ (-> s5-0 x) (* (cos (* 6553.6 (the float (+ sv-80 1)))) f28-0))) - (set! (-> s1-0 z) (+ (-> s5-0 z) (* (sin (* 6553.6 (the float (+ sv-80 1)))) f28-0))) - (set! (-> s0-0 x) (+ (-> s5-0 x) (* (cos (* 6553.6 (the float sv-80))) f26-0))) - (set! (-> s0-0 z) (+ (-> s5-0 z) (* (sin (* 6553.6 (the float sv-80))) f26-0))) - (set! (-> arg0 point s4-0 quad) (-> s2-0 quad)) - (set! (-> arg0 point (+ s4-0 1) quad) (-> s1-0 quad)) - (set! (-> arg0 point (+ s4-0 2) quad) (-> s0-0 quad)) - (+! s4-0 3) - (set! sv-80 (+ sv-80 1)) + (let ((sv-80 0)) + (while (< sv-80 10) + (set! (-> s2-0 x) (+ (-> s5-0 x) (* (cos (* 6553.6 (the float sv-80))) f28-0))) + (set! (-> s2-0 z) (+ (-> s5-0 z) (* (sin (* 6553.6 (the float sv-80))) f28-0))) + (set! (-> s1-0 x) (+ (-> s5-0 x) (* (cos (* 6553.6 (the float (+ sv-80 1)))) f28-0))) + (set! (-> s1-0 z) (+ (-> s5-0 z) (* (sin (* 6553.6 (the float (+ sv-80 1)))) f28-0))) + (set! (-> s0-0 x) (+ (-> s5-0 x) (* (cos (* 6553.6 (the float sv-80))) f26-0))) + (set! (-> s0-0 z) (+ (-> s5-0 z) (* (sin (* 6553.6 (the float sv-80))) f26-0))) + (set! (-> arg0 point s4-0 quad) (-> s2-0 quad)) + (set! (-> arg0 point (+ s4-0 1) quad) (-> s1-0 quad)) + (set! (-> arg0 point (+ s4-0 2) quad) (-> s0-0 quad)) + (+! s4-0 3) + (+! sv-80 1) + ) ) ) ) diff --git a/test/decompiler/reference/jak1/engine/debug/debug_REF.gc b/test/decompiler/reference/jak1/engine/debug/debug_REF.gc index bc4a474aac..c9afb148cb 100644 --- a/test/decompiler/reference/jak1/engine/debug/debug_REF.gc +++ b/test/decompiler/reference/jak1/engine/debug/debug_REF.gc @@ -164,9 +164,8 @@ ;; definition (debug) for function internal-draw-debug-line ;; INFO: Used lq/sq (defun-debug internal-draw-debug-line ((arg0 bucket-id) (arg1 vector) (arg2 vector) (arg3 rgba) (arg4 symbol) (arg5 rgba)) - (local-vars (sv-80 vector)) - (set! sv-80 arg2) - (let ((s2-0 arg3) + (let ((sv-80 arg2) + (s2-0 arg3) (s3-0 arg4) (s5-0 arg5) ) @@ -358,17 +357,11 @@ ;; definition (debug) for function add-debug-triangle-normal ;; INFO: Used lq/sq (defun-debug add-debug-triangle-normal ((arg0 symbol) (arg1 bucket-id) (arg2 vector) (arg3 vector) (arg4 vector) (arg5 rgba)) - (local-vars (sv-48 (function vector vector float vector)) (sv-64 vector) (sv-80 vector)) (when arg0 (let ((s4-0 (new 'stack-no-clear 'vector)) (s3-0 (vector-3pt-cross! (new 'stack-no-clear 'vector) arg2 arg3 arg4)) ) - (set! sv-48 vector-float/!) - (set! sv-64 s3-0) - (set! sv-80 s3-0) - (let ((a2-2 (* 0.00024414062 (vector-length s3-0)))) - (sv-48 sv-64 sv-80 a2-2) - ) + (vector-float/! s3-0 s3-0 (* 0.00024414062 (vector-length s3-0))) (vector+! s4-0 arg2 arg3) (vector+! s4-0 s4-0 arg4) (vector-float/! s4-0 s4-0 3.0) @@ -930,27 +923,28 @@ ;; INFO: Used lq/sq (defun-debug add-debug-circle ((arg0 symbol) (arg1 bucket-id) (arg2 vector) (arg3 float) (arg4 rgba) (arg5 matrix)) "note: you may pass #f for orientation" - (local-vars (sv-48 int) (sv-64 vector) (sv-80 vector)) (if (not arg0) (return #f) ) (let ((f30-0 0.0) (s1-0 (new-stack-vector0)) (s0-0 (new-stack-vector0)) + (sv-48 0) ) - (set! sv-48 0) (while (< sv-48 12) - (set! sv-64 s1-0) - (set! (-> sv-64 x) (* arg3 (cos f30-0))) - (set! (-> sv-64 y) 0.0) - (set! (-> sv-64 z) (* arg3 (sin f30-0))) - (set! (-> sv-64 w) 1.0) + (let ((sv-64 s1-0)) + (set! (-> sv-64 x) (* arg3 (cos f30-0))) + (set! (-> sv-64 y) 0.0) + (set! (-> sv-64 z) (* arg3 (sin f30-0))) + (set! (-> sv-64 w) 1.0) + ) (set! f30-0 (+ 5461.3335 f30-0)) - (set! sv-80 s0-0) - (set! (-> sv-80 x) (* arg3 (cos f30-0))) - (set! (-> sv-80 y) 0.0) - (set! (-> sv-80 z) (* arg3 (sin f30-0))) - (set! (-> sv-80 w) 1.0) + (let ((sv-80 s0-0)) + (set! (-> sv-80 x) (* arg3 (cos f30-0))) + (set! (-> sv-80 y) 0.0) + (set! (-> sv-80 z) (* arg3 (sin f30-0))) + (set! (-> sv-80 w) 1.0) + ) (when arg5 (vector-matrix*! s1-0 s1-0 arg5) (vector-matrix*! s0-0 s0-0 arg5) @@ -958,7 +952,7 @@ (vector+! s1-0 s1-0 arg2) (vector+! s0-0 s0-0 arg2) (add-debug-line #t arg1 s1-0 s0-0 arg4 #f (the-as rgba -1)) - (set! sv-48 (+ sv-48 1)) + (+! sv-48 1) ) ) #f @@ -1021,9 +1015,8 @@ ;; WARN: Stack slot offset 32 signed mismatch ;; WARN: Stack slot load at 32 mismatch: defined as size 4, got size 16 (defun-debug add-debug-yrot-vector ((arg0 symbol) (arg1 bucket-id) (arg2 vector) (arg3 float) (arg4 float) (arg5 rgba)) - (local-vars (sv-32 float)) - (set! sv-32 arg3) - (let ((s0-0 arg4) + (let ((sv-32 arg3) + (s0-0 arg4) (s3-0 arg5) ) (if (not arg0) @@ -1049,44 +1042,48 @@ (arg7 matrix) ) "note: you may pass #f for orientation" - (local-vars (sv-48 vector) (sv-64 vector) (sv-80 int) (sv-96 vector) (sv-112 vector)) (if (not arg0) (return #f) ) - (let ((f30-0 arg3)) - (set! sv-48 (new 'stack-no-clear 'vector)) + (let ((f30-0 arg3) + (sv-48 (new 'stack-no-clear 'vector)) + ) (set! (-> sv-48 quad) (the-as uint128 0)) - (set! sv-64 (new 'stack-no-clear 'vector)) - (set! (-> sv-64 quad) (the-as uint128 0)) - (set! sv-80 0) - (while (< sv-80 12) - (set! sv-96 sv-48) - (set! (-> sv-96 x) (* arg5 (sin f30-0))) - (set! (-> sv-96 y) 0.0) - (set! (-> sv-96 z) (* arg5 (cos f30-0))) - (set! (-> sv-96 w) 1.0) - (+! f30-0 (the float (/ (the int (- arg4 arg3)) 12))) - (set! sv-112 sv-64) - (set! (-> sv-112 x) (* arg5 (sin f30-0))) - (set! (-> sv-112 y) 0.0) - (set! (-> sv-112 z) (* arg5 (cos f30-0))) - (set! (-> sv-112 w) 1.0) - (when arg7 - (vector-matrix*! sv-48 sv-48 arg7) - (vector-matrix*! sv-64 sv-64 arg7) + (let ((sv-64 (new 'stack-no-clear 'vector))) + (set! (-> sv-64 quad) (the-as uint128 0)) + (let ((sv-80 0)) + (while (< sv-80 12) + (let ((sv-96 sv-48)) + (set! (-> sv-96 x) (* arg5 (sin f30-0))) + (set! (-> sv-96 y) 0.0) + (set! (-> sv-96 z) (* arg5 (cos f30-0))) + (set! (-> sv-96 w) 1.0) + ) + (+! f30-0 (the float (/ (the int (- arg4 arg3)) 12))) + (let ((sv-112 sv-64)) + (set! (-> sv-112 x) (* arg5 (sin f30-0))) + (set! (-> sv-112 y) 0.0) + (set! (-> sv-112 z) (* arg5 (cos f30-0))) + (set! (-> sv-112 w) 1.0) + ) + (when arg7 + (vector-matrix*! sv-48 sv-48 arg7) + (vector-matrix*! sv-64 sv-64 arg7) + ) + (vector+! sv-48 sv-48 arg2) + (vector+! sv-64 sv-64 arg2) + (add-debug-line #t arg1 sv-48 sv-64 arg6 #f (the-as rgba -1)) + (cond + ((zero? sv-80) + (add-debug-line #t arg1 sv-48 arg2 arg6 #f (the-as rgba -1)) + ) + ((= sv-80 11) + (add-debug-line #t arg1 sv-64 arg2 arg6 #f (the-as rgba -1)) + ) + ) + (+! sv-80 1) + ) ) - (vector+! sv-48 sv-48 arg2) - (vector+! sv-64 sv-64 arg2) - (add-debug-line #t arg1 sv-48 sv-64 arg6 #f (the-as rgba -1)) - (cond - ((zero? sv-80) - (add-debug-line #t arg1 sv-48 arg2 arg6 #f (the-as rgba -1)) - ) - ((= sv-80 11) - (add-debug-line #t arg1 sv-64 arg2 arg6 #f (the-as rgba -1)) - ) - ) - (set! sv-80 (+ sv-80 1)) ) ) #f @@ -1102,21 +1099,23 @@ (arg5 int) (arg6 rgba) ) - (local-vars (sv-48 vector) (sv-64 int) (sv-80 int)) (if (not arg0) (return #f) ) - (let ((s0-0 (new-stack-vector0))) - (set! sv-48 (new 'stack-no-clear 'vector)) + (let ((s0-0 (new-stack-vector0)) + (sv-48 (new 'stack-no-clear 'vector)) + ) (set! (-> sv-48 quad) (the-as uint128 0)) - (set! sv-64 (* arg3 4)) - (curve-evaluate! sv-48 (-> arg4 0) arg2 arg3 arg4 arg5) - (set! sv-80 0) - (while (< sv-80 sv-64) - (set! (-> s0-0 quad) (-> sv-48 quad)) - (curve-evaluate! sv-48 (/ (the float (+ sv-80 1)) (the float sv-64)) arg2 arg3 arg4 arg5) - (add-debug-line #t arg1 s0-0 sv-48 arg6 #f (the-as rgba -1)) - (set! sv-80 (+ sv-80 1)) + (let ((sv-64 (* arg3 4))) + (curve-evaluate! sv-48 (-> arg4 0) arg2 arg3 arg4 arg5) + (let ((sv-80 0)) + (while (< sv-80 sv-64) + (set! (-> s0-0 quad) (-> sv-48 quad)) + (curve-evaluate! sv-48 (/ (the float (+ sv-80 1)) (the float sv-64)) arg2 arg3 arg4 arg5) + (add-debug-line #t arg1 s0-0 sv-48 arg6 #f (the-as rgba -1)) + (+! sv-80 1) + ) + ) ) ) #f @@ -1133,48 +1132,26 @@ ;; definition (debug) for function add-debug-points ;; INFO: Used lq/sq (defun-debug add-debug-points ((arg0 symbol) (arg1 bucket-id) (arg2 (inline-array vector)) (arg3 int) (arg4 rgba) (arg5 float) (arg6 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)) - (sv-96 vector) - ) (when arg0 (dotimes (s0-0 arg3) - (set! sv-96 (new 'stack-no-clear 'vector)) - (set! (-> sv-96 quad) (the-as uint128 0)) - (set! (-> sv-96 quad) (-> arg2 s0-0 quad)) - (if (!= arg5 0.0) - (set! (-> sv-96 y) arg5) + (let ((sv-96 (new 'stack-no-clear 'vector))) + (set! (-> sv-96 quad) (the-as uint128 0)) + (set! (-> sv-96 quad) (-> arg2 s0-0 quad)) + (if (!= arg5 0.0) + (set! (-> sv-96 y) arg5) + ) + (let ((sv-32 add-debug-text-3d) + (sv-48 #t) + (sv-64 arg1) + ) + (format (clear *temp-string*) "~d" s0-0) + (sv-32 sv-48 sv-64 *temp-string* sv-96 (font-color white) (the-as vector2h #f)) ) - (set! sv-32 add-debug-text-3d) - (set! sv-48 #t) - (set! sv-64 arg1) - (set! sv-80 format) - (let ((a0-5 (clear *temp-string*)) - (a1-1 "~d") - (a2-1 s0-0) - ) - (sv-80 a0-5 a1-1 a2-1) - ) - (let ((a2-2 *temp-string*) - (a3-1 sv-96) - (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 arg1) - (a3-2 (if (= s0-0 arg6) - (new 'static 'rgba :r #xff :g #xff :b #xff :a #x80) - arg4 - ) - ) - ) - (t9-3 a0-7 a1-3 sv-96 a3-2) + (add-debug-x #t arg1 sv-96 (if (= s0-0 arg6) + (new 'static 'rgba :r #xff :g #xff :b #xff :a #x80) + arg4 + ) + ) ) ) ) diff --git a/test/decompiler/reference/jak1/engine/debug/memory-usage_REF.gc b/test/decompiler/reference/jak1/engine/debug/memory-usage_REF.gc index 09822132ef..c229e6e475 100644 --- a/test/decompiler/reference/jak1/engine/debug/memory-usage_REF.gc +++ b/test/decompiler/reference/jak1/engine/debug/memory-usage_REF.gc @@ -305,7 +305,6 @@ ;; INFO: Used lq/sq ;; INFO: Return type mismatch memory-usage-block vs none. (defmethod print-mem-usage ((this memory-usage-block) (arg0 level) (arg1 object)) - (local-vars (sv-16 object) (sv-32 string) (sv-48 symbol) (sv-64 int) (sv-80 int)) (let ((s3-0 (&- (-> arg0 heap current) (the-as uint (-> arg0 heap base))))) (let ((v1-2 (+ (-> this data 59 total) (-> this data 60 total)))) (< #x10000 v1-2) @@ -317,18 +316,14 @@ (if (< s2-0 (-> arg0 mem-usage)) (format arg1 "~3L") ) - (let ((s0-0 format)) - (set! sv-16 arg1) - (set! sv-32 "~0K~10,'-S--~5,'-DK-of-~5,'-DK--~5,'-DK-of-~5,'-DK--") - (set! sv-48 (-> arg0 name)) - (let ((s3-1 (sar s3-0 10)) - (s2-1 (sar s2-0 10)) - ) - (set! sv-64 (sar (memory-used *nk-dead-pool*) 10)) - (let ((t2-0 (sar (memory-total *nk-dead-pool*) 10))) - (s0-0 sv-16 sv-32 sv-48 s3-1 s2-1 sv-64 t2-0) - ) - ) + (format + arg1 + "~0K~10,'-S--~5,'-DK-of-~5,'-DK--~5,'-DK-of-~5,'-DK--" + (-> arg0 name) + (sar s3-0 10) + (sar s2-0 10) + (sar (memory-used *nk-dead-pool*) 10) + (sar (memory-total *nk-dead-pool*) 10) ) (format arg1 "~5,'-DK/~5,'-DK--~%" (shr s1-0 10) (sar *max-dma* 10)) ) @@ -339,16 +334,15 @@ arg1 ) ) - (s3-2 format) - (s1-1 "heap-~5,'-DK/~5,'-DK----~D---~D/~D~%") - (s0-1 (sar (memory-used *nk-dead-pool*) 10)) ) - (set! sv-80 (sar (memory-total *nk-dead-pool*) 10)) - (let ((t0-1 (compact-time *nk-dead-pool*)) - (t1-1 (-> *nk-dead-pool* compact-count)) - (t2-1 (-> *nk-dead-pool* compact-count-targ)) - ) - (s3-2 s2-2 s1-1 s0-1 sv-80 t0-1 t1-1 t2-1) + (format + s2-2 + "heap-~5,'-DK/~5,'-DK----~D---~D/~D~%" + (sar (memory-used *nk-dead-pool*) 10) + (sar (memory-total *nk-dead-pool*) 10) + (compact-time *nk-dead-pool*) + (-> *nk-dead-pool* compact-count) + (-> *nk-dead-pool* compact-count-targ) ) ) ) diff --git a/test/decompiler/reference/jak1/engine/debug/menu_REF.gc b/test/decompiler/reference/jak1/engine/debug/menu_REF.gc index f8500a4871..561a80b3ef 100644 --- a/test/decompiler/reference/jak1/engine/debug/menu_REF.gc +++ b/test/decompiler/reference/jak1/engine/debug/menu_REF.gc @@ -626,7 +626,7 @@ ;; WARN: Stack slot load at 80 mismatch: defined as size 4, got size 16 ;; WARN: Stack slot load at 96 mismatch: defined as size 4, got size 16 (defun debug-menu-make-from-template ((arg0 debug-menu-context) (arg1 pair)) - (local-vars (s5-0 basic) (sv-16 object) (sv-32 int) (sv-48 float) (sv-64 float) (sv-80 float) (sv-96 float)) + (local-vars (s5-0 basic)) (when (or (not arg1) (null? arg1)) (set! s5-0 #f) (goto cfg-41) @@ -704,18 +704,14 @@ (set! s5-0 (new 'debug 'debug-menu-item-var s5-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 s5-0)) - (s1-3 (debug-menu-func-decode (car (cdr (cdr (cdr arg1)))))) - (s0-1 (/ (the-as int (ref arg1 5)) 8)) - ) - (set! sv-16 (ref arg1 6)) - (set! sv-32 (/ (the-as int (ref arg1 7)) 8)) - (let ((t1-0 (/ (the-as int (ref arg1 8)) 8)) - (t2-0 (= s4-0 'hex-var)) - ) - (s3-4 s2-3 (the-as (function int debug-menu-msg int int int) s1-3) s0-1 (the-as symbol sv-16) sv-32 t1-0 t2-0) - ) + (debug-menu-item-var-make-int + (the-as debug-menu-item-var s5-0) + (the-as (function int debug-menu-msg int int int) (debug-menu-func-decode (car (cdr (cdr (cdr arg1)))))) + (/ (the-as int (ref arg1 5)) 8) + (the-as symbol (ref arg1 6)) + (/ (the-as int (ref arg1 7)) 8) + (/ (the-as int (ref arg1 8)) 8) + (= s4-0 'hex-var) ) (set! (-> (the-as debug-menu-item-var s5-0) ifloat-p) #t) s5-0 @@ -724,25 +720,14 @@ (set! s5-0 (new 'debug 'debug-menu-item-var s5-1 (the-as int (car (cdr (cdr arg1)))) (the-as int (ref arg1 4))) ) - (let ((s4-5 debug-menu-item-var-make-float) - (s3-6 (the-as debug-menu-item-var s5-0)) - (s2-5 (debug-menu-func-decode (car (cdr (cdr (cdr arg1)))))) - (s1-5 (the float (/ (the-as int (ref arg1 5)) 8))) - (s0-2 (ref arg1 6)) - ) - (set! sv-48 (the float (/ (the-as int (ref arg1 7)) 8))) - (set! sv-64 (the float (/ (the-as int (ref arg1 8)) 8))) - (let ((t2-1 (/ (the-as int (ref arg1 9)) 8))) - (s4-5 - s3-6 - (the-as (function int debug-menu-msg float float float) s2-5) - s1-5 - (the-as symbol s0-2) - sv-48 - sv-64 - t2-1 - ) - ) + (debug-menu-item-var-make-float + (the-as debug-menu-item-var s5-0) + (the-as (function int debug-menu-msg float float float) (debug-menu-func-decode (car (cdr (cdr (cdr arg1)))))) + (the float (/ (the-as int (ref arg1 5)) 8)) + (the-as symbol (ref arg1 6)) + (the float (/ (the-as int (ref arg1 7)) 8)) + (the float (/ (the-as int (ref arg1 8)) 8)) + (/ (the-as int (ref arg1 9)) 8) ) s5-0 ) @@ -750,25 +735,14 @@ (set! s5-0 (new 'debug 'debug-menu-item-var s5-1 (the-as int (car (cdr (cdr arg1)))) (the-as int (ref arg1 4))) ) - (let ((s4-7 debug-menu-item-var-make-float) - (s3-8 (the-as debug-menu-item-var s5-0)) - (s2-7 (debug-menu-func-decode (car (cdr (cdr (cdr arg1)))))) - (s1-7 (* 0.001 (the float (/ (the-as int (ref arg1 5)) 8)))) - (s0-3 (ref arg1 6)) - ) - (set! sv-80 (* 0.001 (the float (/ (the-as int (ref arg1 7)) 8)))) - (set! sv-96 (* 0.001 (the float (/ (the-as int (ref arg1 8)) 8)))) - (let ((t2-2 (/ (the-as int (ref arg1 9)) 8))) - (s4-7 - s3-8 - (the-as (function int debug-menu-msg float float float) s2-7) - s1-7 - (the-as symbol s0-3) - sv-80 - sv-96 - t2-2 - ) - ) + (debug-menu-item-var-make-float + (the-as debug-menu-item-var s5-0) + (the-as (function int debug-menu-msg float float float) (debug-menu-func-decode (car (cdr (cdr (cdr arg1)))))) + (* 0.001 (the float (/ (the-as int (ref arg1 5)) 8))) + (the-as symbol (ref arg1 6)) + (* 0.001 (the float (/ (the-as int (ref arg1 7)) 8))) + (* 0.001 (the float (/ (the-as int (ref arg1 8)) 8))) + (/ (the-as int (ref arg1 9)) 8) ) s5-0 ) @@ -1059,7 +1033,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)) @@ -1110,21 +1083,23 @@ ) ) (set-origin! (-> arg0 context font) s3-1 s2-1) - (set! sv-16 (-> *display* frames (-> *display* on-screen) frame debug-buf)) - (set! sv-32 (-> sv-16 base)) - (draw-string ">" sv-16 (-> arg0 context font)) - (let ((a3-3 (-> sv-16 base))) - (let ((v1-26 (the-as object (-> sv-16 base)))) - (set! (-> (the-as dma-packet v1-26) dma) (new 'static 'dma-tag :id (dma-tag-id next))) - (set! (-> (the-as dma-packet v1-26) vif0) (new 'static 'vif-tag)) - (set! (-> (the-as dma-packet v1-26) vif1) (new 'static 'vif-tag)) - (set! (-> sv-16 base) (&+ (the-as pointer v1-26) 16)) - ) - (dma-bucket-insert-tag - (-> *display* frames (-> *display* on-screen) frame bucket-group) - (bucket-id debug-no-zbuf) - sv-32 - (the-as (pointer dma-tag) a3-3) + (let* ((sv-16 (-> *display* frames (-> *display* on-screen) frame debug-buf)) + (sv-32 (-> sv-16 base)) + ) + (draw-string ">" sv-16 (-> arg0 context font)) + (let ((a3-3 (-> sv-16 base))) + (let ((v1-26 (the-as object (-> sv-16 base)))) + (set! (-> (the-as dma-packet v1-26) dma) (new 'static 'dma-tag :id (dma-tag-id next))) + (set! (-> (the-as dma-packet v1-26) vif0) (new 'static 'vif-tag)) + (set! (-> (the-as dma-packet v1-26) vif1) (new 'static 'vif-tag)) + (set! (-> sv-16 base) (&+ (the-as pointer v1-26) 16)) + ) + (dma-bucket-insert-tag + (-> *display* frames (-> *display* on-screen) frame bucket-group) + (bucket-id debug-no-zbuf) + sv-32 + (the-as (pointer dma-tag) a3-3) + ) ) ) ) diff --git a/test/decompiler/reference/jak1/engine/debug/viewer_REF.gc b/test/decompiler/reference/jak1/engine/debug/viewer_REF.gc index 6b2f84528d..c3fe821378 100644 --- a/test/decompiler/reference/jak1/engine/debug/viewer_REF.gc +++ b/test/decompiler/reference/jak1/engine/debug/viewer_REF.gc @@ -213,20 +213,18 @@ ;; definition for function add-a-bunch ;; INFO: Used lq/sq (defun add-a-bunch ((arg0 string) (arg1 int) (arg2 int) (arg3 float)) - (local-vars (sv-32 process)) (dotimes (s2-0 arg1) (dotimes (s1-0 arg2) (let ((s0-0 (new-stack-vector0))) (position-in-front-of-camera! s0-0 40960.0 4096.0) (+! (-> s0-0 x) (the float (* (- s2-0 (/ arg1 2)) (the int arg3)))) (+! (-> s0-0 z) (the float (* (- s1-0 (/ arg2 2)) (the int arg3)))) - (set! sv-32 (get-process *default-dead-pool* viewer #x4000)) - (when sv-32 - (let ((t9-2 (method-of-type viewer activate))) - (t9-2 (the-as viewer sv-32) *entity-pool* 'viewer (the-as pointer #x70004000)) + (let ((sv-32 (get-process *default-dead-pool* viewer #x4000))) + (when sv-32 + ((method-of-type viewer activate) (the-as viewer sv-32) *entity-pool* 'viewer (the-as pointer #x70004000)) + (run-now-in-process sv-32 init-viewer-for-other arg0 s0-0) + (-> sv-32 ppointer) ) - (run-now-in-process sv-32 init-viewer-for-other arg0 s0-0) - (-> sv-32 ppointer) ) ) ) diff --git a/test/decompiler/reference/jak1/engine/dma/dma-disasm_REF.gc b/test/decompiler/reference/jak1/engine/dma/dma-disasm_REF.gc index 5c0f788ca5..96112133ed 100644 --- a/test/decompiler/reference/jak1/engine/dma/dma-disasm_REF.gc +++ b/test/decompiler/reference/jak1/engine/dma/dma-disasm_REF.gc @@ -303,138 +303,141 @@ ;; definition for function disasm-vif-tag ;; INFO: Used lq/sq (defun disasm-vif-tag ((data (pointer vif-tag)) (words int) (stream symbol) (details symbol)) - (local-vars (cmd vif-cmd) (data-ptr (pointer vif-tag)) (data-idx int) (unpack-imm vif-unpack-imm)) (let ((byte-idx 0)) (while (< byte-idx (* words 4)) (let ((packet-size 4)) (let ((first-tag (-> data 0))) (format stream " #x~X:" data) (dotimes (cmd-template-idx (-> *vif-disasm-table* length)) - (set! cmd (-> first-tag cmd)) - (when (= (logand cmd (-> *vif-disasm-table* cmd-template-idx mask)) (-> *vif-disasm-table* cmd-template-idx tag)) - (let ((print-kind (-> *vif-disasm-table* cmd-template-idx print))) - (cond - ((zero? print-kind) - (format stream " (~s :irq ~D)~%" (-> *vif-disasm-table* cmd-template-idx string1) (-> first-tag irq)) - ) - ((= print-kind 1) - (format - stream - " (~s :irq ~D :~s #x~X)~%" - (-> *vif-disasm-table* cmd-template-idx string1) - (-> first-tag irq) - (-> *vif-disasm-table* cmd-template-idx string2) - (-> first-tag imm) + (let ((cmd (-> first-tag cmd))) + (when (= (logand cmd (-> *vif-disasm-table* cmd-template-idx mask)) (-> *vif-disasm-table* cmd-template-idx tag)) + (let ((print-kind (-> *vif-disasm-table* cmd-template-idx print))) + (cond + ((zero? print-kind) + (format stream " (~s :irq ~D)~%" (-> *vif-disasm-table* cmd-template-idx string1) (-> first-tag irq)) ) - ) - ((= print-kind 2) - (let ((stcycl-imm (the-as vif-stcycl-imm (-> first-tag imm)))) + ((= print-kind 1) (format stream - " (~s :irq ~D :wl ~D :cl ~D)~%" + " (~s :irq ~D :~s #x~X)~%" (-> *vif-disasm-table* cmd-template-idx string1) (-> first-tag irq) - (-> stcycl-imm wl) - (-> stcycl-imm cl) + (-> *vif-disasm-table* cmd-template-idx string2) + (-> first-tag imm) ) ) - ) - ((= print-kind 3) - (set! packet-size 8) - (format - stream - " (~s :irq ~D :~s #x~X)~%" - (-> *vif-disasm-table* cmd-template-idx string1) - (-> first-tag irq) - (-> *vif-disasm-table* cmd-template-idx string2) - (-> data 1) - ) - ) - ((= print-kind 4) - (set! packet-size 20) - (format - stream - " (~s :irq ~D :~s " - (-> *vif-disasm-table* cmd-template-idx string1) - (-> first-tag irq) - (-> *vif-disasm-table* cmd-template-idx string2) - ) - (format stream "#x~X #x~X #x~X #x~X)~%" (-> data 1) (-> data 2) (-> data 3) (-> data 4)) - ) - ((= print-kind 5) - (format - stream - " (~s :irq ~D :instructions #x~D :addr #x~X)~%" - (-> *vif-disasm-table* cmd-template-idx string1) - (-> first-tag irq) - (-> first-tag num) - (-> first-tag imm) - ) - ) - ((= print-kind 6) - (if (-> first-tag imm) - (set! packet-size #x100000) - (set! packet-size (the-as int (* (-> first-tag imm) 16))) + ((= print-kind 2) + (let ((stcycl-imm (the-as vif-stcycl-imm (-> first-tag imm)))) + (format + stream + " (~s :irq ~D :wl ~D :cl ~D)~%" + (-> *vif-disasm-table* cmd-template-idx string1) + (-> first-tag irq) + (-> stcycl-imm wl) + (-> stcycl-imm cl) + ) ) - (format - stream - " (~s :irq ~D :qwc #x~D)~%" - (-> *vif-disasm-table* cmd-template-idx string1) - (-> first-tag irq) - (-> first-tag imm) ) - (set! data-ptr (&-> data 1)) - (set! data-idx 0) - (while (< data-idx (the-as int (-> first-tag imm))) + ((= print-kind 3) + (set! packet-size 8) (format stream - " #x~X: #x~8x #x~8x #x~8x #x~8x~%" - (+ (+ (* data-idx 16) 4) (the-as int data)) - (-> data-ptr (* data-idx 4)) - (-> data-ptr (+ (* data-idx 4) 1)) - (-> data-ptr (+ (* data-idx 4) 2)) - (-> data-ptr (+ (* data-idx 4) 3)) + " (~s :irq ~D :~s #x~X)~%" + (-> *vif-disasm-table* cmd-template-idx string1) + (-> first-tag irq) + (-> *vif-disasm-table* cmd-template-idx string2) + (-> data 1) ) - (set! data-idx (+ data-idx 1)) ) - #f - ) - ((= print-kind 7) - (set! packet-size - (the-as int (+ (logand -4 (+ (* (-> *vif-disasm-table* cmd-template-idx val) (-> first-tag num)) 3)) 4)) + ((= print-kind 4) + (set! packet-size 20) + (format + stream + " (~s :irq ~D :~s " + (-> *vif-disasm-table* cmd-template-idx string1) + (-> first-tag irq) + (-> *vif-disasm-table* cmd-template-idx string2) + ) + (format stream "#x~X #x~X #x~X #x~X)~%" (-> data 1) (-> data 2) (-> data 3) (-> data 4)) + ) + ((= print-kind 5) + (format + stream + " (~s :irq ~D :instructions #x~D :addr #x~X)~%" + (-> *vif-disasm-table* cmd-template-idx string1) + (-> first-tag irq) + (-> first-tag num) + (-> first-tag imm) + ) + ) + ((= print-kind 6) + (if (-> first-tag imm) + (set! packet-size #x100000) + (set! packet-size (the-as int (* (-> first-tag imm) 16))) ) - (set! unpack-imm (the-as vif-unpack-imm (-> first-tag imm))) - (format - stream - " (~s :irq ~D :num ~D :addr #x~X " - (-> *vif-disasm-table* cmd-template-idx string1) - (-> first-tag irq) - (-> first-tag num) - (-> unpack-imm addr) + (format + stream + " (~s :irq ~D :qwc #x~D)~%" + (-> *vif-disasm-table* cmd-template-idx string1) + (-> first-tag irq) + (-> first-tag imm) + ) + (let ((data-ptr (&-> data 1)) + (data-idx 0) + ) + (while (< data-idx (the-as int (-> first-tag imm))) + (format + stream + " #x~X: #x~8x #x~8x #x~8x #x~8x~%" + (+ (+ (* data-idx 16) 4) (the-as int data)) + (-> data-ptr (* data-idx 4)) + (-> data-ptr (+ (* data-idx 4) 1)) + (-> data-ptr (+ (* data-idx 4) 2)) + (-> data-ptr (+ (* data-idx 4) 3)) + ) + (+! data-idx 1) + ) + ) + #f ) - (format - stream - ":msk ~D :flg ~D :usn ~D [skip ~d])~%" - (-> first-tag msk) - (-> unpack-imm flg) - (-> unpack-imm usn) - (the-as uint packet-size) - ) - (if details - (disasm-vif-details + ((= print-kind 7) + (set! packet-size + (the-as int (+ (logand -4 (+ (* (-> *vif-disasm-table* cmd-template-idx val) (-> first-tag num)) 3)) 4)) + ) + (let ((unpack-imm (the-as vif-unpack-imm (-> first-tag imm)))) + (format stream - (the-as (pointer uint8) data) - (logand cmd (vif-cmd cmd-mask)) - (the-as int (-> first-tag num)) + " (~s :irq ~D :num ~D :addr #x~X " + (-> *vif-disasm-table* cmd-template-idx string1) + (-> first-tag irq) + (-> first-tag num) + (-> unpack-imm addr) + ) + (format + stream + ":msk ~D :flg ~D :usn ~D [skip ~d])~%" + (-> first-tag msk) + (-> unpack-imm flg) + (-> unpack-imm usn) + (the-as uint packet-size) ) ) - ) - ((= print-kind 8) - (format stream " (*unknown* vif-tag #x~X)~%" (-> first-tag cmd)) - ) + (if details + (disasm-vif-details + stream + (the-as (pointer uint8) data) + (logand cmd (vif-cmd cmd-mask)) + (the-as int (-> first-tag num)) + ) + ) + ) + ((= print-kind 8) + (format stream " (*unknown* vif-tag #x~X)~%" (-> first-tag cmd)) + ) + ) ) + (set! cmd-template-idx (-> *vif-disasm-table* length)) ) - (set! cmd-template-idx (-> *vif-disasm-table* length)) ) ) ) @@ -512,17 +515,8 @@ ;; WARN: Check prologue - tricky store of a0 ;; INFO: Used lq/sq (defun disasm-dma-list ((data dma-packet) (mode symbol) (verbose symbol) (stream symbol) (expected-size int)) - (local-vars - (addr object) - (data-2 dma-packet) - (qwc int) - (ra-1 object) - (ra-2 object) - (call-depth int) - (current-tag dma-tag) - ) - (set! data-2 data) - (let ((mode-2 mode) + (let ((data-2 data) + (mode-2 mode) (verbose-2 verbose) (stream-2 stream) (expected-size-2 expected-size) @@ -534,174 +528,176 @@ (let ((total-qwc 0) (total-tags 0) ) - (set! addr 0) - (set! qwc 0) - (set! ra-1 0) - (set! ra-2 1) - (set! call-depth -1) - (set! current-tag (new 'static 'dma-tag)) - (while (not end-condition) - (cond - ((not (valid? data-2 (the-as type #f) "dma-list tag pointer" #t stream-2)) - (format stream-2 "ERROR: dma-list tag pointer invalid~%") - (set! end-condition 'error) - ) - (else - (set! current-tag (-> data-2 dma)) - (when (not (or (zero? total-tags) (valid? addr (the-as type #f) "dma-list data pointer" #t stream-2))) - (format stream-2 "ERROR: dma-list data pointer invalid~%") - (set! end-condition 'error) - ) - (when (logtest? (the-as dma-tag #x3ff0000) current-tag) - (format stream-2 "ERROR: dma tag has data in reserved bits ~X~%") - (set! end-condition 'error) - ) + (let ((addr 0) + (qwc 0) + (ra-1 0) + (ra-2 1) + (call-depth -1) + (current-tag (new 'static 'dma-tag)) ) - ) - (when (or verbose-2 (= end-condition 'error)) - (format stream-2 "#x~8x: " data-2) + (while (not end-condition) (cond - ((zero? call-depth) - (format stream-2 " ") - ) - ((= call-depth 1) - (format stream-2 " ") - ) - ) - (disasm-dma-tag current-tag stream-2) - ) - (cond - (end-condition - ) - ((or (= (-> current-tag id) (dma-tag-id ref)) - (= (-> current-tag id) (dma-tag-id refs)) - (zero? (-> current-tag id)) - ) - (set! addr (-> current-tag addr)) - (set! qwc (the-as int (-> current-tag qwc))) - (when mode-2 - (let ((v0-10 (disasm-vif-tag (&-> data-2 vif0) 2 stream-2 (= mode-2 'details)))) - (disasm-vif-tag - (the-as (pointer vif-tag) (+ addr v0-10)) - (the-as int (- (* qwc 4) (the-as uint (/ v0-10 4)))) - stream-2 - (= mode-2 'details) - ) - ) - ) - (set! data-2 (the-as dma-packet (&-> (the-as (pointer uint64) data-2) 2))) - (if (= (-> current-tag id) (dma-tag-id refe)) - (set! end-condition #t) - ) - ) - ((= (-> current-tag id) (dma-tag-id cnt)) - (set! addr (&-> (the-as (pointer uint64) data-2) 2)) - (set! qwc (the-as int (-> current-tag qwc))) - (if mode-2 - (disasm-vif-tag - (the-as (pointer vif-tag) (&-> (the-as (pointer uint64) data-2) 1)) - (the-as int (+ (* qwc 4) 2)) - stream-2 - (= mode-2 'details) - ) - ) - (set! data-2 (the-as dma-packet (+ (the-as uint data-2) (* (+ qwc 1) 16)))) - data-2 - ) - ((= (-> current-tag id) (dma-tag-id next)) - (set! addr (&-> (the-as (pointer uint64) data-2) 2)) - (set! qwc (the-as int (-> current-tag qwc))) - (if mode-2 - (disasm-vif-tag - (the-as (pointer vif-tag) (&-> (the-as (pointer uint64) data-2) 1)) - (the-as int (+ (* qwc 4) 2)) - stream-2 - (= mode-2 'details) - ) - ) - (when (= data-2 (-> current-tag addr)) - (format stream-2 "ERROR: next tag creates infinite loop.~%") + ((not (valid? data-2 (the-as type #f) "dma-list tag pointer" #t stream-2)) + (format stream-2 "ERROR: dma-list tag pointer invalid~%") (set! end-condition 'error) ) - (set! data-2 (the-as dma-packet (-> current-tag addr))) - data-2 - ) - ((= (-> current-tag id) (dma-tag-id call)) - (set! addr (&-> (the-as (pointer uint64) data-2) 2)) - (set! qwc (the-as int (-> current-tag qwc))) - (if mode-2 - (disasm-vif-tag - (the-as (pointer vif-tag) (&-> (the-as (pointer uint64) data-2) 1)) - (the-as int (+ (* qwc 4) 2)) - stream-2 - (= mode-2 'details) - ) - ) - (set! data-2 (the-as dma-packet (-> current-tag addr))) - (set! call-depth (+ call-depth 1)) - (cond - ((zero? call-depth) - (set! ra-1 (&+ addr qwc)) - (the-as (pointer uint64) ra-1) + (else + (set! current-tag (-> data-2 dma)) + (when (not (or (zero? total-tags) (valid? addr (the-as type #f) "dma-list data pointer" #t stream-2))) + (format stream-2 "ERROR: dma-list data pointer invalid~%") + (set! end-condition 'error) + ) + (when (logtest? (the-as dma-tag #x3ff0000) current-tag) + (format stream-2 "ERROR: dma tag has data in reserved bits ~X~%") + (set! end-condition 'error) + ) ) - (else - (set! ra-2 (&+ addr qwc)) - (the-as (pointer uint64) ra-2) + ) + (when (or verbose-2 (= end-condition 'error)) + (format stream-2 "#x~8x: " data-2) + (cond + ((zero? call-depth) + (format stream-2 " ") ) - ) - ) - ((= (-> current-tag id) (dma-tag-id ret)) - (set! addr (&-> (the-as (pointer uint64) data-2) 2)) - (set! qwc (the-as int (-> current-tag qwc))) - (if mode-2 - (disasm-vif-tag - (the-as (pointer vif-tag) (&-> (the-as (pointer uint64) data-2) 1)) - (the-as int (+ (* qwc 4) 2)) - stream-2 - (= mode-2 'details) + ((= call-depth 1) + (format stream-2 " ") + ) + ) + (disasm-dma-tag current-tag stream-2) + ) + (cond + (end-condition + ) + ((or (= (-> current-tag id) (dma-tag-id ref)) + (= (-> current-tag id) (dma-tag-id refs)) + (zero? (-> current-tag id)) + ) + (set! addr (-> current-tag addr)) + (set! qwc (the-as int (-> current-tag qwc))) + (when mode-2 + (let ((v0-10 (disasm-vif-tag (&-> data-2 vif0) 2 stream-2 (= mode-2 'details)))) + (disasm-vif-tag + (the-as (pointer vif-tag) (+ (the-as uint addr) v0-10)) + (the-as int (- (* (the-as uint qwc) 4) (the-as uint (/ v0-10 4)))) + stream-2 + (= mode-2 'details) + ) ) ) - (let ((v1-123 call-depth)) - (cond - ((zero? v1-123) - (set! data-2 (the-as dma-packet ra-1)) - data-2 - ) - ((= v1-123 1) - (set! data-2 (the-as dma-packet ra-2)) - data-2 - ) - (else + (set! data-2 (the-as dma-packet (&-> (the-as (pointer uint64) data-2) 2))) + (if (= (-> current-tag id) (dma-tag-id refe)) (set! end-condition #t) ) - ) ) - (set! call-depth (+ call-depth -1)) - call-depth - ) - ((= (-> current-tag id) (dma-tag-id end)) - (set! addr (&-> (the-as (pointer uint64) data-2) 2)) - (set! qwc (the-as int (-> current-tag qwc))) - (set! end-condition #t) - (if mode-2 - (disasm-vif-tag - (the-as (pointer vif-tag) (&-> (the-as (pointer uint64) data-2) 1)) - (the-as int (+ (* qwc 4) 2)) - stream-2 - (= mode-2 'details) + ((= (-> current-tag id) (dma-tag-id cnt)) + (set! addr (&-> (the-as (pointer uint64) data-2) 2)) + (set! qwc (the-as int (-> current-tag qwc))) + (if mode-2 + (disasm-vif-tag + (the-as (pointer vif-tag) (&-> (the-as (pointer uint64) data-2) 1)) + (the-as int (+ (* (the-as uint qwc) 4) 2)) + stream-2 + (= mode-2 'details) + ) + ) + (set! data-2 (the-as dma-packet (+ (the-as uint data-2) (* (+ (the-as uint qwc) 1) 16)))) + data-2 + ) + ((= (-> current-tag id) (dma-tag-id next)) + (set! addr (&-> (the-as (pointer uint64) data-2) 2)) + (set! qwc (the-as int (-> current-tag qwc))) + (if mode-2 + (disasm-vif-tag + (the-as (pointer vif-tag) (&-> (the-as (pointer uint64) data-2) 1)) + (the-as int (+ (* (the-as uint qwc) 4) 2)) + stream-2 + (= mode-2 'details) + ) + ) + (when (= data-2 (-> current-tag addr)) + (format stream-2 "ERROR: next tag creates infinite loop.~%") + (set! end-condition 'error) + ) + (set! data-2 (the-as dma-packet (-> current-tag addr))) + data-2 + ) + ((= (-> current-tag id) (dma-tag-id call)) + (set! addr (&-> (the-as (pointer uint64) data-2) 2)) + (set! qwc (the-as int (-> current-tag qwc))) + (if mode-2 + (disasm-vif-tag + (the-as (pointer vif-tag) (&-> (the-as (pointer uint64) data-2) 1)) + (the-as int (+ (* (the-as uint qwc) 4) 2)) + stream-2 + (= mode-2 'details) + ) + ) + (set! data-2 (the-as dma-packet (-> current-tag addr))) + (+! call-depth 1) + (cond + ((zero? call-depth) + (set! ra-1 (&+ (the-as (pointer uint64) addr) (the-as uint qwc))) + (the-as (pointer uint64) (the-as (pointer uint64) ra-1)) + ) + (else + (set! ra-2 (&+ (the-as (pointer uint64) addr) (the-as uint qwc))) + (the-as (pointer uint64) (the-as (pointer uint64) ra-2)) ) ) - ) - (else - (format stream-2 "ERROR: Unknown DMA TAG command.~%") - (set! end-condition 'error) + ) + ((= (-> current-tag id) (dma-tag-id ret)) + (set! addr (&-> (the-as (pointer uint64) data-2) 2)) + (set! qwc (the-as int (-> current-tag qwc))) + (if mode-2 + (disasm-vif-tag + (the-as (pointer vif-tag) (&-> (the-as (pointer uint64) data-2) 1)) + (the-as int (+ (* (the-as uint qwc) 4) 2)) + stream-2 + (= mode-2 'details) + ) + ) + (let ((v1-123 call-depth)) + (cond + ((zero? v1-123) + (set! data-2 (the-as dma-packet ra-1)) + data-2 + ) + ((= v1-123 1) + (set! data-2 (the-as dma-packet ra-2)) + data-2 + ) + (else + (set! end-condition #t) + ) + ) + ) + (+! call-depth -1) + call-depth + ) + ((= (-> current-tag id) (dma-tag-id end)) + (set! addr (&-> (the-as (pointer uint64) data-2) 2)) + (set! qwc (the-as int (-> current-tag qwc))) + (set! end-condition #t) + (if mode-2 + (disasm-vif-tag + (the-as (pointer vif-tag) (&-> (the-as (pointer uint64) data-2) 1)) + (the-as int (+ (* (the-as uint qwc) 4) 2)) + stream-2 + (= mode-2 'details) + ) + ) + ) + (else + (format stream-2 "ERROR: Unknown DMA TAG command.~%") + (set! end-condition 'error) + ) ) + (+! total-qwc qwc) + (+! total-tags 1) + (if (and (>= expected-size-2 0) (>= total-tags expected-size-2)) + (set! end-condition #t) + ) ) - (+! total-qwc qwc) - (+! total-tags 1) - (if (and (>= expected-size-2 0) (>= total-tags expected-size-2)) - (set! end-condition #t) - ) ) (when (or verbose-2 (= end-condition 'error)) (format stream-2 "NOTICE: Total tags: ~d~%" total-tags) diff --git a/test/decompiler/reference/jak1/engine/draw/drawable_REF.gc b/test/decompiler/reference/jak1/engine/draw/drawable_REF.gc index 54356c53c8..57dfa0757a 100644 --- a/test/decompiler/reference/jak1/engine/draw/drawable_REF.gc +++ b/test/decompiler/reference/jak1/engine/draw/drawable_REF.gc @@ -360,17 +360,6 @@ ;; INFO: Return type mismatch object vs none. ;; ERROR: Failed load: (set! a2-12 (l.hu (+ a2-11 68))) at op 283 (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 @@ -447,30 +436,32 @@ (s2-1 (+ (-> s5-0 count 1) (-> s5-0 count 2))) ) (dotimes (s0-0 (-> (the-as drawable-group s1-1) length)) - (set! sv-16 (shrub-num-tris (the-as shrubbery (+ (+ (* s0-0 32) 32) (the-as int s1-1))))) - (set! sv-32 (-> (the-as prototype-shrubbery (+ (the-as uint s1-1) (* s0-0 32))) data 0 header data 2)) - (set! sv-48 (-> (the-as prototype-shrubbery (+ (the-as uint s1-1) (* s0-0 32))) data 0 header data 0)) - (format - arg0 - "~5D ~4D ~5D ~6f ~D~%" - s0-0 - sv-16 - sv-32 - (/ (* 2.0 (the float sv-16)) (the float (- sv-32 sv-16))) - sv-48 - ) - (+! s3-1 sv-16) - (+! s4-2 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-1 9) (the-as uint 10)))) - (* (the float s2-1) (+ 15.0 (* 5.0 (the float sv-48)) (* 13.5 (the float sv-32)))) - f30-0 - ) + (let ((sv-16 (shrub-num-tris (the-as shrubbery (+ (+ (* s0-0 32) 32) (the-as int s1-1))))) + (sv-32 (-> (the-as prototype-shrubbery (+ (the-as uint s1-1) (* s0-0 32))) data 0 header data 2)) + (sv-48 (-> (the-as prototype-shrubbery (+ (the-as uint s1-1) (* s0-0 32))) data 0 header data 0)) ) + (format + arg0 + "~5D ~4D ~5D ~6f ~D~%" + s0-0 + sv-16 + sv-32 + (/ (* 2.0 (the float sv-16)) (the float (- sv-32 sv-16))) + sv-48 + ) + (+! s3-1 sv-16) + (+! s4-2 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-1 9) (the-as uint 10)))) + (* (the float s2-1) (+ 15.0 (* 5.0 (the float sv-48)) (* 13.5 (the float sv-32)))) + f30-0 + ) + ) + ) ) (format arg0 @@ -485,49 +476,46 @@ ) ) ((= s2-0 instance-tie) - (set! sv-144 0) - (let ((s1-2 0) + (let ((sv-144 0) + (s1-2 0) (s0-1 0) (s2-2 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-65 (-> s5-0 geometry sv-64))) - (set! sv-96 0) - (set! sv-112 0) - (set! sv-128 0) - (dotimes (a0-23 (-> (the-as prototype-tie v1-65) length)) - (set! sv-96 (+ sv-96 (l.hu (+ (the-as uint v1-65) (* a0-23 64) 68)))) - (set! sv-112 (+ sv-112 (l.hu (+ (the-as uint v1-65) (* a0-23 64) 70)))) - (set! sv-128 (+ sv-128 (l.hu (+ (the-as uint v1-65) (* a0-23 64) 60)))) + (let ((sv-64 1) + (sv-80 3) ) - (set! sv-144 (+ sv-144 (-> s5-0 count sv-64))) - (format arg0 "~5D ~7D ~5D ~5D" sv-64 (-> s5-0 count sv-64) (-> (the-as prototype-tie v1-65) 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) (-> s5-0 count sv-64)) - ) - (+! s1-2 (* (the-as uint sv-96) (-> s5-0 count sv-64))) - (+! s0-1 (* (the-as uint sv-112) (-> s5-0 count sv-64))) - (+! s3-1 sv-96) - (+! s4-2 sv-112) - (+! s2-2 sv-128) - (set! sv-64 (+ sv-64 1)) - ) - (let ((t9-18 format) - (a0-39 arg0) - (a1-22 "total ~7D/~3D ~5D") - (a3-11 (-> s5-0 in-level)) + (while (>= sv-80 sv-64) + (let ((v1-65 (-> s5-0 geometry sv-64)) + (sv-96 0) + (sv-112 0) + (sv-128 0) + ) + (dotimes (a0-23 (-> (the-as prototype-tie v1-65) length)) + (+! sv-96 (l.hu (+ (the-as uint v1-65) (* a0-23 64) 68))) + (+! sv-112 (l.hu (+ (the-as uint v1-65) (* a0-23 64) 70))) + (+! sv-128 (l.hu (+ (the-as uint v1-65) (* a0-23 64) 60))) + ) + (+! sv-144 (-> s5-0 count sv-64)) + (format arg0 "~5D ~7D ~5D ~5D" sv-64 (-> s5-0 count sv-64) (-> (the-as prototype-tie v1-65) 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) (-> s5-0 count sv-64)) + ) + (+! s1-2 (* (the-as uint sv-96) (-> s5-0 count sv-64))) + (+! s0-1 (* (the-as uint sv-112) (-> s5-0 count sv-64))) + (+! s3-1 sv-96) + (+! s4-2 sv-112) + (+! s2-2 sv-128) ) - (t9-18 a0-39 a1-22 sv-144 a3-11 s3-1) + (+! sv-64 1) + ) ) + (format arg0 "total ~7D/~3D ~5D" sv-144 (-> s5-0 in-level) s3-1) (format arg0 " ~5D ~6f ~3D ~5D~%" @@ -551,7 +539,7 @@ ;; INFO: 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 ((arg0 process-drawable) (arg1 draw-control) (arg2 symbol) (arg3 dma-buffer)) - (local-vars (v1-37 float) (sv-16 process-drawable)) + (local-vars (v1-37 float)) (rlet ((acc :class vf) (Q :class vf) (vf0 :class vf) @@ -576,243 +564,244 @@ (vf5 :class vf) ) (init-vf0-vector) - (set! sv-16 arg0) - (logclear! (-> arg1 status) (draw-status was-drawn)) - (when (not (logtest? (-> arg1 status) (draw-status hidden no-anim no-skeleton-update))) - (let ((s4-0 (-> (the-as terrain-context #x70000000) work foreground joint-work temp-mtx vector 2)) - (vu-lgt - (the-as vu-lights (-> (the-as terrain-context #x70000000) work foreground joint-work temp-mtx vector 3)) - ) - (tod *time-of-day-context*) - ) - (.lvf vf16 (&-> arg1 origin quad)) - (.lvf vf17 (&-> arg1 bounds quad)) - (.mul.x.vf.w vf16 vf16 vf0) - (.add.vf vf16 vf16 vf17) - (.svf (&-> s4-0 quad) vf16) - (.lvf vf28 (&-> arg1 color-mult quad)) - (.lvf vf29 (&-> arg1 color-emissive quad)) - (when (sphere-in-view-frustum? (the-as sphere s4-0)) - (case (-> arg1 global-effect) - (((draw-effect title)) - (when (not (-> tod title-updated)) - (set! (-> tod title-updated) #t) - (let ((s0-0 (-> *math-camera* inv-camera-rot)) - (a1-1 (new 'stack-no-clear 'vector)) - (s1-0 (new 'stack-no-clear 'vector)) - ) - (set-vector! a1-1 0.612 0.5 -0.612 0.0) - (set-vector! s1-0 -0.696 0.174 0.696 0.0) - (vector-matrix*! (the-as vector (-> tod title-light-group)) a1-1 s0-0) - (vector-matrix*! (-> tod title-light-group dir1 direction) s1-0 s0-0) - ) - (set-vector! (-> *time-of-day-context* current-shadow) 0.612 -0.5 -0.612 1.0) - ) - (vu-lights<-light-group! vu-lgt (-> tod title-light-group)) - ) - (else - (let ((interp (-> arg1 secondary-interp)) - (cur-interp (-> arg1 current-secondary-interp)) - (shadow-msk (-> arg1 shadow-mask)) - (lev-idx (-> arg1 level-index)) - (lgt (-> tod light-group (-> *target* draw light-index))) - (cur-lgt (new 'stack-no-clear 'light-group)) - ) - (cond - ((= (-> arg1 light-index) 255) - ) - ((= lev-idx 2) - (set! lgt (-> tod light-group (-> arg1 light-index))) - ) - (else - (set! lgt (-> tod moods lev-idx light-group (-> arg1 light-index))) - ) - ) - (when (not (or (= lev-idx 2) (zero? shadow-msk))) - (let* ((lgt-msk-0 (-> tod light-masks-0 lev-idx)) - (lgt-msk-1 (-> tod light-masks-1 lev-idx)) - (lgt-interp (-> tod light-interp lev-idx)) - (a0-13 (logand lgt-msk-0 shadow-msk)) - (v1-18 (logand lgt-msk-1 shadow-msk)) - ) - (cond - ((and (zero? a0-13) (zero? v1-18)) - ) - (else - (set! interp (cond - ((and (nonzero? a0-13) (nonzero? v1-18)) - 1.0 - ) - ((zero? a0-13) - (quad-copy! (the-as pointer cur-lgt) (the-as pointer lgt) 12) - (set! lgt cur-lgt) - (set! (-> lgt dir1 levels x) 0.0) - lgt-interp - ) - (else - (quad-copy! (the-as pointer cur-lgt) (the-as pointer lgt) 12) - (set! lgt cur-lgt) - (set! (-> lgt dir0 levels x) 0.0) - (- 1.0 lgt-interp) - ) - ) - ) - ) - ) - ) - ) - (if *teleport* - (set! cur-interp interp) - ) - (when (not (or (paused?) (= interp cur-interp))) - (let ((f0-15 (- cur-interp interp))) - (set! cur-interp (cond - ((< (fabs f0-15) 0.2) - interp - ) - ((< f0-15 0.0) - (+ 0.2 cur-interp) - ) - (else - (+ -0.2 cur-interp) - ) - ) - ) - ) - (set! (-> arg1 current-secondary-interp) cur-interp) - ) - (cond - ((= cur-interp 0.0) - (vu-lights<-light-group! vu-lgt lgt) - ) - (else - (if (!= lgt cur-lgt) - (quad-copy! (the-as pointer cur-lgt) (the-as pointer lgt) 12) - ) - (let ((f0-20 (- 1.0 cur-interp))) - (set! (-> cur-lgt dir0 levels x) (* (-> cur-lgt dir0 levels x) f0-20)) - (set! (-> cur-lgt dir0 levels y) (* (-> cur-lgt dir0 levels y) f0-20)) - (set! (-> cur-lgt dir1 levels x) (* (-> cur-lgt dir1 levels x) f0-20)) - (set! (-> cur-lgt dir1 levels y) (* (-> cur-lgt dir1 levels y) f0-20)) - (set! (-> cur-lgt dir2 levels x) (* (-> cur-lgt dir2 levels x) f0-20)) - (set! (-> cur-lgt dir2 levels y) (* (-> cur-lgt dir2 levels y) f0-20)) - ) - (vu-lights<-light-group! vu-lgt cur-lgt) - ) - ) + (let ((sv-16 arg0)) + (logclear! (-> arg1 status) (draw-status was-drawn)) + (when (not (logtest? (-> arg1 status) (draw-status hidden no-anim no-skeleton-update))) + (let ((s4-0 (-> (the-as terrain-context #x70000000) work foreground joint-work temp-mtx vector 2)) + (vu-lgt + (the-as vu-lights (-> (the-as terrain-context #x70000000) work foreground joint-work temp-mtx vector 3)) ) - (.lvf vf2 (&-> vu-lgt color 0 quad)) - (.lvf vf3 (&-> vu-lgt color 1 quad)) - (.lvf vf4 (&-> vu-lgt color 2 quad)) - (.lvf vf5 (&-> vu-lgt 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 (&-> vu-lgt color 0 quad) vf2) - (.svf (&-> vu-lgt color 1 quad) vf3) - (.svf (&-> vu-lgt color 2 quad) vf4) - (.svf (&-> vu-lgt ambient quad) vf5) - (.mov v1-37 vf5) + (tod *time-of-day-context*) ) - ) - (if *display-lights* - (add-debug-lights #t (bucket-id debug) (-> tod light-group 0 lights) (-> arg1 origin)) - ) - (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 vector 0 quad)) - (.lvf vf25 (&-> at-0 camera-rot vector 1 quad)) - (.lvf vf26 (&-> at-0 camera-rot vector 2 quad)) - (.lvf vf27 (&-> at-0 camera-rot vector 3 quad)) - ) - (let ((v1-42 (-> (the-as terrain-context #x70000000) work foreground joint-work joint-stack data 1 vector 1))) - (.lvf vf15 (&-> s4-0 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 (&-> v1-42 quad) vf15) - (when (< 0.0 (+ (-> v1-42 z) (-> arg1 bounds w))) - (let ((lod-to-use 0)) - (let ((cam-dist (-> v1-42 w))) - (when (nonzero? (-> arg1 lod-set max-lod)) - (cond - ((>= (-> arg1 force-lod) 0) - (set! lod-to-use (-> arg1 force-lod)) - (if (< (-> arg1 lod-set lod (-> arg1 lod-set max-lod) dist) cam-dist) - (return #f) - ) + (.lvf vf16 (&-> arg1 origin quad)) + (.lvf vf17 (&-> arg1 bounds quad)) + (.mul.x.vf.w vf16 vf16 vf0) + (.add.vf vf16 vf16 vf17) + (.svf (&-> s4-0 quad) vf16) + (.lvf vf28 (&-> arg1 color-mult quad)) + (.lvf vf29 (&-> arg1 color-emissive quad)) + (when (sphere-in-view-frustum? (the-as sphere s4-0)) + (case (-> arg1 global-effect) + (((draw-effect title)) + (when (not (-> tod title-updated)) + (set! (-> tod title-updated) #t) + (let ((s0-0 (-> *math-camera* inv-camera-rot)) + (a1-1 (new 'stack-no-clear 'vector)) + (s1-0 (new 'stack-no-clear 'vector)) ) - (else - (while (and (< lod-to-use (-> arg1 lod-set max-lod)) (< (-> arg1 lod-set lod lod-to-use dist) cam-dist)) - (+! lod-to-use 1) + (set-vector! a1-1 0.612 0.5 -0.612 0.0) + (set-vector! s1-0 -0.696 0.174 0.696 0.0) + (vector-matrix*! (the-as vector (-> tod title-light-group)) a1-1 s0-0) + (vector-matrix*! (-> tod title-light-group dir1 direction) s1-0 s0-0) + ) + (set-vector! (-> *time-of-day-context* current-shadow) 0.612 -0.5 -0.612 1.0) + ) + (vu-lights<-light-group! vu-lgt (-> tod title-light-group)) + ) + (else + (let ((interp (-> arg1 secondary-interp)) + (cur-interp (-> arg1 current-secondary-interp)) + (shadow-msk (-> arg1 shadow-mask)) + (lev-idx (-> arg1 level-index)) + (lgt (-> tod light-group (-> *target* draw light-index))) + (cur-lgt (new 'stack-no-clear 'light-group)) + ) + (cond + ((= (-> arg1 light-index) 255) + ) + ((= lev-idx 2) + (set! lgt (-> tod light-group (-> arg1 light-index))) + ) + (else + (set! lgt (-> tod moods lev-idx light-group (-> arg1 light-index))) + ) + ) + (when (not (or (= lev-idx 2) (zero? shadow-msk))) + (let* ((lgt-msk-0 (-> tod light-masks-0 lev-idx)) + (lgt-msk-1 (-> tod light-masks-1 lev-idx)) + (lgt-interp (-> tod light-interp lev-idx)) + (a0-13 (logand lgt-msk-0 shadow-msk)) + (v1-18 (logand lgt-msk-1 shadow-msk)) + ) + (cond + ((and (zero? a0-13) (zero? v1-18)) + ) + (else + (set! interp (cond + ((and (nonzero? a0-13) (nonzero? v1-18)) + 1.0 + ) + ((zero? a0-13) + (quad-copy! (the-as pointer cur-lgt) (the-as pointer lgt) 12) + (set! lgt cur-lgt) + (set! (-> lgt dir1 levels x) 0.0) + lgt-interp + ) + (else + (quad-copy! (the-as pointer cur-lgt) (the-as pointer lgt) 12) + (set! lgt cur-lgt) + (set! (-> lgt dir0 levels x) 0.0) + (- 1.0 lgt-interp) + ) + ) + ) ) ) ) ) - (if (and (< (-> arg1 lod-set lod lod-to-use dist) cam-dist) (< (-> arg1 force-lod) 0)) - (return #f) + (if *teleport* + (set! cur-interp interp) ) - (let ((v1-64 (-> arg1 sink-group level)) - (a0-26 (+ (-> arg1 sink-group merc-sink foreground-texture-page) 6)) - ) - (when (not (logtest? (-> arg1 status) (draw-status do-not-check-distance))) - (if (< cam-dist (-> v1-64 closest-object a0-26)) - (set! (-> v1-64 closest-object a0-26) cam-dist) + (when (not (or (paused?) (= interp cur-interp))) + (let ((f0-15 (- cur-interp interp))) + (set! cur-interp (cond + ((< (fabs f0-15) 0.2) + interp + ) + ((< f0-15 0.0) + (+ 0.2 cur-interp) + ) + (else + (+ -0.2 cur-interp) + ) + ) + ) + ) + (set! (-> arg1 current-secondary-interp) cur-interp) + ) + (cond + ((= cur-interp 0.0) + (vu-lights<-light-group! vu-lgt lgt) + ) + (else + (if (!= lgt cur-lgt) + (quad-copy! (the-as pointer cur-lgt) (the-as pointer lgt) 12) ) - (when (and (!= a0-26 6) (!= (-> arg1 level-index) 2)) - (let ((a1-45 (cond - ((< 102400.0 cam-dist) - (-> arg1 mgeo header masks 0) - ) - ((< 81920.0 cam-dist) - (-> arg1 mgeo header masks 1) - ) - (else - (-> arg1 mgeo header masks 2) + (let ((f0-20 (- 1.0 cur-interp))) + (set! (-> cur-lgt dir0 levels x) (* (-> cur-lgt dir0 levels x) f0-20)) + (set! (-> cur-lgt dir0 levels y) (* (-> cur-lgt dir0 levels y) f0-20)) + (set! (-> cur-lgt dir1 levels x) (* (-> cur-lgt dir1 levels x) f0-20)) + (set! (-> cur-lgt dir1 levels y) (* (-> cur-lgt dir1 levels y) f0-20)) + (set! (-> cur-lgt dir2 levels x) (* (-> cur-lgt dir2 levels x) f0-20)) + (set! (-> cur-lgt dir2 levels y) (* (-> cur-lgt dir2 levels y) f0-20)) + ) + (vu-lights<-light-group! vu-lgt cur-lgt) + ) + ) + ) + (.lvf vf2 (&-> vu-lgt color 0 quad)) + (.lvf vf3 (&-> vu-lgt color 1 quad)) + (.lvf vf4 (&-> vu-lgt color 2 quad)) + (.lvf vf5 (&-> vu-lgt 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 (&-> vu-lgt color 0 quad) vf2) + (.svf (&-> vu-lgt color 1 quad) vf3) + (.svf (&-> vu-lgt color 2 quad) vf4) + (.svf (&-> vu-lgt ambient quad) vf5) + (.mov v1-37 vf5) + ) + ) + (if *display-lights* + (add-debug-lights #t (bucket-id debug) (-> tod light-group 0 lights) (-> arg1 origin)) + ) + (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 vector 0 quad)) + (.lvf vf25 (&-> at-0 camera-rot vector 1 quad)) + (.lvf vf26 (&-> at-0 camera-rot vector 2 quad)) + (.lvf vf27 (&-> at-0 camera-rot vector 3 quad)) + ) + (let ((v1-42 (-> (the-as terrain-context #x70000000) work foreground joint-work joint-stack data 1 vector 1))) + (.lvf vf15 (&-> s4-0 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 (&-> v1-42 quad) vf15) + (when (< 0.0 (+ (-> v1-42 z) (-> arg1 bounds w))) + (let ((lod-to-use 0)) + (let ((cam-dist (-> v1-42 w))) + (when (nonzero? (-> arg1 lod-set max-lod)) + (cond + ((>= (-> arg1 force-lod) 0) + (set! lod-to-use (-> arg1 force-lod)) + (if (< (-> arg1 lod-set lod (-> arg1 lod-set max-lod) dist) cam-dist) + (return #f) + ) + ) + (else + (while (and (< lod-to-use (-> arg1 lod-set max-lod)) (< (-> arg1 lod-set lod lod-to-use dist) cam-dist)) + (+! lod-to-use 1) + ) + ) + ) + ) + (if (and (< (-> arg1 lod-set lod lod-to-use dist) cam-dist) (< (-> arg1 force-lod) 0)) + (return #f) + ) + (let ((v1-64 (-> arg1 sink-group level)) + (a0-26 (+ (-> arg1 sink-group merc-sink foreground-texture-page) 6)) + ) + (when (not (logtest? (-> arg1 status) (draw-status do-not-check-distance))) + (if (< cam-dist (-> v1-64 closest-object a0-26)) + (set! (-> v1-64 closest-object a0-26) cam-dist) + ) + (when (and (!= a0-26 6) (!= (-> arg1 level-index) 2)) + (let ((a1-45 (cond + ((< 102400.0 cam-dist) + (-> arg1 mgeo header masks 0) + ) + ((< 81920.0 cam-dist) + (-> arg1 mgeo header masks 1) + ) + (else + (-> arg1 mgeo header masks 2) + ) ) ) - ) - ) - (logior! (-> v1-64 texture-mask a0-26) a1-45) + ) + (logior! (-> v1-64 texture-mask a0-26) a1-45) + ) ) ) ) + (if (or (guard-band-cull s4-0) (< cam-dist (* 1.2 (-> *math-camera* d)))) + (logior! (-> arg1 status) (draw-status needs-clip)) + (logclear! (-> arg1 status) (draw-status needs-clip)) + ) + (logior! (-> arg1 status) (draw-status was-drawn)) + (if (logtest? (-> arg1 status) (draw-status skip-bones)) + (return #f) + ) + (draw-bones arg1 arg3 cam-dist) ) - (if (or (guard-band-cull s4-0) (< cam-dist (* 1.2 (-> *math-camera* d)))) - (logior! (-> arg1 status) (draw-status needs-clip)) - (logclear! (-> arg1 status) (draw-status needs-clip)) + (when (and (< lod-to-use (-> arg1 cur-lod)) (logtest? (-> arg1 status) (draw-status has-joint-channels))) + (let ((v1-82 *matrix-engine*)) + (set! (-> v1-82 (-> v1-82 length)) (process->handle sv-16)) + (+! (-> v1-82 length) 1) ) - (logior! (-> arg1 status) (draw-status was-drawn)) - (if (logtest? (-> arg1 status) (draw-status skip-bones)) - (return #f) - ) - (draw-bones arg1 arg3 cam-dist) - ) - (when (and (< lod-to-use (-> arg1 cur-lod)) (logtest? (-> arg1 status) (draw-status has-joint-channels))) - (let ((v1-82 *matrix-engine*)) - (set! (-> v1-82 (-> v1-82 length)) (process->handle sv-16)) - (+! (-> v1-82 length) 1) ) + (lod-set! arg1 lod-to-use) ) - (lod-set! arg1 lod-to-use) ) ) ) diff --git a/test/decompiler/reference/jak1/engine/entity/actor-link-h_REF.gc b/test/decompiler/reference/jak1/engine/entity/actor-link-h_REF.gc index 812d4621fb..f8ac7838fa 100644 --- a/test/decompiler/reference/jak1/engine/entity/actor-link-h_REF.gc +++ b/test/decompiler/reference/jak1/engine/entity/actor-link-h_REF.gc @@ -5,9 +5,9 @@ ;; INFO: Used lq/sq ;; INFO: Return type mismatch entity vs entity-actor. (defun entity-actor-lookup ((lump res-lump) (name symbol) (idx int)) - (local-vars (sv-16 res-tag)) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-1 (res-lump-data lump name (pointer uint32) :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-1 (res-lump-data lump name (pointer uint32) :tag-ptr (& sv-16))) + ) (the-as entity-actor (when (and v1-1 (< idx (the-as int (-> sv-16 elt-count)))) @@ -24,12 +24,12 @@ ;; WARN: Check prologue - tricky store of r0 ;; INFO: Used lq/sq (defun entity-actor-count ((res res-lump) (name symbol)) - (local-vars (tag res-tag)) - (set! tag (new 'static 'res-tag)) - (if (res-lump-data res name pointer :tag-ptr (& tag)) - (the-as int (-> tag elt-count)) - 0 - ) + (let ((tag (new 'static 'res-tag))) + (if (res-lump-data res name pointer :tag-ptr (& tag)) + (the-as int (-> tag elt-count)) + 0 + ) + ) ) ;; definition of type actor-link-info diff --git a/test/decompiler/reference/jak1/engine/entity/ambient_REF.gc b/test/decompiler/reference/jak1/engine/entity/ambient_REF.gc index 64a6491388..8bba78d051 100644 --- a/test/decompiler/reference/jak1/engine/entity/ambient_REF.gc +++ b/test/decompiler/reference/jak1/engine/entity/ambient_REF.gc @@ -169,24 +169,23 @@ ;; definition for function level-hint-task-process ;; INFO: Used lq/sq (defun level-hint-task-process ((arg0 entity) (arg1 uint128) (arg2 string)) - (local-vars (sv-16 res-tag)) (let ((gp-0 (res-lump-value arg0 'text-id int :default arg1)) (s5-0 0) ) (cond ((can-hint-be-played? (the-as text-id gp-0) arg0 arg2) - (set! sv-16 (new 'static 'res-tag)) - (let ((s4-1 ((method-of-type res-lump get-property-data) - arg0 - 'cmds - 'exact - -1000000000.0 - (the-as pointer #f) - (& sv-16) - *res-static-buf* + (let* ((sv-16 (new 'static 'res-tag)) + (s4-1 ((method-of-type res-lump get-property-data) + arg0 + 'cmds + 'exact + -1000000000.0 + (the-as pointer #f) + (& sv-16) + *res-static-buf* + ) ) - ) - ) + ) (when s4-1 (while (and (>= s5-0 0) (< s5-0 (the-as int (-> sv-16 elt-count)))) (set! s5-0 (level-hint-process-cmd (the-as (pointer int32) s4-1) s5-0 (the-as int (-> sv-16 elt-count)))) @@ -689,7 +688,6 @@ ;; INFO: Used lq/sq ;; INFO: Return type mismatch int vs none. (defun ambient-type-sound ((arg0 drawable-ambient) (arg1 vector)) - (local-vars (sv-16 string) (sv-112 res-tag)) (let* ((s5-0 (-> arg0 ambient)) (s4-0 (-> s5-0 ambient-data user-uint64 0)) ) @@ -704,41 +702,41 @@ ) ) (when (< (the-as uint (- (current-time) (the-as int s4-0))) (the-as uint 300)) - (let ((f30-0 (the float (rand-vu-int-count (the-as int (-> s5-0 ambient-data user-float 2)))))) - (set! sv-16 (symbol->string (res-lump-struct s5-0 'effect-name symbol :time f30-0))) - (let ((s4-2 (new 'stack 'sound-spec))) - (set! (-> s4-2 sound-name) (string->sound-name sv-16)) - (logior! (-> s4-2 mask) (sound-mask volume)) - (set! (-> s4-2 volume) 1024) - (logior! (-> s4-2 mask) (sound-mask bend)) - (set! (-> s4-2 bend) (the int (* 327.66998 (rand-vu-float-range -100.0 100.0)))) - (set! sv-112 (new 'static 'res-tag)) - (let ((a1-7 ((method-of-type res-lump get-property-data) - s5-0 - 'effect-param - 'exact - f30-0 - (the-as pointer #f) - (& sv-112) - *res-static-buf* - ) + (let* ((f30-0 (the float (rand-vu-int-count (the-as int (-> s5-0 ambient-data user-float 2))))) + (sv-16 (symbol->string (res-lump-struct s5-0 'effect-name symbol :time f30-0))) + (s4-2 (new 'stack 'sound-spec)) + ) + (set! (-> s4-2 sound-name) (string->sound-name sv-16)) + (logior! (-> s4-2 mask) (sound-mask volume)) + (set! (-> s4-2 volume) 1024) + (logior! (-> s4-2 mask) (sound-mask bend)) + (set! (-> s4-2 bend) (the int (* 327.66998 (rand-vu-float-range -100.0 100.0)))) + (let* ((sv-112 (new 'static 'res-tag)) + (a1-7 ((method-of-type res-lump get-property-data) + s5-0 + 'effect-param + 'exact + f30-0 + (the-as pointer #f) + (& sv-112) + *res-static-buf* ) - ) - (if a1-7 - (effect-param->sound-spec s4-2 (the-as (pointer float) a1-7) (the-as int (-> sv-112 elt-count))) - ) - ) - (when *debug-effect-control* - (format #t "(~5D) effect sound ~A ~S " (current-time) (res-lump-struct s5-0 'name structure) sv-16) - (format - #t - "volume: ~f pitch-mod: ~f~%" - (* 0.09765625 (the float (-> s4-2 volume))) - (* 0.000656168 (the float (-> s4-2 pitch-mod))) + ) + ) + (if a1-7 + (effect-param->sound-spec s4-2 (the-as (pointer float) a1-7) (the-as int (-> sv-112 elt-count))) ) - ) - (sound-play-by-spec s4-2 (new-sound-id) (-> arg0 bsphere)) ) + (when *debug-effect-control* + (format #t "(~5D) effect sound ~A ~S " (current-time) (res-lump-struct s5-0 'name structure) sv-16) + (format + #t + "volume: ~f pitch-mod: ~f~%" + (* 0.09765625 (the float (-> s4-2 volume))) + (* 0.000656168 (the float (-> s4-2 pitch-mod))) + ) + ) + (sound-play-by-spec s4-2 (new-sound-id) (-> arg0 bsphere)) ) ) ) @@ -1099,7 +1097,6 @@ ;; INFO: Used lq/sq ;; INFO: Return type mismatch int vs none. (defmethod draw-debug ((this entity-ambient)) - (local-vars (sv-16 uint128)) (let ((gp-0 (-> this trans)) (s5-0 (res-lump-struct this 'type symbol)) (s3-0 #f) @@ -1120,8 +1117,8 @@ ) ((= s5-0 'hint) (when *display-ambient-hint-marks* - (set! sv-16 (res-lump-value this 'text-id uint128)) - (let ((s3-2 add-debug-text-3d) + (let ((sv-16 (res-lump-value this 'text-id uint128)) + (s3-2 add-debug-text-3d) (s2-1 #t) (s1-1 68) ) diff --git a/test/decompiler/reference/jak1/engine/entity/entity_REF.gc b/test/decompiler/reference/jak1/engine/entity/entity_REF.gc index 1de851b463..ddd8292273 100644 --- a/test/decompiler/reference/jak1/engine/entity/entity_REF.gc +++ b/test/decompiler/reference/jak1/engine/entity/entity_REF.gc @@ -611,12 +611,7 @@ ;; INFO: Used lq/sq ;; INFO: Return type mismatch int vs none. (defmethod update-vis-volumes ((this level-group)) - (local-vars - (v1-10 symbol) - (sv-16 process) - (sv-32 (function process-drawable vector vector none)) - (sv-48 process-tree) - ) + (local-vars (v1-10 symbol) (sv-16 process)) (dotimes (s5-0 (-> this length)) (let ((v1-3 (-> this level s5-0))) (when (= (-> v1-3 status) 'active) @@ -639,16 +634,17 @@ (update-actor-vis-box (the-as process-drawable sv-16) s2-0 s1-0) (let ((s0-2 (-> sv-16 child))) (while s0-2 - (set! sv-32 update-actor-vis-box) - (set! sv-48 (-> s0-2 0)) - (let ((a0-7 (if (and (nonzero? sv-48) (type-type? (-> sv-48 type) process-drawable)) - sv-48 - ) - ) - (a1-5 s2-0) - (a2-2 s1-0) + (let ((sv-32 update-actor-vis-box) + (sv-48 (-> s0-2 0)) ) - (sv-32 (the-as process-drawable a0-7) a1-5 a2-2) + (sv-32 + (the-as process-drawable (if (and (nonzero? sv-48) (type-type? (-> sv-48 type) process-drawable)) + sv-48 + ) + ) + s2-0 + s1-0 + ) ) (set! s0-2 (-> s0-2 0 brother)) ) @@ -668,27 +664,23 @@ ;; INFO: Used lq/sq ;; INFO: Return type mismatch int vs none. (defmethod update-vis-volumes-from-nav-mesh ((this level-group)) - (local-vars (sv-16 entity) (sv-32 entity)) (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)) - (set! sv-32 (-> s4-0 data s3-0 entity)) - (let* ((v0-0 (res-lump-data sv-32 'visvol (inline-array vector))) + (let* ((sv-32 (-> s4-0 data s3-0 entity)) + (v0-0 (res-lump-data sv-32 'visvol (inline-array vector))) (s1-0 (-> v0-0 0)) (s2-0 (-> v0-0 1)) ) - (let ((s0-0 (-> sv-32 extra trans))) - (set! sv-16 sv-32) - (let* ((t9-1 entity-actor-lookup) - (a1-2 'nav-mesh-actor) - (a2-1 0) - (v0-1 (t9-1 sv-32 a1-2 a2-1)) - ) + (let ((s0-0 (-> sv-32 extra trans)) + (sv-16 sv-32) + ) + (let ((v0-1 (entity-actor-lookup sv-32 'nav-mesh-actor 0))) (when v0-1 (set! sv-16 v0-1) - (the-as entity-actor sv-16) + (the-as entity-actor (the-as entity-actor sv-16)) ) ) (cond @@ -725,47 +717,32 @@ ;; INFO: Used lq/sq ;; INFO: Return type mismatch int vs none. (defmethod print-volume-sizes ((this level-group)) - (local-vars (sv-16 type) (sv-32 (function _varargs_ object)) (sv-48 symbol) (sv-64 string) (sv-80 entity)) + (local-vars (sv-16 type)) (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)) - (set! sv-80 (-> s4-0 data s3-0 entity)) - (let ((s1-0 (the-as object (res-lump-data sv-80 'visvol pointer))) - (f30-0 (res-lump-float sv-80 'vis-dist :default 409600.0)) - (s2-0 (-> sv-80 extra trans)) - ) - (if (type-type? (-> sv-80 type) entity-actor) - (set! sv-16 (-> (the-as entity-actor sv-80) etype)) - (set! sv-16 (the-as type #f)) - ) + (let* ((sv-80 (-> s4-0 data s3-0 entity)) + (s1-0 (the-as object (res-lump-data sv-80 'visvol pointer))) + (f30-0 (res-lump-float sv-80 'vis-dist :default 409600.0)) + (s2-0 (-> sv-80 extra trans)) + ) + (set! sv-16 (cond + ((type-type? (-> sv-80 type) entity-actor) + (set! sv-16 (-> (the-as entity-actor sv-80) etype)) + sv-16 + ) + (else + (the-as type #f) + ) + ) + ) (let ((s0-0 (-> (the-as (inline-array vector) s1-0) 0)) (s1-1 (-> (the-as (inline-array vector) s1-0) 1)) ) - (when (not (or (name= sv-16 money) (or (name= sv-16 crate) (name= sv-16 fuel-cell) (let ((t9-6 name=) - (a1-7 springbox) - ) - (t9-6 sv-16 a1-7) - ) - ) - ) - ) - (set! sv-32 format) - (set! sv-48 #t) - (set! sv-64 "actor-vis ~S ~6,,1M ") - (let* ((t9-7 (method-of-type res-lump get-property-struct)) - (a1-8 'name) - (a2-2 'interp) - (a3-2 -1000000000.0) - (t0-2 #f) - (t1-2 #f) - (t2-2 *res-static-buf*) - (a2-3 (t9-7 sv-80 a1-8 a2-2 a3-2 t0-2 (the-as (pointer res-tag) t1-2) t2-2)) - (a3-3 f30-0) - ) - (sv-32 sv-48 sv-64 a2-3 a3-3) - ) + (when (not (or (name= sv-16 money) (or (name= sv-16 crate) (name= sv-16 fuel-cell) (name= sv-16 springbox)))) + (format #t "actor-vis ~S ~6,,1M " (res-lump-struct sv-80 'name structure) f30-0) (format #t "~6,,1M ~6,,1M ~6,,1M ~6,,1M ~6,,1M ~6,,1M~%" @@ -813,25 +790,6 @@ ;; INFO: Used lq/sq ;; INFO: Return type mismatch int vs none. (defmethod debug-draw-actors ((this level-group) (arg0 symbol)) - (local-vars - (sv-48 (function symbol bucket-id string vector font-color vector2h symbol)) - (sv-64 symbol) - (sv-80 int) - (sv-96 (function symbol bucket-id string vector font-color vector2h symbol)) - (sv-112 symbol) - (sv-128 int) - (sv-144 (function _varargs_ object)) - (sv-160 string) - (sv-176 string) - (sv-192 (function symbol bucket-id string vector font-color vector2h symbol)) - (sv-208 symbol) - (sv-224 int) - (sv-240 (function symbol bucket-id vector vector rgba symbol)) - (sv-256 symbol) - (sv-272 int) - (sv-288 pointer) - (sv-304 pointer) - ) (when (and arg0 (not (or (= *master-mode* 'menu) (= *master-mode* 'progress)))) (dotimes (s4-0 (-> this length)) (let ((v1-8 (-> this level s4-0))) @@ -850,15 +808,13 @@ (-> s1-1 root trans) (new 'static 'rgba :r #x80 :g #xff :b #x80 :a #x80) ) - (set! sv-48 add-debug-text-3d) - (set! sv-64 #t) - (set! sv-80 68) - (let ((a2-2 (res-lump-struct s0-0 'name structure)) - (a3-2 (-> s1-1 root trans)) - (t0-1 1) - (t1-1 (new 'static 'vector2h :y 8)) - ) - (sv-48 sv-64 (the-as bucket-id sv-80) (the-as string a2-2) a3-2 (the-as font-color t0-1) t1-1) + (add-debug-text-3d + #t + (bucket-id debug-no-zbuf) + (res-lump-struct s0-0 'name string) + (-> s1-1 root trans) + (font-color white) + (new 'static 'vector2h :y 8) ) (add-debug-text-3d #t @@ -870,23 +826,19 @@ ) (let ((s0-1 (res-lump-data (-> s1-1 entity) 'eco-info (pointer int32) :time 0.0))) (when s0-1 - (set! sv-96 add-debug-text-3d) - (set! sv-112 #t) - (set! sv-128 68) - (set! sv-144 format) - (set! sv-160 (clear *temp-string*)) - (set! sv-176 "~S ~D~%") - (let ((a2-7 (pickup-type->string (the-as pickup-type (-> s0-1 0)))) - (a3-5 (-> s0-1 1)) + (let ((sv-96 add-debug-text-3d) + (sv-112 #t) + (sv-128 68) ) - (sv-144 sv-160 sv-176 a2-7 a3-5) - ) - (let ((a2-8 *temp-string*) - (a3-6 (-> s1-1 root trans)) - (t0-4 1) - (t1-4 (new 'static 'vector2h :y 24)) - ) - (sv-96 sv-112 (the-as bucket-id sv-128) a2-8 a3-6 (the-as font-color t0-4) t1-4) + (format (clear *temp-string*) "~S ~D~%" (pickup-type->string (the-as pickup-type (-> s0-1 0))) (-> s0-1 1)) + (sv-96 + sv-112 + (the-as bucket-id sv-128) + *temp-string* + (-> s1-1 root trans) + (font-color white) + (new 'static 'vector2h :y 24) + ) ) ) ) @@ -910,18 +862,21 @@ (new 'static 'rgba :r #xff :a #x80) ) ) - (set! sv-192 add-debug-text-3d) - (set! sv-208 #t) - (set! sv-224 68) - (let ((a2-13 (res-lump-struct s0-0 'name structure)) - (t0-8 (if (logtest? (-> s0-0 extra perm status) (entity-perm-status bit-0 bit-1)) - 1 - 5 - ) - ) - (t1-8 (new 'static 'vector2h :y 8)) + (let ((sv-192 add-debug-text-3d) + (sv-208 #t) + (sv-224 68) ) - (sv-192 sv-208 (the-as bucket-id sv-224) (the-as string a2-13) s1-0 (the-as font-color t0-8) t1-8) + (sv-192 + sv-208 + (the-as bucket-id sv-224) + (res-lump-struct s0-0 'name string) + s1-0 + (if (logtest? (-> s0-0 extra perm status) (entity-perm-status bit-0 bit-1)) + (font-color white) + (font-color yellow) + ) + (new 'static 'vector2h :y 8) + ) ) ) ) @@ -944,18 +899,22 @@ (a1-16 (-> s0-2 extra vis-id)) ) (when (and v0-15 (or (= s5-1 #t) (= s5-1 'box))) - (set! sv-240 add-debug-box) - (set! sv-256 #t) - (set! sv-272 68) - (set! sv-288 (&+ v0-15 0)) - (set! sv-304 (&+ v0-15 16)) - (let ((t0-10 (if (is-object-visible? s3-1 a1-16) - (the-as uint #x80808000) - (the-as uint #x80800080) - ) - ) + (let ((sv-240 add-debug-box) + (sv-256 #t) + (sv-272 68) + (sv-288 (&+ v0-15 0)) + (sv-304 (&+ v0-15 16)) ) - (sv-240 sv-256 (the-as bucket-id sv-272) (the-as vector sv-288) (the-as vector sv-304) (the-as rgba t0-10)) + (sv-240 + sv-256 + (the-as bucket-id sv-272) + (the-as vector sv-288) + (the-as vector sv-304) + (if (is-object-visible? s3-1 a1-16) + (new 'static 'rgba :g #x80 :b #x80 :a #x80) + (new 'static 'rgba :r #x80 :b #x80 :a #x80) + ) + ) ) ) ) @@ -1614,7 +1573,6 @@ ;; INFO: Used lq/sq ;; INFO: Return type mismatch int vs object. (defmethod actors-update ((this level-group)) - (local-vars (sv-16 vector) (sv-24 int) (sv-32 entity-links) (sv-48 int) (sv-64 string) (sv-80 int)) (when *compact-actors* (if (and (= *compact-actors* 'debug) (= (-> *nk-dead-pool* alive-list prev) (-> *nk-dead-pool* first-gap))) (churn *nk-dead-pool* 1) @@ -1641,157 +1599,158 @@ ) ) (when *spawn-actors* - (set! sv-16 (camera-pos)) - (set! sv-24 0) - (dotimes (s5-2 (-> this length)) - (let ((s4-2 (-> this level s5-2))) - (when (= (-> s4-2 status) 'active) - (cond - ((= (-> s4-2 display?) 'special) - (let* ((s4-3 (-> s4-2 entity)) - (s3-1 (-> s4-3 length)) - ) - (dotimes (s2-0 s3-1) - (let ((v1-44 (-> s4-3 data s2-0))) - (cond - ((logtest? (-> v1-44 perm status) (entity-perm-status bit-7)) - (when (not (or (-> v1-44 process) (logtest? (-> v1-44 perm status) (entity-perm-status bit-0 dead)))) - (birth! (-> v1-44 entity)) - (set! sv-24 (+ sv-24 1)) - (if (>= sv-24 (-> *ACTOR-bank* birth-max)) - (return (the-as object #f)) - ) - ) + (let ((sv-16 (camera-pos)) + (sv-24 0) + ) + (dotimes (s5-2 (-> this length)) + (let ((s4-2 (-> this level s5-2))) + (when (= (-> s4-2 status) 'active) + (cond + ((= (-> s4-2 display?) 'special) + (let* ((s4-3 (-> s4-2 entity)) + (s3-1 (-> s4-3 length)) ) - (else - (if (and (-> v1-44 process) (not (logtest? (-> v1-44 perm status) (entity-perm-status bit-3)))) - (kill! (-> v1-44 entity)) - ) - ) - ) - ) - ) - ) - ) - ((= (-> s4-2 display?) 'special-vis) - (let* ((s3-2 (-> s4-2 entity)) - (s2-1 (-> s3-2 length)) - ) - (dotimes (s1-0 s2-1) - (let ((s0-0 (-> s3-2 data s1-0))) - (cond - ((and (logtest? (-> s0-0 perm status) (entity-perm-status bit-7)) (is-object-visible? s4-2 (-> s0-0 vis-id))) - (when (not (or (-> s0-0 process) (logtest? (-> s0-0 perm status) (entity-perm-status bit-0 dead)))) - (birth! (-> s0-0 entity)) - (set! sv-24 (+ sv-24 1)) - ) - ) - (else - (when (and (-> s0-0 process) (not (logtest? (-> s0-0 perm status) (entity-perm-status bit-3)))) - (kill! (-> s0-0 entity)) - (set! sv-24 (+ sv-24 1)) - ) - ) - ) - ) - (if (>= sv-24 (-> *ACTOR-bank* birth-max)) - (return (the-as object #f)) - ) - ) - ) - ) - ((= (-> s4-2 display?) 'actor) - (let* ((s4-4 (-> s4-2 entity)) - (s3-3 (-> s4-4 length)) - ) - (dotimes (s2-2 s3-3) - (let ((v1-84 (-> s4-4 data s2-2))) - (cond - (#t - (when (not (or (-> v1-84 process) (logtest? (-> v1-84 perm status) (entity-perm-status bit-0 dead)))) - (birth! (-> v1-84 entity)) - (set! sv-24 (+ sv-24 1)) - (if (>= sv-24 (-> *ACTOR-bank* birth-max)) - (return (the-as object #f)) - ) - ) - ) - (else - (if (and (-> v1-84 process) (not (logtest? (-> v1-84 perm status) (entity-perm-status bit-3)))) - (kill! (-> v1-84 entity)) - ) - ) - ) - ) - ) - ) - ) - ((not *vis-actors*) - (let* ((s4-5 (-> s4-2 entity)) - (s3-4 (-> s4-5 length)) - ) - (dotimes (s2-3 s3-4) - (let ((s1-1 (-> s4-5 data s2-3))) - (cond - ((and (< (vector-vector-distance (-> s1-1 trans) sv-16) (-> *ACTOR-bank* birth-dist)) - (not (logtest? (-> s1-1 perm status) (entity-perm-status bit-9 bit-10))) - ) - (when (not (or (-> s1-1 process) (logtest? (-> s1-1 perm status) (entity-perm-status bit-0 dead)))) - (birth! (-> s1-1 entity)) - (set! sv-24 (+ sv-24 1)) - (if (>= sv-24 (-> *ACTOR-bank* birth-max)) - (return (the-as object #f)) - ) - ) - ) - (else - (if (and (-> s1-1 process) (not (logtest? (-> s1-1 perm status) (entity-perm-status bit-3)))) - (kill! (-> s1-1 entity)) - ) - ) - ) - ) - ) - ) - ) - (*vis-actors* - (when (not (and (-> s4-2 vis-info 0) (-> s4-2 all-visible?))) - (let* ((s3-5 (-> s4-2 entity)) - (s2-4 (-> s3-5 length)) - (s0-1 #f) - ) - (dotimes (s1-2 s2-4) - (set! sv-32 (-> s3-5 data s1-2)) - (cond - ((and (is-object-visible? s4-2 (-> sv-32 vis-id)) - (not (logtest? (-> sv-32 perm status) (entity-perm-status bit-9 bit-10))) - ) - (when (not (or (-> sv-32 process) (logtest? (-> sv-32 perm status) (entity-perm-status bit-0 dead)) s0-1)) - (birth! (-> sv-32 entity)) - (set! sv-24 (+ sv-24 1)) - (when (< (/ (the float (memory-free *nk-dead-pool*)) (the float (memory-total *nk-dead-pool*))) 0.1) - (let ((s0-2 format)) - (set! sv-48 0) - (set! sv-64 "WARNING: low actor memory, no birth triggered!!! ~D/~D~%") - (set! sv-80 (memory-free *nk-dead-pool*)) - (let ((a3-2 (memory-total *nk-dead-pool*))) - (s0-2 sv-48 sv-64 sv-80 a3-2) - ) - ) - (set! s0-1 #t) - ) - ) - ) - (else - (when (and (-> sv-32 process) (not (logtest? (-> sv-32 perm status) (entity-perm-status bit-3)))) - (kill! (-> sv-32 entity)) - (set! sv-24 (+ sv-24 1)) + (dotimes (s2-0 s3-1) + (let ((v1-44 (-> s4-3 data s2-0))) + (cond + ((logtest? (-> v1-44 perm status) (entity-perm-status bit-7)) + (when (not (or (-> v1-44 process) (logtest? (-> v1-44 perm status) (entity-perm-status bit-0 dead)))) + (birth! (-> v1-44 entity)) + (+! sv-24 1) + (if (>= sv-24 (-> *ACTOR-bank* birth-max)) + (return (the-as object #f)) + ) ) ) + (else + (if (and (-> v1-44 process) (not (logtest? (-> v1-44 perm status) (entity-perm-status bit-3)))) + (kill! (-> v1-44 entity)) + ) + ) + ) + ) + ) + ) + ) + ((= (-> s4-2 display?) 'special-vis) + (let* ((s3-2 (-> s4-2 entity)) + (s2-1 (-> s3-2 length)) ) - (if (>= sv-24 (-> *ACTOR-bank* birth-max)) - (return (the-as object #f)) + (dotimes (s1-0 s2-1) + (let ((s0-0 (-> s3-2 data s1-0))) + (cond + ((and (logtest? (-> s0-0 perm status) (entity-perm-status bit-7)) (is-object-visible? s4-2 (-> s0-0 vis-id))) + (when (not (or (-> s0-0 process) (logtest? (-> s0-0 perm status) (entity-perm-status bit-0 dead)))) + (birth! (-> s0-0 entity)) + (+! sv-24 1) + ) ) + (else + (when (and (-> s0-0 process) (not (logtest? (-> s0-0 perm status) (entity-perm-status bit-3)))) + (kill! (-> s0-0 entity)) + (+! sv-24 1) + ) + ) + ) + ) + (if (>= sv-24 (-> *ACTOR-bank* birth-max)) + (return (the-as object #f)) + ) + ) + ) + ) + ((= (-> s4-2 display?) 'actor) + (let* ((s4-4 (-> s4-2 entity)) + (s3-3 (-> s4-4 length)) + ) + (dotimes (s2-2 s3-3) + (let ((v1-84 (-> s4-4 data s2-2))) + (cond + (#t + (when (not (or (-> v1-84 process) (logtest? (-> v1-84 perm status) (entity-perm-status bit-0 dead)))) + (birth! (-> v1-84 entity)) + (+! sv-24 1) + (if (>= sv-24 (-> *ACTOR-bank* birth-max)) + (return (the-as object #f)) + ) + ) + ) + (else + (if (and (-> v1-84 process) (not (logtest? (-> v1-84 perm status) (entity-perm-status bit-3)))) + (kill! (-> v1-84 entity)) + ) + ) + ) + ) + ) + ) + ) + ((not *vis-actors*) + (let* ((s4-5 (-> s4-2 entity)) + (s3-4 (-> s4-5 length)) + ) + (dotimes (s2-3 s3-4) + (let ((s1-1 (-> s4-5 data s2-3))) + (cond + ((and (< (vector-vector-distance (-> s1-1 trans) sv-16) (-> *ACTOR-bank* birth-dist)) + (not (logtest? (-> s1-1 perm status) (entity-perm-status bit-9 bit-10))) + ) + (when (not (or (-> s1-1 process) (logtest? (-> s1-1 perm status) (entity-perm-status bit-0 dead)))) + (birth! (-> s1-1 entity)) + (+! sv-24 1) + (if (>= sv-24 (-> *ACTOR-bank* birth-max)) + (return (the-as object #f)) + ) + ) + ) + (else + (if (and (-> s1-1 process) (not (logtest? (-> s1-1 perm status) (entity-perm-status bit-3)))) + (kill! (-> s1-1 entity)) + ) + ) + ) + ) + ) + ) + ) + (*vis-actors* + (when (not (and (-> s4-2 vis-info 0) (-> s4-2 all-visible?))) + (let* ((s3-5 (-> s4-2 entity)) + (s2-4 (-> s3-5 length)) + (s0-1 #f) + ) + (dotimes (s1-2 s2-4) + (let ((sv-32 (-> s3-5 data s1-2))) + (cond + ((and (is-object-visible? s4-2 (-> sv-32 vis-id)) + (not (logtest? (-> sv-32 perm status) (entity-perm-status bit-9 bit-10))) + ) + (when (not (or (-> sv-32 process) (logtest? (-> sv-32 perm status) (entity-perm-status bit-0 dead)) s0-1)) + (birth! (-> sv-32 entity)) + (+! sv-24 1) + (when (< (/ (the float (memory-free *nk-dead-pool*)) (the float (memory-total *nk-dead-pool*))) 0.1) + (format + 0 + "WARNING: low actor memory, no birth triggered!!! ~D/~D~%" + (memory-free *nk-dead-pool*) + (memory-total *nk-dead-pool*) + ) + (set! s0-1 #t) + ) + ) + ) + (else + (when (and (-> sv-32 process) (not (logtest? (-> sv-32 perm status) (entity-perm-status bit-3)))) + (kill! (-> sv-32 entity)) + (+! sv-24 1) + ) + ) + ) + ) + (if (>= sv-24 (-> *ACTOR-bank* birth-max)) + (return (the-as object #f)) + ) + ) ) ) ) diff --git a/test/decompiler/reference/jak1/engine/entity/res_REF.gc b/test/decompiler/reference/jak1/engine/entity/res_REF.gc index b04e71717c..59b39fee3c 100644 --- a/test/decompiler/reference/jak1/engine/entity/res_REF.gc +++ b/test/decompiler/reference/jak1/engine/entity/res_REF.gc @@ -736,9 +736,8 @@ ;; definition for method 18 of type res-lump (defmethod add-32bit-data! ((this res-lump) (arg0 res-tag) (arg1 object)) - (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)) @@ -748,20 +747,19 @@ ;; definition for method 21 of type res-lump ;; INFO: Used lq/sq (defmethod get-curve-data! ((this res-lump) (arg0 curve) (arg1 symbol) (arg2 symbol) (arg3 float)) - (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))) @@ -774,18 +772,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))) @@ -803,7 +801,6 @@ ;; INFO: Return type mismatch int vs res-lump. ;; ERROR: Failed load: (set! v1-72 (l.wu (+ a0-58 -4))) at op 206 (defmethod mem-usage ((this res-lump) (block memory-usage-block) (flags int)) - (local-vars (sv-16 int)) (let ((mem-use-id 48) (mem-use-name "res") ) @@ -864,12 +861,13 @@ (+! (-> block data mem-use-id used) v1-63) (+! (-> block data mem-use-id total) (logand -16 (+ v1-63 15))) ) - (set! sv-16 0) - (while (< sv-16 (-> (the-as array tag-data) length)) - (let ((a0-58 (-> (the-as (array object) tag-data) sv-16))) - ((method-of-type (rtype-of a0-58) mem-usage) a0-58 block flags) + (let ((sv-16 0)) + (while (< sv-16 (-> (the-as array tag-data) length)) + (let ((a0-58 (-> (the-as (array object) tag-data) sv-16))) + ((method-of-type (rtype-of a0-58) mem-usage) a0-58 block flags) + ) + (+! sv-16 1) ) - (set! sv-16 (+ sv-16 1)) ) ) (else diff --git a/test/decompiler/reference/jak1/engine/game/effect-control_REF.gc b/test/decompiler/reference/jak1/engine/game/effect-control_REF.gc index 881fdb6213..0091db597d 100644 --- a/test/decompiler/reference/jak1/engine/game/effect-control_REF.gc +++ b/test/decompiler/reference/jak1/engine/game/effect-control_REF.gc @@ -264,17 +264,6 @@ ;; INFO: Used lq/sq ;; INFO: Return type mismatch int vs object. (defmethod effect-control-method-10 ((this effect-control) (arg0 symbol) (arg1 float) (arg2 int)) - (local-vars - (sv-160 int) - (sv-176 symbol) - (sv-192 symbol) - (sv-208 symbol) - (sv-224 int) - (sv-240 symbol) - (sv-256 symbol) - (sv-272 symbol) - (sv-288 res-lump) - ) (let ((s3-0 (-> arg0 value)) (s5-0 (cond ((< arg2 0) @@ -367,34 +356,16 @@ s5-0 ) ) - (let ((s4-1 (get-process *default-dead-pool* part-tracker #x4000))) - (when s4-1 - (let ((t9-7 (method-of-type part-tracker activate))) - (t9-7 (the-as part-tracker s4-1) (-> this process) 'part-tracker (the-as pointer #x70004000)) - ) - (let ((s2-1 run-function-in-process) - (s1-0 s4-1) - (s0-0 part-tracker-init) - ) - (set! sv-160 -1) - (set! sv-176 (the-as symbol #f)) - (set! sv-192 (the-as symbol #f)) - (set! sv-208 (the-as symbol #f)) - (let ((t3-0 (vector<-cspace! (new 'stack-no-clear 'vector) (-> this process node-list data s5-0)))) - ((the-as (function object object object object object object object object none) s2-1) - s1-0 - s0-0 - (the-as sparticle-launch-group s3-0) - sv-160 - sv-176 - sv-192 - sv-208 - t3-0 - ) - ) - ) - (-> s4-1 ppointer) - ) + (process-spawn + part-tracker + :init part-tracker-init + (the-as sparticle-launch-group s3-0) + -1 + (the-as symbol #f) + (the-as symbol #f) + (the-as symbol #f) + (vector<-cspace! (new 'stack-no-clear 'vector) (-> this process node-list data s5-0)) + :to (-> this process) ) ) ) @@ -442,34 +413,16 @@ s5-0 ) ) - (let ((s4-3 (get-process *default-dead-pool* part-tracker #x4000))) - (when s4-3 - (let ((t9-19 (method-of-type part-tracker activate))) - (t9-19 (the-as part-tracker s4-3) (-> this process) 'part-tracker (the-as pointer #x70004000)) - ) - (let ((s2-3 run-function-in-process) - (s1-2 s4-3) - (s0-2 part-tracker-init) - ) - (set! sv-224 -1) - (set! sv-240 (the-as symbol #f)) - (set! sv-256 (the-as symbol #f)) - (set! sv-272 (the-as symbol #f)) - (let ((t3-1 (vector<-cspace! (new 'stack-no-clear 'vector) (-> this process node-list data s5-0)))) - ((the-as (function object object object object object object object object none) s2-3) - s1-2 - s0-2 - s3-0 - sv-224 - sv-240 - sv-256 - sv-272 - t3-1 - ) - ) - ) - (-> s4-3 ppointer) - ) + (process-spawn + part-tracker + :init part-tracker-init + s3-0 + -1 + (the-as symbol #f) + (the-as symbol #f) + (the-as symbol #f) + (vector<-cspace! (new 'stack-no-clear 'vector) (-> this process node-list data s5-0)) + :to (-> this process) ) ) ((= (-> (the-as basic s3-0) type) sound-spec) @@ -511,17 +464,16 @@ (set! (-> v1-67 death-timer-org) (-> v1-67 death-timer)) (set! (-> v1-67 death-draw-overlap) (-> (the-as death-info s3-0) overlap)) ) - (when (-> (the-as death-info s3-0) sound) - (let* ((s2-5 this) - (s1-3 (method-of-object s2-5 effect-control-method-12)) - (s0-3 (-> (the-as death-info s3-0) sound)) - ) - (set! sv-288 (-> this res)) - (let ((t1-11 (string->sound-name (symbol->string (-> (the-as death-info s3-0) sound))))) - (s1-3 s2-5 s0-3 arg1 s5-0 sv-288 t1-11) + (if (-> (the-as death-info s3-0) sound) + (effect-control-method-12 + 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)) ) (else @@ -537,16 +489,6 @@ ;; INFO: Used lq/sq ;; INFO: Return type mismatch int vs none. (defmethod effect-control-method-11 ((this effect-control) (arg0 symbol) (arg1 float) (arg2 int) (arg3 basic) (arg4 pat-surface)) - (local-vars - (sv-48 - (function sparticle-system sparticle-launcher vector sparticle-launch-state sparticle-launch-control float none) - ) - (sv-64 sparticle-system) - (sv-80 - (function sparticle-system sparticle-launcher vector sparticle-launch-state sparticle-launch-control float none) - ) - (sv-96 sparticle-system) - ) (let ((s1-0 (the-as sound-name #f))) (let ((a0-4 (-> *display* frames (-> *display* last-screen) frame run-time))) (case arg0 @@ -962,17 +904,9 @@ ) ) ) - (when (nonzero? s0-0) - (set! sv-48 sp-launch-particles-var) - (set! sv-64 *sp-particle-system-2d*) - (let ((a2-36 (vector<-cspace! (new 'stack-no-clear 'vector) (-> this process node-list data arg2))) - (a3-6 #f) - (t0-1 #f) - (t1-1 1.0) - ) - (sv-48 sv-64 s0-0 a2-36 (the-as sparticle-launch-state a3-6) (the-as sparticle-launch-control t0-1) t1-1) + (if (nonzero? s0-0) + (launch-particles s0-0 (vector<-cspace! (new 'stack-no-clear 'vector) (-> this process node-list data arg2))) ) - ) ) ) (('effect-jump-droppings) @@ -1032,17 +966,9 @@ ) ) ) - (when (nonzero? s0-1) - (set! sv-80 sp-launch-particles-var) - (set! sv-96 *sp-particle-system-2d*) - (let ((a2-37 (vector<-cspace! (new 'stack-no-clear 'vector) (-> this process node-list data arg2))) - (a3-7 #f) - (t0-2 #f) - (t1-2 1.0) - ) - (sv-80 sv-96 s0-1 a2-37 (the-as sparticle-launch-state a3-7) (the-as sparticle-launch-control t0-2) t1-2) + (if (nonzero? s0-1) + (launch-particles s0-1 (vector<-cspace! (new 'stack-no-clear 'vector) (-> this process node-list data arg2))) ) - ) ) ) ) @@ -1058,9 +984,8 @@ ;; definition for method 12 of type effect-control ;; INFO: Used lq/sq (defmethod effect-control-method-12 ((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 (new 'stack 'sound-spec)) (s5-0 (if (< arg2 0) (the-as vector #f) @@ -1073,34 +998,31 @@ (set! (-> gp-0 volume) 1024) (logior! (-> gp-0 mask) (sound-mask bend)) (set! (-> gp-0 bend) (the int (* 327.66998 (rand-vu-float-range -100.0 100.0)))) - (set! sv-112 (new 'static 'res-tag)) - (let* ((t9-3 (method-of-type res-lump get-property-data)) - (a1-6 '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-7 (t9-3 (the-as res-lump sv-144) a1-6 a2-1 a3-1 (the-as pointer t0-1) t1-1 t2-0)) + (let* ((sv-112 (new 'static 'res-tag)) + (a1-7 ((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* + ) + ) ) (if a1-7 (effect-param->sound-spec gp-0 (the-as (pointer float) a1-7) (the-as int (-> sv-112 elt-count))) ) ) - (if (and (nonzero? (-> gp-0 fo-max)) (let ((f30-1 (* 4096.0 (the float (-> gp-0 fo-max))))) - (set! sv-160 vector-vector-distance) - (let ((a0-6 (ear-trans)) - (a1-8 s5-0) - ) - (< f30-1 (sv-160 a0-6 a1-8)) - ) - ) + (if (and (nonzero? (-> gp-0 fo-max)) + (< (* 4096.0 (the float (-> gp-0 fo-max))) (vector-vector-distance (ear-trans) s5-0)) ) (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/jak1/engine/game/fact-h_REF.gc b/test/decompiler/reference/jak1/engine/game/fact-h_REF.gc index d3f669d87d..7d05bbf179 100644 --- a/test/decompiler/reference/jak1/engine/game/fact-h_REF.gc +++ b/test/decompiler/reference/jak1/engine/game/fact-h_REF.gc @@ -220,7 +220,6 @@ ;; definition for method 0 of type fact-info ;; INFO: Used lq/sq (defmethod new fact-info ((allocation symbol) (type-to-make type) (proc process-drawable) (pkup-type pickup-type) (pkup-amount float)) - (local-vars (tag res-tag)) (let ((this (object-new allocation type-to-make (the-as int (-> type-to-make size))))) (let ((ent (-> proc entity))) (when (zero? this) @@ -229,8 +228,9 @@ (goto cfg-10) ) (set! (-> this process) proc) - (set! tag (new 'static 'res-tag)) - (let ((v1-6 (res-lump-data ent 'eco-info (pointer int32) :tag-ptr (& tag) :time 0.0))) + (let* ((tag (new 'static 'res-tag)) + (v1-6 (res-lump-data ent 'eco-info (pointer int32) :tag-ptr (& tag) :time 0.0)) + ) (cond (v1-6 (let ((a0-6 (-> tag elt-count))) diff --git a/test/decompiler/reference/jak1/engine/game/game-info_REF.gc b/test/decompiler/reference/jak1/engine/game/game-info_REF.gc index f2883a572f..270a5c90f5 100644 --- a/test/decompiler/reference/jak1/engine/game/game-info_REF.gc +++ b/test/decompiler/reference/jak1/engine/game/game-info_REF.gc @@ -139,7 +139,7 @@ ;; definition for method 9 of type game-info ;; INFO: Used lq/sq (defmethod initialize! ((this game-info) (cause symbol) (save-to-load game-save) (continue-point-override string)) - (local-vars (v0-0 int) (sv-96 symbol)) + (local-vars (v0-0 int)) (case cause (('dead) (+! (-> this total-deaths) 1) @@ -261,29 +261,25 @@ (let ((t9-15 (method-of-type process activate))) (t9-15 s3-1 *default-pool* 'process (the-as pointer #x70004000)) ) - (let ((s2-0 (the-as (function cpu-thread function object object object object pointer) set-to-run)) - (s1-0 (-> s3-1 main-thread)) - (s0-0 (lambda ((arg0 symbol) (arg1 symbol) (arg2 continue-point) (arg3 game-save)) - (stop arg0) - (reset-actors arg1) - (set-continue! *game-info* arg2) - (when arg3 - (load-game! *game-info* arg3) - (set! arg2 (get-or-create-continue! *game-info*)) - ) - (suspend) - (start arg0 arg2) - (none) - ) - ) - ) - (set! sv-96 (-> this mode)) - (let ((t0-2 (get-or-create-continue! this)) - (t1-2 save-to-load) - ) - (s2-0 s1-0 s0-0 sv-96 cause t0-2 t1-2) - ) - ) + ((the-as (function cpu-thread function object object object object pointer) set-to-run) + (-> s3-1 main-thread) + (lambda ((arg0 symbol) (arg1 symbol) (arg2 continue-point) (arg3 game-save)) + (stop arg0) + (reset-actors arg1) + (set-continue! *game-info* arg2) + (when arg3 + (load-game! *game-info* arg3) + (set! arg2 (get-or-create-continue! *game-info*)) + ) + (suspend) + (start arg0 arg2) + (none) + ) + (-> this mode) + cause + (get-or-create-continue! this) + save-to-load + ) (-> s3-1 ppointer) ) ) diff --git a/test/decompiler/reference/jak1/engine/game/game-save_REF.gc b/test/decompiler/reference/jak1/engine/game/game-save_REF.gc index 31884c80a5..ef2fdbed00 100644 --- a/test/decompiler/reference/jak1/engine/game/game-save_REF.gc +++ b/test/decompiler/reference/jak1/engine/game/game-save_REF.gc @@ -260,7 +260,6 @@ ;; definition for method 11 of type game-save ;; INFO: Used lq/sq (defmethod debug-print ((this game-save) (detail symbol)) - (local-vars (sv-16 int)) (format #t "[~8x] ~A~%" this (-> this type)) (format #t "~Tversion: ~D~%" (-> this version)) (format #t "~Tallocated-length: ~D~%" (-> this allocated-length)) @@ -284,19 +283,15 @@ (tag-idx 0) ) (while (< (the-as int tag) (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 tag-idx) - (let ((a3-2 (game-save-elt->string (-> tag elt-type))) - (t0-1 (-> tag elt-count)) - (t1-1 (-> tag elt-size)) - (t2-1 (-> tag user-uint64)) - (t3-0 (-> tag 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 " + tag-idx + (game-save-elt->string (-> tag elt-type)) + (-> tag elt-count) + (-> tag elt-size) + (-> tag user-uint64) + (-> tag user-float0) ) (let ((v1-0 (-> tag elt-type))) (if (or (= v1-0 (game-save-elt name)) (= v1-0 (game-save-elt continue))) diff --git a/test/decompiler/reference/jak1/engine/game/projectiles_REF.gc b/test/decompiler/reference/jak1/engine/game/projectiles_REF.gc index 223333c74a..6d46d0bf14 100644 --- a/test/decompiler/reference/jak1/engine/game/projectiles_REF.gc +++ b/test/decompiler/reference/jak1/engine/game/projectiles_REF.gc @@ -117,74 +117,74 @@ ;; INFO: Used lq/sq ;; INFO: Return type mismatch int vs cshape-moving-flags. (defun projectile-collision-reaction ((arg0 collide-shape-moving) (arg1 collide-shape-intersect) (arg2 vector) (arg3 vector)) - (local-vars (sv-64 vector) (sv-68 vector) (sv-72 matrix) (sv-80 int) (sv-224 symbol)) - (set! sv-64 (new-stack-vector0)) - (set! sv-68 (new-stack-vector0)) - (set! sv-72 (new 'stack-no-clear 'matrix)) - (set! sv-80 0) - (set! (-> sv-72 vector 0 quad) (-> arg3 quad)) - (let ((a1-1 (new 'stack-no-clear 'vector))) - (vector-float*! a1-1 (-> arg1 move-vec) (-> arg1 best-u)) - (move-by-vector! arg0 a1-1) - ) - (set-and-handle-pat! arg0 (-> arg1 best-tri pat)) - (case (-> arg1 best-tri pat material) - (((pat-material stopproj)) - (send-event (-> arg0 process) 'die) - ) - ) - (vector-! sv-64 (-> arg1 best-from-prim prim-core world-sphere) (-> arg1 best-tri intersect)) - (set! (-> sv-64 w) 1.0) - (vector-normalize! sv-64 1.0) - (set! (-> arg0 coverage) (vector-dot sv-64 (-> arg1 best-tri normal))) - (let ((v1-22 (-> sv-64 quad))) - (set! (-> sv-68 quad) v1-22) - ) - (when (= (-> arg1 best-u) 0.0) - (let ((a1-7 (vector-float*! (new 'stack-no-clear 'vector) sv-68 32.0))) - (move-by-vector! arg0 a1-7) - ) - ) - (set! (-> arg0 surface-normal quad) (-> sv-68 quad)) - (set! (-> arg0 poly-normal quad) (-> arg1 best-tri normal quad)) - (set! (-> arg0 surface-angle) (vector-dot sv-68 (-> arg0 dynam gravity-normal))) - (set! (-> arg0 poly-angle) (vector-dot (-> arg0 poly-normal) (-> arg0 dynam gravity-normal))) - (set! (-> arg0 touch-angle) - (vector-dot sv-68 (vector-normalize! (vector-negate! (new-stack-vector0) (the-as vector sv-72)) 1.0)) + (let ((sv-64 (new-stack-vector0)) + (sv-68 (new-stack-vector0)) + (sv-72 (new 'stack-no-clear 'matrix)) + (sv-80 0) ) - (if (< (-> arg0 poly-angle) -0.2) - (set! sv-80 (logior sv-80 16)) + (set! (-> sv-72 vector 0 quad) (-> arg3 quad)) + (let ((a1-1 (new 'stack-no-clear 'vector))) + (vector-float*! a1-1 (-> arg1 move-vec) (-> arg1 best-u)) + (move-by-vector! arg0 a1-1) ) - (set! sv-224 (< (fabs (-> arg0 surface-angle)) (-> *pat-mode-info* (-> arg0 cur-pat mode) wall-angle))) - (if (not (logtest? (-> arg0 prev-status) (cshape-moving-flags onsurf))) - (set! (-> arg0 ground-impact-vel) (- (vector-dot (-> arg0 transv) (-> arg0 dynam gravity-normal)))) + (set-and-handle-pat! arg0 (-> arg1 best-tri pat)) + (case (-> arg1 best-tri pat material) + (((pat-material stopproj)) + (send-event (-> arg0 process) 'die) + ) ) - (set! sv-80 (logior sv-80 4)) - (if (-> arg1 best-to-prim) - (set! sv-80 (logior sv-80 32)) + (vector-! sv-64 (-> arg1 best-from-prim prim-core world-sphere) (-> arg1 best-tri intersect)) + (set! (-> sv-64 w) 1.0) + (vector-normalize! sv-64 1.0) + (set! (-> arg0 coverage) (vector-dot sv-64 (-> arg1 best-tri normal))) + (set! (-> sv-68 quad) (-> sv-64 quad)) + (when (= (-> arg1 best-u) 0.0) + (let ((a1-7 (vector-float*! (new 'stack-no-clear 'vector) sv-68 32.0))) + (move-by-vector! arg0 a1-7) + ) ) - (cond - (sv-224 - (set! sv-80 (logior sv-80 8)) - (set! (-> arg0 cur-pat mode) 1) - (set! (-> arg0 local-normal quad) (-> sv-68 quad)) - ) - (else - (set! sv-80 (logior sv-80 1)) - (set! (-> arg0 local-normal quad) (-> sv-68 quad)) + (set! (-> arg0 surface-normal quad) (-> sv-68 quad)) + (set! (-> arg0 poly-normal quad) (-> arg1 best-tri normal quad)) + (set! (-> arg0 surface-angle) (vector-dot sv-68 (-> arg0 dynam gravity-normal))) + (set! (-> arg0 poly-angle) (vector-dot (-> arg0 poly-normal) (-> arg0 dynam gravity-normal))) + (set! (-> arg0 touch-angle) + (vector-dot sv-68 (vector-normalize! (vector-negate! (new-stack-vector0) (the-as vector sv-72)) 1.0)) + ) + (if (< (-> arg0 poly-angle) -0.2) + (logior! sv-80 16) + ) + (let ((sv-224 (< (fabs (-> arg0 surface-angle)) (-> *pat-mode-info* (-> arg0 cur-pat mode) wall-angle)))) + (if (not (logtest? (-> arg0 prev-status) (cshape-moving-flags onsurf))) + (set! (-> arg0 ground-impact-vel) (- (vector-dot (-> arg0 transv) (-> arg0 dynam gravity-normal)))) + ) + (logior! sv-80 4) + (if (-> arg1 best-to-prim) + (logior! sv-80 32) + ) + (cond + (sv-224 + (logior! sv-80 8) + (set! (-> arg0 cur-pat mode) 1) + (set! (-> arg0 local-normal quad) (-> sv-68 quad)) + ) + (else + (logior! sv-80 1) + (set! (-> arg0 local-normal quad) (-> sv-68 quad)) + ) + ) + (vector-reflect-flat-above! arg2 (the-as vector sv-72) sv-68) + (when (and (not sv-224) (>= (-> arg0 coverage) 0.9)) + (logior! sv-80 2) + (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 ground-touch-point quad) (-> arg1 best-tri intersect quad)) + ) + ) ) + (logior! (-> arg0 status) sv-80) + (the-as cshape-moving-flags sv-80) ) - (vector-reflect-flat-above! arg2 (the-as vector sv-72) sv-68) - (when (and (not sv-224) (>= (-> arg0 coverage) 0.9)) - (set! sv-80 (logior sv-80 2)) - (set! (-> arg0 ground-poly-normal quad) (-> arg0 poly-normal quad)) - (when (!= (-> arg0 poly-pat mode) (pat-mode wall)) - (set! (-> arg0 ground-pat) (-> arg0 poly-pat)) - (set! (-> arg0 ground-touch-point quad) (-> arg1 best-tri intersect quad)) - ) - ) - (logior! (-> arg0 status) sv-80) - (the-as cshape-moving-flags sv-80) ) ;; failed to figure out what this is: @@ -1219,7 +1219,6 @@ ;; INFO: Used lq/sq ;; INFO: Return type mismatch int vs none. (defun spawn-projectile-blue ((arg0 target)) - (local-vars (sv-48 entity-actor)) (with-pp (when arg0 (let ((s3-0 (rand-vu-int-range 3 (+ (-> arg0 node-list length) -1))) @@ -1240,22 +1239,17 @@ (let ((s2-0 run-function-in-process) (s1-0 s4-1) (s0-0 projectile-init-by-other) + (sv-48 (-> pp entity)) ) - (set! sv-48 (-> pp entity)) - (let ((a3-1 (vector<-cspace! (new 'stack-no-clear 'vector) (-> arg0 node-list data s3-0))) - (t1-0 8) - (t2-0 (process->handle pp)) - ) - ((the-as (function process function object object object object object object) s2-0) - s1-0 - s0-0 - sv-48 - a3-1 - gp-0 - t1-0 - t2-0 - ) - ) + ((the-as (function process function object object object object object object) s2-0) + s1-0 + s0-0 + sv-48 + (vector<-cspace! (new 'stack-no-clear 'vector) (-> arg0 node-list data s3-0)) + gp-0 + 8 + (process->handle pp) + ) ) (-> s4-1 ppointer) ) diff --git a/test/decompiler/reference/jak1/engine/geometry/cylinder_REF.gc b/test/decompiler/reference/jak1/engine/geometry/cylinder_REF.gc index 69ecc48a38..2827400da4 100644 --- a/test/decompiler/reference/jak1/engine/geometry/cylinder_REF.gc +++ b/test/decompiler/reference/jak1/engine/geometry/cylinder_REF.gc @@ -52,26 +52,6 @@ ;; INFO: Used lq/sq ;; INFO: Return type mismatch int vs none. (defmethod debug-draw ((this cylinder) (arg0 vector4w)) - (local-vars - (sv-896 matrix) - (sv-912 int) - (sv-928 (function vector vector vector float vector)) - (sv-944 vector) - (sv-960 vector) - (sv-976 vector) - (sv-992 (function vector vector vector float vector)) - (sv-1008 vector) - (sv-1024 vector) - (sv-1040 vector) - (sv-1056 (function vector vector vector float vector)) - (sv-1072 vector) - (sv-1088 vector) - (sv-1104 vector) - (sv-1120 (function vector vector vector float vector)) - (sv-1136 vector) - (sv-1152 vector) - (sv-1168 vector) - ) (rlet ((vf0 :class vf) (vf4 :class vf) (vf5 :class vf) @@ -92,49 +72,37 @@ (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-5 (-> s3-0 vector 3))) - (.lvf vf4 (&-> (-> this origin) quad)) - (.lvf vf5 (&-> sv-896 vector 0 quad)) - (.mov.vf.w vf6 vf0) - (.sub.vf.xyz vf6 vf4 vf5) - (.svf (&-> v1-5 quad) vf6) + (let ((sv-896 (new 'stack-no-clear 'matrix))) + (vector-matrix*! (the-as vector sv-896) (-> this origin) s3-0) + (let ((v1-5 (-> s3-0 vector 3))) + (.lvf vf4 (&-> (-> this origin) quad)) + (.lvf vf5 (&-> sv-896 vector 0 quad)) + (.mov.vf.w vf6 vf0) + (.sub.vf.xyz vf6 vf4 vf5) + (.svf (&-> v1-5 quad) vf6) + ) ) - (set! sv-912 0) - (while (< sv-912 8) - (vector+! (-> s5-0 vert (+ sv-912 8)) (-> this origin) s1-0) - (vector+float*! (-> s5-0 vert (+ sv-912 8)) (-> s5-0 vert (+ sv-912 8)) s0-0 (the float sv-912)) - (set! sv-912 (+ sv-912 1)) + (let ((sv-912 0)) + (while (< sv-912 8) + (vector+! (-> s5-0 vert (+ sv-912 8)) (-> this origin) s1-0) + (vector+float*! (-> s5-0 vert (+ sv-912 8)) (-> s5-0 vert (+ sv-912 8)) s0-0 (the float sv-912)) + (+! sv-912 1) + ) ) (dotimes (s0-1 8) - (set! sv-928 vector+float*!) - (set! sv-944 (-> s5-0 vert s0-1)) - (set! sv-960 (-> this origin)) - (set! sv-976 s1-0) - (let ((a3-1 (cos (* 2048.0 (the float (- 7 s0-1)))))) - (sv-928 sv-944 sv-960 sv-976 a3-1) + (vector+float*! (-> s5-0 vert s0-1) (-> this origin) s1-0 (cos (* 2048.0 (the float (- 7 s0-1))))) + (vector+float*! + (-> s5-0 vert s0-1) + (-> s5-0 vert s0-1) + (-> this axis) + (* (- (-> this radius)) (sin (* 2048.0 (the float (- 7 s0-1))))) ) - (set! sv-992 vector+float*!) - (set! sv-1008 (-> s5-0 vert s0-1)) - (set! sv-1024 (-> s5-0 vert s0-1)) - (set! sv-1040 (-> this axis)) - (let ((a3-2 (* (- (-> this radius)) (sin (* 2048.0 (the float (- 7 s0-1))))))) - (sv-992 sv-1008 sv-1024 sv-1040 a3-2) - ) - (set! sv-1056 vector+float*!) - (set! sv-1072 (-> s5-0 vert (+ s0-1 16))) - (set! sv-1088 (-> this origin)) - (set! sv-1104 s1-0) - (let ((a3-3 (cos (* 2048.0 (the float s0-1))))) - (sv-1056 sv-1072 sv-1088 sv-1104 a3-3) - ) - (set! sv-1120 vector+float*!) - (set! sv-1136 (-> s5-0 vert (+ s0-1 16))) - (set! sv-1152 (-> s5-0 vert (+ s0-1 16))) - (set! sv-1168 (-> this axis)) - (let ((a3-4 (+ (-> this length) (* (-> this radius) (sin (* 2048.0 (the float s0-1))))))) - (sv-1120 sv-1136 sv-1152 sv-1168 a3-4) + (vector+float*! (-> s5-0 vert (+ s0-1 16)) (-> this origin) s1-0 (cos (* 2048.0 (the float s0-1)))) + (vector+float*! + (-> s5-0 vert (+ s0-1 16)) + (-> s5-0 vert (+ s0-1 16)) + (-> this axis) + (+ (-> this length) (* (-> this radius) (sin (* 2048.0 (the float s0-1))))) ) ) (dotimes (s2-1 16) @@ -238,7 +206,6 @@ ;; INFO: Used lq/sq ;; INFO: Return type mismatch int vs none. (defmethod debug-draw ((this cylinder-flat) (arg0 vector4w)) - (local-vars (sv-448 vector) (sv-464 int)) (rlet ((vf0 :class vf) (vf4 :class vf) (vf5 :class vf) @@ -259,20 +226,22 @@ (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-5 (-> s3-0 vector 3))) - (.lvf vf4 (&-> (-> this origin) quad)) - (.lvf vf5 (&-> sv-448 quad)) - (.mov.vf.w vf6 vf0) - (.sub.vf.xyz vf6 vf4 vf5) - (.svf (&-> v1-5 quad) vf6) + (let ((sv-448 (new 'stack-no-clear 'vector))) + (vector-matrix*! sv-448 (-> this origin) s3-0) + (let ((v1-5 (-> s3-0 vector 3))) + (.lvf vf4 (&-> (-> this origin) quad)) + (.lvf vf5 (&-> sv-448 quad)) + (.mov.vf.w vf6 vf0) + (.sub.vf.xyz vf6 vf4 vf5) + (.svf (&-> v1-5 quad) vf6) + ) ) - (set! sv-464 0) - (while (< sv-464 8) - (vector+! (-> s5-0 vert (+ sv-464 1)) (-> this origin) s1-0) - (vector+float*! (-> s5-0 vert (+ sv-464 1)) (-> s5-0 vert (+ sv-464 1)) s0-0 (the float sv-464)) - (set! sv-464 (+ sv-464 1)) + (let ((sv-464 0)) + (while (< sv-464 8) + (vector+! (-> s5-0 vert (+ sv-464 1)) (-> this origin) s1-0) + (vector+float*! (-> s5-0 vert (+ sv-464 1)) (-> s5-0 vert (+ sv-464 1)) s0-0 (the float sv-464)) + (+! sv-464 1) + ) ) (set! (-> s5-0 vert 0 quad) (-> this origin quad)) (vector+float*! (-> s5-0 vert 9) (-> this origin) (-> this axis) (-> this length)) diff --git a/test/decompiler/reference/jak1/engine/geometry/geometry_REF.gc b/test/decompiler/reference/jak1/engine/geometry/geometry_REF.gc index bc665d8c5f..97029da3a9 100644 --- a/test/decompiler/reference/jak1/engine/geometry/geometry_REF.gc +++ b/test/decompiler/reference/jak1/engine/geometry/geometry_REF.gc @@ -360,9 +360,7 @@ (defun matrix-from-two-vectors! ((arg0 matrix) (arg1 vector) (arg2 vector)) (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) ) @@ -375,21 +373,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) ) - ) ) ) @@ -401,21 +388,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) ) - ) ) ) @@ -430,13 +406,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) ) ) ) @@ -549,7 +520,6 @@ ;; definition for function vector-vector-deg-slerp! ;; INFO: Used lq/sq (defun vector-vector-deg-slerp! ((arg0 vector) (arg1 vector) (arg2 vector) (arg3 float) (arg4 vector)) - (local-vars (sv-112 (function float float float float))) (cond ((>= 0.0 arg3) (set! (-> arg0 quad) (-> arg1 quad)) @@ -563,15 +533,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) ) ) ) @@ -1197,9 +1163,8 @@ ;; WARN: Stack slot offset 48 signed mismatch ;; WARN: Stack slot offset 48 signed mismatch (defun curve-closest-point ((arg0 curve) (arg1 vector) (arg2 float) (arg3 float) (arg4 int) (arg5 float)) - (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/jak1/engine/geometry/path-h_REF.gc b/test/decompiler/reference/jak1/engine/geometry/path-h_REF.gc index 0b3e8972e5..65633b2144 100644 --- a/test/decompiler/reference/jak1/engine/geometry/path-h_REF.gc +++ b/test/decompiler/reference/jak1/engine/geometry/path-h_REF.gc @@ -63,7 +63,6 @@ ;; INFO: Used lq/sq ;; INFO: Return type mismatch object vs path-control. (defmethod new path-control ((allocation symbol) (type-to-make type) (proc process) (name symbol) (time float)) - (local-vars (tag res-tag)) (let ((this (object-new allocation type-to-make (the-as int (-> type-to-make size))))) (when (zero? this) (go process-drawable-art-error "memory") @@ -80,8 +79,9 @@ ) ) ) - (set! tag (new 'static 'res-tag)) - (let ((data (res-lump-data ent name pointer :tag-ptr (& tag) :time time))) + (let* ((tag (new 'static 'res-tag)) + (data (res-lump-data ent name pointer :tag-ptr (& tag) :time time)) + ) (cond (data (set! (-> this cverts) (the-as (inline-array vector) data)) diff --git a/test/decompiler/reference/jak1/engine/geometry/vol_REF.gc b/test/decompiler/reference/jak1/engine/geometry/vol_REF.gc index fa974003f3..1b27af1d7a 100644 --- a/test/decompiler/reference/jak1/engine/geometry/vol_REF.gc +++ b/test/decompiler/reference/jak1/engine/geometry/vol_REF.gc @@ -27,140 +27,143 @@ ;; WARN: Stack slot offset 148 signed mismatch ;; WARN: Stack slot offset 148 signed mismatch (defmethod init-vol! ((this plane-volume) (arg0 symbol) (arg1 vector-array) (arg2 vector-array)) - (local-vars - (sv-144 vector) - (sv-148 float) - (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 ((f30-0 (plane-volume-intersect-dist (-> s2-0 sv-256) sv-144 sv-192))) - (cond - ((= f30-0 409600000.0) - ) - ((zero? sv-152) - (vector+float*! sv-144 sv-144 sv-192 f30-0) - (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 f30-0) (>= (vector-dot sv-224 sv-160) 0.0)) - ) - ((>= (vector-dot sv-224 (the-as vector (-> s2-0 sv-256))) 0.0) - (when (< (fabs f30-0) (fabs sv-148)) - (set! sv-148 f30-0) - (set! sv-152 (+ sv-152 1)) - ) - ) - (else - (vector+float*! sv-144 sv-144 sv-192 f30-0) - (set! (-> sv-160 quad) (-> s2-0 sv-256 quad)) - (set! sv-152 (+ sv-152 1)) - (if (< (fabs f30-0) (fabs sv-148)) - (set! sv-148 (- sv-148 f30-0)) - (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 ((f30-0 (plane-volume-intersect-dist (-> s2-0 sv-256) sv-144 sv-192))) + (cond + ((= f30-0 409600000.0) + ) + ((zero? sv-152) + (vector+float*! sv-144 sv-144 sv-192 f30-0) + (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 f30-0) (>= (vector-dot sv-224 sv-160) 0.0)) + ) + ((>= (vector-dot sv-224 (the-as vector (-> s2-0 sv-256))) 0.0) + (when (< (fabs f30-0) (fabs sv-148)) + (set! sv-148 f30-0) + (+! sv-152 1) + ) + ) + (else + (vector+float*! sv-144 sv-144 sv-192 f30-0) + (set! (-> sv-160 quad) (-> s2-0 sv-256 quad)) + (+! sv-152 1) + (set! sv-148 (cond + ((< (fabs f30-0) (fabs sv-148)) + (set! sv-148 (- sv-148 f30-0)) + sv-148 + ) + (else + 0.0 + ) + ) + ) + ) + ) + ) + ) + (+! sv-256 1) + ) + ) ) + (cond + ((zero? sv-152) + ) + ((= sv-148 0.0) + ) + (else + (dotimes (v1-70 (-> this num-planes)) + (when (and (!= v1-70 s3-0) (!= v1-70 sv-240)) + (if (< 4096.0 (- (vector-dot sv-144 (the-as vector (-> s2-0 v1-70))) (the-as float (-> s2-0 v1-70 w)))) + (goto cfg-42) + ) + ) + ) + (vector+float*! sv-224 sv-144 sv-192 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) - ) - ((= sv-148 0.0) - ) - (else - (dotimes (v1-70 (-> this num-planes)) - (when (and (!= v1-70 s3-0) (!= v1-70 sv-240)) - (if (< 4096.0 (- (vector-dot sv-144 (the-as vector (-> s2-0 v1-70))) (the-as float (-> s2-0 v1-70 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 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/jak1/engine/gfx/eye_REF.gc b/test/decompiler/reference/jak1/engine/gfx/foreground/eye_REF.gc similarity index 99% rename from test/decompiler/reference/jak1/engine/gfx/eye_REF.gc rename to test/decompiler/reference/jak1/engine/gfx/foreground/eye_REF.gc index 0c81c8a48d..d9561e9dfc 100644 --- a/test/decompiler/reference/jak1/engine/gfx/eye_REF.gc +++ b/test/decompiler/reference/jak1/engine/gfx/foreground/eye_REF.gc @@ -63,7 +63,6 @@ ;; WARN: Stack slot offset 16 signed mismatch ;; INFO: Return type mismatch vector4w vs pointer. (defun render-eyes ((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)) @@ -71,8 +70,8 @@ (let ((f28-0 (* 16.0 (+ (the float (+ s4-0 16)) (* 32.0 (-> arg1 left data 0 x))))) (f26-0 (* 16.0 (+ (the float (+ s3-0 16)) (* 32.0 (-> arg1 left data 0 y))))) (f30-0 (* 16.0 (+ (the float (+ s4-0 48)) (* 32.0 (-> arg1 right data 0 x))))) + (sv-16 (* 16.0 (+ (the float (+ s3-0 16)) (* 32.0 (-> arg1 right data 0 y))))) ) - (set! sv-16 (* 16.0 (+ (the float (+ s3-0 16)) (* 32.0 (-> arg1 right data 0 y))))) (let ((s1-0 (-> arg1 shaders 0))) (let ((v1-6 (the-as object (-> arg0 base)))) (set! (-> (the-as dma-gif-packet v1-6) dma-vif quad) (-> *eye-work* adgif-tmpl dma-vif quad)) diff --git a/test/decompiler/reference/jak1/engine/gfx/foreground/ripple_REF.gc b/test/decompiler/reference/jak1/engine/gfx/foreground/ripple_REF.gc index ec68dde16f..0b55190489 100644 --- a/test/decompiler/reference/jak1/engine/gfx/foreground/ripple_REF.gc +++ b/test/decompiler/reference/jak1/engine/gfx/foreground/ripple_REF.gc @@ -163,7 +163,6 @@ ;; definition for function ripple-find-height (defun ripple-find-height ((arg0 process-drawable) (arg1 int) (arg2 vector)) - (local-vars (sv-16 float) (sv-32 float)) (let* ((f30-0 (-> arg0 root trans y)) (v1-1 (-> arg0 draw)) (a1-5 (-> v1-1 lod-set lod (-> v1-1 cur-lod) geo effect)) @@ -197,20 +196,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-16 (ripple-slow-add-sine-waves s5-0 (+ 1.0 f22-1) f24-1)) + (sv-32 (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-16 f20-0)))) + (f1-9 (+ sv-32 (* (- f28-1 f22-1) (- f1-6 sv-32)))) + (f1-12 (+ f0-22 (* (- f26-1 f24-1) (- f1-9 f0-22)))) + (f0-23 (-> gp-0 faded-scale)) ) - (set! sv-16 (ripple-slow-add-sine-waves s5-0 (+ 1.0 f22-1) f24-1)) - (set! sv-32 (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-16 f20-0)))) - (f1-9 (+ sv-32 (* (- f28-1 f22-1) (- f1-6 sv-32)))) - (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/jak1/engine/gfx/math-camera_REF.gc b/test/decompiler/reference/jak1/engine/gfx/math-camera_REF.gc index c6e8d57f9d..6eb17916b1 100644 --- a/test/decompiler/reference/jak1/engine/gfx/math-camera_REF.gc +++ b/test/decompiler/reference/jak1/engine/gfx/math-camera_REF.gc @@ -39,28 +39,26 @@ (y-rat (-> math-cam y-ratio)) (cull-info (-> math-cam cull-info)) ) - (/ (+ 1.0 (* 4.0 x-rat x-rat)) (+ 1.0 (* x-rat x-rat))) - (let ((y-thing (/ (+ 1.0 (* 4.0 y-rat y-rat)) (+ 1.0 (* y-rat y-rat))))) + (/ (+ 1.0 (* 4.0 x-rat x-rat)) (+ 1.0 (square x-rat))) + (let ((y-thing (/ (+ 1.0 (* 4.0 y-rat y-rat)) (+ 1.0 (square y-rat))))) (set! (-> cull-info x-fact) (/ (+ 1.0 (* 4.0 x-rat x-rat)) (* x-rat (sqrtf (+ 1.0 (* 16.0 x-rat x-rat)))))) (set! (-> cull-info y-fact) (/ (+ 1.0 (* 4.0 y-rat y-rat)) (* y-rat (sqrtf (+ 1.0 (* 16.0 y-rat y-rat)))))) (set! (-> cull-info z-fact) (sqrtf (+ (* (+ -4.0 y-thing) (+ -4.0 y-thing) y-rat y-rat) (* (+ -1.0 y-thing) (+ -1.0 y-thing)))) ) ) - (let* ((near-x (* x-rat (-> math-cam d))) - (near-y (* y-rat (-> math-cam d))) - (near-corner-dist-sqr (+ (* near-x near-x) (* near-y near-y))) - (near-z (-> math-cam d)) - ) - (set! (-> cull-info cam-radius) (sqrtf (+ near-corner-dist-sqr (* near-z near-z)))) + (let ((near-x (* x-rat (-> math-cam d))) + (near-y (* y-rat (-> math-cam d))) + ) + (set! (-> cull-info cam-radius) (sqrtf (+ (square near-x) (square near-y) (square (-> math-cam d))))) ) (let* ((dx-rat-2 (* (-> math-cam d) (-> math-cam x-ratio))) (d-temp-2 (-> math-cam d)) (dx-rat-times-4 (* 4.0 dx-rat-2)) (d-temp-3 (-> math-cam d)) ) - (let ((inverse-x-len (/ 1.0 (sqrtf (+ (* dx-rat-2 dx-rat-2) (* d-temp-2 d-temp-2))))) - (inverse-x-len-2 (/ 1.0 (sqrtf (+ (* dx-rat-times-4 dx-rat-times-4) (* d-temp-3 d-temp-3))))) + (let ((inverse-x-len (/ 1.0 (sqrtf (+ (square dx-rat-2) (square d-temp-2))))) + (inverse-x-len-2 (/ 1.0 (sqrtf (+ (square dx-rat-times-4) (square d-temp-3))))) ) (set! (-> cull-info xz-dir-ax) (* dx-rat-2 inverse-x-len)) (set! (-> cull-info xz-dir-az) (* d-temp-2 inverse-x-len)) @@ -74,8 +72,8 @@ (dy-rat-times-4 (* 4.0 dy-rat)) (d-temp-5 (-> math-cam d)) ) - (let ((inverse-y-len (/ 1.0 (sqrtf (+ (* dy-rat dy-rat) (* d-temp-4 d-temp-4))))) - (inverse-y-len-2 (/ 1.0 (sqrtf (+ (* dy-rat-times-4 dy-rat-times-4) (* d-temp-5 d-temp-5))))) + (let ((inverse-y-len (/ 1.0 (sqrtf (+ (square dy-rat) (square d-temp-4))))) + (inverse-y-len-2 (/ 1.0 (sqrtf (+ (square dy-rat-times-4) (square d-temp-5))))) ) (set! (-> cull-info yz-dir-ay) (* dy-rat inverse-y-len)) (set! (-> cull-info yz-dir-az) (* d-temp-4 inverse-y-len)) diff --git a/test/decompiler/reference/jak1/engine/gfx/mood/mood-tables_REF.gc b/test/decompiler/reference/jak1/engine/gfx/mood/mood-tables_REF.gc index 7738fd4545..b8af250797 100644 --- a/test/decompiler/reference/jak1/engine/gfx/mood/mood-tables_REF.gc +++ b/test/decompiler/reference/jak1/engine/gfx/mood/mood-tables_REF.gc @@ -257,12 +257,7 @@ (set! (-> v1-0 y) (- (-> arg0 direction y))) (set! (-> v1-0 z) (- (-> arg0 direction z))) (when (< (-> arg0 direction y) 0.9063) - (let* ((f0-7 0.4226) - (f1-1 (-> v1-0 x)) - (f1-3 (* f1-1 f1-1)) - (f2-0 (-> v1-0 z)) - (f0-8 (/ f0-7 (sqrtf (+ f1-3 (* f2-0 f2-0))))) - ) + (let ((f0-8 (/ 0.4226 (sqrtf (+ (square (-> v1-0 x)) (square (-> v1-0 z))))))) (set! (-> v1-0 x) (* (-> v1-0 x) f0-8)) (set! (-> v1-0 y) -0.9063) (set! (-> v1-0 z) (* (-> v1-0 z) f0-8)) diff --git a/test/decompiler/reference/jak1/engine/gfx/mood/mood_REF.gc b/test/decompiler/reference/jak1/engine/gfx/mood/mood_REF.gc index d18ed04f42..100a0dc4e0 100644 --- a/test/decompiler/reference/jak1/engine/gfx/mood/mood_REF.gc +++ b/test/decompiler/reference/jak1/engine/gfx/mood/mood_REF.gc @@ -358,7 +358,6 @@ ;; INFO: Used lq/sq ;; INFO: Return type mismatch object vs none. (defun update-mood-interp ((arg0 mood-context) (arg1 mood-context) (arg2 mood-context) (arg3 float)) - (local-vars (sv-16 light)) (cond ((= arg3 0.0) (set! (-> arg0 current-fog fog-color quad) (-> arg1 current-fog fog-color quad)) @@ -423,8 +422,9 @@ ) (dotimes (s2-0 3) (let ((s1-0 (-> arg0 light-group 0 lights s2-0))) - (let ((s0-0 (-> arg1 light-group 0 lights s2-0))) - (set! sv-16 (-> arg2 light-group 0 lights s2-0)) + (let ((s0-0 (-> arg1 light-group 0 lights s2-0)) + (sv-16 (-> arg2 light-group 0 lights s2-0)) + ) (vector4-lerp! (-> s1-0 direction) (-> s0-0 direction) (-> sv-16 direction) arg3) (vector4-lerp! (-> s1-0 color) (-> s0-0 color) (-> sv-16 color) arg3) (vector4-lerp! (-> s1-0 levels) (-> s0-0 levels) (-> sv-16 levels) arg3) @@ -1586,7 +1586,6 @@ ;; INFO: Used lq/sq ;; INFO: Return type mismatch int vs none. (defun update-mood-sunken ((arg0 mood-context) (arg1 float) (arg2 int)) - (local-vars (sv-80 vector)) (when (not (paused?)) (update-mood-fog arg0 arg1) (update-mood-sky-texture arg0 arg1) @@ -1635,33 +1634,26 @@ (let ((s2-1 (new 'static 'vector :x 0.193 :y 0.432 :z 0.721)) (s1-1 (new 'static 'vector :x 0.193 :y 0.338 :z 0.603)) (s0-0 (new 'static 'vector :x 0.193 :y 0.336 :z 0.721)) + (sv-80 (new 'static 'vector :x 0.215 :y 0.309 :z 0.674)) + (s3-2 (new 'stack-no-clear 'vector)) + (s4-3 (new 'stack-no-clear 'vector)) + (f26-3 (+ 0.75 + (* 0.0625 (cos (the float (* 4000 (-> *display* integral-frame-counter))))) + (* 0.0625 (cos (the float (shl (-> *display* integral-frame-counter) 11)))) + (* 0.125 (cos (the float (* 1500 (-> *display* integral-frame-counter))))) + ) + ) ) - (set! sv-80 (new 'static 'vector :x 0.215 :y 0.309 :z 0.674)) - (let ((s3-2 (new 'stack-no-clear 'vector)) - (s4-3 (new 'stack-no-clear 'vector)) - (f26-3 (+ 0.75 - (* 0.0625 (cos (the float (* 4000 (-> *display* integral-frame-counter))))) - (* 0.0625 (cos (the float (shl (-> *display* integral-frame-counter) 11)))) - (* 0.125 (cos (the float (* 1500 (-> *display* integral-frame-counter))))) - ) - ) - ) - (vector4-lerp! s3-2 s2-1 s1-1 f28-0) - (let ((t9-16 vector4-lerp!) - (a0-19 s4-3) - (a3-7 f28-0) - ) - (t9-16 a0-19 s0-0 sv-80 a3-7) - ) - (let ((v1-18 (-> s5-1 0 dir2))) - (set! (-> v1-18 direction x) 0.0) - (set! (-> v1-18 direction y) 0.999) - (set! (-> v1-18 direction z) 0.011) - (set! (-> v1-18 direction w) 1.0) - ) - (vector4-lerp! (-> s5-1 0 dir2 color) s4-3 s3-2 f30-0) - (set! (-> s5-1 0 dir2 levels x) f26-3) + (vector4-lerp! s3-2 s2-1 s1-1 f28-0) + (vector4-lerp! s4-3 s0-0 sv-80 f28-0) + (let ((v1-18 (-> s5-1 0 dir2))) + (set! (-> v1-18 direction x) 0.0) + (set! (-> v1-18 direction y) 0.999) + (set! (-> v1-18 direction z) 0.011) + (set! (-> v1-18 direction w) 1.0) ) + (vector4-lerp! (-> s5-1 0 dir2 color) s4-3 s3-2 f30-0) + (set! (-> s5-1 0 dir2 levels x) f26-3) ) ) ) @@ -2002,12 +1994,7 @@ (set! (-> v1-21 y) (- (-> s4-0 y))) (set! (-> v1-21 z) (- (-> s4-0 z))) (when (< (-> s4-0 y) 0.9063) - (let* ((f0-22 0.4226) - (f1-3 (-> v1-21 x)) - (f1-5 (* f1-3 f1-3)) - (f2-2 (-> v1-21 z)) - (f0-23 (/ f0-22 (sqrtf (+ f1-5 (* f2-2 f2-2))))) - ) + (let ((f0-23 (/ 0.4226 (sqrtf (+ (square (-> v1-21 x)) (square (-> v1-21 z))))))) (set! (-> v1-21 x) (* (-> v1-21 x) f0-23)) (set! (-> v1-21 y) -0.9063) (set! (-> v1-21 z) (* (-> v1-21 z) f0-23)) @@ -2664,12 +2651,7 @@ (set! (-> v1-45 y) (- (-> a0-22 direction y))) (set! (-> v1-45 z) (- (-> a0-22 direction z))) (when (< (-> a0-22 direction y) 0.9063) - (let* ((f0-23 0.4226) - (f1-25 (-> v1-45 x)) - (f1-27 (* f1-25 f1-25)) - (f2-4 (-> v1-45 z)) - (f0-24 (/ f0-23 (sqrtf (+ f1-27 (* f2-4 f2-4))))) - ) + (let ((f0-24 (/ 0.4226 (sqrtf (+ (square (-> v1-45 x)) (square (-> v1-45 z))))))) (set! (-> v1-45 x) (* (-> v1-45 x) f0-24)) (set! (-> v1-45 y) -0.9063) (set! (-> v1-45 z) (* (-> v1-45 z) f0-24)) diff --git a/test/decompiler/reference/jak1/engine/gfx/mood/time-of-day_REF.gc b/test/decompiler/reference/jak1/engine/gfx/mood/time-of-day_REF.gc index 4f0426c74f..1c1452b528 100644 --- a/test/decompiler/reference/jak1/engine/gfx/mood/time-of-day_REF.gc +++ b/test/decompiler/reference/jak1/engine/gfx/mood/time-of-day_REF.gc @@ -539,12 +539,7 @@ (set! (-> a2-30 y) (- (-> s5-2 dir0 direction y))) (set! (-> a2-30 z) (- (-> s5-2 dir0 direction z))) (when (< (-> s5-2 dir0 direction y) 0.9063) - (let* ((f0-56 0.4226) - (f1-17 (-> a2-30 x)) - (f1-19 (* f1-17 f1-17)) - (f2-7 (-> a2-30 z)) - (f0-57 (/ f0-56 (sqrtf (+ f1-19 (* f2-7 f2-7))))) - ) + (let ((f0-57 (/ 0.4226 (sqrtf (+ (square (-> a2-30 x)) (square (-> a2-30 z))))))) (set! (-> a2-30 x) (* (-> a2-30 x) f0-57)) (set! (-> a2-30 y) -0.9063) (set! (-> a2-30 z) (* (-> a2-30 z) f0-57)) diff --git a/test/decompiler/reference/jak1/engine/gfx/ocean/ocean-mid_REF.gc b/test/decompiler/reference/jak1/engine/gfx/ocean/ocean-mid_REF.gc index ec621a18ba..e672a68c7c 100644 --- a/test/decompiler/reference/jak1/engine/gfx/ocean/ocean-mid_REF.gc +++ b/test/decompiler/reference/jak1/engine/gfx/ocean/ocean-mid_REF.gc @@ -977,42 +977,43 @@ ;; definition for function draw-ocean-mid-seams ;; INFO: Return type mismatch symbol vs none. (defun draw-ocean-mid-seams ((arg0 dma-buffer)) - (local-vars (sv-32 uint) (sv-33 uint) (sv-34 uint) (sv-35 uint) (sv-36 sphere)) (ocean-seams-add-constants arg0) - (set! sv-32 (-> *ocean-work* mid-minx)) - (set! sv-33 (-> *ocean-work* mid-maxx)) - (set! sv-34 (-> *ocean-work* mid-minz)) - (set! sv-35 (-> *ocean-work* mid-maxz)) - (set! sv-36 (new 'stack 'sphere)) - (set! (-> sv-36 y) (-> *ocean-map* start-corner y)) - (set! (-> sv-36 w) 278045.7) - (let ((s5-0 sv-34) - (s4-0 sv-35) + (let ((sv-32 (-> *ocean-work* mid-minx)) + (sv-33 (-> *ocean-work* mid-maxx)) + (sv-34 (-> *ocean-work* mid-minz)) + (sv-35 (-> *ocean-work* mid-maxz)) + (sv-36 (new 'stack 'sphere)) ) - (while (>= s4-0 s5-0) - (let ((s3-0 sv-32) - (s2-0 sv-33) - ) - (while (>= s2-0 s3-0) - (set! (-> sv-36 x) (+ 196608.0 (* 393216.0 (the float s3-0)) (-> *ocean-map* start-corner x))) - (set! (-> sv-36 z) (+ 196608.0 (* 393216.0 (the float s5-0)) (-> *ocean-map* start-corner z))) - (when (sphere-cull sv-36) - (cond - ((= s5-0 sv-34) - (ocean-mid-add-upload-top arg0 s5-0 s3-0) - ) - ((= s5-0 sv-35) - (ocean-mid-add-upload-bottom arg0 s5-0 s3-0) - ) - (else - (ocean-mid-add-upload-middle arg0 s5-0 s3-0) + (set! (-> sv-36 y) (-> *ocean-map* start-corner y)) + (set! (-> sv-36 w) 278045.7) + (let ((s5-0 sv-34) + (s4-0 sv-35) + ) + (while (>= s4-0 s5-0) + (let ((s3-0 sv-32) + (s2-0 sv-33) + ) + (while (>= s2-0 s3-0) + (set! (-> sv-36 x) (+ 196608.0 (* 393216.0 (the float s3-0)) (-> *ocean-map* start-corner x))) + (set! (-> sv-36 z) (+ 196608.0 (* 393216.0 (the float s5-0)) (-> *ocean-map* start-corner z))) + (when (sphere-cull sv-36) + (cond + ((= s5-0 sv-34) + (ocean-mid-add-upload-top arg0 s5-0 s3-0) + ) + ((= s5-0 sv-35) + (ocean-mid-add-upload-bottom arg0 s5-0 s3-0) + ) + (else + (ocean-mid-add-upload-middle arg0 s5-0 s3-0) + ) ) ) + (+! s3-0 1) ) - (+! s3-0 1) ) + (+! s5-0 1) ) - (+! s5-0 1) ) ) (dotimes (v1-26 36) diff --git a/test/decompiler/reference/jak1/engine/gfx/ocean/ocean-texture_REF.gc b/test/decompiler/reference/jak1/engine/gfx/ocean/ocean-texture_REF.gc index da15e9040d..56003de1d0 100644 --- a/test/decompiler/reference/jak1/engine/gfx/ocean/ocean-texture_REF.gc +++ b/test/decompiler/reference/jak1/engine/gfx/ocean/ocean-texture_REF.gc @@ -215,9 +215,8 @@ ;; INFO: Used lq/sq ;; INFO: Return type mismatch int vs none. (defun draw-ocean-texture ((arg0 dma-buffer) (arg1 (inline-array vector)) (arg2 symbol)) - (local-vars (sv-16 (inline-array vector)) (sv-32 int) (sv-48 vector) (sv-64 (inline-array vector))) - (set! sv-64 arg1) - (let* ((s0-0 arg2) + (let* ((sv-64 arg1) + (s0-0 arg2) (a1-1 *ocean-base-page*) (s2-0 *ocean-base-block*) (s1-0 (+ a1-1 8)) @@ -237,18 +236,21 @@ ) (ocean-texture-add-constants arg0) (ocean-texture-add-envmap arg0) - (set! sv-16 sv-64) - (ocean-texture-add-verts arg0 sv-16) - (set! sv-48 (-> sv-16 192)) - (ocean-texture-add-call-start arg0) - (set! sv-32 0) - (while (< sv-32 9) - (ocean-texture-add-verts arg0 (the-as (inline-array vector) sv-48)) - (set! sv-48 (-> (the-as (inline-array vector) sv-48) 192)) - (ocean-texture-add-call-rest arg0) - (set! sv-32 (+ sv-32 1)) + (let ((sv-16 sv-64)) + (ocean-texture-add-verts arg0 sv-16) + (let ((sv-48 (-> sv-16 192))) + (ocean-texture-add-call-start arg0) + (let ((sv-32 0)) + (while (< sv-32 9) + (ocean-texture-add-verts arg0 (the-as (inline-array vector) sv-48)) + (set! sv-48 (-> (the-as (inline-array vector) sv-48) 192)) + (ocean-texture-add-call-rest arg0) + (+! sv-32 1) + ) + ) + (ocean-texture-add-verts-last arg0 (the-as (inline-array vector) sv-48) sv-64) + ) ) - (ocean-texture-add-verts-last arg0 (the-as (inline-array vector) sv-48) sv-64) (ocean-texture-add-call-rest arg0) (ocean-texture-add-call-done arg0) (when s0-0 diff --git a/test/decompiler/reference/jak1/engine/gfx/ocean/ocean-transition_REF.gc b/test/decompiler/reference/jak1/engine/gfx/ocean/ocean-transition_REF.gc index 0912bf92b1..1f324d3585 100644 --- a/test/decompiler/reference/jak1/engine/gfx/ocean/ocean-transition_REF.gc +++ b/test/decompiler/reference/jak1/engine/gfx/ocean/ocean-transition_REF.gc @@ -492,21 +492,22 @@ ;; definition for function ocean-make-trans-camera-masks ;; INFO: Used lq/sq (defun ocean-make-trans-camera-masks ((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 (-> *ocean-work* 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) (+ (-> *ocean-map* start-corner x) (* 393216.0 (the float arg1)))) - (set! (-> sv-56 y) (-> *ocean-map* start-corner y)) - (set! (-> sv-56 z) (+ (-> *ocean-map* start-corner z) (* 393216.0 (the float arg0)))) - (set! (-> sv-56 w) 1.0) - (dotimes (gp-0 4) - (dotimes (s5-0 4) - (set! (-> sv-60 x) (- (+ (-> sv-56 x) (* 98304.0 (the float s5-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 gp-0))) (-> sv-52 z))) - (ocean-transition-check sv-48 s5-0 gp-0 sv-56) + (let ((sv-48 (-> *ocean-work* 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) (+ (-> *ocean-map* start-corner x) (* 393216.0 (the float arg1)))) + (set! (-> sv-56 y) (-> *ocean-map* start-corner y)) + (set! (-> sv-56 z) (+ (-> *ocean-map* start-corner z) (* 393216.0 (the float arg0)))) + (set! (-> sv-56 w) 1.0) + (dotimes (gp-0 4) + (dotimes (s5-0 4) + (set! (-> sv-60 x) (- (+ (-> sv-56 x) (* 98304.0 (the float s5-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 gp-0))) (-> sv-52 z))) + (ocean-transition-check sv-48 s5-0 gp-0 sv-56) + ) ) ) #f @@ -638,34 +639,35 @@ ;; definition for function draw-ocean-transition-seams (defun draw-ocean-transition-seams ((arg0 dma-buffer)) - (local-vars (sv-32 uint) (sv-33 uint) (sv-34 uint) (sv-35 uint) (sv-36 sphere)) - (set! sv-32 (-> *ocean-work* near-minx)) - (set! sv-33 (-> *ocean-work* near-maxx)) - (set! sv-34 (-> *ocean-work* near-minz)) - (set! sv-35 (-> *ocean-work* near-maxz)) - (set! sv-36 (new 'stack 'sphere)) - (set! (-> sv-36 y) (-> *ocean-map* start-corner y)) - (set! (-> sv-36 w) 69511.42) - (when (and (< sv-32 sv-33) (< sv-34 sv-35)) - (let ((s5-0 sv-34) - (s4-0 sv-35) - ) - (while (>= s4-0 s5-0) - (let ((s3-0 sv-32) - (s2-0 sv-33) - ) - (while (>= s2-0 s3-0) - (set! (-> sv-36 x) (+ 49152.0 (* 98304.0 (the float s3-0)) (-> *ocean-map* start-corner x))) - (set! (-> sv-36 z) (+ 49152.0 (* 98304.0 (the float s5-0)) (-> *ocean-map* start-corner z))) - (when (sphere-cull sv-36) - (if (not (ocean-trans-camera-masks-bit? s5-0 s3-0)) - (ocean-trans-add-upload arg0 (the-as int s5-0) (the-as int s3-0)) - ) - ) - (+! s3-0 1) + (let ((sv-32 (-> *ocean-work* near-minx)) + (sv-33 (-> *ocean-work* near-maxx)) + (sv-34 (-> *ocean-work* near-minz)) + (sv-35 (-> *ocean-work* near-maxz)) + (sv-36 (new 'stack 'sphere)) + ) + (set! (-> sv-36 y) (-> *ocean-map* start-corner y)) + (set! (-> sv-36 w) 69511.42) + (when (and (< sv-32 sv-33) (< sv-34 sv-35)) + (let ((s5-0 sv-34) + (s4-0 sv-35) ) + (while (>= s4-0 s5-0) + (let ((s3-0 sv-32) + (s2-0 sv-33) + ) + (while (>= s2-0 s3-0) + (set! (-> sv-36 x) (+ 49152.0 (* 98304.0 (the float s3-0)) (-> *ocean-map* start-corner x))) + (set! (-> sv-36 z) (+ 49152.0 (* 98304.0 (the float s5-0)) (-> *ocean-map* start-corner z))) + (when (sphere-cull sv-36) + (if (not (ocean-trans-camera-masks-bit? s5-0 s3-0)) + (ocean-trans-add-upload arg0 (the-as int s5-0) (the-as int s3-0)) + ) + ) + (+! s3-0 1) + ) + ) + (+! s5-0 1) ) - (+! s5-0 1) ) ) ) @@ -711,15 +713,6 @@ ;; definition for function draw-ocean-transition ;; INFO: Return type mismatch int vs none. (defun draw-ocean-transition ((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) - ) (dotimes (v1-0 16) (set! (-> *ocean-work* trans-camera-masks v1-0 word) (the-as uint 0)) (set! (-> *ocean-work* near-mask-indices v1-0) (the-as uint -1)) @@ -727,123 +720,128 @@ (dotimes (v1-3 64) (set! (-> *ocean-work* trans-mask-ptrs v1-3) (the-as (pointer int32) #f)) ) - (set! sv-32 (-> *ocean-work* mid-minx)) - (set! sv-33 (-> *ocean-work* mid-maxx)) - (set! sv-34 (-> *ocean-work* mid-minz)) - (set! sv-35 (-> *ocean-work* mid-maxz)) - (set! sv-36 (new 'stack 'sphere)) - (set! (-> sv-36 y) (-> *ocean-map* start-corner y)) - (set! (-> sv-36 w) 278045.7) - (let ((s5-0 sv-34) - (s4-0 sv-35) + (let ((sv-32 (-> *ocean-work* mid-minx)) + (sv-33 (-> *ocean-work* mid-maxx)) + (sv-34 (-> *ocean-work* mid-minz)) + (sv-35 (-> *ocean-work* mid-maxz)) ) - (while (>= s4-0 s5-0) - (let ((s3-0 sv-32) - (s2-0 sv-33) + (let ((sv-36 (new 'stack 'sphere))) + (set! (-> sv-36 y) (-> *ocean-map* start-corner y)) + (set! (-> sv-36 w) 278045.7) + (let ((s5-0 sv-34) + (s4-0 sv-35) ) - (while (>= s2-0 s3-0) - (when (not (ocean-mid-mask-ptrs-bit? s5-0 s3-0)) - (when (ocean-mid-camera-masks-bit? s5-0 s3-0) - (set! (-> sv-36 x) (+ 196608.0 (* 393216.0 (the float s3-0)) (-> *ocean-map* start-corner x))) - (set! (-> sv-36 z) (+ 196608.0 (* 393216.0 (the float s5-0)) (-> *ocean-map* start-corner z))) - (if (sphere-cull sv-36) - (ocean-make-trans-camera-masks s5-0 s3-0 (- s5-0 sv-34) (- s3-0 sv-32)) - ) - ) - ) - (+! s3-0 1) - ) - ) - (+! s5-0 1) - ) - ) - (let ((a2-2 192) - (a1-8 0) - (a0-11 192) - (v1-32 0) - ) - (let ((a3-1 sv-34) - (t0-0 sv-35) - ) - (while (>= t0-0 a3-1) - (let ((t1-0 sv-32) - (t2-0 sv-33) - ) - (while (>= t2-0 t1-0) - (set! sv-40 (-> *ocean-work* trans-camera-masks (+ (* (- a3-1 sv-34) 4) (- t1-0 sv-32)))) - (when (nonzero? (-> sv-40 word)) - (dotimes (t3-10 4) - (let ((t4-5 (-> sv-40 mask t3-10))) - (when (nonzero? t4-5) - (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-32) t5-2) - (set! v1-32 (the-as int t5-2)) - ) + (while (>= s4-0 s5-0) + (let ((s3-0 sv-32) + (s2-0 sv-33) + ) + (while (>= s2-0 s3-0) + (when (not (ocean-mid-mask-ptrs-bit? s5-0 s3-0)) + (when (ocean-mid-camera-masks-bit? s5-0 s3-0) + (set! (-> sv-36 x) (+ 196608.0 (* 393216.0 (the float s3-0)) (-> *ocean-map* start-corner x))) + (set! (-> sv-36 z) (+ 196608.0 (* 393216.0 (the float s5-0)) (-> *ocean-map* start-corner z))) + (if (sphere-cull sv-36) + (ocean-make-trans-camera-masks s5-0 s3-0 (- s5-0 sv-34) (- s3-0 sv-32)) ) - (dotimes (t5-3 4) - (when (logtest? t4-5 (ash 1 t5-3)) - (let ((t6-9 (+ (* t1-0 4) t5-3))) - (if (< t6-9 (the-as uint a2-2)) - (set! a2-2 (the-as int t6-9)) - ) - (if (< (the-as uint a1-8) t6-9) - (set! a1-8 (the-as int t6-9)) - ) - ) - ) - ) - ) ) ) + (+! s3-0 1) ) - (+! t1-0 1) ) + (+! s5-0 1) ) - (+! a3-1 1) ) ) - (set! (-> *ocean-work* near-minx) (the-as uint (+ a2-2 -1))) - (set! (-> *ocean-work* near-maxx) (the-as uint (+ a1-8 1))) - (set! (-> *ocean-work* near-minz) (the-as uint (+ a0-11 -1))) - (set! (-> *ocean-work* near-maxz) (the-as uint (+ v1-32 1))) - ) - (dotimes (v1-34 16) - (set! (-> *ocean-work* trans-temp-masks v1-34 word) (-> *ocean-work* trans-camera-masks v1-34 word)) - ) - (let ((s5-1 sv-34) - (s4-1 sv-35) - ) - (while (>= s4-1 s5-1) - (let ((s3-1 sv-32) - (s2-1 sv-33) + (let ((a2-2 192) + (a1-8 0) + (a0-11 192) + (v1-32 0) + ) + (let ((a3-1 sv-34) + (t0-0 sv-35) ) - (while (>= s2-1 s3-1) - (when (not (ocean-mid-mask-ptrs-bit? s5-1 s3-1)) - (when (ocean-mid-camera-masks-bit? s5-1 s3-1) - (let ((v1-43 (-> *ocean-map* ocean-trans-indices data (+ (* (the-as uint 48) s5-1) s3-1)))) - (when (>= (-> v1-43 parent) 0) - (set! sv-44 (+ (* (- s5-1 sv-34) 4) (- s3-1 sv-32))) - (set! (-> *ocean-work* near-mask-indices sv-44) (the-as uint (-> v1-43 child))) - (let ((s1-0 (-> *ocean-map* ocean-mid-masks data (-> v1-43 parent)))) - (dotimes (s0-0 4) - (let ((a3-5 (-> (the-as ocean-mid-mask (+ s0-0 (the-as int s1-0))) mask 0))) - (if (!= a3-5 255) - (ocean-trans-add-upload-strip arg0 s5-1 s3-1 a3-5 sv-44 (the-as uint s0-0)) + (while (>= t0-0 a3-1) + (let ((t1-0 sv-32) + (t2-0 sv-33) + ) + (while (>= t2-0 t1-0) + (let ((sv-40 (-> *ocean-work* trans-camera-masks (+ (* (- a3-1 sv-34) 4) (- t1-0 sv-32))))) + (when (nonzero? (-> sv-40 word)) + (dotimes (t3-10 4) + (let ((t4-5 (-> sv-40 mask t3-10))) + (when (nonzero? t4-5) + (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-32) t5-2) + (set! v1-32 (the-as int t5-2)) + ) + ) + (dotimes (t5-3 4) + (when (logtest? t4-5 (ash 1 t5-3)) + (let ((t6-9 (+ (* t1-0 4) t5-3))) + (if (< t6-9 (the-as uint a2-2)) + (set! a2-2 (the-as int t6-9)) + ) + (if (< (the-as uint a1-8) t6-9) + (set! a1-8 (the-as int t6-9)) + ) + ) ) + ) + ) + ) + ) + ) + ) + (+! t1-0 1) + ) + ) + (+! a3-1 1) + ) + ) + (set! (-> *ocean-work* near-minx) (the-as uint (+ a2-2 -1))) + (set! (-> *ocean-work* near-maxx) (the-as uint (+ a1-8 1))) + (set! (-> *ocean-work* near-minz) (the-as uint (+ a0-11 -1))) + (set! (-> *ocean-work* near-maxz) (the-as uint (+ v1-32 1))) + ) + (dotimes (v1-34 16) + (set! (-> *ocean-work* trans-temp-masks v1-34 word) (-> *ocean-work* trans-camera-masks v1-34 word)) + ) + (let ((s5-1 sv-34) + (s4-1 sv-35) + ) + (while (>= s4-1 s5-1) + (let ((s3-1 sv-32) + (s2-1 sv-33) + ) + (while (>= s2-1 s3-1) + (when (not (ocean-mid-mask-ptrs-bit? s5-1 s3-1)) + (when (ocean-mid-camera-masks-bit? s5-1 s3-1) + (let ((v1-43 (-> *ocean-map* ocean-trans-indices data (+ (* (the-as uint 48) s5-1) s3-1)))) + (when (>= (-> v1-43 parent) 0) + (let ((sv-44 (+ (* (- s5-1 sv-34) 4) (- s3-1 sv-32)))) + (set! (-> *ocean-work* near-mask-indices sv-44) (the-as uint (-> v1-43 child))) + (let ((s1-0 (-> *ocean-map* ocean-mid-masks data (-> v1-43 parent)))) + (dotimes (s0-0 4) + (let ((a3-5 (-> (the-as ocean-mid-mask (+ s0-0 (the-as int s1-0))) mask 0))) + (if (!= a3-5 255) + (ocean-trans-add-upload-strip arg0 s5-1 s3-1 a3-5 sv-44 (the-as uint s0-0)) + ) + ) + ) ) ) ) ) ) ) + (+! s3-1 1) ) - (+! s3-1 1) ) + (+! s5-1 1) ) - (+! s5-1 1) ) ) (ocean-mid-add-call-flush arg0 (the-as uint 41)) diff --git a/test/decompiler/reference/jak1/engine/gfx/shadow/shadow_REF.gc b/test/decompiler/reference/jak1/engine/gfx/shadow/shadow_REF.gc index 89538dd713..309557159f 100644 --- a/test/decompiler/reference/jak1/engine/gfx/shadow/shadow_REF.gc +++ b/test/decompiler/reference/jak1/engine/gfx/shadow/shadow_REF.gc @@ -52,27 +52,20 @@ ;; INFO: Used lq/sq ;; INFO: Return type mismatch int vs none. (defun compute-and-draw-shadow ((arg0 vector) (arg1 vector) (arg2 vector) (arg3 vector) (arg4 float) (arg5 float)) - (local-vars - (v1-10 float) - (v1-11 float) - (sv-96 vector) - (sv-112 (function quaternion vector float quaternion)) - (sv-128 vector) - (sv-144 vector) - ) + (local-vars (v1-10 float) (v1-11 float)) (rlet ((vf0 :class vf) (vf1 :class vf) (vf2 :class vf) ) (init-vf0-vector) - (set! sv-96 arg2) - (let ((s4-0 arg3) + (let ((sv-96 arg2) + (s4-0 arg3) (s3-0 arg4) (s2-0 arg5) ) (when (< (- (-> arg0 y) (-> arg1 y)) s3-0) - (set! sv-144 (new 'stack-no-clear 'vector)) - (let ((s0-0 (new 'stack-no-clear 'vector)) + (let ((sv-144 (new 'stack-no-clear 'vector)) + (s0-0 (new 'stack-no-clear 'vector)) (s1-0 (new 'stack-no-clear 'sparticle-cpuinfo)) ) (+! (-> arg1 y) 40.96) @@ -80,11 +73,7 @@ (set! (-> sv-144 y) 0.0) (set! (-> sv-144 z) (- (-> sv-96 x))) (vector-normalize! sv-144 1.0) - (set! sv-112 quaternion-vector-angle!) - (set! sv-128 s0-0) - (let ((a2-1 (acos (-> sv-96 y)))) - (sv-112 (the-as quaternion sv-128) sv-144 a2-1) - ) + (quaternion-vector-angle! (the-as quaternion s0-0) sv-144 (acos (-> sv-96 y))) (let ((v1-9 s1-0)) (cond ((< (-> s0-0 w) 0.0) diff --git a/test/decompiler/reference/jak1/engine/gfx/sprite/sparticle/sparticle-launcher_REF.gc b/test/decompiler/reference/jak1/engine/gfx/sprite/sparticle/sparticle-launcher_REF.gc index ff3fda8d7f..0b2dea425a 100644 --- a/test/decompiler/reference/jak1/engine/gfx/sprite/sparticle/sparticle-launcher_REF.gc +++ b/test/decompiler/reference/jak1/engine/gfx/sprite/sparticle/sparticle-launcher_REF.gc @@ -559,7 +559,7 @@ (set! (-> v1-0 x) f0-0) (set! (-> v1-0 y) f1-0) (set! (-> v1-0 z) f3-0) - (set! (-> v1-0 w) (sqrtf (- (- (- 1.0 (* f3-0 f3-0)) (* f1-0 f1-0)) (* f0-0 f0-0)))) + (set! (-> v1-0 w) (sqrtf (- (- (- 1.0 (square f3-0)) (square f1-0)) (square f0-0)))) ) (quaternion->matrix s5-0 a1-1) ) @@ -814,7 +814,7 @@ (set! (-> v1-0 x) f0-0) (set! (-> v1-0 y) f1-0) (set! (-> v1-0 z) f3-0) - (set! (-> v1-0 w) (sqrtf (- (- (- 1.0 (* f3-0 f3-0)) (* f1-0 f1-0)) (* f0-0 f0-0)))) + (set! (-> v1-0 w) (sqrtf (- (- (- 1.0 (square f3-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) @@ -1181,7 +1181,7 @@ (set! (-> s4-0 x) f0-0) (set! (-> s4-0 y) f1-0) (set! (-> s4-0 z) f3-0) - (set! (-> s4-0 w) (sqrtf (- (- (- 1.0 (* f3-0 f3-0)) (* f1-0 f1-0)) (* f0-0 f0-0)))) + (set! (-> s4-0 w) (sqrtf (- (- (- 1.0 (square f3-0)) (square f1-0)) (square f0-0)))) ) (quaternion-rotate-y! (the-as quaternion s4-0) (the-as quaternion s4-0) (-> s5-0 sprite rot)) (let ((v1-3 arg2)) @@ -1240,7 +1240,7 @@ (set! (-> s4-0 x) f0-0) (set! (-> s4-0 y) f1-0) (set! (-> s4-0 z) f3-0) - (set! (-> s4-0 w) (sqrtf (- (- (- 1.0 (* f3-0 f3-0)) (* f1-0 f1-0)) (* f0-0 f0-0)))) + (set! (-> s4-0 w) (sqrtf (- (- (- 1.0 (square f3-0)) (square f1-0)) (square f0-0)))) ) (let ((a1-1 (new-stack-vector0))) (set! (-> a1-1 y) (-> s5-0 sprite rot)) diff --git a/test/decompiler/reference/jak1/engine/gfx/sprite/sparticle/sparticle_REF.gc b/test/decompiler/reference/jak1/engine/gfx/sprite/sparticle/sparticle_REF.gc index 7f0314b9e8..1af5106da7 100644 --- a/test/decompiler/reference/jak1/engine/gfx/sprite/sparticle/sparticle_REF.gc +++ b/test/decompiler/reference/jak1/engine/gfx/sprite/sparticle/sparticle_REF.gc @@ -358,59 +358,27 @@ ;; INFO: Used lq/sq ;; INFO: 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 (function sparticle-system int int int int symbol none)) - (sv-64 sparticle-system) - (sv-80 int) - (sv-96 int) - (sv-112 int) - (sv-128 (function sparticle-system int int int int symbol none)) - (sv-144 sparticle-system) - (sv-160 int) - (sv-176 int) - (sv-192 int) - ) - (let ((s3-0 16) - (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 16) + (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-80 (+ #x70000000 s3-0)) - (set! sv-96 (+ #x70000000 s1-0)) - (cond - ((-> arg0 is-3d) - (set! sv-48 sp-process-block-3d) - (set! sv-64 arg0) - (set! sv-112 arg1) - (let ((t1-0 (paused?))) - (sv-48 sv-64 sv-80 sv-96 sv-112 arg3 t1-0) - ) - ) - (else - (set! sv-128 sp-process-block-2d) - (set! sv-144 arg0) - (set! sv-160 sv-80) - (set! sv-176 sv-96) - (set! sv-192 arg1) - (let ((t1-1 (paused?))) - (sv-128 sv-144 sv-160 sv-176 sv-192 arg3 t1-1) - ) - ) - ) - (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-80 (+ #x70000000 s3-0)) + (sv-96 (+ #x70000000 s1-0)) + ) + (if (-> arg0 is-3d) + (sp-process-block-3d arg0 sv-80 sv-96 arg1 arg3 (paused?)) + (sp-process-block-2d arg0 sv-80 sv-96 arg1 arg3 (paused?)) + ) + ) + (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) @@ -452,7 +420,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))) @@ -460,14 +427,15 @@ (dotimes (s0-0 s1-0) (cond ((!= (-> arg2 alloc-table s0-0) -1) - (set! sv-16 0) - (while (< sv-16 64) - (if (and (-> (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 (-> (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/jak1/engine/gfx/sprite/sprite-distort_REF.gc b/test/decompiler/reference/jak1/engine/gfx/sprite/sprite-distort_REF.gc index ca59e5843d..f31cacf4ee 100644 --- a/test/decompiler/reference/jak1/engine/gfx/sprite/sprite-distort_REF.gc +++ b/test/decompiler/reference/jak1/engine/gfx/sprite/sprite-distort_REF.gc @@ -169,15 +169,7 @@ ;; ERROR: Inline assembly instruction marked with TODO - [TODO.VCLIP] ;; ERROR: Unsupported inline assembly instruction kind - [cfc2.i v1, Clipping] (defun sprite-draw-distorters ((arg0 dma-buffer)) - (local-vars - (v1-14 float) - (v1-20 float) - (v1-25 int) - (v1-57 float) - (sv-16 sprite-vec-data-2d) - (sv-32 pointer) - (sv-48 pointer) - ) + (local-vars (v1-14 float) (v1-20 float) (v1-25 int) (v1-57 float)) (rlet ((acc :class vf) (Q :class vf) (vf0 :class vf) @@ -202,10 +194,11 @@ (s2-0 (-> s3-0 entry)) ) (dotimes (s1-0 s2-0) - (set! sv-16 (-> s3-0 data s1-0)) - (let ((a0-1 (the-as object (-> arg0 base)))) - (set! sv-32 (&+ (the-as pointer a0-1) 16)) - (set! sv-48 (&+ (the-as pointer a0-1) 32)) + (let* ((sv-16 (-> s3-0 data s1-0)) + (a0-1 (the-as object (-> arg0 base))) + (sv-32 (&+ (the-as pointer a0-1) 16)) + (sv-48 (&+ (the-as pointer a0-1) 32)) + ) (cond ((= (-> sv-16 matrix) 1) (.lvf vf3 (&-> *math-camera* sprite-2d vector 0 quad)) @@ -247,32 +240,32 @@ (set! (-> (the-as vector sv-32) y) (* 0.00390625 (+ -2048.0 (the float (-> *video-parms* screen-hy)) (-> (the-as vector a0-1) y))) ) - ) - (set! (-> (the-as vector sv-32) z) 1.0) - (when (or (< (-> sv-16 flag) 3) (< 11 (-> sv-16 flag))) - (format 0 "Turns = ~D!!!~%" (-> sv-16 flag)) - (set! (-> (the-as (pointer int32) sv-16) 4) 11) - ) - (set! (-> (the-as (pointer int32) sv-32) 3) (-> sv-16 flag)) - (let* ((f0-7 (- (-> *math-camera* perspective vector 1 y))) - (f2-4 (-> (the-as vector sv-32) y)) - (f4-0 (+ f2-4 (* (-> (the-as (pointer float) sv-48)) f0-7))) - (f3-0 256.0) - (f1-7 (-> (the-as (pointer float) sv-48))) - ) - (if (< (the float (-> *video-parms* screen-sy)) f4-0) - (set! f3-0 (/ (- (the float (-> *video-parms* screen-sy)) f2-4) f0-7)) + (set! (-> (the-as vector sv-32) z) 1.0) + (when (or (< (-> sv-16 flag) 3) (< 11 (-> sv-16 flag))) + (format 0 "Turns = ~D!!!~%" (-> sv-16 flag)) + (set! (-> (the-as (pointer int32) sv-16) 4) 11) + ) + (set! (-> (the-as (pointer int32) sv-32) 3) (-> sv-16 flag)) + (let* ((f0-7 (- (-> *math-camera* perspective vector 1 y))) + (f2-4 (-> (the-as vector sv-32) y)) + (f4-0 (+ f2-4 (* (-> (the-as (pointer float) sv-48)) f0-7))) + (f3-0 256.0) + (f1-7 (-> (the-as (pointer float) sv-48))) + ) + (if (< (the float (-> *video-parms* screen-sy)) f4-0) + (set! f3-0 (/ (- (the float (-> *video-parms* screen-sy)) f2-4) f0-7)) + ) + (if (< 128.0 f3-0) + (set! f3-0 128.0) + ) + (when (< f3-0 f1-7) + (let ((v1-55 (/ f3-0 f1-7))) + (.mov vf1 v1-55) + ) + (.mul.x.vf vf2 vf2 vf1) + (.svf (&-> (the-as vector sv-48) quad) vf2) + (.mov v1-57 vf2) ) - (if (< 128.0 f3-0) - (set! f3-0 128.0) - ) - (when (< f3-0 f1-7) - (let ((v1-55 (/ f3-0 f1-7))) - (.mov vf1 v1-55) - ) - (.mul.x.vf vf2 vf2 vf1) - (.svf (&-> (the-as vector sv-48) quad) vf2) - (.mov v1-57 vf2) ) ) (&+! (-> arg0 base) 48) diff --git a/test/decompiler/reference/jak1/engine/gfx/sprite/sprite_REF.gc b/test/decompiler/reference/jak1/engine/gfx/sprite/sprite_REF.gc index 90881381a6..4583682785 100644 --- a/test/decompiler/reference/jak1/engine/gfx/sprite/sprite_REF.gc +++ b/test/decompiler/reference/jak1/engine/gfx/sprite/sprite_REF.gc @@ -474,7 +474,7 @@ (set! (-> arg0 x) f0-0) (set! (-> arg0 y) f1-0) (set! (-> arg0 z) f3-0) - (set! (-> arg0 w) (sqrtf (- (- (- 1.0 (* f3-0 f3-0)) (* f1-0 f1-0)) (* f0-0 f0-0)))) + (set! (-> arg0 w) (sqrtf (- (- (- 1.0 (square f3-0)) (square f1-0)) (square f0-0)))) ) arg0 ) diff --git a/test/decompiler/reference/jak1/engine/gfx/texture/texture_REF.gc b/test/decompiler/reference/jak1/engine/gfx/texture/texture_REF.gc index 08bb01eb55..8e8416b5cf 100644 --- a/test/decompiler/reference/jak1/engine/gfx/texture/texture_REF.gc +++ b/test/decompiler/reference/jak1/engine/gfx/texture/texture_REF.gc @@ -830,81 +830,78 @@ ;; definition for function upload-vram-pages (defun upload-vram-pages ((pool texture-pool) (segment texture-pool-segment) (page texture-page) (mode int) (bucket-idx bucket-id)) - (local-vars - (tex-data pointer) - (tex-dest-base-chunk uint) - (chunk-count int) - (chunks-to-upload-count int) - (first-chunk-idx-to-upload int) - (tex-id uint) - ) (let ((total-upload-size 0)) (let* ((dma-buf (-> *display* frames (-> *display* on-screen) frame global-buf)) (dma-start (-> dma-buf base)) ) - (set! tex-data (-> page segment 0 block-data)) - (set! tex-dest-base-chunk (shr (-> page segment 0 dest) 12)) - (set! chunk-count (the-as int (-> page segment 0 size))) - (set! chunks-to-upload-count 0) - (set! first-chunk-idx-to-upload 0) - (set! tex-id (-> page id)) - (let ((v1-8 mode)) - (cond - ((= v1-8 -3) - (return 0) - ) - ((zero? v1-8) - ) - ((= v1-8 -2) - (set! chunk-count (the-as int (+ chunk-count (-> page segment 1 size)))) - ) - ((= v1-8 -1) - (set! chunk-count (the-as int (-> page size))) - ) - ((= v1-8 2) - (set! tex-data (-> page segment 2 block-data)) - (set! tex-dest-base-chunk (shr (-> page segment 2 dest) 12)) - (set! chunk-count (the-as int (-> page segment 2 size))) - ) - ) - ) - (set! chunk-count (shr (min (the-as int (-> segment size)) (the-as int (+ chunk-count 4095))) 12)) - (dotimes (upload-chunk-idx chunk-count) - (let ((current-dest-chunk (+ tex-dest-base-chunk upload-chunk-idx))) - (cond - ((zero? chunks-to-upload-count) - (when (!= (-> pool ids current-dest-chunk) tex-id) - (set! first-chunk-idx-to-upload upload-chunk-idx) - (set! (-> pool ids current-dest-chunk) tex-id) - (set! chunks-to-upload-count (+ chunks-to-upload-count 1)) + (let ((tex-data (-> page segment 0 block-data)) + (tex-dest-base-chunk (shr (-> page segment 0 dest) 12)) + (chunk-count (the-as int (-> page segment 0 size))) + (chunks-to-upload-count 0) + (first-chunk-idx-to-upload 0) + ) + (let ((tex-id (-> page id))) + (let ((v1-8 mode)) + (cond + ((= v1-8 -3) + (return 0) ) - ) - ((= (-> pool ids current-dest-chunk) tex-id) - (upload-vram-data - dma-buf - (the-as int (* (+ tex-dest-base-chunk first-chunk-idx-to-upload) 64)) - (&+ tex-data (shl first-chunk-idx-to-upload 14)) - (* chunks-to-upload-count 32) + ((zero? v1-8) ) - (+! total-upload-size chunks-to-upload-count) - (set! chunks-to-upload-count 0) - 0 - ) - (else - (set! (-> pool ids current-dest-chunk) tex-id) - (set! chunks-to-upload-count (+ chunks-to-upload-count 1)) + ((= v1-8 -2) + (set! chunk-count (the-as int (+ (the-as uint chunk-count) (-> page segment 1 size)))) + ) + ((= v1-8 -1) + (set! chunk-count (the-as int (-> page size))) + ) + ((= v1-8 2) + (set! tex-data (-> page segment 2 block-data)) + (set! tex-dest-base-chunk (shr (-> page segment 2 dest) 12)) + (set! chunk-count (the-as int (-> page segment 2 size))) + ) + ) + ) + (set! chunk-count + (shr (min (the-as int (-> segment size)) (the-as int (+ (the-as uint chunk-count) 4095))) 12) + ) + (dotimes (upload-chunk-idx chunk-count) + (let ((current-dest-chunk (+ tex-dest-base-chunk upload-chunk-idx))) + (cond + ((zero? chunks-to-upload-count) + (when (!= (-> pool ids current-dest-chunk) tex-id) + (set! first-chunk-idx-to-upload upload-chunk-idx) + (set! (-> pool ids current-dest-chunk) tex-id) + (+! chunks-to-upload-count 1) + ) + ) + ((= (-> pool ids current-dest-chunk) tex-id) + (upload-vram-data + dma-buf + (the-as int (* (+ tex-dest-base-chunk first-chunk-idx-to-upload) 64)) + (&+ tex-data (shl first-chunk-idx-to-upload 14)) + (* chunks-to-upload-count 32) + ) + (+! total-upload-size chunks-to-upload-count) + (set! chunks-to-upload-count 0) + 0 + ) + (else + (set! (-> pool ids current-dest-chunk) tex-id) + (+! chunks-to-upload-count 1) + ) + ) ) ) ) - ) - (when (nonzero? chunks-to-upload-count) - (upload-vram-data - dma-buf - (the-as int (* (+ tex-dest-base-chunk first-chunk-idx-to-upload) 64)) - (&+ tex-data (shl first-chunk-idx-to-upload 14)) - (* chunks-to-upload-count 32) + (when (nonzero? chunks-to-upload-count) + (upload-vram-data + dma-buf + (the-as int (* (+ tex-dest-base-chunk first-chunk-idx-to-upload) 64)) + (&+ tex-data (shl first-chunk-idx-to-upload 14)) + (* chunks-to-upload-count 32) + ) + (+! total-upload-size chunks-to-upload-count) ) - (+! total-upload-size chunks-to-upload-count) ) (let* ((v1-47 dma-buf) (dma (the-as dma-packet (-> v1-47 base))) @@ -1007,63 +1004,60 @@ (bucket-idx bucket-id) (allow-cache-mask int) ) - (local-vars - (tex-data pointer) - (tex-dest-base-chunk uint) - (chunk-count int) - (chunks-to-upload-count int) - (first-chunk-idx-to-upload int) - (page-id uint) - (current-dest-chunk uint) - (need-tex symbol) - ) (let ((total-upload-size 0)) (let* ((dma-buf (-> *display* frames (-> *display* on-screen) frame global-buf)) (s4-0 (-> dma-buf base)) ) - (set! tex-data (-> page segment 0 block-data)) - (set! tex-dest-base-chunk (shr (-> page segment 0 dest) 12)) - (set! chunk-count (the-as int (-> page size))) - (set! chunks-to-upload-count 0) - (set! first-chunk-idx-to-upload 0) - (set! page-id (-> page id)) - (set! chunk-count (shr (min (the-as int (-> segment size)) (the-as int (+ chunk-count 4095))) 12)) - (dotimes (upload-chunk-idx chunk-count) - (set! current-dest-chunk (+ tex-dest-base-chunk upload-chunk-idx)) - (set! need-tex (logtest? allow-cache-mask (ash 1 upload-chunk-idx))) - (cond - ((zero? chunks-to-upload-count) - (when (and (!= (-> pool ids current-dest-chunk) page-id) need-tex) - (set! first-chunk-idx-to-upload upload-chunk-idx) - (set! (-> pool ids current-dest-chunk) page-id) - (set! chunks-to-upload-count (+ chunks-to-upload-count 1)) - ) - ) - ((or (= (-> pool ids current-dest-chunk) page-id) (not need-tex)) - (upload-vram-data - dma-buf - (the-as int (* (+ tex-dest-base-chunk first-chunk-idx-to-upload) 64)) - (&+ tex-data (shl first-chunk-idx-to-upload 14)) - (* chunks-to-upload-count 32) - ) - (+! total-upload-size chunks-to-upload-count) - (set! chunks-to-upload-count 0) - 0 - ) - (else - (set! (-> pool ids current-dest-chunk) page-id) - (set! chunks-to-upload-count (+ chunks-to-upload-count 1)) + (let ((tex-data (-> page segment 0 block-data)) + (tex-dest-base-chunk (shr (-> page segment 0 dest) 12)) + (chunk-count (the-as int (-> page size))) + (chunks-to-upload-count 0) + (first-chunk-idx-to-upload 0) + ) + (let ((page-id (-> page id))) + (set! chunk-count + (shr (min (the-as int (-> segment size)) (the-as int (+ (the-as uint chunk-count) 4095))) 12) + ) + (dotimes (upload-chunk-idx chunk-count) + (let ((current-dest-chunk (+ tex-dest-base-chunk upload-chunk-idx)) + (need-tex (logtest? allow-cache-mask (ash 1 upload-chunk-idx))) + ) + (cond + ((zero? chunks-to-upload-count) + (when (and (!= (-> pool ids current-dest-chunk) page-id) need-tex) + (set! first-chunk-idx-to-upload upload-chunk-idx) + (set! (-> pool ids current-dest-chunk) page-id) + (+! chunks-to-upload-count 1) + ) + ) + ((or (= (-> pool ids current-dest-chunk) page-id) (not need-tex)) + (upload-vram-data + dma-buf + (the-as int (* (+ tex-dest-base-chunk first-chunk-idx-to-upload) 64)) + (&+ tex-data (shl first-chunk-idx-to-upload 14)) + (* chunks-to-upload-count 32) + ) + (+! total-upload-size chunks-to-upload-count) + (set! chunks-to-upload-count 0) + 0 + ) + (else + (set! (-> pool ids current-dest-chunk) page-id) + (+! chunks-to-upload-count 1) + ) + ) + ) ) ) - ) - (when (nonzero? chunks-to-upload-count) - (upload-vram-data - dma-buf - (the-as int (* (+ tex-dest-base-chunk first-chunk-idx-to-upload) 64)) - (&+ tex-data (shl first-chunk-idx-to-upload 14)) - (* chunks-to-upload-count 32) + (when (nonzero? chunks-to-upload-count) + (upload-vram-data + dma-buf + (the-as int (* (+ tex-dest-base-chunk first-chunk-idx-to-upload) 64)) + (&+ tex-data (shl first-chunk-idx-to-upload 14)) + (* chunks-to-upload-count 32) + ) + (+! total-upload-size chunks-to-upload-count) ) - (+! total-upload-size chunks-to-upload-count) ) (let* ((v1-52 dma-buf) (dma (the-as dma-packet (-> v1-52 base))) @@ -1811,9 +1805,8 @@ ;; definition for method 13 of type texture-page (defmethod add-to-dma-buffer ((this texture-page) (dma-buff dma-buffer) (mode int)) - (local-vars (total-size int)) - (let ((v1-0 mode)) - (set! total-size (cond + (let* ((v1-0 mode) + (total-size (cond ((= v1-0 -3) 0 ) @@ -1827,53 +1820,54 @@ (the-as int (-> this segment mode size)) ) ) - ) - ) - (let* ((start-segment (max 0 mode)) - (chunk-count (* (/ (+ (/ total-size 64) 63) 64) 32)) - (current-dest (shr (-> this segment start-segment dest) 6)) - (current-data (-> this segment start-segment block-data)) + ) ) - (while (> chunk-count 0) - (let ((chunks-now (min 2048 chunk-count))) - (let* ((v1-11 dma-buff) - (pkt (the-as dma-packet (-> v1-11 base))) - ) - (set! (-> pkt dma) (new 'static 'dma-tag :qwc #x5 :id (dma-tag-id cnt))) - (set! (-> pkt vif0) (new 'static 'vif-tag)) - (set! (-> pkt vif1) (new 'static 'vif-tag :imm #x5 :cmd (vif-cmd direct) :msk #x1)) - (set! (-> v1-11 base) (&+ (the-as pointer pkt) 16)) + (let* ((start-segment (max 0 mode)) + (chunk-count (* (/ (+ (/ total-size 64) 63) 64) 32)) + (current-dest (shr (-> this segment start-segment dest) 6)) + (current-data (-> this segment start-segment block-data)) + ) + (while (> chunk-count 0) + (let ((chunks-now (min 2048 chunk-count))) + (let* ((v1-11 dma-buff) + (pkt (the-as dma-packet (-> v1-11 base))) + ) + (set! (-> pkt dma) (new 'static 'dma-tag :qwc #x5 :id (dma-tag-id cnt))) + (set! (-> pkt vif0) (new 'static 'vif-tag)) + (set! (-> pkt vif1) (new 'static 'vif-tag :imm #x5 :cmd (vif-cmd direct) :msk #x1)) + (set! (-> v1-11 base) (&+ (the-as pointer pkt) 16)) + ) + (let* ((v1-12 dma-buff) + (gs-tag (the-as gs-gif-tag (-> v1-12 base))) + ) + (set! (-> gs-tag tag) (new 'static 'gif-tag64 :nloop #x4 :nreg #x1)) + (set! (-> gs-tag regs) (new 'static 'gif-tag-regs :regs0 (gif-reg-id a+d))) + (set! (-> v1-12 base) (&+ (the-as pointer gs-tag) 16)) + ) + (let* ((v1-13 dma-buff) + (gs-reg-data (-> v1-13 base)) + ) + (set! (-> (the-as (pointer gs-bitbltbuf) gs-reg-data) 0) + (new 'static 'gs-bitbltbuf :dbw #x2 :dbp current-dest) + ) + (set! (-> (the-as (pointer gs-reg64) gs-reg-data) 1) (gs-reg64 bitbltbuf)) + (set! (-> (the-as (pointer gs-trxpos) gs-reg-data) 2) (new 'static 'gs-trxpos)) + (set! (-> (the-as (pointer gs-reg64) gs-reg-data) 3) (gs-reg64 trxpos)) + (set! (-> (the-as (pointer gs-trxreg) gs-reg-data) 4) (new 'static 'gs-trxreg :rrw #x80 :rrh chunks-now)) + (set! (-> (the-as (pointer gs-reg64) gs-reg-data) 5) (gs-reg64 trxreg)) + (set! (-> (the-as (pointer gs-trxdir) gs-reg-data) 6) (new 'static 'gs-trxdir)) + (set! (-> (the-as (pointer gs-reg64) gs-reg-data) 7) (gs-reg64 trxdir)) + (set! (-> v1-13 base) (&+ gs-reg-data 64)) + ) + (dma-buffer-add-ref-texture dma-buff current-data 128 chunks-now (gs-psm ct32)) ) - (let* ((v1-12 dma-buff) - (gs-tag (the-as gs-gif-tag (-> v1-12 base))) - ) - (set! (-> gs-tag tag) (new 'static 'gif-tag64 :nloop #x4 :nreg #x1)) - (set! (-> gs-tag regs) (new 'static 'gif-tag-regs :regs0 (gif-reg-id a+d))) - (set! (-> v1-12 base) (&+ (the-as pointer gs-tag) 16)) - ) - (let* ((v1-13 dma-buff) - (gs-reg-data (-> v1-13 base)) - ) - (set! (-> (the-as (pointer gs-bitbltbuf) gs-reg-data) 0) - (new 'static 'gs-bitbltbuf :dbw #x2 :dbp current-dest) - ) - (set! (-> (the-as (pointer gs-reg64) gs-reg-data) 1) (gs-reg64 bitbltbuf)) - (set! (-> (the-as (pointer gs-trxpos) gs-reg-data) 2) (new 'static 'gs-trxpos)) - (set! (-> (the-as (pointer gs-reg64) gs-reg-data) 3) (gs-reg64 trxpos)) - (set! (-> (the-as (pointer gs-trxreg) gs-reg-data) 4) (new 'static 'gs-trxreg :rrw #x80 :rrh chunks-now)) - (set! (-> (the-as (pointer gs-reg64) gs-reg-data) 5) (gs-reg64 trxreg)) - (set! (-> (the-as (pointer gs-trxdir) gs-reg-data) 6) (new 'static 'gs-trxdir)) - (set! (-> (the-as (pointer gs-reg64) gs-reg-data) 7) (gs-reg64 trxdir)) - (set! (-> v1-13 base) (&+ gs-reg-data 64)) - ) - (dma-buffer-add-ref-texture dma-buff current-data 128 chunks-now (gs-psm ct32)) + (+! current-dest 4096) + (&+! current-data #x100000) + (+! chunk-count -2048) ) - (+! current-dest 4096) - (&+! current-data #x100000) - (+! chunk-count -2048) ) + total-size ) - total-size ) ;; definition for function texture-relocate @@ -2020,10 +2014,10 @@ ;; WARN: Stack slot offset 16 signed mismatch ;; INFO: Return type mismatch int vs none. (defmethod setup-font-texture! ((this texture-pool)) - (local-vars (heap-before-font-tex int) (clut-dest-addr int)) - (let ((font-clut (-> this font-palette))) - (set! heap-before-font-tex (-> this cur)) - (set! clut-dest-addr (/ font-clut 64)) + (let* ((font-clut (-> this font-palette)) + (heap-before-font-tex (-> this cur)) + (clut-dest-addr (/ font-clut 64)) + ) (set! *font-texture* (get-texture ascii.12lo gamefontnew)) (let ((main-font-tx (texture-page-login (new 'static 'texture-id :index #x1 :page #x4fe) texture-page-default-allocate global) diff --git a/test/decompiler/reference/jak1/engine/gfx/tfrag/tfrag-methods_REF.gc b/test/decompiler/reference/jak1/engine/gfx/tfrag/tfrag-methods_REF.gc index bc7ea3b016..9a56b1f8a6 100644 --- a/test/decompiler/reference/jak1/engine/gfx/tfrag/tfrag-methods_REF.gc +++ b/test/decompiler/reference/jak1/engine/gfx/tfrag/tfrag-methods_REF.gc @@ -29,7 +29,7 @@ ;; definition for function draw-drawable-tree-tfrag ;; INFO: Return type mismatch drawable-tree-tfrag vs none. (defun draw-drawable-tree-tfrag ((arg0 drawable-tree-tfrag)) - (local-vars (a0-20 int) (a0-22 int) (a0-38 int) (a0-40 int) (sv-16 (pointer uint8))) + (local-vars (a0-20 int) (a0-22 int) (a0-38 int) (a0-40 int)) (when (logtest? *vu1-enable-user* (vu1-renderer-mask tfrag)) (let ((s5-0 (+ (-> arg0 length) -1))) (when (nonzero? s5-0) @@ -53,165 +53,164 @@ (let* ((v1-13 (the-as drawable-inline-array-tfrag (-> arg0 arrays s5-0))) (s4-1 (-> v1-13 data)) (s3-0 (-> v1-13 length)) + (sv-16 (&-> (the-as terrain-context #x70000000) work background vis-list (/ (-> s4-1 0 id) 8))) + (s5-1 (-> *display* frames (-> *display* on-screen) frame global-buf base)) ) - (set! sv-16 (&-> (the-as terrain-context #x70000000) work background vis-list (/ (-> s4-1 0 id) 8))) - (let ((s5-1 (-> *display* frames (-> *display* on-screen) frame global-buf base))) - (let* ((s1-0 (-> *display* frames (-> *display* on-screen) frame global-buf)) - (s2-0 (-> s1-0 base)) + (let* ((s1-0 (-> *display* frames (-> *display* on-screen) frame 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)) + (tfrag-init-buffer + s1-0 + (new 'static 'gs-test + :ate #x1 + :atst (gs-atest greater-equal) + :aref #x26 + :zte #x1 + :ztst (gs-ztest greater-equal) + ) + 0 + ) + (let* ((v1-28 (-> *perf-stats* data 5)) + (a0-17 (-> v1-28 ctrl)) ) - (set! (-> *tfrag-work* wait-to-spr) (the-as uint 0)) - (set! (-> *tfrag-work* wait-from-spr) (the-as uint 0)) - (tfrag-init-buffer - s1-0 - (new 'static 'gs-test - :ate #x1 - :atst (gs-atest greater-equal) - :aref #x26 - :zte #x1 - :ztst (gs-ztest greater-equal) - ) - 0 - ) - (let* ((v1-28 (-> *perf-stats* data 5)) - (a0-17 (-> v1-28 ctrl)) - ) - (+! (-> v1-28 count) 1) - (b! (zero? a0-17) cfg-8 :delay (nop!)) - (.mtc0 Perf 0) - (.sync.l) - (.sync.p) - (.mtpc pcr0 0) - (.mtpc pcr1 0) - (.sync.l) - (.sync.p) - (.mtc0 Perf a0-17) - ) + (+! (-> v1-28 count) 1) + (b! (zero? a0-17) cfg-8 :delay (nop!)) + (.mtc0 Perf 0) (.sync.l) (.sync.p) - (label cfg-8) - 0 - (draw-inline-array-tfrag sv-16 (the-as drawable-inline-array s4-1) s3-0 s1-0) - (let ((v1-31 (-> *perf-stats* data 5))) - (b! (zero? (-> v1-31 ctrl)) cfg-10 :delay (nop!)) - (.mtc0 Perf 0) - (.sync.l) - (.sync.p) - (.mfpc a0-20 pcr0) - (+! (-> v1-31 accum0) a0-20) - (.mfpc a0-22 pcr1) - (+! (-> v1-31 accum1) a0-22) - ) - (label cfg-10) - 0 - (update-wait-stats - (-> *perf-stats* data 5) - (the-as uint 0) - (-> *tfrag-work* wait-to-spr) - (-> *tfrag-work* wait-from-spr) - ) - (tfrag-end-buffer s1-0) - (let ((a3-3 (-> s1-0 base))) - (let ((v1-38 (the-as object (-> s1-0 base)))) - (set! (-> (the-as dma-packet v1-38) dma) (new 'static 'dma-tag :id (dma-tag-id next))) - (set! (-> (the-as dma-packet v1-38) vif0) (new 'static 'vif-tag)) - (set! (-> (the-as dma-packet v1-38) vif1) (new 'static 'vif-tag)) - (set! (-> s1-0 base) (&+ (the-as pointer v1-38) 16)) - ) - (dma-bucket-insert-tag - (-> *display* frames (-> *display* on-screen) frame bucket-group) - (if (zero? (-> (the-as terrain-context #x70000000) bsp lev-index)) - (bucket-id tfrag-0) - (bucket-id tfrag-1) - ) - s2-0 - (the-as (pointer dma-tag) a3-3) - ) - ) - ) - (let* ((s1-1 (-> *display* frames (-> *display* on-screen) frame 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)) - (tfrag-near-init-buffer - s1-1 - (new 'static 'gs-test - :ate #x1 - :atst (gs-atest greater-equal) - :aref #x26 - :zte #x1 - :ztst (gs-ztest greater-equal) - ) - 0 - ) - (let* ((v1-52 (-> *perf-stats* data 6)) - (a0-35 (-> v1-52 ctrl)) - ) - (+! (-> v1-52 count) 1) - (b! (zero? a0-35) cfg-15 :delay (nop!)) - (.mtc0 Perf 0) - (.sync.l) - (.sync.p) - (.mtpc pcr0 0) - (.mtpc pcr1 0) - (.sync.l) - (.sync.p) - (.mtc0 Perf a0-35) - ) + (.mtpc pcr0 0) + (.mtpc pcr1 0) (.sync.l) (.sync.p) - (label cfg-15) - 0 - (draw-inline-array-tfrag-near sv-16 (the-as drawable-inline-array s4-1) s3-0 s1-1) - (let ((v1-55 (-> *perf-stats* data 6))) - (b! (zero? (-> v1-55 ctrl)) cfg-17 :delay (nop!)) - (.mtc0 Perf 0) - (.sync.l) - (.sync.p) - (.mfpc a0-38 pcr0) - (+! (-> v1-55 accum0) a0-38) - (.mfpc a0-40 pcr1) - (+! (-> v1-55 accum1) a0-40) - ) - (label cfg-17) - 0 - (update-wait-stats - (-> *perf-stats* data 6) - (the-as uint 0) - (-> *tfrag-work* near-wait-to-spr) - (-> *tfrag-work* near-wait-from-spr) - ) - (tfrag-near-end-buffer s1-1) - (let ((a3-6 (-> s1-1 base))) - (let ((v1-62 (the-as object (-> s1-1 base)))) - (set! (-> (the-as dma-packet v1-62) dma) (new 'static 'dma-tag :id (dma-tag-id next))) - (set! (-> (the-as dma-packet v1-62) vif0) (new 'static 'vif-tag)) - (set! (-> (the-as dma-packet v1-62) vif1) (new 'static 'vif-tag)) - (set! (-> s1-1 base) (&+ (the-as pointer v1-62) 16)) - ) - (dma-bucket-insert-tag - (-> *display* frames (-> *display* on-screen) frame bucket-group) - (if (zero? (-> (the-as terrain-context #x70000000) bsp lev-index)) - (bucket-id tfrag-near-0) - (bucket-id tfrag-near-1) - ) - s2-1 - (the-as (pointer dma-tag) a3-6) - ) - ) + (.mtc0 Perf a0-17) ) - (let ((v1-69 *dma-mem-usage*)) - (when (nonzero? v1-69) - (set! (-> v1-69 length) (max 2 (-> v1-69 length))) - (set! (-> v1-69 data 1 name) "tfragment") - (+! (-> v1-69 data 1 count) 1) - (+! (-> v1-69 data 1 used) - (&- (-> *display* frames (-> *display* on-screen) frame global-buf base) (the-as uint s5-1)) + (.sync.l) + (.sync.p) + (label cfg-8) + 0 + (draw-inline-array-tfrag sv-16 (the-as drawable-inline-array s4-1) s3-0 s1-0) + (let ((v1-31 (-> *perf-stats* data 5))) + (b! (zero? (-> v1-31 ctrl)) cfg-10 :delay (nop!)) + (.mtc0 Perf 0) + (.sync.l) + (.sync.p) + (.mfpc a0-20 pcr0) + (+! (-> v1-31 accum0) a0-20) + (.mfpc a0-22 pcr1) + (+! (-> v1-31 accum1) a0-22) + ) + (label cfg-10) + 0 + (update-wait-stats + (-> *perf-stats* data 5) + (the-as uint 0) + (-> *tfrag-work* wait-to-spr) + (-> *tfrag-work* wait-from-spr) + ) + (tfrag-end-buffer s1-0) + (let ((a3-3 (-> s1-0 base))) + (let ((v1-38 (the-as object (-> s1-0 base)))) + (set! (-> (the-as dma-packet v1-38) dma) (new 'static 'dma-tag :id (dma-tag-id next))) + (set! (-> (the-as dma-packet v1-38) vif0) (new 'static 'vif-tag)) + (set! (-> (the-as dma-packet v1-38) vif1) (new 'static 'vif-tag)) + (set! (-> s1-0 base) (&+ (the-as pointer v1-38) 16)) + ) + (dma-bucket-insert-tag + (-> *display* frames (-> *display* on-screen) frame bucket-group) + (if (zero? (-> (the-as terrain-context #x70000000) bsp lev-index)) + (bucket-id tfrag-0) + (bucket-id tfrag-1) ) - (set! (-> v1-69 data 1 total) (-> v1-69 data 1 used)) + s2-0 + (the-as (pointer dma-tag) a3-3) ) ) ) + (let* ((s1-1 (-> *display* frames (-> *display* on-screen) frame 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)) + (tfrag-near-init-buffer + s1-1 + (new 'static 'gs-test + :ate #x1 + :atst (gs-atest greater-equal) + :aref #x26 + :zte #x1 + :ztst (gs-ztest greater-equal) + ) + 0 + ) + (let* ((v1-52 (-> *perf-stats* data 6)) + (a0-35 (-> v1-52 ctrl)) + ) + (+! (-> v1-52 count) 1) + (b! (zero? a0-35) cfg-15 :delay (nop!)) + (.mtc0 Perf 0) + (.sync.l) + (.sync.p) + (.mtpc pcr0 0) + (.mtpc pcr1 0) + (.sync.l) + (.sync.p) + (.mtc0 Perf a0-35) + ) + (.sync.l) + (.sync.p) + (label cfg-15) + 0 + (draw-inline-array-tfrag-near sv-16 (the-as drawable-inline-array s4-1) s3-0 s1-1) + (let ((v1-55 (-> *perf-stats* data 6))) + (b! (zero? (-> v1-55 ctrl)) cfg-17 :delay (nop!)) + (.mtc0 Perf 0) + (.sync.l) + (.sync.p) + (.mfpc a0-38 pcr0) + (+! (-> v1-55 accum0) a0-38) + (.mfpc a0-40 pcr1) + (+! (-> v1-55 accum1) a0-40) + ) + (label cfg-17) + 0 + (update-wait-stats + (-> *perf-stats* data 6) + (the-as uint 0) + (-> *tfrag-work* near-wait-to-spr) + (-> *tfrag-work* near-wait-from-spr) + ) + (tfrag-near-end-buffer s1-1) + (let ((a3-6 (-> s1-1 base))) + (let ((v1-62 (the-as object (-> s1-1 base)))) + (set! (-> (the-as dma-packet v1-62) dma) (new 'static 'dma-tag :id (dma-tag-id next))) + (set! (-> (the-as dma-packet v1-62) vif0) (new 'static 'vif-tag)) + (set! (-> (the-as dma-packet v1-62) vif1) (new 'static 'vif-tag)) + (set! (-> s1-1 base) (&+ (the-as pointer v1-62) 16)) + ) + (dma-bucket-insert-tag + (-> *display* frames (-> *display* on-screen) frame bucket-group) + (if (zero? (-> (the-as terrain-context #x70000000) bsp lev-index)) + (bucket-id tfrag-near-0) + (bucket-id tfrag-near-1) + ) + s2-1 + (the-as (pointer dma-tag) a3-6) + ) + ) + ) + (let ((v1-69 *dma-mem-usage*)) + (when (nonzero? v1-69) + (set! (-> v1-69 length) (max 2 (-> v1-69 length))) + (set! (-> v1-69 data 1 name) "tfragment") + (+! (-> v1-69 data 1 count) 1) + (+! (-> v1-69 data 1 used) + (&- (-> *display* frames (-> *display* on-screen) frame global-buf base) (the-as uint s5-1)) + ) + (set! (-> v1-69 data 1 total) (-> v1-69 data 1 used)) + ) + ) ) ) ) @@ -221,7 +220,7 @@ ;; definition for function draw-drawable-tree-trans-tfrag ;; INFO: Return type mismatch drawable-tree-trans-tfrag vs none. (defun draw-drawable-tree-trans-tfrag ((arg0 drawable-tree-trans-tfrag)) - (local-vars (a0-18 int) (a0-20 int) (a0-35 int) (a0-37 int) (sv-16 (pointer uint8))) + (local-vars (a0-18 int) (a0-20 int) (a0-35 int) (a0-37 int)) (when (logtest? *vu1-enable-user* (vu1-renderer-mask trans-tfrag)) (let ((s5-0 (+ (-> arg0 length) -1))) (when (nonzero? s5-0) @@ -245,8 +244,8 @@ (let* ((v1-13 (-> arg0 arrays s5-0)) (s5-1 (&+ v1-13 32)) (s4-1 (-> v1-13 length)) + (sv-16 (&-> (the-as terrain-context #x70000000) work background vis-list (/ (-> s5-1 id) 8))) ) - (set! sv-16 (&-> (the-as terrain-context #x70000000) work background vis-list (/ (-> s5-1 id) 8))) (let* ((s2-0 (-> *display* frames (-> *display* on-screen) frame global-buf)) (s3-0 (-> s2-0 base)) ) @@ -402,7 +401,7 @@ ;; definition for function draw-drawable-tree-dirt-tfrag ;; INFO: Return type mismatch drawable-tree-dirt-tfrag vs none. (defun draw-drawable-tree-dirt-tfrag ((arg0 drawable-tree-dirt-tfrag)) - (local-vars (a0-18 int) (a0-20 int) (a0-35 int) (a0-37 int) (sv-16 (pointer uint8))) + (local-vars (a0-18 int) (a0-20 int) (a0-35 int) (a0-37 int)) (when (logtest? *vu1-enable-user* (vu1-renderer-mask trans-tfrag)) (let ((s5-0 (+ (-> arg0 length) -1))) (when (nonzero? s5-0) @@ -426,8 +425,8 @@ (let* ((v1-13 (-> arg0 arrays s5-0)) (s5-1 (&+ v1-13 32)) (s4-1 (-> v1-13 length)) + (sv-16 (&-> (the-as terrain-context #x70000000) work background vis-list (/ (-> s5-1 id) 8))) ) - (set! sv-16 (&-> (the-as terrain-context #x70000000) work background vis-list (/ (-> s5-1 id) 8))) (let* ((s2-0 (-> *display* frames (-> *display* on-screen) frame global-buf)) (s3-0 (-> s2-0 base)) ) @@ -565,7 +564,7 @@ ;; definition for function draw-drawable-tree-ice-tfrag ;; INFO: Return type mismatch drawable-tree-ice-tfrag vs none. (defun draw-drawable-tree-ice-tfrag ((arg0 drawable-tree-ice-tfrag)) - (local-vars (a0-18 int) (a0-20 int) (a0-35 int) (a0-37 int) (sv-16 (pointer uint8))) + (local-vars (a0-18 int) (a0-20 int) (a0-35 int) (a0-37 int)) (when (logtest? *vu1-enable-user* (vu1-renderer-mask trans-tfrag)) (let ((s5-0 (+ (-> arg0 length) -1))) (when (nonzero? s5-0) @@ -589,8 +588,8 @@ (let* ((v1-13 (-> arg0 arrays s5-0)) (s5-1 (&+ v1-13 32)) (s4-1 (-> v1-13 length)) + (sv-16 (&-> (the-as terrain-context #x70000000) work background vis-list (/ (-> s5-1 id) 8))) ) - (set! sv-16 (&-> (the-as terrain-context #x70000000) work background vis-list (/ (-> s5-1 id) 8))) (let* ((s2-0 (-> *display* frames (-> *display* on-screen) frame global-buf)) (s3-0 (-> s2-0 base)) ) diff --git a/test/decompiler/reference/jak1/engine/gfx/tie/tie-methods_REF.gc b/test/decompiler/reference/jak1/engine/gfx/tie/tie-methods_REF.gc index 88e8ffa555..5222f76cfe 100644 --- a/test/decompiler/reference/jak1/engine/gfx/tie/tie-methods_REF.gc +++ b/test/decompiler/reference/jak1/engine/gfx/tie/tie-methods_REF.gc @@ -246,17 +246,7 @@ ;; INFO: Used lq/sq ;; INFO: Return type mismatch int vs none. (defun draw-drawable-tree-instance-tie ((arg0 drawable-tree-instance-tie) (arg1 level)) - (local-vars - (a0-31 int) - (a0-33 int) - (a0-46 int) - (a0-48 int) - (a0-62 int) - (a0-64 int) - (a0-82 int) - (a0-84 int) - (sv-16 int) - ) + (local-vars (a0-31 int) (a0-33 int) (a0-46 int) (a0-48 int) (a0-62 int) (a0-64 int) (a0-82 int) (a0-84 int)) (when (logtest? *vu1-enable-user* (vu1-renderer-mask tie-near tie generic)) (set! (-> *instance-tie-work* first-generic-prototype) (the-as uint 0)) (set! (-> *instance-tie-work* wind-vectors) (-> arg0 prototypes wind-vectors)) @@ -294,8 +284,8 @@ (let* ((s1-0 (-> (the-as drawable-inline-array-instance-tie v1-16) data)) (s0-0 (&-> (the-as terrain-context #x70000000) work background vis-list (/ (-> s1-0 0 id) 8))) (s3-1 (-> *display* frames (-> *display* on-screen) frame global-buf)) + (sv-16 (-> (the-as drawable-inline-array-node v1-16) length)) ) - (set! sv-16 (-> (the-as drawable-inline-array-node v1-16) length)) (when (nonzero? sv-16) (let* ((v1-21 (logand (the-as int *gsf-buffer*) 8191)) (v1-23 (logand (the-as int (&- (logand (the-as int (&-> s4-1 data -512)) 8191) (the-as uint v1-21))) 8191)) @@ -324,11 +314,7 @@ (.sync.p) (label cfg-12) 0 - (let ((t9-2 draw-inline-array-instance-tie) - (a3-1 s3-1) - ) - (t9-2 s0-0 s1-0 sv-16 a3-1) - ) + (draw-inline-array-instance-tie s0-0 s1-0 sv-16 s3-1) (let ((v1-35 (-> *perf-stats* data 9))) (b! (zero? (-> v1-35 ctrl)) cfg-14 :delay (nop!)) (.mtc0 Perf 0) diff --git a/test/decompiler/reference/jak1/engine/gfx/tie/tie_REF.gc b/test/decompiler/reference/jak1/engine/gfx/tie/tie_REF.gc index 6c95420cb2..816b099393 100644 --- a/test/decompiler/reference/jak1/engine/gfx/tie/tie_REF.gc +++ b/test/decompiler/reference/jak1/engine/gfx/tie/tie_REF.gc @@ -648,23 +648,12 @@ ;; INFO: Used lq/sq ;; INFO: Return type mismatch symbol vs none. (defun-debug tie-ints () - (local-vars (sv-16 uint)) (let ((gp-0 (the-as (pointer uint32) (+ #x3fa0 #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 (-> gp-0 (* s5-0 4))) - ) - (set! sv-16 (-> gp-0 (* s5-0 4))) - (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 (-> gp-0 (* s5-0 4)) (-> gp-0 (* s5-0 4)) (tie-int-reg s5-0)) ) ) (none) @@ -674,7 +663,6 @@ ;; INFO: Used lq/sq ;; INFO: 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) @@ -689,17 +677,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/jak1/engine/level/level_REF.gc b/test/decompiler/reference/jak1/engine/level/level_REF.gc index 0e9b8d9edd..b35985b847 100644 --- a/test/decompiler/reference/jak1/engine/level/level_REF.gc +++ b/test/decompiler/reference/jak1/engine/level/level_REF.gc @@ -349,7 +349,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) @@ -376,8 +375,9 @@ ) (case (-> this status) (('loading) - (set! sv-16 (the-as symbol #f)) - (let ((a0-15 (dgo-load-get-next (& sv-16)))) + (let* ((sv-16 (the-as symbol #f)) + (a0-15 (dgo-load-get-next (& sv-16))) + ) (when a0-15 (cond ((not sv-16) @@ -488,7 +488,7 @@ ;; ERROR: Unsupported inline assembly instruction kind - [mfc0 v1, Count] ;; ERROR: Unsupported inline assembly instruction kind - [mfc0 v1, Count] (defun level-update-after-load ((loaded-level level) (level-login-state login-state)) - (local-vars (current-timer int) (v1-154 int) (initial-timer int) (sv-16 prototype-bucket-tie) (sv-32 int)) + (local-vars (current-timer int) (v1-154 int) (initial-timer int)) 0 (let ((level-drawable-trees (-> loaded-level bsp drawable-trees))) 0 @@ -574,15 +574,17 @@ (when (< current-login-pos (-> s1-2 length)) (dotimes (s0-1 10) (when (< current-login-pos (-> s1-2 length)) - (set! sv-16 (-> s1-2 array-data (the-as uint current-login-pos))) - (set! sv-32 0) - (while (< sv-32 4) - (let ((a0-28 (-> sv-16 geometry-override sv-32))) - (if (nonzero? a0-28) - (login a0-28) - ) + (let ((sv-16 (-> s1-2 array-data (the-as uint current-login-pos))) + (sv-32 0) + ) + (while (< sv-32 4) + (let ((a0-28 (-> sv-16 geometry-override sv-32))) + (if (nonzero? a0-28) + (login a0-28) + ) + ) + (+! sv-32 1) ) - (set! sv-32 (+ sv-32 1)) ) (set! current-login-pos (the-as int (+ (the-as uint current-login-pos) 1))) ) diff --git a/test/decompiler/reference/jak1/engine/level/load-boundary_REF.gc b/test/decompiler/reference/jak1/engine/level/load-boundary_REF.gc index d3c6e5634b..0d7074c0e9 100644 --- a/test/decompiler/reference/jak1/engine/level/load-boundary_REF.gc +++ b/test/decompiler/reference/jak1/engine/level/load-boundary_REF.gc @@ -1085,7 +1085,7 @@ (f2-2 (* 0.5 (+ f0-0 f2-0))) (f1-1 (- f3-2 f1-0)) (f0-1 (- f2-2 f0-0)) - (f0-4 (sqrtf (+ (* f1-1 f1-1) (* f0-1 f0-1)))) + (f0-4 (sqrtf (+ (square f1-1) (square f0-1)))) ) (set-vector! (-> arg0 rejector) f3-2 0.0 f2-2 f0-4) ) @@ -2124,7 +2124,7 @@ (f1-2 (- (-> a1-0 z) (-> arg0 rejector z))) ) (cond - ((< (+ (* f0-1 f0-1) (* f1-2 f1-2)) (* (-> arg0 rejector w) (-> arg0 rejector w))) + ((< (+ (square f0-1) (square f1-2)) (* (-> arg0 rejector w) (-> arg0 rejector w))) (if (logtest? (-> arg0 flags) (load-boundary-flags closed)) (set! s5-0 (check-closed-boundary arg0 a1-0 a2-0)) (set! s5-0 (check-open-boundary arg0 a1-0 a2-0)) diff --git a/test/decompiler/reference/jak1/engine/load/loader_REF.gc b/test/decompiler/reference/jak1/engine/load/loader_REF.gc index 970f3a8193..c20c18f407 100644 --- a/test/decompiler/reference/jak1/engine/load/loader_REF.gc +++ b/test/decompiler/reference/jak1/engine/load/loader_REF.gc @@ -4,22 +4,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 @@ -797,147 +793,145 @@ ;; WARN: Stack slot offset 24 signed mismatch ;; WARN: Stack slot offset 24 signed mismatch (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-39 int) - (spool-part int) - (sv-24 float) - (old-skel-status janim-status) - (sv-32 int) - (sv-40 int) - (sv-48 int) - (sv-56 int) - (spool-sound sound-id) - (sv-72 int) - ) - (set! spool-part 0) - (set! sv-24 -17.0) - (set! old-skel-status (-> self skel status)) - (set! sv-32 -2) - (set! sv-40 0) - (set! sv-48 0) - (set! sv-56 0) - (set! spool-sound (new-sound-id)) - (backup-load-state-and-set-cmds *load-state* (-> arg0 command-list)) - (set-setting! 'spooling (process->ppointer self) 0.0 0) - (logior! (-> self skel status) (janim-status inited drawn done)) - (kill-current-level-hint '() '() 'die) - (level-hint-surpress!) - (apply-settings *setting-control*) - (when (or (handle->process (-> *art-control* spool-lock)) (!= *master-mode* 'game)) - (cond - (arg1 - (when (!= (ja-group) arg1) - (ja-channel-push! 1 (seconds 0.05)) - (ja :group! arg1 :num! min) - ) + (local-vars (v0-39 int)) + (let ((spool-part 0)) + (let ((sv-24 -17.0)) + (let ((old-skel-status (-> self skel status))) ) - (else - (ja-channel-set! 0) - ) - ) - (while (or (handle->process (-> *art-control* spool-lock)) (!= *master-mode* 'game)) - (format #t "WARNING: ---------------------> loader stall on lock~%") - (if (arg3 self) - (goto cfg-88) - ) - (spool-push *art-control* (-> arg0 name) spool-part self -9.0) - (suspend) - (if arg1 - (ja :num! (loop!)) - ) - ) - ) - (set! (-> *art-control* spool-lock) (process->handle self)) - (set! sv-48 (the-as int (current-time))) - (while (< spool-part (-> arg0 parts)) - (spool-push *art-control* (-> arg0 name) spool-part self -20.0) - (update *art-control* #f) - (spool-push *art-control* (-> arg0 name) spool-part self -20.0) - (when (!= (file-status *art-control* (-> arg0 name) spool-part) 'active) - (cond - (arg1 - (when (!= (ja-group) arg1) - (ja-channel-set! 1) - (ja :group! arg1 :num! min) + (let ((sv-32 -2) + (sv-40 0) + (sv-48 0) + (sv-56 0) + (spool-sound (new-sound-id)) + ) + (backup-load-state-and-set-cmds *load-state* (-> arg0 command-list)) + (set-setting! 'spooling (process->ppointer self) 0.0 0) + (logior! (-> self skel status) (janim-status inited drawn done)) + (kill-current-level-hint '() '() 'die) + (level-hint-surpress!) + (apply-settings *setting-control*) + (when (or (handle->process (-> *art-control* spool-lock)) (!= *master-mode* 'game)) + (cond + (arg1 + (when (!= (ja-group) arg1) + (ja-channel-push! 1 (seconds 0.05)) + (ja :group! arg1 :num! min) + ) + ) + (else + (ja-channel-set! 0) + ) + ) + (while (or (handle->process (-> *art-control* spool-lock)) (!= *master-mode* 'game)) + (format #t "WARNING: ---------------------> loader stall on lock~%") + (if (arg3 self) + (goto cfg-88) + ) + (spool-push *art-control* (-> arg0 name) spool-part self -9.0) + (suspend) + (if arg1 + (ja :num! (loop!)) + ) ) ) - (else - (ja-channel-set! 0) - ) - ) - (while (!= (file-status *art-control* (-> arg0 name) spool-part) 'active) - (if (arg3 self) - (goto cfg-88) - ) - (spool-push *art-control* (-> arg0 name) spool-part self -20.0) - (format #t "WARNING: ---------------------> loader stall on art ~S ~D~%" (-> arg0 name) spool-part) - (suspend) - (if arg1 - (ja :num! (loop!)) - ) - ) - ) - (spool-push *art-control* (-> arg0 name) spool-part self -20.0) - (let ((s2-4 (the-as art-joint-anim (lookup-art (-> self draw art-group) (-> arg0 name) art-joint-anim)))) - (cond - (s2-4 - (ja-channel-set! 1) - (ja-no-eval :group! s2-4 :num! (seek!) :frame-num 0.0) - (when (zero? spool-part) - (str-play-async (-> arg0 name) spool-sound) - (set! (-> *art-control* active-stream) (-> arg0 name)) - ) - (let* ((f30-0 (* 0.05859375 (-> s2-4 speed))) - (f28-0 (+ sv-24 (/ (the float (+ (-> s2-4 data 0 length) -1)) f30-0))) - ) - (set! sv-72 (current-str-pos spool-sound)) - (set! sv-40 (the-as int (current-time))) - (until (>= (the float v0-39) f28-0) - (if (= (-> self skel root-channel 0) (-> self skel channel)) - (logior! (-> self skel status) (janim-status spool)) + (set! (-> *art-control* spool-lock) (process->handle self)) + (set! sv-48 (the-as int (current-time))) + (while (< spool-part (-> arg0 parts)) + (spool-push *art-control* (-> arg0 name) spool-part self -20.0) + (update *art-control* #f) + (spool-push *art-control* (-> arg0 name) spool-part self -20.0) + (when (!= (file-status *art-control* (-> arg0 name) spool-part) 'active) + (cond + (arg1 + (when (!= (ja-group) arg1) + (ja-channel-set! 1) + (ja :group! arg1 :num! min) ) - (if (or (arg3 self) (and (<= sv-72 0) (time-elapsed? sv-40 (seconds 4))) (and (< 300 sv-56) (<= sv-72 0))) + ) + (else + (ja-channel-set! 0) + ) + ) + (while (!= (file-status *art-control* (-> arg0 name) spool-part) 'active) + (if (arg3 self) (goto cfg-88) ) (spool-push *art-control* (-> arg0 name) spool-part self -20.0) - (if (< (+ spool-part 1) (-> arg0 parts)) - (spool-push *art-control* (-> arg0 name) (+ spool-part 1) self -10.0) - (logclear! (-> self skel status) (janim-status done)) - ) - (execute-commands-up-to *load-state* (ja-aframe-num 0)) - (cond - ((and (< sv-32 sv-72) (= (current-str-id) spool-sound)) - (set! sv-56 (+ sv-56 (- (current-time) (-> *display* old-base-frame-counter)))) - (set! sv-40 (the-as int (current-time))) - ) - (else - 0 - ) - ) - (set! sv-32 sv-72) - (set! sv-48 (the-as int (current-time))) + (format #t "WARNING: ---------------------> loader stall on art ~S ~D~%" (-> arg0 name) spool-part) (suspend) - (let ((f0-14 (* (- (the float (current-str-pos spool-sound)) sv-24) f30-0))) - (ja-no-eval :num! (seek!) :frame-num f0-14) - ) - (set! v0-39 (current-str-pos spool-sound)) - (set! sv-72 v0-39) + (if arg1 + (ja :num! (loop!)) + ) ) - (set! sv-24 f28-0) ) - (logclear! (-> self skel status) (janim-status spool)) - ) - (else - (format 0 "ERROR: ~A in spool anim loop for ~A ~D, but not loaded.~" self (-> arg0 name) spool-part) - (goto cfg-88) + (spool-push *art-control* (-> arg0 name) spool-part self -20.0) + (let ((s2-4 (the-as art-joint-anim (lookup-art (-> self draw art-group) (-> arg0 name) art-joint-anim)))) + (cond + (s2-4 + (ja-channel-set! 1) + (ja-no-eval :group! s2-4 :num! (seek!) :frame-num 0.0) + (when (zero? spool-part) + (str-play-async (-> arg0 name) spool-sound) + (set! (-> *art-control* active-stream) (-> arg0 name)) + ) + (let* ((f30-0 (* 0.05859375 (-> s2-4 speed))) + (f28-0 (+ sv-24 (/ (the float (+ (-> s2-4 data 0 length) -1)) f30-0))) + ) + (let ((sv-72 (current-str-pos spool-sound))) + (set! sv-40 (the-as int (current-time))) + (until (>= (the float v0-39) f28-0) + (if (= (-> self skel root-channel 0) (-> self skel channel)) + (logior! (-> self skel status) (janim-status spool)) + ) + (if (or (arg3 self) + (and (<= sv-72 0) (time-elapsed? (the-as time-frame sv-40) (seconds 4))) + (and (< 300 sv-56) (<= sv-72 0)) + ) + (goto cfg-88) + ) + (spool-push *art-control* (-> arg0 name) spool-part self -20.0) + (if (< (+ spool-part 1) (-> arg0 parts)) + (spool-push *art-control* (-> arg0 name) (+ spool-part 1) self -10.0) + (logclear! (-> self skel status) (janim-status done)) + ) + (execute-commands-up-to *load-state* (ja-aframe-num 0)) + (cond + ((and (< sv-32 sv-72) (= (current-str-id) spool-sound)) + (+! sv-56 (- (current-time) (-> *display* old-base-frame-counter))) + (set! sv-40 (the-as int (current-time))) + ) + (else + 0 + ) + ) + (set! sv-32 sv-72) + (set! sv-48 (the-as int (current-time))) + (suspend) + (let ((f0-14 (* (- (the float (current-str-pos spool-sound)) sv-24) f30-0))) + (ja-no-eval :num! (seek!) :frame-num f0-14) + ) + (set! v0-39 (current-str-pos spool-sound)) + (set! sv-72 v0-39) + ) + ) + (set! sv-24 f28-0) + ) + (logclear! (-> self skel status) (janim-status spool)) + ) + (else + (format 0 "ERROR: ~A in spool anim loop for ~A ~D, but not loaded.~" self (-> arg0 name) spool-part) + (goto cfg-88) + ) + ) + ) + (+! spool-part 1) ) ) ) - (set! spool-part (+ spool-part 1)) + (+! spool-part -1) + (label cfg-88) + (ja-abort-spooled-anim arg0 arg2 spool-part) ) - (set! spool-part (+ spool-part -1)) - (label cfg-88) - (ja-abort-spooled-anim arg0 arg2 spool-part) 0 ) diff --git a/test/decompiler/reference/jak1/engine/math/euler_REF.gc b/test/decompiler/reference/jak1/engine/math/euler_REF.gc index 874adbb17b..dc1e0069d2 100644 --- a/test/decompiler/reference/jak1/engine/math/euler_REF.gc +++ b/test/decompiler/reference/jak1/engine/math/euler_REF.gc @@ -104,11 +104,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.00001 f30-0) (set! (-> arg0 x) (atan @@ -136,11 +137,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.00001 f30-1) (set! (-> arg0 x) diff --git a/test/decompiler/reference/jak1/engine/math/quaternion_REF.gc b/test/decompiler/reference/jak1/engine/math/quaternion_REF.gc index 44f60eb57a..cbf7e68352 100644 --- a/test/decompiler/reference/jak1/engine/math/quaternion_REF.gc +++ b/test/decompiler/reference/jak1/engine/math/quaternion_REF.gc @@ -45,12 +45,9 @@ ;; definition for function vector-angle<-quaternion! (defun vector-angle<-quaternion! ((arg0 vector) (arg1 quaternion)) - (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)) @@ -550,11 +547,7 @@ ;; definition for function quaternion-vector-len (defun quaternion-vector-len ((arg0 quaternion)) - (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! @@ -636,9 +629,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)) ) diff --git a/test/decompiler/reference/jak1/engine/math/transformq_REF.gc b/test/decompiler/reference/jak1/engine/math/transformq_REF.gc index c57365a76d..84c3016075 100644 --- a/test/decompiler/reference/jak1/engine/math/transformq_REF.gc +++ b/test/decompiler/reference/jak1/engine/math/transformq_REF.gc @@ -153,19 +153,14 @@ ;; definition for method 17 of type trsqv ;; INFO: Used lq/sq (defmethod rotate-toward-orientation! ((this trsqv) (target quaternion) (y-rate float) (z-rate float)) - (local-vars (sv-96 vector)) (let ((quat (get-quaternion this))) (let ((temp-quat (new 'stack-no-clear 'quaternion))) (when (< 0.0 z-rate) - (let ((s1-0 quaternion-from-two-vectors-max-angle!) - (s0-0 temp-quat) - ) - (set! sv-96 (vector-y-quaternion! (new 'stack-no-clear 'vector) quat)) - (let ((a2-1 (vector-y-quaternion! (new 'stack-no-clear 'vector) target)) - (a3-1 (* z-rate (seconds-per-frame))) - ) - (s1-0 s0-0 sv-96 a2-1 a3-1) - ) + (quaternion-from-two-vectors-max-angle! + temp-quat + (vector-y-quaternion! (new 'stack-no-clear 'vector) quat) + (vector-y-quaternion! (new 'stack-no-clear 'vector) target) + (* z-rate (seconds-per-frame)) ) (quaternion-normalize! (quaternion*! quat temp-quat quat)) ) diff --git a/test/decompiler/reference/jak1/engine/math/trigonometry_REF.gc b/test/decompiler/reference/jak1/engine/math/trigonometry_REF.gc index 954cb2bc2a..fefc1da8ba 100644 --- a/test/decompiler/reference/jak1/engine/math/trigonometry_REF.gc +++ b/test/decompiler/reference/jak1/engine/math/trigonometry_REF.gc @@ -159,7 +159,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)) @@ -181,11 +181,11 @@ ;; ERROR: Unsupported inline assembly instruction kind - [madd.s f12, f6, f11] (defun sin-rad ((arg0 float)) (local-vars (f12-0 float)) - (let* ((f1-0 (* arg0 arg0)) + (let* ((f1-0 (square arg0)) (f7-0 0.999998) (f8-0 -0.16666014) (f2-0 (* arg0 f1-0)) - (f3-0 (* f1-0 f1-0)) + (f3-0 (square f1-0)) (f9-0 0.008326521) (f4-0 (* f2-0 f1-0)) (f5-0 (* f3-0 f2-0)) @@ -251,14 +251,14 @@ ;; ERROR: Unsupported inline assembly instruction kind - [madd.s f12, f11, f5] (defun cos-rad ((arg0 float)) (local-vars (f12-0 float)) - (let* ((f1-0 (* arg0 arg0)) + (let* ((f1-0 (square arg0)) (f7-0 1.0) (f8-0 -0.49998003) - (f3-0 (* f1-0 f1-0)) + (f3-0 (square f1-0)) (f9-0 0.041620404) (f10-0 -0.0013636408) (f4-0 (* f3-0 f1-0)) - (f5-0 (* f3-0 f3-0)) + (f5-0 (square f3-0)) (f11-0 0.000020170546) ) (.mula.s f7-0 f7-0) @@ -449,11 +449,11 @@ ;; ERROR: Unsupported inline assembly instruction kind - [madd.s f18, f9, f17] (defun atan-series-rad ((arg0 float)) (local-vars (f18-1 float)) - (let* ((f1-0 (* arg0 arg0)) + (let* ((f1-0 (square arg0)) (f10-0 0.99999934) (f11-0 -0.33329856) (f2-0 (* arg0 f1-0)) - (f3-0 (* f1-0 f1-0)) + (f3-0 (square f1-0)) (f12-0 0.19946536) (f4-0 (* f2-0 f1-0)) (f5-0 (* f3-0 f2-0)) @@ -650,10 +650,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) ) ) @@ -677,18 +674,14 @@ (defun acos-rad ((arg0 float)) (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))) ) (- PI (atan-series-rad f0-10)) diff --git a/test/decompiler/reference/jak1/engine/math/vector_REF.gc b/test/decompiler/reference/jak1/engine/math/vector_REF.gc index d2ce210976..c0e0edfa9c 100644 --- a/test/decompiler/reference/jak1/engine/math/vector_REF.gc +++ b/test/decompiler/reference/jak1/engine/math/vector_REF.gc @@ -291,7 +291,7 @@ (when (or (!= x-diff 0.0) (!= z-diff 0.0)) (let* ((x-step (* x-diff alpha)) (z-step (* z-diff alpha)) - (step-len (sqrtf (+ (* x-step x-step) (* z-step z-step)))) + (step-len (sqrtf (+ (square x-step) (square z-step)))) ) (cond ((>= max-step step-len) @@ -319,7 +319,7 @@ (when (or (!= y-diff 0.0) (!= z-diff 0.0)) (let* ((y-step (* y-diff alpha)) (z-step (* z-diff alpha)) - (step-len (sqrtf (+ (* y-step y-step) (* z-step z-step)))) + (step-len (sqrtf (+ (square y-step) (square z-step)))) ) (cond ((>= max-step step-len) @@ -349,7 +349,7 @@ (let* ((x-step (* x-diff alpha)) (y-step (* y-diff alpha)) (z-step (* z-diff alpha)) - (step-len (sqrtf (+ (* x-step x-step) (* y-step y-step) (* z-step z-step)))) + (step-len (sqrtf (+ (square x-step) (square y-step) (square z-step)))) ) (cond ((>= max-step step-len) diff --git a/test/decompiler/reference/jak1/engine/nav/navigate-h_REF.gc b/test/decompiler/reference/jak1/engine/nav/navigate-h_REF.gc index e4ffcebf1e..211ece199f 100644 --- a/test/decompiler/reference/jak1/engine/nav/navigate-h_REF.gc +++ b/test/decompiler/reference/jak1/engine/nav/navigate-h_REF.gc @@ -403,7 +403,6 @@ ;; definition for function nav-mesh-connect ;; INFO: Used lq/sq (defbehavior nav-mesh-connect process ((proc process) (trans trsqv) (nav-cont nav-control)) - (local-vars (sv-16 type) (sv-32 symbol)) (let ((ent (-> proc entity))) (when (zero? (-> ent nav-mesh)) (let ((lookup-entity (entity-actor-lookup ent 'nav-mesh-actor 0))) @@ -417,15 +416,13 @@ ((nonzero? entity-nav-mesh) (when (zero? (-> entity-nav-mesh user-list)) (set! process-level-heap (-> self entity extra level heap)) - (let ((s1-0 (method-of-type engine new)) - (s0-0 'process-level-heap) + (set! (-> entity-nav-mesh user-list) (new + 'process-level-heap + 'engine + 'nav-engine + (res-lump-value ent 'nav-max-users int :default (the-as uint128 32)) + ) ) - (set! sv-16 engine) - (set! sv-32 'nav-engine) - (let ((a3-1 (res-lump-value ent 'nav-max-users uint128 :default (the-as uint128 32)))) - (set! (-> entity-nav-mesh user-list) (s1-0 s0-0 sv-16 sv-32 (the-as int a3-1))) - ) - ) (initialize-mesh! entity-nav-mesh) (update-route-table entity-nav-mesh) ) diff --git a/test/decompiler/reference/jak1/engine/nav/navigate_REF.gc b/test/decompiler/reference/jak1/engine/nav/navigate_REF.gc index e9f0d12a2d..bfd203480b 100644 --- a/test/decompiler/reference/jak1/engine/nav/navigate_REF.gc +++ b/test/decompiler/reference/jak1/engine/nav/navigate_REF.gc @@ -133,7 +133,6 @@ ;; INFO: Used lq/sq ;; INFO: Return type mismatch int vs none. (defun entity-nav-login ((arg0 entity-actor)) - (local-vars (sv-16 res-tag)) (let ((gp-0 (if (nonzero? (-> arg0 nav-mesh)) (-> arg0 nav-mesh) ) @@ -148,8 +147,9 @@ (update-route-table gp-0) ) (when (zero? (-> gp-0 static-sphere)) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-11 (res-lump-data arg0 'nav-mesh-sphere pointer :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-11 (res-lump-data arg0 'nav-mesh-sphere pointer :tag-ptr (& sv-16))) + ) (when v1-11 (set! (-> gp-0 static-sphere-count) (-> sv-16 elt-count)) (set! (-> gp-0 static-sphere) (the-as (inline-array nav-sphere) v1-11)) @@ -549,9 +549,8 @@ -1 (let ((s2-0 -1) (s3-0 (current-time)) - (f0-0 (-> this bounds w)) ) - (when (>= (* f0-0 f0-0) (vector-length-squared arg0)) + (when (>= (square (-> this bounds w)) (vector-length-squared arg0)) (dotimes (v1-3 4) (set! a0-6 (and (= (-> this cache v1-3 time) s3-0) (= (-> this cache v1-3 vec w) arg1) @@ -613,10 +612,7 @@ (f1-2 (- (-> t1-4 x) (-> t0-4 x))) (f2-2 (- (-> arg0 x) (-> t0-4 x))) (f3-2 (- (-> arg0 z) (-> t0-4 z))) - (f4-1 f0-1) - (f4-3 (* f4-1 f4-1)) - (f5-0 f1-2) - (f4-5 (sqrtf (+ f4-3 (* f5-0 f5-0)))) + (f4-5 (sqrtf (+ (square f0-1) (square f1-2)))) (f4-7 (/ 1.0 f4-5)) (f0-2 (* f0-1 f4-7)) (f1-3 (* f1-2 f4-7)) @@ -686,13 +682,9 @@ ) (when t0-15 (let* ((v1-28 (-> arg2 a3-5)) - (f0-11 (- (-> v1-28 x) (-> arg0 x))) - (f0-13 (* f0-11 f0-11)) - (f1-14 (- (-> v1-28 z) (-> arg0 z))) - (f0-14 (+ f0-13 (* f1-14 f1-14))) - (f1-17 arg1) + (f0-14 (+ (square (- (-> v1-28 x) (-> arg0 x))) (square (- (-> v1-28 z) (-> arg0 z))))) ) - (if (>= (* f1-17 f1-17) f0-14) + (if (>= (square arg1) f0-14) #t ) ) @@ -715,10 +707,7 @@ (f2-2 (- (-> t0-4 x) (-> a3-4 x))) (f3-2 (- (-> v1-0 x) (-> a3-4 x))) (f4-2 (- (-> v1-0 z) (-> a3-4 z))) - (f5-1 f1-1) - (f5-3 (* f5-1 f5-1)) - (f6-0 f2-2) - (f5-5 (sqrtf (+ f5-3 (* f6-0 f6-0)))) + (f5-5 (sqrtf (+ (square f1-1) (square f2-2)))) (f5-7 (/ 1.0 f5-5)) (f1-2 (* f1-1 f5-7)) (f2-3 (* f2-2 f5-7)) @@ -788,12 +777,9 @@ ) (when a3-15 (let* ((a0-2 (-> a0-1 a2-6)) - (f1-11 (- (-> a0-2 x) (-> v1-0 x))) - (f1-13 (* f1-11 f1-11)) - (f2-13 (- (-> a0-2 z) (-> v1-0 z))) - (f1-14 (+ f1-13 (* f2-13 f2-13))) + (f1-14 (+ (square (- (-> a0-2 x) (-> v1-0 x))) (square (- (-> a0-2 z) (-> v1-0 z))))) ) - (if (>= (* f0-0 f0-0) f1-14) + (if (>= (square f0-0) f1-14) #t ) ) @@ -814,64 +800,62 @@ (vf6 :class vf) (vf7 :class vf) ) - (let ((f0-1 (+ arg1 (-> this bounds w)))) - (when (>= (* f0-1 f0-1) (vector-length-squared arg0)) - (let ((s2-0 (new 'stack-no-clear 'inline-array 'nav-vertex 6)) - (f30-1 0.33333334) - ) - (countdown (s1-0 (-> this poly-count)) - (set! *debug-traverse* (+ *debug-traverse* 1)) - (let ((a0-3 (-> this poly s1-0))) - (when (not (logtest? (-> a0-3 pat) 1)) + (when (>= (square (+ arg1 (-> this bounds w))) (vector-length-squared arg0)) + (let ((s2-0 (new 'stack-no-clear 'inline-array 'nav-vertex 6)) + (f30-1 0.33333334) + ) + (countdown (s1-0 (-> this poly-count)) + (set! *debug-traverse* (+ *debug-traverse* 1)) + (let ((a0-3 (-> this poly s1-0))) + (when (not (logtest? (-> a0-3 pat) 1)) + (nop!) + (let ((v1-8 (the-as object (-> this vertex)))) (nop!) - (let ((v1-8 (the-as object (-> this vertex)))) + (let ((a2-1 (-> a0-3 vertex 0))) (nop!) - (let ((a2-1 (-> a0-3 vertex 0))) - (nop!) - (let* ((a1-1 (-> a0-3 vertex 1)) - (a2-2 (* a2-1 16)) - (a3-1 (-> a0-3 vertex 2)) - (a1-2 (* a1-1 16)) - (a0-4 (+ a2-2 (the-as int v1-8))) - (a2-3 (* a3-1 16)) - (a1-3 (+ a1-2 (the-as int v1-8))) - (v1-9 (+ a2-3 (the-as int v1-8))) - ) - (.lvf vf3 a0-4) - (let ((a0-5 f30-1)) - (.mov vf7 a0-5) - ) - (.lvf vf4 a1-3) - (.lvf vf5 v1-9) + (let* ((a1-1 (-> a0-3 vertex 1)) + (a2-2 (* a2-1 16)) + (a3-1 (-> a0-3 vertex 2)) + (a1-2 (* a1-1 16)) + (a0-4 (+ a2-2 (the-as int v1-8))) + (a2-3 (* a3-1 16)) + (a1-3 (+ a1-2 (the-as int v1-8))) + (v1-9 (+ a2-3 (the-as int v1-8))) + ) + (.lvf vf3 a0-4) + (let ((a0-5 f30-1)) + (.mov vf7 a0-5) ) + (.lvf vf4 a1-3) + (.lvf vf5 v1-9) ) ) - (.min.vf.xyz vf1 vf3 vf4) - (.lvf vf6 (&-> arg0 quad)) - (.add.y.vf.y vf7 vf3 vf4) - (.svf (&-> s2-0 0 quad) vf3) - (.max.vf.xyz vf2 vf3 vf4) - (.svf (&-> s2-0 1 quad) vf4) - (.min.vf.xyz vf1 vf1 vf5) - (.svf (&-> s2-0 2 quad) vf5) - (.max.vf.xyz vf2 vf2 vf5) - (.mul.x.vf.y vf7 vf7 vf7) - (.svf (&-> s2-0 3 quad) vf1) - (.svf (&-> s2-0 4 quad) vf2) - (.sub.y.vf.y vf7 vf6 vf7) - (.mov v1-10 vf7) - (let ((v1-11 (the-as number (sar (the-as int v1-10) 32)))) - (when (and (>= arg2 (fabs (the-as float v1-11))) - (>= (+ (-> arg0 x) arg1) (-> s2-0 3 x)) - (>= (-> s2-0 4 x) (- (-> arg0 x) arg1)) - (>= (+ (-> arg0 z) arg1) (-> s2-0 3 z)) - (>= (-> s2-0 4 z) (- (-> arg0 z) arg1)) - ) - (set! *debug-tests* (+ *debug-tests* 1)) - (if (circle-triangle-intersection? arg0 arg1 s2-0) - (return #t) - ) - ) + ) + (.min.vf.xyz vf1 vf3 vf4) + (.lvf vf6 (&-> arg0 quad)) + (.add.y.vf.y vf7 vf3 vf4) + (.svf (&-> s2-0 0 quad) vf3) + (.max.vf.xyz vf2 vf3 vf4) + (.svf (&-> s2-0 1 quad) vf4) + (.min.vf.xyz vf1 vf1 vf5) + (.svf (&-> s2-0 2 quad) vf5) + (.max.vf.xyz vf2 vf2 vf5) + (.mul.x.vf.y vf7 vf7 vf7) + (.svf (&-> s2-0 3 quad) vf1) + (.svf (&-> s2-0 4 quad) vf2) + (.sub.y.vf.y vf7 vf6 vf7) + (.mov v1-10 vf7) + (let ((v1-11 (the-as number (sar (the-as int v1-10) 32)))) + (when (and (>= arg2 (fabs (the-as float v1-11))) + (>= (+ (-> arg0 x) arg1) (-> s2-0 3 x)) + (>= (-> s2-0 4 x) (- (-> arg0 x) arg1)) + (>= (+ (-> arg0 z) arg1) (-> s2-0 3 z)) + (>= (-> s2-0 4 z) (- (-> arg0 z) arg1)) + ) + (set! *debug-tests* (+ *debug-tests* 1)) + (if (circle-triangle-intersection? arg0 arg1 s2-0) + (return #t) + ) ) ) ) @@ -1067,7 +1051,6 @@ ;; INFO: Used lq/sq ;; INFO: Return type mismatch int vs none. (defmethod nav-mesh-method-18 ((this nav-mesh) (arg0 int) (arg1 vector) (arg2 int) (arg3 (pointer int8)) (arg4 int)) - (local-vars (sv-32 int) (sv-48 uint)) (set! (-> arg3 arg2) 1) (nav-mesh-update-route-table this arg0 arg2 (the-as uint 3)) (nav-mesh-update-route-table this arg2 arg0 (the-as uint 3)) @@ -1075,34 +1058,27 @@ (when (> arg4 0) (let ((s1-1 (-> this poly arg2)) (s0-0 (new 'stack-no-clear 'vector)) + (sv-32 0) ) - (set! sv-32 0) (while (< sv-32 3) - (set! sv-48 (-> (the-as nav-poly (+ sv-32 (the-as int s1-1))) adj-poly 0)) - (when (and (!= sv-48 255) (!= 1 (-> (the-as (pointer uint8) (&+ arg3 sv-48))))) - (set! (-> arg3 sv-48) 1) - (when (not (logtest? (-> this poly sv-48 pat) 1)) - (let ((v0-3 (= (nav-mesh-lookup-route this arg0 (the-as int sv-48)) 3))) - (when (not v0-3) - (tri-centroid-local this s1-1 s0-0) - (set! *nav-update-route-table-ray-count* (+ *nav-update-route-table-ray-count* 1)) - (set! v0-3 (nav-ray-test-local? this (-> this poly arg0) arg1 s0-0)) - ) - (when v0-3 - (let* ((a0-16 this) - (t9-5 (method-of-object a0-16 nav-mesh-method-18)) - (a1-7 arg0) - (a2-6 arg1) - (t0-1 arg3) - (t1-1 (+ arg4 -1)) - ) - (t9-5 a0-16 a1-7 a2-6 (the-as int sv-48) t0-1 t1-1) + (let ((sv-48 (-> (the-as nav-poly (+ sv-32 (the-as int s1-1))) adj-poly 0))) + (when (and (!= sv-48 255) (!= 1 (-> (the-as (pointer uint8) (&+ arg3 sv-48))))) + (set! (-> arg3 sv-48) 1) + (when (not (logtest? (-> this poly sv-48 pat) 1)) + (let ((v0-3 (= (nav-mesh-lookup-route this arg0 (the-as int sv-48)) 3))) + (when (not v0-3) + (tri-centroid-local this s1-1 s0-0) + (set! *nav-update-route-table-ray-count* (+ *nav-update-route-table-ray-count* 1)) + (set! v0-3 (nav-ray-test-local? this (-> this poly arg0) arg1 s0-0)) ) + (if v0-3 + (nav-mesh-method-18 this arg0 arg1 (the-as int sv-48) arg3 (+ arg4 -1)) + ) ) ) ) ) - (set! sv-32 (+ sv-32 1)) + (+! sv-32 1) ) ) ) @@ -1159,10 +1135,7 @@ (f2-2 (- (-> t1-4 x) (-> t0-4 x))) (f3-2 (- (-> arg0 x) (-> t0-4 x))) (f4-2 (- (-> arg0 z) (-> t0-4 z))) - (f5-1 f1-1) - (f5-3 (* f5-1 f5-1)) - (f6-0 f2-2) - (f5-5 (sqrtf (+ f5-3 (* f6-0 f6-0)))) + (f5-5 (sqrtf (+ (square f1-1) (square f2-2)))) (f5-7 (/ 1.0 f5-5)) (f1-2 (* f1-1 f5-7)) (f2-3 (* f2-2 f5-7)) @@ -1234,12 +1207,10 @@ ) ) (when t0-14 - (let* ((v1-27 (-> arg2 a3-5)) - (f0-2 (- (-> v1-27 x) (-> arg0 x))) - (f0-4 (* f0-2 f0-2)) - (f1-12 (- (-> v1-27 z) (-> arg0 z))) - ) - (set! f0-0 (fmin (sqrtf (+ f0-4 (* f1-12 f1-12))) arg1)) + (let ((v1-27 (-> arg2 a3-5))) + (set! f0-0 + (fmin (sqrtf (+ (square (- (-> v1-27 x) (-> arg0 x))) (square (- (-> v1-27 z) (-> arg0 z))))) arg1) + ) ) ) ) @@ -1408,39 +1379,39 @@ ;; INFO: Used lq/sq ;; INFO: Return type mismatch int vs none. (defmethod initialize-mesh! ((this nav-mesh)) - (local-vars (sv-32 vector) (sv-48 int)) (with-pp - (set! sv-32 (new 'stack-no-clear 'vector)) - (let ((s5-0 (-> this poly-count)) + (let ((sv-32 (new 'stack-no-clear 'vector)) + (s5-0 (-> this poly-count)) (s3-0 (-> this vertex-count)) (s1-0 0) (s2-0 0) (s4-0 0) (gp-0 #f) ) - (set! sv-48 s5-0) - (while (nonzero? sv-48) - (set! sv-48 (+ sv-48 -1)) - (let ((v1-4 (-> this poly sv-48))) - (if (logtest? (-> v1-4 pat) 1) - (+! s4-0 1) + (let ((sv-48 s5-0)) + (while (nonzero? sv-48) + (+! sv-48 -1) + (let ((v1-4 (-> this poly sv-48))) + (if (logtest? (-> v1-4 pat) 1) + (+! s4-0 1) + ) + (let ((a1-2 (-> this vertex (-> v1-4 vertex 0))) + (a2-2 (-> this vertex (-> v1-4 vertex 1))) + (a3-0 (-> this vertex (-> v1-4 vertex 2))) + ) + (vector-3pt-cross! sv-32 a1-2 a2-2 a3-0) ) - (let ((a1-2 (-> this vertex (-> v1-4 vertex 0))) - (a2-2 (-> this vertex (-> v1-4 vertex 1))) - (a3-0 (-> this vertex (-> v1-4 vertex 2))) - ) - (vector-3pt-cross! sv-32 a1-2 a2-2 a3-0) ) - ) - (cond - ((= (vector-length sv-32) 0.0) - (+! s1-0 1) - ) - (else - (vector-normalize! sv-32 1.0) - (if (>= 0.0 (-> sv-32 y)) - (+! s2-0 1) - ) + (cond + ((= (vector-length sv-32) 0.0) + (+! s1-0 1) + ) + (else + (vector-normalize! sv-32 1.0) + (if (>= 0.0 (-> sv-32 y)) + (+! s2-0 1) + ) + ) ) ) ) @@ -1657,20 +1628,18 @@ ;; definition for method 17 of type nav-control ;; INFO: Used lq/sq (defmethod project-onto-nav-mesh ((this nav-control) (arg0 vector) (arg1 vector)) - (local-vars (sv-32 int)) - (let ((s5-0 (-> this mesh)) - (s3-1 (vector-! (new 'stack-no-clear 'vector) arg1 (-> this mesh origin))) - ) - (set! sv-32 0) - (let ((a1-5 (find-poly s5-0 s3-1 (-> this nearest-y-threshold) (the-as (pointer nav-control-flags) (& sv-32))))) - (cond - ((logtest? #x100000 sv-32) - (set! (-> arg0 quad) (-> arg1 quad)) + (let* ((s5-0 (-> this mesh)) + (s3-1 (vector-! (new 'stack-no-clear 'vector) arg1 (-> this mesh origin))) + (sv-32 0) + (a1-5 (find-poly s5-0 s3-1 (-> this nearest-y-threshold) (the-as (pointer nav-control-flags) (& sv-32)))) ) - (else - (closest-point-on-boundary s5-0 a1-5 arg0 s3-1) - (vector+! arg0 arg0 (-> s5-0 origin)) - ) + (cond + ((logtest? #x100000 sv-32) + (set! (-> arg0 quad) (-> arg1 quad)) + ) + (else + (closest-point-on-boundary s5-0 a1-5 arg0 s3-1) + (vector+! arg0 arg0 (-> s5-0 origin)) ) ) ) @@ -1712,15 +1681,6 @@ ;; INFO: Used lq/sq ;; INFO: Return type mismatch int vs none. (defmethod debug-draw ((this nav-control)) - (local-vars - (sv-192 vector) - (sv-208 uint) - (sv-224 int) - (sv-240 (function _varargs_ object)) - (sv-256 string) - (sv-272 int) - (sv-288 (function _varargs_ object)) - ) (let ((a0-1 this)) (when (and *display-nav-marks* (logtest? (-> a0-1 flags) (nav-control-flags display-marks))) (let ((s5-0 (-> this mesh)) @@ -1753,43 +1713,34 @@ (let ((a1-4 (-> s5-0 nodes s3-1)) (a0-15 (new 'stack-no-clear 'vector)) (v1-20 (new 'stack-no-clear 'vector)) + (sv-192 (new 'stack-no-clear 'vector)) + (s2-0 (new 'stack-no-clear 'vector)) + (s1-0 (new 'stack-no-clear 'vector)) + (s0-0 (new 'stack-no-clear 'vector)) + (sv-208 (the-as uint #x80808080)) ) - (set! sv-192 (new 'stack-no-clear 'vector)) - (let ((s2-0 (new 'stack-no-clear 'vector)) - (s1-0 (new 'stack-no-clear 'vector)) - (s0-0 (new 'stack-no-clear 'vector)) - ) - (set! sv-208 (the-as uint #x80808080)) - (set! (-> a0-15 quad) (-> a1-4 center quad)) - (set! (-> v1-20 quad) (-> a1-4 radius quad)) - (set! (-> sv-192 w) 1.0) - (set! (-> s2-0 w) 1.0) - (set! (-> s1-0 w) 1.0) - (set! (-> s0-0 w) 1.0) - (set! (-> sv-192 x) (+ (-> a0-15 x) (-> v1-20 x))) - (set! (-> sv-192 y) (+ (-> a0-15 y) (-> v1-20 y))) - (set! (-> sv-192 z) (+ (-> a0-15 z) (-> v1-20 z))) - (set! (-> s2-0 x) (+ (-> a0-15 x) (-> v1-20 x))) - (set! (-> s2-0 y) (+ (-> a0-15 y) (-> v1-20 y))) - (set! (-> s2-0 z) (- (-> a0-15 z) (-> v1-20 z))) - (set! (-> s1-0 x) (- (-> a0-15 x) (-> v1-20 x))) - (set! (-> s1-0 y) (+ (-> a0-15 y) (-> v1-20 y))) - (set! (-> s1-0 z) (- (-> a0-15 z) (-> v1-20 z))) - (set! (-> s0-0 x) (- (-> a0-15 x) (-> v1-20 x))) - (set! (-> s0-0 y) (+ (-> a0-15 y) (-> v1-20 y))) - (set! (-> s0-0 z) (+ (-> a0-15 z) (-> v1-20 z))) - (add-debug-line #t (bucket-id debug-no-zbuf) sv-192 s2-0 (the-as rgba sv-208) #f (the-as rgba -1)) - (add-debug-line #t (bucket-id debug-no-zbuf) s2-0 s1-0 (the-as rgba sv-208) #f (the-as rgba -1)) - (add-debug-line #t (bucket-id debug-no-zbuf) s1-0 s0-0 (the-as rgba sv-208) #f (the-as rgba -1)) - (let ((t9-7 add-debug-line) - (a0-19 #t) - (a1-13 68) - (t1-5 #f) - (t2-3 -1) - ) - (t9-7 a0-19 (the-as bucket-id a1-13) s0-0 sv-192 (the-as rgba sv-208) t1-5 (the-as rgba t2-3)) - ) - ) + (set! (-> a0-15 quad) (-> a1-4 center quad)) + (set! (-> v1-20 quad) (-> a1-4 radius quad)) + (set! (-> sv-192 w) 1.0) + (set! (-> s2-0 w) 1.0) + (set! (-> s1-0 w) 1.0) + (set! (-> s0-0 w) 1.0) + (set! (-> sv-192 x) (+ (-> a0-15 x) (-> v1-20 x))) + (set! (-> sv-192 y) (+ (-> a0-15 y) (-> v1-20 y))) + (set! (-> sv-192 z) (+ (-> a0-15 z) (-> v1-20 z))) + (set! (-> s2-0 x) (+ (-> a0-15 x) (-> v1-20 x))) + (set! (-> s2-0 y) (+ (-> a0-15 y) (-> v1-20 y))) + (set! (-> s2-0 z) (- (-> a0-15 z) (-> v1-20 z))) + (set! (-> s1-0 x) (- (-> a0-15 x) (-> v1-20 x))) + (set! (-> s1-0 y) (+ (-> a0-15 y) (-> v1-20 y))) + (set! (-> s1-0 z) (- (-> a0-15 z) (-> v1-20 z))) + (set! (-> s0-0 x) (- (-> a0-15 x) (-> v1-20 x))) + (set! (-> s0-0 y) (+ (-> a0-15 y) (-> v1-20 y))) + (set! (-> s0-0 z) (+ (-> a0-15 z) (-> v1-20 z))) + (add-debug-line #t (bucket-id debug-no-zbuf) sv-192 s2-0 (the-as rgba sv-208) #f (the-as rgba -1)) + (add-debug-line #t (bucket-id debug-no-zbuf) s2-0 s1-0 (the-as rgba sv-208) #f (the-as rgba -1)) + (add-debug-line #t (bucket-id debug-no-zbuf) s1-0 s0-0 (the-as rgba sv-208) #f (the-as rgba -1)) + (add-debug-line #t (bucket-id debug-no-zbuf) s0-0 sv-192 (the-as rgba sv-208) #f (the-as rgba -1)) ) ) ) @@ -1820,21 +1771,16 @@ (when (logtest? (-> this flags) (nav-control-flags navcf4)) (let ((s1-1 add-debug-text-3d) (s0-1 #t) + (sv-224 68) ) - (set! sv-224 68) - (set! sv-240 format) - (let ((a0-23 (clear *temp-string*)) - (a1-15 "~D") - (a2-13 (-> s2-1 id)) - ) - (sv-240 a0-23 a1-15 a2-13) - ) - (set! sv-256 *temp-string*) - (let ((a3-10 (tri-centroid-world s5-0 s2-1 s4-0)) - (t0-8 8) - (t1-6 #f) - ) - (s1-1 s0-1 (the-as bucket-id sv-224) sv-256 a3-10 (the-as font-color t0-8) (the-as vector2h t1-6)) + (format (clear *temp-string*) "~D" (-> s2-1 id)) + (s1-1 + s0-1 + (the-as bucket-id sv-224) + *temp-string* + (tri-centroid-world s5-0 s2-1 s4-0) + (font-color cyan) + (the-as vector2h #f) ) ) ) @@ -1858,27 +1804,16 @@ (add-debug-sphere #t (bucket-id debug) (the-as vector s2-2) (-> s2-2 trans w) *color-blue*) (let ((s1-2 add-debug-text-3d) (s0-2 #t) + (sv-272 68) ) - (set! sv-272 68) - (set! sv-288 format) - (let ((a0-32 (clear *temp-string*)) - (a1-22 "~D") - (a2-20 s3-3) - ) - (sv-288 a0-32 a1-22 a2-20) - ) - (let ((a2-21 *temp-string*) - (t0-10 8) - (t1-7 #f) - ) - (s1-2 - s0-2 - (the-as bucket-id sv-272) - a2-21 - (the-as vector s2-2) - (the-as font-color t0-10) - (the-as vector2h t1-7) - ) + (format (clear *temp-string*) "~D" s3-3) + (s1-2 + s0-2 + (the-as bucket-id sv-272) + *temp-string* + (the-as vector s2-2) + (font-color cyan) + (the-as vector2h #f) ) ) ) @@ -2025,12 +1960,11 @@ ;; INFO: Return type mismatch int vs none. (defun add-nav-sphere ((arg0 nav-control) (arg1 vector)) (when (< (-> arg0 num-spheres) (-> arg0 max-spheres)) - (let* ((s4-0 (-> arg0 sphere (-> arg0 num-spheres))) - (f1-0 (vector-vector-xz-distance-squared arg1 (-> arg0 shape trans))) - (f0-1 (+ (-> arg1 w) (-> arg0 shape nav-radius))) - (f2-2 (+ 40960.0 f0-1)) - ) - (when (< f1-0 (* f2-2 f2-2)) + (let ((s4-0 (-> arg0 sphere (-> arg0 num-spheres))) + (f1-0 (vector-vector-xz-distance-squared arg1 (-> arg0 shape trans))) + (f0-1 (+ (-> arg1 w) (-> arg0 shape nav-radius))) + ) + (when (< f1-0 (square (+ 40960.0 f0-1))) (vector-! (the-as vector s4-0) arg1 (-> arg0 mesh origin)) (set! (-> s4-0 w) f0-1) (+! (-> arg0 num-spheres) 1) @@ -2052,12 +1986,11 @@ (s3-0 arg2) ) (when (< (-> s4-0 num-spheres) (-> s4-0 max-spheres)) - (let* ((s2-0 (-> s4-0 sphere (-> s4-0 num-spheres))) - (f1-0 (vector-vector-xz-distance-squared s3-0 (-> s4-0 shape trans))) - (f0-2 (+ (-> s3-0 w) (-> s4-0 shape nav-radius))) - (f2-2 (+ 40960.0 f0-2)) - ) - (when (< f1-0 (* f2-2 f2-2)) + (let ((s2-0 (-> s4-0 sphere (-> s4-0 num-spheres))) + (f1-0 (vector-vector-xz-distance-squared s3-0 (-> s4-0 shape trans))) + (f0-2 (+ (-> s3-0 w) (-> s4-0 shape nav-radius))) + ) + (when (< f1-0 (square (+ 40960.0 f0-2))) (vector-! (the-as vector s2-0) s3-0 (-> s4-0 mesh origin)) (set! (-> s2-0 w) f0-2) (+! (-> s4-0 num-spheres) 1) @@ -2070,12 +2003,11 @@ (when (logtest? (-> arg1 nav-flags) (nav-flags navf1)) (let ((s5-1 (-> arg1 process nav extra-nav-sphere))) (when (< (-> arg0 num-spheres) (-> arg0 max-spheres)) - (let* ((s4-1 (-> arg0 sphere (-> arg0 num-spheres))) - (f1-1 (vector-vector-xz-distance-squared s5-1 (-> arg0 shape trans))) - (f0-4 (+ (-> s5-1 w) (-> arg0 shape nav-radius))) - (f2-7 (+ 40960.0 f0-4)) - ) - (when (< f1-1 (* f2-7 f2-7)) + (let ((s4-1 (-> arg0 sphere (-> arg0 num-spheres))) + (f1-1 (vector-vector-xz-distance-squared s5-1 (-> arg0 shape trans))) + (f0-4 (+ (-> s5-1 w) (-> arg0 shape nav-radius))) + ) + (when (< f1-1 (square (+ 40960.0 f0-4))) (vector-! (the-as vector s4-1) s5-1 (-> arg0 mesh origin)) (set! (-> s4-1 w) f0-4) (+! (-> arg0 num-spheres) 1) @@ -2092,15 +2024,6 @@ ;; INFO: Used lq/sq ;; INFO: Return type mismatch int vs none. (defmethod nav-control-method-28 ((this nav-control) (arg0 collide-kind)) - (local-vars - (sv-32 nav-control) - (sv-48 sphere) - (sv-64 sphere) - (sv-80 nav-control) - (sv-96 sphere) - (sv-112 vector) - (sv-128 sphere) - ) (set! (-> this num-spheres) 0) (let ((s4-0 (-> this mesh user-list)) (s3-0 (new 'stack-no-clear 'vector)) @@ -2119,17 +2042,17 @@ (when (logtest? (-> s1-0 nav-flags) (nav-flags navf0)) (set! (-> s0-0 quad) (-> s1-0 root-prim prim-core world-sphere quad)) (set! (-> s0-0 w) (-> s1-0 nav-radius)) - (set! sv-32 s2-0) - (when (< (-> sv-32 num-spheres) (-> sv-32 max-spheres)) - (set! sv-48 (-> sv-32 sphere (-> sv-32 num-spheres))) - (let* ((f1-0 (vector-vector-xz-distance-squared s0-0 (-> sv-32 shape trans))) - (f0-2 (+ (-> s0-0 w) (-> sv-32 shape nav-radius))) - (f2-2 (+ 40960.0 f0-2)) - ) - (when (< f1-0 (* f2-2 f2-2)) - (vector-! (the-as vector sv-48) s0-0 (-> sv-32 mesh origin)) - (set! (-> sv-48 w) f0-2) - (+! (-> sv-32 num-spheres) 1) + (let ((sv-32 s2-0)) + (when (< (-> sv-32 num-spheres) (-> sv-32 max-spheres)) + (let ((sv-48 (-> sv-32 sphere (-> sv-32 num-spheres))) + (f1-0 (vector-vector-xz-distance-squared s0-0 (-> sv-32 shape trans))) + (f0-2 (+ (-> s0-0 w) (-> sv-32 shape nav-radius))) + ) + (when (< f1-0 (square (+ 40960.0 f0-2))) + (vector-! (the-as vector sv-48) s0-0 (-> sv-32 mesh origin)) + (set! (-> sv-48 w) f0-2) + (+! (-> sv-32 num-spheres) 1) + ) ) ) ) @@ -2139,12 +2062,11 @@ (when (logtest? (-> s1-0 nav-flags) (nav-flags navf1)) (let ((s1-1 (-> s1-0 process nav extra-nav-sphere))) (when (< (-> s2-0 num-spheres) (-> s2-0 max-spheres)) - (let* ((s0-1 (-> s2-0 sphere (-> s2-0 num-spheres))) - (f1-1 (vector-vector-xz-distance-squared s1-1 (-> s2-0 shape trans))) - (f0-4 (+ (-> s1-1 w) (-> s2-0 shape nav-radius))) - (f2-7 (+ 40960.0 f0-4)) - ) - (when (< f1-1 (* f2-7 f2-7)) + (let ((s0-1 (-> s2-0 sphere (-> s2-0 num-spheres))) + (f1-1 (vector-vector-xz-distance-squared s1-1 (-> s2-0 shape trans))) + (f0-4 (+ (-> s1-1 w) (-> s2-0 shape nav-radius))) + ) + (when (< f1-1 (square (+ 40960.0 f0-4))) (vector-! (the-as vector s0-1) s1-1 (-> s2-0 mesh origin)) (set! (-> s0-1 w) f0-4) (+! (-> s2-0 num-spheres) 1) @@ -2162,12 +2084,11 @@ (s0-2 (-> this mesh static-sphere s2-1)) ) (when (< (-> s1-2 num-spheres) (-> s1-2 max-spheres)) - (set! sv-64 (-> s1-2 sphere (-> s1-2 num-spheres))) - (let* ((f1-2 (vector-vector-xz-distance-squared (the-as vector s0-2) (-> s1-2 shape trans))) - (f0-6 (+ (-> s0-2 trans w) (-> s1-2 shape nav-radius))) - (f2-12 (+ 40960.0 f0-6)) - ) - (when (< f1-2 (* f2-12 f2-12)) + (let ((sv-64 (-> s1-2 sphere (-> s1-2 num-spheres))) + (f1-2 (vector-vector-xz-distance-squared (the-as vector s0-2) (-> s1-2 shape trans))) + (f0-6 (+ (-> s0-2 trans w) (-> s1-2 shape nav-radius))) + ) + (when (< f1-2 (square (+ 40960.0 f0-6))) (vector-! (the-as vector sv-64) (the-as vector s0-2) (-> s1-2 mesh origin)) (set! (-> sv-64 w) f0-6) (+! (-> s1-2 num-spheres) 1) @@ -2185,39 +2106,35 @@ (let ((s0-3 (the-as collide-shape (-> (the-as connection v1-71) param3)))) (when (not (or (= s0-3 (-> this shape)) (not (logtest? arg0 (-> s0-3 root-prim prim-core collide-as))))) (let ((s1-3 this)) - (set! sv-112 s3-0) - (when (logtest? (-> s0-3 nav-flags) (nav-flags navf0)) - (set! (-> sv-112 quad) (-> s0-3 root-prim prim-core world-sphere quad)) - (set! (-> sv-112 w) (-> s0-3 nav-radius)) - (set! sv-80 s1-3) - (when (< (-> sv-80 num-spheres) (-> sv-80 max-spheres)) - (set! sv-96 (-> sv-80 sphere (-> sv-80 num-spheres))) - (let* ((f1-3 (vector-vector-xz-distance-squared sv-112 (-> sv-80 shape trans))) - (f0-9 (+ (-> sv-112 w) (-> sv-80 shape nav-radius))) - (f2-17 (+ 40960.0 f0-9)) - ) - (when (< f1-3 (* f2-17 f2-17)) - (let ((v1-94 sv-96) - (a0-47 (-> sv-80 mesh origin)) + (let ((sv-112 s3-0)) + (when (logtest? (-> s0-3 nav-flags) (nav-flags navf0)) + (set! (-> sv-112 quad) (-> s0-3 root-prim prim-core world-sphere quad)) + (set! (-> sv-112 w) (-> s0-3 nav-radius)) + (let ((sv-80 s1-3)) + (when (< (-> sv-80 num-spheres) (-> sv-80 max-spheres)) + (let ((sv-96 (-> sv-80 sphere (-> sv-80 num-spheres))) + (f1-3 (vector-vector-xz-distance-squared sv-112 (-> sv-80 shape trans))) + (f0-9 (+ (-> sv-112 w) (-> sv-80 shape nav-radius))) ) - (vector-! (the-as vector v1-94) sv-112 a0-47) + (when (< f1-3 (square (+ 40960.0 f0-9))) + (vector-! (the-as vector sv-96) sv-112 (-> sv-80 mesh origin)) + (set! (-> sv-96 w) f0-9) + (+! (-> sv-80 num-spheres) 1) + ) ) - (set! (-> sv-96 w) f0-9) - (+! (-> sv-80 num-spheres) 1) ) ) + 0 ) - 0 ) (when (logtest? (-> s0-3 nav-flags) (nav-flags navf1)) (let ((s0-4 (-> s0-3 process nav extra-nav-sphere))) (when (< (-> s1-3 num-spheres) (-> s1-3 max-spheres)) - (set! sv-128 (-> s1-3 sphere (-> s1-3 num-spheres))) - (let* ((f1-4 (vector-vector-xz-distance-squared s0-4 (-> s1-3 shape trans))) - (f0-11 (+ (-> s0-4 w) (-> s1-3 shape nav-radius))) - (f2-22 (+ 40960.0 f0-11)) - ) - (when (< f1-4 (* f2-22 f2-22)) + (let ((sv-128 (-> s1-3 sphere (-> s1-3 num-spheres))) + (f1-4 (vector-vector-xz-distance-squared s0-4 (-> s1-3 shape trans))) + (f0-11 (+ (-> s0-4 w) (-> s1-3 shape nav-radius))) + ) + (when (< f1-4 (square (+ 40960.0 f0-11))) (vector-! (the-as vector sv-128) s0-4 (-> s1-3 mesh origin)) (set! (-> sv-128 w) f0-11) (+! (-> s1-3 num-spheres) 1) @@ -2369,10 +2286,7 @@ (if (< f1-1 f0-4) (set! f0-4 f1-1) ) - (let* ((f2-0 f1-1) - (f2-2 (* f2-0 f2-0)) - (f3-0 f0-4) - (f2-4 (sqrtf (- f2-2 (* f3-0 f3-0)))) + (let* ((f2-4 (sqrtf (- (square f1-1) (square f0-4)))) (f3-4 (/ 1.0 f1-1)) (f1-3 (* f2-4 f3-4)) (f30-0 (* f0-4 f3-4)) @@ -2433,7 +2347,7 @@ ;; definition for method 32 of type nav-control ;; INFO: Used lq/sq (defmethod nav-control-method-32 ((this nav-control) (arg0 vector) (arg1 vector) (arg2 vector) (arg3 vector) (arg4 float)) - (local-vars (v0-3 symbol) (v1-38 int) (a0-29 int) (a3-7 int) (sv-208 sphere)) + (local-vars (v0-3 symbol) (v1-38 int) (a0-29 int) (a3-7 int)) (let ((gp-0 (new 'stack-no-clear 'nav-control-cfs-work))) (set! (-> gp-0 in-dir quad) (-> arg2 quad)) (set! (-> gp-0 in-dir y) 0.0) @@ -2450,12 +2364,9 @@ (set! (-> gp-0 i-inside-sphere) -1) (set! (-> gp-0 inside-sphere-dist) 0.0) (dotimes (s0-0 (-> this num-spheres)) - (set! sv-208 (-> this sphere s0-0)) - (set! (-> gp-0 dist2) (vector-vector-xz-distance-squared arg1 sv-208)) - (let ((f0-10 (-> gp-0 dist2)) - (f1-0 (-> sv-208 w)) - ) - (when (< f0-10 (* f1-0 f1-0)) + (let ((sv-208 (-> this sphere s0-0))) + (set! (-> gp-0 dist2) (vector-vector-xz-distance-squared arg1 sv-208)) + (when (< (-> gp-0 dist2) (square (-> sv-208 w))) (vector-! (-> gp-0 temp-dir 0) arg1 (the-as vector sv-208)) (set! (-> gp-0 temp-dir 0 y) 0.0) (if (< 0.0 (vector-dot (-> gp-0 temp-dir 0) (-> gp-0 in-dir))) @@ -2671,36 +2582,32 @@ ;; INFO: Used lq/sq ;; INFO: Return type mismatch vector vs none. (defmethod nav-control-method-19 ((this nav-control) (arg0 vector) (arg1 collide-shape-moving) (arg2 vector) (arg3 float)) - (local-vars (sv-48 float)) - (let ((f30-0 (* arg3 (seconds-per-frame))) - (s0-0 arg1) - (s1-0 arg2) - (s2-0 deg-diff) - ) - (set! sv-48 (y-angle s0-0)) - (let* ((a1-1 (vector-y-angle (vector-! (new 'stack-no-clear 'vector) s1-0 (-> s0-0 trans)))) - (f28-0 (s2-0 sv-48 a1-1)) + (let* ((f30-0 (* arg3 (seconds-per-frame))) + (s0-0 arg1) + (s1-0 arg2) + (f28-0 + (deg-diff (y-angle s0-0) (vector-y-angle (vector-! (new 'stack-no-clear 'vector) s1-0 (-> s0-0 trans)))) ) - (cond - ((or (vector= arg2 (-> this target-pos)) (< (fabs f28-0) 364.0889)) - (logior! (-> this flags) (nav-control-flags navcf21)) - (set! (-> arg0 quad) (-> arg2 quad)) ) - (else - (let ((s2-1 (vector-z-quaternion! (new 'stack-no-clear 'vector) (-> arg1 quat)))) - (vector-rotate-y! s2-1 s2-1 (fmax (fmin f28-0 f30-0) (- f30-0))) - (vector-normalize! s2-1 819.2) - (logclear! (-> this flags) (nav-control-flags navcf21)) - (vector+! arg0 (-> arg1 trans) s2-1) - ) - (when (or (not (nav-control-method-16 this arg0)) - (logtest? (nav-control-flags navcf17) (-> this flags)) - (not (logtest? (-> this flags) (nav-control-flags navcf10))) - ) - (logior! (-> this flags) (nav-control-flags navcf21)) - (vector-! (-> this travel) arg2 (-> arg1 trans)) - (set! (-> arg0 quad) (-> arg2 quad)) - ) + (cond + ((or (vector= arg2 (-> this target-pos)) (< (fabs f28-0) 364.0889)) + (logior! (-> this flags) (nav-control-flags navcf21)) + (set! (-> arg0 quad) (-> arg2 quad)) + ) + (else + (let ((s2-1 (vector-z-quaternion! (new 'stack-no-clear 'vector) (-> arg1 quat)))) + (vector-rotate-y! s2-1 s2-1 (fmax (fmin f28-0 f30-0) (- f30-0))) + (vector-normalize! s2-1 819.2) + (logclear! (-> this flags) (nav-control-flags navcf21)) + (vector+! arg0 (-> arg1 trans) s2-1) + ) + (when (or (not (nav-control-method-16 this arg0)) + (logtest? (nav-control-flags navcf17) (-> this flags)) + (not (logtest? (-> this flags) (nav-control-flags navcf10))) + ) + (logior! (-> this flags) (nav-control-flags navcf21)) + (vector-! (-> this travel) arg2 (-> arg1 trans)) + (set! (-> arg0 quad) (-> arg2 quad)) ) ) ) @@ -2817,81 +2724,81 @@ (arg4 float) (arg5 clip-travel-vector-to-mesh-return-info) ) - (local-vars (v1-10 symbol) (sv-96 symbol) (sv-112 int) (sv-128 int)) + (local-vars (v1-10 symbol)) (when arg5 (set! (-> arg5 found-boundary) #f) (set! (-> arg5 gap-poly) #f) ) (let ((s0-0 (new 'stack-no-clear 'nav-ray))) - (set! sv-96 (the-as symbol #f)) - (set! sv-112 0) - (set! (-> s0-0 current-poly) arg1) - (set! (-> s0-0 current-pos quad) (-> arg0 quad)) - (vector+! (-> s0-0 dest-pos) arg0 arg2) - (until sv-96 - (set! sv-128 0) - (init-ray s0-0) - (until v1-10 - (set! sv-128 (+ sv-128 1)) - (move-along-nav-ray! this s0-0) - (set! v1-10 (or (>= sv-128 15) (or (>= (-> s0-0 len) (fmax 20480.0 arg4)) (-> s0-0 terminated)))) - ) - (cond - ((and (-> s0-0 hit-boundary) (and (< (-> s0-0 len) arg4) (!= (-> s0-0 last-edge) -1) (< sv-112 1))) - (set! sv-112 (+ sv-112 1)) - (let* ((v1-22 (-> this vertex (-> s0-0 current-poly vertex (-> *edge-vert0-table* (-> s0-0 last-edge))))) - (a0-15 (-> this vertex (-> s0-0 current-poly vertex (-> *edge-vert1-table* (-> s0-0 last-edge))))) - (f2-1 (- (-> v1-22 z) (-> a0-15 z))) - (f3-0 (- (-> a0-15 x) (-> v1-22 x))) - (f1-5 (-> arg2 x)) - (f0-4 (-> arg2 z)) - (f4-0 f2-1) - (f4-2 (* f4-0 f4-0)) - (f5-0 f3-0) - (f4-4 (sqrtf (+ f4-2 (* f5-0 f5-0)))) - (f4-6 (/ 1.0 f4-4)) - (f2-2 (* f2-1 f4-6)) - (f3-1 (* f3-0 f4-6)) - ) - (when arg5 - (set! (-> arg5 found-boundary) #t) - (vector+! (-> arg5 intersection) (-> s0-0 current-pos) (-> this origin)) - (set! (-> arg5 boundary-normal x) f2-2) - (set! (-> arg5 boundary-normal y) 0.0) - (set! (-> arg5 boundary-normal z) f3-1) - (set! (-> arg5 poly) (-> s0-0 current-poly)) - (set! (-> arg5 edge) (-> s0-0 last-edge)) - (vector+! (-> arg5 vert-0) (the-as vector v1-22) (-> this origin)) - (vector+! (-> arg5 vert-1) (the-as vector a0-15) (-> this origin)) - ) - (set! (-> s0-0 dest-pos quad) (-> s0-0 current-pos quad)) - (cond - (arg3 - (let* ((f4-9 (* 1.01 (+ (* f2-2 f1-5) (* f3-1 f0-4)))) - (f1-6 (- f1-5 (* f2-2 f4-9))) - (f0-5 (- f0-4 (* f3-1 f4-9))) - ) - (+! (-> s0-0 dest-pos x) f1-6) - (+! (-> s0-0 dest-pos z) f0-5) - ) + (let ((sv-96 (the-as symbol #f)) + (sv-112 0) + ) + (set! (-> s0-0 current-poly) arg1) + (set! (-> s0-0 current-pos quad) (-> arg0 quad)) + (vector+! (-> s0-0 dest-pos) arg0 arg2) + (until sv-96 + (let ((sv-128 0)) + (init-ray s0-0) + (until v1-10 + (+! sv-128 1) + (move-along-nav-ray! this s0-0) + (set! v1-10 (or (>= sv-128 15) (or (>= (-> s0-0 len) (fmax 20480.0 arg4)) (-> s0-0 terminated)))) + ) + ) + (cond + ((and (-> s0-0 hit-boundary) (and (< (-> s0-0 len) arg4) (!= (-> s0-0 last-edge) -1) (< sv-112 1))) + (+! sv-112 1) + (let* ((v1-22 (-> this vertex (-> s0-0 current-poly vertex (-> *edge-vert0-table* (-> s0-0 last-edge))))) + (a0-15 (-> this vertex (-> s0-0 current-poly vertex (-> *edge-vert1-table* (-> s0-0 last-edge))))) + (f2-1 (- (-> v1-22 z) (-> a0-15 z))) + (f3-0 (- (-> a0-15 x) (-> v1-22 x))) + (f1-5 (-> arg2 x)) + (f0-4 (-> arg2 z)) + (f4-4 (sqrtf (+ (square f2-1) (square f3-0)))) + (f4-6 (/ 1.0 f4-4)) + (f2-2 (* f2-1 f4-6)) + (f3-1 (* f3-0 f4-6)) + ) + (when arg5 + (set! (-> arg5 found-boundary) #t) + (vector+! (-> arg5 intersection) (-> s0-0 current-pos) (-> this origin)) + (set! (-> arg5 boundary-normal x) f2-2) + (set! (-> arg5 boundary-normal y) 0.0) + (set! (-> arg5 boundary-normal z) f3-1) + (set! (-> arg5 poly) (-> s0-0 current-poly)) + (set! (-> arg5 edge) (-> s0-0 last-edge)) + (vector+! (-> arg5 vert-0) (the-as vector v1-22) (-> this origin)) + (vector+! (-> arg5 vert-1) (the-as vector a0-15) (-> this origin)) ) - (else - (set! sv-96 #t) - sv-96 + (set! (-> s0-0 dest-pos quad) (-> s0-0 current-pos quad)) + (cond + (arg3 + (let* ((f4-9 (* 1.01 (+ (* f2-2 f1-5) (* f3-1 f0-4)))) + (f1-6 (- f1-5 (* f2-2 f4-9))) + (f0-5 (- f0-4 (* f3-1 f4-9))) + ) + (+! (-> s0-0 dest-pos x) f1-6) + (+! (-> s0-0 dest-pos z) f0-5) + ) + ) + (else + (set! sv-96 #t) + sv-96 + ) ) ) ) - ) - ((-> s0-0 hit-gap) - (if arg5 - (set! (-> arg5 gap-poly) (-> s0-0 next-poly)) - ) - (set! sv-96 #t) - sv-96 - ) - (else - (set! sv-96 #t) - sv-96 + ((-> s0-0 hit-gap) + (if arg5 + (set! (-> arg5 gap-poly) (-> s0-0 next-poly)) + ) + (set! sv-96 #t) + sv-96 + ) + (else + (set! sv-96 #t) + sv-96 + ) ) ) ) @@ -2932,10 +2839,7 @@ (when (not v0-2) (let* ((f0-3 (- (-> arg2 x) (-> arg1 x))) (f1-2 (- (-> arg2 z) (-> arg1 z))) - (f2-1 f0-3) - (f2-3 (* f2-1 f2-1)) - (f3-0 f1-2) - (f2-5 (sqrtf (+ f2-3 (* f3-0 f3-0)))) + (f2-5 (sqrtf (+ (square f0-3) (square f1-2)))) (f3-3 f2-5) (f3-5 (/ 1.0 f3-3)) (f4-2 (* f3-5 (- f1-2))) @@ -2945,7 +2849,7 @@ ) (when (>= arg3 (fabs (+ (* f3-7 f4-2) (* f6-2 f5-0)))) (let ((f0-5 (+ (* f3-7 f0-3) (* f6-2 f1-2)))) - (set! v0-2 (and (>= f0-5 0.0) (>= (* f2-5 f2-5) f0-5))) + (set! v0-2 (and (>= f0-5 0.0) (>= (square f2-5) f0-5))) ) ) ) @@ -2964,10 +2868,7 @@ (s1-0 0) ) (let* ((s0-0 #f) - (f2-2 f0-1) - (f2-4 (* f2-2 f2-2)) - (f3-0 f1-2) - (f2-6 (sqrtf (+ f2-4 (* f3-0 f3-0)))) + (f2-6 (sqrtf (+ (square f0-1) (square f1-2)))) (f2-8 (/ 1.0 f2-6)) (f30-0 (* f0-1 f2-8)) (f28-0 (* f1-2 f2-8)) @@ -3030,110 +2931,107 @@ ;; definition for method 13 of type nav-control ;; INFO: Used lq/sq (defmethod nav-control-method-13 ((this nav-control) (arg0 vector) (arg1 vector)) - (local-vars - (sv-80 vector) - (sv-84 vector) - (sv-88 nav-poly) - (sv-92 vector) - (sv-96 nav-route-portal) - (sv-100 symbol) - ) - (set! sv-80 (new 'stack-no-clear 'vector)) - (set! sv-84 (new 'stack-no-clear 'vector)) - (set! sv-88 (-> this current-poly)) - (set! sv-92 (new 'stack-no-clear 'vector)) - (set! sv-96 (new 'stack-no-clear 'nav-route-portal)) - (set! sv-100 (the-as symbol #f)) - (vector-! sv-80 (-> this shape trans) (-> this mesh origin)) - (set! (-> sv-84 quad) (-> sv-80 quad)) - (let ((s4-0 (new 'stack-no-clear 'vector))) - (vector-! s4-0 arg0 (-> this mesh origin)) - (set! (-> this target-poly) (find-poly (-> this mesh) s4-0 (-> this nearest-y-threshold) (&-> this flags))) - (if (not (-> this target-poly)) - (set! (-> this target-poly) (-> this current-poly)) + (let ((sv-80 (new 'stack-no-clear 'vector)) + (sv-84 (new 'stack-no-clear 'vector)) ) - (project-point-into-tri-2d (-> this mesh) (-> this target-poly) sv-92 s4-0) - ) - (vector-! (-> this travel) sv-92 sv-80) - (setup-portal (-> this mesh) (-> this current-poly) (-> this target-poly) sv-96) - (cond - ((not (-> sv-96 next-poly)) - (set! (-> this next-poly) #f) - (set! (-> this portal 0) #f) - (set! (-> this portal 1) #f) - ) - (else - (set! (-> this next-poly) (-> sv-96 next-poly)) - (set! (-> this portal 0) (the-as nav-route-portal (-> sv-96 vertex 0))) - (set! (-> this portal 1) (the-as nav-route-portal (-> sv-96 vertex 1))) - (set! sv-100 #t) - (while (and sv-100 - (-> sv-96 next-poly) - (test-xz-point-on-line-segment? sv-80 (-> sv-96 vertex 0) (-> sv-96 vertex 1) 409.59998) - ) - (when #t - #t - (vector-segment-distance-point! sv-80 (-> sv-96 vertex 0) (-> sv-96 vertex 1) sv-84) - (vector-! (-> this travel) sv-92 sv-84) - 0 + (let ((sv-88 (-> this current-poly))) + (let ((sv-92 (new 'stack-no-clear 'vector)) + (sv-96 (new 'stack-no-clear 'nav-route-portal)) + (sv-100 (the-as symbol #f)) + ) + (vector-! sv-80 (-> this shape trans) (-> this mesh origin)) + (set! (-> sv-84 quad) (-> sv-80 quad)) + (let ((s4-0 (new 'stack-no-clear 'vector))) + (vector-! s4-0 arg0 (-> this mesh origin)) + (set! (-> this target-poly) (find-poly (-> this mesh) s4-0 (-> this nearest-y-threshold) (&-> this flags))) + (if (not (-> this target-poly)) + (set! (-> this target-poly) (-> this current-poly)) + ) + (project-point-into-tri-2d (-> this mesh) (-> this target-poly) sv-92 s4-0) ) + (vector-! (-> this travel) sv-92 sv-80) + (setup-portal (-> this mesh) (-> this current-poly) (-> this target-poly) sv-96) (cond - ((logtest? (-> sv-96 next-poly pat) 1) - (vector-segment-distance-point! sv-80 (-> sv-96 vertex 0) (-> sv-96 vertex 1) sv-92) - (vector-! (-> this travel) sv-92 sv-84) - (set! (-> this next-poly) (-> sv-96 next-poly)) - (set! sv-100 (the-as symbol #f)) - ) - ((begin - (set! sv-88 (-> sv-96 next-poly)) - (setup-portal (-> this mesh) (-> sv-96 next-poly) (-> this target-poly) sv-96) - ) - (set! (-> this next-poly) (-> sv-96 next-poly)) - (set! (-> this portal 0) (the-as nav-route-portal (-> sv-96 vertex 0))) - (set! (-> this portal 1) (the-as nav-route-portal (-> sv-96 vertex 1))) - 0 + ((not (-> sv-96 next-poly)) + (set! (-> this next-poly) #f) + (set! (-> this portal 0) #f) + (set! (-> this portal 1) #f) ) (else - (set! (-> this next-poly) #f) - (set! (-> this portal 0) #f) - (set! (-> this portal 1) #f) - (set! sv-100 (the-as symbol #f)) + (set! (-> this next-poly) (-> sv-96 next-poly)) + (set! (-> this portal 0) (the-as nav-route-portal (-> sv-96 vertex 0))) + (set! (-> this portal 1) (the-as nav-route-portal (-> sv-96 vertex 1))) + (set! sv-100 #t) + (while (and sv-100 + (-> sv-96 next-poly) + (test-xz-point-on-line-segment? sv-80 (-> sv-96 vertex 0) (-> sv-96 vertex 1) 409.59998) + ) + (when #t + #t + (vector-segment-distance-point! sv-80 (-> sv-96 vertex 0) (-> sv-96 vertex 1) sv-84) + (vector-! (-> this travel) sv-92 sv-84) + 0 + ) + (cond + ((logtest? (-> sv-96 next-poly pat) 1) + (vector-segment-distance-point! sv-80 (-> sv-96 vertex 0) (-> sv-96 vertex 1) sv-92) + (vector-! (-> this travel) sv-92 sv-84) + (set! (-> this next-poly) (-> sv-96 next-poly)) + (set! sv-100 (the-as symbol #f)) + ) + ((begin + (set! sv-88 (-> sv-96 next-poly)) + (setup-portal (-> this mesh) (-> sv-96 next-poly) (-> this target-poly) sv-96) + ) + (set! (-> this next-poly) (-> sv-96 next-poly)) + (set! (-> this portal 0) (the-as nav-route-portal (-> sv-96 vertex 0))) + (set! (-> this portal 1) (the-as nav-route-portal (-> sv-96 vertex 1))) + 0 + ) + (else + (set! (-> this next-poly) #f) + (set! (-> this portal 0) #f) + (set! (-> this portal 1) #f) + (set! sv-100 (the-as symbol #f)) + ) + ) + ) + ) + ) + (when sv-100 + (when (not (ray-ccw-line-segment-intersection? + sv-84 + (-> this travel) + (the-as vector (-> this portal 0)) + (the-as vector (-> this portal 1)) + ) + ) + (let ((a0-18 (choose-travel-portal-vertex (-> this mesh) sv-96 (-> this target-poly) sv-92))) + (vector-! (-> this travel) (the-as vector (-> sv-96 vertex a0-18)) sv-84) + ) ) ) ) - ) - ) - (when sv-100 - (when (not (ray-ccw-line-segment-intersection? - sv-84 - (-> this travel) - (the-as vector (-> this portal 0)) - (the-as vector (-> this portal 1)) - ) - ) - (let ((a0-18 (choose-travel-portal-vertex (-> this mesh) sv-96 (-> this target-poly) sv-92))) - (vector-! (-> this travel) (the-as vector (-> sv-96 vertex a0-18)) sv-84) + (nav-control-method-33 this (-> this travel) sv-84 (-> this travel) arg1 40960.0) + (let ((s5-1 (new 'stack-no-clear 'clip-travel-vector-to-mesh-return-info))) + (nav-mesh-method-16 + (-> this mesh) + sv-84 + sv-88 + (-> this travel) + (not (logtest? (-> this flags) (nav-control-flags navcf12))) + 204.8 + s5-1 + ) + (if (-> s5-1 gap-poly) + (set! (-> this next-poly) (-> s5-1 gap-poly)) + ) ) ) - ) - (nav-control-method-33 this (-> this travel) sv-84 (-> this travel) arg1 40960.0) - (let ((s5-1 (new 'stack-no-clear 'clip-travel-vector-to-mesh-return-info))) - (nav-mesh-method-16 - (-> this mesh) - sv-84 - sv-88 - (-> this travel) - (not (logtest? (-> this flags) (nav-control-flags navcf12))) - 204.8 - s5-1 + (let ((v1-82 (new 'stack-no-clear 'vector))) + (vector-! v1-82 sv-84 sv-80) + (vector+! (-> this travel) (-> this travel) v1-82) ) - (if (-> s5-1 gap-poly) - (set! (-> this next-poly) (-> s5-1 gap-poly)) - ) - ) - (let ((v1-82 (new 'stack-no-clear 'vector))) - (vector-! v1-82 sv-84 sv-80) - (vector+! (-> this travel) (-> this travel) v1-82) ) (set! (-> this travel y) 0.0) (-> this travel) diff --git a/test/decompiler/reference/jak1/engine/physics/trajectory_REF.gc b/test/decompiler/reference/jak1/engine/physics/trajectory_REF.gc index d583729294..62c5e9bb4d 100644 --- a/test/decompiler/reference/jak1/engine/physics/trajectory_REF.gc +++ b/test/decompiler/reference/jak1/engine/physics/trajectory_REF.gc @@ -51,10 +51,9 @@ ;; definition for method 13 of type trajectory ;; INFO: Return type mismatch int vs none. (defmethod setup-from-to-y-vel! ((this trajectory) (from vector) (to vector) (y-vel float) (grav float)) - (let* ((f0-0 y-vel) - (f1-3 (- (* f0-0 f0-0) (* 2.0 (- (-> from y) (-> to y)) grav))) - (f0-3 900.0) - ) + (let ((f1-3 (- (square y-vel) (* 2.0 (- (-> from y) (-> to y)) grav))) + (f0-3 900.0) + ) (when (>= f1-3 0.0) (let ((f0-4 (sqrtf f1-3))) (set! f0-3 (fmax (/ (- (- y-vel) f0-4) grav) (/ (+ (- y-vel) f0-4) grav))) diff --git a/test/decompiler/reference/jak1/engine/ps2/pad_REF.gc b/test/decompiler/reference/jak1/engine/ps2/pad_REF.gc index e005fb1f2d..455f7b5792 100644 --- a/test/decompiler/reference/jak1/engine/ps2/pad_REF.gc +++ b/test/decompiler/reference/jak1/engine/ps2/pad_REF.gc @@ -259,7 +259,7 @@ (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/jak1/engine/sound/gsound_REF.gc b/test/decompiler/reference/jak1/engine/sound/gsound_REF.gc index aab6a84ac1..39d978d7ae 100644 --- a/test/decompiler/reference/jak1/engine/sound/gsound_REF.gc +++ b/test/decompiler/reference/jak1/engine/sound/gsound_REF.gc @@ -438,10 +438,10 @@ ;; definition for function sound-play-by-name ;; INFO: Used lq/sq (defun sound-play-by-name ((name sound-name) (id sound-id) (vol int) (pitch int) (bend int) (group sound-group) (trans symbol)) - (local-vars (sv-16 sound-group)) (with-pp - (set! sv-16 group) - (let ((sound-trans (the-as structure trans))) + (let ((sv-16 group) + (sound-trans (the-as structure trans)) + ) (when *sound-player-enable* (let ((cmd (the-as sound-rpc-play (get-sound-buffer-entry)))) (set! (-> cmd command) (sound-command play)) @@ -603,108 +603,102 @@ ;; INFO: Used lq/sq ;; INFO: Return type mismatch object vs ambient-sound. (defmethod new ambient-sound ((allocation symbol) (type-to-make type) (arg0 basic) (arg1 vector)) - (local-vars - (sv-16 sound-spec) - (sv-32 sound-name) - (sv-48 (pointer float)) - (sv-52 sound-play-parms) - (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 sound-play-parms #f)) - (set! sv-56 0) - (case (-> arg0 type) - ((entity-actor entity-ambient) - (let ((bc - ((method-of-type res-lump get-property-struct) - (the-as res-lump arg0) - 'effect-name - 'exact - 0.0 - #f - (the-as (pointer res-tag) #f) - *res-static-buf* - ) - ) - ) - (when bc - (set! sv-32 (string->sound-name (symbol->string bc))) - (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 sound-play-parms #f)) + (sv-56 0) + ) + (case (-> arg0 type) + ((entity-actor entity-ambient) + (let ((bc + ((method-of-type res-lump get-property-struct) + (the-as res-lump arg0) + 'effect-name + 'exact + 0.0 + #f + (the-as (pointer res-tag) #f) + *res-static-buf* + ) + ) + ) + (when bc + (set! sv-32 (string->sound-name (symbol->string bc))) + (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 (the-as sound-play-parms v1-7)) + (set! sv-56 (the-as int (-> sv-64 elt-count))) ) - (when v1-7 - (set! sv-52 (the-as sound-play-parms v1-7)) - (set! sv-56 (the-as int (-> sv-64 elt-count))) ) ) ) ) - ) - ((sound-spec) - (set! sv-16 (the-as sound-spec arg0)) - ) - ((symbol) - (set! sv-32 (string->sound-name (symbol->string 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 ((this (object-new allocation type-to-make (the-as int (-> type-to-make size))))) - (set! (-> this spec) sv-16) - (set! (-> this name) sv-32) - (set! (-> this playing-id) (new-sound-id)) - (set! (-> this params) (the-as (pointer float) sv-52)) - (set! (-> this param-count) sv-56) - (set! (-> this entity) #f) - (set! (-> this sound-count) 1) - (set! (-> this volume) 1024) - (set! (-> this pitch) 0) - (when (and sv-16 (!= sv-16 *ambient-spec*)) - (if (logtest? (-> (the-as sound-spec sv-16) mask) (sound-mask volume)) - (set! (-> this volume) (-> (the-as sound-spec sv-16) volume)) - ) - (if (logtest? (-> (the-as sound-spec sv-16) mask) (sound-mask pitch)) - (set! (-> this pitch) (-> (the-as sound-spec sv-16) pitch-mod)) - ) - ) - (cond - (sv-48 - (set! (-> this time-base) (the-as time-frame (the int (* 300.0 (-> sv-48 0))))) - (set! (-> this time-random) (the-as time-frame (the int (* 300.0 (-> sv-48 1))))) - ) - (else - (set! (-> this time-base) -1) - ) - ) - (set! (-> this trans quad) (-> arg1 quad)) - this - ) + ((sound-spec) + (set! sv-16 (the-as sound-spec arg0)) + ) + ((symbol) + (set! sv-32 (string->sound-name (symbol->string arg0))) + ) + ((string) + (set! sv-32 (string->sound-name (the-as string arg0))) ) (else - (the-as ambient-sound 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 ((this (object-new allocation type-to-make (the-as int (-> type-to-make size))))) + (set! (-> this spec) sv-16) + (set! (-> this name) sv-32) + (set! (-> this playing-id) (new-sound-id)) + (set! (-> this params) (the-as (pointer float) sv-52)) + (set! (-> this param-count) sv-56) + (set! (-> this entity) #f) + (set! (-> this sound-count) 1) + (set! (-> this volume) 1024) + (set! (-> this pitch) 0) + (when (and sv-16 (!= sv-16 *ambient-spec*)) + (if (logtest? (-> (the-as sound-spec sv-16) mask) (sound-mask volume)) + (set! (-> this volume) (-> (the-as sound-spec sv-16) volume)) + ) + (if (logtest? (-> (the-as sound-spec sv-16) mask) (sound-mask pitch)) + (set! (-> this pitch) (-> (the-as sound-spec sv-16) pitch-mod)) + ) + ) + (cond + (sv-48 + (set! (-> this time-base) (the-as time-frame (the int (* 300.0 (-> sv-48 0))))) + (set! (-> this time-random) (the-as time-frame (the int (* 300.0 (-> sv-48 1))))) + ) + (else + (set! (-> this time-base) -1) + ) + ) + (set! (-> this trans quad) (-> arg1 quad)) + this + ) + ) + (else + (the-as ambient-sound 0) + ) ) ) ) diff --git a/test/decompiler/reference/jak1/engine/target/collide-reaction-target_REF.gc b/test/decompiler/reference/jak1/engine/target/collide-reaction-target_REF.gc index 769906c856..9f210170fc 100644 --- a/test/decompiler/reference/jak1/engine/target/collide-reaction-target_REF.gc +++ b/test/decompiler/reference/jak1/engine/target/collide-reaction-target_REF.gc @@ -28,35 +28,36 @@ ;; WARN: Stack slot offset 48 signed mismatch ;; ERROR: Failed store: (s.q! v1-20 a0-7) at op 72 (defun poly-find-nearest-edge ((arg0 vector) (arg1 (inline-array vector)) (arg2 vector) (arg3 vector)) - (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 4095996000.0) - (set! sv-40 -1) - (set! sv-48 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 4095996000.0) + (sv-40 -1) + ) + (let ((sv-48 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) + ) ) ) ) ) + (let ((v1-20 (&-> arg0 x)) + (a0-7 (-> arg1 sv-40 quad)) + ) + (s.q! v1-20 a0-7) + ) + (set! (-> (&+ arg0 16) quad) (-> arg1 (mod (+ sv-40 1) 3) quad)) ) - (let ((v1-20 (&-> arg0 x)) - (a0-7 (-> arg1 sv-40 quad)) - ) - (s.q! v1-20 a0-7) - ) - (set! (-> (&+ arg0 16) quad) (-> arg1 (mod (+ sv-40 1) 3) quad)) arg0 ) @@ -70,172 +71,165 @@ (arg4 (pointer uint64)) (arg5 (pointer symbol)) ) - (local-vars - (sv-16 vector) - (sv-20 (pointer uint32)) - (sv-24 (pointer uint64)) - (sv-28 (pointer symbol)) - (sv-32 uint) - (sv-40 uint) - (sv-48 symbol) - (sv-52 vector) - (sv-56 vector) - (sv-160 vector) - (sv-164 collide-tri-result) - (sv-208 vector) - (sv-212 vector) - (sv-272 vector) - (sv-276 vector) - ) - (set! sv-16 arg2) - (set! sv-20 arg3) - (set! sv-24 arg4) - (set! sv-28 arg5) - (set! sv-32 (-> arg3 0)) - (set! sv-40 (-> arg4 0)) - (set! sv-48 (-> arg5 0)) - (set! sv-52 (-> arg0 unknown-vector60)) - (set! sv-56 (vector-cross! (-> arg0 unknown-vector-coverage-2) (-> arg0 poly-normal) sv-16)) - (vector-normalize! sv-56 1.0) - (if (>= (fabs (vector-dot (-> arg0 dynam gravity-normal) sv-56)) 0.866) - (set! sv-32 (logior sv-32 512)) - ) - (vector-cross! sv-52 sv-16 sv-56) - (if (< 0.0 (vector-dot (-> arg0 dynam gravity-normal) sv-52)) - (vector-negate! sv-52 sv-52) - ) - (vector-normalize! sv-52 1.0) - (set! sv-160 (vector-flatten! (-> arg0 unknown-vector-coverage-3) sv-52 (-> arg0 dynam gravity-normal))) - (set! sv-164 (new 'stack 'collide-tri-result)) - (vector-normalize! sv-160 1.0) - (if (< (vector-dot sv-160 sv-16) 0.0) - (vector-negate! sv-160 sv-160) - ) - (set! (-> arg0 unknown-float-coverage-0) 4095996000.0) - (set! (-> arg0 unknown-float-coverage-2) 4095996000.0) - (set! sv-208 (vector+float*! (new 'stack-no-clear 'vector) (-> arg1 best-tri intersect) sv-160 2867.2)) - (set! sv-212 (vector-normalize-copy! (new 'stack-no-clear 'vector) (-> arg0 dynam gravity-normal) -20480.0)) - (vector+float*! sv-212 sv-212 sv-160 4096.0) - (when (>= (probe-using-line-sphere - *collide-cache* - sv-208 - sv-212 - 409.6 - (-> arg1 best-from-prim collide-with) - sv-164 - (new 'static 'pat-surface :noentity #x1) - ) - 0.0 + (let ((sv-16 arg2) + (sv-20 arg3) + (sv-24 arg4) + (sv-28 arg5) + (sv-32 (-> arg3 0)) + (sv-40 (-> arg4 0)) + (sv-48 (-> arg5 0)) + ) + (let ((sv-52 (-> arg0 unknown-vector60))) + (let ((sv-56 (vector-cross! (-> arg0 unknown-vector-coverage-2) (-> arg0 poly-normal) sv-16))) + (vector-normalize! sv-56 1.0) + (if (>= (fabs (vector-dot (-> arg0 dynam gravity-normal) sv-56)) 0.866) + (logior! sv-32 512) ) - (set! (-> arg0 unknown-float-coverage-0) - (vector-dot - (-> arg0 dynam gravity-normal) - (vector-! (new 'stack-no-clear 'vector) (-> arg1 best-tri intersect) (-> sv-164 intersect)) + (vector-cross! sv-52 sv-16 sv-56) + ) + (if (< 0.0 (vector-dot (-> arg0 dynam gravity-normal) sv-52)) + (vector-negate! sv-52 sv-52) + ) + (vector-normalize! sv-52 1.0) + (let ((sv-160 (vector-flatten! (-> arg0 unknown-vector-coverage-3) sv-52 (-> arg0 dynam gravity-normal))) + (sv-164 (new 'stack 'collide-tri-result)) + ) + (vector-normalize! sv-160 1.0) + (if (< (vector-dot sv-160 sv-16) 0.0) + (vector-negate! sv-160 sv-160) + ) + (set! (-> arg0 unknown-float-coverage-0) 4095996000.0) + (set! (-> arg0 unknown-float-coverage-2) 4095996000.0) + (let ((sv-208 (vector+float*! (new 'stack-no-clear 'vector) (-> arg1 best-tri intersect) sv-160 2867.2)) + (sv-212 (vector-normalize-copy! (new 'stack-no-clear 'vector) (-> arg0 dynam gravity-normal) -20480.0)) + ) + (vector+float*! sv-212 sv-212 sv-160 4096.0) + (when (>= (probe-using-line-sphere + *collide-cache* + sv-208 + sv-212 + 409.6 + (-> arg1 best-from-prim collide-with) + sv-164 + (new 'static 'pat-surface :noentity #x1) + ) + 0.0 + ) + (set! (-> arg0 unknown-float-coverage-0) + (vector-dot + (-> arg0 dynam gravity-normal) + (vector-! (new 'stack-no-clear 'vector) (-> arg1 best-tri intersect) (-> sv-164 intersect)) + ) + ) + (set! (-> arg0 unknown-float-coverage-1) (the-as float (-> sv-164 pat))) + (set! (-> arg0 unknown-vector-coverage-0 quad) (-> sv-164 normal quad)) + 0 ) ) - (set! (-> arg0 unknown-float-coverage-1) (the-as float (-> sv-164 pat))) - (set! (-> arg0 unknown-vector-coverage-0 quad) (-> sv-164 normal quad)) - 0 - ) - (set! sv-272 (vector+float*! - (new 'stack-no-clear 'vector) - (-> arg1 best-tri intersect) - (-> arg0 dynam gravity-normal) - 819.2 - ) - ) - (set! sv-276 (vector-normalize-copy! (new 'stack-no-clear 'vector) (-> arg0 dynam gravity-normal) -20480.0)) - (vector+float*! sv-272 sv-272 sv-160 -819.2) - (vector+float*! sv-276 sv-276 sv-160 -4096.0) - (when (>= (probe-using-line-sphere - *collide-cache* - sv-272 - sv-276 - 409.6 - (-> arg1 best-from-prim collide-with) - sv-164 - (new 'static 'pat-surface :noentity #x1) - ) - 0.0 - ) - (set! (-> arg0 unknown-float-coverage-2) (vector-vector-distance sv-272 (-> sv-164 intersect))) - (set! (-> arg0 unknown-u32-coverage-0) (the-as uint (-> sv-164 pat))) - (set! (-> arg0 unknown-vector-coverage-1 quad) (-> sv-164 normal quad)) - 0 - ) - (when (and (not (logtest? sv-32 512)) - (and (or (< (* 1.25 (-> arg1 best-from-prim local-sphere w)) (-> arg0 unknown-float-coverage-0)) - (= (shr (shl (the-as int (-> arg0 unknown-float-coverage-1)) 58) 61) 1) + (let ((sv-272 (vector+float*! + (new 'stack-no-clear 'vector) + (-> arg1 best-tri intersect) + (-> arg0 dynam gravity-normal) + 819.2 + ) ) - (and (< (-> arg0 unknown-float-coverage-2) (* 2.0 (-> arg1 best-from-prim local-sphere w))) - (zero? (shr (shl (-> arg0 unknown-u32-coverage-0) 58) 61)) + (sv-276 (vector-normalize-copy! (new 'stack-no-clear 'vector) (-> arg0 dynam gravity-normal) -20480.0)) + ) + (vector+float*! sv-272 sv-272 sv-160 -819.2) + (vector+float*! sv-276 sv-276 sv-160 -4096.0) + (when (>= (probe-using-line-sphere + *collide-cache* + sv-272 + sv-276 + 409.6 + (-> arg1 best-from-prim collide-with) + sv-164 + (new 'static 'pat-surface :noentity #x1) + ) + 0.0 + ) + (set! (-> arg0 unknown-float-coverage-2) (vector-vector-distance sv-272 (-> sv-164 intersect))) + (set! (-> arg0 unknown-u32-coverage-0) (the-as uint (-> sv-164 pat))) + (set! (-> arg0 unknown-vector-coverage-1 quad) (-> sv-164 normal quad)) + 0 + ) + ) + ) + (when (and (not (logtest? sv-32 512)) + (and (or (< (* 1.25 (-> arg1 best-from-prim local-sphere w)) (-> arg0 unknown-float-coverage-0)) + (= (shr (shl (the-as int (-> arg0 unknown-float-coverage-1)) 58) 61) 1) + ) + (and (< (-> arg0 unknown-float-coverage-2) (* 2.0 (-> arg1 best-from-prim local-sphere w))) + (zero? (shr (shl (-> arg0 unknown-u32-coverage-0) 58) 61)) + ) + ) + ) + (logior! sv-32 128) + (set! (-> arg0 unknown-dword-coverage) (the-as int (current-time))) + (logior! sv-40 128) + (set-time! (-> arg0 unknown-dword21)) + (let ((f30-0 (vector-dot sv-52 (-> arg0 unknown-vector22))) + (f0-21 (if (logtest? sv-32 2) + (cos (- 16384.0 (acos (-> arg0 coverage)))) + (-> arg0 coverage) + ) + ) + (f1-11 (vector-dot + (-> arg0 dynam gravity-normal) + (vector-! (new 'stack-no-clear 'vector) (-> arg0 trans) (-> arg1 best-tri intersect)) + ) + ) + ) + (if (or (not (logtest? sv-32 32)) (< 0.5 f0-21)) + (set! sv-48 (the-as symbol #f)) + ) + (when (and (or (and (< f0-21 0.95) (>= f30-0 0.0)) + (and (logtest? sv-32 32) (< f0-21 0.3)) + (< f1-11 (/ (-> arg1 best-from-prim local-sphere w) -4)) + ) + (>= (vector-dot sv-52 sv-16) -0.000001) + ) + (set! (-> arg0 surf) *edge-surface*) + (logior! sv-32 1024) + (set! sv-48 (the-as symbol #f)) + (when (logtest? sv-32 32) + (set! sv-48 #t) + (logior! sv-32 4096) + ) + ) + ) + ) + ) + (if (< (-> arg0 surface-angle) 0.0) + (set! sv-48 #t) + ) + (when sv-48 + (cond + ((and (or (= (-> arg0 poly-pat mode) (pat-mode ground)) + (and (logtest? sv-32 8) + (>= (* 1.25 (-> arg1 best-from-prim local-sphere w)) (-> arg0 unknown-float-coverage-0)) + (zero? (shr (shl (the-as int (-> arg0 unknown-float-coverage-1)) 58) 61)) + (< 0.3 (fabs (-> arg0 surface-angle))) ) ) - ) - (set! sv-32 (logior sv-32 128)) - (set! (-> arg0 unknown-dword-coverage) (the-as int (current-time))) - (set! sv-40 (logior sv-40 128)) - (set-time! (-> arg0 unknown-dword21)) - (let ((f30-0 (vector-dot sv-52 (-> arg0 unknown-vector22))) - (f0-21 (if (logtest? sv-32 2) - (cos (- 16384.0 (acos (-> arg0 coverage)))) - (-> arg0 coverage) - ) - ) - (f1-11 (vector-dot - (-> arg0 dynam gravity-normal) - (vector-! (new 'stack-no-clear 'vector) (-> arg0 trans) (-> arg1 best-tri intersect)) - ) - ) - ) - (if (or (not (logtest? sv-32 32)) (< 0.5 f0-21)) - (set! sv-48 (the-as symbol #f)) - ) - (when (and (or (and (< f0-21 0.95) (>= f30-0 0.0)) - (and (logtest? sv-32 32) (< f0-21 0.3)) - (< f1-11 (/ (-> arg1 best-from-prim local-sphere w) -4)) - ) - (>= (vector-dot sv-52 sv-16) -0.000001) - ) - (set! (-> arg0 surf) *edge-surface*) - (set! sv-32 (logior sv-32 1024)) - (set! sv-48 (the-as symbol #f)) - (when (logtest? sv-32 32) - (set! sv-48 #t) - (set! sv-32 (logior sv-32 4096)) + (not (logtest? sv-32 128)) + ) + (logior! sv-32 64) + (logior! sv-40 128) + (set-time! (-> arg0 unknown-dword21)) + (set! sv-48 (the-as symbol #f)) + ) + (#t + (logior! sv-32 64) + (logior! sv-40 128) + (set-time! (-> arg0 unknown-dword21)) ) ) ) + (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 (= (-> arg0 poly-pat mode) (pat-mode ground)) - (and (logtest? sv-32 8) - (>= (* 1.25 (-> arg1 best-from-prim local-sphere w)) (-> arg0 unknown-float-coverage-0)) - (zero? (shr (shl (the-as int (-> arg0 unknown-float-coverage-1)) 58) 61)) - (< 0.3 (fabs (-> arg0 surface-angle))) - ) - ) - (not (logtest? sv-32 128)) - ) - (set! sv-32 (logior sv-32 64)) - (set! sv-40 (logior sv-40 128)) - (set-time! (-> arg0 unknown-dword21)) - (set! sv-48 (the-as symbol #f)) - ) - (#t - (set! sv-32 (logior sv-32 64)) - (set! sv-40 (logior sv-40 128)) - (set-time! (-> arg0 unknown-dword21)) - ) - ) - ) - (set! (-> sv-24 0) sv-40) - (set! (-> sv-20 0) sv-32) - (set! (-> sv-28 0) sv-48) (the-as uint 0) ) @@ -243,198 +237,200 @@ ;; INFO: Used lq/sq ;; INFO: Return type mismatch int vs cshape-moving-flags. (defun target-collision-reaction ((arg0 control-info) (arg1 collide-shape-intersect) (arg2 vector) (arg3 vector)) - (local-vars (sv-80 vector) (sv-84 vector) (sv-88 matrix) (sv-96 int) (sv-104 int) (sv-160 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 vector a0-1 quad) (the-as uint128 0)) ) - (set! sv-88 v1-2) - ) - (set! sv-96 0) - (set! sv-104 0) - (set! (-> sv-88 vector 0 quad) (-> arg3 quad)) - (set! (-> sv-88 vector 1 quad) (-> arg3 quad)) - (let ((a1-3 (new 'stack-no-clear 'vector))) - (vector-float*! a1-3 (-> arg1 move-vec) (-> arg1 best-u)) - (move-by-vector! arg0 a1-3) - ) - (set-and-handle-pat! arg0 (-> arg1 best-tri pat)) - (if (= (-> arg0 poly-pat mode) (pat-mode wall)) - (set! sv-104 (logior sv-104 1)) - ) - (if (logtest? (-> arg0 unknown-surface00 flags) (surface-flags jump)) - (set! sv-104 (logior sv-104 32)) - ) - (let ((v1-23 (new 'stack-no-clear 'vector))) - (set! (-> v1-23 quad) (-> arg1 best-from-prim prim-core world-sphere quad)) - (vector-! sv-80 v1-23 (-> arg1 best-tri intersect)) - ) - (vector-normalize! sv-80 1.0) - (set! (-> arg0 coverage) (vector-dot sv-80 (-> arg1 best-tri normal))) - (when (< (-> arg0 coverage) 0.0) - (set! (-> arg0 coverage) 0.0) - (vector-flatten! sv-80 sv-80 (-> arg1 best-tri normal)) - (vector-normalize! sv-80 1.0) - ) - (if (< (-> arg0 coverage) 0.9999) - (set! sv-104 (logior sv-104 24)) - ) - (let ((v1-33 (-> sv-80 quad))) - (set! (-> sv-84 quad) v1-33) - ) - (if (= (-> arg1 best-u) 0.0) - (move-by-vector! arg0 (vector-normalize-copy! (new-stack-vector0) sv-84 3.0)) - ) - (set! (-> arg0 poly-normal quad) (-> arg1 best-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 16)) - ) - (if (< (-> arg0 poly-angle) 0.0) - (set! sv-96 (logior sv-96 #x4000)) - ) - (set! sv-160 (< (fabs (-> arg0 surface-angle)) (-> *pat-mode-info* (-> arg0 cur-pat mode) wall-angle))) - (if (and sv-160 (and (= (-> arg0 unknown-surface00 mode) 'dive) (< 0.2 (fabs (-> arg0 surface-angle))))) - (set! sv-160 (the-as symbol #f)) - ) - (if sv-160 - (set! sv-104 (logior sv-104 2)) - ) - (if (logtest? sv-104 8) - (target-collision-low-coverage - arg0 - arg1 - sv-84 - (the-as (pointer uint32) (& sv-104)) - (the-as (pointer uint64) (& sv-96)) - (& sv-160) - ) - ) - (when (not (logtest? (-> arg0 prev-status) (cshape-moving-flags onsurf))) - (set! (-> arg0 ground-impact-vel) (- (vector-dot (-> arg0 transv) (-> arg0 dynam gravity-normal)))) - (set! sv-96 (logior sv-96 2048)) - (when (not sv-160) - (let ((f30-0 (- 1.0 (-> arg0 surf impact-fric)))) - (when (< f30-0 1.0) - (let ((s3-1 (new-stack-vector0)) - (f28-0 (vector-dot (-> arg0 dynam gravity-normal) (-> sv-88 vector 0))) - ) - 0.0 - (vector-! s3-1 (-> sv-88 vector 0) (vector-float*! s3-1 (-> arg0 dynam gravity-normal) f28-0)) - (let* ((f0-20 (vector-length s3-1)) - (f1-9 f0-20) - ) - (if (< f28-0 0.0) - (set! f28-0 (* f28-0 f30-0)) - ) - (vector+! - (-> sv-88 vector 0) - (vector-float*! (-> sv-88 vector 0) (-> arg0 dynam gravity-normal) f28-0) - (vector-float*! s3-1 s3-1 (/ f0-20 f1-9)) + (let ((sv-88 v1-2) + (sv-96 0) + ) + (let ((sv-104 0)) + (set! (-> sv-88 vector 0 quad) (-> arg3 quad)) + (set! (-> sv-88 vector 1 quad) (-> arg3 quad)) + (let ((a1-3 (new 'stack-no-clear 'vector))) + (vector-float*! a1-3 (-> arg1 move-vec) (-> arg1 best-u)) + (move-by-vector! arg0 a1-3) + ) + (set-and-handle-pat! arg0 (-> arg1 best-tri pat)) + (if (= (-> arg0 poly-pat mode) (pat-mode wall)) + (logior! sv-104 1) + ) + (if (logtest? (-> arg0 unknown-surface00 flags) (surface-flags jump)) + (logior! sv-104 32) + ) + (let ((v1-23 (new 'stack-no-clear 'vector))) + (set! (-> v1-23 quad) (-> arg1 best-from-prim prim-core world-sphere quad)) + (vector-! sv-80 v1-23 (-> arg1 best-tri intersect)) + ) + (vector-normalize! sv-80 1.0) + (set! (-> arg0 coverage) (vector-dot sv-80 (-> arg1 best-tri normal))) + (when (< (-> arg0 coverage) 0.0) + (set! (-> arg0 coverage) 0.0) + (vector-flatten! sv-80 sv-80 (-> arg1 best-tri normal)) + (vector-normalize! sv-80 1.0) + ) + (if (< (-> arg0 coverage) 0.9999) + (logior! sv-104 24) + ) + (set! (-> sv-84 quad) (-> sv-80 quad)) + (if (= (-> arg1 best-u) 0.0) + (move-by-vector! arg0 (vector-normalize-copy! (new-stack-vector0) sv-84 3.0)) + ) + (set! (-> arg0 poly-normal quad) (-> arg1 best-tri normal quad)) + (collide-shape-moving-angle-set! arg0 sv-84 (-> sv-88 vector 0)) + (if (< (-> arg0 poly-angle) -0.2) + (logior! sv-96 16) + ) + (if (< (-> arg0 poly-angle) 0.0) + (logior! sv-96 #x4000) + ) + (let ((sv-160 (< (fabs (-> arg0 surface-angle)) (-> *pat-mode-info* (-> arg0 cur-pat mode) wall-angle)))) + (if (and sv-160 (and (= (-> arg0 unknown-surface00 mode) 'dive) (< 0.2 (fabs (-> arg0 surface-angle))))) + (set! sv-160 (the-as symbol #f)) + ) + (if sv-160 + (logior! sv-104 2) + ) + (if (logtest? sv-104 8) + (target-collision-low-coverage + arg0 + arg1 + sv-84 + (the-as (pointer uint32) (& sv-104)) + (the-as (pointer uint64) (& sv-96)) + (& sv-160) ) ) - ) - ) - ) - ) - ) - (set! sv-96 (logior sv-96 4)) - (cond - ((-> arg1 best-to-prim) - (set! sv-96 (logior sv-96 32)) - (set! (-> arg0 unknown-vector72 quad) (-> arg1 best-tri intersect quad)) - (set! (-> arg0 unknown-vector73 quad) (-> arg0 poly-normal quad)) - (set! (-> arg0 unknown-handle00) (process->handle (-> arg1 best-to-prim cshape process))) - ) - ((= (-> arg0 poly-pat material) (pat-material waterbottom)) - ) - (else - (set! sv-96 (logior sv-96 4096)) - ) - ) - (cond - (sv-160 - (set! sv-104 (logior sv-104 4)) - (set! sv-96 (logior sv-96 8)) - (set! (-> arg0 cur-pat mode) 1) - (set! (-> arg0 unknown-vector70 quad) (-> arg1 best-tri intersect quad)) - (set! (-> arg0 unknown-vector71 quad) (-> arg0 poly-normal quad)) - (set! (-> arg0 unknown-vector121 quad) (-> sv-84 quad)) - (set! (-> arg0 wall-pat) (-> arg1 best-tri pat)) - (-> arg0 history-data (logand (+ (-> arg0 unknown-halfword00) 127) 127)) - (cond - (#f - (sound-play "cursor-options") - (set! sv-104 (logior sv-104 8192)) - (vector-reflect-flat-above! arg2 (-> sv-88 vector 0) sv-84) - ) - (else - (vector-reflect-flat! arg2 (-> sv-88 vector 0) sv-84) - ) - ) - (cond - ((not (and (>= (-> arg1 best-from-prim local-sphere w) - (vector-dot - (-> arg0 ground-poly-normal) - (vector-! (new 'stack-no-clear 'vector) (-> arg1 best-tri intersect) (-> arg0 ground-touch-point)) - ) - ) - (and (< 0.0 (vector-dot (-> arg0 ground-poly-normal) arg2)) - (not (time-elapsed? (-> arg0 unknown-dword10) (seconds 0.3))) - (not (logtest? sv-104 32)) + (when (not (logtest? (-> arg0 prev-status) (cshape-moving-flags onsurf))) + (set! (-> arg0 ground-impact-vel) (- (vector-dot (-> arg0 transv) (-> arg0 dynam gravity-normal)))) + (logior! sv-96 2048) + (when (not sv-160) + (let ((f30-0 (- 1.0 (-> arg0 surf impact-fric)))) + (when (< f30-0 1.0) + (let ((s3-1 (new-stack-vector0)) + (f28-0 (vector-dot (-> arg0 dynam gravity-normal) (-> sv-88 vector 0))) ) - ) + 0.0 + (vector-! s3-1 (-> sv-88 vector 0) (vector-float*! s3-1 (-> arg0 dynam gravity-normal) f28-0)) + (let* ((f0-20 (vector-length s3-1)) + (f1-9 f0-20) + ) + (if (< f28-0 0.0) + (set! f28-0 (* f28-0 f30-0)) + ) + (vector+! + (-> sv-88 vector 0) + (vector-float*! (-> sv-88 vector 0) (-> arg0 dynam gravity-normal) f28-0) + (vector-float*! s3-1 s3-1 (/ f0-20 f1-9)) + ) + ) + ) + ) + ) ) - ) - (else - (set! sv-104 (logior sv-104 256)) - (set! sv-104 (logand -65 sv-104)) - (let ((s3-4 (vector-cross! (new 'stack-no-clear 'vector) (-> arg0 poly-normal) (-> arg0 ground-poly-normal)))) - (vector-normalize! s3-4 1.0) - (vector-float*! arg2 s3-4 (vector-dot (-> sv-88 vector 0) s3-4)) ) - (vector+! arg2 arg2 (-> arg0 poly-normal)) - ) - ) - ) - (else - (set! sv-96 (logior sv-96 1)) - (set! (-> arg0 cur-pat mode) 0) - (if (= (-> arg1 best-from-prim prim-id) 6) - (set! (-> arg0 local-normal quad) (-> sv-84 quad)) - ) - (vector-reflect-flat! arg2 (-> sv-88 vector 0) sv-84) - (vector+! arg2 arg2 sv-84) - (set! (-> arg0 ground-touch-point w) 0.0) - (when (not (or (logtest? sv-104 15) (nonzero? (-> arg0 poly-pat event)))) - (set! sv-96 (logior sv-96 2)) - (set! (-> arg0 ground-poly-normal quad) (-> arg0 poly-normal quad)) - (set! (-> arg0 unknown-vector53 quad) (-> sv-84 quad)) - (set! (-> arg0 unknown-float60) (vector-dot sv-84 (-> arg0 dynam gravity-normal))) - (set-time! (-> arg0 unknown-dword10)) - (set! (-> arg0 ground-pat) (-> arg0 poly-pat)) - (set! (-> arg0 ground-touch-point quad) (-> arg1 best-tri intersect quad)) - (set! (-> arg0 unknown-vector55 quad) (-> arg1 best-from-prim prim-core world-sphere quad)) - (set! sv-104 (logior sv-104 2048)) - (if (= (-> arg0 poly-pat material) (pat-material waterbottom)) - (set! sv-96 (logior sv-96 1024)) + (logior! sv-96 4) + (cond + ((-> arg1 best-to-prim) + (logior! sv-96 32) + (set! (-> arg0 unknown-vector72 quad) (-> arg1 best-tri intersect quad)) + (set! (-> arg0 unknown-vector73 quad) (-> arg0 poly-normal quad)) + (set! (-> arg0 unknown-handle00) (process->handle (-> arg1 best-to-prim cshape process))) + ) + ((= (-> arg0 poly-pat material) (pat-material waterbottom)) + ) + (else + (logior! sv-96 4096) + ) ) + (cond + (sv-160 + (logior! sv-104 4) + (logior! sv-96 8) + (set! (-> arg0 cur-pat mode) 1) + (set! (-> arg0 unknown-vector70 quad) (-> arg1 best-tri intersect quad)) + (set! (-> arg0 unknown-vector71 quad) (-> arg0 poly-normal quad)) + (set! (-> arg0 unknown-vector121 quad) (-> sv-84 quad)) + (set! (-> arg0 wall-pat) (-> arg1 best-tri pat)) + (-> arg0 history-data (logand (+ (-> arg0 unknown-halfword00) 127) 127)) + (cond + (#f + (sound-play "cursor-options") + (logior! sv-104 8192) + (vector-reflect-flat-above! arg2 (-> sv-88 vector 0) sv-84) + ) + (else + (vector-reflect-flat! arg2 (-> sv-88 vector 0) sv-84) + ) + ) + (cond + ((not (and (>= (-> arg1 best-from-prim local-sphere w) + (vector-dot + (-> arg0 ground-poly-normal) + (vector-! (new 'stack-no-clear 'vector) (-> arg1 best-tri intersect) (-> arg0 ground-touch-point)) + ) + ) + (and (< 0.0 (vector-dot (-> arg0 ground-poly-normal) arg2)) + (not (time-elapsed? (-> arg0 unknown-dword10) (seconds 0.3))) + (not (logtest? sv-104 32)) + ) + ) + ) + ) + (else + (logior! sv-104 256) + (logand! sv-104 -65) + (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 + (logior! sv-96 1) + (set! (-> arg0 cur-pat mode) 0) + (if (= (-> arg1 best-from-prim prim-id) 6) + (set! (-> arg0 local-normal quad) (-> sv-84 quad)) + ) + (vector-reflect-flat! arg2 (-> sv-88 vector 0) sv-84) + (vector+! arg2 arg2 sv-84) + (set! (-> arg0 ground-touch-point w) 0.0) + (when (not (or (logtest? sv-104 15) (nonzero? (-> arg0 poly-pat event)))) + (logior! sv-96 2) + (set! (-> arg0 ground-poly-normal quad) (-> arg0 poly-normal quad)) + (set! (-> arg0 unknown-vector53 quad) (-> sv-84 quad)) + (set! (-> arg0 unknown-float60) (vector-dot sv-84 (-> arg0 dynam gravity-normal))) + (set-time! (-> arg0 unknown-dword10)) + (set! (-> arg0 ground-pat) (-> arg0 poly-pat)) + (set! (-> arg0 ground-touch-point quad) (-> arg1 best-tri intersect quad)) + (set! (-> arg0 unknown-vector55 quad) (-> arg1 best-from-prim prim-core world-sphere quad)) + (logior! sv-104 2048) + (if (= (-> arg0 poly-pat material) (pat-material waterbottom)) + (logior! sv-96 1024) + ) + ) + ) + ) + ) + (logior! (-> arg0 status) sv-96) + (set! (-> arg0 reaction-flag) (the-as cshape-reaction-flags sv-104)) ) + (update! + (-> arg0 history-data (-> arg0 unknown-halfword00)) + arg0 + (-> arg1 best-tri intersect) + (-> sv-88 vector 1) + arg2 + ) + (set! (-> arg0 unknown-halfword00) (logand (+ (-> arg0 unknown-halfword00) 1) 127)) + (the-as cshape-moving-flags sv-96) ) ) - (logior! (-> arg0 status) sv-96) - (set! (-> arg0 reaction-flag) (the-as cshape-reaction-flags sv-104)) - (update! - (-> arg0 history-data (-> arg0 unknown-halfword00)) - arg0 - (-> arg1 best-tri intersect) - (-> sv-88 vector 1) - arg2 - ) - (set! (-> arg0 unknown-halfword00) (logand (+ (-> arg0 unknown-halfword00) 1) 127)) - (the-as cshape-moving-flags sv-96) ) ;; definition for function target-collision-no-reaction diff --git a/test/decompiler/reference/jak1/engine/target/logic-target_REF.gc b/test/decompiler/reference/jak1/engine/target/logic-target_REF.gc index b73e901e2f..20e2b9755a 100644 --- a/test/decompiler/reference/jak1/engine/target/logic-target_REF.gc +++ b/test/decompiler/reference/jak1/engine/target/logic-target_REF.gc @@ -263,49 +263,30 @@ ;; WARN: Stack slot load at 160 mismatch: defined as size 4, got size 16 ;; WARN: Stack slot load at 176 mismatch: defined as size 4, got size 16 (defun-debug target-print-stats ((arg0 target) (arg1 symbol)) - (local-vars - (sv-64 string) - (sv-80 string) - (sv-96 string) - (sv-112 string) - (sv-128 string) - (sv-144 string) - (sv-160 float) - (sv-176 float) - ) (when (and *display-ground-stats* arg0) - (let ((s4-0 format) - (s3-0 arg1) - (s2-0 "~0kpoly:~6X mode:~-8S material:~-10S event:~S~%") - (s1-0 (-> arg0 control poly-pat)) - (s0-0 (pat-mode->string (-> arg0 control poly-pat))) - ) - (set! sv-64 (pat-material->string (-> arg0 control poly-pat))) - (let ((t1-0 (pat-event->string (-> arg0 control poly-pat)))) - (s4-0 s3-0 s2-0 s1-0 s0-0 sv-64 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 ((s4-1 format) - (s3-1 arg1) - (s2-1 "~0kgrnd:~6X mode:~-8S material:~-10S event:~S~%") - (s1-1 (-> arg0 control ground-pat)) - (s0-1 (pat-mode->string (-> arg0 control ground-pat))) - ) - (set! sv-80 (pat-material->string (-> arg0 control ground-pat))) - (let ((t1-1 (pat-event->string (-> arg0 control ground-pat)))) - (s4-1 s3-1 s2-1 s1-1 s0-1 sv-80 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 ((s4-2 format) - (s3-2 arg1) - (s2-2 "~0kwall:~6X mode:~-8S material:~-10S event:~S~%") - (s1-2 (-> arg0 control wall-pat)) - (s0-2 (pat-mode->string (-> arg0 control wall-pat))) - ) - (set! sv-96 (pat-material->string (-> arg0 control wall-pat))) - (let ((t1-2 (pat-event->string (-> arg0 control wall-pat)))) - (s4-2 s3-2 s2-2 s1-2 s0-2 sv-96 t1-2) - ) + (format + arg1 + "~0kwall:~6X mode:~-8S material:~-10S event:~S~%" + (-> arg0 control wall-pat) + (pat-mode->string (-> arg0 control wall-pat)) + (pat-material->string (-> arg0 control wall-pat)) + (pat-event->string (-> arg0 control wall-pat)) ) ) (when (and *stats-target* arg0) @@ -397,58 +378,46 @@ (let ((v1-74 (-> arg0 control trans))) (format arg1 "pos: ~6,,2m ~6,,2m ~6,,2m " (-> v1-74 x) (-> v1-74 y) (-> v1-74 z)) ) - (let ((s4-3 format) - (s3-3 arg1) - (s2-3 "~0kpol:~X/~S/~S/~S~%") - (s1-3 (-> arg0 control poly-pat)) - (s0-3 (pat-mode->string (-> arg0 control poly-pat))) - ) - (set! sv-112 (pat-material->string (-> arg0 control poly-pat))) - (let ((t1-7 (pat-event->string (-> arg0 control poly-pat)))) - (s4-3 s3-3 s2-3 s1-3 s0-3 sv-112 t1-7) - ) + (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 ((s4-4 format) - (s3-4 arg1) - (s2-4 "~0kcur:~X/~S/~S/~S ") - (s1-4 (-> arg0 control cur-pat)) - (s0-4 (pat-mode->string (-> arg0 control cur-pat))) - ) - (set! sv-128 (pat-material->string (-> arg0 control cur-pat))) - (let ((t1-8 (pat-event->string (-> arg0 control cur-pat)))) - (s4-4 s3-4 s2-4 s1-4 s0-4 sv-128 t1-8) - ) + (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 ((s4-5 format) - (s3-5 arg1) - (s2-5 "~0kgnd:~X/~S/~S/~S~%") - (s1-5 (-> arg0 control ground-pat)) - (s0-5 (pat-mode->string (-> arg0 control ground-pat))) - ) - (set! sv-144 (pat-material->string (-> arg0 control ground-pat))) - (let ((t1-9 (pat-event->string (-> arg0 control ground-pat)))) - (s4-5 s3-5 s2-5 s1-5 s0-5 sv-144 t1-9) - ) + (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 ((s4-6 format) (s3-6 arg1) (s2-6 "~0kvel: x:~M y:~M z:~M yv:~M xzv:~M~%") (s1-6 (-> arg0 control transv x)) (s0-6 (-> arg0 control transv y)) + (sv-160 (-> arg0 control transv z)) + (sv-176 (vector-dot (-> arg0 control dynam gravity-normal) (-> arg0 control transv))) + (a0-36 (new-stack-vector0)) ) - (set! sv-160 (-> arg0 control transv z)) - (set! sv-176 (vector-dot (-> arg0 control dynam gravity-normal) (-> arg0 control transv))) - (let ((a0-36 (new-stack-vector0))) - (let ((f0-17 (vector-dot (-> arg0 control dynam gravity-normal) (-> arg0 control transv)))) - 0.0 - (vector-! a0-36 (-> arg0 control transv) (vector-float*! a0-36 (-> arg0 control dynam gravity-normal) f0-17)) - ) - (let ((f0-18 (vector-length a0-36))) - f0-18 - (let ((t2-4 f0-18)) - (s4-6 s3-6 s2-6 s1-6 s0-6 sv-160 sv-176 t2-4) - ) - ) + (let ((f0-17 (vector-dot (-> arg0 control dynam gravity-normal) (-> arg0 control transv)))) + 0.0 + (vector-! a0-36 (-> arg0 control transv) (vector-float*! a0-36 (-> arg0 control dynam gravity-normal) f0-17)) + ) + (let ((f0-18 (vector-length a0-36))) + f0-18 + (s4-6 s3-6 s2-6 s1-6 s0-6 sv-160 sv-176 f0-18) ) ) (format @@ -703,7 +672,7 @@ ) (if (< 0.0 f30-1) (vector-xz-normalize! s5-0 (+ f0-11 (* f30-1 (-> self control unknown-surface01 slope-down-factor)))) - (vector-xz-normalize! s5-0 (- f0-11 (* f30-1 f30-1 (-> self control unknown-surface01 slope-up-factor)))) + (vector-xz-normalize! s5-0 (- f0-11 (* (square f30-1) (-> self control unknown-surface01 slope-up-factor)))) ) ) ) diff --git a/test/decompiler/reference/jak1/engine/target/target-handler_REF.gc b/test/decompiler/reference/jak1/engine/target/target-handler_REF.gc index 001febd9ab..23645cba1c 100644 --- a/test/decompiler/reference/jak1/engine/target/target-handler_REF.gc +++ b/test/decompiler/reference/jak1/engine/target/target-handler_REF.gc @@ -398,31 +398,6 @@ ;; INFO: Used lq/sq ;; INFO: Return type mismatch object vs symbol. (defbehavior target-send-attack target ((arg0 process) (arg1 uint) (arg2 touching-shapes-entry) (arg3 int) (arg4 int)) - (local-vars - (sv-96 touching-prims-entry) - (sv-128 touching-prims-entry) - (sv-176 touching-prims-entry) - (sv-224 int) - (sv-240 symbol) - (sv-256 symbol) - (sv-272 symbol) - (sv-288 int) - (sv-304 symbol) - (sv-320 symbol) - (sv-336 symbol) - (sv-352 int) - (sv-368 symbol) - (sv-384 symbol) - (sv-400 symbol) - (sv-416 int) - (sv-432 symbol) - (sv-448 symbol) - (sv-464 symbol) - (sv-480 int) - (sv-496 symbol) - (sv-512 symbol) - (sv-528 symbol) - ) (let ((v1-0 (new 'stack-no-clear 'event-message-block))) (set! (-> v1-0 from) self) (set! (-> v1-0 num-params) 4) @@ -436,43 +411,21 @@ (let ((v1-5 (-> self control unknown-symbol30))) (cond ((or (= v1-5 'spin) (= v1-5 'spin-air)) - (set! sv-96 (prims-touching? arg2 (-> self control) (the-as uint 64))) - (cond - (sv-96 - (let ((s4-0 (get-process *default-dead-pool* part-tracker #x4000))) - (when s4-0 - (let ((t9-3 (method-of-type part-tracker activate))) - (t9-3 (the-as part-tracker s4-0) self 'part-tracker (the-as pointer #x70004000)) - ) - (let ((s3-0 run-function-in-process) - (s2-0 s4-0) - (s1-0 part-tracker-init) - (s0-0 group-spin-hit) - ) - (set! sv-224 -1) - (set! sv-240 (the-as symbol #f)) - (set! sv-256 (the-as symbol #f)) - (set! sv-272 (the-as symbol #f)) - (let ((t3-0 (get-intersect-point (new 'stack-no-clear 'vector) sv-96 (-> self control) arg2))) - ((the-as (function object object object object object object object object none) s3-0) - s2-0 - s1-0 - s0-0 - sv-224 - sv-240 - sv-256 - sv-272 - t3-0 - ) - ) - ) - (-> s4-0 ppointer) + (let ((sv-96 (prims-touching? arg2 (-> self control) (the-as uint 64)))) + (if sv-96 + (process-spawn + part-tracker + :init part-tracker-init + group-spin-hit + -1 + (the-as symbol #f) + (the-as symbol #f) + (the-as symbol #f) + (get-intersect-point (new 'stack-no-clear 'vector) sv-96 (-> self control) arg2) + :to self ) + (effect-control-method-10 (-> self skel effect) 'group-spin-hit (the-as float -1.0) 74) ) - ) - (else - (effect-control-method-10 (-> self skel effect) 'group-spin-hit (the-as float -1.0) 74) - ) ) (effect-control-method-12 (-> self skel effect) @@ -485,75 +438,38 @@ (cpad-set-buzz! (-> *cpad-list* cpads 0) 1 127 (seconds 0.2)) ) ((= v1-5 'punch) - (set! sv-128 (prims-touching? arg2 (-> self control) (the-as uint 64))) - (cond - (sv-128 - (let ((s4-1 (get-process *default-dead-pool* part-tracker #x4000))) - (when s4-1 - (let ((t9-11 (method-of-type part-tracker activate))) - (t9-11 (the-as part-tracker s4-1) self 'part-tracker (the-as pointer #x70004000)) - ) - (let ((s3-1 run-function-in-process) - (s2-1 s4-1) - (s1-1 part-tracker-init) - (s0-1 group-punch-hit) - ) - (set! sv-288 -1) - (set! sv-304 (the-as symbol #f)) - (set! sv-320 (the-as symbol #f)) - (set! sv-336 (the-as symbol #f)) - (let ((t3-1 (get-intersect-point (new 'stack-no-clear 'vector) sv-128 (-> self control) arg2))) - ((the-as (function object object object object object object object object none) s3-1) - s2-1 - s1-1 - s0-1 - sv-288 - sv-304 - sv-320 - sv-336 - t3-1 - ) - ) - ) - (-> s4-1 ppointer) + (let ((sv-128 (prims-touching? arg2 (-> self control) (the-as uint 64)))) + (cond + (sv-128 + (process-spawn + part-tracker + :init part-tracker-init + group-punch-hit + -1 + (the-as symbol #f) + (the-as symbol #f) + (the-as symbol #f) + (get-intersect-point (new 'stack-no-clear 'vector) sv-128 (-> self control) arg2) + :to self ) ) - ) - ((let ((v0-14 (prims-touching? arg2 (-> self control) (the-as uint 32)))) - (set! sv-128 v0-14) - v0-14 - ) - (let ((s4-2 (get-process *default-dead-pool* part-tracker #x4000))) - (when s4-2 - (let ((t9-16 (method-of-type part-tracker activate))) - (t9-16 (the-as part-tracker s4-2) self 'part-tracker (the-as pointer #x70004000)) - ) - (let ((s3-2 run-function-in-process) - (s2-2 s4-2) - (s1-2 part-tracker-init) - (s0-2 group-punch-hit) - ) - (set! sv-352 -1) - (set! sv-368 (the-as symbol #f)) - (set! sv-384 (the-as symbol #f)) - (set! sv-400 (the-as symbol #f)) - (let ((t3-2 (get-intersect-point (new 'stack-no-clear 'vector) sv-128 (-> self control) arg2))) - ((the-as (function object object object object object object object object none) s3-2) - s2-2 - s1-2 - s0-2 - sv-352 - sv-368 - sv-384 - sv-400 - t3-2 - ) - ) - ) - (-> s4-2 ppointer) + ((let ((v0-14 (prims-touching? arg2 (-> self control) (the-as uint 32)))) + (set! sv-128 v0-14) + v0-14 + ) + (process-spawn + part-tracker + :init part-tracker-init + group-punch-hit + -1 + (the-as symbol #f) + (the-as symbol #f) + (the-as symbol #f) + (get-intersect-point (new 'stack-no-clear 'vector) sv-128 (-> self control) arg2) + :to self ) ) - ) + ) ) (effect-control-method-12 (-> self skel effect) @@ -577,75 +493,38 @@ (cpad-set-buzz! (-> *cpad-list* cpads 0) 1 127 (seconds 0.1)) ) ((= v1-5 'uppercut) - (set! sv-176 (prims-touching? arg2 (-> self control) (the-as uint 64))) - (cond - (sv-176 - (let ((s4-3 (get-process *default-dead-pool* part-tracker #x4000))) - (when s4-3 - (let ((t9-25 (method-of-type part-tracker activate))) - (t9-25 (the-as part-tracker s4-3) self 'part-tracker (the-as pointer #x70004000)) - ) - (let ((s3-3 run-function-in-process) - (s2-3 s4-3) - (s1-3 part-tracker-init) - (s0-3 group-punch-hit) - ) - (set! sv-416 -1) - (set! sv-432 (the-as symbol #f)) - (set! sv-448 (the-as symbol #f)) - (set! sv-464 (the-as symbol #f)) - (let ((t3-3 (get-intersect-point (new 'stack-no-clear 'vector) sv-176 (-> self control) arg2))) - ((the-as (function object object object object object object object object none) s3-3) - s2-3 - s1-3 - s0-3 - sv-416 - sv-432 - sv-448 - sv-464 - t3-3 - ) - ) - ) - (-> s4-3 ppointer) + (let ((sv-176 (prims-touching? arg2 (-> self control) (the-as uint 64)))) + (cond + (sv-176 + (process-spawn + part-tracker + :init part-tracker-init + group-punch-hit + -1 + (the-as symbol #f) + (the-as symbol #f) + (the-as symbol #f) + (get-intersect-point (new 'stack-no-clear 'vector) sv-176 (-> self control) arg2) + :to self ) ) - ) - ((let ((v0-26 (prims-touching? arg2 (-> self control) (the-as uint 32)))) - (set! sv-176 v0-26) - v0-26 - ) - (let ((s4-4 (get-process *default-dead-pool* part-tracker #x4000))) - (when s4-4 - (let ((t9-30 (method-of-type part-tracker activate))) - (t9-30 (the-as part-tracker s4-4) self 'part-tracker (the-as pointer #x70004000)) - ) - (let ((s3-4 run-function-in-process) - (s2-4 s4-4) - (s1-4 part-tracker-init) - (s0-4 group-punch-hit) - ) - (set! sv-480 -1) - (set! sv-496 (the-as symbol #f)) - (set! sv-512 (the-as symbol #f)) - (set! sv-528 (the-as symbol #f)) - (let ((t3-4 (get-intersect-point (new 'stack-no-clear 'vector) sv-176 (-> self control) arg2))) - ((the-as (function object object object object object object object object none) s3-4) - s2-4 - s1-4 - s0-4 - sv-480 - sv-496 - sv-512 - sv-528 - t3-4 - ) - ) - ) - (-> s4-4 ppointer) + ((let ((v0-26 (prims-touching? arg2 (-> self control) (the-as uint 32)))) + (set! sv-176 v0-26) + v0-26 + ) + (process-spawn + part-tracker + :init part-tracker-init + group-punch-hit + -1 + (the-as symbol #f) + (the-as symbol #f) + (the-as symbol #f) + (get-intersect-point (new 'stack-no-clear 'vector) sv-176 (-> self control) arg2) + :to self ) ) - ) + ) ) (effect-control-method-10 (-> self skel effect) 'group-uppercut-hit (the-as float -1.0) 23) (effect-control-method-12 diff --git a/test/decompiler/reference/jak1/engine/target/target-part_REF.gc b/test/decompiler/reference/jak1/engine/target/target-part_REF.gc index 5d2ad363b9..876d8cab97 100644 --- a/test/decompiler/reference/jak1/engine/target/target-part_REF.gc +++ b/test/decompiler/reference/jak1/engine/target/target-part_REF.gc @@ -87,14 +87,15 @@ ;; definition for function birth-func-target-orient ;; INFO: 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*) - (let ((s3-0 (new 'stack-no-clear 'vector))) + (let ((sv-16 *target*) + (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))) diff --git a/test/decompiler/reference/jak1/engine/target/target2_REF.gc b/test/decompiler/reference/jak1/engine/target/target2_REF.gc index bd8f0da791..83a4ea2578 100644 --- a/test/decompiler/reference/jak1/engine/target/target2_REF.gc +++ b/test/decompiler/reference/jak1/engine/target/target2_REF.gc @@ -509,7 +509,6 @@ ) ) :trans (behavior () - (local-vars (sv-48 vector)) (rlet ((vf0 :class vf) (vf4 :class vf) (vf5 :class vf) @@ -545,8 +544,8 @@ (s2-0 s4-0) (s1-0 projectile-init-by-other) (s0-0 (-> self entity)) + (sv-48 s5-1) ) - (set! sv-48 s5-1) (let ((v0-3 (camera-pos))) (.mov.vf.w vf6 vf0) (.lvf vf4 (&-> v0-3 quad)) @@ -554,23 +553,18 @@ (.lvf vf5 (&-> s5-1 quad)) (.add.vf.xyz vf6 vf4 vf5) (.svf (&-> sv-48 quad) vf6) - (let ((t1-0 (if (>= (-> self fact eco-level) (-> *FACT-bank* eco-level-max)) - 56 - 40 - ) - ) - (t2-0 #f) - ) - ((the-as (function object object object object object object object none) s3-0) - s2-0 - s1-0 - s0-0 - sv-48 - gp-1 - t1-0 - t2-0 - ) - ) + ((the-as (function object object object object object object object none) s3-0) + s2-0 + s1-0 + s0-0 + sv-48 + gp-1 + (if (>= (-> self fact eco-level) (-> *FACT-bank* eco-level-max)) + 56 + 40 + ) + #f + ) ) (-> s4-0 ppointer) ) @@ -660,7 +654,6 @@ (target-exit) ) :trans (behavior () - (local-vars (sv-48 vector)) (rlet ((vf0 :class vf) (vf4 :class vf) (vf5 :class vf) @@ -696,8 +689,8 @@ (s2-0 s4-0) (s1-0 projectile-init-by-other) (s0-0 (-> self entity)) + (sv-48 s5-1) ) - (set! sv-48 s5-1) (let ((v0-4 (camera-pos))) (.mov.vf.w vf6 vf0) (.lvf vf4 (&-> v0-4 quad)) @@ -705,23 +698,18 @@ (.lvf vf5 (&-> s5-1 quad)) (.add.vf.xyz vf6 vf4 vf5) (.svf (&-> sv-48 quad) vf6) - (let ((t1-0 (if (>= (-> self fact eco-level) (-> *FACT-bank* eco-level-max)) - 120 - 104 - ) - ) - (t2-0 #f) - ) - ((the-as (function object object object object object object object none) s3-0) - s2-0 - s1-0 - s0-0 - sv-48 - gp-1 - t1-0 - t2-0 - ) - ) + ((the-as (function object object object object object object object none) s3-0) + s2-0 + s1-0 + s0-0 + sv-48 + gp-1 + (if (>= (-> self fact eco-level) (-> *FACT-bank* eco-level-max)) + 120 + 104 + ) + #f + ) ) (-> s4-0 ppointer) ) @@ -2563,61 +2551,63 @@ process (lambda :behavior process ((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 unknown-vector52 y)) arg2) - ) - (vector-xz-normalize! (-> (the-as target s4-0) control transv) (the-as float 0.0)) - (case (-> (the-as target s4-0) current-level name) - (('jungleb) - (let ((v1-16 (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 -4096.0 (fmin 4096.0 (-> v1-16 x))))) - (set! (-> (the-as target s4-0) control trans z) (+ (-> sv-40 z) (fmax -4096.0 (fmin 4096.0 (-> v1-16 z))))) - ) - ) - ) - ) - (else - (if sv-44 - (set! sv-32 (current-time)) - ) - (set! sv-44 (the-as symbol #f)) - (when (or (= (-> (the-as target s4-0) next-state name) 'target-duck-high-jump-jump) - (= (-> (the-as target s4-0) next-state name) 'target-falling) - ) - (let ((v1-30 (-> (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 unknown-vector52 y)) arg2) ) - (set! (-> s3-0 x) (- (-> sv-40 x) (-> v1-30 x))) - (set! (-> s3-0 z) (- (-> sv-40 z) (-> v1-30 z))) - (let ((f30-0 (vector-xz-length s3-0))) - (if (< 122880.0 f30-0) - (vector-xz-normalize! s3-0 (the-as float 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 (the-as float 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) (the-as float 0.0)) + (case (-> (the-as target s4-0) current-level name) + (('jungleb) + (let ((v1-16 (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 -4096.0 (fmin 4096.0 (-> v1-16 x))))) + (set! (-> (the-as target s4-0) control trans z) (+ (-> sv-40 z) (fmax -4096.0 (fmin 4096.0 (-> v1-16 z))))) + ) + ) + ) + ) + (else + (if sv-44 + (set! sv-32 (current-time)) + ) + (set! sv-44 (the-as symbol #f)) + (when (or (= (-> (the-as target s4-0) next-state name) 'target-duck-high-jump-jump) + (= (-> (the-as target s4-0) next-state name) 'target-falling) + ) + (let ((v1-30 (-> (the-as target s4-0) control trans)) + (s3-0 (-> (the-as target s4-0) control transv)) ) + (set! (-> s3-0 x) (- (-> sv-40 x) (-> v1-30 x))) + (set! (-> s3-0 z) (- (-> sv-40 z) (-> v1-30 z))) + (let ((f30-0 (vector-xz-length s3-0))) + (if (< 122880.0 f30-0) + (vector-xz-normalize! s3-0 (the-as float 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 (the-as float 1.0)) + (vector-y-quaternion! (new 'stack-no-clear 'vector) (-> (the-as target s4-0) control quat)) + ) + ) ) + ) ) ) ) ) + (suspend) + 0 ) ) - (suspend) - 0 ) #f ) diff --git a/test/decompiler/reference/jak1/engine/ui/progress/progress-draw_REF.gc b/test/decompiler/reference/jak1/engine/ui/progress/progress-draw_REF.gc index b19b2c8b02..fd679d5336 100644 --- a/test/decompiler/reference/jak1/engine/ui/progress/progress-draw_REF.gc +++ b/test/decompiler/reference/jak1/engine/ui/progress/progress-draw_REF.gc @@ -13,16 +13,6 @@ ;; INFO: Used lq/sq ;; INFO: Return type mismatch int vs none. (defmethod draw-fuel-cell-screen ((this progress) (arg0 int)) - (local-vars - (sv-112 int) - (sv-128 int) - (sv-144 int) - (sv-160 (function trsqv float quaternion)) - (sv-176 trsqv) - (sv-192 int) - (sv-208 int) - (sv-224 (function string float font-context int none)) - ) (hide-progress-icons) (let ((s5-0 (-> *level-task-data* arg0))) (if (and (= *cheat-mode* 'debug) (cpad-hold? 0 l3)) @@ -32,141 +22,144 @@ (set! (-> *progress-process* 0 particles 15 init-pos x) -320.0) (set! (-> *progress-process* 0 icons 4 icon-x) -320) (when (and (!= s5-0 #f) (= (-> *game-info* level-opened arg0) 1)) - (set! sv-112 (- (-> *task-egg-starting-x* (-> s5-0 nb-of-tasks)) (-> this left-x-offset))) - (set! sv-128 (the int (* 47.0 (-> this transition-percentage-invert)))) - 0 - (let ((s0-0 6) - (s2-0 0) - (s4-1 (if (= (-> this level-transition) 1) - (- (-> this transition-offset)) - (-> this transition-offset) - ) - ) - (f30-0 (-> this transition-percentage-invert)) - (s1-0 0) - (s3-0 #f) + (let ((sv-112 (- (-> *task-egg-starting-x* (-> s5-0 nb-of-tasks)) (-> this left-x-offset))) + (sv-128 (the int (* 47.0 (-> this transition-percentage-invert)))) ) - (when (-> this stat-transition) - (set! sv-128 47) - (set! s2-0 (if (!= (-> this display-state) (-> this next-display-state)) - (- (-> this transition-offset)) - (-> this transition-offset) - ) - ) - (set! s4-1 0) - (set! f30-0 1.0) - ) - (set! sv-144 0) - (while (< sv-144 4) - (let ((a0-18 (-> this icons sv-144 icon 0 root))) - (set! sv-176 a0-18) - (set! sv-160 (method-of-object sv-176 set-yaw-angle-clear-roll-pitch!)) - (let ((a1-2 (+ (y-angle a0-18) (* 182.04445 (/ (-> *display* time-adjust-ratio) 2))))) - (sv-160 sv-176 a1-2) - ) - ) - (set! sv-144 (+ sv-144 1)) - ) - (set! sv-192 (+ sv-112 (/ (- (* 47 (-> s5-0 nb-of-tasks)) (* sv-128 (-> s5-0 nb-of-tasks))) 2))) - (set! sv-208 0) - (while (< sv-208 (-> s5-0 nb-of-tasks)) - (let ((v0-4 (get-task-status (-> s5-0 task-info sv-208 task-id))) - (v1-59 -1) - (a0-25 #f) - ) - (set! (-> this particle-state s0-0) 2) - (cond - ((or (= v0-4 (task-status need-hint)) (= v0-4 (task-status unknown))) - (if (= *kernel-boot-message* 'play) - (set! (-> this particle-state s0-0) 1) - ) - ) - ((= v0-4 (task-status invalid)) - (set! v1-59 (-> s5-0 task-info sv-208 text-index-when-resolved)) - (set! (-> this particle-state s0-0) 3) - (set! a0-25 #t) - ) - ((= v0-4 (task-status need-introduction)) - (set! v1-59 0) - ) - ((= v0-4 (task-status need-reminder-a)) - (set! v1-59 0) - ) - ((= v0-4 (task-status need-reminder)) - (set! v1-59 1) - ) - ((= v0-4 (task-status need-reward-speech)) - (set! v1-59 2) - ) - ((= v0-4 (task-status need-resolution)) - (set! v1-59 2) - ) - ) - (if (and (!= *kernel-boot-message* 'play) (= v1-59 -1)) - (set! v1-59 0) - ) - (set! (-> this particles s0-0 init-pos x) (the float (+ sv-192 s2-0))) - (set! (-> this particles s0-0 init-pos y) (the float (+ s4-1 204))) - (+! s0-0 1) - (when (= sv-208 (-> this task-index)) - (set! s1-0 v1-59) - (set! s3-0 a0-25) - (set! (-> this particles 5 init-pos x) (the float (+ sv-192 s2-0))) - (set! (-> this particles 5 init-pos y) (the float (+ s4-1 204))) - ) - ) - (set! sv-192 (+ sv-192 sv-128)) - (set! sv-208 (+ sv-208 1)) - ) - (dotimes (v1-77 (- 8 (-> s5-0 nb-of-tasks))) - (set! (-> *progress-process* 0 particles s0-0 init-pos x) (the float (+ s2-0 -320))) - (set! (-> this particles s0-0 init-pos y) (the float (+ s4-1 194))) - (+! s0-0 1) - ) - (when *common-text* - (when (and (!= s1-0 -1) - (> (-> s5-0 nb-of-tasks) 0) - (>= (-> this task-index) 0) - (< (-> this task-index) (-> s5-0 nb-of-tasks)) - ) - (let ((s0-1 (new - 'stack - 'font-context - *font-default-matrix* - (- (+ s2-0 32) (-> this left-x-offset)) - (+ (/ s4-1 2) 125) - 8325000.0 - (font-color progress-yellow) - (font-flags shadow kerning) - ) + 0 + (let ((s0-0 6) + (s2-0 0) + (s4-1 (if (= (-> this level-transition) 1) + (- (-> this transition-offset)) + (-> this transition-offset) ) - ) - (set-width! s0-1 328) - (set-height! s0-1 50) - (set-scale! s0-1 0.7) - (set! (-> s0-1 flags) (font-flags shadow kerning middle middle-vert large)) - (set! sv-224 print-game-text-scaled) - (let ((a0-47 (lookup-text! *common-text* (-> s5-0 task-info (-> this task-index) task-name s1-0) #f)) - (a1-57 f30-0) - (a2-15 s0-1) - (a3-2 (the int (* 128.0 f30-0))) ) - (sv-224 a0-47 a1-57 a2-15 a3-2) - ) - (when s3-0 - (set! (-> s0-1 origin x) (the float (- (+ s2-0 32) (-> this left-x-offset)))) - (set! (-> s0-1 origin y) (the float (+ (/ s4-1 2) 175))) - (let ((a0-49 s0-1)) - (set! (-> a0-49 color) (font-color progress-blue)) + (f30-0 (-> this transition-percentage-invert)) + (s1-0 0) + (s3-0 #f) + ) + (when (-> this stat-transition) + (set! sv-128 47) + (set! s2-0 (if (!= (-> this display-state) (-> this next-display-state)) + (- (-> this transition-offset)) + (-> this transition-offset) + ) ) - (set-height! s0-1 15) - (set-scale! s0-1 0.5) + (set! s4-1 0) + (set! f30-0 1.0) + ) + (let ((sv-144 0)) + (while (< sv-144 4) + (let ((a0-18 (-> this icons sv-144 icon 0 root))) + (set-yaw-angle-clear-roll-pitch! + a0-18 + (+ (y-angle a0-18) (* 182.04445 (/ (-> *display* time-adjust-ratio) 2))) + ) + ) + (+! sv-144 1) + ) + ) + (let ((sv-192 (+ sv-112 (/ (- (* 47 (-> s5-0 nb-of-tasks)) (* sv-128 (-> s5-0 nb-of-tasks))) 2))) + (sv-208 0) + ) + (while (< sv-208 (-> s5-0 nb-of-tasks)) + (let ((v0-4 (get-task-status (-> s5-0 task-info sv-208 task-id))) + (v1-59 -1) + (a0-25 #f) + ) + (set! (-> this particle-state s0-0) 2) + (cond + ((or (= v0-4 (task-status need-hint)) (= v0-4 (task-status unknown))) + (if (= *kernel-boot-message* 'play) + (set! (-> this particle-state s0-0) 1) + ) + ) + ((= v0-4 (task-status invalid)) + (set! v1-59 (-> s5-0 task-info sv-208 text-index-when-resolved)) + (set! (-> this particle-state s0-0) 3) + (set! a0-25 #t) + ) + ((= v0-4 (task-status need-introduction)) + (set! v1-59 0) + ) + ((= v0-4 (task-status need-reminder-a)) + (set! v1-59 0) + ) + ((= v0-4 (task-status need-reminder)) + (set! v1-59 1) + ) + ((= v0-4 (task-status need-reward-speech)) + (set! v1-59 2) + ) + ((= v0-4 (task-status need-resolution)) + (set! v1-59 2) + ) + ) + (if (and (!= *kernel-boot-message* 'play) (= v1-59 -1)) + (set! v1-59 0) + ) + (set! (-> this particles s0-0 init-pos x) (the float (+ sv-192 s2-0))) + (set! (-> this particles s0-0 init-pos y) (the float (+ s4-1 204))) + (+! s0-0 1) + (when (= sv-208 (-> this task-index)) + (set! s1-0 v1-59) + (set! s3-0 a0-25) + (set! (-> this particles 5 init-pos x) (the float (+ sv-192 s2-0))) + (set! (-> this particles 5 init-pos y) (the float (+ s4-1 204))) + ) + ) + (+! sv-192 sv-128) + (+! sv-208 1) + ) + ) + (dotimes (v1-77 (- 8 (-> s5-0 nb-of-tasks))) + (set! (-> *progress-process* 0 particles s0-0 init-pos x) (the float (+ s2-0 -320))) + (set! (-> this particles s0-0 init-pos y) (the float (+ s4-1 194))) + (+! s0-0 1) + ) + (when *common-text* + (when (and (!= s1-0 -1) + (> (-> s5-0 nb-of-tasks) 0) + (>= (-> this task-index) 0) + (< (-> this task-index) (-> s5-0 nb-of-tasks)) + ) + (let ((s0-1 + (new + 'stack + 'font-context + *font-default-matrix* + (- (+ s2-0 32) (-> this left-x-offset)) + (+ (/ s4-1 2) 125) + 8325000.0 + (font-color progress-yellow) + (font-flags shadow kerning) + ) + ) + ) + (set-width! s0-1 328) + (set-height! s0-1 50) + (set-scale! s0-1 0.7) + (set! (-> s0-1 flags) (font-flags shadow kerning middle middle-vert large)) (print-game-text-scaled - (lookup-text! *common-text* (text-id task-completed) #f) + (lookup-text! *common-text* (-> s5-0 task-info (-> this task-index) task-name s1-0) #f) f30-0 s0-1 (the int (* 128.0 f30-0)) ) + (when s3-0 + (set! (-> s0-1 origin x) (the float (- (+ s2-0 32) (-> this left-x-offset)))) + (set! (-> s0-1 origin y) (the float (+ (/ s4-1 2) 175))) + (let ((a0-49 s0-1)) + (set! (-> a0-49 color) (font-color progress-blue)) + ) + (set-height! s0-1 15) + (set-scale! s0-1 0.5) + (print-game-text-scaled + (lookup-text! *common-text* (text-id task-completed) #f) + f30-0 + s0-1 + (the int (* 128.0 f30-0)) + ) + ) ) ) ) @@ -545,17 +538,6 @@ ;; INFO: Used lq/sq ;; INFO: Return type mismatch int vs none. (defmethod draw-memcard-file-select ((this progress) (arg0 font-context)) - (local-vars - (sv-16 (function _varargs_ object)) - (sv-32 (function _varargs_ object)) - (sv-48 (function _varargs_ object)) - (sv-64 (function _varargs_ object)) - (sv-80 (function _varargs_ object)) - (sv-96 (function _varargs_ object)) - (sv-112 (function _varargs_ object)) - (sv-128 (function _varargs_ object)) - (sv-144 (function _varargs_ object)) - ) (let ((s4-0 (* (+ (-> this transition-offset) -256) 2))) (if (< s4-0 0) (set! s4-0 0) @@ -652,35 +634,17 @@ (set! (-> arg0 origin x) (the float (- -73 (-> this left-x-offset)))) (set-width! arg0 350) (let ((s0-2 print-game-text)) - (set! sv-16 format) - (let ((a0-40 (clear *temp-string*)) - (a1-13 "~D") - (a2-5 (the int (-> s3-3 file s1-0 fuel-cell-count))) - ) - (sv-16 a0-40 a1-13 a2-5) - ) + (format (clear *temp-string*) "~D" (the int (-> s3-3 file s1-0 fuel-cell-count))) (s0-2 *temp-string* arg0 #f s4-1 22) ) (set! (-> arg0 origin x) (the float (- 1 (-> this left-x-offset)))) (let ((s0-3 print-game-text)) - (set! sv-32 format) - (let ((a0-44 (clear *temp-string*)) - (a1-15 "~D") - (a2-7 (the int (-> s3-3 file s1-0 money-count))) - ) - (sv-32 a0-44 a1-15 a2-7) - ) + (format (clear *temp-string*) "~D" (the int (-> s3-3 file s1-0 money-count))) (s0-3 *temp-string* arg0 #f s4-1 22) ) (set! (-> arg0 origin x) (the float (- 79 (-> this left-x-offset)))) (let ((s0-4 print-game-text)) - (set! sv-48 format) - (let ((a0-48 (clear *temp-string*)) - (a1-17 "~D") - (a2-9 (the int (-> s3-3 file s1-0 buzzer-count))) - ) - (sv-48 a0-48 a1-17 a2-9) - ) + (format (clear *temp-string*) "~D" (the int (-> s3-3 file s1-0 buzzer-count))) (s0-4 *temp-string* arg0 #f s4-1 22) ) (+! (-> arg0 origin y) 1.0) @@ -688,13 +652,7 @@ (set! (-> arg0 flags) (font-flags shadow kerning right large)) (set! (-> arg0 origin x) (the float (- 352 (-> this left-x-offset)))) (let ((s0-5 print-game-text)) - (set! sv-64 format) - (let ((a0-52 (clear *temp-string*)) - (a1-19 "~D%") - (a2-11 (the int (-> s3-3 file s1-0 completion-percentage))) - ) - (sv-64 a0-52 a1-19 a2-11) - ) + (format (clear *temp-string*) "~D%" (the int (-> s3-3 file s1-0 completion-percentage))) (s0-5 *temp-string* arg0 #f s4-1 22) ) (set-scale! arg0 0.5) @@ -702,39 +660,23 @@ (set! (-> arg0 flags) (font-flags shadow kerning large)) (set! (-> arg0 origin x) (the float (- 85 (-> this left-x-offset)))) (let ((s0-6 print-game-text)) - (set! sv-80 format) - (let ((a0-56 (clear *temp-string*)) - (a1-21 "/~D") - (a2-17 (if (< 100 (the int (-> s3-3 file s1-0 fuel-cell-count))) - (-> this total-nb-of-power-cells) - 100 - ) - ) - ) - (sv-80 a0-56 a1-21 a2-17) + (let ((sv-80 format)) + (sv-80 (clear *temp-string*) "/~D" (if (< 100 (the int (-> s3-3 file s1-0 fuel-cell-count))) + (-> this total-nb-of-power-cells) + 100 + ) + ) ) (s0-6 *temp-string* arg0 #f s4-1 22) ) (set! (-> arg0 origin x) (the float (- 150 (-> this left-x-offset)))) (let ((s0-7 print-game-text)) - (set! sv-96 format) - (let ((a0-60 (clear *temp-string*)) - (a1-23 "/~D") - (a2-19 (-> this total-nb-of-orbs)) - ) - (sv-96 a0-60 a1-23 a2-19) - ) + (format (clear *temp-string*) "/~D" (-> this total-nb-of-orbs)) (s0-7 *temp-string* arg0 #f s4-1 22) ) (set! (-> arg0 origin x) (the float (- 238 (-> this left-x-offset)))) (let ((s0-8 print-game-text)) - (set! sv-112 format) - (let ((a0-64 (clear *temp-string*)) - (a1-25 "/~D") - (a2-21 (-> this total-nb-of-buzzers)) - ) - (sv-112 a0-64 a1-25 a2-21) - ) + (format (clear *temp-string*) "/~D" (-> this total-nb-of-buzzers)) (s0-8 *temp-string* arg0 #f s4-1 22) ) (+! (-> arg0 origin y) 15.0) @@ -748,32 +690,28 @@ (cond ((= (scf-get-territory) 1) (let ((s0-10 print-game-text)) - (set! sv-128 format) - (let ((a0-69 (clear *temp-string*)) - (a1-27 "~X/~X/20~2X ~2X:~2X") - (a2-23 (-> s3-3 file s1-0 day)) - (a3-10 (-> s3-3 file s1-0 month)) - (t0-10 (-> s3-3 file s1-0 year)) - (t1-0 (-> s3-3 file s1-0 hour)) - (t2-0 (-> s3-3 file s1-0 minute)) - ) - (sv-128 a0-69 a1-27 a2-23 a3-10 t0-10 t1-0 t2-0) + (format + (clear *temp-string*) + "~X/~X/20~2X ~2X:~2X" + (-> s3-3 file s1-0 day) + (-> s3-3 file s1-0 month) + (-> s3-3 file s1-0 year) + (-> s3-3 file s1-0 hour) + (-> s3-3 file s1-0 minute) ) (s0-10 *temp-string* arg0 #f s4-1 22) ) ) (else (let ((s0-11 print-game-text)) - (set! sv-144 format) - (let ((a0-72 (clear *temp-string*)) - (a1-29 "~X/~X/20~2X ~2X:~2X") - (a2-25 (-> s3-3 file s1-0 month)) - (a3-12 (-> s3-3 file s1-0 day)) - (t0-12 (-> s3-3 file s1-0 year)) - (t1-1 (-> s3-3 file s1-0 hour)) - (t2-1 (-> s3-3 file s1-0 minute)) - ) - (sv-144 a0-72 a1-29 a2-25 a3-12 t0-12 t1-1 t2-1) + (format + (clear *temp-string*) + "~X/~X/20~2X ~2X:~2X" + (-> s3-3 file s1-0 month) + (-> s3-3 file s1-0 day) + (-> s3-3 file s1-0 year) + (-> s3-3 file s1-0 hour) + (-> s3-3 file s1-0 minute) ) (s0-11 *temp-string* arg0 #f s4-1 22) ) @@ -1308,59 +1246,7 @@ ;; INFO: Used lq/sq ;; INFO: Return type mismatch int vs none. (defmethod draw-options ((this progress) (arg0 int) (arg1 int) (arg2 float)) - (local-vars - (sv-112 font-context) - (sv-128 int) - (sv-144 int) - (sv-160 (function _varargs_ object)) - (sv-176 string) - (sv-192 string) - (sv-208 string) - (sv-224 (function _varargs_ object)) - (sv-240 string) - (sv-256 string) - (sv-272 string) - (sv-288 (function string font-context symbol int int float)) - (sv-304 (function _varargs_ object)) - (sv-320 (function _varargs_ object)) - (sv-336 string) - (sv-352 string) - (sv-368 string) - (sv-384 (function _varargs_ object)) - (sv-400 string) - (sv-416 string) - (sv-432 string) - (sv-448 uint) - (sv-464 int) - (sv-480 int) - (sv-496 int) - (sv-512 int) - (sv-528 (function _varargs_ object)) - (sv-544 string) - (sv-560 string) - (sv-576 string) - (sv-592 (function _varargs_ object)) - (sv-608 string) - (sv-624 string) - (sv-640 string) - (sv-656 (function _varargs_ object)) - (sv-672 string) - (sv-688 string) - (sv-704 string) - (sv-720 (function _varargs_ object)) - (sv-736 string) - (sv-752 string) - (sv-768 string) - (sv-784 (function _varargs_ object)) - (sv-800 string) - (sv-816 string) - (sv-832 string) - (sv-848 (function _varargs_ object)) - (sv-864 string) - (sv-880 string) - (sv-896 string) - (sv-912 string) - ) + (local-vars (sv-464 int)) (let ((s3-0 (-> *options-remap* (-> this display-state)))) (when s3-0 (let ((s2-1 (- arg0 (/ (* arg1 (length s3-0)) 2))) @@ -1368,359 +1254,323 @@ ) 27 0 - (set! sv-112 - (new 'stack 'font-context *font-default-matrix* 0 0 0.0 (font-color default) (font-flags shadow kerning)) + (let ((sv-112 + (new 'stack 'font-context *font-default-matrix* 0 0 0.0 (font-color default) (font-flags shadow kerning)) + ) ) - (set-width! sv-112 350) - (set-height! sv-112 25) - (set! (-> sv-112 flags) (font-flags shadow kerning middle middle-vert large)) - (dotimes (s0-0 (length s3-0)) - (set! sv-912 (the-as string #f)) - (set! sv-128 27) - (set! sv-144 s2-1) - (let ((v1-18 (-> s3-0 s0-0 option-type))) - (cond - ((= v1-18 (game-option-type yes-no)) - (cond - ((-> (the-as (pointer uint32) (-> s3-0 s0-0 value-to-modify))) - (set! sv-160 format) - (set! sv-176 (clear *temp-string*)) - (set! sv-192 "~30L~S~0L ~S") - (set! sv-208 (lookup-text! *common-text* (text-id yes) #f)) - (let ((a3-2 (lookup-text! *common-text* (text-id no) #f))) - (sv-160 sv-176 sv-192 sv-208 a3-2) - ) - (set! sv-912 *temp-string*) - sv-912 + (set-width! sv-112 350) + (set-height! sv-112 25) + (set! (-> sv-112 flags) (font-flags shadow kerning middle middle-vert large)) + (dotimes (s0-0 (length s3-0)) + (let ((sv-912 (the-as string #f)) + (sv-128 27) + (sv-144 s2-1) ) - (else - (set! sv-224 format) - (set! sv-240 (clear *temp-string*)) - (set! sv-256 "~0L~S ~30L~S~1L") - (set! sv-272 (lookup-text! *common-text* (text-id yes) #f)) - (let ((a3-3 (lookup-text! *common-text* (text-id no) #f))) - (sv-224 sv-240 sv-256 sv-272 a3-3) - ) - (set! sv-912 *temp-string*) - sv-912 - ) - ) - ) - ((or (= v1-18 (game-option-type menu)) (= v1-18 (game-option-type button))) - (cond - ((nonzero? (-> s3-0 s0-0 name)) - (set! sv-912 (lookup-text! *common-text* (-> s3-0 s0-0 name) #f)) - sv-912 - ) - (else - (set! sv-912 (the-as string #f)) - (the-as symbol sv-912) - ) - ) - ) - ((and (-> this selected-option) (= (-> this option-index) s0-0)) - (let ((a0-19 sv-112)) - (set! (-> a0-19 color) (font-color default)) - ) - (set! (-> sv-112 origin x) (the float (- sv-128 (-> this left-x-offset)))) - (case (-> s3-0 s0-0 option-type) - (((game-option-type center-screen)) - (set! (-> sv-112 origin y) (the float (+ s2-1 -20))) - ) - (else - (set! (-> sv-112 origin y) (the float (+ s2-1 -8))) - ) - ) - (set-scale! sv-112 0.6) - (set! sv-288 print-game-text) - (let ((a0-23 (lookup-text! *common-text* (-> s3-0 s0-0 name) #f)) - (a1-11 sv-112) - (a2-10 #f) - (a3-4 128) - (t0-1 22) - ) - (sv-288 a0-23 a1-11 a2-10 a3-4 t0-1) - ) - (case (-> s3-0 s0-0 option-type) - (((game-option-type center-screen)) - (set! sv-144 (+ s2-1 3)) - sv-144 - ) - (else - (set! sv-144 (+ s2-1 7)) - sv-144 - ) - ) - (case (-> s3-0 s0-0 option-type) - (((game-option-type slider)) - (let* ((v1-82 (the-as uint #x8000ffff)) - (f0-12 (/ (-> (the-as (pointer float) (-> s3-0 s0-0 value-to-modify))) 100)) - (a0-34 (logior (logand v1-82 -256) (shr (shl (the int (+ 64.0 (* 191.0 f0-12))) 56) 56))) - (a3-5 (logior (logand a0-34 -65281) (shr (shl (shr (shl a0-34 56) 56) 56) 48))) - ) - (draw-percent-bar (- 75 (-> this left-x-offset)) (+ s2-1 8) f0-12 (the-as rgba a3-5)) - ) - (set! sv-304 format) - (let ((a0-42 (clear *temp-string*)) - (a1-13 "~D") - (a2-12 (the int (-> (the-as (pointer float) (-> s3-0 s0-0 value-to-modify))))) - ) - (sv-304 a0-42 a1-13 a2-12) - ) - (set! sv-912 *temp-string*) - (set! sv-128 (+ (the int (* 2.5 (-> (the-as (pointer float) (-> s3-0 s0-0 value-to-modify))))) -100)) - sv-128 - ) - (((game-option-type on-off)) - (cond - ((-> (the-as (pointer uint32) (-> s3-0 s0-0 value-to-modify))) - (set! sv-320 format) - (set! sv-336 (clear *temp-string*)) - (set! sv-352 "~30L~S~0L ~S") - (set! sv-368 (lookup-text! *common-text* (text-id on) #f)) - (let ((a3-6 (lookup-text! *common-text* (text-id off) #f))) - (sv-320 sv-336 sv-352 sv-368 a3-6) - ) - (set! sv-912 *temp-string*) - sv-912 - ) - (else - (set! sv-384 format) - (set! sv-400 (clear *temp-string*)) - (set! sv-416 "~0L~S ~30L~S~1L") - (set! sv-432 (lookup-text! *common-text* (text-id on) #f)) - (let ((a3-7 (lookup-text! *common-text* (text-id off) #f))) - (sv-384 sv-400 sv-416 sv-432 a3-7) + (let ((v1-18 (-> s3-0 s0-0 option-type))) + (cond + ((= v1-18 (game-option-type yes-no)) + (cond + ((-> (the-as (pointer uint32) (-> s3-0 s0-0 value-to-modify))) + (format + (clear *temp-string*) + "~30L~S~0L ~S" + (lookup-text! *common-text* (text-id yes) #f) + (lookup-text! *common-text* (text-id no) #f) ) (set! sv-912 *temp-string*) sv-912 ) - ) - ) - (((game-option-type language)) - (set! sv-512 (the-as int (-> this language-selection))) - (set! sv-448 (-> (the-as (pointer uint64) (-> s3-0 s0-0 value-to-modify)))) - (if (and (zero? (scf-get-territory)) - (not (and (= *progress-cheat* 'language) (cpad-hold? 0 l2) (cpad-hold? 0 r2))) - ) - (set! sv-464 5) - (set! sv-464 6) - ) - (if (-> this language-transition) - (seekl! (-> this language-x-offset) 200 (the int (* 10.0 (-> *display* time-adjust-ratio)))) - ) - (when (>= (-> this language-x-offset) 100) - (set! (-> this language-selection) (the-as language-enum sv-448)) - (set! sv-512 (the-as int sv-448)) - (set! (-> this language-transition) #f) - (set! (-> this language-x-offset) 0) - 0 - ) - (set! (-> sv-112 origin y) (the float (+ s2-1 3))) - (let ((a0-62 sv-112)) - (set! (-> a0-62 color) (font-color progress-blue)) - ) - 0 - (set! sv-480 (mod (+ sv-512 1) sv-464)) - (let ((a0-66 (mod (+ sv-464 -1 sv-512) sv-464)) - (v1-153 (mod (+ sv-512 2) sv-464)) - ) - (set! sv-496 (mod (+ sv-464 -2 sv-512) sv-464)) - (cond - ((-> this language-direction) - (let ((a2-22 (- 200 (+ (-> this language-x-offset) 100)))) - (print-language-name a0-66 sv-112 a2-22 #f) + (else + (format + (clear *temp-string*) + "~0L~S ~30L~S~1L" + (lookup-text! *common-text* (text-id yes) #f) + (lookup-text! *common-text* (text-id no) #f) ) - (let ((a2-23 (+ (-> this language-x-offset) 100))) - (cond - ((< a2-23 150) - (let ((t9-27 print-language-name) - (a1-30 sv-112) - (a3-9 #t) - ) - (t9-27 sv-480 a1-30 a2-23 a3-9) - ) + (set! sv-912 *temp-string*) + sv-912 + ) + ) + ) + ((or (= v1-18 (game-option-type menu)) (= v1-18 (game-option-type button))) + (cond + ((nonzero? (-> s3-0 s0-0 name)) + (set! sv-912 (lookup-text! *common-text* (-> s3-0 s0-0 name) #f)) + sv-912 + ) + (else + (set! sv-912 (the-as string #f)) + (the-as symbol (the-as symbol sv-912)) + ) + ) + ) + ((and (-> this selected-option) (= (-> this option-index) s0-0)) + (let ((a0-19 sv-112)) + (set! (-> a0-19 color) (font-color default)) + ) + (set! (-> sv-112 origin x) (the float (- sv-128 (-> this left-x-offset)))) + (case (-> s3-0 s0-0 option-type) + (((game-option-type center-screen)) + (set! (-> sv-112 origin y) (the float (+ s2-1 -20))) + ) + (else + (set! (-> sv-112 origin y) (the float (+ s2-1 -8))) + ) + ) + (set-scale! sv-112 0.6) + (print-game-text (lookup-text! *common-text* (-> s3-0 s0-0 name) #f) sv-112 #f 128 22) + (case (-> s3-0 s0-0 option-type) + (((game-option-type center-screen)) + (set! sv-144 (+ s2-1 3)) + sv-144 + ) + (else + (set! sv-144 (+ s2-1 7)) + sv-144 + ) + ) + (case (-> s3-0 s0-0 option-type) + (((game-option-type slider)) + (let* ((v1-82 (the-as uint #x8000ffff)) + (f0-12 (/ (-> (the-as (pointer float) (-> s3-0 s0-0 value-to-modify))) 100)) + (a0-34 (logior (logand v1-82 -256) (shr (shl (the int (+ 64.0 (* 191.0 f0-12))) 56) 56))) + (a3-5 (logior (logand a0-34 -65281) (shr (shl (shr (shl a0-34 56) 56) 56) 48))) + ) + (draw-percent-bar (- 75 (-> this left-x-offset)) (+ s2-1 8) f0-12 (the-as rgba a3-5)) + ) + (format (clear *temp-string*) "~D" (the int (-> (the-as (pointer float) (-> s3-0 s0-0 value-to-modify))))) + (set! sv-912 *temp-string*) + (set! sv-128 (+ (the int (* 2.5 (-> (the-as (pointer float) (-> s3-0 s0-0 value-to-modify))))) -100)) + sv-128 + ) + (((game-option-type on-off)) + (cond + ((-> (the-as (pointer uint32) (-> s3-0 s0-0 value-to-modify))) + (format + (clear *temp-string*) + "~30L~S~0L ~S" + (lookup-text! *common-text* (text-id on) #f) + (lookup-text! *common-text* (text-id off) #f) + ) + (set! sv-912 *temp-string*) + sv-912 + ) + (else + (format + (clear *temp-string*) + "~0L~S ~30L~S~1L" + (lookup-text! *common-text* (text-id on) #f) + (lookup-text! *common-text* (text-id off) #f) ) - (else - (let ((a2-24 (- 200 (-> this language-x-offset))) - (t9-28 print-language-name) - (a1-31 sv-112) - (a3-10 #f) + (set! sv-912 *temp-string*) + sv-912 + ) + ) + ) + (((game-option-type language)) + (let ((sv-512 (the-as int (-> this language-selection)))) + (let ((sv-448 (-> (the-as (pointer uint64) (-> s3-0 s0-0 value-to-modify))))) + (set! sv-464 (cond + ((and (zero? (scf-get-territory)) + (not (and (= *progress-cheat* 'language) (cpad-hold? 0 l2) (cpad-hold? 0 r2))) + ) + (set! sv-464 5) + sv-464 + ) + (else + 6 + ) + ) + ) + (if (-> this language-transition) + (seekl! (-> this language-x-offset) 200 (the int (* 10.0 (-> *display* time-adjust-ratio)))) + ) + (when (>= (-> this language-x-offset) 100) + (set! (-> this language-selection) (the-as language-enum sv-448)) + (set! sv-512 (the-as int sv-448)) + (set! (-> this language-transition) #f) + (set! (-> this language-x-offset) 0) + 0 + ) + ) + (set! (-> sv-112 origin y) (the float (+ s2-1 3))) + (let ((a0-62 sv-112)) + (set! (-> a0-62 color) (font-color progress-blue)) + ) + 0 + (let ((sv-480 (mod (+ sv-512 1) sv-464)) + (a0-66 (mod (+ sv-464 -1 sv-512) sv-464)) + (v1-153 (mod (+ sv-512 2) sv-464)) + (sv-496 (mod (+ sv-464 -2 sv-512) sv-464)) + ) + (cond + ((-> this language-direction) + (let ((a2-22 (- 200 (+ (-> this language-x-offset) 100)))) + (print-language-name a0-66 sv-112 a2-22 #f) + ) + (let ((a2-23 (+ (-> this language-x-offset) 100))) + (cond + ((< a2-23 150) + (print-language-name sv-480 sv-112 a2-23 #t) + ) + (else + (let ((a2-24 (- 200 (-> this language-x-offset)))) + (print-language-name sv-496 sv-112 a2-24 #f) + ) ) - (t9-28 sv-496 a1-31 a2-24 a3-10) + ) ) ) - ) - ) - ) - (else - (let ((a2-25 (+ (-> this language-x-offset) 100))) - (cond - ((< a2-25 150) - (print-language-name a0-66 sv-112 a2-25 #f) - ) (else - (let ((a2-26 (- 200 (-> this language-x-offset)))) - (print-language-name v1-153 sv-112 a2-26 #t) + (let ((a2-25 (+ (-> this language-x-offset) 100))) + (cond + ((< a2-25 150) + (print-language-name a0-66 sv-112 a2-25 #f) + ) + (else + (let ((a2-26 (- 200 (-> this language-x-offset)))) + (print-language-name v1-153 sv-112 a2-26 #t) + ) + ) + ) + ) + (let ((a2-27 (- 200 (+ (-> this language-x-offset) 100)))) + (print-language-name sv-480 sv-112 a2-27 #t) ) ) ) ) - (let ((a2-27 (- 200 (+ (-> this language-x-offset) 100)))) - (print-language-name sv-480 sv-112 a2-27 #t) + (when (not (-> this language-transition)) + (let ((a0-75 sv-112)) + (set! (-> a0-75 color) (font-color progress-selected)) + ) + ) + (print-language-name sv-512 sv-112 (-> this language-x-offset) (-> this language-direction)) + ) + ) + (((game-option-type center-screen)) + (set! sv-912 (lookup-text! *common-text* (text-id move-dpad) #f)) + sv-912 + ) + (((game-option-type aspect-ratio)) + (cond + ((= (-> (the-as (pointer uint32) (-> s3-0 s0-0 value-to-modify))) 'aspect4x3) + (format + (clear *temp-string*) + "~30L~S~0L ~S" + (lookup-text! *common-text* (text-id 4x3) #f) + (lookup-text! *common-text* (text-id 16x9) #f) + ) + (set! sv-912 *temp-string*) + sv-912 + ) + (else + (format + (clear *temp-string*) + "~0L~S ~30L~S~1L" + (lookup-text! *common-text* (text-id 4x3) #f) + (lookup-text! *common-text* (text-id 16x9) #f) + ) + (set! sv-912 *temp-string*) + sv-912 ) ) ) - ) - (when (not (-> this language-transition)) - (let ((a0-75 sv-112)) - (set! (-> a0-75 color) (font-color progress-selected)) - ) - ) - (let ((t9-32 print-language-name) - (a1-37 sv-112) - (a2-28 (-> this language-x-offset)) - (a3-14 (-> this language-direction)) - ) - (t9-32 sv-512 a1-37 a2-28 a3-14) - ) - ) - (((game-option-type center-screen)) - (set! sv-912 (lookup-text! *common-text* (text-id move-dpad) #f)) - sv-912 - ) - (((game-option-type aspect-ratio)) - (cond - ((= (-> (the-as (pointer uint32) (-> s3-0 s0-0 value-to-modify))) 'aspect4x3) - (set! sv-528 format) - (set! sv-544 (clear *temp-string*)) - (set! sv-560 "~30L~S~0L ~S") - (set! sv-576 (lookup-text! *common-text* (text-id 4x3) #f)) - (let ((a3-15 (lookup-text! *common-text* (text-id 16x9) #f))) - (sv-528 sv-544 sv-560 sv-576 a3-15) - ) - (set! sv-912 *temp-string*) - sv-912 - ) - (else - (set! sv-592 format) - (set! sv-608 (clear *temp-string*)) - (set! sv-624 "~0L~S ~30L~S~1L") - (set! sv-640 (lookup-text! *common-text* (text-id 4x3) #f)) - (let ((a3-16 (lookup-text! *common-text* (text-id 16x9) #f))) - (sv-592 sv-608 sv-624 sv-640 a3-16) - ) - (set! sv-912 *temp-string*) - sv-912 - ) - ) - ) - (((game-option-type video-mode)) - (cond - ((= (-> (the-as (pointer uint32) (-> s3-0 s0-0 value-to-modify))) 'ntsc) - (set! sv-656 format) - (set! sv-672 (clear *temp-string*)) - (set! sv-688 "~0L~S ~30L~S~1L") - (set! sv-704 (lookup-text! *common-text* (text-id 50hz) #f)) - (let ((a3-17 (lookup-text! *common-text* (text-id 60hz) #f))) - (sv-656 sv-672 sv-688 sv-704 a3-17) - ) - (set! sv-912 *temp-string*) - sv-912 - ) - (else - (set! sv-720 format) - (set! sv-736 (clear *temp-string*)) - (set! sv-752 "~30L~S~0L ~S") - (set! sv-768 (lookup-text! *common-text* (text-id 50hz) #f)) - (let ((a3-18 (lookup-text! *common-text* (text-id 60hz) #f))) - (sv-720 sv-736 sv-752 sv-768 a3-18) - ) - (set! sv-912 *temp-string*) - sv-912 - ) - ) - ) - ) - ) - (else - (case (-> s3-0 s0-0 option-type) - (((game-option-type slider) - (game-option-type center-screen) - (game-option-type aspect-ratio) - (game-option-type video-mode) - ) - (set! sv-912 (lookup-text! *common-text* (-> s3-0 s0-0 name) #f)) - sv-912 - ) - (((game-option-type on-off)) - (set! sv-784 format) - (set! sv-800 (clear *temp-string*)) - (set! sv-816 "~S: ~S") - (set! sv-832 (lookup-text! *common-text* (-> s3-0 s0-0 name) #f)) - (let ((a3-19 (if (-> (the-as (pointer uint32) (-> s3-0 s0-0 value-to-modify))) - (lookup-text! *common-text* (text-id on) #f) - (lookup-text! *common-text* (text-id off) #f) - ) - ) + (((game-option-type video-mode)) + (cond + ((= (-> (the-as (pointer uint32) (-> s3-0 s0-0 value-to-modify))) 'ntsc) + (format + (clear *temp-string*) + "~0L~S ~30L~S~1L" + (lookup-text! *common-text* (text-id 50hz) #f) + (lookup-text! *common-text* (text-id 60hz) #f) + ) + (set! sv-912 *temp-string*) + sv-912 ) - (sv-784 sv-800 sv-816 sv-832 a3-19) + (else + (format + (clear *temp-string*) + "~30L~S~0L ~S" + (lookup-text! *common-text* (text-id 50hz) #f) + (lookup-text! *common-text* (text-id 60hz) #f) + ) + (set! sv-912 *temp-string*) + sv-912 + ) + ) + ) ) - (set! sv-912 *temp-string*) - sv-912 ) - (((game-option-type language)) - (set! sv-848 format) - (set! sv-864 (clear *temp-string*)) - (set! sv-880 "~S: ~S") - (set! sv-896 (lookup-text! *common-text* (-> s3-0 s0-0 name) #f)) - (let ((a3-20 (lookup-text! - *common-text* - (-> *language-name-remap* (-> (the-as (pointer uint64) (-> s3-0 s0-0 value-to-modify)))) - #f - ) - ) + (else + (case (-> s3-0 s0-0 option-type) + (((game-option-type slider) + (game-option-type center-screen) + (game-option-type aspect-ratio) + (game-option-type video-mode) + ) + (set! sv-912 (lookup-text! *common-text* (-> s3-0 s0-0 name) #f)) + sv-912 + ) + (((game-option-type on-off)) + (let ((sv-784 format) + (sv-800 (clear *temp-string*)) + (sv-816 "~S: ~S") + (sv-832 (lookup-text! *common-text* (-> s3-0 s0-0 name) #f)) + ) + (sv-784 sv-800 sv-816 sv-832 (if (-> (the-as (pointer uint32) (-> s3-0 s0-0 value-to-modify))) + (lookup-text! *common-text* (text-id on) #f) + (lookup-text! *common-text* (text-id off) #f) + ) + ) ) - (sv-848 sv-864 sv-880 sv-896 a3-20) - ) - (set! sv-912 *temp-string*) - sv-912 - ) + (set! sv-912 *temp-string*) + sv-912 + ) + (((game-option-type language)) + (format + (clear *temp-string*) + "~S: ~S" + (lookup-text! *common-text* (-> s3-0 s0-0 name) #f) + (lookup-text! + *common-text* + (-> *language-name-remap* (-> (the-as (pointer uint64) (-> s3-0 s0-0 value-to-modify)))) + #f + ) + ) + (set! sv-912 *temp-string*) + sv-912 + ) + ) + ) + ) + ) + (when sv-912 + (let ((f0-23 (-> this transition-percentage-invert))) + (let ((v1-235 sv-112)) + (set! (-> v1-235 color) (if (and (= s0-0 (-> this option-index)) (not (-> this in-transition))) + (font-color progress-selected) + (font-color default) + ) + ) + ) + (set! (-> sv-112 origin x) (the float (- sv-128 (-> this left-x-offset)))) + (set! (-> sv-112 origin y) (the float (the int (* (the float sv-144) (if (-> s3-0 s0-0 scale) + f0-23 + 1.0 + ) + ) + ) + ) + ) + (set-scale! sv-112 (* arg2 f0-23)) + (print-game-text sv-912 sv-112 #f (the int (* 128.0 f0-23)) 22) ) ) ) + (+! s2-1 arg1) + (+! s1-0 1) ) - (when sv-912 - (let ((f0-23 (-> this transition-percentage-invert))) - (let ((v1-235 sv-112)) - (set! (-> v1-235 color) (if (and (= s0-0 (-> this option-index)) (not (-> this in-transition))) - (font-color progress-selected) - (font-color default) - ) - ) - ) - (set! (-> sv-112 origin x) (the float (- sv-128 (-> this left-x-offset)))) - (set! (-> sv-112 origin y) (the float (the int (* (the float sv-144) (if (-> s3-0 s0-0 scale) - f0-23 - 1.0 - ) - ) - ) - ) - ) - (set-scale! sv-112 (* arg2 f0-23)) - (let ((t9-60 print-game-text) - (a1-64 sv-112) - (a2-50 #f) - (a3-21 (the int (* 128.0 f0-23))) - (t0-2 22) - ) - (t9-60 sv-912 a1-64 a2-50 a3-21 t0-2) - ) - ) - ) - (+! s2-1 arg1) - (+! s1-0 1) ) ) ) diff --git a/test/decompiler/reference/jak1/engine/ui/progress/progress_REF.gc b/test/decompiler/reference/jak1/engine/ui/progress/progress_REF.gc index ce94e04d41..59f910fa1f 100644 --- a/test/decompiler/reference/jak1/engine/ui/progress/progress_REF.gc +++ b/test/decompiler/reference/jak1/engine/ui/progress/progress_REF.gc @@ -287,51 +287,45 @@ ;; definition for function calculate-completion (defun calculate-completion ((the-progress progress)) - (local-vars - (current-cells int) - (current-buzzers int) - (current-orbs int) - (total-cells int) - (total-buzzers int) - (total-orbs int) - ) - (set! current-cells 0) - (set! current-buzzers 0) - (set! current-orbs 0) - (set! total-cells 0) - (set! total-buzzers 0) - (set! total-orbs 0) - (dotimes (s5-0 (length *level-task-data*)) - (let ((s4-0 (-> *level-task-data* s5-0))) - (when (!= s4-0 #f) - (when (or (= *kernel-boot-message* 'play) (= (-> s4-0 level-name-id) (text-id misty-level-name))) - (dotimes (s3-0 (-> s4-0 nb-of-tasks)) - (if (= (get-task-status (-> s4-0 task-info s3-0 task-id)) (task-status invalid)) - (set! current-cells (+ current-cells 1)) + (let ((current-cells 0) + (current-buzzers 0) + (current-orbs 0) + (total-cells 0) + (total-buzzers 0) + (total-orbs 0) + ) + (dotimes (s5-0 (length *level-task-data*)) + (let ((s4-0 (-> *level-task-data* s5-0))) + (when (!= s4-0 #f) + (when (or (= *kernel-boot-message* 'play) (= (-> s4-0 level-name-id) (text-id misty-level-name))) + (dotimes (s3-0 (-> s4-0 nb-of-tasks)) + (if (= (get-task-status (-> s4-0 task-info s3-0 task-id)) (task-status invalid)) + (+! current-cells 1) + ) + ) + (+! total-cells (-> s4-0 nb-of-tasks)) + (+! current-orbs (-> *game-info* money-per-level s5-0)) + (+! total-orbs (-> *game-counts* data s5-0 money-count)) + (let ((v1-20 (-> s4-0 buzzer-task-index))) + (when (!= v1-20 -1) + (+! current-buzzers (buzzer-count *game-info* (-> s4-0 task-info v1-20 task-id))) + (+! total-buzzers (-> *game-counts* data s5-0 buzzer-count)) ) - ) - (set! total-cells (+ total-cells (-> s4-0 nb-of-tasks))) - (set! current-orbs (+ current-orbs (-> *game-info* money-per-level s5-0))) - (set! total-orbs (+ total-orbs (-> *game-counts* data s5-0 money-count))) - (let ((v1-20 (-> s4-0 buzzer-task-index))) - (when (!= v1-20 -1) - (set! current-buzzers (+ current-buzzers (buzzer-count *game-info* (-> s4-0 task-info v1-20 task-id)))) - (set! total-buzzers (+ total-buzzers (-> *game-counts* data s5-0 buzzer-count))) ) ) ) ) ) + (when the-progress + (set! (-> the-progress total-nb-of-power-cells) total-cells) + (set! (-> the-progress total-nb-of-buzzers) total-buzzers) + (set! (-> the-progress total-nb-of-orbs) total-orbs) + ) + (+ (/ (* 80.0 (the float current-cells)) (the float total-cells)) + (/ (* 10.0 (the float current-orbs)) (the float total-orbs)) + (/ (* 10.0 (the float current-buzzers)) (the float total-buzzers)) + ) ) - (when the-progress - (set! (-> the-progress total-nb-of-power-cells) total-cells) - (set! (-> the-progress total-nb-of-buzzers) total-buzzers) - (set! (-> the-progress total-nb-of-orbs) total-orbs) - ) - (+ (/ (* 80.0 (the float current-cells)) (the float total-cells)) - (/ (* 10.0 (the float current-orbs)) (the float total-orbs)) - (/ (* 10.0 (the float current-buzzers)) (the float total-buzzers)) - ) ) ;; definition for symbol *progress-save-info*, type mc-slot-info diff --git a/test/decompiler/reference/jak1/engine/ui/text_REF.gc b/test/decompiler/reference/jak1/engine/ui/text_REF.gc index 8970c2d8fc..6882f4575b 100644 --- a/test/decompiler/reference/jak1/engine/ui/text_REF.gc +++ b/test/decompiler/reference/jak1/engine/ui/text_REF.gc @@ -104,76 +104,78 @@ ;; definition for function load-game-text-info ;; WARN: Found some very strange gotos. Check result carefully, this is not well tested. (defun load-game-text-info ((txt-name string) (curr-text symbol) (heap kheap)) - (local-vars (v0-2 int) (heap-sym-heap game-text-info) (lang int) (load-status int) (heap-free int)) - (set! heap-sym-heap (the-as game-text-info (-> curr-text value))) - (set! lang (the-as int (-> *setting-control* current language))) - (set! load-status 0) - (set! heap-free (&- (-> heap top) (the-as uint (-> heap base)))) - (if (and (= (scf-get-territory) 1) (zero? lang)) - (set! lang 6) - ) - (when (or (= heap-sym-heap #f) - (!= (-> heap-sym-heap language-id) lang) - (not (string= (-> heap-sym-heap group-name) txt-name)) - ) - (let ((v1-16 heap)) - (set! (-> v1-16 current) (-> v1-16 base)) - ) - (b! #t cfg-14 :delay (nop!)) - (label cfg-13) - (set! v0-2 0) - (b! #t cfg-27 :delay (nop!)) - (label cfg-14) - (let ((s3-0 str-load)) - (format (clear *temp-string*) "~D~S.TXT" lang txt-name) - (b! - (not (s3-0 - *temp-string* - -1 - (logand -64 (&+ (-> heap current) 63)) - (&- (-> heap top) (the-as uint (-> heap current))) - ) - ) - cfg-13 - :delay (nop!) + (local-vars (v0-2 int)) + (let ((heap-sym-heap (the-as game-text-info (-> curr-text value))) + (lang (the-as int (-> *setting-control* current language))) + (load-status 0) + (heap-free (&- (-> heap top) (the-as uint (-> heap base)))) ) - ) - (label cfg-16) - (let ((v1-20 (str-load-status (the-as (pointer int32) (& load-status))))) - (b! (!= v1-20 'error) cfg-19 :delay (empty-form)) - (format 0 "Error loading text~%") + (if (and (= (scf-get-territory) 1) (zero? (the-as language-enum lang))) + (set! lang 6) + ) + (when (or (= heap-sym-heap #f) + (!= (-> heap-sym-heap language-id) lang) + (not (string= (-> heap-sym-heap group-name) txt-name)) + ) + (let ((v1-16 heap)) + (set! (-> v1-16 current) (-> v1-16 base)) + ) + (b! #t cfg-14 :delay (nop!)) + (label cfg-13) (set! v0-2 0) (b! #t cfg-27 :delay (nop!)) - (the-as none 0) - (b! #t cfg-24 :delay (nop!)) - (label cfg-19) - (cond - ((>= load-status (+ heap-free -300)) - (format 0 "Game text heap overrun!~%") - (return 0) - ) - ((= v1-20 'busy) - (nop!) - (nop!) - (nop!) - (nop!) - (nop!) - (nop!) - (goto cfg-16) - ) - ) - ) - (label cfg-24) - (let ((s2-1 (logand -64 (&+ (-> heap current) 63)))) - (flush-cache 0) - (let ((s3-1 link)) + (label cfg-14) + (let ((s3-0 str-load)) (format (clear *temp-string*) "~D~S.TXT" lang txt-name) - (set! (-> curr-text value) (s3-1 s2-1 (-> *temp-string* data) load-status heap 0)) + (b! + (not (s3-0 + *temp-string* + -1 + (logand -64 (&+ (-> heap current) 63)) + (&- (-> heap top) (the-as uint (-> heap current))) + ) + ) + cfg-13 + :delay (nop!) + ) ) + (label cfg-16) + (let ((v1-20 (str-load-status (the-as (pointer int32) (& load-status))))) + (b! (!= v1-20 'error) cfg-19 :delay (empty-form)) + (format 0 "Error loading text~%") + (set! v0-2 0) + (b! #t cfg-27 :delay (nop!)) + (the-as none 0) + (b! #t cfg-24 :delay (nop!)) + (label cfg-19) + (cond + ((>= load-status (+ heap-free -300)) + (format 0 "Game text heap overrun!~%") + (return 0) + ) + ((= v1-20 'busy) + (nop!) + (nop!) + (nop!) + (nop!) + (nop!) + (nop!) + (goto cfg-16) + ) + ) + ) + (label cfg-24) + (let ((s2-1 (logand -64 (&+ (-> heap current) 63)))) + (flush-cache 0) + (let ((s3-1 link)) + (format (clear *temp-string*) "~D~S.TXT" lang txt-name) + (set! (-> curr-text value) (s3-1 s2-1 (-> *temp-string* data) load-status heap 0)) + ) + ) + (if (<= (the-as int (-> curr-text value)) 0) + (set! (-> curr-text value) (the-as object #f)) + ) ) - (if (<= (the-as int (-> curr-text value)) 0) - (set! (-> curr-text value) (the-as object #f)) - ) ) (set! v0-2 0) (label cfg-27) @@ -338,29 +340,6 @@ ;; WARN: Stack slot offset 132 signed mismatch ;; WARN: Stack slot offset 164 signed mismatch (defun print-game-text ((str string) (font-ctxt font-context) (opaque symbol) (alpha int) (line-height int)) - (local-vars - (sv-112 float) - (sv-116 float) - (sv-120 float) - (sv-124 float) - (sv-128 float) - (sv-132 float) - (sv-136 float) - (sv-140 (pointer uint8)) - (sv-144 float) - (sv-148 float) - (sv-152 float) - (sv-156 float) - (sv-160 float) - (sv-164 float) - (sv-168 int) - (sv-176 int) - (sv-184 int) - (sv-192 int) - (sv-200 int) - (sv-208 symbol) - (sv-212 symbol) - ) (let ((gp-0 (new 'stack 'font-context @@ -374,174 +353,190 @@ ) ) (when (< 0.1 (-> font-ctxt scale)) - (set! sv-112 (-> font-ctxt mat vector 0 x)) - (set! sv-116 (-> font-ctxt mat vector 1 y)) - (set! sv-120 (-> *video-parms* relative-x-scale)) - (set! sv-124 (-> *video-parms* relative-y-scale)) - (set! sv-128 (-> *video-parms* relative-x-scale-reciprical)) - (set! sv-132 (-> *video-parms* relative-y-scale-reciprical)) - (set! sv-136 (-> font-ctxt scale)) - (set! (-> gp-0 origin z) (-> font-ctxt origin z)) - (set! (-> gp-0 flags) (-> font-ctxt flags)) - (set! (-> gp-0 color) (-> font-ctxt color)) - (set! (-> gp-0 scale) sv-136) - (when (logtest? (-> gp-0 flags) (font-flags middle-vert)) - (logclear! (-> gp-0 flags) (font-flags middle-vert)) - (let ((f30-0 (-> gp-0 width)) - (f28-0 (-> gp-0 height)) - ) - (set! (-> gp-0 width) (-> font-ctxt width)) - (set! (-> gp-0 height) (-> font-ctxt height)) - (+! (-> gp-0 origin y) - (the float (the int (* 0.5 (- (-> gp-0 height) (print-game-text str gp-0 #t 128 22))))) - ) - (set! (-> gp-0 width) f30-0) - (set! (-> gp-0 height) f28-0) + (let ((sv-112 (-> font-ctxt mat vector 0 x)) + (sv-116 (-> font-ctxt mat vector 1 y)) + (sv-120 (-> *video-parms* relative-x-scale)) + (sv-124 (-> *video-parms* relative-y-scale)) + (sv-128 (-> *video-parms* relative-x-scale-reciprical)) + (sv-132 (-> *video-parms* relative-y-scale-reciprical)) + (sv-136 (-> font-ctxt scale)) + ) + (set! (-> gp-0 origin z) (-> font-ctxt origin z)) + (set! (-> gp-0 flags) (-> font-ctxt flags)) + (set! (-> gp-0 color) (-> font-ctxt color)) + (set! (-> gp-0 scale) sv-136) + (when (logtest? (-> gp-0 flags) (font-flags middle-vert)) + (logclear! (-> gp-0 flags) (font-flags middle-vert)) + (let ((f30-0 (-> gp-0 width)) + (f28-0 (-> gp-0 height)) + ) + (set! (-> gp-0 width) (-> font-ctxt width)) + (set! (-> gp-0 height) (-> font-ctxt height)) + (+! (-> gp-0 origin y) + (the float (the int (* 0.5 (- (-> gp-0 height) (print-game-text str gp-0 #t 128 22))))) + ) + (set! (-> gp-0 width) f30-0) + (set! (-> gp-0 height) f28-0) + ) ) - ) - (set! (-> gp-0 mat vector 0 x) (* (-> gp-0 mat vector 0 x) sv-136)) - (set! (-> gp-0 mat vector 1 y) (* (-> gp-0 mat vector 1 y) sv-136)) - (set! (-> *video-parms* relative-x-scale) (* (-> *video-parms* relative-x-scale) sv-136)) - (set! (-> *video-parms* relative-y-scale) (* (-> *video-parms* relative-y-scale) sv-136)) - (set! (-> *video-parms* relative-x-scale-reciprical) (/ 1.0 (-> *video-parms* relative-x-scale))) - (set! (-> *video-parms* relative-y-scale-reciprical) (/ 1.0 sv-136)) - (set! sv-140 (-> str data)) - (set! sv-144 (-> gp-0 origin x)) - (set! sv-148 (-> gp-0 origin x)) - (set! sv-152 (+ (-> gp-0 origin x) (-> font-ctxt width))) - (set! sv-156 (+ (-> gp-0 origin y) (-> font-ctxt height))) - (set! sv-160 (* (get-string-length " " gp-0) (-> *video-parms* relative-x-scale))) - (set! sv-164 (* (if (logtest? (-> gp-0 flags) (font-flags large)) - (the float line-height) - 14.0 - ) - sv-136 + (set! (-> gp-0 mat vector 0 x) (* (-> gp-0 mat vector 0 x) sv-136)) + (set! (-> gp-0 mat vector 1 y) (* (-> gp-0 mat vector 1 y) sv-136)) + (set! (-> *video-parms* relative-x-scale) (* (-> *video-parms* relative-x-scale) sv-136)) + (set! (-> *video-parms* relative-y-scale) (* (-> *video-parms* relative-y-scale) sv-136)) + (set! (-> *video-parms* relative-x-scale-reciprical) (/ 1.0 (-> *video-parms* relative-x-scale))) + (set! (-> *video-parms* relative-y-scale-reciprical) (/ 1.0 sv-136)) + (let ((sv-140 (-> str data)) + (sv-144 (-> gp-0 origin x)) + (sv-148 (-> gp-0 origin x)) + (sv-152 (+ (-> gp-0 origin x) (-> font-ctxt width))) + (sv-156 (+ (-> gp-0 origin y) (-> font-ctxt height))) + (sv-160 (* (get-string-length " " gp-0) (-> *video-parms* relative-x-scale))) + (sv-164 (* (if (logtest? (-> gp-0 flags) (font-flags large)) + (the float line-height) + 14.0 + ) + sv-136 + ) ) - ) - (set! sv-168 0) - (if (logtest? (-> gp-0 flags) (font-flags middle)) - (+! (-> gp-0 origin x) (/ (-> font-ctxt width) 2)) - ) - (set! sv-176 (the-as int (-> sv-140 0))) - (set! sv-184 0) - (set! sv-192 0) - (set! sv-200 0) - (set! sv-208 (the-as symbol #f)) - (set! sv-212 (the-as symbol #f)) - (set! (-> *game-text-line* data 0) (the-as uint 0)) - (while (or (not (and (zero? sv-176) (zero? sv-184) (zero? sv-192))) (>= sv-156 (-> gp-0 origin y))) - (cond - ((= sv-176 32) - (set! (-> *game-text-word* data sv-184) (the-as uint sv-176)) - (set! sv-184 (+ sv-184 1)) - (set! sv-208 #t) - ) - ((zero? sv-176) - (if (zero? sv-184) - (set! sv-212 #t) - (set! sv-208 #t) - ) - ) - (else - (if (= sv-176 95) - (set! sv-176 32) - ) - (set! (-> *game-text-word* data sv-184) (the-as uint sv-176)) - (set! sv-184 (+ sv-184 1)) - ) - ) - (when (= sv-208 #t) - (set! (-> *game-text-word* data sv-184) (the-as uint 0)) - (let* ((f30-1 sv-144) - (f0-49 (* (get-string-length *game-text-word* gp-0) (-> *video-parms* relative-x-scale))) - (f1-14 (+ f30-1 f0-49)) - ) - (if (= (-> *game-text-word* data (+ sv-184 -1)) 32) - (set! f1-14 (- f1-14 sv-160)) - ) - (cond - ((< sv-152 f1-14) - (set! sv-144 (+ sv-148 f0-49)) - (set! sv-212 #t) - ) - (else - (set! sv-144 (+ sv-144 f0-49)) - ) + (sv-168 0) ) - ) - ) - (when (= sv-212 #t) - (when (>= sv-200 (the-as int (-> gp-0 start-line))) - (let ((f30-2 (+ (-> gp-0 origin y) sv-164))) - (when (>= sv-156 f30-2) - (when (= (-> *game-text-line* data (+ sv-192 -1)) 32) - (set! (-> *game-text-line* data (+ sv-192 -1)) (the-as uint 0)) - (when (and (= (-> *game-text-line* data (+ sv-192 -5)) 126) (= (-> *game-text-line* data (+ sv-192 -2)) 72)) - (set! (-> *game-text-line* data (+ sv-192 -5)) (the-as uint 0)) - 0 + (if (logtest? (-> gp-0 flags) (font-flags middle)) + (+! (-> gp-0 origin x) (/ (-> font-ctxt width) 2)) + ) + (let ((sv-176 (the-as int (-> sv-140 0))) + (sv-184 0) + (sv-192 0) + (sv-200 0) + (sv-208 (the-as symbol #f)) + (sv-212 (the-as symbol #f)) + ) + (set! (-> *game-text-line* data 0) (the-as uint 0)) + (while (or (not (and (zero? sv-176) (zero? sv-184) (zero? sv-192))) (>= sv-156 (-> gp-0 origin y))) + (set! sv-208 (cond + ((= sv-176 32) + (set! (-> *game-text-word* data sv-184) (the-as uint sv-176)) + (+! sv-184 1) + (set! sv-208 #t) + sv-208 + ) + ((zero? sv-176) + (cond + ((zero? sv-184) + (set! sv-212 #t) + sv-208 + ) + (else + #t + ) + ) + ) + (else + (if (= sv-176 95) + (set! sv-176 32) + ) + (set! (-> *game-text-word* data sv-184) (the-as uint sv-176)) + (+! sv-184 1) + sv-208 + ) + ) ) - ) - ) - (when (and (= (-> *game-text-line* data (+ sv-192 -4)) 126) (= (-> *game-text-line* data (+ sv-192 -1)) 72)) - (set! (-> *game-text-line* data (+ sv-192 -4)) (the-as uint 0)) - 0 - ) - (if (nonzero? (-> *game-text-line* data 0)) - (set! sv-168 (+ sv-168 1)) - ) - (when (not opaque) - (let* ((s1-1 (-> *display* frames (-> *display* on-screen) frame global-buf)) - (s2-1 (-> s1-1 base)) + (when (= sv-208 #t) + (set! (-> *game-text-word* data sv-184) (the-as uint 0)) + (let* ((f30-1 sv-144) + (f0-49 (* (get-string-length *game-text-word* gp-0) (-> *video-parms* relative-x-scale))) + (f1-14 (+ f30-1 f0-49)) ) - (set-font-color-alpha (-> font-ctxt color) alpha) - (draw-string *game-text-line* s1-1 gp-0) - (set-font-color-alpha (-> font-ctxt color) 128) - (set! (-> gp-0 color) (-> *font-work* last-color)) - (let ((a3-3 (-> s1-1 base))) - (let ((v1-127 (the-as object (-> s1-1 base)))) - (set! (-> (the-as dma-packet v1-127) dma) (new 'static 'dma-tag :id (dma-tag-id next))) - (set! (-> (the-as dma-packet v1-127) vif0) (new 'static 'vif-tag)) - (set! (-> (the-as dma-packet v1-127) vif1) (new 'static 'vif-tag)) - (set! (-> s1-1 base) (&+ (the-as pointer v1-127) 16)) + (if (= (-> *game-text-word* data (+ sv-184 -1)) 32) + (set! f1-14 (- f1-14 sv-160)) ) - (dma-bucket-insert-tag - (-> *display* frames (-> *display* on-screen) frame bucket-group) - (bucket-id debug) - s2-1 - (the-as (pointer dma-tag) a3-3) - ) - ) + (set! sv-212 (cond + ((< sv-152 f1-14) + (set! sv-144 (+ sv-148 f0-49)) + #t + ) + (else + (+! sv-144 f0-49) + sv-212 + ) + ) + ) ) ) - (set! (-> gp-0 origin y) f30-2) + (when (= sv-212 #t) + (when (>= sv-200 (the-as int (-> gp-0 start-line))) + (let ((f30-2 (+ (-> gp-0 origin y) sv-164))) + (when (>= sv-156 f30-2) + (when (= (-> *game-text-line* data (+ sv-192 -1)) 32) + (set! (-> *game-text-line* data (+ sv-192 -1)) (the-as uint 0)) + (when (and (= (-> *game-text-line* data (+ sv-192 -5)) 126) (= (-> *game-text-line* data (+ sv-192 -2)) 72)) + (set! (-> *game-text-line* data (+ sv-192 -5)) (the-as uint 0)) + 0 + ) + ) + ) + (when (and (= (-> *game-text-line* data (+ sv-192 -4)) 126) (= (-> *game-text-line* data (+ sv-192 -1)) 72)) + (set! (-> *game-text-line* data (+ sv-192 -4)) (the-as uint 0)) + 0 + ) + (if (nonzero? (-> *game-text-line* data 0)) + (+! sv-168 1) + ) + (when (not opaque) + (let* ((s1-1 (-> *display* frames (-> *display* on-screen) frame global-buf)) + (s2-1 (-> s1-1 base)) + ) + (set-font-color-alpha (-> font-ctxt color) alpha) + (draw-string *game-text-line* s1-1 gp-0) + (set-font-color-alpha (-> font-ctxt color) 128) + (set! (-> gp-0 color) (-> *font-work* last-color)) + (let ((a3-3 (-> s1-1 base))) + (let ((v1-127 (the-as object (-> s1-1 base)))) + (set! (-> (the-as dma-packet v1-127) dma) (new 'static 'dma-tag :id (dma-tag-id next))) + (set! (-> (the-as dma-packet v1-127) vif0) (new 'static 'vif-tag)) + (set! (-> (the-as dma-packet v1-127) vif1) (new 'static 'vif-tag)) + (set! (-> s1-1 base) (&+ (the-as pointer v1-127) 16)) + ) + (dma-bucket-insert-tag + (-> *display* frames (-> *display* on-screen) frame bucket-group) + (bucket-id debug) + s2-1 + (the-as (pointer dma-tag) a3-3) + ) + ) + ) + ) + (set! (-> gp-0 origin y) f30-2) + ) + ) + (+! sv-200 1) + (set! (-> *game-text-line* data 0) (the-as uint 0)) + (set! sv-192 0) + (set! sv-212 (the-as symbol #f)) + ) + (when (= sv-208 #t) + (copy-charp<-charp (&-> *game-text-line* data sv-192) (-> *game-text-word* data)) + (+! sv-192 sv-184) + (set! sv-184 0) + (set! sv-208 (the-as symbol #f)) + ) + (when (nonzero? sv-176) + (set! sv-140 (&-> sv-140 1)) + (set! sv-176 (the-as int (-> sv-140 0))) + ) ) ) - (set! sv-200 (+ sv-200 1)) - (set! (-> *game-text-line* data 0) (the-as uint 0)) - (set! sv-192 0) - (set! sv-212 (the-as symbol #f)) - ) - (when (= sv-208 #t) - (copy-charp<-charp (&-> *game-text-line* data sv-192) (-> *game-text-word* data)) - (set! sv-192 (+ sv-192 sv-184)) - (set! sv-184 0) - (set! sv-208 (the-as symbol #f)) - ) - (when (nonzero? sv-176) - (set! sv-140 (&-> sv-140 1)) - (set! sv-176 (the-as int (-> sv-140 0))) + (set! (-> gp-0 mat vector 0 x) sv-112) + (set! (-> gp-0 mat vector 1 y) sv-116) + (set! (-> *video-parms* relative-x-scale) sv-120) + (set! (-> *video-parms* relative-y-scale) sv-124) + (set! (-> *video-parms* relative-x-scale-reciprical) sv-128) + (set! (-> *video-parms* relative-y-scale-reciprical) sv-132) + (if (> sv-168 0) + (* sv-164 (the float sv-168)) + 0.0 + ) ) ) - (set! (-> gp-0 mat vector 0 x) sv-112) - (set! (-> gp-0 mat vector 1 y) sv-116) - (set! (-> *video-parms* relative-x-scale) sv-120) - (set! (-> *video-parms* relative-y-scale) sv-124) - (set! (-> *video-parms* relative-x-scale-reciprical) sv-128) - (set! (-> *video-parms* relative-y-scale-reciprical) sv-132) - (if (> sv-168 0) - (* sv-164 (the float sv-168)) - 0.0 - ) ) ) ) diff --git a/test/decompiler/reference/jak1/engine/util/capture_REF.gc b/test/decompiler/reference/jak1/engine/util/capture_REF.gc index edae6e0c62..ce6ea803d0 100644 --- a/test/decompiler/reference/jak1/engine/util/capture_REF.gc +++ b/test/decompiler/reference/jak1/engine/util/capture_REF.gc @@ -78,7 +78,6 @@ ;; definition for function store-image ;; INFO: Used lq/sq (defun store-image ((oddeven int)) - (local-vars (ptr-1 (pointer uint128)) (y-idx int) (y-idx-2 int)) (let ((width 512) (height (-> *video-parms* screen-sy)) (file (new 'debug 'file-stream "image.raw" 'write)) @@ -95,23 +94,26 @@ (gs-store-image packet (-> buff1 data)) ) (sync-path 0 0) - (let ((ptr-0 (-> buff0 data))) - (set! ptr-1 (-> buff1 data)) + (let ((ptr-0 (-> buff0 data)) + (ptr-1 (-> buff1 data)) + ) (cond ((zero? oddeven) - (set! y-idx 0) - (while (< y-idx height) - (file-stream-write file (&+ ptr-0 (* y-idx (* width 4))) (the-as uint (* width 4))) - (file-stream-write file (&+ ptr-1 (* y-idx (* width 4))) (the-as uint (* width 4))) - (set! y-idx (+ y-idx 1)) + (let ((y-idx 0)) + (while (< y-idx height) + (file-stream-write file (&+ ptr-0 (* y-idx (* width 4))) (the-as uint (* width 4))) + (file-stream-write file (&+ ptr-1 (* y-idx (* width 4))) (the-as uint (* width 4))) + (+! y-idx 1) + ) ) ) (else - (set! y-idx-2 0) - (while (< y-idx-2 height) - (file-stream-write file (&+ ptr-1 (* y-idx-2 (* width 4))) (the-as uint (* width 4))) - (file-stream-write file (&+ ptr-0 (* y-idx-2 (* width 4))) (the-as uint (* width 4))) - (set! y-idx-2 (+ y-idx-2 1)) + (let ((y-idx-2 0)) + (while (< y-idx-2 height) + (file-stream-write file (&+ ptr-1 (* y-idx-2 (* width 4))) (the-as uint (* width 4))) + (file-stream-write file (&+ ptr-0 (* y-idx-2 (* width 4))) (the-as uint (* width 4))) + (+! y-idx-2 1) + ) ) ) ) diff --git a/test/decompiler/reference/jak1/engine/util/sync-info_REF.gc b/test/decompiler/reference/jak1/engine/util/sync-info_REF.gc index d0608b7521..7ea65c6fea 100644 --- a/test/decompiler/reference/jak1/engine/util/sync-info_REF.gc +++ b/test/decompiler/reference/jak1/engine/util/sync-info_REF.gc @@ -43,7 +43,7 @@ (let* ((total-normal-phase (- 1.0 total-easing-phase)) (f0-10 out-param) (f1-12 (+ out-param total-normal-phase)) - (f2-5 (* f0-10 f0-10)) + (f2-5 (square f0-10)) (f3-3 (+ (* 2.0 f0-10 (- f1-12 f0-10)) f2-5)) (f4-3 (/ f0-10 (- 1.0 f1-12))) (y-end (+ (* (- 1.0 f1-12) (- 1.0 f1-12) f4-3) f3-3)) @@ -99,9 +99,9 @@ (default-out float) (default-in float) ) - (local-vars (sv-16 res-tag)) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-1 (res-lump-data (-> proc entity) 'sync pointer :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-1 (res-lump-data (-> proc entity) 'sync pointer :tag-ptr (& sv-16))) + ) (cond (v1-1 (setup-params! @@ -130,9 +130,9 @@ (default-out float) (default-in float) ) - (local-vars (sv-16 res-tag)) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-1 (res-lump-data (-> proc entity) 'sync pointer :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-1 (res-lump-data (-> proc entity) 'sync pointer :tag-ptr (& sv-16))) + ) (cond (v1-1 (if (>= (-> sv-16 elt-count) (the-as uint 4)) @@ -170,9 +170,9 @@ (default-out float) (default-in float) ) - (local-vars (sv-16 res-tag)) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-1 (res-lump-data (-> proc entity) 'sync pointer :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-1 (res-lump-data (-> proc entity) 'sync pointer :tag-ptr (& sv-16))) + ) (cond (v1-1 (if (>= (-> sv-16 elt-count) (the-as uint 4)) @@ -317,14 +317,14 @@ (let* ((tlo (-> this tlo)) (eased-phase (/ (cond ((< current-val tlo) - (* current-val current-val) + (square current-val) ) ((< current-val (-> this thi)) (+ (* 2.0 tlo (- current-val tlo)) (-> this ylo)) ) (else (let ((f1-7 (- 1.0 current-val))) - (- (-> this yend) (* f1-7 f1-7 (-> this m2))) + (- (-> this yend) (* (square f1-7) (-> this m2))) ) ) ) diff --git a/test/decompiler/reference/jak1/kernel/gstate_REF.gc b/test/decompiler/reference/jak1/kernel/gstate_REF.gc index 0d4c7724b8..49f9a6a90c 100644 --- a/test/decompiler/reference/jak1/kernel/gstate_REF.gc +++ b/test/decompiler/reference/jak1/kernel/gstate_REF.gc @@ -47,7 +47,7 @@ ;; ERROR: Unsupported inline assembly instruction kind - [jr t9] ;; ERROR: Unsupported inline assembly instruction kind - [sw v0, 0(sp)] (defun enter-state ((arg0 object) (arg1 object) (arg2 object) (arg3 object) (arg4 object) (arg5 object)) - (local-vars (s7-0 none) (sp-0 int) (ra-0 int) (sv-0 none)) + (local-vars (s7-0 none) (sp-0 int) (ra-0 int)) (with-pp (logclear! (-> pp mask) (process-mask sleep sleep-code)) (logior! (-> pp mask) (process-mask going)) diff --git a/test/decompiler/reference/jak1/levels/beach/beach-obs_REF.gc b/test/decompiler/reference/jak1/levels/beach/beach-obs_REF.gc index a7496724ee..d4dd356040 100644 --- a/test/decompiler/reference/jak1/levels/beach/beach-obs_REF.gc +++ b/test/decompiler/reference/jak1/levels/beach/beach-obs_REF.gc @@ -592,7 +592,6 @@ (set-time! (-> self state-time)) ) :code (behavior ((arg0 symbol)) - (local-vars (sv-128 symbol)) (ja-channel-set! 0) (clear-collide-with-as (-> self root)) (ja-post) @@ -623,7 +622,7 @@ (f1-2 (- (-> s5-1 z) (-> v1-14 z))) (f2-1 7372.8) (f30-0 5734.4) - (f2-2 (/ f2-1 (sqrtf (+ (* f0-1 f0-1) (* f1-2 f1-2))))) + (f2-2 (/ f2-1 (sqrtf (+ (square f0-1) (square f1-2))))) (f28-0 (* f0-1 f2-2)) (f26-0 (* f1-2 f2-2)) (s4-0 (new-stack-vector0)) @@ -660,32 +659,33 @@ ) ) (when (or (-> self link prev) (-> self link next)) - (set! sv-128 (the-as symbol #f)) - (apply-all (-> self link) actor-link-subtask-complete-hook (& sv-128)) - (when sv-128 - (suspend-for (seconds 0.5) - ) - (let ((gp-1 (cond - (arg0 - (the-as int #f) - ) - (else - (ambient-hint-spawn "gamcam10" (the-as vector #f) *entity-pool* 'camera) - (ppointer->handle - (process-spawn pov-camera (-> self root trans) *beachcam-sg* (-> self name) 0 #f '() :to self) + (let ((sv-128 (the-as symbol #f))) + (apply-all (-> self link) actor-link-subtask-complete-hook (& sv-128)) + (when sv-128 + (suspend-for (seconds 0.5) + ) + (let ((gp-1 (cond + (arg0 + (the-as int #f) + ) + (else + (ambient-hint-spawn "gamcam10" (the-as vector #f) *entity-pool* 'camera) + (ppointer->handle + (process-spawn pov-camera (-> self root trans) *beachcam-sg* (-> self name) 0 #f '() :to self) + ) ) ) ) - ) + ) + (process-drawable-birth-fuel-cell (the-as entity #f) (the-as vector #f) #f) + (while (handle->process (the-as handle gp-1)) + (suspend) ) - (process-drawable-birth-fuel-cell (the-as entity #f) (the-as vector #f) #f) - (while (handle->process (the-as handle gp-1)) + ) + (while (-> self child) (suspend) ) ) - (while (-> self child) - (suspend) - ) ) ) (process-entity-status! self (entity-perm-status dead) #t) diff --git a/test/decompiler/reference/jak1/levels/citadel/citadel-obs_REF.gc b/test/decompiler/reference/jak1/levels/citadel/citadel-obs_REF.gc index 216ecbfa88..3f9441ac94 100644 --- a/test/decompiler/reference/jak1/levels/citadel/citadel-obs_REF.gc +++ b/test/decompiler/reference/jak1/levels/citadel/citadel-obs_REF.gc @@ -869,51 +869,37 @@ ;; failed to figure out what this is: (defstate citb-robotboss-idle (citb-robotboss) :event (behavior ((proc process) (argc int) (message symbol) (block event-message-block)) - (local-vars (sv-96 int) (sv-112 int)) - (the-as - symbol - (cond - ((= message 'shield-off) - (stop! (-> self sound)) - (if (-> self shield-on) - (sound-play "robotcage-off") - ) - (set! (-> self shield-on) #f) - #f - ) - ((= message 'shield-on) - (let ((v0-3 #t)) - (set! (-> self shield-on) v0-3) - v0-3 - ) - ) - ((= message 'die) - (cleanup-for-death self) - (the-as symbol (deactivate self)) - ) - ((or (= message 'touch) (= message 'attack)) - (let ((s4-0 sound-play-by-name) - (s3-0 (make-u128 #x7061 (the-as uint #x7a2d646c65696873))) - (s2-0 (new-sound-id)) - (s1-0 1024) - (s0-0 0) - ) - (set! sv-96 0) - (set! sv-112 1) - (let ((t2-1 (target-pos 0))) - (s4-0 (the-as sound-name s3-0) s2-0 s1-0 s0-0 sv-96 (the-as sound-group sv-112) (the-as symbol t2-1)) - ) - ) - (the-as symbol (send-event - proc - 'shove - (-> block param 0) - (static-attack-info ((shove-up (meters 2)) (shove-back (meters 3)))) + (the-as symbol (cond + ((= message 'shield-off) + (stop! (-> self sound)) + (if (-> self shield-on) + (sound-play "robotcage-off") ) - ) - ) - ) - ) + (set! (-> self shield-on) #f) + #f + ) + ((= message 'shield-on) + (let ((v0-3 #t)) + (set! (-> self shield-on) v0-3) + v0-3 + ) + ) + ((= message 'die) + (cleanup-for-death self) + (the-as symbol (deactivate self)) + ) + ((or (= message 'touch) (= message 'attack)) + (sound-play "shield-zap" :position (the-as symbol (target-pos 0))) + (the-as symbol (send-event + proc + 'shove + (-> block param 0) + (static-attack-info ((shove-up (meters 2)) (shove-back (meters 3)))) + ) + ) + ) + ) + ) ) :code (behavior () (let ((gp-0 (manipy-spawn (-> self root trans) (-> self entity) *citb-robotboss-nose-sg* #f :to self))) diff --git a/test/decompiler/reference/jak1/levels/citadel/citadel-part_REF.gc b/test/decompiler/reference/jak1/levels/citadel/citadel-part_REF.gc index ff1b0cd7c4..25c207fa5c 100644 --- a/test/decompiler/reference/jak1/levels/citadel/citadel-part_REF.gc +++ b/test/decompiler/reference/jak1/levels/citadel/citadel-part_REF.gc @@ -610,7 +610,7 @@ (set! (-> v1-3 x) f0-13) (set! (-> v1-3 y) f1-4) (set! (-> v1-3 z) f2-0) - (set! (-> v1-3 w) (sqrtf (- (- (- 1.0 (* f2-0 f2-0)) (* f1-4 f1-4)) (* f0-13 f0-13)))) + (set! (-> v1-3 w) (sqrtf (- (- (- 1.0 (square f2-0)) (square f1-4)) (square f0-13)))) ) (quaternion-rotate-y! (the-as quaternion s5-0) (the-as quaternion s5-0) (+ 16384.0 f30-0)) (cond diff --git a/test/decompiler/reference/jak1/levels/citadel/citb-drop-plat_REF.gc b/test/decompiler/reference/jak1/levels/citadel/citb-drop-plat_REF.gc index 58f3f6ec8e..bae52062af 100644 --- a/test/decompiler/reference/jak1/levels/citadel/citb-drop-plat_REF.gc +++ b/test/decompiler/reference/jak1/levels/citadel/citb-drop-plat_REF.gc @@ -166,9 +166,9 @@ (set! (-> gp-0 quad) (-> self root trans quad)) (set! (-> gp-0 y) (-> (the-as process-drawable (-> self parent 0)) root trans y)) (loop - (let ((f0-6 (fmax 0.0 (- 1.0 (* 0.0033333334 (the float (- (current-time) (-> self state-time)))))))) - (set! (-> self interp) (* f0-6 f0-6)) - ) + (set! (-> self interp) + (square (fmax 0.0 (- 1.0 (* 0.0033333334 (the float (- (current-time) (-> self state-time))))))) + ) (set! (-> self root trans y) (- (-> (the-as process-drawable (-> self parent 0)) root trans y) (* 204800.0 (-> self interp))) ) @@ -288,11 +288,7 @@ (s4-0 (new 'stack-no-clear 'vector)) ) (set! (-> s3-0 x) (* 65536.0 (rand-vu))) - (let ((f30-1 14563.556) - (f0-2 (rand-vu-float-range -1.0 1.0)) - ) - (set! (-> s3-0 y) (* f30-1 (* f0-2 f0-2))) - ) + (set! (-> s3-0 y) (* 14563.556 (square (rand-vu-float-range -1.0 1.0)))) (vector-sincos! s5-0 s4-0 s3-0) (set! (-> this spin-axis x) (* (-> s4-0 y) (-> s4-0 x))) (set! (-> this spin-axis y) (-> s5-0 y)) @@ -395,7 +391,7 @@ ;; INFO: Used lq/sq ;; INFO: Return type mismatch int vs none. (defbehavior citb-drop-plat-spawn-children citb-drop-plat () - (local-vars (s0-0 int) (sv-48 process) (sv-64 int)) + (local-vars (s0-0 int)) (let ((gp-0 (new 'stack-no-clear 'vector))) 6 0 @@ -419,32 +415,26 @@ (set! s0-0 (rand-vu-int-range 0 5)) ) (when (nonzero? s0-0) - (set! sv-64 (the int (* 150.0 (rand-vu)))) - (set! sv-48 (get-process *default-dead-pool* drop-plat #x4000)) - (set! (-> self child-array data s1-0) - (ppointer->handle (when sv-48 - (let ((t9-6 (method-of-type drop-plat activate))) - (t9-6 (the-as drop-plat sv-48) self 'drop-plat (the-as pointer #x70004000)) - ) - (let ((t9-7 run-function-in-process) - (a0-8 sv-48) - (a1-5 drop-plat-init-by-other) - (a2-4 gp-0) - (t0-0 (-> self duration)) - ) - ((the-as (function process function vector int int int none) t9-7) - a0-8 - a1-5 - a2-4 - sv-64 - (the-as int t0-0) - s0-0 - ) - ) - (-> sv-48 ppointer) - ) - ) + (let ((sv-64 (the int (* 150.0 (rand-vu)))) + (sv-48 (get-process *default-dead-pool* drop-plat #x4000)) ) + (set! (-> self child-array data s1-0) + (ppointer->handle + (when sv-48 + ((method-of-type drop-plat activate) (the-as drop-plat sv-48) self 'drop-plat (the-as pointer #x70004000)) + ((the-as (function process function vector int int int none) run-function-in-process) + sv-48 + drop-plat-init-by-other + gp-0 + sv-64 + (the-as int (-> self duration)) + s0-0 + ) + (-> sv-48 ppointer) + ) + ) + ) + ) ) ) ) diff --git a/test/decompiler/reference/jak1/levels/citadel/citb-plat_REF.gc b/test/decompiler/reference/jak1/levels/citadel/citb-plat_REF.gc index 6bd27c8ed9..d97641e88d 100644 --- a/test/decompiler/reference/jak1/levels/citadel/citb-plat_REF.gc +++ b/test/decompiler/reference/jak1/levels/citadel/citb-plat_REF.gc @@ -345,7 +345,7 @@ (set! (-> self root trans y) (-> self rise-height)) (go-virtual citb-base-plat-active) ) - (set! (-> self root trans y) (lerp (-> self rise-height) (-> self idle-height) (* f30-0 f30-0))) + (set! (-> self root trans y) (lerp (-> self rise-height) (-> self idle-height) (square f30-0))) ) (let ((f0-12 (fmax 0.0 (fmin 1.0 (* 0.000012207031 (+ 409600.0 (-> self root trans y))))))) (set! (-> self draw color-mult x) f0-12) @@ -1120,7 +1120,7 @@ (set! (-> self root trans y) (-> self rise-height)) (go-virtual plat-button-idle) ) - (set! (-> self root trans y) (lerp (-> self rise-height) (-> self idle-height) (* f30-0 f30-0))) + (set! (-> self root trans y) (lerp (-> self rise-height) (-> self idle-height) (square f30-0))) ) (suspend) ) diff --git a/test/decompiler/reference/jak1/levels/common/battlecontroller_REF.gc b/test/decompiler/reference/jak1/levels/common/battlecontroller_REF.gc index 0219ba6896..ff47aaaa2c 100644 --- a/test/decompiler/reference/jak1/levels/common/battlecontroller_REF.gc +++ b/test/decompiler/reference/jak1/levels/common/battlecontroller_REF.gc @@ -684,7 +684,6 @@ battlecontroller-default-event-handler ;; INFO: Used lq/sq ;; INFO: Return type mismatch int vs none. (defmethod battlecontroller-method-27 ((this battlecontroller)) - (local-vars (sv-16 res-tag)) (set! (-> this fact) (new 'process 'fact-info this (pickup-type eco-pill-random) (-> *FACT-bank* default-pill-inc)) ) @@ -756,8 +755,9 @@ battlecontroller-default-event-handler (set! (-> this creature-type-array 0 type2) babak) (set! (-> this creature-type-array 0 percent) 1.0) (let ((s5-3 0)) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-49 (res-lump-data (-> this entity) 'lurker-type pointer :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-49 (res-lump-data (-> this entity) 'lurker-type pointer :tag-ptr (& sv-16))) + ) (when v1-49 (dotimes (a0-22 (the-as int (-> sv-16 elt-count))) (let ((a1-15 (-> (the-as (pointer uint32) (&+ v1-49 (* a0-22 4)))))) diff --git a/test/decompiler/reference/jak1/levels/demo/static-screen_REF.gc b/test/decompiler/reference/jak1/levels/demo/static-screen_REF.gc index c882bf8001..87691f6a9f 100644 --- a/test/decompiler/reference/jak1/levels/demo/static-screen_REF.gc +++ b/test/decompiler/reference/jak1/levels/demo/static-screen_REF.gc @@ -170,16 +170,19 @@ (arg5 symbol) (arg6 process-tree) ) - (local-vars (sv-16 process)) - (set! sv-16 (get-process *default-dead-pool* static-screen #x4000)) - (the-as - (pointer static-screen) - (when sv-16 - (let ((t9-1 (method-of-type static-screen activate))) - (t9-1 (the-as static-screen sv-16) arg6 'static-screen (the-as pointer #x70004000)) + (let ((sv-16 (get-process *default-dead-pool* static-screen #x4000))) + (the-as + (pointer static-screen) + (when sv-16 + ((method-of-type static-screen activate) + (the-as static-screen sv-16) + arg6 + 'static-screen + (the-as pointer #x70004000) + ) + (run-now-in-process sv-16 static-screen-init-by-other arg0 arg1 arg2 arg3 arg4 arg5) + (-> sv-16 ppointer) ) - (run-now-in-process sv-16 static-screen-init-by-other arg0 arg1 arg2 arg3 arg4 arg5) - (-> sv-16 ppointer) ) ) ) diff --git a/test/decompiler/reference/jak1/levels/finalboss/final-door_REF.gc b/test/decompiler/reference/jak1/levels/finalboss/final-door_REF.gc index 35ceb8df8e..d1dc7746e1 100644 --- a/test/decompiler/reference/jak1/levels/finalboss/final-door_REF.gc +++ b/test/decompiler/reference/jak1/levels/finalboss/final-door_REF.gc @@ -374,7 +374,6 @@ (set-letterbox-frames (seconds 0.017)) ) :code (behavior ((arg0 basic) (arg1 handle)) - (local-vars (sv-144 process) (sv-160 vector) (sv-176 process) (sv-192 vector)) (let ((a0-2 (get-task-control (game-task finalboss-movies)))) (save-reminder a0-2 (logior (get-reminder a0-2 0) 2) 0) ) @@ -393,17 +392,20 @@ ) (dotimes (s2-0 50) (when (handle->process (the-as handle arg0)) - (let ((s1-0 (handle->process (the-as handle arg0))) - (s0-0 (+ s2-0 4)) - ) - (set! sv-160 - (vector<-cspace! (new 'stack-no-clear 'vector) (-> (the-as process-drawable s1-0) node-list data s0-0)) - ) - (set! sv-144 (get-process *default-dead-pool* powercellalt #x4000)) + (let* ((s1-0 (handle->process (the-as handle arg0))) + (s0-0 (+ s2-0 4)) + (sv-160 + (vector<-cspace! (new 'stack-no-clear 'vector) (-> (the-as process-drawable s1-0) node-list data s0-0)) + ) + (sv-144 (get-process *default-dead-pool* powercellalt #x4000)) + ) (when sv-144 - (let ((t9-16 (method-of-type powercellalt activate))) - (t9-16 (the-as powercellalt sv-144) s1-0 'powercellalt (the-as pointer #x70004000)) - ) + ((method-of-type powercellalt activate) + (the-as powercellalt sv-144) + s1-0 + 'powercellalt + (the-as pointer #x70004000) + ) (run-now-in-process sv-144 powercellalt-init-by-other s4-3 s3-1 sv-160 s0-0) (-> sv-144 ppointer) ) @@ -412,17 +414,20 @@ (suspend-for (seconds 0.1) ) (when (handle->process arg1) - (let ((s1-2 (handle->process arg1)) - (s0-1 (+ s2-0 4)) - ) - (set! sv-192 - (vector<-cspace! (new 'stack-no-clear 'vector) (-> (the-as process-drawable s1-2) node-list data s0-1)) - ) - (set! sv-176 (get-process *default-dead-pool* powercellalt #x4000)) + (let* ((s1-2 (handle->process arg1)) + (s0-1 (+ s2-0 4)) + (sv-192 + (vector<-cspace! (new 'stack-no-clear 'vector) (-> (the-as process-drawable s1-2) node-list data s0-1)) + ) + (sv-176 (get-process *default-dead-pool* powercellalt #x4000)) + ) (when sv-176 - (let ((t9-20 (method-of-type powercellalt activate))) - (t9-20 (the-as powercellalt sv-176) s1-2 'powercellalt (the-as pointer #x70004000)) - ) + ((method-of-type powercellalt activate) + (the-as powercellalt sv-176) + s1-2 + 'powercellalt + (the-as pointer #x70004000) + ) (run-now-in-process sv-176 powercellalt-init-by-other s4-3 s3-1 sv-192 s0-1) (-> sv-176 ppointer) ) diff --git a/test/decompiler/reference/jak1/levels/finalboss/robotboss-weapon_REF.gc b/test/decompiler/reference/jak1/levels/finalboss/robotboss-weapon_REF.gc index 158dcc8370..73d39c812f 100644 --- a/test/decompiler/reference/jak1/levels/finalboss/robotboss-weapon_REF.gc +++ b/test/decompiler/reference/jak1/levels/finalboss/robotboss-weapon_REF.gc @@ -36,7 +36,7 @@ (vector-flatten! s5-0 gp-0 (-> this axis)) (vector-normalize! s5-0 (-> this radius-primary)) (vector-! arg1 gp-0 s5-0) - (< (vector-length-squared arg1) (* f30-0 f30-0)) + (< (vector-length-squared arg1) (square f30-0)) ) ) @@ -78,7 +78,6 @@ ;; INFO: Used lq/sq ;; INFO: Return type mismatch int vs none. (defmethod torus-method-9 ((this torus) (arg0 vector)) - (local-vars (sv-256 int) (sv-272 int) (sv-288 int)) (let ((s0-0 (new 'stack-no-clear 'vector)) (s4-0 (new 'stack-no-clear 'vector)) (s3-0 (new 'stack-no-clear 'vector)) @@ -93,10 +92,11 @@ (vector-cross! s4-0 s0-0 (-> this axis)) (matrix-axis-angle! s2-0 s4-0 8192.0) (vector-float*! (-> s1-0 0) s0-0 (-> this radius-secondary)) - (set! sv-256 0) - (while (< sv-256 7) - (vector-matrix*! (-> s1-0 (+ sv-256 1)) (-> s1-0 sv-256) s2-0) - (set! sv-256 (+ sv-256 1)) + (let ((sv-256 0)) + (while (< sv-256 7) + (vector-matrix*! (-> s1-0 (+ sv-256 1)) (-> s1-0 sv-256) s2-0) + (+! sv-256 1) + ) ) (vector-float*! s0-0 s0-0 (-> this radius-primary)) (dotimes (v1-21 8) @@ -104,22 +104,24 @@ ) (matrix-axis-angle! s2-0 (-> this axis) 4096.0) (dotimes (s0-1 16) - (set! sv-272 0) - (while (< sv-272 7) - (vector+! s4-0 (-> s1-0 sv-272) (-> this origin)) - (vector+! s3-0 (-> s1-0 (+ sv-272 1)) (-> this origin)) - (camera-line s4-0 s3-0 (the-as vector4w arg0)) - (set! sv-272 (+ sv-272 1)) + (let ((sv-272 0)) + (while (< sv-272 7) + (vector+! s4-0 (-> s1-0 sv-272) (-> this origin)) + (vector+! s3-0 (-> s1-0 (+ sv-272 1)) (-> this origin)) + (camera-line s4-0 s3-0 (the-as vector4w arg0)) + (+! sv-272 1) + ) ) (vector+! s4-0 (-> s1-0 0) (-> this origin)) (camera-line s4-0 s3-0 (the-as vector4w arg0)) - (set! sv-288 0) - (while (< sv-288 8) - (vector+! s4-0 (-> s1-0 sv-288) (-> this origin)) - (vector-matrix*! (-> s1-0 sv-288) (-> s1-0 sv-288) s2-0) - (vector+! s3-0 (-> s1-0 sv-288) (-> this origin)) - (camera-line s4-0 s3-0 (the-as vector4w arg0)) - (set! sv-288 (+ sv-288 1)) + (let ((sv-288 0)) + (while (< sv-288 8) + (vector+! s4-0 (-> s1-0 sv-288) (-> this origin)) + (vector-matrix*! (-> s1-0 sv-288) (-> s1-0 sv-288) s2-0) + (vector+! s3-0 (-> s1-0 sv-288) (-> this origin)) + (camera-line s4-0 s3-0 (the-as vector4w arg0)) + (+! sv-288 1) + ) ) ) ) @@ -194,7 +196,7 @@ (let ((f0-6 (* -4.0 v1-2)) (f3-1 (* 4.0 v1-2 (- (-> arg1 y) (-> arg0 y)))) ) - (set! (-> self y-vel) (* 0.5 (- (sqrtf (- (* f0-6 f0-6) (* 4.0 f3-1))) f0-6))) + (set! (-> self y-vel) (* 0.5 (- (sqrtf (- (square f0-6) (* 4.0 f3-1))) f0-6))) ) (set! (-> self grav) (/ (- (* (-> self y-vel) (-> self y-vel))) (* 2.0 v1-2))) ) @@ -802,21 +804,21 @@ ;; INFO: Used lq/sq ;; INFO: Return type mismatch object vs none. (defbehavior redshot-init-by-other redshot ((arg0 vector) (arg1 vector) (arg2 float) (arg3 time-frame) (arg4 time-frame) (arg5 int)) - (local-vars (sv-16 collide-shape-prim-sphere)) (let ((s0-0 (new 'process 'collide-shape-moving self (collide-list-enum usually-hit-by-player)))) (set! (-> s0-0 dynam) (copy *standard-dynamics* 'process)) (set! (-> s0-0 reaction) default-collision-reaction) (set! (-> s0-0 no-reaction) (the-as (function collide-shape-moving collide-shape-intersect vector vector none) nothing) ) - (set! sv-16 (new 'process 'collide-shape-prim-sphere s0-0 (the-as uint 0))) - (set! (-> sv-16 prim-core collide-as) (collide-kind wall-object)) - (set! (-> sv-16 collide-with) (collide-kind target)) - (set! (-> sv-16 prim-core action) (collide-action solid)) - (set! (-> sv-16 prim-core offense) (collide-offense indestructible)) - (set! (-> sv-16 transform-index) 4) - (set-vector! (-> sv-16 local-sphere) 0.0 0.0 0.0 12288.0) - (set-root-prim! s0-0 sv-16) + (let ((sv-16 (new 'process 'collide-shape-prim-sphere s0-0 (the-as uint 0)))) + (set! (-> sv-16 prim-core collide-as) (collide-kind wall-object)) + (set! (-> sv-16 collide-with) (collide-kind target)) + (set! (-> sv-16 prim-core action) (collide-action solid)) + (set! (-> sv-16 prim-core offense) (collide-offense indestructible)) + (set! (-> sv-16 transform-index) 4) + (set-vector! (-> sv-16 local-sphere) 0.0 0.0 0.0 12288.0) + (set-root-prim! s0-0 sv-16) + ) (set! (-> s0-0 nav-radius) (* 0.75 (-> s0-0 root-prim local-sphere w))) (backup-collide-with-as s0-0) (set! (-> self root) s0-0) diff --git a/test/decompiler/reference/jak1/levels/finalboss/robotboss_REF.gc b/test/decompiler/reference/jak1/levels/finalboss/robotboss_REF.gc index cacd84dc18..54f71cdee6 100644 --- a/test/decompiler/reference/jak1/levels/finalboss/robotboss_REF.gc +++ b/test/decompiler/reference/jak1/levels/finalboss/robotboss_REF.gc @@ -1393,9 +1393,9 @@ ;; INFO: Used lq/sq ;; WARN: Stack slot load at 64 mismatch: defined as size 4, got size 16 (defbehavior robotboss-redshot robotboss ((arg0 redshot-launch-info) (arg1 symbol)) - (local-vars (sv-32 redshot-launch-info) (sv-48 vector) (sv-64 float) (sv-80 time-frame) (sv-96 time-frame)) - (set! sv-32 arg0) - (let ((s5-0 arg1)) + (let ((sv-32 arg0) + (s5-0 arg1) + ) (+! (-> self children-spawned) 1) (let ((gp-0 (new 'stack-no-clear 'vector))) (vector<-cspace! gp-0 (joint-node robotboss-basic-lod0-jg red_ecoTip)) @@ -1404,35 +1404,32 @@ (let ((t9-2 (method-of-type redshot activate))) (t9-2 (the-as redshot s4-0) self 'redshot (the-as pointer #x70004000)) ) - (let ((s3-0 run-function-in-process) - (s2-0 s4-0) - (s1-0 redshot-init-by-other) - (s0-0 gp-0) - ) - (set! sv-48 (-> sv-32 dest)) - (let ((f30-0 20480.0) - (f28-0 12288.0) - ) - (set! sv-64 (+ f30-0 (* f28-0 (rand-float-gen)))) - ) - (set! sv-80 (-> sv-32 flight-time)) - (set! sv-96 (-> sv-32 stall-time)) - (let* ((f30-1 300.0) - (v1-19 (/ (the-as int (rand-uint31-gen *random-generator*)) 256)) - (v1-20 (the-as number (logior #x3f800000 v1-19))) - (t3-0 (the int (* f30-1 (+ -1.0 (the-as float v1-20))))) - ) - ((the-as (function object object object object object object object object none) s3-0) - s2-0 - s1-0 - s0-0 - sv-48 - sv-64 - sv-80 - sv-96 - t3-0 - ) - ) + (let* ((s3-0 run-function-in-process) + (s2-0 s4-0) + (s1-0 redshot-init-by-other) + (s0-0 gp-0) + (sv-48 (-> sv-32 dest)) + (f30-0 20480.0) + (f28-0 12288.0) + (v1-10 (/ (the-as int (rand-uint31-gen *random-generator*)) 256)) + (v1-11 (the-as number (logior #x3f800000 v1-10))) + (sv-64 (+ f30-0 (* f28-0 (+ -1.0 (the-as float v1-11))))) + (sv-80 (-> sv-32 flight-time)) + (sv-96 (-> sv-32 stall-time)) + (f30-1 300.0) + (v1-19 (/ (the-as int (rand-uint31-gen *random-generator*)) 256)) + (v1-20 (the-as number (logior #x3f800000 v1-19))) + ) + ((the-as (function object object object object object object object object none) s3-0) + s2-0 + s1-0 + s0-0 + sv-48 + sv-64 + sv-80 + sv-96 + (the int (* f30-1 (+ -1.0 (the-as float v1-20)))) + ) ) (-> s4-0 ppointer) ) diff --git a/test/decompiler/reference/jak1/levels/jungle/jungle-mirrors_REF.gc b/test/decompiler/reference/jak1/levels/jungle/jungle-mirrors_REF.gc index 911fac7375..666f4aeebe 100644 --- a/test/decompiler/reference/jak1/levels/jungle/jungle-mirrors_REF.gc +++ b/test/decompiler/reference/jak1/levels/jungle/jungle-mirrors_REF.gc @@ -712,7 +712,6 @@ ) ) :code (behavior () - (local-vars (sv-32 int) (sv-48 int)) (let* ((gp-0 (-> self change-event-from)) (f28-0 (the-as float (-> (the-as periscope (-> gp-0 0)) tilt))) (f30-0 (the-as float (-> (the-as periscope (-> gp-0 0)) turn))) @@ -741,28 +740,15 @@ ) (set! (-> s5-0 y) (- (-> s5-0 y) (* 136.53334 (- f26-0)))) (set! (-> s5-0 x) (- (-> s5-0 x) (* 136.53334 (- f0-0)))) - (cond - ((and (= f26-0 0.0) (= f0-0 0.0)) - (sound-stop (-> (the-as periscope (-> gp-0 0)) sound-id)) - ) - (else - (let ((s4-0 sound-play-by-name) - (s3-0 (make-u128 101 (the-as uint #x706f6373656c6574))) - (s2-0 (-> (the-as periscope (-> gp-0 0)) sound-id)) - (s1-0 1024) - (s0-0 0) - ) - (set! sv-32 0) - (set! sv-48 1) - (let ((t2-0 (target-pos 0))) - (the-as - int - (s4-0 (the-as sound-name s3-0) s2-0 s1-0 s0-0 sv-32 (the-as sound-group sv-48) (the-as symbol t2-0)) - ) - ) - ) + (if (and (= f26-0 0.0) (= f0-0 0.0)) + (sound-stop (-> (the-as periscope (-> gp-0 0)) sound-id)) + (the-as int (sound-play + "telescope" + :id (-> (the-as periscope (-> gp-0 0)) sound-id) + :position (the-as symbol (target-pos 0)) + ) + ) ) - ) ) ) (cond @@ -1129,19 +1115,19 @@ ;; definition for function periscope-test-task-complete? (defbehavior periscope-test-task-complete? periscope () - (local-vars (sv-16 symbol)) - (set! sv-16 #t) - (apply-all - (-> self link) - (lambda ((arg0 entity-actor) (arg1 (pointer symbol))) - (when (and (= (-> arg0 etype) periscope) (not (logtest? (-> arg0 extra perm status) (entity-perm-status complete)))) - (set! (-> arg1 0) #f) - #t + (let ((sv-16 #t)) + (apply-all + (-> self link) + (lambda ((arg0 entity-actor) (arg1 (pointer symbol))) + (when (and (= (-> arg0 etype) periscope) (not (logtest? (-> arg0 extra perm status) (entity-perm-status complete)))) + (set! (-> arg1 0) #f) + #t + ) ) + (& sv-16) ) - (& sv-16) + sv-16 ) - sv-16 ) ;; definition for function peri-beamcam-init-by-other diff --git a/test/decompiler/reference/jak1/levels/jungle/jungle-obs_REF.gc b/test/decompiler/reference/jak1/levels/jungle/jungle-obs_REF.gc index c846be0b2c..d1026765c1 100644 --- a/test/decompiler/reference/jak1/levels/jungle/jungle-obs_REF.gc +++ b/test/decompiler/reference/jak1/levels/jungle/jungle-obs_REF.gc @@ -440,7 +440,6 @@ ;; INFO: Used lq/sq ;; INFO: Return type mismatch object vs none. (defmethod init-from-entity! ((this lurkerm-piston) (arg0 entity-actor)) - (local-vars (sv-16 res-tag) (sv-32 res-tag)) (logior! (-> this mask) (process-mask platform)) (let ((s4-0 (new 'process 'collide-shape-moving this (collide-list-enum hit-by-player)))) (set! (-> s4-0 dynam) (copy *standard-dynamics* 'process)) @@ -468,21 +467,22 @@ (logior! (-> this skel status) (janim-status inited)) (update-transforms! (-> this root)) (set! (-> this base quad) (-> this root trans quad)) - (let ((f30-0 (-> this base y))) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-32 (res-lump-data arg0 'height-info pointer :tag-ptr (& sv-16)))) - (set! (-> this base y) (+ f30-0 (if (and v1-32 (> (the-as int (-> sv-16 elt-count)) 0)) - (-> (the-as (pointer float) v1-32)) - 0.0 - ) - ) - ) - ) + (let* ((f30-0 (-> this base y)) + (sv-16 (new 'static 'res-tag)) + (v1-32 (res-lump-data arg0 'height-info pointer :tag-ptr (& sv-16))) + ) + (set! (-> this base y) (+ f30-0 (if (and v1-32 (> (the-as int (-> sv-16 elt-count)) 0)) + (-> (the-as (pointer float) v1-32)) + 0.0 + ) + ) + ) ) (let ((s4-1 (-> this height))) (set! (-> s4-1 x) 0.0) - (set! sv-32 (new 'static 'res-tag)) - (let ((v1-35 (res-lump-data arg0 'height-info (pointer float) :tag-ptr (& sv-32)))) + (let* ((sv-32 (new 'static 'res-tag)) + (v1-35 (res-lump-data arg0 'height-info (pointer float) :tag-ptr (& sv-32))) + ) (set! (-> s4-1 y) (if (and v1-35 (< 1 (the-as int (-> sv-32 elt-count)))) (-> v1-35 1) 20480.0 diff --git a/test/decompiler/reference/jak1/levels/jungleb/plat-flip_REF.gc b/test/decompiler/reference/jak1/levels/jungleb/plat-flip_REF.gc index 5648f43f8f..030993735f 100644 --- a/test/decompiler/reference/jak1/levels/jungleb/plat-flip_REF.gc +++ b/test/decompiler/reference/jak1/levels/jungleb/plat-flip_REF.gc @@ -114,7 +114,6 @@ ;; INFO: Used lq/sq ;; INFO: Return type mismatch object vs none. (defmethod init-from-entity! ((this plat-flip) (arg0 entity-actor)) - (local-vars (sv-16 res-tag) (sv-32 res-tag) (sv-48 res-tag)) (logior! (-> this mask) (process-mask platform)) (let ((s4-0 (new 'process 'collide-shape-moving this (collide-list-enum hit-by-player)))) (set! (-> s4-0 dynam) (copy *standard-dynamics* 'process)) @@ -140,27 +139,27 @@ (set! (-> this base-pos quad) (-> this root trans quad)) (initialize-skeleton this *plat-flip-sg* '()) (logior! (-> this skel status) (janim-status inited)) - (let ((f30-0 300.0)) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-28 (res-lump-data arg0 'delay pointer :tag-ptr (& sv-16)))) - (set! (-> this before-turn-down-time) (* f30-0 (if (and v1-28 (> (the-as int (-> sv-16 elt-count)) 0)) - (-> (the-as (pointer float) v1-28)) - 2.0 - ) - ) - ) - ) - ) - (let ((f30-1 300.0)) - (set! sv-32 (new 'static 'res-tag)) - (let ((v1-31 (res-lump-data arg0 'delay pointer :tag-ptr (& sv-32)))) - (set! (-> this before-turn-up-time) (* f30-1 (if (and v1-31 (< 1 (the-as int (-> sv-32 elt-count)))) - (-> (the-as (pointer float) v1-31) 1) - 0.2 + (let* ((f30-0 300.0) + (sv-16 (new 'static 'res-tag)) + (v1-28 (res-lump-data arg0 'delay pointer :tag-ptr (& sv-16))) + ) + (set! (-> this before-turn-down-time) (* f30-0 (if (and v1-28 (> (the-as int (-> sv-16 elt-count)) 0)) + (-> (the-as (pointer float) v1-28)) + 2.0 ) ) - ) - ) + ) + ) + (let* ((f30-1 300.0) + (sv-32 (new 'static 'res-tag)) + (v1-31 (res-lump-data arg0 'delay pointer :tag-ptr (& sv-32))) + ) + (set! (-> this before-turn-up-time) (* f30-1 (if (and v1-31 (< 1 (the-as int (-> sv-32 elt-count)))) + (-> (the-as (pointer float) v1-31) 1) + 0.2 + ) + ) + ) ) (set! (-> this turn-down-time) 300.0) (set! (-> this turn-up-time) 300.0) @@ -170,22 +169,21 @@ (-> this turn-up-time) ) ) - (let ((s4-1 (-> this sync)) - (s3-1 (method-of-type sync-info setup-params!)) - (s2-0 (the int (-> this total-time))) - ) - (set! sv-48 (new 'static 'res-tag)) - (let ((v1-35 (res-lump-data arg0 'sync-percent pointer :tag-ptr (& sv-48)))) - (s3-1 - s4-1 - (the-as uint s2-0) - (if (and v1-35 (> (the-as int (-> sv-48 elt-count)) 0)) - (-> (the-as (pointer float) v1-35) 0) - 0.0 - ) - 0.15 - 0.15 - ) + (let* ((s4-1 (-> this sync)) + (s3-1 (method-of-type sync-info setup-params!)) + (s2-0 (the int (-> this total-time))) + (sv-48 (new 'static 'res-tag)) + (v1-35 (res-lump-data arg0 'sync-percent pointer :tag-ptr (& sv-48))) + ) + (s3-1 + s4-1 + (the-as uint s2-0) + (if (and v1-35 (> (the-as int (-> sv-48 elt-count)) 0)) + (-> (the-as (pointer float) v1-35) 0) + 0.0 + ) + 0.15 + 0.15 ) ) (update-transforms! (-> this root)) diff --git a/test/decompiler/reference/jak1/levels/lavatube/lavatube-obs_REF.gc b/test/decompiler/reference/jak1/levels/lavatube/lavatube-obs_REF.gc index 577d0af0a7..e552c74cac 100644 --- a/test/decompiler/reference/jak1/levels/lavatube/lavatube-obs_REF.gc +++ b/test/decompiler/reference/jak1/levels/lavatube/lavatube-obs_REF.gc @@ -776,7 +776,6 @@ ;; INFO: Used lq/sq ;; INFO: Return type mismatch object vs none. (defmethod init-from-entity! ((this darkecobarrel) (arg0 entity-actor)) - (local-vars (sv-16 res-tag)) (set! (-> this root) (the-as collide-shape-moving (new 'process 'trsqv))) (darkecobarrel-base-init arg0) (set! (-> this sound) @@ -784,8 +783,9 @@ ) (logior! (-> this draw status) (draw-status hidden)) (set! (-> this speed) (/ 300.0 (res-lump-float (-> this entity) 'speed :default 61440.0))) - (set! sv-16 (new 'static 'res-tag)) - (let ((s5-1 (res-lump-data arg0 'delay pointer :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (s5-1 (res-lump-data arg0 'delay pointer :tag-ptr (& sv-16))) + ) (cond (s5-1 (set! (-> this spawn-array) (new 'process 'boxed-array time-frame (the-as int (-> sv-16 elt-count)))) diff --git a/test/decompiler/reference/jak1/levels/maincave/driller-lurker_REF.gc b/test/decompiler/reference/jak1/levels/maincave/driller-lurker_REF.gc index 7344e30623..0b9e2fcfee 100644 --- a/test/decompiler/reference/jak1/levels/maincave/driller-lurker_REF.gc +++ b/test/decompiler/reference/jak1/levels/maincave/driller-lurker_REF.gc @@ -236,7 +236,6 @@ ;; definition for function driller-lurker-default-event-handler ;; INFO: Used lq/sq (defbehavior driller-lurker-default-event-handler driller-lurker ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) - (local-vars (sv-96 collide-shape-prim)) (cond ((= arg2 'attack) (cond @@ -269,15 +268,16 @@ (s0-0 (-> s1-0 head)) ) (while s0-0 - (set! sv-96 (get-touched-prim s0-0 (-> self root-overeride) s1-0)) - (if (and (logtest? (-> (get-touched-prim s0-0 (-> s4-0 control) s1-0) prim-core action) (collide-action solid)) - (logtest? (-> sv-96 prim-id) 1) - ) - (set! s2-0 #t) - ) - (if (logtest? (-> sv-96 prim-id) 2) - (set! s3-0 #t) - ) + (let ((sv-96 (get-touched-prim s0-0 (-> self root-overeride) s1-0))) + (if (and (logtest? (-> (get-touched-prim s0-0 (-> s4-0 control) s1-0) prim-core action) (collide-action solid)) + (logtest? (-> sv-96 prim-id) 1) + ) + (set! s2-0 #t) + ) + (if (logtest? (-> sv-96 prim-id) 2) + (set! s3-0 #t) + ) + ) (set! s0-0 (-> s0-0 next)) ) ) @@ -1004,7 +1004,6 @@ ;; INFO: Used lq/sq ;; INFO: Return type mismatch object vs none. (defmethod init-from-entity! ((this driller-lurker) (arg0 entity-actor)) - (local-vars (sv-16 res-tag)) (set! (-> this hit-player?) #f) (set! (-> this played-drill-sound?) #f) (set! (-> this hit-player-time) 0) @@ -1109,7 +1108,8 @@ (set! (-> this path-speed) 15360.0) (set! (-> this targ-path-speed) 15360.0) (set! (-> this up-blend) 0.0) - (set! sv-16 (new 'static 'res-tag)) + (let ((sv-16 (new 'static 'res-tag))) + ) (let ((v1-91 (res-lump-data arg0 diff --git a/test/decompiler/reference/jak1/levels/maincave/gnawer_REF.gc b/test/decompiler/reference/jak1/levels/maincave/gnawer_REF.gc index 3bc2dbb476..064ebf1b19 100644 --- a/test/decompiler/reference/jak1/levels/maincave/gnawer_REF.gc +++ b/test/decompiler/reference/jak1/levels/maincave/gnawer_REF.gc @@ -479,7 +479,6 @@ ;; INFO: Used lq/sq ;; INFO: Return type mismatch int vs none. (defmethod gnawer-method-24 ((this gnawer)) - (local-vars (sv-48 vector) (sv-64 vector)) (let ((s5-0 0) (s4-0 0) ) @@ -496,15 +495,17 @@ (set! s0-0 (mod (+ s1-0 1) s3-0)) ) ) - (set! sv-48 (new 'stack-no-clear 'vector)) - (set! sv-64 (new 'stack-no-clear 'vector)) - (eval-path-curve-div! (-> this path) sv-48 (the float s1-0) 'interp) - (eval-path-curve-div! (-> this path) sv-64 (the float s0-0) 'interp) - (let ((f0-4 (vector-vector-distance sv-48 sv-64))) - (when (< f30-0 f0-4) - (set! f30-0 f0-4) - (set! s5-0 s1-0) - (set! s4-0 s0-0) + (let ((sv-48 (new 'stack-no-clear 'vector)) + (sv-64 (new 'stack-no-clear 'vector)) + ) + (eval-path-curve-div! (-> this path) sv-48 (the float s1-0) 'interp) + (eval-path-curve-div! (-> this path) sv-64 (the float s0-0) 'interp) + (let ((f0-4 (vector-vector-distance sv-48 sv-64))) + (when (< f30-0 f0-4) + (set! f30-0 f0-4) + (set! s5-0 s1-0) + (set! s4-0 s0-0) + ) ) ) ) @@ -565,7 +566,7 @@ ) (set-vector! (-> this route surface-dir) f30-5 f28-0 0.0 1.0) (vector-normalize! (-> this route surface-dir) 1.0) - (let ((f0-25 (sqrtf (+ (* f30-5 f30-5) (* f28-0 f28-0))))) + (let ((f0-25 (sqrtf (+ (square f30-5) (square f28-0))))) (set! (-> this route surface-dist) f0-25) (set! (-> this route total-dist) (+ 20480.0 f0-25)) ) @@ -620,7 +621,7 @@ (let* ((f0-10 (- (-> s4-0 max x) (-> this root trans x))) (f1-12 (- (-> s4-0 max y) (-> this root trans y))) (f2-7 (- (-> s4-0 max z) (-> this root trans z))) - (f0-14 (sqrtf (+ (* f0-10 f0-10) (* f1-12 f1-12) (* f2-7 f2-7)))) + (f0-14 (sqrtf (+ (square f0-10) (square f1-12) (square f2-7)))) (a0-3 (-> this draw bounds)) (v1-21 (-> this root root-prim)) (f0-15 (+ 12288.0 f0-14)) @@ -837,7 +838,6 @@ ;; definition for method 30 of type gnawer ;; INFO: Used lq/sq (defmethod gnawer-method-30 ((this gnawer) (arg0 process-drawable)) - (local-vars (sv-48 vector)) (let ((gp-0 (-> this entity extra perm))) (logior! (-> gp-0 status) (entity-perm-status user-set-from-cstage)) (let ((s5-0 (-> gp-0 user-uint16 0)) @@ -848,17 +848,15 @@ ) (dotimes (s0-0 s1-0) (when (logtest? (ash 1 s0-0) s5-0) - (let ((a2-0 (new 'stack-no-clear 'vector))) - (set! sv-48 (new 'stack-no-clear 'vector)) + (let ((a2-0 (new 'stack-no-clear 'vector)) + (sv-48 (new 'stack-no-clear 'vector)) + ) (gnawer-method-29 this s0-0 a2-0 sv-48) - ) - (let* ((t9-1 vector-vector-xz-distance) - (a1-2 (-> arg0 root trans)) - (f0-0 (t9-1 sv-48 a1-2)) - ) - (when (or (< s2-0 0) (< f0-0 f30-0)) - (set! s2-0 s0-0) - (set! f30-0 f0-0) + (let ((f0-0 (vector-vector-xz-distance sv-48 (-> arg0 root trans)))) + (when (or (< s2-0 0) (< f0-0 f30-0)) + (set! s2-0 s0-0) + (set! f30-0 f0-0) + ) ) ) ) @@ -1180,7 +1178,6 @@ (spool-push *art-control* "maincavecam-gnawer-fuel-cell" 0 self -1.0) ) :code (behavior () - (local-vars (sv-128 symbol)) (clear-collide-with-as (-> self root)) (set! (-> self skel postbind-function) #f) (ja-channel-set! 0) @@ -1218,11 +1215,12 @@ (suspend) ) ) - (set! sv-128 (the-as symbol #f)) - (apply-all (-> self link) actor-link-subtask-complete-hook (& sv-128)) - (when sv-128 - (save-reminder (get-task-control (game-task cave-gnawers)) (-> self gnawer-id) 3) - (go gnawer-give-fuel-cell) + (let ((sv-128 (the-as symbol #f))) + (apply-all (-> self link) actor-link-subtask-complete-hook (& sv-128)) + (when sv-128 + (save-reminder (get-task-control (game-task cave-gnawers)) (-> self gnawer-id) 3) + (go gnawer-give-fuel-cell) + ) ) (set! (-> self trans-hook) #f) (process-entity-status! self (entity-perm-status bit-3) #f) @@ -1409,7 +1407,6 @@ ;; INFO: Used lq/sq ;; INFO: Return type mismatch object vs none. (defmethod init-from-entity! ((this gnawer) (arg0 entity-actor)) - (local-vars (sv-16 res-tag) (sv-32 res-tag) (sv-48 res-tag)) (set! (-> this hidden?) #f) (set! (-> this show-damage?) #f) (set! (-> this hit-points) 6) @@ -1501,8 +1498,9 @@ (quaternion-rotate-y! (-> this root quat) (-> this root quat) f0-40) ) (+! (-> this root trans y) -2048.0) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-81 (res-lump-data arg0 'trans-offset (pointer float) :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-81 (res-lump-data arg0 'trans-offset (pointer float) :tag-ptr (& sv-16))) + ) (when v1-81 (+! (-> this root trans x) (-> v1-81 0)) (+! (-> this root trans y) (-> v1-81 1)) @@ -1517,8 +1515,9 @@ (set! (-> this part2) (create-launch-control group-gnawer-crumbs this)) (set! (-> this total-money) 0) (set! (-> this money-mask) (the-as uint 0)) - (set! sv-32 (new 'static 'res-tag)) - (let ((v1-96 (res-lump-data arg0 'extra-count (pointer int32) :tag-ptr (& sv-32)))) + (let* ((sv-32 (new 'static 'res-tag)) + (v1-96 (res-lump-data arg0 'extra-count (pointer int32) :tag-ptr (& sv-32))) + ) (when v1-96 (case (-> v1-96 0) ((5) @@ -1528,8 +1527,9 @@ ) ) (when (> (-> this total-money) 0) - (set! sv-48 (new 'static 'res-tag)) - (let ((a0-49 (res-lump-data arg0 'gnawer (pointer int32) :tag-ptr (& sv-48)))) + (let* ((sv-48 (new 'static 'res-tag)) + (a0-49 (res-lump-data arg0 'gnawer (pointer int32) :tag-ptr (& sv-48))) + ) (cond (a0-49 (let ((v1-100 0)) diff --git a/test/decompiler/reference/jak1/levels/maincave/maincave-obs_REF.gc b/test/decompiler/reference/jak1/levels/maincave/maincave-obs_REF.gc index 36e81e7731..f320e562d4 100644 --- a/test/decompiler/reference/jak1/levels/maincave/maincave-obs_REF.gc +++ b/test/decompiler/reference/jak1/levels/maincave/maincave-obs_REF.gc @@ -558,7 +558,6 @@ ;; INFO: Used lq/sq ;; INFO: Return type mismatch object vs none. (defmethod init-from-entity! ((this caveflamepots) (arg0 entity-actor)) - (local-vars (sv-16 res-tag) (sv-32 res-tag) (sv-48 res-tag)) (set! (-> this was-deadly?) #f) (set! (-> this should-play-sound?) #f) (set! (-> this shove-up) (res-lump-float arg0 'shove :default 8192.0)) @@ -643,43 +642,43 @@ ) ) (update-transforms! (-> this root)) - (let ((f30-1 300.0)) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-70 (res-lump-data arg0 'cycle-speed (pointer float) :tag-ptr (& sv-16)))) - (set! (-> this cycle-speed) (the int (* f30-1 (if (and v1-70 (> (the-as int (-> sv-16 elt-count)) 0)) - (-> v1-70 0) - 4.0 - ) - ) - ) - ) - ) - ) - (let ((f30-2 (the float (-> this cycle-speed)))) - (set! sv-32 (new 'static 'res-tag)) - (let ((v1-74 (res-lump-data arg0 'cycle-speed (pointer float) :tag-ptr (& sv-32)))) - (set! (-> this cycle-offset) - (the-as uint (the int (* f30-2 (if (and v1-74 (< 1 (the-as int (-> sv-32 elt-count)))) - (-> v1-74 1) - 0.0 - ) + (let* ((f30-1 300.0) + (sv-16 (new 'static 'res-tag)) + (v1-70 (res-lump-data arg0 'cycle-speed (pointer float) :tag-ptr (& sv-16))) + ) + (set! (-> this cycle-speed) (the int (* f30-1 (if (and v1-70 (> (the-as int (-> sv-16 elt-count)) 0)) + (-> v1-70 0) + 4.0 + ) + ) ) - ) - ) - ) - ) + ) ) - (let ((f30-3 300.0)) - (set! sv-48 (new 'static 'res-tag)) - (let ((v1-77 (res-lump-data arg0 'cycle-speed (pointer float) :tag-ptr (& sv-48)))) - (set! (-> this cycle-pause) (the int (* f30-3 (if (and v1-77 (< 2 (the-as int (-> sv-48 elt-count)))) - (-> v1-77 2) - 2.0 - ) - ) - ) - ) - ) + (let* ((f30-2 (the float (-> this cycle-speed))) + (sv-32 (new 'static 'res-tag)) + (v1-74 (res-lump-data arg0 'cycle-speed (pointer float) :tag-ptr (& sv-32))) + ) + (set! (-> this cycle-offset) + (the-as uint (the int (* f30-2 (if (and v1-74 (< 1 (the-as int (-> sv-32 elt-count)))) + (-> v1-74 1) + 0.0 + ) + ) + ) + ) + ) + ) + (let* ((f30-3 300.0) + (sv-48 (new 'static 'res-tag)) + (v1-77 (res-lump-data arg0 'cycle-speed (pointer float) :tag-ptr (& sv-48))) + ) + (set! (-> this cycle-pause) (the int (* f30-3 (if (and v1-77 (< 2 (the-as int (-> sv-48 elt-count)))) + (-> v1-77 2) + 2.0 + ) + ) + ) + ) ) (go caveflamepots-active) (none) @@ -1203,7 +1202,7 @@ ;; INFO: Used lq/sq ;; INFO: Return type mismatch object vs none. (defmethod init-from-entity! ((this caveelevator) (arg0 entity-actor)) - (local-vars (v1-43 int) (sv-16 res-tag)) + (local-vars (v1-43 int)) (set! (-> this prev-frame-num) 10000.0) (set! (-> this last-update-bounce-time) 0) (logior! (-> this mask) (process-mask platform)) @@ -1231,8 +1230,9 @@ (initialize-skeleton this *caveelevator-sg* '()) (logior! (-> this skel status) (janim-status inited)) (set! (-> this skel postbind-function) caveelevator-joint-callback) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-28 (res-lump-data arg0 'trans-offset (pointer float) :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-28 (res-lump-data arg0 'trans-offset (pointer float) :tag-ptr (& sv-16))) + ) (when v1-28 (+! (-> this root trans x) (-> v1-28 0)) (+! (-> this root trans y) (-> v1-28 1)) diff --git a/test/decompiler/reference/jak1/levels/maincave/mother-spider_REF.gc b/test/decompiler/reference/jak1/levels/maincave/mother-spider_REF.gc index 234e5ede04..9534725d71 100644 --- a/test/decompiler/reference/jak1/levels/maincave/mother-spider_REF.gc +++ b/test/decompiler/reference/jak1/levels/maincave/mother-spider_REF.gc @@ -506,7 +506,6 @@ ;; definition for method 21 of type mother-spider ;; INFO: Used lq/sq (defmethod mother-spider-method-21 ((this mother-spider) (arg0 vector) (arg1 float) (arg2 symbol)) - (local-vars (sv-112 process) (sv-128 vector) (sv-144 vector)) (let ((f30-0 (vector-length (-> this swing-pos)))) (when (< 0.0 f30-0) (let ((s1-0 (new 'stack-no-clear 'vector)) @@ -543,9 +542,10 @@ (logior! (-> this leg-socket-part-mask) (ash 1 s4-1)) (set-time! (-> this leg-socket-part-time s4-1)) (let ((s1-1 (-> *mother-spider-leg-infos* s4-1))) - (let ((s0-0 (new 'stack-no-clear 'vector))) - (set! sv-128 (new 'stack-no-clear 'vector)) - (set! sv-144 (new 'stack-no-clear 'vector)) + (let ((s0-0 (new 'stack-no-clear 'vector)) + (sv-128 (new 'stack-no-clear 'vector)) + (sv-144 (new 'stack-no-clear 'vector)) + ) (vector<-cspace! s0-0 (-> this node-list data (-> s1-1 joint-index0))) (vector<-cspace! sv-128 (-> this node-list data (-> s1-1 joint-index1))) (vector-! sv-128 sv-128 s0-0) @@ -554,13 +554,17 @@ (vector-normalize! sv-144 1.0) (+! (-> sv-144 y) (rand-vu-float-range 0.0 0.3)) (vector-normalize! sv-144 1.0) - (set! sv-112 (get-process *default-dead-pool* mother-spider-leg #x4000)) - (when sv-112 - (let ((t9-15 (method-of-type mother-spider-leg activate))) - (t9-15 (the-as mother-spider-leg sv-112) this 'mother-spider-leg (the-as pointer #x70004000)) + (let ((sv-112 (get-process *default-dead-pool* mother-spider-leg #x4000))) + (when sv-112 + ((method-of-type mother-spider-leg activate) + (the-as mother-spider-leg sv-112) + this + 'mother-spider-leg + (the-as pointer #x70004000) + ) + (run-now-in-process sv-112 mother-spider-leg-init-by-other this s0-0 sv-128 sv-144) + (-> sv-112 ppointer) ) - (run-now-in-process sv-112 mother-spider-leg-init-by-other this s0-0 sv-128 sv-144) - (-> sv-112 ppointer) ) ) (let ((v1-43 (-> (the-as collide-shape-prim-group s3-1) prims (-> s1-1 cprim-index)))) @@ -1640,7 +1644,6 @@ ;; INFO: Used lq/sq ;; INFO: Return type mismatch object vs none. (defmethod init-from-entity! ((this mother-spider) (arg0 entity-actor)) - (local-vars (sv-16 res-tag) (sv-64 vector)) (set! (-> this baby-count) 0) (set! (-> this spit-counter) 0) (set! (-> this leg-socket-part-mask) 0) @@ -1781,8 +1784,9 @@ (set! (-> this max-swing-radius) 73728.0) (set! (-> this max-baby-count) 4) (let ((s4-1 #f)) - (set! sv-16 (new 'static 'res-tag)) - (let ((v0-31 (res-lump-data arg0 'mother-spider pointer :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v0-31 (res-lump-data arg0 'mother-spider pointer :tag-ptr (& sv-16))) + ) (cond (v0-31 (+! (-> this thread-min-trans y) (-> (the-as (pointer float) v0-31) 0)) @@ -1849,14 +1853,7 @@ (eval-path-curve-div! (-> this path) s4-2 (the float s2-9) 'interp) (vector-! s3-1 (target-pos 0) s4-2) (set! (-> s3-1 y) 0.0) - (let ((s1-2 vector-rotate-around-y!) - (s0-0 s3-1) - ) - (set! sv-64 s3-1) - (let ((a2-21 (rand-vu-float-range -7281.778 7281.778))) - (s1-2 s0-0 sv-64 a2-21) - ) - ) + (vector-rotate-around-y! s3-1 s3-1 (rand-vu-float-range -7281.778 7281.778)) (vector-normalize! s3-1 1.0) (spawn-child this s4-2 s3-1 #f) ) diff --git a/test/decompiler/reference/jak1/levels/misty/balloonlurker_REF.gc b/test/decompiler/reference/jak1/levels/misty/balloonlurker_REF.gc index 178752306d..aa43ed783a 100644 --- a/test/decompiler/reference/jak1/levels/misty/balloonlurker_REF.gc +++ b/test/decompiler/reference/jak1/levels/misty/balloonlurker_REF.gc @@ -827,37 +827,38 @@ (set! (-> self dead) #t) ) :code (behavior () - (local-vars (v1-27 symbol) (sv-16 symbol) (sv-20 (pointer process-tree)) (sv-24 entity-actor)) + (local-vars (v1-27 symbol)) (process-entity-status! self (entity-perm-status bit-4) #t) (process-entity-status! self (entity-perm-status dead) #t) (when (or (-> self link prev) (-> self link next)) - (set! sv-16 (the-as symbol #f)) - (set! sv-20 (-> self child)) - (set! sv-24 (entity-actor-lookup (-> self entity) 'alt-actor 0)) - (entity-birth-no-kill sv-24) - (apply-all (-> self link) actor-link-dead-hook (& sv-16)) - (when (and sv-16 sv-24) - (process-grab? *target*) - (suspend-for (seconds 1) + (let ((sv-16 (the-as symbol #f))) + (let ((sv-20 (-> self child))) ) - (process-release? *target*) - (while (let ((a1-4 (new 'stack-no-clear 'event-message-block))) - (set! (-> a1-4 from) self) - (set! (-> a1-4 num-params) 0) - (set! (-> a1-4 message) 'task-complete) - (let ((t9-7 send-event-function) - (v1-17 sv-24) - ) - (not (t9-7 - (if v1-17 - (-> v1-17 extra process) + (let ((sv-24 (entity-actor-lookup (-> self entity) 'alt-actor 0))) + (entity-birth-no-kill sv-24) + (apply-all (-> self link) actor-link-dead-hook (& sv-16)) + (when (and sv-16 sv-24) + (process-grab? *target*) + (suspend-for (seconds 1) + ) + (process-release? *target*) + (while (let ((a1-4 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-4 from) self) + (set! (-> a1-4 num-params) 0) + (set! (-> a1-4 message) 'task-complete) + (let ((v1-17 sv-24)) + (not (send-event-function + (if v1-17 + (-> v1-17 extra process) + ) + a1-4 ) - a1-4 - ) - ) - ) - ) - (suspend) + ) + ) + ) + (suspend) + ) + ) ) ) ) diff --git a/test/decompiler/reference/jak1/levels/misty/misty-conveyor_REF.gc b/test/decompiler/reference/jak1/levels/misty/misty-conveyor_REF.gc index 281172af8c..aa67e3dbae 100644 --- a/test/decompiler/reference/jak1/levels/misty/misty-conveyor_REF.gc +++ b/test/decompiler/reference/jak1/levels/misty/misty-conveyor_REF.gc @@ -253,7 +253,6 @@ (defstate keg-on-path (keg) :event keg-event-handler :code (behavior () - (local-vars (sv-48 float) (sv-64 float) (sv-80 float) (sv-96 float) (sv-112 float)) (let ((gp-0 (new-stack-vector0)) (s5-0 (new 'stack 'vector3s)) ) @@ -268,90 +267,92 @@ (/ 1.0 f24-0) (let ((f22-0 1.0) (f20-0 2.5) + (sv-48 0.0) + (sv-64 0.0) + (sv-80 (- (-> *standard-dynamics* gravity-length))) ) - (set! sv-48 0.0) - (set! sv-64 0.0) - (set! sv-80 (- (-> *standard-dynamics* gravity-length))) (loop - (let ((f0-13 (+ (get-current-phase (-> (the-as keg-conveyor-paddle (-> self parent 0)) sync)) f26-1))) - (set! sv-96 (- f0-13 (the float (the int f0-13)))) - ) - (if (< sv-96 f30-0) - (go keg-in-chute) - ) - (set! f30-0 sv-96) - (set! sv-112 (* sv-96 f28-0)) - (eval-path-curve-div! - (-> (the-as keg-conveyor-paddle (-> self parent 0)) path) - (-> self path-position) - sv-112 - 'interp - ) - (path-control-method-12 (-> (the-as keg-conveyor-paddle (-> self parent 0)) path) gp-0 sv-112) - (seek-toward-heading-vec! (-> self root) gp-0 131072.0 (seconds 0.1)) - (set! (-> self root trans quad) (-> self path-position quad)) - (when (= (-> self keg-behavior) 1) - (cond - ((>= (vector4-dot (camera-pos) (-> self shadow-enable-plane)) 0.0) - (let ((v1-32 (-> self draw shadow-ctrl))) - (logclear! (-> v1-32 settings flags) (shadow-flags disable-draw)) + (let* ((f0-13 (+ (get-current-phase (-> (the-as keg-conveyor-paddle (-> self parent 0)) sync)) f26-1)) + (sv-96 (- f0-13 (the float (the int f0-13)))) ) - 0 - (let ((v1-35 (-> self draw shadow-ctrl))) - (set! (-> v1-35 settings top-plane w) (- (-> self path-position y))) - ) - 0 - (let ((v1-38 (-> self draw shadow-ctrl))) - (set! (-> v1-38 settings bot-plane w) (- (+ -8192.0 (-> self path-position y)))) - ) - 0 - ) - (else - (let ((v1-41 (-> self draw shadow-ctrl))) - (logior! (-> v1-41 settings flags) (shadow-flags disable-draw)) + (if (< sv-96 f30-0) + (go keg-in-chute) + ) + (set! f30-0 sv-96) + (let ((sv-112 (* sv-96 f28-0))) + (eval-path-curve-div! + (-> (the-as keg-conveyor-paddle (-> self parent 0)) path) + (-> self path-position) + sv-112 + 'interp + ) + (path-control-method-12 (-> (the-as keg-conveyor-paddle (-> self parent 0)) path) gp-0 sv-112) + (seek-toward-heading-vec! (-> self root) gp-0 131072.0 (seconds 0.1)) + (set! (-> self root trans quad) (-> self path-position quad)) + (when (= (-> self keg-behavior) 1) + (cond + ((>= (vector4-dot (camera-pos) (-> self shadow-enable-plane)) 0.0) + (let ((v1-32 (-> self draw shadow-ctrl))) + (logclear! (-> v1-32 settings flags) (shadow-flags disable-draw)) + ) + 0 + (let ((v1-35 (-> self draw shadow-ctrl))) + (set! (-> v1-35 settings top-plane w) (- (-> self path-position y))) + ) + 0 + (let ((v1-38 (-> self draw shadow-ctrl))) + (set! (-> v1-38 settings bot-plane w) (- (+ -8192.0 (-> self path-position y)))) + ) + 0 + ) + (else + (let ((v1-41 (-> self draw shadow-ctrl))) + (logior! (-> v1-41 settings flags) (shadow-flags disable-draw)) + ) + 0 + (let ((v1-44 (-> self draw shadow-ctrl))) + (set! (-> v1-44 settings top-plane w) (- (-> self path-position y))) + ) + 0 + (let ((v1-47 (-> self draw shadow-ctrl))) + (set! (-> v1-47 settings bot-plane w) (- (+ -8192.0 (-> self path-position y)))) + ) + 0 + ) ) - 0 - (let ((v1-44 (-> self draw shadow-ctrl))) - (set! (-> v1-44 settings top-plane w) (- (-> self path-position y))) + (let ((f0-32 (- f28-0 sv-112))) + (if (< f0-32 f20-0) + (set! f22-0 (/ f0-32 f20-0)) + ) ) - 0 - (let ((v1-47 (-> self draw shadow-ctrl))) - (set! (-> v1-47 settings bot-plane w) (- (+ -8192.0 (-> self path-position y)))) + (+! sv-64 (* sv-80 (seconds-per-frame))) + (+! sv-48 (* sv-64 (seconds-per-frame))) + (when (< sv-48 0.0) + (set! sv-48 0.0) + (activate! (-> self smush) -0.15 90 150 1.0 1.0) + (set! sv-64 f24-0) + (sound-play "barrel-bounce" :vol 80) + (process-spawn + part-tracker + :init part-tracker-init + group-keg-bounce + -1 + keg-bounce-set-particle-rotation-callback + (-> self ppointer) + #f + (-> self root trans) + :to self + ) ) - 0 + (let ((f0-39 (update! (-> self smush)))) + (keg-update-smush self f0-39) + ) + (+! (-> self root trans y) (* f22-0 sv-48)) + (set! (-> s5-0 x) 0.0) + (set! (-> s5-0 y) 1.0) + (set! (-> s5-0 z) 0.0) ) ) - (let ((f0-32 (- f28-0 sv-112))) - (if (< f0-32 f20-0) - (set! f22-0 (/ f0-32 f20-0)) - ) - ) - (set! sv-64 (+ sv-64 (* sv-80 (seconds-per-frame)))) - (set! sv-48 (+ sv-48 (* sv-64 (seconds-per-frame)))) - (when (< sv-48 0.0) - (set! sv-48 0.0) - (activate! (-> self smush) -0.15 90 150 1.0 1.0) - (set! sv-64 f24-0) - (sound-play "barrel-bounce" :vol 80) - (process-spawn - part-tracker - :init part-tracker-init - group-keg-bounce - -1 - keg-bounce-set-particle-rotation-callback - (-> self ppointer) - #f - (-> self root trans) - :to self - ) - ) - (let ((f0-39 (update! (-> self smush)))) - (keg-update-smush self f0-39) - ) - (+! (-> self root trans y) (* f22-0 sv-48)) - (set! (-> s5-0 x) 0.0) - (set! (-> s5-0 y) 1.0) - (set! (-> s5-0 z) 0.0) ) (ja :num! (loop!)) (suspend) diff --git a/test/decompiler/reference/jak1/levels/misty/mistycannon_REF.gc b/test/decompiler/reference/jak1/levels/misty/mistycannon_REF.gc index ab1c050c3a..50c4c894c9 100644 --- a/test/decompiler/reference/jak1/levels/misty/mistycannon_REF.gc +++ b/test/decompiler/reference/jak1/levels/misty/mistycannon_REF.gc @@ -1354,7 +1354,7 @@ (f0-3 f1-3) (f30-0 (- (* arg2 arg1 arg1))) (f2-6 (+ f1-3 (* arg1 arg1 arg3))) - (f1-5 (- (* f30-0 f30-0) (* 4.0 f2-6 f0-3))) + (f1-5 (- (square f30-0) (* 4.0 f2-6 f0-3))) (f28-0 (/ 0.5 f0-3)) ) (if (< f1-5 0.0) @@ -1769,7 +1769,6 @@ ;; INFO: Used lq/sq ;; INFO: Return type mismatch object vs none. (defmethod init-from-entity! ((this mistycannon) (arg0 entity-actor)) - (local-vars (sv-16 res-tag) (sv-32 res-tag) (sv-48 res-tag)) (logior! (-> this mask) (process-mask enemy)) (let ((s4-0 (new 'process 'collide-shape-moving this (collide-list-enum hit-by-others)))) (set! (-> s4-0 dynam) (copy *standard-dynamics* 'process)) @@ -1838,24 +1837,27 @@ (set! (-> this center-point w) (-> this fact idle-distance)) ) (else - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-64 (res-lump-data arg0 'center-point pointer :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-64 (res-lump-data arg0 'center-point pointer :tag-ptr (& sv-16))) + ) (set! (-> this center-point x) (if (and v1-64 (< 0.0 (the float (-> sv-16 elt-count)))) (-> (the-as (pointer float) v1-64)) 0.0 ) ) ) - (set! sv-32 (new 'static 'res-tag)) - (let ((v1-67 (res-lump-data arg0 'center-point (pointer float) :tag-ptr (& sv-32)))) + (let* ((sv-32 (new 'static 'res-tag)) + (v1-67 (res-lump-data arg0 'center-point (pointer float) :tag-ptr (& sv-32))) + ) (set! (-> this center-point y) (if (and v1-67 (< 1.0 (the float (-> sv-32 elt-count)))) (-> v1-67 1) 0.0 ) ) ) - (set! sv-48 (new 'static 'res-tag)) - (let ((v1-70 (res-lump-data arg0 'center-point (pointer float) :tag-ptr (& sv-48)))) + (let* ((sv-48 (new 'static 'res-tag)) + (v1-70 (res-lump-data arg0 'center-point (pointer float) :tag-ptr (& sv-48))) + ) (set! (-> this center-point z) (if (and v1-70 (< 2.0 (the float (-> sv-48 elt-count)))) (-> v1-70 2) 0.0 diff --git a/test/decompiler/reference/jak1/levels/ogre/ogreboss_REF.gc b/test/decompiler/reference/jak1/levels/ogre/ogreboss_REF.gc index 1396193698..7189f4d90e 100644 --- a/test/decompiler/reference/jak1/levels/ogre/ogreboss_REF.gc +++ b/test/decompiler/reference/jak1/levels/ogre/ogreboss_REF.gc @@ -1538,12 +1538,9 @@ ) ) ) - (let* ((gp-0 (the int (* (-> self difficulty) (+ 8.0 (* 4.0 (-> self level)))))) - (f0-17 1.0) - (f1-2 0.15) - (f2-2 (-> self difficulty)) - (f30-0 (+ f0-17 (* f1-2 (* f2-2 f2-2) (-> self level)))) - ) + (let ((gp-0 (the int (* (-> self difficulty) (+ 8.0 (* 4.0 (-> self level)))))) + (f30-0 (+ 1.0 (* 0.15 (square (-> self difficulty)) (-> self level)))) + ) (ja-channel-push! 1 (seconds 0.1)) (ja-no-eval :group! ogreboss-attack2-start-ja :num! (seek! max f30-0) :frame-num 0.0) (until (ja-done? 0) diff --git a/test/decompiler/reference/jak1/levels/racer_common/collide-reaction-racer_REF.gc b/test/decompiler/reference/jak1/levels/racer_common/collide-reaction-racer_REF.gc index ef250c41d9..e0d1e6ceb1 100644 --- a/test/decompiler/reference/jak1/levels/racer_common/collide-reaction-racer_REF.gc +++ b/test/decompiler/reference/jak1/levels/racer_common/collide-reaction-racer_REF.gc @@ -5,188 +5,189 @@ ;; INFO: Used lq/sq ;; INFO: Return type mismatch int vs cshape-moving-flags. (defun racer-collision-reaction ((arg0 control-info) (arg1 collide-shape-intersect) (arg2 vector) (arg3 vector)) - (local-vars (sv-80 vector) (sv-84 vector) (sv-88 (inline-array vector)) (sv-96 int) (sv-104 int)) - (set! sv-80 (new-stack-vector0)) - (set! sv-84 (new-stack-vector0)) - (let ((v1-2 (new 'stack-no-clear 'inline-array 'vector 2))) + (let ((sv-80 (new-stack-vector0)) + (sv-84 (new-stack-vector0)) + (v1-2 (new 'stack-no-clear 'inline-array 'vector 2)) + ) (dotimes (a0-1 2) (set! (-> v1-2 a0-1 quad) (the-as uint128 0)) ) - (set! sv-88 v1-2) - ) - (set! sv-96 0) - (set! sv-104 0) - (set! (-> sv-88 0 quad) (-> arg3 quad)) - (set! (-> sv-88 1 quad) (-> arg3 quad)) - (let ((a1-3 (new 'stack-no-clear 'vector))) - (vector-float*! a1-3 (-> arg1 move-vec) (-> arg1 best-u)) - (move-by-vector! arg0 a1-3) - ) - (set-and-handle-pat! arg0 (-> arg1 best-tri pat)) - (if (= (-> arg0 poly-pat mode) (pat-mode wall)) - (set! sv-104 (logior sv-104 1)) - ) - (if (= (-> arg0 unknown-surface00 mode) 'air) - (set! sv-104 (logior sv-104 32)) - ) - (let ((v1-21 (new 'stack-no-clear 'vector))) - (set! (-> v1-21 quad) (-> arg1 best-from-prim prim-core world-sphere quad)) - (vector-! sv-80 v1-21 (-> arg1 best-tri intersect)) - ) - (vector-normalize! sv-80 1.0) - (set! (-> arg0 coverage) (vector-dot sv-80 (-> arg1 best-tri normal))) - (when (< (-> arg0 coverage) 0.0) - (set! (-> arg0 coverage) 0.0) - (vector-flatten! sv-80 sv-80 (-> arg1 best-tri normal)) - (vector-normalize! sv-80 1.0) - ) - (if (< (-> arg0 coverage) 0.9999) - (set! sv-104 (logior sv-104 24)) - ) - (let ((v1-31 (-> sv-80 quad))) - (set! (-> sv-84 quad) v1-31) - ) - (if (= (-> arg1 best-u) 0.0) - (move-by-vector! arg0 (vector-normalize-copy! (new-stack-vector0) sv-84 3.0)) - ) - (set! (-> arg0 poly-normal quad) (-> arg1 best-tri normal quad)) - (collide-shape-moving-angle-set! arg0 sv-84 (-> sv-88 0)) - (if (< (-> arg0 poly-angle) -0.2) - (set! sv-96 (logior sv-96 16)) - ) - (let ((s3-1 (< (fabs (-> arg0 surface-angle)) (-> *pat-mode-info* (-> arg0 cur-pat mode) wall-angle)))) - (if s3-1 - (set! sv-104 (logior sv-104 2)) - ) - (when (not (logtest? (-> arg0 prev-status) (cshape-moving-flags onsurf))) - (set! (-> arg0 ground-impact-vel) (- (vector-dot (-> arg0 transv) (-> arg0 dynam gravity-normal)))) - (set! sv-96 (logior sv-96 2048)) - (when (not s3-1) - (let ((f30-0 (- 1.0 (-> arg0 surf impact-fric)))) - (when (< f30-0 1.0) - (let ((s2-1 (new-stack-vector0)) - (f28-0 (vector-dot (-> arg0 dynam gravity-normal) (-> sv-88 0))) - ) - 0.0 - (vector-! s2-1 (-> sv-88 0) (vector-float*! s2-1 (-> arg0 dynam gravity-normal) f28-0)) - (let* ((f0-18 (vector-length s2-1)) - (f1-6 f0-18) - ) - (if (< f28-0 0.0) - (set! f28-0 (* f28-0 f30-0)) - ) - (vector+! - (-> sv-88 0) - (vector-float*! (-> sv-88 0) (-> arg0 dynam gravity-normal) f28-0) - (vector-float*! s2-1 s2-1 (/ f0-18 f1-6)) - ) - ) - ) - ) + (let ((sv-88 v1-2) + (sv-96 0) ) - ) - ) - (set! sv-96 (logior sv-96 4)) - (cond - ((-> arg1 best-to-prim) - (set! sv-96 (logior sv-96 32)) - (set! (-> arg0 unknown-vector72 quad) (-> arg1 best-tri intersect quad)) - (set! (-> arg0 unknown-vector73 quad) (-> arg0 poly-normal quad)) - (set! (-> arg0 unknown-handle00) (process->handle (-> arg1 best-to-prim cshape process))) - ) - ((= (-> arg0 poly-pat material) (pat-material waterbottom)) - ) - (else - (set! sv-96 (logior sv-96 4096)) - ) - ) - (if (and s3-1 (logtest? (collide-action racer-unused) (-> arg0 root-prim prim-core action))) - (set! s3-1 #f) - ) - (cond - (s3-1 - (set! sv-104 (logior sv-104 4)) - (set! sv-96 (logior sv-96 8)) - (set! (-> arg0 cur-pat mode) 1) - (set! (-> arg0 unknown-vector70 quad) (-> arg1 best-tri intersect quad)) - (set! (-> arg0 unknown-vector71 quad) (-> arg0 poly-normal quad)) - (set! (-> arg0 wall-pat) (-> arg1 best-tri pat)) - (vector-reflect-flat-above! arg2 (-> sv-88 0) sv-84) - (cond - ((not (and (>= (-> arg1 best-from-prim local-sphere w) - (vector-dot - (-> arg0 ground-poly-normal) - (vector-! (new 'stack-no-clear 'vector) (-> arg1 best-tri intersect) (-> arg0 ground-touch-point)) + (let ((sv-104 0)) + (set! (-> sv-88 0 quad) (-> arg3 quad)) + (set! (-> sv-88 1 quad) (-> arg3 quad)) + (let ((a1-3 (new 'stack-no-clear 'vector))) + (vector-float*! a1-3 (-> arg1 move-vec) (-> arg1 best-u)) + (move-by-vector! arg0 a1-3) + ) + (set-and-handle-pat! arg0 (-> arg1 best-tri pat)) + (if (= (-> arg0 poly-pat mode) (pat-mode wall)) + (logior! sv-104 1) + ) + (if (= (-> arg0 unknown-surface00 mode) 'air) + (logior! sv-104 32) + ) + (let ((v1-21 (new 'stack-no-clear 'vector))) + (set! (-> v1-21 quad) (-> arg1 best-from-prim prim-core world-sphere quad)) + (vector-! sv-80 v1-21 (-> arg1 best-tri intersect)) + ) + (vector-normalize! sv-80 1.0) + (set! (-> arg0 coverage) (vector-dot sv-80 (-> arg1 best-tri normal))) + (when (< (-> arg0 coverage) 0.0) + (set! (-> arg0 coverage) 0.0) + (vector-flatten! sv-80 sv-80 (-> arg1 best-tri normal)) + (vector-normalize! sv-80 1.0) + ) + (if (< (-> arg0 coverage) 0.9999) + (logior! sv-104 24) + ) + (set! (-> sv-84 quad) (-> sv-80 quad)) + (if (= (-> arg1 best-u) 0.0) + (move-by-vector! arg0 (vector-normalize-copy! (new-stack-vector0) sv-84 3.0)) + ) + (set! (-> arg0 poly-normal quad) (-> arg1 best-tri normal quad)) + (collide-shape-moving-angle-set! arg0 sv-84 (-> sv-88 0)) + (if (< (-> arg0 poly-angle) -0.2) + (logior! sv-96 16) + ) + (let ((s3-1 (< (fabs (-> arg0 surface-angle)) (-> *pat-mode-info* (-> arg0 cur-pat mode) wall-angle)))) + (if s3-1 + (logior! sv-104 2) + ) + (when (not (logtest? (-> arg0 prev-status) (cshape-moving-flags onsurf))) + (set! (-> arg0 ground-impact-vel) (- (vector-dot (-> arg0 transv) (-> arg0 dynam gravity-normal)))) + (logior! sv-96 2048) + (when (not s3-1) + (let ((f30-0 (- 1.0 (-> arg0 surf impact-fric)))) + (when (< f30-0 1.0) + (let ((s2-1 (new-stack-vector0)) + (f28-0 (vector-dot (-> arg0 dynam gravity-normal) (-> sv-88 0))) + ) + 0.0 + (vector-! s2-1 (-> sv-88 0) (vector-float*! s2-1 (-> arg0 dynam gravity-normal) f28-0)) + (let* ((f0-18 (vector-length s2-1)) + (f1-6 f0-18) ) - ) - (and (< 0.0 (vector-dot (-> arg0 ground-poly-normal) arg2)) - (not (time-elapsed? (-> arg0 unknown-dword10) (seconds 0.3))) - (not (logtest? sv-104 32)) + (if (< f28-0 0.0) + (set! f28-0 (* f28-0 f30-0)) ) - ) + (vector+! + (-> sv-88 0) + (vector-float*! (-> sv-88 0) (-> arg0 dynam gravity-normal) f28-0) + (vector-float*! s2-1 s2-1 (/ f0-18 f1-6)) + ) + ) + ) + ) ) - ) - (else - (set! sv-104 (logior sv-104 256)) - (set! sv-104 (logand -65 sv-104)) - (let ((s3-3 (vector-cross! (new 'stack-no-clear 'vector) (-> arg0 poly-normal) (-> arg0 ground-poly-normal)))) - (vector-normalize! s3-3 1.0) - (vector-float*! arg2 s3-3 (vector-dot (-> sv-88 0) s3-3)) ) - (vector+! arg2 arg2 (-> arg0 poly-normal)) ) - ) - (let* ((s2-2 (vector-normalize-copy! (new 'stack-no-clear 'vector) (-> sv-88 0) 1.0)) - (s3-4 (new-stack-vector0)) - (f30-1 (vector-dot s2-2 arg2)) - ) - 0.0 - (vector-! s3-4 arg2 (vector-float*! s3-4 s2-2 f30-1)) - (let* ((f1-11 (vector-length s3-4)) - (f0-27 f1-11) - (f1-12 (* 0.9 f1-11)) + (logior! sv-96 4) + (cond + ((-> arg1 best-to-prim) + (logior! sv-96 32) + (set! (-> arg0 unknown-vector72 quad) (-> arg1 best-tri intersect quad)) + (set! (-> arg0 unknown-vector73 quad) (-> arg0 poly-normal quad)) + (set! (-> arg0 unknown-handle00) (process->handle (-> arg1 best-to-prim cshape process))) + ) + ((= (-> arg0 poly-pat material) (pat-material waterbottom)) + ) + (else + (logior! sv-96 4096) + ) + ) + (if (and s3-1 (logtest? (collide-action racer-unused) (-> arg0 root-prim prim-core action))) + (set! s3-1 #f) + ) + (cond + (s3-1 + (logior! sv-104 4) + (logior! sv-96 8) + (set! (-> arg0 cur-pat mode) 1) + (set! (-> arg0 unknown-vector70 quad) (-> arg1 best-tri intersect quad)) + (set! (-> arg0 unknown-vector71 quad) (-> arg0 poly-normal quad)) + (set! (-> arg0 wall-pat) (-> arg1 best-tri pat)) + (vector-reflect-flat-above! arg2 (-> sv-88 0) sv-84) + (cond + ((not (and (>= (-> arg1 best-from-prim local-sphere w) + (vector-dot + (-> arg0 ground-poly-normal) + (vector-! (new 'stack-no-clear 'vector) (-> arg1 best-tri intersect) (-> arg0 ground-touch-point)) + ) + ) + (and (< 0.0 (vector-dot (-> arg0 ground-poly-normal) arg2)) + (not (time-elapsed? (-> arg0 unknown-dword10) (seconds 0.3))) + (not (logtest? sv-104 32)) + ) + ) + ) ) - (vector+! arg2 (vector-float*! arg2 s2-2 f30-1) (vector-float*! s3-4 s3-4 (/ f1-12 f0-27))) - ) - ) - ) - (else - (set! sv-96 (logior sv-96 1)) - (set! (-> arg0 cur-pat mode) 0) - (if (and (= (-> arg1 best-from-prim prim-id) 6) (not (logtest? sv-104 7))) - (set! (-> arg0 local-normal quad) (-> sv-84 quad)) - ) - (vector-reflect-flat! arg2 (-> sv-88 0) sv-84) - (dotimes (v1-142 16) - (vector+! arg2 arg2 (-> arg0 poly-normal)) - ) - (set! sv-96 (logior sv-96 2)) - (set! (-> arg0 ground-touch-point w) 0.0) - (when (not (logtest? sv-104 15)) - (set! sv-96 (logior sv-96 2)) - (set! (-> arg0 ground-poly-normal quad) (-> arg0 poly-normal quad)) - (set! (-> arg0 unknown-vector53 quad) (-> sv-84 quad)) - (set! (-> arg0 unknown-float60) (vector-dot sv-84 (-> arg0 dynam gravity-normal))) - (set-time! (-> arg0 unknown-dword10)) - (set! (-> arg0 ground-pat) (-> arg0 poly-pat)) - (set! (-> arg0 ground-touch-point quad) (-> arg1 best-tri intersect quad)) - (set! sv-104 (logior sv-104 2048)) - (if (= (-> arg0 poly-pat material) (pat-material waterbottom)) - (set! sv-96 (logior sv-96 1024)) + (else + (logior! sv-104 256) + (logand! sv-104 -65) + (let ((s3-3 (vector-cross! (new 'stack-no-clear 'vector) (-> arg0 poly-normal) (-> arg0 ground-poly-normal)))) + (vector-normalize! s3-3 1.0) + (vector-float*! arg2 s3-3 (vector-dot (-> sv-88 0) s3-3)) + ) + (vector+! arg2 arg2 (-> arg0 poly-normal)) + ) + ) + (let* ((s2-2 (vector-normalize-copy! (new 'stack-no-clear 'vector) (-> sv-88 0) 1.0)) + (s3-4 (new-stack-vector0)) + (f30-1 (vector-dot s2-2 arg2)) + ) + 0.0 + (vector-! s3-4 arg2 (vector-float*! s3-4 s2-2 f30-1)) + (let* ((f1-11 (vector-length s3-4)) + (f0-27 f1-11) + (f1-12 (* 0.9 f1-11)) + ) + (vector+! arg2 (vector-float*! arg2 s2-2 f30-1) (vector-float*! s3-4 s3-4 (/ f1-12 f0-27))) + ) + ) ) + (else + (logior! sv-96 1) + (set! (-> arg0 cur-pat mode) 0) + (if (and (= (-> arg1 best-from-prim prim-id) 6) (not (logtest? sv-104 7))) + (set! (-> arg0 local-normal quad) (-> sv-84 quad)) + ) + (vector-reflect-flat! arg2 (-> sv-88 0) sv-84) + (dotimes (v1-142 16) + (vector+! arg2 arg2 (-> arg0 poly-normal)) + ) + (logior! sv-96 2) + (set! (-> arg0 ground-touch-point w) 0.0) + (when (not (logtest? sv-104 15)) + (logior! sv-96 2) + (set! (-> arg0 ground-poly-normal quad) (-> arg0 poly-normal quad)) + (set! (-> arg0 unknown-vector53 quad) (-> sv-84 quad)) + (set! (-> arg0 unknown-float60) (vector-dot sv-84 (-> arg0 dynam gravity-normal))) + (set-time! (-> arg0 unknown-dword10)) + (set! (-> arg0 ground-pat) (-> arg0 poly-pat)) + (set! (-> arg0 ground-touch-point quad) (-> arg1 best-tri intersect quad)) + (logior! sv-104 2048) + (if (= (-> arg0 poly-pat material) (pat-material waterbottom)) + (logior! sv-96 1024) + ) + ) + ) + ) ) + (logior! (-> arg0 status) sv-96) + (set! (-> arg0 reaction-flag) (the-as cshape-reaction-flags sv-104)) ) + (update! + (-> arg0 history-data (-> arg0 unknown-halfword00)) + arg0 + (-> arg1 best-tri intersect) + (-> sv-88 1) + arg2 + ) + (set! (-> arg0 unknown-halfword00) (logand (+ (-> arg0 unknown-halfword00) 1) 127)) + (the-as cshape-moving-flags sv-96) ) ) - (logior! (-> arg0 status) sv-96) - (set! (-> arg0 reaction-flag) (the-as cshape-reaction-flags sv-104)) - (update! - (-> arg0 history-data (-> arg0 unknown-halfword00)) - arg0 - (-> arg1 best-tri intersect) - (-> sv-88 1) - arg2 - ) - (set! (-> arg0 unknown-halfword00) (logand (+ (-> arg0 unknown-halfword00) 1) 127)) - (the-as cshape-moving-flags sv-96) ) diff --git a/test/decompiler/reference/jak1/levels/rolling/rolling-lightning-mole_REF.gc b/test/decompiler/reference/jak1/levels/rolling/rolling-lightning-mole_REF.gc index aa7e76b742..4cd32c0ce4 100644 --- a/test/decompiler/reference/jak1/levels/rolling/rolling-lightning-mole_REF.gc +++ b/test/decompiler/reference/jak1/levels/rolling/rolling-lightning-mole_REF.gc @@ -4,7 +4,7 @@ ;; definition for function find-adjacent-bounds-one ;; INFO: Used lq/sq (defun find-adjacent-bounds-one ((arg0 nav-mesh) (arg1 nav-poly) (arg2 int) (arg3 (array int8)) (arg4 (array int8)) (arg5 vector)) - (local-vars (v0-2 object) (v1-2 int) (v1-30 int) (a0-2 int) (a0-12 int) (sv-16 nav-poly) (sv-32 int)) + (local-vars (v0-2 object) (v1-2 int) (v1-30 int) (a0-2 int) (a0-12 int)) (let ((v1-1 (+ arg2 1))) (let ((a0-1 2)) (set-on-less-than a0-2 a0-1 v1-1) @@ -21,51 +21,53 @@ ) ) ) - (let ((s0-0 (-> arg1 vertex (-> arg3 arg2)))) - (set! sv-16 arg1) + (let ((s0-0 (-> arg1 vertex (-> arg3 arg2))) + (sv-16 arg1) + ) (while (begin (label cfg-28) #t) - (set! sv-32 0) - (while (< sv-32 3) - (cond - ((and (= sv-32 arg2) (= sv-16 arg1)) - ) - ((= s0-0 (-> sv-16 vertex (-> arg4 sv-32))) - (vector+! arg5 (-> arg0 origin) (the-as vector (-> arg0 vertex (-> sv-16 vertex (-> arg3 sv-32))))) - (let ((v1-29 (+ sv-32 1))) - (let ((a0-11 2)) - (set-on-less-than a0-12 a0-11 v1-29) - ) - (move-if-not-zero v1-30 0 a0-12 v1-29) + (let ((sv-32 0)) + (while (< sv-32 3) + (cond + ((and (= sv-32 arg2) (= sv-16 arg1)) ) - (let ((v1-32 (-> sv-16 adj-poly v1-30))) - (if (= v1-32 255) - (return #t) + ((= s0-0 (-> sv-16 vertex (-> arg4 sv-32))) + (vector+! arg5 (-> arg0 origin) (the-as vector (-> arg0 vertex (-> sv-16 vertex (-> arg3 sv-32))))) + (let ((v1-29 (+ sv-32 1))) + (let ((a0-11 2)) + (set-on-less-than a0-12 a0-11 v1-29) ) - (let ((v1-35 (-> arg0 poly v1-32))) - (set! v0-2 (cond - ((= arg1 v1-35) - (format 0 "ERROR: find-adjacent-bounds-one given tried to go back~%") - ) - (else - (cond - ((logtest? (-> v1-35 pat) 1) - (return #t) - ) - (else - (set! arg1 sv-16) - (set! sv-16 v1-35) - (goto cfg-28) + (move-if-not-zero v1-30 0 a0-12 v1-29) + ) + (let ((v1-32 (-> sv-16 adj-poly v1-30))) + (if (= v1-32 255) + (return #t) + ) + (let ((v1-35 (-> arg0 poly v1-32))) + (set! v0-2 (cond + ((= arg1 v1-35) + (format 0 "ERROR: find-adjacent-bounds-one given tried to go back~%") + ) + (else + (cond + ((logtest? (-> v1-35 pat) 1) + (return #t) + ) + (else + (set! arg1 sv-16) + (set! sv-16 v1-35) + (goto cfg-28) + ) ) + v0-2 ) - v0-2 ) - ) - ) + ) + ) ) ) - ) + ) + (+! sv-32 1) ) - (set! sv-32 (+ sv-32 1)) ) (format 0 "ERROR: abnormal exit from find-adjacent-bounds-one~%") (return #f) @@ -219,7 +221,6 @@ ;; definition for function fleeing-nav-enemy-clip-travel ;; INFO: Used lq/sq (defun fleeing-nav-enemy-clip-travel ((arg0 fleeing-nav-enemy) (arg1 vector)) - (local-vars (sv-224 vector) (sv-240 vector) (sv-256 vector) (sv-272 vector) (sv-288 vector)) (let ((s2-0 (new 'stack 'clip-travel-vector-to-mesh-return-info)) (gp-0 (new 'stack-no-clear 'vector)) (s1-0 #f) @@ -252,21 +253,8 @@ (cond ((< (cos f28-1) f30-0) (vector--float*! s3-0 s0-0 (-> s2-0 boundary-normal) f30-0) - (let ((s0-1 vector-normalize!)) - (set! sv-224 s3-0) - (let ((a1-7 (sin f28-1))) - (s0-1 sv-224 a1-7) - ) - ) - (let ((s0-2 vector+float*!)) - (set! sv-240 s3-0) - (set! sv-256 s3-0) - (let ((s2-1 (-> s2-0 boundary-normal)) - (a3-1 (cos f28-1)) - ) - (s0-2 sv-240 sv-256 s2-1 a3-1) - ) - ) + (vector-normalize! s3-0 (sin f28-1)) + (vector+float*! s3-0 s3-0 (-> s2-0 boundary-normal) (cos f28-1)) ) (else (let ((v1-15 s3-0)) @@ -280,31 +268,13 @@ ((< (cos (-> arg0 flee-info min-reflect-angle)) f30-0) (vector--float*! s3-0 s0-0 (-> s2-0 boundary-normal) f30-0) (vector-normalize! s3-0 (sin (-> arg0 flee-info min-reflect-angle))) - (let ((s1-2 vector--float*!) - (s0-4 s3-0) - ) - (set! sv-272 s3-0) - (let ((s2-2 (-> s2-0 boundary-normal)) - (a3-3 (cos (-> arg0 flee-info min-reflect-angle))) - ) - (s1-2 s0-4 sv-272 s2-2 a3-3) - ) - ) + (vector--float*! s3-0 s3-0 (-> s2-0 boundary-normal) (cos (-> arg0 flee-info min-reflect-angle))) (set! s1-0 #t) ) ((< f30-0 (cos (-> arg0 flee-info max-reflect-angle))) (vector--float*! s3-0 s0-0 (-> s2-0 boundary-normal) f30-0) (vector-normalize! s3-0 (sin (-> arg0 flee-info max-reflect-angle))) - (let ((s1-4 vector--float*!) - (s0-6 s3-0) - ) - (set! sv-288 s3-0) - (let ((s2-3 (-> s2-0 boundary-normal)) - (a3-5 (cos (-> arg0 flee-info max-reflect-angle))) - ) - (s1-4 s0-6 sv-288 s2-3 a3-5) - ) - ) + (vector--float*! s3-0 s3-0 (-> s2-0 boundary-normal) (cos (-> arg0 flee-info max-reflect-angle))) (set! s1-0 #t) ) (else @@ -572,41 +542,41 @@ ;; definition for function lightning-mole-task-complete? (defbehavior lightning-mole-task-complete? lightning-mole () - (local-vars (sv-16 symbol)) (process-entity-status! self (entity-perm-status complete) #t) (when (or (-> self link prev) (-> self link next)) - (set! sv-16 (the-as symbol #f)) - (apply-all (-> self link) actor-link-subtask-complete-hook (& sv-16)) - (cond - (sv-16 - (close-specific-task! (-> self entity extra perm task) (task-status need-reminder)) - (process-spawn-function - process - (lambda :behavior lightning-mole - () - (while (or (-> *setting-control* current ambient) - (-> *setting-control* current movie) - (-> *setting-control* current hint) - ) - (suspend) + (let ((sv-16 (the-as symbol #f))) + (apply-all (-> self link) actor-link-subtask-complete-hook (& sv-16)) + (cond + (sv-16 + (close-specific-task! (-> self entity extra perm task) (task-status need-reminder)) + (process-spawn-function + process + (lambda :behavior lightning-mole + () + (while (or (-> *setting-control* current ambient) + (-> *setting-control* current movie) + (-> *setting-control* current hint) + ) + (suspend) + ) + (level-hint-spawn + (text-id rolling-moles-resolution) + "sksp0112" + (the-as entity #f) + *entity-pool* + (game-task none) + ) + (none) ) - (level-hint-spawn - (text-id rolling-moles-resolution) - "sksp0112" - (the-as entity #f) - *entity-pool* - (game-task none) - ) - (none) + :to self ) - :to self + (format #t "lightning-mole task is complete~%") + ) + (else ) - (format #t "lightning-mole task is complete~%") - ) - (else ) + sv-16 ) - sv-16 ) ) diff --git a/test/decompiler/reference/jak1/levels/rolling/rolling-robber_REF.gc b/test/decompiler/reference/jak1/levels/rolling/rolling-robber_REF.gc index 026854e9b6..a4fc718d34 100644 --- a/test/decompiler/reference/jak1/levels/rolling/rolling-robber_REF.gc +++ b/test/decompiler/reference/jak1/levels/rolling/rolling-robber_REF.gc @@ -141,20 +141,20 @@ ;; definition for function robber-task-complete? (defbehavior robber-task-complete? robber () - (local-vars (sv-16 symbol)) (process-entity-status! self (entity-perm-status complete) #t) (when (or (-> self link prev) (-> self link next)) - (set! sv-16 (the-as symbol #f)) - (apply-all (-> self link) actor-link-subtask-complete-hook (& sv-16)) - (cond - (sv-16 - (close-specific-task! (-> self entity extra perm task) (task-status need-reminder)) - (format #t "robber task is complete~%") - ) - (else + (let ((sv-16 (the-as symbol #f))) + (apply-all (-> self link) actor-link-subtask-complete-hook (& sv-16)) + (cond + (sv-16 + (close-specific-task! (-> self entity extra perm task) (task-status need-reminder)) + (format #t "robber task is complete~%") + ) + (else + ) ) + sv-16 ) - sv-16 ) ) diff --git a/test/decompiler/reference/jak1/levels/snow/snow-ball_REF.gc b/test/decompiler/reference/jak1/levels/snow/snow-ball_REF.gc index 8e3407cbc6..f70f367949 100644 --- a/test/decompiler/reference/jak1/levels/snow/snow-ball_REF.gc +++ b/test/decompiler/reference/jak1/levels/snow/snow-ball_REF.gc @@ -213,9 +213,7 @@ (let ((f0-6 (-> this path-faded-up-u))) (cond ((< (-> this path-u) f0-6) - (let* ((f0-7 (/ (-> this path-u) f0-6)) - (f0-8 (* f0-7 f0-7)) - ) + (let ((f0-8 (square (/ (-> this path-u) f0-6)))) (set-vector! (-> this draw color-mult) f0-8 f0-8 f0-8 1.0) ) ) diff --git a/test/decompiler/reference/jak1/levels/snow/snow-bumper_REF.gc b/test/decompiler/reference/jak1/levels/snow/snow-bumper_REF.gc index 71d549cbc8..974515841c 100644 --- a/test/decompiler/reference/jak1/levels/snow/snow-bumper_REF.gc +++ b/test/decompiler/reference/jak1/levels/snow/snow-bumper_REF.gc @@ -233,7 +233,6 @@ ) :trans rider-trans :code (behavior () - (local-vars (sv-16 symbol)) (logclear! (-> self mask) (process-mask actor-pause)) (sound-play "bumper-pwr-dwn") (ja-no-eval :group! snow-bumper-button-ja :num! (seek! max 0.05) :frame-num 0.0) @@ -254,11 +253,12 @@ (ja :num! (seek! max 0.02)) ) (process-entity-status! self (entity-perm-status complete) #t) - (set! sv-16 (the-as symbol #f)) - (apply-all (-> self link) actor-link-subtask-complete-hook (& sv-16)) - (when sv-16 - (save-reminder (get-task-control (game-task snow-bumpers)) (-> self bumper-id) 0) - (go snow-bumper-spawn-fuel-cell) + (let ((sv-16 (the-as symbol #f))) + (apply-all (-> self link) actor-link-subtask-complete-hook (& sv-16)) + (when sv-16 + (save-reminder (get-task-control (game-task snow-bumpers)) (-> self bumper-id) 0) + (go snow-bumper-spawn-fuel-cell) + ) ) (go snow-bumper-inactive-idle) ) @@ -323,7 +323,6 @@ ;; INFO: Used lq/sq ;; INFO: Return type mismatch object vs none. (defmethod init-from-entity! ((this snow-bumper) (arg0 entity-actor)) - (local-vars (sv-16 res-tag)) (set! (-> this last-shoved-player-time) 0) (let ((s4-0 (new 'process 'collide-shape-moving this (collide-list-enum hit-by-player)))) (set! (-> s4-0 dynam) (copy *standard-dynamics* 'process)) @@ -382,8 +381,9 @@ (transform-post) (set! (-> this base-shove-ry) 0.0) (set! (-> this max-shove-diff-ry) 32768.0) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-52 (res-lump-data (-> this entity) 'rotmin (pointer float) :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-52 (res-lump-data (-> this entity) 'rotmin (pointer float) :tag-ptr (& sv-16))) + ) (when v1-52 (set! (-> this base-shove-ry) (-> v1-52 0)) (set! (-> this max-shove-diff-ry) (-> v1-52 1)) diff --git a/test/decompiler/reference/jak1/levels/snow/snow-bunny_REF.gc b/test/decompiler/reference/jak1/levels/snow/snow-bunny_REF.gc index fbea0e8d42..4a7880162f 100644 --- a/test/decompiler/reference/jak1/levels/snow/snow-bunny_REF.gc +++ b/test/decompiler/reference/jak1/levels/snow/snow-bunny_REF.gc @@ -545,7 +545,6 @@ ;; definition for method 54 of type snow-bunny ;; INFO: Used lq/sq (defmethod nav-enemy-method-54 ((this snow-bunny)) - (local-vars (sv-48 (function float float))) (set! (-> this using-jump-event?) #f) (let* ((s5-1 (vector-! (new 'stack-no-clear 'vector) (-> this final-dest) (-> this collide-info trans))) (f30-0 (vector-length s5-1)) @@ -569,16 +568,7 @@ (vector-rotate-around-y! s5-1 s5-1 16384.0) (vector-normalize! s5-1 (- f30-0 f28-0)) (let ((s4-0 (new 'stack-no-clear 'vector))) - (let ((s3-0 vector+*!) - (s2-0 s4-0) - (s1-0 (-> this final-dest)) - (s0-0 s5-1) - ) - (set! sv-48 sin) - (let ((a0-9 (rand-vu-float-range -16384.0 16384.0))) - (s3-0 s2-0 s1-0 s0-0 (sv-48 a0-9)) - ) - ) + (vector+*! s4-0 (-> this final-dest) s5-1 (sin (rand-vu-float-range -16384.0 16384.0))) (vector-! s5-1 s4-0 (-> this collide-info trans)) (when (< f28-0 (vector-length s5-1)) (vector-normalize! s5-1 f28-0) @@ -734,7 +724,6 @@ ;; definition for method 52 of type snow-bunny ;; INFO: Used lq/sq (defmethod nav-enemy-method-52 ((this snow-bunny)) - (local-vars (sv-48 (function float float))) (set! (-> this using-jump-event?) #f) (if (not *target*) (return #f) @@ -757,15 +746,7 @@ (vector-rotate-around-y! s5-2 s5-2 16384.0) (vector-normalize! s5-2 (- f28-0 f30-0)) (let ((s3-0 (new 'stack-no-clear 'vector))) - (let ((s2-0 vector+*!) - (s1-0 s3-0) - (s0-0 s5-2) - ) - (set! sv-48 sin) - (let ((a0-11 (rand-vu-float-range -16384.0 16384.0))) - (s2-0 s1-0 s4-0 s0-0 (sv-48 a0-11)) - ) - ) + (vector+*! s3-0 s4-0 s5-2 (sin (rand-vu-float-range -16384.0 16384.0))) (vector-! s5-2 s3-0 (-> this collide-info trans)) (when (< f30-0 (vector-length s5-2)) (vector-normalize! s5-2 f30-0) diff --git a/test/decompiler/reference/jak1/levels/snow/snow-flutflut-obs_REF.gc b/test/decompiler/reference/jak1/levels/snow/snow-flutflut-obs_REF.gc index 9044fd4731..5764d43d76 100644 --- a/test/decompiler/reference/jak1/levels/snow/snow-flutflut-obs_REF.gc +++ b/test/decompiler/reference/jak1/levels/snow/snow-flutflut-obs_REF.gc @@ -616,8 +616,7 @@ :trans (behavior () (plat-trans) (let* ((f0-1 (fmin 1.0 (/ (the float (- (current-time) (-> self state-time))) (the float (-> self rise-time))))) - (f0-2 (- 1.0 f0-1)) - (f0-3 (* f0-2 f0-2)) + (f0-3 (square (- 1.0 f0-1))) (f30-0 (- 1.0 f0-3)) ) (vector-lerp! (-> self basetrans) (-> self appear-trans-bottom) (-> self appear-trans-top) f30-0) @@ -758,9 +757,10 @@ ) :trans (behavior () (plat-trans) - (let* ((f0-1 (fmin 1.0 (/ (the float (- (current-time) (-> self state-time))) (the float (-> self fall-time))))) - (f30-0 (* f0-1 f0-1)) - ) + (let ((f30-0 + (square (fmin 1.0 (/ (the float (- (current-time) (-> self state-time))) (the float (-> self fall-time))))) + ) + ) (vector-lerp! (-> self basetrans) (-> self start-trans) (-> self appear-trans-bottom) f30-0) (quaternion-slerp! (-> self root quat) (-> self appear-quat-top) (-> self appear-quat-bottom) f30-0) (let ((f0-3 (- 1.0 f30-0))) diff --git a/test/decompiler/reference/jak1/levels/snow/snow-obs_REF.gc b/test/decompiler/reference/jak1/levels/snow/snow-obs_REF.gc index a7c64a3ef1..0411831ef1 100644 --- a/test/decompiler/reference/jak1/levels/snow/snow-obs_REF.gc +++ b/test/decompiler/reference/jak1/levels/snow/snow-obs_REF.gc @@ -574,13 +574,13 @@ ;; INFO: Used lq/sq ;; INFO: Return type mismatch object vs none. (defmethod init-from-entity! ((this snowpusher) (arg0 entity-actor)) - (local-vars (sv-16 res-tag)) (logior! (-> this mask) (process-mask enemy platform)) (let ((s3-0 0) (s4-0 0) ) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-3 (res-lump-data (-> this entity) 'mode (pointer int32) :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-3 (res-lump-data (-> this entity) 'mode (pointer int32) :tag-ptr (& sv-16))) + ) (when v1-3 (set! s3-0 (-> v1-3 0)) (set! s4-0 (-> v1-3 1)) diff --git a/test/decompiler/reference/jak1/levels/snow/snow-ram_REF.gc b/test/decompiler/reference/jak1/levels/snow/snow-ram_REF.gc index b00f938486..e977f977d7 100644 --- a/test/decompiler/reference/jak1/levels/snow/snow-ram_REF.gc +++ b/test/decompiler/reference/jak1/levels/snow/snow-ram_REF.gc @@ -211,7 +211,6 @@ ) ) :code (behavior () - (local-vars (sv-16 symbol)) (ja-channel-push! 1 (seconds 0.075)) (loop (sound-play "set-ram") @@ -239,15 +238,16 @@ ) ) (logior! (-> self mask) (process-mask actor-pause)) - (set! sv-16 (the-as symbol #f)) - (apply-function-forward (-> self link) actor-link-dead-hook (& sv-16)) - (when (or sv-16 (nonzero? (-> self root riders num-riders))) - (let ((v1-67 (-> self entity extra perm))) - (logior! (-> v1-67 status) (entity-perm-status user-set-from-cstage)) - (set! (-> v1-67 user-int8 0) 1) + (let ((sv-16 (the-as symbol #f))) + (apply-function-forward (-> self link) actor-link-dead-hook (& sv-16)) + (when (or sv-16 (nonzero? (-> self root riders num-riders))) + (let ((v1-67 (-> self entity extra perm))) + (logior! (-> v1-67 status) (entity-perm-status user-set-from-cstage)) + (set! (-> v1-67 user-int8 0) 1) + ) + (send-event (ppointer->process (-> self child)) 'jump) + (go ram-fun-idle) ) - (send-event (ppointer->process (-> self child)) 'jump) - (go ram-fun-idle) ) ) ) diff --git a/test/decompiler/reference/jak1/levels/sunken/puffer_REF.gc b/test/decompiler/reference/jak1/levels/sunken/puffer_REF.gc index 144450449d..ce8407c404 100644 --- a/test/decompiler/reference/jak1/levels/sunken/puffer_REF.gc +++ b/test/decompiler/reference/jak1/levels/sunken/puffer_REF.gc @@ -1117,7 +1117,6 @@ ;; INFO: Used lq/sq ;; INFO: Return type mismatch object vs none. (defmethod init-from-entity! ((this puffer) (arg0 entity-actor)) - (local-vars (sv-16 res-tag)) (set! (-> this cprims-type) (the-as uint 0)) (set! (-> this attacking?) #f) (set! (-> this buddy) #f) @@ -1170,8 +1169,9 @@ (let ((f28-0 8192.0) (f30-0 -8192.0) ) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-54 (res-lump-data arg0 'distance (pointer float) :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-54 (res-lump-data arg0 'distance (pointer float) :tag-ptr (& sv-16))) + ) (when v1-54 (set! f28-0 (-> v1-54 0)) (set! f30-0 (-> v1-54 1)) diff --git a/test/decompiler/reference/jak1/levels/sunken/shover_REF.gc b/test/decompiler/reference/jak1/levels/sunken/shover_REF.gc index 3f3b359bc2..13bdaf3ab2 100644 --- a/test/decompiler/reference/jak1/levels/sunken/shover_REF.gc +++ b/test/decompiler/reference/jak1/levels/sunken/shover_REF.gc @@ -77,7 +77,6 @@ ;; INFO: Used lq/sq ;; INFO: Return type mismatch object vs none. (defmethod init-from-entity! ((this shover) (arg0 entity-actor)) - (local-vars (sv-16 res-tag)) (set! (-> this shove-up) (res-lump-float arg0 'shove :default 12288.0)) (let ((s3-0 (res-lump-value arg0 'collision-mesh-id uint128)) (s4-0 (new 'process 'collide-shape this (collide-list-enum hit-by-player))) @@ -104,8 +103,9 @@ (go process-drawable-art-error "no path") ) ) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-23 (res-lump-data arg0 'trans-offset (pointer float) :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-23 (res-lump-data arg0 'trans-offset (pointer float) :tag-ptr (& sv-16))) + ) (when v1-23 (+! (-> this root trans x) (-> v1-23 0)) (+! (-> this root trans y) (-> v1-23 1)) diff --git a/test/decompiler/reference/jak1/levels/sunken/square-platform_REF.gc b/test/decompiler/reference/jak1/levels/sunken/square-platform_REF.gc index 273d553bfd..a0606d9854 100644 --- a/test/decompiler/reference/jak1/levels/sunken/square-platform_REF.gc +++ b/test/decompiler/reference/jak1/levels/sunken/square-platform_REF.gc @@ -209,7 +209,7 @@ ;; INFO: Used lq/sq ;; INFO: Return type mismatch object vs none. (defmethod square-platform-method-27 ((this square-platform) (arg0 symbol)) - (local-vars (v0-3 sound-id) (sv-48 int)) + (local-vars (v0-3 sound-id)) (let ((s4-0 (new 'stack-no-clear 'vector))) (set! (-> s4-0 quad) (-> this root trans quad)) (+! (-> s4-0 y) -20480.0) @@ -245,19 +245,7 @@ (else (when (>= f0-2 (-> s4-0 y)) (set-time! (-> this start-splash-time)) - (let ((s2-0 sound-play-by-name) - (s1-0 (make-u128 #x6873616c (the-as uint #x70732d656772616c))) - (s0-0 (new-sound-id)) - ) - (set! sv-48 1024) - (let ((a3-0 (the int (* 1524.0 (rand-vu-float-range -0.8 0.8)))) - (t0-0 0) - (t1-0 1) - (t2-0 #t) - ) - (s2-0 (the-as sound-name s1-0) s0-0 sv-48 a3-0 t0-0 (the-as sound-group t1-0) t2-0) - ) - ) + (sound-play "large-splash" :pitch (rand-vu-float-range -0.8 0.8)) ) ) ) @@ -451,7 +439,6 @@ ;; INFO: Used lq/sq ;; INFO: Return type mismatch object vs none. (defmethod init-from-entity! ((this square-platform) (arg0 entity-actor)) - (local-vars (sv-16 res-tag) (sv-32 res-tag)) (set! (-> this pos-u) 0.0) (let ((s4-0 (new 'process 'collide-shape-moving this (collide-list-enum hit-by-player)))) (set! (-> s4-0 dynam) (copy *standard-dynamics* 'process)) @@ -487,27 +474,25 @@ ) (set! (-> s4-1 frame-num) 0.0) ) - (set! sv-16 (new 'static 'res-tag)) - (let* ((v1-32 (res-lump-data (-> this entity) 'distance pointer :tag-ptr (& sv-16))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-32 (res-lump-data (-> this entity) 'distance pointer :tag-ptr (& sv-16))) (f30-0 (if (and v1-32 (> (the-as int (-> sv-16 elt-count)) 0)) (-> (the-as (pointer float) v1-32)) -8192.0 ) ) + (sv-32 (new 'static 'res-tag)) + (v1-35 (res-lump-data (-> this entity) 'distance pointer :tag-ptr (& sv-32))) + (f0-10 (if (and v1-35 (< 1 (the-as int (-> sv-32 elt-count)))) + (-> (the-as (pointer float) v1-35) 1) + 16384.0 + ) + ) ) - (set! sv-32 (new 'static 'res-tag)) - (let* ((v1-35 (res-lump-data (-> this entity) 'distance pointer :tag-ptr (& sv-32))) - (f0-10 (if (and v1-35 (< 1 (the-as int (-> sv-32 elt-count)))) - (-> (the-as (pointer float) v1-35) 1) - 16384.0 - ) - ) - ) - (set! (-> this down-pos quad) (-> this root trans quad)) - (+! (-> this down-pos y) f30-0) - (set! (-> this up-pos quad) (-> this root trans quad)) - (+! (-> this up-pos y) f0-10) - ) + (set! (-> this down-pos quad) (-> this root trans quad)) + (+! (-> this down-pos y) f30-0) + (set! (-> this up-pos quad) (-> this root trans quad)) + (+! (-> this up-pos y) f0-10) ) (set! (-> this basetrans quad) (-> this down-pos quad)) (set! (-> this root trans quad) (-> this basetrans quad)) diff --git a/test/decompiler/reference/jak1/levels/sunken/steam-cap_REF.gc b/test/decompiler/reference/jak1/levels/sunken/steam-cap_REF.gc index 5ebb6b1aef..426d648770 100644 --- a/test/decompiler/reference/jak1/levels/sunken/steam-cap_REF.gc +++ b/test/decompiler/reference/jak1/levels/sunken/steam-cap_REF.gc @@ -709,7 +709,6 @@ ;; INFO: Used lq/sq ;; INFO: Return type mismatch object vs none. (defmethod init-from-entity! ((this steam-cap) (arg0 entity-actor)) - (local-vars (sv-16 res-tag)) (logior! (-> this mask) (process-mask platform)) (let ((s4-0 (new 'process 'collide-shape-moving this (collide-list-enum hit-by-player)))) (set! (-> s4-0 dynam) (copy *standard-dynamics* 'process)) @@ -751,8 +750,9 @@ (let ((f30-0 0.4) (f28-0 0.9) ) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-36 (res-lump-data arg0 'percent (pointer float) :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-36 (res-lump-data arg0 'percent (pointer float) :tag-ptr (& sv-16))) + ) (when v1-36 (set! f30-0 (-> v1-36 0)) (set! f28-0 (-> v1-36 1)) diff --git a/test/decompiler/reference/jak1/levels/sunken/sun-iris-door_REF.gc b/test/decompiler/reference/jak1/levels/sunken/sun-iris-door_REF.gc index 9013fa0d63..7b589542b1 100644 --- a/test/decompiler/reference/jak1/levels/sunken/sun-iris-door_REF.gc +++ b/test/decompiler/reference/jak1/levels/sunken/sun-iris-door_REF.gc @@ -314,7 +314,6 @@ ;; INFO: Used lq/sq ;; INFO: Return type mismatch object vs none. (defmethod init-from-entity! ((this sun-iris-door) (arg0 entity-actor)) - (local-vars (sv-16 res-tag)) (set! (-> this move-to?) #f) (let ((s4-0 (new 'process 'collide-shape this (collide-list-enum hit-by-others)))) (let ((s3-0 (new 'process 'collide-shape-prim-mesh s4-0 (the-as uint 0) (the-as uint 0)))) @@ -350,8 +349,9 @@ (set! (-> v1-25 local-sphere w) (* 24576.0 f0-11 f0-11)) ) ) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-28 (res-lump-data (-> this entity) 'trans-offset (pointer float) :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-28 (res-lump-data (-> this entity) 'trans-offset (pointer float) :tag-ptr (& sv-16))) + ) (when v1-28 (+! (-> this root trans x) (-> v1-28 0)) (+! (-> this root trans y) (-> v1-28 1)) diff --git a/test/decompiler/reference/jak1/levels/sunken/sunken-fish_REF.gc b/test/decompiler/reference/jak1/levels/sunken/sunken-fish_REF.gc index 006bc6c6f1..79d9b7c21b 100644 --- a/test/decompiler/reference/jak1/levels/sunken/sunken-fish_REF.gc +++ b/test/decompiler/reference/jak1/levels/sunken/sunken-fish_REF.gc @@ -265,7 +265,6 @@ ;; definition for method 27 of type sunkenfisha ;; INFO: Used lq/sq (defmethod sunkenfisha-method-27 ((this sunkenfisha)) - (local-vars (sv-16 res-tag) (sv-32 res-tag) (sv-48 res-tag)) (vector-reset! (-> this path-trans-offset)) (set! (-> this path-u) (rand-vu-float-range 0.0 1.0)) (if (zero? (rand-vu-int-count 2)) @@ -273,8 +272,9 @@ (set! (-> this path-dir) -1.0) ) (set-vector! (-> this max-local-path-offset) 16384.0 28672.0 0.0 1.0) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-5 (res-lump-data (-> this entity) 'path-max-offset (pointer float) :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-5 (res-lump-data (-> this entity) 'path-max-offset (pointer float) :tag-ptr (& sv-16))) + ) (when v1-5 (set! (-> this max-local-path-offset x) (-> v1-5 0)) (set! (-> this max-local-path-offset y) (-> v1-5 1)) @@ -299,8 +299,9 @@ (set! (-> this change-path-dir-time) (+ (current-time) (rand-vu-int-range (seconds 5) (seconds 18)))) (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)) - (set! sv-32 (new 'static 'res-tag)) - (let ((v1-16 (res-lump-data (-> this entity) 'path-trans-offset (pointer float) :tag-ptr (& sv-32)))) + (let* ((sv-32 (new 'static 'res-tag)) + (v1-16 (res-lump-data (-> this entity) 'path-trans-offset (pointer float) :tag-ptr (& sv-32))) + ) (when v1-16 (+! (-> this path-trans-offset x) (-> v1-16 0)) (+! (-> this path-trans-offset y) (-> v1-16 1)) @@ -313,8 +314,9 @@ (let ((f28-0 8192.0) (f30-0 26624.0) ) - (set! sv-48 (new 'static 'res-tag)) - (let ((v1-23 (res-lump-data (-> this entity) 'speed (pointer float) :tag-ptr (& sv-48)))) + (let* ((sv-48 (new 'static 'res-tag)) + (v1-23 (res-lump-data (-> this entity) 'speed (pointer float) :tag-ptr (& sv-48))) + ) (when v1-23 (set! f28-0 (-> v1-23 0)) (set! f30-0 (-> v1-23 1)) diff --git a/test/decompiler/reference/jak1/levels/sunken/whirlpool_REF.gc b/test/decompiler/reference/jak1/levels/sunken/whirlpool_REF.gc index b4a657f8b9..09b79401ee 100644 --- a/test/decompiler/reference/jak1/levels/sunken/whirlpool_REF.gc +++ b/test/decompiler/reference/jak1/levels/sunken/whirlpool_REF.gc @@ -298,8 +298,7 @@ (f28-0 (vector-vector-xz-distance (-> this root trans) gp-0)) ) (when (< f28-0 40960.0) - (let* ((f0-2 (* 0.000024414063 (- 40960.0 f28-0))) - (f26-0 (* f0-2 f0-2)) + (let* ((f26-0 (square (* 0.000024414063 (- 40960.0 f28-0)))) (f0-7 (atan (- (-> gp-0 x) (-> this root trans x)) (- (-> gp-0 z) (-> this root trans z)))) (f30-0 (* (/ f26-0 2) arg0 (seconds-per-frame))) (f24-0 (+ f0-7 f30-0)) @@ -367,7 +366,6 @@ ;; INFO: Used lq/sq ;; INFO: Return type mismatch object vs none. (defmethod init-from-entity! ((this whirlpool) (arg0 entity-actor)) - (local-vars (sv-16 res-tag)) (set! (-> this spin-ry) (rand-vu-float-range 0.0 65536.0)) (let ((s4-0 (new 'process 'collide-shape this (collide-list-enum hit-by-player)))) (let ((s3-0 (new 'process 'collide-shape-prim-sphere s4-0 (the-as uint 0)))) @@ -388,8 +386,9 @@ (let ((f30-0 32768.0) (f28-0 145635.56) ) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-17 (res-lump-data arg0 'speed (pointer float) :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-17 (res-lump-data arg0 'speed (pointer float) :tag-ptr (& sv-16))) + ) (when v1-17 (set! f30-0 (-> v1-17 0)) (set! f28-0 (-> v1-17 1)) diff --git a/test/decompiler/reference/jak1/levels/village1/fishermans-boat_REF.gc b/test/decompiler/reference/jak1/levels/village1/fishermans-boat_REF.gc index 00d02dd988..6e46374642 100644 --- a/test/decompiler/reference/jak1/levels/village1/fishermans-boat_REF.gc +++ b/test/decompiler/reference/jak1/levels/village1/fishermans-boat_REF.gc @@ -108,7 +108,6 @@ ;; definition for method 13 of type vehicle-path ;; INFO: Used lq/sq (defmethod debug-draw ((this vehicle-path)) - (local-vars (sv-64 int) (sv-80 (function _varargs_ object))) (let ((s5-0 (new 'stack-no-clear 'vector)) (s4-0 (new 'stack-no-clear 'vector)) (s3-0 (new 'stack-no-clear 'vector)) @@ -149,22 +148,10 @@ ) (let ((s1-0 add-debug-text-3d) (s0-0 #t) + (sv-64 68) ) - (set! sv-64 68) - (set! sv-80 format) - (let ((a0-9 (clear *temp-string*)) - (a1-6 "~D") - (a2-2 s2-0) - ) - (sv-80 a0-9 a1-6 a2-2) - ) - (let ((a2-3 *temp-string*) - (a3-2 s4-0) - (t0-2 4) - (t1-2 #f) - ) - (s1-0 s0-0 (the-as bucket-id sv-64) a2-3 a3-2 (the-as font-color t0-2) (the-as vector2h t1-2)) - ) + (format (clear *temp-string*) "~D" s2-0) + (s1-0 s0-0 (the-as bucket-id sv-64) *temp-string* s4-0 (font-color orange) (the-as vector2h #f)) ) ) ) @@ -380,13 +367,10 @@ (if (= (-> this left-circle) 1) (vector-float*! s3-0 s3-0 -1.0) ) - (let* ((f0-5 f30-0) - (f0-7 (* f0-5 f0-5)) - (f1-0 f28-0) - (f0-9 (sqrtf (- f0-7 (* f1-0 f1-0)))) + (let* ((f0-9 (sqrtf (- (square f30-0) (square f28-0)))) (f28-1 (/ (* f28-0 f0-9) f30-0)) ) - (let ((f0-12 (/ (* f0-9 f0-9) f30-0))) + (let ((f0-12 (/ (square f0-9) f30-0))) (set! (-> arg1 quad) (-> arg0 quad)) (vector+*! arg1 (-> this target-point) s5-0 f0-12) ) @@ -635,7 +619,6 @@ ;; INFO: Used lq/sq ;; INFO: Return type mismatch int vs none. (defmethod rigid-body-platform-method-23 ((this fishermans-boat) (arg0 float)) - (local-vars (sv-128 int) (sv-144 rigid-body-control-point) (sv-160 int) (sv-176 vector)) (let ((s4-0 (new 'stack-no-clear 'vector)) (s1-0 (new 'stack-no-clear 'vector)) (s5-0 (new 'stack-no-clear 'vector)) @@ -644,41 +627,45 @@ (s3-0 (-> this rbody matrix)) ) (set! (-> s2-0 quad) (-> s3-0 vector 2 quad)) - (set! sv-128 0) - (while (< sv-128 6) - (set! sv-144 (-> this control-point-array data sv-128)) - (vector-matrix*! s5-0 (-> sv-144 local-pos) s3-0) - (set! (-> sv-144 world-pos quad) (-> s5-0 quad)) - (rigid-body-method-17 (-> this rbody) s5-0 s1-0) - (set! (-> sv-144 velocity quad) (-> s1-0 quad)) - (set! (-> sv-144 world-pos w) (ocean-get-height s5-0)) - (let* ((f0-2 (- (-> sv-144 world-pos w) (-> s5-0 y))) - (f30-0 (fmin 1.0 (/ f0-2 (-> this info max-buoyancy-depth)))) - ) - (when (< 0.0 f0-2) - (vector-float*! s4-0 *y-vector* (* 20.0 f0-2 (-> this rbody mass))) - (rigid-body-method-13 (-> this rbody) s5-0 s4-0) - (vector-float*! s4-0 *y-vector* (* 1.6 f30-0 (fmax 0.0 (vector-dot s2-0 s1-0)))) - (rigid-body-method-13 (-> this rbody) s5-0 s4-0) - (vector-float*! s4-0 s1-0 (* -1.0 (-> this info drag-factor) f30-0)) - (rigid-body-method-13 (-> this rbody) s5-0 s4-0) - (vector-float*! s4-0 (-> s3-0 vector 0) (* -0.5 (vector-dot (-> s3-0 vector 0) s1-0))) - (rigid-body-method-13 (-> this rbody) s5-0 s4-0) + (let ((sv-128 0)) + (while (< sv-128 6) + (let ((sv-144 (-> this control-point-array data sv-128))) + (vector-matrix*! s5-0 (-> sv-144 local-pos) s3-0) + (set! (-> sv-144 world-pos quad) (-> s5-0 quad)) + (rigid-body-method-17 (-> this rbody) s5-0 s1-0) + (set! (-> sv-144 velocity quad) (-> s1-0 quad)) + (set! (-> sv-144 world-pos w) (ocean-get-height s5-0)) + (let* ((f0-2 (- (-> sv-144 world-pos w) (-> s5-0 y))) + (f30-0 (fmin 1.0 (/ f0-2 (-> this info max-buoyancy-depth)))) + ) + (when (< 0.0 f0-2) + (vector-float*! s4-0 *y-vector* (* 20.0 f0-2 (-> this rbody mass))) + (rigid-body-method-13 (-> this rbody) s5-0 s4-0) + (vector-float*! s4-0 *y-vector* (* 1.6 f30-0 (fmax 0.0 (vector-dot s2-0 s1-0)))) + (rigid-body-method-13 (-> this rbody) s5-0 s4-0) + (vector-float*! s4-0 s1-0 (* -1.0 (-> this info drag-factor) f30-0)) + (rigid-body-method-13 (-> this rbody) s5-0 s4-0) + (vector-float*! s4-0 (-> s3-0 vector 0) (* -0.5 (vector-dot (-> s3-0 vector 0) s1-0))) + (rigid-body-method-13 (-> this rbody) s5-0 s4-0) + ) + ) ) + 0 + (+! sv-128 1) ) - 0 - (set! sv-128 (+ sv-128 1)) ) - (set! sv-160 0) - (while (< sv-160 2) - (set! sv-176 (-> this stabilizer-array sv-160 local-pos)) - (vector-matrix*! s5-0 (the-as vector (&-> sv-176 x)) s3-0) - (vector-rotate*! s0-0 (&+ sv-176 16) s3-0) - (rigid-body-method-17 (-> this rbody) s5-0 s1-0) - (vector-float*! s4-0 s0-0 (* -1.0 (vector-dot s0-0 s1-0))) - (rigid-body-method-13 (-> this rbody) s5-0 s4-0) - 0 - (set! sv-160 (+ sv-160 1)) + (let ((sv-160 0)) + (while (< sv-160 2) + (let ((sv-176 (-> this stabilizer-array sv-160 local-pos))) + (vector-matrix*! s5-0 (the-as vector (&-> sv-176 x)) s3-0) + (vector-rotate*! s0-0 (&+ sv-176 16) s3-0) + ) + (rigid-body-method-17 (-> this rbody) s5-0 s1-0) + (vector-float*! s4-0 s0-0 (* -1.0 (vector-dot s0-0 s1-0))) + (rigid-body-method-13 (-> this rbody) s5-0 s4-0) + 0 + (+! sv-160 1) + ) ) (when (-> this anchored) (let ((s1-1 (new 'stack-no-clear 'vector))) diff --git a/test/decompiler/reference/jak1/levels/village1/yakow_REF.gc b/test/decompiler/reference/jak1/levels/village1/yakow_REF.gc index e2e353133c..64e84e72e6 100644 --- a/test/decompiler/reference/jak1/levels/village1/yakow_REF.gc +++ b/test/decompiler/reference/jak1/levels/village1/yakow_REF.gc @@ -217,7 +217,6 @@ yakow-default-event-handler ;; definition for function yakow-task-complete? (defbehavior yakow-task-complete? yakow ((arg0 symbol)) - (local-vars (sv-16 symbol) (sv-20 (pointer process-tree))) (let ((gp-0 (not (and (-> self entity) (logtest? (-> self entity extra perm status) (entity-perm-status complete)))) ) @@ -227,30 +226,32 @@ yakow-default-event-handler (process-entity-status! self (entity-perm-status complete) #f) ) (when (or (-> self link prev) (-> self link next)) - (set! sv-16 (the-as symbol #f)) - (set! sv-20 (-> self child)) - (apply-all (-> self link) actor-link-subtask-complete-hook (& sv-16)) - (cond - (sv-16 - (close-specific-task! (-> self entity extra perm task) (task-status need-hint)) - (close-specific-task! (-> self entity extra perm task) (task-status need-introduction)) - (close-specific-task! (-> self entity extra perm task) (task-status need-reminder)) - (if gp-0 - (yakow-cam) + (let ((sv-16 (the-as symbol #f))) + (let ((sv-20 (-> self child))) + ) + (apply-all (-> self link) actor-link-subtask-complete-hook (& sv-16)) + (cond + (sv-16 + (close-specific-task! (-> self entity extra perm task) (task-status need-hint)) + (close-specific-task! (-> self entity extra perm task) (task-status need-introduction)) + (close-specific-task! (-> self entity extra perm task) (task-status need-reminder)) + (if gp-0 + (yakow-cam) + ) + (level-hint-spawn + (text-id village1-yakow-resolution) + "sksp018a" + (the-as entity #f) + *entity-pool* + (game-task none) ) - (level-hint-spawn - (text-id village1-yakow-resolution) - "sksp018a" - (the-as entity #f) - *entity-pool* - (game-task none) + ) + (else + (open-specific-task! (-> self entity extra perm task) (task-status need-reminder)) ) ) - (else - (open-specific-task! (-> self entity extra perm task) (task-status need-reminder)) - ) + sv-16 ) - sv-16 ) ) ) diff --git a/test/decompiler/reference/jak1/levels/village2/swamp-blimp_REF.gc b/test/decompiler/reference/jak1/levels/village2/swamp-blimp_REF.gc index 33a3a90c7e..c97944cb2b 100644 --- a/test/decompiler/reference/jak1/levels/village2/swamp-blimp_REF.gc +++ b/test/decompiler/reference/jak1/levels/village2/swamp-blimp_REF.gc @@ -1110,11 +1110,7 @@ 0.0 ) (else - (let ((f0-2 1.0) - (f1-3 (- 1.0 arg0)) - ) - (- f0-2 (* f1-3 f1-3)) - ) + (- 1.0 (square (- 1.0 arg0))) ) ) ) diff --git a/test/decompiler/reference/jak1/levels/village_common/villagep-obs_REF.gc b/test/decompiler/reference/jak1/levels/village_common/villagep-obs_REF.gc index e327f5abff..6c2ad454ce 100644 --- a/test/decompiler/reference/jak1/levels/village_common/villagep-obs_REF.gc +++ b/test/decompiler/reference/jak1/levels/village_common/villagep-obs_REF.gc @@ -268,7 +268,6 @@ ) ) :code (behavior () - (local-vars (sv-112 int) (sv-128 int) (sv-144 int)) (let ((gp-0 (get-next-slot-up self (+ (-> self level-slot) -1)))) 0 (let ((s5-0 #f) @@ -326,18 +325,15 @@ (set! (-> a0-34 color) (font-color progress-blue)) ) 0 - (let ((s0-3 (get-next-slot-up self gp-0))) - (set! sv-112 (get-next-slot-down self gp-0)) - (set! sv-144 (get-next-slot-up self s0-3)) - (set! sv-128 (get-next-slot-down self sv-112)) + (let* ((s0-3 (get-next-slot-up self gp-0)) + (sv-112 (get-next-slot-down self gp-0)) + (sv-144 (get-next-slot-up self s0-3)) + (sv-128 (get-next-slot-down self sv-112)) + ) (cond (s4-0 - (let ((a2-6 (- 300 (+ s2-0 150))) - (t9-20 print-level-name) - (a1-16 s1-3) - (a3-4 #f) - ) - (t9-20 sv-112 a1-16 a2-6 (the-as int a3-4)) + (let ((a2-6 (- 300 (+ s2-0 150)))) + (print-level-name sv-112 s1-3 a2-6 (the-as int #f)) ) (let ((a2-7 (+ s2-0 150))) (cond @@ -345,12 +341,8 @@ (print-level-name s0-3 s1-3 a2-7 (the-as int #t)) ) (else - (let ((a2-8 (- 300 s2-0)) - (t9-22 print-level-name) - (a1-18 s1-3) - (a3-6 #f) - ) - (t9-22 sv-128 a1-18 a2-8 (the-as int a3-6)) + (let ((a2-8 (- 300 s2-0))) + (print-level-name sv-128 s1-3 a2-8 (the-as int #f)) ) ) ) @@ -363,12 +355,8 @@ (print-level-name sv-112 s1-3 a2-9 (the-as int #f)) ) (else - (let ((a2-10 (- 300 s2-0)) - (t9-24 print-level-name) - (a1-20 s1-3) - (a3-8 #t) - ) - (t9-24 sv-144 a1-20 a2-10 (the-as int a3-8)) + (let ((a2-10 (- 300 s2-0))) + (print-level-name sv-144 s1-3 a2-10 (the-as int #t)) ) ) ) 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)) diff --git a/test/decompiler/reference/jak3/decompiler-macros.gc b/test/decompiler/reference/jak3/decompiler-macros.gc index 7bc58e3cd4..a913e937f9 100644 --- a/test/decompiler/reference/jak3/decompiler-macros.gc +++ b/test/decompiler/reference/jak3/decompiler-macros.gc @@ -1758,5 +1758,9 @@ ) ) +(defmacro square (x) + `(* ,x ,x) + ) + (import "goal_src/jak3/engine/data/tpages.gc") (import "goal_src/jak3/engine/data/textures.gc") \ No newline at end of file diff --git a/test/decompiler/reference/jak3/engine/ai/enemy_REF.gc b/test/decompiler/reference/jak3/engine/ai/enemy_REF.gc index 33d13a3444..e95b190b59 100644 --- a/test/decompiler/reference/jak3/engine/ai/enemy_REF.gc +++ b/test/decompiler/reference/jak3/engine/ai/enemy_REF.gc @@ -1124,7 +1124,6 @@ ;; WARN: Return type mismatch int vs none. (defmethod setup-enemy! ((this enemy) (arg0 enemy-info)) "Initialize the enemy by setting all the enemy-specific fields." - (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!)) @@ -1185,8 +1184,9 @@ ) (reset-to-collide-spec (-> this focus) (the-as collide-spec cspec)) ) - (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))) + ) (cond ((and v1-47 (nonzero? (-> sv-16 elt-count))) (set! (-> this actor-group) v1-47) @@ -1705,7 +1705,7 @@ ;; INFO: Used lq/sq (defmethod event-handler ((this enemy) (proc process) (argc int) (msg symbol) (block event-message-block)) "Commmon handler for events." - (local-vars (s5-6 rgbaf) (sv-640 event-message-block) (sv-656 process) (sv-672 event-message-block)) + (local-vars (s5-6 rgbaf)) (cond ((= msg 'go-gun-dark-2-stretch) (go-gun-dark-2-stretch this) @@ -1766,23 +1766,14 @@ ) ) ((= msg 'attack-no-avoid) - (let* ((s2-0 (-> block param 1)) - (s3-4 this) - (s1-0 (method-of-object s3-4 handle-incoming-attack!)) - (s0-0 proc) - ) - (set! sv-640 block) - (let ((a3-3 (get-penetrate-using-from-attack-event (the-as process-drawable proc) block)) - (t1-0 (-> block param 0)) - ) - (s1-0 - s3-4 - (the-as process-drawable s0-0) - sv-640 - a3-3 - (the-as attack-info s2-0) - (the-as touching-shapes-entry t1-0) - ) + (let ((s2-0 (-> block param 1))) + (handle-incoming-attack! + this + (the-as process-drawable proc) + block + (get-penetrate-using-from-attack-event (the-as process-drawable proc) block) + (the-as attack-info s2-0) + (the-as touching-shapes-entry (-> block param 0)) ) ) (damage-enemy-from-attack! this proc block) @@ -1794,23 +1785,13 @@ ((and (logtest? (-> this enemy-flags) (enemy-flag vulnerable)) (not (logtest? (-> this focus-status) (focus-status grabbed))) ) - (let* ((s1-1 this) - (s0-1 (method-of-object s1-1 handle-incoming-attack!)) - ) - (set! sv-656 proc) - (set! sv-672 block) - (let ((a3-4 (get-penetrate-using-from-attack-event (the-as process-drawable proc) block)) - (t1-1 (-> block param 0)) - ) - (s0-1 - s1-1 - (the-as process-drawable sv-656) - sv-672 - a3-4 - (the-as attack-info s2-1) - (the-as touching-shapes-entry t1-1) - ) - ) + (handle-incoming-attack! + this + (the-as process-drawable proc) + block + (get-penetrate-using-from-attack-event (the-as process-drawable proc) block) + (the-as attack-info s2-1) + (the-as touching-shapes-entry (-> block param 0)) ) (send-event (ppointer->process (-> this parent)) 'child-hit) (let ((f0-1 0.0)) @@ -2765,13 +2746,8 @@ (format 0 "Intensity ~f (handle ~d)~%" f30-4 (process->handle this)) ) (else - (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) - ) - (set! f30-4 (* (- f0-26 (/ f1-3 (* f2-3 f2-3))) (rnd-float-range this 0.8 1.0))) + (let ((f1-2 (vector-vector-xz-distance-squared (target-pos 0) (-> this root trans)))) + (set! f30-4 (* (- 1.0 (/ (fmin f1-2 (square 61440.0)) (square 61440.0))) (rnd-float-range this 0.8 1.0))) ) ) ) @@ -2813,11 +2789,7 @@ ) (((knocked-type blue-shot)) (let* ((f1-5 (vector-vector-xz-distance-squared (target-pos 0) (-> this root trans))) - (f0-36 1.0) - (f2-6 122880.0) - (f1-6 (fmin f1-5 (* f2-6 f2-6))) - (f2-9 122880.0) - (f30-7 (* (- f0-36 (/ 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 @@ -2938,12 +2910,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/jak3/engine/anim/joint-exploder_REF.gc b/test/decompiler/reference/jak3/engine/anim/joint-exploder_REF.gc index 45b6162501..fdc2bd5b6b 100644 --- a/test/decompiler/reference/jak3/engine/anim/joint-exploder_REF.gc +++ b/test/decompiler/reference/jak3/engine/anim/joint-exploder_REF.gc @@ -406,15 +406,6 @@ For example, geyser rock dummies, or the jak 1 zoomer." ;; INFO: Used lq/sq ;; WARN: Return type mismatch object vs joint-exploder-list. (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 ((s4-0 (the-as object #f))) (let ((v1-0 1)) (until (= v1-0 (+ (-> this tuning max-probes) 1)) @@ -438,22 +429,23 @@ For example, geyser rock dummies, or the jak 1 zoomer." ) ) (set! (-> arg0 bbox-valid?) #f) - (let ((s2-0 (-> this joints))) - (set! sv-32 (-> arg0 head)) - (let ((s1-0 0) - (s0-0 0) - ) - (let ((v1-8 arg1)) - (cond - ((zero? v1-8) - (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-8 arg1)) + (cond + ((zero? v1-8) + (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 (the-as joint-exploder-list s4-0) sv-32) - (set! sv-32 sv-16) + (let ((sv-16 (remove-joint-from-list this arg0 sv-32))) + (add-joint-to-list this (the-as joint-exploder-list s4-0) sv-32) + (set! sv-32 sv-16) + ) (update-bbox-for-joint this (the-as joint-exploder-list s4-0) sv-48) (+! s0-0 1) ) @@ -466,15 +458,17 @@ For example, geyser rock dummies, or the jak 1 zoomer." ) ) ) - ((= v1-8 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-8 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 (the-as joint-exploder-list s4-0) sv-32) - (set! sv-32 sv-64) + (let ((sv-64 (remove-joint-from-list this arg0 sv-32))) + (add-joint-to-list this (the-as joint-exploder-list s4-0) sv-32) + (set! sv-32 sv-64) + ) (update-bbox-for-joint this (the-as joint-exploder-list s4-0) sv-80) (+! s0-0 1) ) @@ -487,15 +481,17 @@ For example, geyser rock dummies, or the jak 1 zoomer." ) ) ) - ((= v1-8 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-8 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 (the-as joint-exploder-list s4-0) sv-32) - (set! sv-32 sv-96) + (let ((sv-96 (remove-joint-from-list this arg0 sv-32))) + (add-joint-to-list this (the-as joint-exploder-list s4-0) sv-32) + (set! sv-32 sv-96) + ) (update-bbox-for-joint this (the-as joint-exploder-list s4-0) sv-112) (+! s0-0 1) ) @@ -508,19 +504,19 @@ For example, geyser rock dummies, or the jak 1 zoomer." ) ) ) - ) - ) - (cond - ((zero? s0-0) - (final-adjust this arg0 arg1) - ) - ((zero? s1-0) - (if (not (-> (the-as joint-exploder-list s4-0) probeless?)) - (final-adjust this (the-as joint-exploder-list s4-0) arg1) - ) ) ) ) + (cond + ((zero? s0-0) + (final-adjust this arg0 arg1) + ) + ((zero? s1-0) + (if (not (-> (the-as joint-exploder-list s4-0) probeless?)) + (final-adjust this (the-as joint-exploder-list s4-0) arg1) + ) + ) + ) ) (the-as joint-exploder-list s4-0) ) @@ -530,14 +526,13 @@ For example, geyser rock dummies, or the jak 1 zoomer." ;; 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?)) ) (vector-copy! (-> s1-0 min) (-> arg0 bbox min)) @@ -559,11 +554,13 @@ For example, geyser rock dummies, or the jak 1 zoomer." ) (set! s2-0 (cond (v1-8 - (set! sv-48 (remove-joint-from-list this arg0 s2-0)) - (set! sv-64 (-> this lists data)) - (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 data)) + ) + (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)) (vector-copy! (-> arg0 bbox max) (-> s1-0 max)) diff --git a/test/decompiler/reference/jak3/engine/anim/joint-mod_REF.gc b/test/decompiler/reference/jak3/engine/anim/joint-mod_REF.gc index b4a6f5d9ac..31bc5e5549 100644 --- a/test/decompiler/reference/jak3/engine/anim/joint-mod_REF.gc +++ b/test/decompiler/reference/jak3/engine/anim/joint-mod_REF.gc @@ -8,16 +8,6 @@ (defbehavior joint-mod-ik-callback process ((arg0 cspace) (arg1 transformq)) "Inverse kinematics joint mod callback. Despite the arm-related names, can be used on legs too." - (local-vars - (sv-352 vector) - (sv-356 vector) - (sv-360 vector) - (sv-364 vector) - (sv-368 quaternion) - (sv-372 quaternion) - (sv-768 matrix) - (sv-784 vector) - ) (rlet ((vf0 :class vf) (vf4 :class vf) (vf5 :class vf) @@ -57,161 +47,163 @@ ) (matrix-copy! (-> gp-0 shoulder-matrix-no-ik) s5-0) (matrix-copy! (-> gp-0 elbow-matrix-no-ik) s4-1) - (let ((s2-0 (new 'stack-no-clear 'vector))) - (set! sv-784 (new 'stack-no-clear 'vector)) - (let ((s0-0 (new 'stack-no-clear 'vector)) - (s1-0 (new 'stack-no-clear 'vector)) - (s3-1 (new 'stack-no-clear 'vector)) - ) - 0.0 - 0.0 - (vector-copy! s2-0 (-> s5-0 trans)) - (vector-copy! sv-784 (-> s4-1 trans)) - (vector+*! s0-0 sv-784 (-> s4-1 uvec) (-> gp-0 hand-dist)) - (if (-> gp-0 callback) - ((-> gp-0 callback) gp-0 s5-0 s4-1 s0-0) - ) - (vector-copy! s1-0 (-> gp-0 handle-pos)) - (let ((f30-0 (vector-vector-distance s2-0 sv-784)) - (f0-12 (vector-vector-distance sv-784 s0-0)) - ) - (set! sv-768 (new 'stack-no-clear 'matrix)) - (let ((v1-32 s1-0) - (a0-19 s2-0) - ) - (.lvf vf4 (&-> v1-32 quad)) - (.lvf vf5 (&-> a0-19 quad)) - ) - (.mov.vf.w vf6 vf0) - (.sub.vf.xyz vf6 vf4 vf5) - (.svf (&-> sv-768 rvec quad) vf6) - (vector-length (-> sv-768 rvec)) - (+ -4.096 f0-12 f30-0) - (let ((f0-15 (+ 4.096 (fabs (- f30-0 f0-12))))) - (cond - ((< f0-15 f0-15) - (vector-normalize! (-> sv-768 rvec) f0-15) - (let ((v1-39 s1-0)) - (let ((a0-21 s2-0)) - (.mov.vf.w vf6 vf0) - (.lvf vf4 (&-> a0-21 quad)) - ) - (.lvf vf5 (&-> sv-768 rvec quad)) - (.add.vf.xyz vf6 vf4 vf5) - (.svf (&-> v1-39 quad) vf6) - ) - ) - ((< f0-15 f0-15) - (vector-normalize! (-> sv-768 rvec) f0-15) - (vector+! s1-0 s2-0 (-> sv-768 rvec)) - ) - ) - ) + (let ((s2-0 (new 'stack-no-clear 'vector)) + (sv-784 (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)) ) - (set! sv-352 (vector-! (new 'stack-no-clear 'vector) sv-784 s2-0)) - (let ((v1-44 (new 'stack-no-clear 'vector))) - (.lvf vf4 (&-> s0-0 quad)) - (.lvf vf5 (&-> sv-784 quad)) - (.mov.vf.w vf6 vf0) - (.sub.vf.xyz vf6 vf4 vf5) - (.svf (&-> v1-44 quad) vf6) - (set! sv-356 v1-44) + 0.0 + 0.0 + (vector-copy! s2-0 (-> s5-0 trans)) + (vector-copy! sv-784 (-> s4-1 trans)) + (vector+*! s0-0 sv-784 (-> s4-1 uvec) (-> gp-0 hand-dist)) + (if (-> gp-0 callback) + ((-> gp-0 callback) gp-0 s5-0 s4-1 s0-0) ) - (set! sv-360 (vector-! (new 'stack-no-clear 'vector) s0-0 s2-0)) - (set! sv-364 (vector-! (new 'stack-no-clear 'vector) s1-0 s2-0)) - (set! sv-368 (new 'stack-no-clear 'quaternion)) - (set! sv-372 (new 'stack-no-clear 'quaternion)) - (let ((f26-0 (vector-length sv-352)) - (f24-0 (vector-length sv-356)) - (f30-1 (vector-length sv-364)) + (vector-copy! s1-0 (-> gp-0 handle-pos)) + (let ((f30-0 (vector-vector-distance s2-0 sv-784)) + (f0-12 (vector-vector-distance sv-784 s0-0)) + (sv-768 (new 'stack-no-clear 'matrix)) + ) + (let ((v1-32 s1-0) + (a0-19 s2-0) ) - (let* ((s2-1 (new 'stack-no-clear 'vector)) - (f28-0 (vector-vector-angle-safe sv-352 sv-356)) - (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)) + (.lvf vf4 (&-> v1-32 quad)) + (.lvf vf5 (&-> a0-19 quad)) + ) + (.mov.vf.w vf6 vf0) + (.sub.vf.xyz vf6 vf4 vf5) + (.svf (&-> sv-768 rvec quad) vf6) + (vector-length (-> sv-768 rvec)) + (+ -4.096 f0-12 f30-0) + (let ((f0-15 (+ 4.096 (fabs (- f30-0 f0-12))))) + (cond + ((< f0-15 f0-15) + (vector-normalize! (-> sv-768 rvec) f0-15) + (let ((v1-39 s1-0)) + (let ((a0-21 s2-0)) + (.mov.vf.w vf6 vf0) + (.lvf vf4 (&-> a0-21 quad)) ) - (cond - ((= f28-0 0.0) - (set! (-> s2-1 quad) (-> (&-> s4-1 quad (-> gp-0 elbow-rotation-axis)) 0)) - (when (logtest? (-> gp-0 flags) (joint-mod-ik-flags elbow-rot-neg)) - (vector-negate! s2-1 s2-1) - (set! f26-1 (- f26-1)) - ) - (set! (-> s3-1 quad) (-> (&-> s4-1 quad (-> gp-0 elbow-pole-vector-axis)) 0)) - (if (logtest? (-> gp-0 flags) (joint-mod-ik-flags elbow-trans-neg)) - (vector-negate! s3-1 s3-1) - ) + (.lvf vf5 (&-> sv-768 rvec quad)) + (.add.vf.xyz vf6 vf4 vf5) + (.svf (&-> v1-39 quad) vf6) ) - (else - (vector-cross! s2-1 sv-352 sv-356) - (vector-! - s3-1 - sv-352 - (vector-float*! - (new 'stack-no-clear 'vector) - sv-360 - (/ (vector-dot sv-360 sv-352) (vector-dot sv-360 sv-360)) - ) - ) - ) - ) - (vector-normalize! s3-1 1.0) - (vector-normalize! s2-1 1.0) - (quaternion-vector-angle! sv-368 s2-1 (- f26-1 f28-0)) - ) - (vector-orient-by-quat! sv-356 sv-356 sv-368) - (vector+! sv-360 sv-352 sv-356) - (quaternion-from-two-vectors! - sv-372 - (vector-normalize-copy! (new 'stack-no-clear 'vector) sv-360 1.0) - (vector-normalize-copy! (new 'stack-no-clear 'vector) sv-364 1.0) - ) - (vector-orient-by-quat! sv-352 sv-352 sv-372) - (let ((f0-25 (fabs (vector-dot - (vector-normalize-copy! (new 'stack-no-clear 'vector) sv-352 1.0) - (vector-normalize-copy! (new 'stack-no-clear 'vector) sv-364 1.0) - ) - ) - ) - ) - (if (< 0.98 f0-25) - (vector-orient-by-quat! sv-352 s3-1 sv-372) - ) - ) - (let ((s2-4 (new 'stack-no-clear 'vector)) - (s1-2 (new 'stack-no-clear 'quaternion)) - ) - (new 'stack-no-clear 'matrix) - (* f30-1 f30-1) - (let ((s0-2 (new 'stack-no-clear 'quaternion))) - (vector-flatten! s2-4 sv-352 sv-364) - (vector-flatten! (-> s1-2 vec) s3-1 sv-364) - (vector-normalize! s2-4 1.0) - (vector-normalize! (-> s1-2 vec) 1.0) - (quaternion-from-two-vectors! s0-2 s2-4 (-> s1-2 vec)) - (quaternion*! sv-372 s0-2 sv-372) - ) + ) + ((< f0-15 f0-15) + (vector-normalize! (-> sv-768 rvec) f0-15) + (vector+! s1-0 s2-0 (-> sv-768 rvec)) + ) ) ) ) - ) - (quaternion-pseudo-slerp! sv-368 *unity-quaternion* sv-368 (-> gp-0 blend)) - (quaternion-pseudo-slerp! sv-372 *unity-quaternion* sv-372 (-> gp-0 blend)) - (let ((a2-19 (quaternion->matrix (new 'stack-no-clear 'matrix) sv-368)) - (gp-1 (new 'stack-no-clear 'matrix)) + (let ((sv-352 (vector-! (new 'stack-no-clear 'vector) sv-784 s2-0)) + (v1-44 (new 'stack-no-clear 'vector)) + ) + (.lvf vf4 (&-> s0-0 quad)) + (.lvf vf5 (&-> sv-784 quad)) + (.mov.vf.w vf6 vf0) + (.sub.vf.xyz vf6 vf4 vf5) + (.svf (&-> v1-44 quad) vf6) + (let ((sv-356 v1-44) + (sv-360 (vector-! (new 'stack-no-clear 'vector) s0-0 s2-0)) + (sv-364 (vector-! (new 'stack-no-clear 'vector) s1-0 s2-0)) + (sv-368 (new 'stack-no-clear 'quaternion)) + (sv-372 (new 'stack-no-clear 'quaternion)) + ) + (let ((f26-0 (vector-length sv-352)) + (f24-0 (vector-length sv-356)) + (f30-1 (vector-length sv-364)) + ) + (let* ((s2-1 (new 'stack-no-clear 'vector)) + (f28-0 (vector-vector-angle-safe sv-352 sv-356)) + (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)) + ) + (cond + ((= f28-0 0.0) + (set! (-> s2-1 quad) (-> (&-> s4-1 quad (-> gp-0 elbow-rotation-axis)) 0)) + (when (logtest? (-> gp-0 flags) (joint-mod-ik-flags elbow-rot-neg)) + (vector-negate! s2-1 s2-1) + (set! f26-1 (- f26-1)) + ) + (set! (-> s3-1 quad) (-> (&-> s4-1 quad (-> gp-0 elbow-pole-vector-axis)) 0)) + (if (logtest? (-> gp-0 flags) (joint-mod-ik-flags elbow-trans-neg)) + (vector-negate! s3-1 s3-1) + ) + ) + (else + (vector-cross! s2-1 sv-352 sv-356) + (vector-! + s3-1 + sv-352 + (vector-float*! + (new 'stack-no-clear 'vector) + sv-360 + (/ (vector-dot sv-360 sv-352) (vector-dot sv-360 sv-360)) + ) + ) + ) + ) + (vector-normalize! s3-1 1.0) + (vector-normalize! s2-1 1.0) + (quaternion-vector-angle! sv-368 s2-1 (- f26-1 f28-0)) + ) + (vector-orient-by-quat! sv-356 sv-356 sv-368) + (vector+! sv-360 sv-352 sv-356) + (quaternion-from-two-vectors! + sv-372 + (vector-normalize-copy! (new 'stack-no-clear 'vector) sv-360 1.0) + (vector-normalize-copy! (new 'stack-no-clear 'vector) sv-364 1.0) + ) + (vector-orient-by-quat! sv-352 sv-352 sv-372) + (let ((f0-25 (fabs (vector-dot + (vector-normalize-copy! (new 'stack-no-clear 'vector) sv-352 1.0) + (vector-normalize-copy! (new 'stack-no-clear 'vector) sv-364 1.0) + ) + ) + ) + ) + (if (< 0.98 f0-25) + (vector-orient-by-quat! sv-352 s3-1 sv-372) + ) + ) + (let ((s2-4 (new 'stack-no-clear 'vector)) + (s1-2 (new 'stack-no-clear 'quaternion)) + ) + (new 'stack-no-clear 'matrix) + (square f30-1) + (let ((s0-2 (new 'stack-no-clear 'quaternion))) + (vector-flatten! s2-4 sv-352 sv-364) + (vector-flatten! (-> s1-2 vec) s3-1 sv-364) + (vector-normalize! s2-4 1.0) + (vector-normalize! (-> s1-2 vec) 1.0) + (quaternion-from-two-vectors! s0-2 s2-4 (-> s1-2 vec)) + (quaternion*! sv-372 s0-2 sv-372) + ) + ) + ) + (quaternion-pseudo-slerp! sv-368 *unity-quaternion* sv-368 (-> gp-0 blend)) + (quaternion-pseudo-slerp! sv-372 *unity-quaternion* sv-372 (-> gp-0 blend)) + (let ((a2-19 (quaternion->matrix (new 'stack-no-clear 'matrix) sv-368)) + (gp-1 (new 'stack-no-clear 'matrix)) + ) + (set! (-> gp-1 rvec quad) (-> s4-1 trans quad)) + (matrix*! s4-1 s4-1 a2-19) + (vector-copy! (-> s4-1 trans) (-> gp-1 rvec)) + ) + (let ((s3-2 (quaternion->matrix (new 'stack-no-clear 'matrix) sv-372)) + (a2-20 (matrix-4x4-inverse! (new 'stack-no-clear 'matrix) s5-0)) + (gp-2 (new 'stack-no-clear 'matrix)) + ) + (set! (-> gp-2 rvec quad) (-> s5-0 trans quad)) + (matrix*! s4-1 s4-1 a2-20) + (matrix*! s5-0 s5-0 s3-2) + (vector-copy! (-> s5-0 trans) (-> gp-2 rvec)) + ) ) - (set! (-> gp-1 rvec quad) (-> s4-1 trans quad)) - (matrix*! s4-1 s4-1 a2-19) - (vector-copy! (-> s4-1 trans) (-> gp-1 rvec)) - ) - (let ((s3-2 (quaternion->matrix (new 'stack-no-clear 'matrix) sv-372)) - (a2-20 (matrix-4x4-inverse! (new 'stack-no-clear 'matrix) s5-0)) - (gp-2 (new 'stack-no-clear 'matrix)) - ) - (set! (-> gp-2 rvec quad) (-> s5-0 trans quad)) - (matrix*! s4-1 s4-1 a2-20) - (matrix*! s5-0 s5-0 s3-2) - (vector-copy! (-> s5-0 trans) (-> gp-2 rvec)) + ) ) (matrix*! s4-1 s4-1 s5-0) ) @@ -265,149 +257,145 @@ ;; WARN: Return type mismatch int vs none. (defbehavior real-joint-mod-gun-look-at-handler process ((arg0 cspace) (arg1 transformq)) "Joint mod callback for pointing the gun (implementation)." - (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 uvec)) + (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 uvec)) - (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) ) @@ -717,100 +705,95 @@ ;; WARN: Return type mismatch int vs none. (defbehavior joint-mod-look-at-handler process ((arg0 cspace) (arg1 transformq)) "Callback for look-at joint mod." - (local-vars - (sv-144 matrix) - (sv-148 quaternion) - (sv-152 vector) - (sv-156 vector) - (sv-160 (pointer uint128)) - (sv-164 symbol) - ) (let ((gp-0 (the-as joint-mod (-> arg0 param1)))) (cspace<-parented-transformq-joint! arg0 arg1) - (let ((s3-0 (-> arg0 bone transform))) - (set! sv-144 (new 'stack-no-clear 'matrix)) - (set! sv-148 (new 'stack-no-clear 'quaternion)) - (set! sv-152 (new 'stack-no-clear 'vector)) - (set! sv-156 (new 'stack-no-clear 'vector)) - (set! sv-160 (&-> gp-0 process node-list data (-> gp-0 base-joint) bone transform quad (-> gp-0 base-nose))) - (set! sv-164 - (< (vector-dot (-> s3-0 rvec) (vector-cross! (new 'stack-no-clear 'vector) (-> s3-0 uvec) (-> s3-0 fvec))) - 0.0 - ) - ) - (vector-normalize-copy! (-> sv-144 rvec) (the-as vector (&-> s3-0 quad (-> gp-0 ear))) (if sv-164 - -1.0 - 1.0 - ) - ) - (vector-normalize-copy! (-> sv-144 uvec) (the-as vector (&-> s3-0 quad (-> gp-0 up))) 1.0) - (vector-normalize-copy! (-> sv-144 fvec) (the-as vector (&-> s3-0 quad (-> gp-0 nose))) 1.0) - ) - (vector-reset! (-> sv-144 trans)) - (matrix->quaternion sv-148 sv-144) - (vector-normalize! (vector-! sv-152 (-> gp-0 target) (-> arg0 bone transform trans)) 1.0) - (vector-inv-orient-by-quat! sv-156 sv-152 sv-148) - (let ((f30-0 (vector-y-angle sv-156)) - (f0-2 (if (= (-> gp-0 base-joint) (+ (-> arg0 joint number) 1)) - 0.0 - (deg-diff (vector-y-angle (-> sv-144 fvec)) (vector-y-angle (the-as vector sv-160))) - ) - ) + (let ((s3-0 (-> arg0 bone transform)) + (sv-144 (new 'stack-no-clear 'matrix)) + (sv-148 (new 'stack-no-clear 'quaternion)) + (sv-152 (new 'stack-no-clear 'vector)) + (sv-156 (new 'stack-no-clear 'vector)) ) - (if (< (-> gp-0 ignore-angle) (fabs f30-0)) - (set! f30-0 0.0) - ) - (let ((f30-1 - (fmax - (fmin (* f30-0 (-> gp-0 blend) (-> gp-0 flex-blend)) (+ (-> gp-0 twist-max y) (* f0-2 (-> gp-0 flex-blend)))) - (+ (- (-> gp-0 twist-max y)) (* f0-2 (-> gp-0 flex-blend))) - ) - ) - ) - (when (and (-> gp-0 shutting-down?) (< (fabs (- (-> gp-0 twist y) f30-1)) 18.204445)) - (if (and (= (-> gp-0 scale x) 1.0) (= (-> gp-0 scale y) 1.0) (= (-> gp-0 scale z) 1.0)) - (mode-set! gp-0 (joint-mod-mode reset)) - (mode-set! gp-0 (joint-mod-mode rotate2)) - ) - ) - (set! (-> gp-0 twist y) - (deg-seek - (-> gp-0 twist y) - f30-1 - (* (fabs (deg-diff f30-1 (-> gp-0 twist y))) (-> gp-0 twist-speed-y) (-> self clock time-adjust-ratio)) - ) - ) - ) - ) - (let ((f0-21 (if sv-164 - (- (-> gp-0 twist y)) - (-> gp-0 twist y) - ) + (let ((sv-160 (&-> gp-0 process node-list data (-> gp-0 base-joint) bone transform quad (-> gp-0 base-nose))) + (sv-164 + (< (vector-dot (-> s3-0 rvec) (vector-cross! (new 'stack-no-clear 'vector) (-> s3-0 uvec) (-> s3-0 fvec))) + 0.0 ) - (a1-18 (new-stack-vector0)) + ) + ) + (vector-normalize-copy! (-> sv-144 rvec) (the-as vector (&-> s3-0 quad (-> gp-0 ear))) (if sv-164 + -1.0 + 1.0 + ) + ) + (vector-normalize-copy! (-> sv-144 uvec) (the-as vector (&-> s3-0 quad (-> gp-0 up))) 1.0) + (vector-normalize-copy! (-> sv-144 fvec) (the-as vector (&-> s3-0 quad (-> gp-0 nose))) 1.0) + (vector-reset! (-> sv-144 trans)) + (matrix->quaternion sv-148 sv-144) + (vector-normalize! (vector-! sv-152 (-> gp-0 target) (-> arg0 bone transform trans)) 1.0) + (vector-inv-orient-by-quat! sv-156 sv-152 sv-148) + (let ((f30-0 (vector-y-angle sv-156)) + (f0-2 (if (= (-> gp-0 base-joint) (+ (-> arg0 joint number) 1)) + 0.0 + (deg-diff (vector-y-angle (-> sv-144 fvec)) (vector-y-angle (the-as vector sv-160))) + ) + ) + ) + (if (< (-> gp-0 ignore-angle) (fabs f30-0)) + (set! f30-0 0.0) + ) + (let ((f30-1 + (fmax + (fmin (* f30-0 (-> gp-0 blend) (-> gp-0 flex-blend)) (+ (-> gp-0 twist-max y) (* f0-2 (-> gp-0 flex-blend)))) + (+ (- (-> gp-0 twist-max y)) (* f0-2 (-> gp-0 flex-blend))) + ) + ) + ) + (when (and (-> gp-0 shutting-down?) (< (fabs (- (-> gp-0 twist y) f30-1)) 18.204445)) + (if (and (= (-> gp-0 scale x) 1.0) (= (-> gp-0 scale y) 1.0) (= (-> gp-0 scale z) 1.0)) + (mode-set! gp-0 (joint-mod-mode reset)) + (mode-set! gp-0 (joint-mod-mode rotate2)) + ) + ) + (set! (-> gp-0 twist y) + (deg-seek + (-> gp-0 twist y) + f30-1 + (* (fabs (deg-diff f30-1 (-> gp-0 twist y))) (-> gp-0 twist-speed-y) (-> self clock time-adjust-ratio)) + ) + ) + ) + ) + (let ((f0-21 (if sv-164 + (- (-> gp-0 twist y)) + (-> gp-0 twist y) + ) + ) + (a1-18 (new-stack-vector0)) + ) + (set! (-> a1-18 data (-> gp-0 up)) 1.0) + (let ((a2-7 (quaternion-vector-angle! (new-stack-quaternion0) a1-18 f0-21))) + (quaternion-normalize! (quaternion*! (-> arg1 quat) (-> arg1 quat) a2-7)) + ) ) - (set! (-> a1-18 data (-> gp-0 up)) 1.0) - (let ((a2-7 (quaternion-vector-angle! (new-stack-quaternion0) a1-18 f0-21))) - (quaternion-normalize! (quaternion*! (-> arg1 quat) (-> arg1 quat) a2-7)) ) - ) - (let ((f0-27 - (fmax - (fmin (* (- (vector-x-angle sv-156)) (-> gp-0 blend) (-> gp-0 flex-blend)) (-> gp-0 twist-max x)) - (- (-> gp-0 twist-max x)) + (let ((f0-27 + (fmax + (fmin (* (- (vector-x-angle sv-156)) (-> gp-0 blend) (-> gp-0 flex-blend)) (-> gp-0 twist-max x)) + (- (-> gp-0 twist-max x)) + ) ) ) - ) - (if (< (vector-dot sv-156 *z-vector*) 0.1) - (set! f0-27 0.0) - ) - (set! (-> gp-0 twist x) - (deg-seek - (-> gp-0 twist x) - f0-27 - (* (fabs (deg-diff f0-27 (-> gp-0 twist x))) (-> gp-0 twist-speed-x) (-> self clock time-adjust-ratio)) - ) + (if (< (vector-dot sv-156 *z-vector*) 0.1) + (set! f0-27 0.0) ) + (set! (-> gp-0 twist x) + (deg-seek + (-> gp-0 twist x) + f0-27 + (* (fabs (deg-diff f0-27 (-> gp-0 twist x))) (-> gp-0 twist-speed-x) (-> self clock time-adjust-ratio)) + ) + ) + ) ) (let ((a1-22 (new-stack-vector0))) (set! (-> a1-22 data (-> gp-0 ear)) 1.0) @@ -844,75 +827,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 uvec) - 1.0 - ) + (let ((sv-48 (vector-normalize-copy! + (new 'stack-no-clear 'vector) + (-> gp-0 process node-list data 0 bone transform uvec) + 1.0 + ) + ) + (sv-52 (vector-normalize! (the-as vector (&-> s5-0 quad (-> 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! (the-as vector (&-> s5-0 quad (-> 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) + (-> gp-0 process node-list data 0 bone transform rvec) + 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) - (-> gp-0 process node-list data 0 bone transform rvec) - 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 @@ -1372,13 +1356,9 @@ (matrix-transpose! s4-1 s4-1) (set-vector! (-> s4-1 trans) 0.0 0.0 0.0 1.0) (vector-matrix*! s2-0 s1-0 s4-1) - (let* ((t9-11 asin) - (f0-9 (-> s2-0 x)) - (f0-11 (* f0-9 f0-9)) - (f1-0 (-> s2-0 y)) - (f26-0 (t9-11 (sqrtf (+ f0-11 (* f1-0 f1-0))))) - (f28-0 (atan (-> s2-0 y) (-> s2-0 x))) - ) + (let ((f26-0 (asin (sqrtf (+ (square (-> s2-0 x)) (square (-> s2-0 y)))))) + (f28-0 (atan (-> s2-0 y) (-> s2-0 x))) + ) (if (< (-> s2-0 z) 0.0) (set! f26-0 (- 32768.0 f26-0)) ) @@ -1409,11 +1389,9 @@ ) ) ) - (let* ((f0-39 (sin f28-0)) - (f24-0 (* f0-39 f0-39)) - (f0-41 (cos f28-0)) - (f0-43 (* f0-41 f0-41)) - ) + (let ((f24-0 (square (sin f28-0))) + (f0-43 (square (cos f28-0))) + ) 32768.0 (let ((f0-45 (cond ((< 16384.0 f28-0) @@ -1438,13 +1416,7 @@ ) (let ((f26-1 (cos f26-0))) (set-vector! s2-0 (cos f28-0) (sin f28-0) 0.0 1.0) - (let ((t9-18 vector-normalize!) - (a0-24 s2-0) - (f0-53 1.0) - (f1-22 f26-1) - ) - (t9-18 a0-24 (sqrtf (- f0-53 (* f1-22 f1-22)))) - ) + (vector-normalize! s2-0 (sqrtf (- 1.0 (square f26-1)))) (set! (-> s2-0 z) f26-1) ) ) diff --git a/test/decompiler/reference/jak3/engine/anim/joint_REF.gc b/test/decompiler/reference/jak3/engine/anim/joint_REF.gc index ecc32d95a3..42e38a8c8b 100644 --- a/test/decompiler/reference/jak3/engine/anim/joint_REF.gc +++ b/test/decompiler/reference/jak3/engine/anim/joint_REF.gc @@ -791,84 +791,76 @@ ) "Map animation from parent to child using the given animation mapping. This is used to animate daxter based on the animation of jak." - (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/jak3/engine/camera/cam-combiner_REF.gc b/test/decompiler/reference/jak3/engine/camera/cam-combiner_REF.gc index c061df3445..e00de6e2e3 100644 --- a/test/decompiler/reference/jak3/engine/camera/cam-combiner_REF.gc +++ b/test/decompiler/reference/jak3/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/jak3/engine/camera/cam-layout_REF.gc b/test/decompiler/reference/jak3/engine/camera/cam-layout_REF.gc index 0d72e86e47..830ad885ba 100644 --- a/test/decompiler/reference/jak3/engine/camera/cam-layout_REF.gc +++ b/test/decompiler/reference/jak3/engine/camera/cam-layout_REF.gc @@ -305,35 +305,21 @@ ;; INFO: Used lq/sq ;; 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 float) - (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) @@ -349,121 +335,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 (the-as float 0.0)) - (set! sv-168 0) - (set! sv-176 (new-stack-vector0)) - (vector-copy! sv-160 sv-240) - (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) - (vector-copy! sv-176 (-> s3-0 sv-288)) - (set! sv-164 (the-as float 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 sv-164)) - (set! sv-164 f0-8) - (set! sv-168 (+ sv-168 1)) - ) - ) - (else - (vector+float*! sv-160 sv-160 sv-208 f0-8) - (vector-copy! sv-176 (-> s3-0 sv-288)) - (set! sv-168 (+ sv-168 1)) - (if (< (fabs f0-8) (fabs sv-164)) - (set! sv-164 (- sv-164 f0-8)) - (set! sv-164 (the-as float 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 (the-as float 0.0)) + (sv-168 0) + ) + (let ((sv-176 (new-stack-vector0))) + (vector-copy! sv-160 sv-240) + (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) + (vector-copy! sv-176 (-> s3-0 sv-288)) + (set! sv-164 (the-as float 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 sv-164)) + (set! sv-164 f0-8) + (+! sv-168 1) + ) + ) + (else + (vector+float*! sv-160 sv-160 sv-208 f0-8) + (vector-copy! sv-176 (-> s3-0 sv-288)) + (+! sv-168 1) + (set! sv-164 (cond + ((< (fabs f0-8) (fabs sv-164)) + (set! sv-164 (- sv-164 f0-8)) + sv-164 + ) + (else + (the-as float 0.0) + ) + ) + ) + ) + ) + ) + ) + (+! sv-288 1) + ) + ) ) + (cond + ((zero? sv-168) + ) + ((= sv-164 0.0) + ) + (else + (dotimes (v1-87 (the-as int (-> sv-16 elt-count))) + (when (and (!= v1-87 s1-0) (!= v1-87 sv-272)) + (if (< 4096.0 (- (vector-dot sv-160 (-> s3-0 v1-87)) (-> s3-0 v1-87 w))) + (goto cfg-47) + ) + ) + ) + (vector+float*! sv-240 sv-160 sv-208 sv-164) + (cond + ((>= *volume-point-current* 999) + (format 0 "ERROR : camera editing out of volume points~%") + ) + (else + (vector-copy! (-> *volume-point* data *volume-point-current*) sv-160) + (vector-copy! (-> *volume-point* data (+ *volume-point-current* 1)) sv-240) + (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) - ) - ((= sv-164 0.0) - ) - (else - (dotimes (v1-87 (the-as int (-> sv-16 elt-count))) - (when (and (!= v1-87 s1-0) (!= v1-87 sv-272)) - (if (< 4096.0 (- (vector-dot sv-160 (-> s3-0 v1-87)) (-> s3-0 v1-87 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 + (vector-copy! (-> *volume-normal* data *volume-normal-current*) s0-0) + (vector-copy! (-> *volume-normal* data (+ *volume-normal-current* 1)) (-> s3-0 s1-0)) + (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 sv-164) - (cond - ((>= *volume-point-current* 999) - (format 0 "ERROR : camera editing out of volume points~%") - ) - (else - (vector-copy! (-> *volume-point* data *volume-point-current*) sv-160) - (vector-copy! (-> *volume-point* data (+ *volume-point-current* 1)) sv-240) - (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 - (vector-copy! (-> *volume-normal* data *volume-normal-current*) s0-0) - (vector-copy! (-> *volume-normal* data (+ *volume-normal-current* 1)) (-> s3-0 s1-0)) - (set! *volume-normal-current* (+ *volume-normal-current* 2)) - (set! (-> s2-0 normal-count) (+ (-> s2-0 normal-count) 2)) - ) - ) ) ) ) @@ -968,7 +970,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 structure) (sv-192 matrix)) + (local-vars (s2-0 structure) (s3-1 structure)) (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)) @@ -1026,35 +1028,35 @@ ) ) ) - (let ((s1-1 (new 'stack-no-clear 'matrix))) - (set! sv-192 (new 'stack-no-clear 'matrix)) - (let ((s0-1 (new 'stack-no-clear 'quaternion))) - (if (not s3-1) - (return #f) - ) - (clmf-input s5-0 s4-0 0) - (vector+float*! (the-as vector s3-1) (the-as vector 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 s0-1 sv-192) - (quaternion-inverse! (the-as quaternion s2-0) (the-as quaternion (-> self cam-entity connect))) - (quaternion*! (the-as quaternion s2-0) 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 'quaternion)) + ) + (if (not s3-1) + (return #f) + ) + (clmf-input s5-0 s4-0 0) + (vector+float*! (the-as vector s3-1) (the-as vector 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 s0-1 sv-192) + (quaternion-inverse! (the-as quaternion s2-0) (the-as quaternion (-> self cam-entity connect))) + (quaternion*! (the-as quaternion s2-0) s0-1 (the-as quaternion s2-0)) + (quaternion-normalize! (the-as quaternion s2-0)) ) ) ) @@ -2483,10 +2485,10 @@ ;; definition for function clmf-cam-string ;; INFO: Used lq/sq (defbehavior clmf-cam-string cam-layout ((arg0 string) (arg1 symbol)) - (local-vars (sv-16 res-tag)) (format arg0 ":") - (set! sv-16 (new 'static 'res-tag)) - (let ((s5-1 (res-lump-data (-> self cam-entity) arg1 pointer :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (s5-1 (res-lump-data (-> self cam-entity) arg1 pointer :tag-ptr (& sv-16))) + ) (when s5-1 (dotimes (s4-0 (the-as int (-> sv-16 elt-count))) (format arg0 " ~S" (-> (the-as (pointer uint32) (&+ s5-1 (* s4-0 4))))) diff --git a/test/decompiler/reference/jak3/engine/camera/cam-master_REF.gc b/test/decompiler/reference/jak3/engine/camera/cam-master_REF.gc index adebc0debb..c1fe396b78 100644 --- a/test/decompiler/reference/jak3/engine/camera/cam-master_REF.gc +++ b/test/decompiler/reference/jak3/engine/camera/cam-master_REF.gc @@ -364,16 +364,7 @@ ;; definition for function master-choose-entity ;; INFO: Used lq/sq (defbehavior master-choose-entity camera-master ((arg0 cam-setting-data)) - (local-vars - (r0-0 uint128) - (v1-44 uint128) - (sv-96 int) - (sv-112 process) - (sv-128 entity) - (sv-144 string) - (sv-160 string) - (sv-176 uint) - ) + (local-vars (r0-0 uint128) (v1-44 uint128)) (let ((s5-0 (entity-by-name (-> arg0 entity-name)))) (set! (-> arg0 real-entity-name) #f) (when s5-0 @@ -390,8 +381,9 @@ (format 0 "ERROR : camera entity '~S' didn't produce a state~%" (res-lump-struct s5-0 'name structure)) ) ) - (set! sv-96 0) - (let ((s4-1 (res-lump-data s5-0 'alternates pointer :tag-ptr (the-as (pointer res-tag) (& sv-96))))) + (let* ((sv-96 0) + (s4-1 (res-lump-data s5-0 'alternates pointer :tag-ptr (the-as (pointer res-tag) (& sv-96)))) + ) (when s4-1 (let ((s3-1 (process-spawn camera-slave @@ -415,69 +407,67 @@ ) (< s2-1 (shr (* (the-as int v1-44) 2) 49)) ) - (set! sv-128 (entity-by-name (the-as string (-> (the-as (pointer uint32) (&+ s4-1 (* s2-1 4))))))) - (cond - (sv-128 - (let ((s1-2 (cam-state-from-entity sv-128))) - (cond - (s1-2 - (set! sv-112 (get-process *camera-dead-pool* camera-slave #x4000 1)) - (let ((s0-0 (when sv-112 - (let ((t9-14 (method-of-type camera-slave activate))) - (t9-14 (the-as camera-slave sv-112) *camera* "camera-slave" (the-as pointer #x70004000)) - ) - (run-now-in-process sv-112 cam-slave-init s1-2 sv-128) - (-> sv-112 ppointer) - ) - ) - ) - (cond - (s0-0 - (setup-slave-for-hopefull (the-as camera-slave (ppointer->process s0-0))) - (cond - ((master-is-hopeful-better? - (the-as camera-slave (ppointer->process s3-1)) - (the-as camera-slave (ppointer->process s0-0)) - ) - (if s3-1 - (deactivate (-> s3-1 0)) - ) - (set! s3-1 (the-as (pointer camera-slave) s0-0)) - (set! (-> arg0 real-entity-name) (the-as string (-> (the-as (pointer uint32) (&+ s4-1 (* s2-1 4)))))) - (set! (-> arg0 cam-mode) (the-as symbol s1-2)) + (let ((sv-128 (entity-by-name (the-as string (-> (the-as (pointer uint32) (&+ s4-1 (* s2-1 4)))))))) + (cond + (sv-128 + (let ((s1-2 (cam-state-from-entity sv-128))) + (cond + (s1-2 + (let* ((sv-112 (get-process *camera-dead-pool* camera-slave #x4000 1)) + (s0-0 (when sv-112 + ((method-of-type camera-slave activate) + (the-as camera-slave sv-112) + *camera* + "camera-slave" + (the-as pointer #x70004000) + ) + (run-now-in-process sv-112 cam-slave-init s1-2 sv-128) + (-> sv-112 ppointer) + ) + ) ) - (else - (deactivate (-> s0-0 0)) + (cond + (s0-0 + (setup-slave-for-hopefull (the-as camera-slave (ppointer->process s0-0))) + (cond + ((master-is-hopeful-better? + (the-as camera-slave (ppointer->process s3-1)) + (the-as camera-slave (ppointer->process s0-0)) + ) + (if s3-1 + (deactivate (-> s3-1 0)) + ) + (set! s3-1 (the-as (pointer camera-slave) s0-0)) + (set! (-> arg0 real-entity-name) (the-as string (-> (the-as (pointer uint32) (&+ s4-1 (* s2-1 4)))))) + (set! (-> arg0 cam-mode) (the-as symbol s1-2)) + ) + (else + (deactivate (-> s0-0 0)) + ) ) ) - ) - (else - (format 0 "ERROR : alternate region activate failed~%") + (else + (format 0 "ERROR : alternate region activate failed~%") + ) ) ) ) - ) - (else - (let ((s1-5 format) - (s0-1 0) - ) - (set! sv-144 "ERROR : alternate camera region '~S' didn't produce a state~%") - (let ((a2-10 (res-lump-struct sv-128 'name structure))) - (s1-5 s0-1 sv-144 a2-10) + (else + (format + 0 + "ERROR : alternate camera region '~S' didn't produce a state~%" + (res-lump-struct sv-128 'name structure) ) ) ) ) ) - ) - (else - (let ((s1-7 format) - (s0-2 0) - ) - (set! sv-160 "ERROR : alternate '~S' not found for '~S'~%") - (set! sv-176 (-> (the-as (pointer uint32) (&+ s4-1 (* s2-1 4))))) - (let ((a3-10 (res-lump-struct s5-0 'name structure))) - (s1-7 s0-2 sv-160 sv-176 a3-10) + (else + (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/jak3/engine/camera/cam-states_REF.gc b/test/decompiler/reference/jak3/engine/camera/cam-states_REF.gc index c4d0dd8ae0..8e2392b81f 100644 --- a/test/decompiler/reference/jak3/engine/camera/cam-states_REF.gc +++ b/test/decompiler/reference/jak3/engine/camera/cam-states_REF.gc @@ -1655,86 +1655,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 'inline-array 'vector 4))) - (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 sv-208 z) 0.0) - ) - (else - (vector-! sv-160 sv-144 (-> arg0 0 vertex sv-208)) - (set! (-> s5-0 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 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 sv-208 x)) - ) - ) - (if (< f28-0 0.0) - (set! (-> s5-0 sv-208 y) (- (vector-length sv-192))) - (set! (-> s5-0 sv-208 y) (vector-length sv-192)) - ) - ) - (set! (-> s5-0 sv-208 x) (- sv-128 (-> s5-0 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) (-> s5-0 s4-1)) - ) - #f - ) - ((< (-> s5-0 3 y) 0.0) - (dotimes (s4-2 4) - (when (>= (-> s5-0 3 y) (-> s5-0 s4-2 y)) - (set! (-> s5-0 s4-2 y) (- (-> s5-0 s4-2 y))) - (dist-info-append (-> gp-0 ccw) (-> s5-0 s4-2)) - ) - ) - #f - ) - (else - (dotimes (s4-3 4) - (if (>= (-> s5-0 s4-3 y) (-> s5-0 3 y)) - (dist-info-append (-> gp-0 cw) (-> s5-0 s4-3)) - ) - ) - #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 'inline-array 'vector 4)) + (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 sv-208 z) 0.0) + ) + (else + (vector-! sv-160 sv-144 (-> arg0 0 vertex sv-208)) + (set! (-> s5-0 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 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 sv-208 x)) + ) + ) + (if (< f28-0 0.0) + (set! (-> s5-0 sv-208 y) (- (vector-length sv-192))) + (set! (-> s5-0 sv-208 y) (vector-length sv-192)) + ) + ) + (set! (-> s5-0 sv-208 x) (- sv-128 (-> s5-0 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) (-> s5-0 s4-1)) + ) + #f + ) + ((< (-> s5-0 3 y) 0.0) + (dotimes (s4-2 4) + (when (>= (-> s5-0 3 y) (-> s5-0 s4-2 y)) + (set! (-> s5-0 s4-2 y) (- (-> s5-0 s4-2 y))) + (dist-info-append (-> gp-0 ccw) (-> s5-0 s4-2)) + ) + ) + #f + ) + (else + (dotimes (s4-3 4) + (if (>= (-> s5-0 s4-3 y) (-> s5-0 3 y)) + (dist-info-append (-> gp-0 cw) (-> s5-0 s4-3)) + ) + ) + #f ) ) ) @@ -1950,151 +1947,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)) ) - (vector-copy! (-> s1-0 start-pos) arg0) - (vector-copy! (-> s1-0 move-dist) arg1) - (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) + (vector-copy! (-> s1-0 start-pos) arg0) + (vector-copy! (-> s1-0 move-dist) arg1) + (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)) ) ) ) @@ -2171,13 +2146,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/jak3/engine/camera/cam-update_REF.gc b/test/decompiler/reference/jak3/engine/camera/cam-update_REF.gc index b9ade87a75..3973e8d2ad 100644 --- a/test/decompiler/reference/jak3/engine/camera/cam-update_REF.gc +++ b/test/decompiler/reference/jak3/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))) @@ -64,22 +63,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-9 (-> arg3 trans quad))) - (set! (-> sv-240 quad) v1-9) - ) - (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)) + (vector-copy! sv-240 (-> arg3 trans)) + (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/jak3/engine/camera/camera_REF.gc b/test/decompiler/reference/jak3/engine/camera/camera_REF.gc index 54628238e9..61ac84d307 100644 --- a/test/decompiler/reference/jak3/engine/camera/camera_REF.gc +++ b/test/decompiler/reference/jak3/engine/camera/camera_REF.gc @@ -322,9 +322,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 @@ -342,19 +340,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))))) ) ) ) @@ -398,59 +387,57 @@ ;; 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)) (sv-48 (function _varargs_ object))) - (let* ((s2-0 cam-slave-get-flags) - (s0-0 arg1) - (v1-0 arg0) - (a1-1 - (cond - ((= v1-0 'focalpull) - 'focalpull-flags - ) - ((= v1-0 'campoints) - 'campoints-flags - ) - (else - (set! sv-32 format) - (let ((a0-4 (clear *cam-res-string*)) - (a1-2 "~S-flags") - (a2-1 arg0) - ) - (sv-32 a0-4 a1-2 a2-1) + (let ((s2-0 cam-slave-get-flags) + (s0-0 arg1) + (v1-0 arg0) + ) + (set! (-> this flags) + (the-as + cam-index-options + (s2-0 + s0-0 + (cond + ((= v1-0 'focalpull) + 'focalpull-flags ) - (format 0 "WARNING: cam-index-init is using string->symbol to build symbol ~A at runtime.~%" *cam-res-string*) - (string->symbol *cam-res-string*) - ) - ) - ) - ) - (set! (-> this flags) (the-as cam-index-options (s2-0 s0-0 a1-1))) + ((= v1-0 'campoints) + 'campoints-flags + ) + (else + (format (clear *cam-res-string*) "~S-flags" arg0) + (format 0 "WARNING: cam-index-init is using string->symbol to build symbol ~A at runtime.~%" *cam-res-string*) + (string->symbol *cam-res-string*) + ) + ) + ) + ) + ) ) (let* ((s2-1 (res-lump-data arg1 arg0 pointer)) (s0-1 (method-of-type res-lump get-property-struct)) (v1-4 arg0) - (a1-5 - (cond - ((= v1-4 'focalpull) - 'focalpull-offset - ) - ((= v1-4 'campoints) - 'campoints-offset - ) - (else - (set! sv-48 format) - (let ((a0-12 (clear *cam-res-string*)) - (a1-6 "~S-offset") - ) - (sv-48 a0-12 a1-6 arg0) - ) - (format 0 "WARNING: cam-index-init is using string->symbol to build symbol ~A at runtime.~%" *cam-res-string*) - (string->symbol *cam-res-string*) - ) - ) - ) (v0-10 - (s0-1 arg1 a1-5 'interp -1000000000.0 (the-as structure #f) (the-as (pointer res-tag) #f) *res-static-buf*) + (s0-1 + arg1 + (cond + ((= v1-4 'focalpull) + 'focalpull-offset + ) + ((= v1-4 'campoints) + 'campoints-offset + ) + (else + (format (clear *cam-res-string*) "~S-offset" arg0) + (format 0 "WARNING: cam-index-init is using string->symbol to build symbol ~A at runtime.~%" *cam-res-string*) + (string->symbol *cam-res-string*) + ) + ) + 'interp + -1000000000.0 + (the-as structure #f) + (the-as (pointer res-tag) #f) + *res-static-buf* + ) ) ) (cond @@ -1266,7 +1253,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 @@ -1297,11 +1283,13 @@ (vector-flatten! s0-0 s0-0 (-> *camera* local-down)) (vector-normalize! s0-0 1.0) (vector-float*! s2-0 (-> *camera* tgt-face-mat fvec) 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)) ) @@ -1319,10 +1307,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) ) @@ -1370,10 +1355,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)) ) ) ) @@ -1536,7 +1521,6 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs vector. (defun vector-into-frustum-nosmooth! ((arg0 matrix) (arg1 vector) (arg2 float)) - (local-vars (sv-112 vector) (sv-128 vector) (sv-144 vector) (sv-160 vector) (sv-176 vector)) (rlet ((vf0 :class vf) (vf1 :class vf) (vf2 :class vf) @@ -1557,17 +1541,19 @@ (vector-flatten! s3-0 s3-0 (-> arg0 uvec)) (vector-normalize! s3-0 1.0) (let ((f28-0 (vector-dot s3-0 (-> arg0 rvec)))) - (set! sv-128 s2-0) - (set! sv-112 (-> arg0 rvec)) - (let ((f0-7 (* 0.8 (tan (/ arg2 2))))) - (.lvf vf1 (&-> sv-112 quad)) - (let ((v1-11 f0-7)) - (.mov vf2 v1-11) + (let ((sv-128 s2-0)) + (let ((sv-112 (-> arg0 rvec)) + (f0-7 (* 0.8 (tan (/ arg2 2)))) + ) + (.lvf vf1 (&-> sv-112 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 fvec)) (vector-normalize! s2-0 f26-0) (vector--float*! s2-0 s2-0 (-> arg0 rvec) 6144.0) @@ -1590,17 +1576,19 @@ (vector-flatten! s3-0 s3-0 (-> arg0 rvec)) (vector-normalize! s3-0 1.0) (let ((f28-1 (vector-dot s3-0 (-> arg0 uvec)))) - (set! sv-160 s2-0) - (set! sv-144 (-> arg0 uvec)) - (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 uvec)) + (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 fvec)) (vector-normalize! s2-0 1.0) (let ((f0-18 (vector-dot s2-0 (-> arg0 uvec)))) @@ -1616,12 +1604,7 @@ (vector-flatten! s3-0 s3-0 (-> arg0 rvec)) (vector-normalize! s3-0 1.0) (let ((f28-2 (vector-dot s3-0 (-> arg0 uvec)))) - (let ((s0-1 s2-0)) - (set! sv-176 (-> arg0 uvec)) - (let ((f0-26 (* 0.525 (tan (/ arg2 2))))) - (vector-float*! s0-1 sv-176 f0-26) - ) - ) + (vector-float*! s2-0 (-> arg0 uvec) (* 0.525 (tan (/ arg2 2)))) (vector+! s2-0 s2-0 (-> arg0 fvec)) (vector-normalize! s2-0 1.0) (let ((f0-28 (vector-dot s2-0 (-> arg0 uvec)))) @@ -1664,16 +1647,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 - (v1-60 matrix) - (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 (v1-60 matrix) (f0-9 float)) (rlet ((vf0 :class vf) (vf4 :class vf) (vf5 :class vf) @@ -1689,22 +1663,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*! @@ -1724,47 +1699,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) ) ) ) @@ -1777,12 +1740,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))) (set! v1-60 (cond (arg4 (slave-matrix-blend-2 (-> arg0 inv-mat) arg2 s0-0 s1-0) @@ -1841,97 +1799,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 rvec quad) (the-as uint128 0)) - (set! (-> sv-176 uvec quad) (the-as uint128 0)) - (set! (-> sv-176 fvec quad) (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 rvec quad) (the-as uint128 0)) + (set! (-> sv-176 uvec quad) (the-as uint128 0)) + (set! (-> sv-176 fvec quad) (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 + (vector-copy! s0-0 arg1) + (vector-copy! sv-160 arg2) + (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 - (vector-copy! s0-0 arg1) - (vector-copy! sv-160 arg2) - (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))) @@ -1960,10 +1892,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 @@ -1995,31 +1928,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/jak3/engine/collide/collide-cache_REF.gc b/test/decompiler/reference/jak3/engine/collide/collide-cache_REF.gc index 8e11c204cd..ceb0705b5e 100644 --- a/test/decompiler/reference/jak3/engine/collide/collide-cache_REF.gc +++ b/test/decompiler/reference/jak3/engine/collide/collide-cache_REF.gc @@ -390,14 +390,12 @@ ) (vector+float*! (-> s3-0 rvec) (-> arg0 start-pos) (-> arg0 move-dist) f0-6) ) - (let ((f0-7 (vector-vector-distance-squared (-> s3-0 rvec) (-> 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 rvec) (-> 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)) ) ) ) @@ -426,14 +424,12 @@ ) (vector+float*! (-> s3-0 rvec) (-> arg0 start-pos) (-> arg0 move-dist) f0-11) ) - (let ((f0-12 (vector-vector-distance-squared (-> s3-0 rvec) (-> 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 rvec) (-> 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/jak3/engine/collide/collide-edge-grab_REF.gc b/test/decompiler/reference/jak3/engine/collide/collide-edge-grab_REF.gc index bb2ee5c420..e524158a4d 100644 --- a/test/decompiler/reference/jak3/engine/collide/collide-edge-grab_REF.gc +++ b/test/decompiler/reference/jak3/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) @@ -170,19 +169,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)) @@ -580,7 +581,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)) @@ -617,13 +617,7 @@ (s1-0 #t) (s0-0 577) ) - (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/jak3/engine/collide/collide-shape-rider_REF.gc b/test/decompiler/reference/jak3/engine/collide/collide-shape-rider_REF.gc index 3936a6e9f7..6c2462cf96 100644 --- a/test/decompiler/reference/jak3/engine/collide/collide-shape-rider_REF.gc +++ b/test/decompiler/reference/jak3/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/jak3/engine/collide/collide-shape_REF.gc b/test/decompiler/reference/jak3/engine/collide/collide-shape_REF.gc index 966470fa79..1a08f8900b 100644 --- a/test/decompiler/reference/jak3/engine/collide/collide-shape_REF.gc +++ b/test/decompiler/reference/jak3/engine/collide/collide-shape_REF.gc @@ -562,7 +562,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))))) @@ -602,51 +601,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))) + ) + (vector-copy! arg1 (-> s1-0 best-other-tri intersect)) + (+! 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))) - ) - (vector-copy! arg1 (-> s1-0 best-other-tri intersect)) - (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)) ) ) ) @@ -934,73 +932,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))) - ) - (vector-copy! sv-48 (-> arg1 best-other-tri normal)) - (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))) + ) + (vector-copy! sv-48 (-> arg1 best-other-tri normal)) + (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) + ) ) ) + (vector-copy! sv-52 sv-48) + (if (= (-> arg1 best-dist) 0.0) + (move-by-vector! arg0 (vector-normalize-copy! (new-stack-vector0) sv-52 6.0)) + ) + (vector-copy! (-> arg0 poly-normal) (-> arg1 best-other-tri normal)) + (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 best-other-prim) + (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)) + (vector-copy! (-> arg0 local-normal) sv-52) + ) + ) + (when (and (not sv-96) (>= (-> arg0 coverage) 0.9)) + (logior! sv-56 (collide-status on-ground)) + (vector-copy! (-> arg0 ground-poly-normal) (-> arg0 poly-normal)) + (when (!= (-> arg0 poly-pat mode) (pat-mode wall)) + (set! (-> arg0 ground-pat) (-> arg0 poly-pat)) + (set! (-> arg0 ground-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)) - ) - (vector-copy! (-> arg0 poly-normal) (-> arg1 best-other-tri normal)) - (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 best-other-prim) - (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))) - (vector-copy! (-> arg0 local-normal) sv-52) - ) - ) - (when (and (not sv-96) (>= (-> arg0 coverage) 0.9)) - (set! sv-56 (logior sv-56 (collide-status on-ground))) - (vector-copy! (-> arg0 ground-poly-normal) (-> arg0 poly-normal)) - (when (!= (-> arg0 poly-pat mode) (pat-mode wall)) - (set! (-> arg0 ground-pat) (-> arg0 poly-pat)) - (set! (-> arg0 ground-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) ) @@ -1063,7 +1061,6 @@ ;; definition for method 66 of type collide-shape-moving ;; INFO: Used lq/sq (defmethod step-collision! ((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)) ) @@ -1075,10 +1072,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 (>= (-> s0-0 prim-core prim-type) 0) (collide-with-collide-cache-prim-mesh s1-1 s5-0 s0-0) @@ -1766,22 +1763,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) + ) (set! (-> s1-0 count) (min 1023 (+ (-> s1-0 count) 1))) (+! (-> s1-0 depth) 1) (set! (-> s1-0 max-depth) (max (-> s1-0 max-depth) (-> s1-0 depth))) @@ -2450,14 +2448,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)) ) ) ) @@ -2491,14 +2485,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)) ) ) ) @@ -2632,11 +2622,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) @@ -2673,11 +2659,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) @@ -2989,7 +2971,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) @@ -2997,63 +2978,60 @@ ) (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 (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 collide-shape (-> (the-as process-drawable gp-0) root)) arg1) (when (logtest? (-> sv-160 prim-core action) (collide-action no-standon)) - (let ((v1-12 (touching-prims-entry-method-9 s0-0 (new 'stack-no-clear 'vector)))) - (set! sv-176 (new 'stack-no-clear 'vector)) + (let ((v1-12 (touching-prims-entry-method-9 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))) - (vector-copy! s2-1 (-> (the-as process-focusable gp-0) root transv)) - (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) - (vector-copy! s2-1 (vector-z-quaternion! s2-1 (-> (the-as process-focusable gp-0) root quat))) - ) - (vector-xz-normalize! s2-1 (fmax f30-0 arg4)) - ) - (set! (-> s2-1 y) arg3) - (send-event - gp-0 - 'shove - arg1 - (static-attack-info :mask (vehicle-impulse-factor) ((id (new-attack-id)) - (damage 2.0) - (vehicle-damage-factor 1.0) - (vehicle-impulse-factor 1.0) - (vector s2-1) - (angle 'jump) - ) - ) + (.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))) + (vector-copy! s2-1 (-> (the-as process-focusable gp-0) root transv)) + (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) + (vector-copy! s2-1 (vector-z-quaternion! s2-1 (-> (the-as process-focusable gp-0) root quat))) + ) + (vector-xz-normalize! s2-1 (fmax f30-0 arg4)) + ) + (set! (-> s2-1 y) arg3) + (send-event + gp-0 + 'shove + arg1 + (static-attack-info :mask (vehicle-impulse-factor) ((id (new-attack-id)) + (damage 2.0) + (vehicle-damage-factor 1.0) + (vehicle-impulse-factor 1.0) + (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/jak3/engine/collide/find-nearest_REF.gc b/test/decompiler/reference/jak3/engine/collide/find-nearest_REF.gc index 9b0b401caa..90ab6abcae 100644 --- a/test/decompiler/reference/jak3/engine/collide/find-nearest_REF.gc +++ b/test/decompiler/reference/jak3/engine/collide/find-nearest_REF.gc @@ -246,15 +246,7 @@ (arg6 vector) (arg7 float) ) - (local-vars - (f0-12 float) - (sv-704 (function float float float)) - (sv-720 float) - (sv-736 vector) - (sv-752 vector) - (sv-768 (function float float float)) - (sv-784 float) - ) + (local-vars (f0-12 float)) (with-pp (rlet ((acc :class vf) (vf0 :class vf) @@ -305,40 +297,27 @@ (when (nonzero? (-> s0-0 root-prim prim-core collide-as)) (let ((s0-1 (search-info-flag))) 0.0 - (set! sv-736 (vector-normalize! (vector-! (new 'stack-no-clear 'vector) s2-1 (-> gp-0 point)) 1.0)) - (let ((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-6 (vector-y-angle sv-736))) - (fabs (sv-704 sv-720 a1-6)) + (let* ((sv-736 (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)) + (fabs (deg-diff (vector-y-angle (-> gp-0 rot-base)) (vector-y-angle sv-736))) + ) + ((logtest? (-> gp-0 mask) (search-info-flag prefer-angle)) + (- -9999.0 (vector-dot sv-736 (-> gp-0 rot-base))) + ) + ((logtest? (search-info-flag prefer-center) (-> gp-0 mask)) + (* f30-0 (fmax 0.01 (- 1.0 (vector-dot sv-736 (-> gp-0 rot-base))))) + ) + (else + f30-0 ) ) - ((logtest? (-> gp-0 mask) (search-info-flag prefer-angle)) - (- -9999.0 (vector-dot sv-736 (-> gp-0 rot-base))) - ) - ((logtest? (search-info-flag prefer-center) (-> gp-0 mask)) - (* f30-0 (fmax 0.01 (- 1.0 (vector-dot sv-736 (-> gp-0 rot-base))))) - ) - (else - f30-0 - ) - ) - ) - ) + ) + ) (cond ((logtest? (-> gp-0 mask) (search-info-flag cull-angle-simple)) - (let* ((v1-41 (-> gp-0 rot-base)) - (f0-11 (-> sv-736 x)) - (f1-6 (-> sv-736 y)) - (f2-2 (-> sv-736 z)) - (f3-0 (-> v1-41 x)) - (f4-0 (-> v1-41 y)) - (f5-0 (-> v1-41 z)) - ) - (.mula.s f0-11 f3-0) - (.madda.s f1-6 f4-0) - (.madd.s f0-12 f2-2 f5-0) + (let* ((v1-41 (-> gp-0 rot-base))) + (set! f0-12 (vector-dot sv-736 v1-41)) ) (if (< f0-12 (cos (-> gp-0 rot-range))) (return (the-as process-focusable #f)) @@ -347,8 +326,9 @@ ((logtest? (-> gp-0 mask) (search-info-flag cull-angle)) (cond ((< (-> gp-0 rot-range) 14563.556) - (let ((f26-1 (vector-dot (vector-! (new 'stack-no-clear 'vector) s2-1 (-> gp-0 point)) (-> gp-0 rot-base)))) - (set! sv-752 (new 'stack-no-clear 'vector)) + (let ((f26-1 (vector-dot (vector-! (new 'stack-no-clear 'vector) s2-1 (-> gp-0 point)) (-> gp-0 rot-base))) + (sv-752 (new 'stack-no-clear 'vector)) + ) (let ((v1-53 (-> gp-0 point)) (a0-27 (-> gp-0 rot-base)) (f0-17 f26-1) @@ -363,14 +343,9 @@ (.mul.x.vf acc vf2 vf3) (.add.mul.w.vf.xyz vf4 vf1 vf0 acc) (.svf (&-> sv-752 quad) vf4) - (let ((f26-2 (* f26-1 (tan (-> gp-0 rot-range)))) - (t9-10 vector-vector-distance) - (a1-8 s2-1) - ) - (if (< f26-2 (- (t9-10 sv-752 a1-8) (-> s2-1 w))) - (goto cfg-104) - ) - ) + (if (< (* f26-1 (tan (-> gp-0 rot-range))) (- (vector-vector-distance sv-752 s2-1) (-> s2-1 w))) + (goto cfg-104) + ) ) ) (else @@ -381,15 +356,9 @@ ) ) ((logtest? (-> gp-0 mask) (search-info-flag cull-xz)) - (let ((f26-4 (-> gp-0 rot-range))) - (set! sv-768 deg-diff) - (set! sv-784 (vector-y-angle (-> gp-0 rot-base))) - (let ((a1-9 (vector-y-angle sv-736))) - (if (< f26-4 (fabs (sv-768 sv-784 a1-9))) - (goto cfg-104) - ) + (if (< (-> gp-0 rot-range) (fabs (deg-diff (vector-y-angle (-> gp-0 rot-base)) (vector-y-angle sv-736)))) + (goto cfg-104) ) - ) ) ) (when (logtest? (-> gp-0 mask) (search-info-flag back-point)) diff --git a/test/decompiler/reference/jak3/engine/collide/los-control_REF.gc b/test/decompiler/reference/jak3/engine/collide/los-control_REF.gc index 4315af1752..d895c415ce 100644 --- a/test/decompiler/reference/jak3/engine/collide/los-control_REF.gc +++ b/test/decompiler/reference/jak3/engine/collide/los-control_REF.gc @@ -31,7 +31,7 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defmethod los-control-method-9 ((this los-control) (arg0 process-focusable) (arg1 vector) (arg2 float) (arg3 float)) - (local-vars (a0-22 int) (a0-24 int) (sv-592 vector)) + (local-vars (a0-22 int) (a0-24 int)) (rlet ((vf0 :class vf) (vf4 :class vf) (vf5 :class vf) @@ -66,35 +66,34 @@ (set! arg0 (as-type (handle->process (-> this dst-proc)) process-focusable)) ) (when (or (the-as process arg0) arg1) - (set! sv-592 (new 'stack-no-clear 'vector)) - (let ((v1-24 (-> (get-trans (the-as process-focusable s1-0) 10) quad))) - (set! (-> sv-592 quad) v1-24) - ) - (let ((s0-2 (new 'stack-no-clear 'collide-query))) - (if (not arg1) - (set! arg1 (get-trans arg0 3)) - ) - (vector-copy! (-> s0-2 start-pos) sv-592) - (set! (-> s0-2 ignore-process0) s1-0) - (set! (-> s0-2 ignore-process1) (the-as process arg0)) - (set! (-> s0-2 ignore-pat) (-> (the-as process-focusable s1-0) root pat-ignore-mask)) - (set! (-> s0-2 action-mask) (collide-action solid semi-solid)) - (let ((s2-1 (new 'stack-no-clear 'vector))) - (.lvf vf4 (&-> arg1 quad)) - (.lvf vf5 (&-> sv-592 quad)) - (.mov.vf.w vf6 vf0) - (.sub.vf.xyz vf6 vf4 vf5) - (.svf (&-> s2-1 quad) vf6) - (let ((f30-0 (vector-length s2-1))) - (let ((f0-0 (los-control-method-13 this s0-2 s2-1 -2 arg3))) - (if (< f0-0 f30-0) - (vector-normalize! s2-1 f0-0) + (let ((sv-592 (new 'stack-no-clear 'vector))) + (vector-copy! sv-592 (get-trans (the-as process-focusable s1-0) 10)) + (let ((s0-2 (new 'stack-no-clear 'collide-query))) + (if (not arg1) + (set! arg1 (get-trans arg0 3)) + ) + (vector-copy! (-> s0-2 start-pos) sv-592) + (set! (-> s0-2 ignore-process0) s1-0) + (set! (-> s0-2 ignore-process1) (the-as process arg0)) + (set! (-> s0-2 ignore-pat) (-> (the-as process-focusable s1-0) root pat-ignore-mask)) + (set! (-> s0-2 action-mask) (collide-action solid semi-solid)) + (let ((s2-1 (new 'stack-no-clear 'vector))) + (.lvf vf4 (&-> arg1 quad)) + (.lvf vf5 (&-> sv-592 quad)) + (.mov.vf.w vf6 vf0) + (.sub.vf.xyz vf6 vf4 vf5) + (.svf (&-> s2-1 quad) vf6) + (let ((f30-0 (vector-length s2-1))) + (let ((f0-0 (los-control-method-13 this s0-2 s2-1 -2 arg3))) + (if (< f0-0 f30-0) + (vector-normalize! s2-1 f0-0) + ) + ) + (if (< (los-control-method-13 this s0-2 s2-1 1 arg2) f30-0) + (set-time! (-> this last-lost-los)) + (set-time! (-> this last-gained-los)) ) ) - (if (< (los-control-method-13 this s0-2 s2-1 1 arg2) f30-0) - (set-time! (-> this last-lost-los)) - (set-time! (-> this last-gained-los)) - ) ) ) ) diff --git a/test/decompiler/reference/jak3/engine/common-obs/airlock_REF.gc b/test/decompiler/reference/jak3/engine/common-obs/airlock_REF.gc index 4563f31b2d..fa4da57f5f 100644 --- a/test/decompiler/reference/jak3/engine/common-obs/airlock_REF.gc +++ b/test/decompiler/reference/jak3/engine/common-obs/airlock_REF.gc @@ -159,7 +159,6 @@ ;; definition for method 22 of type com-airlock ;; INFO: Used lq/sq (defmethod init-airlock! ((this com-airlock)) - (local-vars (sv-16 res-tag) (sv-32 res-tag)) (process-entity-status! this (entity-perm-status subtask-complete) #f) (set! (-> this open?) #f) (process-drawable-from-entity! this (-> this entity)) @@ -196,8 +195,9 @@ ) (set! (-> this open-distance 0) 143360.0) (set! (-> this open-distance 1) 143360.0) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-21 (res-lump-data (-> this entity) 'distance (pointer float) :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-21 (res-lump-data (-> this entity) 'distance (pointer float) :tag-ptr (& sv-16))) + ) (when v1-21 (if (>= (-> sv-16 elt-count) (the-as uint 1)) (set! (-> this open-distance 0) (-> v1-21 0)) @@ -209,8 +209,9 @@ ) (set! (-> this active-distance 0) (+ 143360.0 (-> this open-distance 0))) (set! (-> this active-distance 1) (+ 143360.0 (-> this open-distance 1))) - (set! sv-32 (new 'static 'res-tag)) - (let ((v1-25 (res-lump-data (-> this entity) 'idle-distance (pointer float) :tag-ptr (& sv-32)))) + (let* ((sv-32 (new 'static 'res-tag)) + (v1-25 (res-lump-data (-> this entity) 'idle-distance (pointer float) :tag-ptr (& sv-32))) + ) (when v1-25 (if (>= (-> sv-32 elt-count) (the-as uint 1)) (set! (-> this active-distance 0) (-> v1-25 0)) diff --git a/test/decompiler/reference/jak3/engine/common-obs/basebutton_REF.gc b/test/decompiler/reference/jak3/engine/common-obs/basebutton_REF.gc index 31acd65384..a227ba717c 100644 --- a/test/decompiler/reference/jak3/engine/common-obs/basebutton_REF.gc +++ b/test/decompiler/reference/jak3/engine/common-obs/basebutton_REF.gc @@ -420,7 +420,6 @@ ;; INFO: Used lq/sq (defmethod init-from-entity! ((this basebutton) (arg0 entity-actor)) "Set up a newly created process from the entity that created it." - (local-vars (sv-16 res-tag)) (init! 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))) @@ -435,11 +434,12 @@ (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 actor-group) :tag-ptr (& sv-16))) + ) (cond ((and v1-15 (nonzero? (-> sv-16 elt-count))) - (set! (-> this actor-group) (the-as (pointer actor-group) v1-15)) + (set! (-> this actor-group) v1-15) (set! (-> this actor-group-count) (the-as int (-> sv-16 elt-count))) ) (else @@ -484,3 +484,7 @@ (idle-state-transition self) (none) ) + + + + diff --git a/test/decompiler/reference/jak3/engine/common-obs/blocking-plane_REF.gc b/test/decompiler/reference/jak3/engine/common-obs/blocking-plane_REF.gc index df735c0be3..b0335b3052 100644 --- a/test/decompiler/reference/jak3/engine/common-obs/blocking-plane_REF.gc +++ b/test/decompiler/reference/jak3/engine/common-obs/blocking-plane_REF.gc @@ -177,16 +177,12 @@ (vector-cross! (-> s1-0 fvec) (-> s1-0 rvec) (-> s1-0 uvec)) (vector-normalize! (-> s1-0 fvec) 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 (/ arg1 2))) - (set! (-> v1-20 z) 0.0) - (let ((f0-17 0.5) - (f1-7 (* f30-1 f30-1)) - (f2-2 arg1) - ) - (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 (/ arg1 2)) + 0.0 + (* 0.5 (sqrtf (+ (square f30-1) (square arg1)))) ) ) ) diff --git a/test/decompiler/reference/jak3/engine/common-obs/collectables_REF.gc b/test/decompiler/reference/jak3/engine/common-obs/collectables_REF.gc index f885f4c708..e861fea310 100644 --- a/test/decompiler/reference/jak3/engine/common-obs/collectables_REF.gc +++ b/test/decompiler/reference/jak3/engine/common-obs/collectables_REF.gc @@ -2820,61 +2820,55 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch object vs (pointer process). (defbehavior birth-pickup-at-point process ((arg0 vector) (arg1 pickup-type) (arg2 float) (arg3 symbol) (arg4 process-tree) (arg5 fact-info)) - (local-vars - (v1-56 pickup-type) - (v1-68 pickup-type) - (sv-32 vector) - (sv-36 float) - (sv-40 (pointer process)) - (sv-48 int) - (sv-56 fact-info) - (sv-64 int) - (sv-72 int) - ) + (local-vars (v1-56 pickup-type) (v1-68 pickup-type)) (let ((s2-0 (verify-pickup-type arg1))) (if (= s2-0 (pickup-type none)) (return (the-as (pointer process) 0)) ) - (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 + ((= s2-0 (pickup-type buzzer)) + 0.0 ) - 'pickup-radius - :default (cond - ((= s2-0 (pickup-type buzzer)) - 0.0 - ) - ((= arg2 1.0) - 409.6 - ) - (else - 8192.0 + ((= arg2 1.0) + 409.6 ) - ) - ) + (else + 8192.0 + ) + ) + ) + ) + (sv-40 (the-as (pointer process) #f)) ) - (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)) - (set! (-> sv-56 process) #f) - (if arg5 - (mem-copy! (&-> sv-56 type) (&-> arg5 type) 40) - ) - (set! (-> sv-56 pickup-type) s2-0) - (if (not (logtest? (actor-option dont-override-fact) (-> sv-56 options))) - (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 s2-0 - (((pickup-type eco-yellow)) - (set! sv-40 (process-spawn + (let ((sv-48 (the int arg2)) + (sv-56 (new 'static 'fact-info)) + ) + (set! (-> sv-56 options) (actor-option)) + (set! (-> sv-56 process) #f) + (if arg5 + (mem-copy! (&-> sv-56 type) (&-> arg5 type) 40) + ) + (set! (-> sv-56 pickup-type) s2-0) + (if (not (logtest? (actor-option dont-override-fact) (-> sv-56 options))) + (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-30 s2-0)) + (set! sv-40 + (cond + ((= v1-30 (pickup-type eco-yellow)) + (process-spawn eco-yellow :init initialize-eco-by-other arg0 @@ -2884,234 +2878,249 @@ :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 - :name "eco-red" - :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 - :name "eco-blue" - :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 - :name "eco-green" - :from *pickup-dead-pool* - :to arg4 - ) - ) - ) - (((pickup-type health)) - (if (not (logtest? (actor-option dont-override-fact) (-> sv-56 options))) - (set! (-> sv-56 pickup-spawn-amount) arg2) - ) - (set! sv-40 (process-spawn - health - :init initialize-eco-by-other - arg0 - sv-32 - sv-56 - :name "health" - :from *pickup-dead-pool* - :to arg4 - ) - ) - (set! sv-48 0) - 0 - ) - (((pickup-type eco-pill-green) (pickup-type eco-pill-dark) (pickup-type eco-pill-light)) - (set! sv-64 (cond - ((logtest? (actor-option dont-override-fact) (-> sv-56 options)) - (the int (-> sv-56 pickup-spawn-amount)) - ) - ((begin (set! v1-56 s2-0) (= v1-56 (pickup-type eco-pill-dark))) - 2 - ) - ((= v1-56 (pickup-type eco-pill-light)) - 20 - ) - (else - 1 + ) + (else + (cond + ((= v1-30 (pickup-type eco-red)) + (let ((s1-2 (get-process *pickup-dead-pool* eco-red #x4000 1))) + (set! sv-40 (when s1-2 + (let ((t9-8 (method-of-type eco-red activate))) + (t9-8 (the-as eco-red s1-2) arg4 "eco-red" (the-as pointer #x70004000)) + ) + (run-now-in-process s1-2 initialize-eco-by-other arg0 sv-32 sv-56) + (-> s1-2 ppointer) + ) + ) + ) ) - ) - ) - (set! (-> sv-56 pickup-spawn-amount) (the float sv-64)) - (set! sv-40 (process-spawn - eco-pill - :init initialize-eco-by-other - arg0 - sv-32 - sv-56 - :name "eco-pill" - :from *pickup-dead-pool* - :to arg4 - ) - ) - (set! sv-48 (- sv-48 (+ sv-64 -1))) - ) - (((pickup-type ammo-yellow) - (pickup-type ammo-red) - (pickup-type ammo-blue) - (pickup-type ammo-dark) - (pickup-type shield) - ) - (set! sv-72 (cond - ((logtest? (actor-option dont-override-fact) (-> sv-56 options)) - (the int (-> sv-56 pickup-spawn-amount)) - ) - ((begin (set! v1-68 s2-0) (= v1-68 (pickup-type ammo-red))) - 5 - ) - ((= v1-68 (pickup-type ammo-dark)) - 1 - ) - (else - 10 + ((= v1-30 (pickup-type eco-blue)) + (let ((s1-3 (get-process *pickup-dead-pool* eco-blue #x4000 1))) + (set! sv-40 (when s1-3 + (let ((t9-11 (method-of-type eco-blue activate))) + (t9-11 (the-as eco-blue s1-3) arg4 "eco-blue" (the-as pointer #x70004000)) + ) + (run-now-in-process s1-3 initialize-eco-by-other arg0 sv-32 sv-56) + (-> s1-3 ppointer) + ) + ) + ) ) - ) - ) - (set! (-> sv-56 pickup-spawn-amount) (the float sv-72)) - (set! sv-40 (process-spawn - ammo-collectable - :init initialize-ammo-by-other - arg0 - sv-32 - sv-56 - :name "ammo-collectable" - :from *pickup-dead-pool* - :to arg4 - ) - ) - (set! sv-48 (- sv-48 (+ sv-72 -1))) - ) - (((pickup-type gun-red-1) - (pickup-type gun-red-2) - (pickup-type gun-red-3) - (pickup-type gun-yellow-1) - (pickup-type gun-yellow-2) - (pickup-type gun-yellow-3) - (pickup-type gun-blue-1) - (pickup-type gun-blue-2) - (pickup-type gun-blue-3) - (pickup-type gun-dark-1) - (pickup-type gun-dark-2) - (pickup-type gun-dark-3) - (pickup-type board) - ) - (set! sv-40 (process-spawn - upgrade-collectable - :init initialize-upgrade-by-other - arg0 - sv-32 - sv-56 - (-> self entity) - :name "upgrade-collectable" - :from *pickup-dead-pool* - :to arg4 - ) - ) - (set! sv-48 0) - 0 - ) - (((pickup-type trick-point)) - (if (not (logtest? (actor-option dont-override-fact) (-> sv-56 options))) - (set! (-> sv-56 pickup-spawn-amount) arg2) - ) - (set! sv-40 (process-spawn - trick-point - :init initialize-ammo-by-other - arg0 - sv-32 - sv-56 - :name "trick-point" - :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) 0 :name "money" :from *pickup-dead-pool* :to arg4) - ) - ) - (((pickup-type trick-point)) - (set! sv-40 - (process-spawn money arg0 sv-32 sv-56 (-> self entity) 4500 :name "money" :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) - 4500 - :name "gem" - :from *pickup-dead-pool* - :to arg4 - ) - ) - ) - (((pickup-type skill)) - (when (>= arg2 (-> *FACT-bank* super-skill-inc)) - (if (not (logtest? (actor-option dont-override-fact) (-> sv-56 options))) - (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) - 0 - :name "skill" - :from *pickup-dead-pool* - :to arg4 - ) - ) - ) - (else - (format 0 "ERROR: unknown type of eco ~d~%" s2-0) + ((= v1-30 (pickup-type eco-green)) + (let ((s1-4 (get-process *pickup-dead-pool* eco-green #x4000 1))) + (set! sv-40 (when s1-4 + (let ((t9-14 (method-of-type eco-green activate))) + (t9-14 (the-as eco-green s1-4) arg4 "eco-green" (the-as pointer #x70004000)) + ) + (run-now-in-process s1-4 initialize-eco-by-other arg0 sv-32 sv-56) + (-> s1-4 ppointer) + ) + ) + ) + ) + ((= v1-30 (pickup-type health)) + (if (not (logtest? (actor-option dont-override-fact) (-> sv-56 options))) + (set! (-> sv-56 pickup-spawn-amount) arg2) + ) + (let ((s1-5 (get-process *pickup-dead-pool* health #x4000 1))) + (set! sv-40 (when s1-5 + (let ((t9-17 (method-of-type health activate))) + (t9-17 (the-as health s1-5) arg4 "health" (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-30 (pickup-type eco-pill-green)) + (= v1-30 (pickup-type eco-pill-dark)) + (= v1-30 (pickup-type eco-pill-light)) + ) + (let ((sv-64 (cond + ((logtest? (actor-option dont-override-fact) (-> sv-56 options)) + (the int (-> sv-56 pickup-spawn-amount)) + ) + ((begin (set! v1-56 s2-0) (= v1-56 (pickup-type eco-pill-dark))) + 2 + ) + ((= v1-56 (pickup-type eco-pill-light)) + 20 + ) + (else + 1 + ) + ) + ) + ) + (set! (-> sv-56 pickup-spawn-amount) (the float sv-64)) + (let ((s1-6 (get-process *pickup-dead-pool* eco-pill #x4000 1))) + (set! sv-40 (when s1-6 + (let ((t9-20 (method-of-type eco-pill activate))) + (t9-20 (the-as eco-pill s1-6) arg4 "eco-pill" (the-as pointer #x70004000)) + ) + (run-now-in-process s1-6 initialize-eco-by-other arg0 sv-32 sv-56) + (-> s1-6 ppointer) + ) + ) + ) + (set! sv-48 (- sv-48 (+ sv-64 -1))) + ) + ) + ((or (= v1-30 (pickup-type ammo-yellow)) + (= v1-30 (pickup-type ammo-red)) + (= v1-30 (pickup-type ammo-blue)) + (= v1-30 (pickup-type ammo-dark)) + (= v1-30 (pickup-type shield)) + ) + (let ((sv-72 (cond + ((logtest? (actor-option dont-override-fact) (-> sv-56 options)) + (the int (-> sv-56 pickup-spawn-amount)) + ) + ((begin (set! v1-68 s2-0) (= v1-68 (pickup-type ammo-red))) + 5 + ) + ((= v1-68 (pickup-type ammo-dark)) + 1 + ) + (else + 10 + ) + ) + ) + ) + (set! (-> sv-56 pickup-spawn-amount) (the float sv-72)) + (let ((s1-7 (get-process *pickup-dead-pool* ammo-collectable #x4000 1))) + (set! sv-40 (when s1-7 + (let ((t9-23 (method-of-type ammo-collectable activate))) + (t9-23 (the-as ammo-collectable s1-7) arg4 "ammo-collectable" (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-72 -1))) + ) + ) + ((or (= v1-30 (pickup-type gun-red-1)) + (= v1-30 (pickup-type gun-red-2)) + (= v1-30 (pickup-type gun-red-3)) + (= v1-30 (pickup-type gun-yellow-1)) + (= v1-30 (pickup-type gun-yellow-2)) + (= v1-30 (pickup-type gun-yellow-3)) + (= v1-30 (pickup-type gun-blue-1)) + (= v1-30 (pickup-type gun-blue-2)) + (= v1-30 (pickup-type gun-blue-3)) + (= v1-30 (pickup-type gun-dark-1)) + (= v1-30 (pickup-type gun-dark-2)) + (= v1-30 (pickup-type gun-dark-3)) + (= v1-30 (pickup-type board)) + ) + (let ((s1-8 (get-process *pickup-dead-pool* upgrade-collectable #x4000 1))) + (set! sv-40 + (when s1-8 + (let ((t9-26 (method-of-type upgrade-collectable activate))) + (t9-26 (the-as upgrade-collectable s1-8) arg4 "upgrade-collectable" (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-30 (pickup-type trick-point)) + (if (not (logtest? (actor-option dont-override-fact) (-> sv-56 options))) + (set! (-> sv-56 pickup-spawn-amount) arg2) + ) + (let ((s1-9 (get-process *pickup-dead-pool* trick-point #x4000 1))) + (set! sv-40 (when s1-9 + (let ((t9-29 (method-of-type trick-point activate))) + (t9-29 (the-as trick-point s1-9) arg4 "trick-point" (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-30 (pickup-type money)) + (let ((s1-10 (get-process *pickup-dead-pool* money #x4000 1))) + (set! sv-40 (when s1-10 + (let ((t9-32 (method-of-type money activate))) + (t9-32 (the-as money s1-10) arg4 "money" (the-as pointer #x70004000)) + ) + (run-now-in-process s1-10 money-init-by-other arg0 sv-32 sv-56 (-> self entity) 0) + (-> s1-10 ppointer) + ) + ) + ) + ) + ((= v1-30 (pickup-type trick-point)) + (let ((s1-11 (get-process *pickup-dead-pool* money #x4000 1))) + (set! sv-40 (when s1-11 + (let ((t9-35 (method-of-type money activate))) + (t9-35 (the-as money s1-11) arg4 "money" (the-as pointer #x70004000)) + ) + (run-now-in-process s1-11 money-init-by-other arg0 sv-32 sv-56 (-> self entity) 4500) + (-> s1-11 ppointer) + ) + ) + ) + ) + ((= v1-30 (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 1))) + (set! sv-40 (when s1-12 + (let ((t9-38 (method-of-type gem activate))) + (t9-38 (the-as gem s1-12) arg4 "gem" (the-as pointer #x70004000)) + ) + (run-now-in-process s1-12 money-init-by-other arg0 sv-32 sv-56 (-> self entity) 4500) + (-> s1-12 ppointer) + ) + ) + ) + ) + ((= v1-30 (pickup-type skill)) + (when (>= arg2 (-> *FACT-bank* super-skill-inc)) + (if (not (logtest? (actor-option dont-override-fact) (-> sv-56 options))) + (set! (-> sv-56 pickup-spawn-amount) arg2) + ) + (set! sv-48 0) + 0 + ) + (let ((s1-13 (get-process *pickup-dead-pool* skill #x4000 1))) + (set! sv-40 (when s1-13 + (let ((t9-41 (method-of-type skill activate))) + (t9-41 (the-as skill s1-13) arg4 "skill" (the-as pointer #x70004000)) + ) + (run-now-in-process s1-13 money-init-by-other arg0 sv-32 sv-56 (-> self entity) 0) + (-> s1-13 ppointer) + ) + ) + ) + ) + (else + (format 0 "ERROR: unknown type of eco ~d~%" s2-0) + ) + ) + sv-40 + ) + ) + ) + ) ) ) + (the-as (pointer process) sv-40) ) ) - (the-as (pointer process) sv-40) ) ;; definition for function pickup-dark-set! @@ -3158,118 +3167,116 @@ ;; definition for function pickup-ammo-set! (defun pickup-ammo-set! ((arg0 fact-info) (arg1 (pointer pickup-type)) (arg2 (pointer float)) (arg3 int)) - (local-vars (v0-5 number) (sv-16 float)) + (local-vars (v0-5 number)) (let ((s2-0 (-> *game-info* features))) 0.0 - (let ((f22-0 0.0) - (f26-0 0.0) - (f28-0 0.0) - (f30-0 0.0) - ) - (set! sv-16 (the-as float (if (logtest? s2-0 (game-feature gun-yellow-1 gun-yellow-2 gun-yellow-3)) + (let* ((f22-0 0.0) + (f26-0 0.0) + (f28-0 0.0) + (f30-0 0.0) + (sv-16 (the-as float (if (logtest? s2-0 (game-feature gun-yellow-1 gun-yellow-2 gun-yellow-3)) (get-max-ammo-for-gun *game-info* (pickup-type ammo-yellow)) 0.0 ) ) - ) - (let* ((f20-0 (if (logtest? s2-0 (game-feature gun-red-1 gun-red-2 gun-red-3)) - (get-max-ammo-for-gun *game-info* (pickup-type ammo-red)) - 0.0 - ) - ) - (f24-0 (if (logtest? s2-0 (game-feature gun-blue-1 gun-blue-2 gun-blue-3)) - (get-max-ammo-for-gun *game-info* (pickup-type ammo-blue)) - 0.0 - ) - ) - (f0-2 (if (logtest? (game-feature gun-dark-1 gun-dark-2 gun-dark-3) s2-0) - (get-max-ammo-for-gun *game-info* (pickup-type ammo-dark)) - 0.0 - ) - ) - (f4-0 (if (logtest? s2-0 (game-feature gun-yellow-1 gun-yellow-2 gun-yellow-3)) - (-> *game-info* gun-ammo 0) - 0.0 - ) - ) - (f1-2 (if (logtest? s2-0 (game-feature gun-red-1 gun-red-2 gun-red-3)) - (-> *game-info* gun-ammo 1) - 0.0 - ) - ) - (f2-1 (if (logtest? s2-0 (game-feature gun-blue-1 gun-blue-2 gun-blue-3)) - (-> *game-info* gun-ammo 2) - 0.0 - ) - ) - (f3-1 (if (logtest? (game-feature gun-dark-1 gun-dark-2 gun-dark-3) s2-0) - (-> *game-info* gun-ammo 3) - 0.0 - ) - ) - (f22-1 (+ f22-0 (- sv-16 f4-0))) - ) - (if (< 0.0 sv-16) - (set! f22-1 (/ f22-1 sv-16)) - ) - (let ((f1-4 (+ f26-0 (- f20-0 f1-2)))) - (if (< 0.0 f20-0) - (set! f1-4 (/ f1-4 f20-0)) - ) - (let ((f2-3 (+ f28-0 (- f24-0 f2-1)))) - (if (< 0.0 f24-0) - (set! f2-3 (/ f2-3 f24-0)) - ) - (let ((f3-3 (+ f30-0 (- f0-2 f3-1)))) - (if (< 0.0 f0-2) - (set! f3-3 (/ f3-3 f0-2)) ) - (let ((f26-1 (+ f22-1 f1-4 f2-3 f3-3))) - (when (= f26-1 0.0) - (set! f22-1 1.0) - (set! f26-1 1.0) + (f20-0 (if (logtest? s2-0 (game-feature gun-red-1 gun-red-2 gun-red-3)) + (get-max-ammo-for-gun *game-info* (pickup-type ammo-red)) + 0.0 + ) ) - (cond - ((!= f26-1 0.0) - (let* ((f24-1 (+ f1-4 f22-1)) - (f28-1 (+ f2-3 f24-1)) - (f30-1 (+ f3-3 f28-1)) - (v1-39 (/ (the-as int (rand-uint31-gen *random-generator*)) 256)) - (v1-40 (the-as number (logior #x3f800000 v1-39))) - (f0-10 (* (+ -1.0 (the-as float v1-40)) f26-1)) - ) - (set! v0-5 (cond - ((and (>= f22-1 f0-10) (logtest? s2-0 (game-feature gun-yellow-1 gun-yellow-2 gun-yellow-3))) - (set! v0-5 15) - (set! (-> arg1 0) (the-as pickup-type v0-5)) - v0-5 - ) - ((and (>= f24-1 f0-10) (logtest? s2-0 (game-feature gun-red-1 gun-red-2 gun-red-3))) - (set! (-> arg1 0) (pickup-type ammo-red)) - (if (>= 1 (mod (the-as int (rand-uint31-gen *random-generator*)) 3)) - (set! (-> arg2 0) (/ (-> arg2 0) 2)) - ) - ) - ((and (>= f28-1 f0-10) (logtest? s2-0 (game-feature gun-blue-1 gun-blue-2 gun-blue-3))) - (set! v0-5 17) - (set! (-> arg1 0) (the-as pickup-type v0-5)) - v0-5 - ) - ((and (>= f30-1 f0-10) (logtest? (game-feature gun-dark-1 gun-dark-2 gun-dark-3) s2-0)) - (set! (-> arg1 0) (pickup-type ammo-dark)) - (set! (-> arg2 0) (the float (the int (fmax 1.0 (/ (-> arg2 0) 15))))) - ) - (else - (pickup-dark-set! arg0 arg1 arg2 arg3) - ) - ) - ) + (f24-0 (if (logtest? s2-0 (game-feature gun-blue-1 gun-blue-2 gun-blue-3)) + (get-max-ammo-for-gun *game-info* (pickup-type ammo-blue)) + 0.0 + ) + ) + (f0-2 (if (logtest? (game-feature gun-dark-1 gun-dark-2 gun-dark-3) s2-0) + (get-max-ammo-for-gun *game-info* (pickup-type ammo-dark)) + 0.0 ) + ) + (f4-0 (if (logtest? s2-0 (game-feature gun-yellow-1 gun-yellow-2 gun-yellow-3)) + (-> *game-info* gun-ammo 0) + 0.0 + ) + ) + (f1-2 (if (logtest? s2-0 (game-feature gun-red-1 gun-red-2 gun-red-3)) + (-> *game-info* gun-ammo 1) + 0.0 + ) + ) + (f2-1 (if (logtest? s2-0 (game-feature gun-blue-1 gun-blue-2 gun-blue-3)) + (-> *game-info* gun-ammo 2) + 0.0 + ) + ) + (f3-1 (if (logtest? (game-feature gun-dark-1 gun-dark-2 gun-dark-3) s2-0) + (-> *game-info* gun-ammo 3) + 0.0 + ) + ) + (f22-1 (+ f22-0 (- sv-16 f4-0))) + ) + (if (< 0.0 sv-16) + (set! f22-1 (/ f22-1 sv-16)) + ) + (let ((f1-4 (+ f26-0 (- f20-0 f1-2)))) + (if (< 0.0 f20-0) + (set! f1-4 (/ f1-4 f20-0)) + ) + (let ((f2-3 (+ f28-0 (- f24-0 f2-1)))) + (if (< 0.0 f24-0) + (set! f2-3 (/ f2-3 f24-0)) + ) + (let ((f3-3 (+ f30-0 (- f0-2 f3-1)))) + (if (< 0.0 f0-2) + (set! f3-3 (/ f3-3 f0-2)) + ) + (let ((f26-1 (+ f22-1 f1-4 f2-3 f3-3))) + (when (= f26-1 0.0) + (set! f22-1 1.0) + (set! f26-1 1.0) + ) + (cond + ((!= f26-1 0.0) + (let* ((f24-1 (+ f1-4 f22-1)) + (f28-1 (+ f2-3 f24-1)) + (f30-1 (+ f3-3 f28-1)) + (v1-39 (/ (the-as int (rand-uint31-gen *random-generator*)) 256)) + (v1-40 (the-as number (logior #x3f800000 v1-39))) + (f0-10 (* (+ -1.0 (the-as float v1-40)) f26-1)) + ) + (set! v0-5 (cond + ((and (>= f22-1 f0-10) (logtest? s2-0 (game-feature gun-yellow-1 gun-yellow-2 gun-yellow-3))) + (set! v0-5 15) + (set! (-> arg1 0) (the-as pickup-type v0-5)) + v0-5 + ) + ((and (>= f24-1 f0-10) (logtest? s2-0 (game-feature gun-red-1 gun-red-2 gun-red-3))) + (set! (-> arg1 0) (pickup-type ammo-red)) + (if (>= 1 (mod (the-as int (rand-uint31-gen *random-generator*)) 3)) + (set! (-> arg2 0) (/ (-> arg2 0) 2)) + ) + ) + ((and (>= f28-1 f0-10) (logtest? s2-0 (game-feature gun-blue-1 gun-blue-2 gun-blue-3))) + (set! v0-5 17) + (set! (-> arg1 0) (the-as pickup-type v0-5)) + v0-5 + ) + ((and (>= f30-1 f0-10) (logtest? (game-feature gun-dark-1 gun-dark-2 gun-dark-3) s2-0)) + (set! (-> arg1 0) (pickup-type ammo-dark)) + (set! (-> arg2 0) (the float (the int (fmax 1.0 (/ (-> arg2 0) 15))))) + ) + (else + (pickup-dark-set! arg0 arg1 arg2 arg3) + ) + ) + ) ) - (else - (set! (-> arg1 0) (pickup-type none)) - 0 - ) + ) + (else + (set! (-> arg1 0) (pickup-type none)) + 0 ) ) ) @@ -3310,90 +3317,91 @@ ;; WARN: Stack slot offset 16 signed mismatch ;; WARN: Stack slot offset 16 signed mismatch (defmethod drop-pickup ((this fact-info) (arg0 symbol) (arg1 process-tree) (arg2 fact-info) (arg3 int) (arg4 symbol)) - (local-vars (sv-16 pickup-type) (sv-20 float)) - (set! sv-16 (-> this pickup-type)) - (set! sv-20 (-> this pickup-amount)) - (if (not arg4) - (set! sv-20 (fmin 10.0 sv-20)) - ) - (cond - ((= sv-16 (pickup-type ammo-random)) - (pickup-ammo-set! this (& sv-16) (& sv-20) arg3) - ) - ((= sv-16 (pickup-type eco-pill-random)) - (if (rand-vu-percent? 0.1) - (pickup-light-set! this (& sv-16) (& sv-20) arg3) - (pickup-dark-set! this (& sv-16) (& sv-20) arg3) - ) - ) - ((= sv-16 (pickup-type light-random)) - (cond - ((rand-vu-percent? 0.1) - (pickup-light-set! this (& sv-16) (& sv-20) arg3) + (let ((sv-16 (-> this pickup-type)) + (sv-20 (-> this pickup-amount)) ) - (else - (set! sv-16 (pickup-type none)) - 0 - ) + (if (not arg4) + (set! sv-20 (fmin 10.0 sv-20)) + ) + (cond + ((= sv-16 (pickup-type ammo-random)) + (pickup-ammo-set! this (& sv-16) (& sv-20) arg3) ) - ) - ((= sv-16 (pickup-type ammo-light-random)) - (let ((v1-17 (rand-vu-int-count 100))) + ((= sv-16 (pickup-type eco-pill-random)) + (if (rand-vu-percent? 0.1) + (pickup-light-set! this (& sv-16) (& sv-20) arg3) + (pickup-dark-set! this (& sv-16) (& sv-20) arg3) + ) + ) + ((= sv-16 (pickup-type light-random)) (cond - ((< v1-17 10) + ((rand-vu-percent? 0.1) (pickup-light-set! this (& sv-16) (& sv-20) arg3) ) - ((< v1-17 50) - (pickup-ammo-set! this (& sv-16) (& sv-20) arg3) - ) (else (set! sv-16 (pickup-type none)) 0 ) ) ) - ) - ((= sv-16 (pickup-type ammo-dark-light-random)) - (let ((v1-23 (rand-vu-int-count 100))) - (cond - ((< v1-23 10) - (pickup-light-set! this (& sv-16) (& sv-20) arg3) - ) - ((< v1-23 55) - (pickup-ammo-set! this (& sv-16) (& sv-20) arg3) - ) - (else - (pickup-dark-set! this (& sv-16) (& sv-20) arg3) + ((= sv-16 (pickup-type ammo-light-random)) + (let ((v1-17 (rand-vu-int-count 100))) + (cond + ((< v1-17 10) + (pickup-light-set! this (& sv-16) (& sv-20) arg3) + ) + ((< v1-17 50) + (pickup-ammo-set! this (& sv-16) (& sv-20) arg3) + ) + (else + (set! sv-16 (pickup-type none)) + 0 + ) ) ) ) - ) - ) - (if (= sv-16 (pickup-type none)) - (return (the-as (pointer process) #f)) - ) - (let ((s3-1 (new 'stack-no-clear 'collide-query))) - (vector-copy! (-> s3-1 start-pos) (-> (the-as process-drawable (-> this process)) root trans)) - (set-vector! (-> s3-1 move-dist) 0.0 -81920.0 0.0 1.0) - (+! (-> s3-1 start-pos y) 12288.0) - (let ((v1-33 s3-1)) - (set! (-> v1-33 radius) 40.96) - (set! (-> v1-33 collide-with) (collide-spec backgnd hit-by-others-list pusher)) - (set! (-> v1-33 ignore-process0) #f) - (set! (-> v1-33 ignore-process1) #f) - (set! (-> v1-33 ignore-pat) - (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) + ((= sv-16 (pickup-type ammo-dark-light-random)) + (let ((v1-23 (rand-vu-int-count 100))) + (cond + ((< v1-23 10) + (pickup-light-set! this (& sv-16) (& sv-20) arg3) ) - (set! (-> v1-33 action-mask) (collide-action solid)) + ((< v1-23 55) + (pickup-ammo-set! this (& sv-16) (& sv-20) arg3) + ) + (else + (pickup-dark-set! this (& sv-16) (& sv-20) arg3) + ) + ) + ) + ) ) - (if (>= (fill-and-probe-using-line-sphere *collide-cache* s3-1) 0.0) - (vector-copy! (-> s3-1 start-pos) (-> s3-1 best-other-tri intersect)) - (vector-copy! (-> s3-1 start-pos) (-> (the-as process-drawable (-> this process)) root trans)) + (if (= sv-16 (pickup-type none)) + (return (the-as (pointer process) #f)) ) - (if (= sv-16 (pickup-type fuel-cell)) - (+! (-> s3-1 start-pos y) 6144.0) + (let ((s3-1 (new 'stack-no-clear 'collide-query))) + (vector-copy! (-> s3-1 start-pos) (-> (the-as process-drawable (-> this process)) root trans)) + (set-vector! (-> s3-1 move-dist) 0.0 -81920.0 0.0 1.0) + (+! (-> s3-1 start-pos y) 12288.0) + (let ((v1-33 s3-1)) + (set! (-> v1-33 radius) 40.96) + (set! (-> v1-33 collide-with) (collide-spec backgnd hit-by-others-list pusher)) + (set! (-> v1-33 ignore-process0) #f) + (set! (-> v1-33 ignore-process1) #f) + (set! (-> v1-33 ignore-pat) + (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) + ) + (set! (-> v1-33 action-mask) (collide-action solid)) ) - (birth-pickup-at-point (-> s3-1 start-pos) sv-16 sv-20 arg0 arg1 this) + (if (>= (fill-and-probe-using-line-sphere *collide-cache* s3-1) 0.0) + (vector-copy! (-> s3-1 start-pos) (-> s3-1 best-other-tri intersect)) + (vector-copy! (-> s3-1 start-pos) (-> (the-as process-drawable (-> this process)) root trans)) + ) + (if (= sv-16 (pickup-type fuel-cell)) + (+! (-> s3-1 start-pos y) 6144.0) + ) + (birth-pickup-at-point (-> s3-1 start-pos) sv-16 sv-20 arg0 arg1 this) + ) ) ) diff --git a/test/decompiler/reference/jak3/engine/common-obs/debris_REF.gc b/test/decompiler/reference/jak3/engine/common-obs/debris_REF.gc index 87d1bb9da6..a417b109e5 100644 --- a/test/decompiler/reference/jak3/engine/common-obs/debris_REF.gc +++ b/test/decompiler/reference/jak3/engine/common-obs/debris_REF.gc @@ -267,10 +267,6 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defmethod do-collision ((this debris-group) (idx int)) - (local-vars - (sv-80 (function sound-name sound-id int int int sound-group object sound-id :behavior process-drawable)) - (name sound-name) - ) (let* ((debris-box (-> this boxes idx)) (box-num (-> debris-box num)) (box-start (-> debris-box start)) @@ -343,19 +339,9 @@ (f30-0 (sqrtf (+ (* (-> v1-38 x) (-> v1-38 x)) (* (-> v1-38 z) (-> v1-38 z))))) ) (let ((f28-0 (vector-length (-> s1-0 transv)))) - (when (< (-> s1-0 transv y) -61440.0) - (set! sv-80 sound-play-by-name) - (set! name (-> s1-0 params sound-hit)) - (let ((a1-14 (new-sound-id)) - (a2-5 1024) - (a3-6 0) - (t0-4 0) - (t1-0 0) - (t2-0 (-> s1-0 root)) - ) - (sv-80 name a1-14 a2-5 a3-6 t0-4 (the-as sound-group t1-0) t2-0) + (if (< (-> s1-0 transv y) -61440.0) + (sound-play-by-name (-> s1-0 params sound-hit) (new-sound-id) 1024 0 0 (sound-group) (-> s1-0 root)) ) - ) (vector-reflect! (-> s1-0 transv) (-> s1-0 transv) (-> cquery best-other-tri normal)) (vector-reflect! (-> s1-0 rot-axis) (-> s1-0 rot-axis) (-> cquery best-other-tri normal)) (set! (-> s1-0 rot-angle) f28-0) @@ -508,7 +494,6 @@ ;; definition for function debris-group-init-by-other ;; INFO: Used lq/sq (defbehavior debris-group-init-by-other debris-group ((tuning debris-tuning) (params debris-static-params) (pdraw process-drawable)) - (local-vars (tuning-scale vector) (debris-scale vector) (sv-80 vector) (sv-96 vector) (sv-112 vector)) (rlet ((vf0 :class vf) (vf4 :class vf) (vf5 :class vf) @@ -535,27 +520,27 @@ (vector-matrix*! (-> debris root trans) (-> params joints i offset) joint-transform) ) ) - (set! debris-scale (-> debris root scale)) - (let ((s0-1 (-> debris root scale))) - (set! tuning-scale (new 'stack-no-clear 'vector)) - (set! (-> tuning-scale x) (rand-vu-float-range (-> tuning scale-rand-lo) (-> tuning scale-rand-hi))) - (set! (-> tuning-scale y) (rand-vu-float-range (-> tuning scale-rand-lo) (-> tuning scale-rand-hi))) - (set! (-> tuning-scale z) (rand-vu-float-range (-> tuning scale-rand-lo) (-> tuning scale-rand-hi))) - (set! (-> tuning-scale w) 1.0) - (.lvf vf4 (&-> s0-1 quad)) + (let ((debris-scale (-> debris root scale))) + (let ((s0-1 (-> debris root scale)) + (tuning-scale (new 'stack-no-clear 'vector)) + ) + (set! (-> tuning-scale x) (rand-vu-float-range (-> tuning scale-rand-lo) (-> tuning scale-rand-hi))) + (set! (-> tuning-scale y) (rand-vu-float-range (-> tuning scale-rand-lo) (-> tuning scale-rand-hi))) + (set! (-> tuning-scale z) (rand-vu-float-range (-> tuning scale-rand-lo) (-> tuning scale-rand-hi))) + (set! (-> tuning-scale w) 1.0) + (.lvf vf4 (&-> s0-1 quad)) + (.lvf vf5 (&-> tuning-scale quad)) + ) + (.add.x.vf.w vf6 vf0 vf0) + (.mul.vf.xyz vf6 vf4 vf5) + (.svf (&-> debris-scale quad) vf6) ) - (.lvf vf5 (&-> tuning-scale quad)) - (.add.x.vf.w vf6 vf0 vf0) - (.mul.vf.xyz vf6 vf4 vf5) - (.svf (&-> debris-scale quad) vf6) (case (-> tuning explosion) ((1) (vector-! (-> debris transv) (-> debris root trans) (-> tuning fountain-rand-transv-lo)) - (let ((s0-2 vector-normalize!)) - (set! sv-80 (-> debris transv)) - (let ((a1-17 (rand-vu-float-range (-> tuning fountain-rand-transv-hi x) (-> tuning fountain-rand-transv-hi y)))) - (s0-2 sv-80 a1-17) - ) + (vector-normalize! + (-> debris transv) + (rand-vu-float-range (-> tuning fountain-rand-transv-hi x) (-> tuning fountain-rand-transv-hi y)) ) (+! (-> debris transv y) (rand-vu-float-range (-> tuning fountain-rand-transv-hi z) (-> tuning fountain-rand-transv-hi w)) @@ -563,14 +548,16 @@ (set! (-> debris transv w) 1.0) ) (else - (set! sv-96 (-> tuning fountain-rand-transv-lo)) - (set! sv-112 (-> tuning fountain-rand-transv-hi)) - (set-vector! - (-> debris transv) - (rand-vu-float-range (-> sv-96 x) (-> sv-112 x)) - (rand-vu-float-range (-> sv-96 y) (-> sv-112 y)) - (rand-vu-float-range (-> sv-96 z) (-> sv-112 z)) - 1.0 + (let ((sv-96 (-> tuning fountain-rand-transv-lo)) + (sv-112 (-> tuning fountain-rand-transv-hi)) + ) + (set-vector! + (-> debris transv) + (rand-vu-float-range (-> sv-96 x) (-> sv-112 x)) + (rand-vu-float-range (-> sv-96 y) (-> sv-112 y)) + (rand-vu-float-range (-> sv-96 z) (-> sv-112 z)) + 1.0 + ) ) ) ) diff --git a/test/decompiler/reference/jak3/engine/common-obs/elevator_REF.gc b/test/decompiler/reference/jak3/engine/common-obs/elevator_REF.gc index 3561235ab1..e3fe763b02 100644 --- a/test/decompiler/reference/jak3/engine/common-obs/elevator_REF.gc +++ b/test/decompiler/reference/jak3/engine/common-obs/elevator_REF.gc @@ -253,7 +253,7 @@ (let* ((f0-0 arg1) (f4-0 (- 1.0 arg1)) (f3-0 (/ f0-0 (- 1.0 f4-0))) - (f2-1 (* f0-0 f0-0)) + (f2-1 (square f0-0)) (f1-6 (+ (* 2.0 f0-0 (- f4-0 f0-0)) f2-1)) (f1-7 (+ (* (- 1.0 f4-0) (- 1.0 f4-0) f3-0) f1-6)) ) @@ -265,9 +265,7 @@ (+ (* 2.0 f0-0 (- arg0 f0-0)) f2-1) ) (else - (let ((f0-7 (- 1.0 arg0))) - (- f1-7 (* f0-7 f0-7 f3-0)) - ) + (- f1-7 (* (square (- 1.0 arg0)) f3-0)) ) ) f1-7 @@ -418,27 +416,24 @@ ;; definition for method 49 of type elevator ;; INFO: Used lq/sq (defmethod find-closest-point-in-path! ((this elevator) (arg0 vector) (arg1 (pointer float)) (arg2 symbol) (arg3 symbol)) - (local-vars (sv-32 vector)) (let ((s1-0 (-> this params)) (f28-0 0.0) (f30-0 -1.0) ) (dotimes (s0-0 (-> this path curve num-cverts)) - (set! sv-32 (get-point-in-path! (-> this path) (new 'stack-no-clear 'vector) (the float s0-0) 'interp)) - (when (and (or (not arg2) (< (vector-vector-xz-distance sv-32 arg0) (-> s1-0 xz-threshold))) - (or (not arg3) - (< (fabs (- (-> sv-32 y) (-> arg0 y))) (-> s1-0 y-threshold)) - (and (= s0-0 (the int (-> this bottom-top 0))) (< (-> arg0 y) (-> sv-32 y))) - (and (= s0-0 (the int (-> this bottom-top 1))) (< (-> sv-32 y) (-> arg0 y))) - ) - ) - (let* ((t9-2 vector-vector-distance) - (a1-3 arg0) - (f0-12 (t9-2 sv-32 a1-3)) - ) - (when (or (= f30-0 -1.0) (< f0-12 f28-0)) - (set! f28-0 f0-12) - (set! f30-0 (the float s0-0)) + (let ((sv-32 (get-point-in-path! (-> this path) (new 'stack-no-clear 'vector) (the float s0-0) 'interp))) + (when (and (or (not arg2) (< (vector-vector-xz-distance sv-32 arg0) (-> s1-0 xz-threshold))) + (or (not arg3) + (< (fabs (- (-> sv-32 y) (-> arg0 y))) (-> s1-0 y-threshold)) + (and (= s0-0 (the int (-> this bottom-top 0))) (< (-> arg0 y) (-> sv-32 y))) + (and (= s0-0 (the int (-> this bottom-top 1))) (< (-> sv-32 y) (-> arg0 y))) + ) + ) + (let ((f0-12 (vector-vector-distance sv-32 arg0))) + (when (or (= f30-0 -1.0) (< f0-12 f28-0)) + (set! f28-0 f0-12) + (set! f30-0 (the float s0-0)) + ) ) ) ) @@ -465,7 +460,6 @@ ;; definition for method 48 of type elevator ;; WARN: Return type mismatch int vs none. (defmethod elevator-method-48 ((this elevator)) - (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) @@ -473,12 +467,13 @@ ) ) ) - (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)) - (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)) + (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)) + ) ) ) ) @@ -502,13 +497,13 @@ ;; definition for function teleport-check ;; WARN: Return type mismatch vector vs none. (defbehavior teleport-check elevator () - (local-vars (sv-16 float)) (when (and *target* (logtest? (-> self params flags) (elevator-flags teleport)) (focus-test? *target* teleporting)) - (set! sv-16 (the-as float 0.0)) - (when (find-closest-point-in-path! self (target-pos 0) (& sv-16) #f #t) - (set! (-> self move-pos 0) sv-16) - (set! (-> self move-pos 1) sv-16) - (get-point-in-path! (-> self path) (-> self basetrans) sv-16 'interp) + (let ((sv-16 (the-as float 0.0))) + (when (find-closest-point-in-path! self (target-pos 0) (& sv-16) #f #t) + (set! (-> self move-pos 0) sv-16) + (set! (-> self move-pos 1) sv-16) + (get-point-in-path! (-> self path) (-> self basetrans) sv-16 'interp) + ) ) ) (none) @@ -918,7 +913,6 @@ ;; INFO: Process stack size was changed from 512 to 1024 (defmethod init-from-entity! ((this elevator) (arg0 entity-actor)) "Set up a newly created process from the entity that created it." - (local-vars (sv-32 float) (sv-36 path-control) (sv-40 target)) (stack-size-set! (-> this main-thread) 1024) (set! (-> this sound-running-loop) #f) (set! (-> this sound-arrived) #f) @@ -982,19 +976,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 teleport)) - (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 teleport)) + (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/jak3/engine/common-obs/enemy-states_REF.gc b/test/decompiler/reference/jak3/engine/common-obs/enemy-states_REF.gc index e01af486f2..519d84bca1 100644 --- a/test/decompiler/reference/jak3/engine/common-obs/enemy-states_REF.gc +++ b/test/decompiler/reference/jak3/engine/common-obs/enemy-states_REF.gc @@ -595,9 +595,7 @@ (when (or (not (-> self draw)) (and (or (not v1-2) (!= (-> v1-2 type) target)) (or (not (logtest? (-> self draw status) (draw-control-status on-screen))) - (let ((f0-1 450560.0)) - (< (* f0-1 f0-1) (vector-vector-xz-distance-squared (-> self root trans) (math-camera-pos))) - ) + (< (square 450560.0) (vector-vector-xz-distance-squared (-> self root trans) (math-camera-pos))) ) ) ) @@ -1323,7 +1321,7 @@ (defstate gun-dark-2-stretch (enemy) :virtual #t :event (behavior ((proc process) (argc int) (message symbol) (block event-message-block)) - (local-vars (v0-4 object) (sv-112 event-message-block) (sv-128 event-message-block)) + (local-vars (v0-4 object)) (case message (('attack) (let* ((s5-0 (the-as object (-> block param 1))) @@ -1334,23 +1332,13 @@ ((= v1-1 'gravity-end) (set! (-> self root transv quad) (the-as uint128 0)) (gun-dark-2-ragdoll-start self) - (let* ((s4-1 self) - (s1-0 (method-of-object s4-1 handle-incoming-attack!)) - (s0-0 proc) - ) - (set! sv-112 block) - (let ((a3-1 (get-penetrate-using-from-attack-event (the-as process-drawable proc) block)) - (t1-0 #f) - ) - (s1-0 - s4-1 - (the-as process-drawable s0-0) - sv-112 - a3-1 - (the-as attack-info s5-0) - (the-as touching-shapes-entry t1-0) - ) - ) + (handle-incoming-attack! + self + (the-as process-drawable proc) + block + (get-penetrate-using-from-attack-event (the-as process-drawable proc) block) + (the-as attack-info s5-0) + (the-as touching-shapes-entry #f) ) (damage-enemy-from-attack! self proc block) (set! (-> self incoming penetrate-using) (penetrate vehicle)) @@ -1372,24 +1360,13 @@ ) (else (when (!= (-> (the-as attack-info s5-0) id) (-> self incoming attack-id)) - (let* ((s2-1 self) - (s1-1 (method-of-object s2-1 handle-incoming-attack!)) - (s0-1 proc) - ) - (set! sv-128 block) - (let ((a3-2 (get-penetrate-using-from-attack-event (the-as process-drawable proc) block)) - (t0-1 (the-as uint s5-0)) - (t1-1 (-> block param 0)) - ) - (s1-1 - s2-1 - (the-as process-drawable s0-1) - sv-128 - a3-2 - (the-as attack-info t0-1) - (the-as touching-shapes-entry t1-1) - ) - ) + (handle-incoming-attack! + self + (the-as process-drawable proc) + block + (get-penetrate-using-from-attack-event (the-as process-drawable proc) block) + (the-as attack-info s5-0) + (the-as touching-shapes-entry (-> block param 0)) ) (knocked-handler self s4-0) (let ((gp-1 (-> self child))) diff --git a/test/decompiler/reference/jak3/engine/common-obs/generic-obs_REF.gc b/test/decompiler/reference/jak3/engine/common-obs/generic-obs_REF.gc index bffa6ae2e4..a74993eaaa 100644 --- a/test/decompiler/reference/jak3/engine/common-obs/generic-obs_REF.gc +++ b/test/decompiler/reference/jak3/engine/common-obs/generic-obs_REF.gc @@ -18,10 +18,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)) ) @@ -2393,7 +2393,6 @@ ;; INFO: Process stack size was changed from 16 to 64 (defmethod init-from-entity! ((this part-spawner) (arg0 entity-actor)) "Set up a newly created process from the entity that created it." - (local-vars (sv-16 string)) (stack-size-set! (-> this main-thread) 64) (logior! (-> this mask) (process-mask ambient)) (+! (-> this clock ref-count) -1) @@ -2433,52 +2432,53 @@ ) ) ) - (set! sv-16 "#f") - (set! (-> this mode) (entity-lookup-part-group arg0 (& sv-16) 'art-name)) - (when (-> this mode) - (let ((s5-1 (-> this mode 0))) - (when (and (nonzero? s5-1) (= (-> s5-1 type) sparticle-launch-group)) - (cond - ((logtest? (-> s5-1 flags) (sp-group-flag sp8)) - (countdown (v1-60 (-> s5-1 length)) - (let* ((a0-34 (-> s5-1 launcher v1-60)) - (a2-12 (-> *part-id-table* (-> a0-34 launcher))) - ) - (when (nonzero? a2-12) - (let ((a1-22 (-> this level part-engine))) - (when (and a1-22 (< (-> a1-22 length) (-> a1-22 allocated-length))) - (let ((a3-14 (-> a1-22 data (-> a1-22 length)))) - (set! (-> a3-14 next1) (the-as connectable a2-12)) - (set! (-> a3-14 prev1) (the-as connectable (-> a0-34 hour-mask))) - (set! (-> (the-as vector (&-> a3-14 param0)) quad) (-> this root trans quad)) - (set! (-> a3-14 param3) (the-as int (-> a0-34 fade-after))) + (let ((sv-16 "#f")) + (set! (-> this mode) (entity-lookup-part-group arg0 (& sv-16) 'art-name)) + (when (-> this mode) + (let ((s5-1 (-> this mode 0))) + (when (and (nonzero? s5-1) (= (-> s5-1 type) sparticle-launch-group)) + (cond + ((logtest? (-> s5-1 flags) (sp-group-flag sp8)) + (countdown (v1-60 (-> s5-1 length)) + (let* ((a0-34 (-> s5-1 launcher v1-60)) + (a2-12 (-> *part-id-table* (-> a0-34 launcher))) + ) + (when (nonzero? a2-12) + (let ((a1-22 (-> this level part-engine))) + (when (and a1-22 (< (-> a1-22 length) (-> a1-22 allocated-length))) + (let ((a3-14 (-> a1-22 data (-> a1-22 length)))) + (set! (-> a3-14 next1) (the-as connectable a2-12)) + (set! (-> a3-14 prev1) (the-as connectable (-> a0-34 hour-mask))) + (set! (-> (the-as vector (&-> a3-14 param0)) quad) (-> this root trans quad)) + (set! (-> a3-14 param3) (the-as int (-> a0-34 fade-after))) + ) + (+! (-> a1-22 length) 1) ) - (+! (-> a1-22 length) 1) ) ) ) ) + (process-entity-status! this (entity-perm-status dead) #t) + (deactivate this) ) - (process-entity-status! this (entity-perm-status dead) #t) - (deactivate this) - ) - ((logtest? (-> s5-1 flags) (sp-group-flag sp9)) - (process-entity-status! this (entity-perm-status dead) #t) - (deactivate this) - ) - (else - (set! (-> this part) (create-launch-control s5-1 this)) - (when (logtest? (-> s5-1 flags) (sp-group-flag sp10)) - (process-entity-status! this (entity-perm-status subtask-complete) #t) - (set! (-> this enable) #f) + ((logtest? (-> s5-1 flags) (sp-group-flag sp9)) + (process-entity-status! this (entity-perm-status dead) #t) + (deactivate this) + ) + (else + (set! (-> this part) (create-launch-control s5-1 this)) + (when (logtest? (-> s5-1 flags) (sp-group-flag sp10)) + (process-entity-status! this (entity-perm-status subtask-complete) #t) + (set! (-> this enable) #f) + ) + (go (method-of-object this active)) ) - (go (method-of-object this active)) ) ) ) ) + (go process-drawable-art-error sv-16) ) - (go process-drawable-art-error sv-16) ) ;; definition of type launcher @@ -4050,10 +4050,10 @@ ;; INFO: Used lq/sq (defmethod init-from-entity! ((this part-controller) (arg0 entity-actor)) "Set up a newly created process from the entity that created it." - (local-vars (sv-16 res-tag) (sv-32 string)) (stack-size-set! (-> this main-thread) 32) - (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)) @@ -4093,10 +4093,11 @@ (set! (-> this particle-launchers length) 0) (dotimes (s4-0 (min 1 (-> this actor-group-count))) (dotimes (s3-0 (-> this actor-group s4-0 length)) - (set! sv-32 "#f") - (set! (-> this particle-launchers (-> this particle-launchers length)) - (entity-lookup-part-group (-> this actor-group s4-0 data s3-0 actor) (& sv-32) 'art-name) - ) + (let ((sv-32 "#f")) + (set! (-> this particle-launchers (-> this particle-launchers length)) + (entity-lookup-part-group (-> this actor-group s4-0 data s3-0 actor) (& sv-32) 'art-name) + ) + ) (+! (-> this particle-launchers length) 1) ) ) diff --git a/test/decompiler/reference/jak3/engine/common-obs/water-anim_REF.gc b/test/decompiler/reference/jak3/engine/common-obs/water-anim_REF.gc index bc12e6486a..ce26c84aa5 100644 --- a/test/decompiler/reference/jak3/engine/common-obs/water-anim_REF.gc +++ b/test/decompiler/reference/jak3/engine/common-obs/water-anim_REF.gc @@ -324,14 +324,14 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch quaternion vs none. (defmethod set-offset-and-look! ((this water-anim)) - (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 wanim-look :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)) @@ -388,7 +388,6 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch water-flag vs none. (defmethod water-anim-init! ((this 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 @@ -412,19 +411,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/jak3/engine/common-obs/water-flow_REF.gc b/test/decompiler/reference/jak3/engine/common-obs/water-flow_REF.gc index 79591b5040..284ba225f0 100644 --- a/test/decompiler/reference/jak3/engine/common-obs/water-flow_REF.gc +++ b/test/decompiler/reference/jak3/engine/common-obs/water-flow_REF.gc @@ -123,7 +123,7 @@ ;; definition for method 13 of type flow-control ;; INFO: Used lq/sq (defmethod flow-control-method-13 ((this flow-control) (arg0 water-info) (arg1 vector)) - (local-vars (v0-7 symbol) (sv-192 vector) (sv-208 vector) (sv-224 flow-section)) + (local-vars (v0-7 symbol)) (let ((s5-0 (new 'stack-no-clear 'vector))) (vector-copy! s5-0 arg1) (set! (-> s5-0 w) 1.0) @@ -142,63 +142,51 @@ (f0-9 (- (-> v1-10 y) (* (-> s3-0 pull-dir y) f0-7))) ) (when (and (>= f0-9 -41984.0) (>= 41779.2 f0-9)) - (let ((a0-11 (new 'stack-no-clear 'vector))) - (set! sv-192 (new 'stack-no-clear 'vector)) - (let* ((f30-0 (ray-plane-equation-intersect a0-11 s5-0 (-> s3-0 pull-dir) (the-as vector a3-0))) - (t9-1 ray-plane-equation-intersect) - (a1-5 s5-0) - (a2-4 (-> s3-0 pull-dir)) - (a3-1 (-> s3-0 trailing)) - (f0-10 (t9-1 sv-192 a1-5 a2-4 a3-1)) - ) - (vector+*! (new 'stack-no-clear 'vector) (-> s3-0 start) (-> s3-0 pull-dir) 12288.0) - 0 - (let ((f0-12 (/ f30-0 (- f30-0 f0-10)))) - (set! sv-208 (new 'stack-no-clear 'vector)) - (displacement-between-two-points-normalized! (-> this path) sv-208 (+ (the float (if (= s4-0 (+ s2-0 -1)) - (+ s4-0 -1) - s4-0 - ) - ) - f0-12 - ) - ) + (let* ((a0-11 (new 'stack-no-clear 'vector)) + (sv-192 (new 'stack-no-clear 'vector)) + (f30-0 (ray-plane-equation-intersect a0-11 s5-0 (-> s3-0 pull-dir) (the-as vector a3-0))) + (f0-10 (ray-plane-equation-intersect sv-192 s5-0 (-> s3-0 pull-dir) (-> s3-0 trailing))) + ) + (vector+*! (new 'stack-no-clear 'vector) (-> s3-0 start) (-> s3-0 pull-dir) 12288.0) + 0 + (let ((f0-12 (/ f30-0 (- f30-0 f0-10))) + (sv-208 (new 'stack-no-clear 'vector)) + ) + (displacement-between-two-points-normalized! (-> this path) sv-208 (+ (the float (if (= s4-0 (+ s2-0 -1)) + (+ s4-0 -1) + s4-0 + ) + ) + f0-12 + ) + ) + (let ((v1-22 (new 'stack-no-clear 'vector))) + (vector-float*! v1-22 sv-208 (* (-> s3-0 speed) (seconds-per-frame))) + (vector+*! (new 'stack-no-clear 'vector) s5-0 v1-22 2048.0) ) ) ) - (let ((v1-22 (new 'stack-no-clear 'vector))) - (let ((a0-15 v1-22) - (f0-15 (* (-> s3-0 speed) (seconds-per-frame))) - ) - (vector-float*! a0-15 sv-208 f0-15) - ) - (vector+*! (new 'stack-no-clear 'vector) s5-0 v1-22 2048.0) - ) 0 - (let ((s0-1 (-> s3-0 start))) - (set! sv-224 (-> s1-0 data (if (= s4-0 (+ s2-0 -1)) - (+ s4-0 -1) - (+ s4-0 1) - ) - ) + (let ((s0-1 (-> s3-0 start)) + (sv-224 (-> s1-0 data (if (= s4-0 (+ s2-0 -1)) + (+ s4-0 -1) + (+ s4-0 1) + ) + ) + ) + (s4-1 (new 'stack-no-clear 'vector)) + ) + (let ((s2-1 (new 'stack-no-clear 'vector)) + (s1-1 (new 'stack-no-clear 'vector)) ) - (let ((s4-1 (new 'stack-no-clear 'vector))) - (let ((s2-1 (new 'stack-no-clear 'vector)) - (s1-1 (new 'stack-no-clear 'vector)) - ) - (vector-copy! s2-1 (-> s3-0 pull-dir)) - (vector-normalize! s2-1 1.0) - (vector-cross! s1-1 s2-1 *y-vector*) - (vector-normalize! s1-1 1.0) - (vector-cross! (-> arg0 normal) s2-1 s1-1) - ) - (let ((t9-5 vector-segment-distance-point!) - (a3-2 s4-1) - ) - (t9-5 s5-0 s0-1 (-> sv-224 start) a3-2) - ) - (set! (-> arg0 trans y) (-> s4-1 y)) + (vector-copy! s2-1 (-> s3-0 pull-dir)) + (vector-normalize! s2-1 1.0) + (vector-cross! s1-1 s2-1 *y-vector*) + (vector-normalize! s1-1 1.0) + (vector-cross! (-> arg0 normal) s2-1 s1-1) ) + (vector-segment-distance-point! s5-0 s0-1 (-> sv-224 start) s4-1) + (set! (-> arg0 trans y) (-> s4-1 y)) ) (if (< (-> arg0 normal y) 0.0) (vector-negate! (-> arg0 normal) (-> arg0 normal)) @@ -316,14 +304,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)) ) ) ) @@ -358,14 +342,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) (-> this collide-bounds r))) - ) - (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) (-> this collide-bounds 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)) ) ) ) @@ -419,7 +399,6 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defmethod setup ((this flow-control) (arg0 (pointer float)) (arg1 int)) - (local-vars (sv-32 int) (sv-48 flow-section) (sv-64 int) (sv-80 flow-section)) (let* ((s5-0 (-> this path)) (s4-0 (-> s5-0 curve num-cverts)) (s3-0 (new 'stack-no-clear 'vector)) @@ -429,42 +408,45 @@ (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) - (set! sv-32 (+ s4-0 -1)) - (set! sv-48 (the-as flow-section #f)) - (set! sv-64 0) - (while (< sv-64 sv-32) - (set! sv-80 (-> s0-0 data sv-64)) - (let ((f0-0 1.0)) - (if (< sv-64 arg1) - (set! f0-0 (-> arg0 sv-64)) - ) - (if arg0 - (set! (-> sv-80 speed) (* f0-0 (-> this speed))) - (set! (-> sv-80 speed) (-> this speed)) - ) - ) - (vector-copy! (-> sv-80 start) s3-0) - (get-point-in-path! s5-0 s3-0 (the float (+ sv-64 1)) 'interp) - (vector+! (the-as vector (-> this collide-bounds)) (the-as vector (-> this collide-bounds)) s3-0) - (vector-! (-> sv-80 pull-dir) s3-0 (-> sv-80 start)) - (vector-normalize! (-> sv-80 pull-dir) 1.0) - (set! (-> sv-80 trailing quad) (-> sv-80 pull-dir quad)) - (set! (-> sv-80 trailing y) 0.0) - (vector-normalize! (-> sv-80 trailing) 1.0) - (set-vector! (-> sv-80 radial-dir) (- (-> sv-80 trailing z)) 0.0 (-> sv-80 trailing x) 1.0) - (set! (-> sv-80 trailing w) (- (vector-dot s3-0 (the-as vector (-> sv-80 trailing))))) - (when sv-48 - (vector+! - (the-as vector (-> sv-48 trailing)) - (the-as vector (-> sv-48 trailing)) - (the-as vector (-> sv-80 trailing)) + (let ((sv-32 (+ s4-0 -1)) + (sv-48 (the-as flow-section #f)) + (sv-64 0) ) - (vector-normalize! (-> sv-48 trailing) 1.0) - (set! (-> sv-48 trailing w) (- (vector-dot (-> sv-80 start) (the-as vector (-> sv-48 trailing))))) + (while (< sv-64 sv-32) + (let ((sv-80 (-> s0-0 data sv-64))) + (let ((f0-0 1.0)) + (if (< sv-64 arg1) + (set! f0-0 (-> arg0 sv-64)) + ) + (if arg0 + (set! (-> sv-80 speed) (* f0-0 (-> this speed))) + (set! (-> sv-80 speed) (-> this speed)) + ) + ) + (vector-copy! (-> sv-80 start) s3-0) + (get-point-in-path! s5-0 s3-0 (the float (+ sv-64 1)) 'interp) + (vector+! (the-as vector (-> this collide-bounds)) (the-as vector (-> this collide-bounds)) s3-0) + (vector-! (-> sv-80 pull-dir) s3-0 (-> sv-80 start)) + (vector-normalize! (-> sv-80 pull-dir) 1.0) + (set! (-> sv-80 trailing quad) (-> sv-80 pull-dir quad)) + (set! (-> sv-80 trailing y) 0.0) + (vector-normalize! (-> sv-80 trailing) 1.0) + (set-vector! (-> sv-80 radial-dir) (- (-> sv-80 trailing z)) 0.0 (-> sv-80 trailing x) 1.0) + (set! (-> sv-80 trailing w) (- (vector-dot s3-0 (the-as vector (-> sv-80 trailing))))) + (when sv-48 + (vector+! + (the-as vector (-> sv-48 trailing)) + (the-as vector (-> sv-48 trailing)) + (the-as vector (-> sv-80 trailing)) + ) + (vector-normalize! (-> sv-48 trailing) 1.0) + (set! (-> sv-48 trailing w) (- (vector-dot (-> sv-80 start) (the-as vector (-> sv-48 trailing))))) + ) + (set! sv-48 sv-80) + ) + sv-48 + (+! sv-64 1) ) - (set! sv-48 sv-80) - sv-48 - (set! sv-64 (+ sv-64 1)) ) ) (let ((s2-1 (-> this sections data))) @@ -495,7 +477,6 @@ ;; definition for method 0 of type flow-control ;; INFO: Used lq/sq (defmethod new flow-control ((allocation symbol) (type-to-make type) (arg0 process-drawable) (arg1 res-lump)) - (local-vars (sv-16 res-tag)) (if (not arg1) (set! arg1 (-> arg0 entity)) ) @@ -511,8 +492,9 @@ ) (set! (-> gp-0 speed) (res-lump-float arg1 'speed :default 12288.0)) (set! (-> gp-0 belt-radius) (res-lump-float arg1 'extra-radius :default 16384.0)) - (set! sv-16 (new 'static 'res-tag)) - (let ((a1-6 (res-lump-data arg1 'scale-factor pointer :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (a1-6 (res-lump-data arg1 'scale-factor pointer :tag-ptr (& sv-16))) + ) (setup gp-0 (the-as (pointer float) a1-6) (the-as int (-> sv-16 elt-count))) ) ) diff --git a/test/decompiler/reference/jak3/engine/common-obs/water_REF.gc b/test/decompiler/reference/jak3/engine/common-obs/water_REF.gc index ac2de92487..76acfcbac0 100644 --- a/test/decompiler/reference/jak3/engine/common-obs/water_REF.gc +++ b/test/decompiler/reference/jak3/engine/common-obs/water_REF.gc @@ -274,7 +274,6 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defmethod water-control-method-10 ((this water-control)) - (local-vars (sv-336 (function vector vector vector vector)) (sv-352 vector)) (with-pp (let ((s4-0 (-> this flags)) (s5-0 (new 'stack-no-clear 'water-info)) @@ -387,16 +386,14 @@ (f30-0 (sqrtf (+ (* (-> v1-102 x) (-> v1-102 x)) (* (-> v1-102 z) (-> v1-102 z))))) (s2-0 (new 'stack-no-clear 'matrix)) ) - (let ((s1-0 forward-up->inv-matrix) - (s0-0 s2-0) - ) - (set! sv-336 vector-flatten!) - (set! sv-352 (-> s2-0 fvec)) - (let ((a1-11 (vector-z-quaternion! (-> s2-0 fvec) (-> this process control quat))) - (a2-2 (-> s5-0 normal)) - ) - (s1-0 s0-0 (sv-336 sv-352 a1-11 a2-2) (-> s5-0 normal)) + (forward-up->inv-matrix + s2-0 + (vector-flatten! + (-> s2-0 fvec) + (vector-z-quaternion! (-> s2-0 fvec) (-> this process control quat)) + (-> s5-0 normal) ) + (-> s5-0 normal) ) (vector-copy! (-> s2-0 trans) s3-0) (set! (-> *part-id-table* 762 init-specs 1 initial-valuef) (* 0.000004150391 f30-0)) @@ -818,7 +815,6 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defmethod spawn-ripples ((this water-control) (arg0 float) (arg1 vector) (arg2 int) (arg3 vector) (arg4 symbol)) - (local-vars (sv-112 vector)) (when (and (logtest? (water-flag part-splash) (-> this flags)) (logtest? (water-flag part-water) (-> this flags)) (cond @@ -826,12 +822,7 @@ (= (-> this process type) target) ) ((< 100 (-> *sp-particle-system-3d* num-alloc 0)) - (let ((s2-0 vector-vector-distance)) - (set! sv-112 arg1) - (let ((a1-1 (camera-pos))) - (< (s2-0 sv-112 a1-1) 81920.0) - ) - ) + (< (vector-vector-distance arg1 (camera-pos)) 81920.0) ) (else #t @@ -882,7 +873,6 @@ (arg3 collide-action) (arg4 process-drawable) ) - (local-vars (sv-256 process)) (when (and (-> arg0 prim) (= (-> arg0 prim region) (-> arg1 region))) (set! arg0 arg0) (goto cfg-96) @@ -922,14 +912,13 @@ ) ) (('water-anim) - (set! sv-256 (command-get-process - (-> (the-as pair (-> (the-as pair (-> (the-as pair s1-0) cdr)) cdr)) car) - (the-as process #f) - ) - ) - (let ((s0-0 (if (type? sv-256 process-drawable) - sv-256 + (let ((s0-0 (as-type + (command-get-process + (-> (the-as pair (-> (the-as pair (-> (the-as pair s1-0) cdr)) cdr)) car) + (the-as process #f) ) + process-drawable + ) ) ) (cond @@ -1126,7 +1115,7 @@ ;; INFO: Used lq/sq ;; ERROR: Unsupported inline assembly instruction kind - [movz v1, v1, a0] (defmethod water-info-init! ((this collide-shape) (arg0 water-info) (arg1 collide-action)) - (local-vars (v1-4 int) (a0-3 int) (sv-80 int)) + (local-vars (v1-4 int) (a0-3 int)) (let ((s4-0 (new 'stack-no-clear 'water-info))) (when (find-water-1 (the-as water-sphere (-> this root-prim prim-core)) arg0 s4-0) (let ((s3-0 (new 'static 'inline-array water-sphere 30 @@ -1164,8 +1153,9 @@ ) (s2-0 0) ) - (let ((s0-0 (-> this root-prim))) - (set! sv-80 30) + (let ((s0-0 (-> this root-prim)) + (sv-80 30) + ) (let ((a0-2 sv-80) (v1-3 (-> this total-prims)) ) @@ -1177,7 +1167,7 @@ (format *stdcon* "find-water exceeded FIND_WATER_MAX_PRIMS ~D/~D~%" (-> this total-prims) 30) ) (while (nonzero? sv-80) - (set! sv-80 (+ sv-80 -1)) + (+! sv-80 -1) (when (and (nonzero? (-> s0-0 prim-core prim-type)) (logtest? (-> s0-0 prim-core action) arg1) (nonzero? (-> s0-0 prim-core collide-with)) diff --git a/test/decompiler/reference/jak3/engine/debug/collision-editor_REF.gc b/test/decompiler/reference/jak3/engine/debug/collision-editor_REF.gc index 76779964ef..3da4b20ed6 100644 --- a/test/decompiler/reference/jak3/engine/debug/collision-editor_REF.gc +++ b/test/decompiler/reference/jak3/engine/debug/collision-editor_REF.gc @@ -163,7 +163,6 @@ ;; ERROR: Stack slot load at 288 mismatch: defined as size 4, got size 16 ;; WARN: Return type mismatch int vs none. (defun print-default-collision () - (local-vars (sv-224 matrix) (sv-240 symbol) (sv-256 string) (sv-272 float) (sv-288 float)) (let ((gp-0 (process-spawn collision-editor-default-proc :name "collision-editor-default-proc"))) (when gp-0 (when (and (nonzero? (-> (the-as process-drawable (-> gp-0 0)) draw)) @@ -298,32 +297,30 @@ (vector-float*! s3-0 s3-0 0.5) (vector<-cspace! s1-0 (-> (the-as process-drawable (-> gp-0 0)) node-list data (-> s0-0 transform-index))) (vector-! s1-0 s3-0 s1-0) - (set! sv-224 (new 'stack-no-clear 'matrix)) - (let* ((a0-34 (-> (the-as process-drawable (-> gp-0 0)) node-list data (-> s0-0 transform-index) bone transform)) - (a2-11 (-> a0-34 rvec quad)) - (a1-36 (-> a0-34 uvec quad)) - (v1-53 (-> a0-34 fvec quad)) - (a0-35 (-> a0-34 trans quad)) - ) - (set! (-> sv-224 rvec quad) a2-11) - (set! (-> sv-224 uvec quad) a1-36) - (set! (-> sv-224 fvec quad) v1-53) - (set! (-> sv-224 trans quad) a0-35) - ) - (vector-reset! (-> sv-224 trans)) - (matrix-transpose! sv-224 sv-224) - (vector-matrix*! s1-0 s1-0 sv-224) - (let ((s0-1 format)) - (set! sv-240 #t) - (set! sv-256 " :sphere ((meters ~M) (meters ~M) (meters ~M) (meters ~M))~%") - (set! sv-272 (-> s1-0 x)) - (set! sv-288 (-> s1-0 y)) - (let ((s1-1 (-> s1-0 z)) - (t1-1 (* 1.0001 (vector-vector-distance s3-0 s2-0))) - ) - (set! t0-0 s1-1) - (s0-1 sv-240 sv-256 sv-272 sv-288 t0-0 t1-1) + (let ((sv-224 (new 'stack-no-clear 'matrix))) + (let* ((a0-34 (-> (the-as process-drawable (-> gp-0 0)) node-list data (-> s0-0 transform-index) bone transform)) + (a2-11 (-> a0-34 rvec quad)) + (a1-36 (-> a0-34 uvec quad)) + (v1-53 (-> a0-34 fvec quad)) + (a0-35 (-> a0-34 trans quad)) + ) + (set! (-> sv-224 rvec quad) a2-11) + (set! (-> sv-224 uvec quad) a1-36) + (set! (-> sv-224 fvec quad) v1-53) + (set! (-> sv-224 trans quad) a0-35) ) + (vector-reset! (-> sv-224 trans)) + (matrix-transpose! sv-224 sv-224) + (vector-matrix*! s1-0 s1-0 sv-224) + ) + (let ((s0-1 format) + (sv-240 #t) + (sv-256 " :sphere ((meters ~M) (meters ~M) (meters ~M) (meters ~M))~%") + (sv-272 (-> s1-0 x)) + (sv-288 (-> s1-0 y)) + ) + (set! t0-0 (-> s1-0 z)) + (s0-1 sv-240 sv-256 sv-272 sv-288 t0-0 (* 1.0001 (vector-vector-distance s3-0 s2-0))) ) ) ) @@ -968,7 +965,3 @@ (process-spawn collision-editor gp-2 :name "collision-editor") ) ) - - - - diff --git a/test/decompiler/reference/jak3/engine/debug/debug-sphere_REF.gc b/test/decompiler/reference/jak3/engine/debug/debug-sphere_REF.gc index 279ab04b0c..24e17d417a 100644 --- a/test/decompiler/reference/jak3/engine/debug/debug-sphere_REF.gc +++ b/test/decompiler/reference/jak3/engine/debug/debug-sphere_REF.gc @@ -5,7 +5,6 @@ ;; INFO: Used lq/sq (defun make-debug-sphere-table ((arg0 vector-array) (arg1 float) (arg2 float)) "Create a table of lines on a sphere." - (local-vars (sv-80 vector) (sv-96 vector) (sv-112 int)) (let ((s2-0 (new-stack-vector0)) (f30-0 1.0) (s5-0 0) @@ -15,27 +14,29 @@ (let ((f28-0 (* f30-0 (sin (* (the float s1-0) (/ 32768.0 arg2))))) (f26-0 (* f30-0 (sin (* (the float (+ s1-0 1)) (/ 32768.0 arg2))))) (s0-0 (new-stack-vector0)) + (sv-80 (new 'stack-no-clear 'vector)) ) - (set! sv-80 (new 'stack-no-clear 'vector)) (set! (-> sv-80 quad) (the-as uint128 0)) - (set! sv-96 (new 'stack-no-clear 'vector)) - (set! (-> sv-96 quad) (the-as uint128 0)) - (set! (-> s0-0 y) (+ (-> s2-0 y) (* (cos (* (the float s1-0) (/ 32768.0 arg2))) f30-0))) - (set! (-> sv-80 y) (-> s0-0 y)) - (set! (-> sv-96 y) (+ (-> s2-0 y) (* (cos (* (the float (+ s1-0 1)) (/ 32768.0 arg2))) f30-0))) - (set! sv-112 0) - (while (< sv-112 (the int arg1)) - (set! (-> s0-0 x) (+ (-> s2-0 x) (* (cos (* (the float sv-112) (/ 65536.0 arg1))) f28-0))) - (set! (-> s0-0 z) (+ (-> s2-0 z) (* (sin (* (the float sv-112) (/ 65536.0 arg1))) f28-0))) - (set! (-> sv-80 x) (+ (-> s2-0 x) (* (cos (* (the float (+ sv-112 1)) (/ 65536.0 arg1))) f28-0))) - (set! (-> sv-80 z) (+ (-> s2-0 z) (* (sin (* (the float (+ sv-112 1)) (/ 65536.0 arg1))) f28-0))) - (set! (-> sv-96 x) (+ (-> s2-0 x) (* (cos (* (the float sv-112) (/ 65536.0 arg1))) f26-0))) - (set! (-> sv-96 z) (+ (-> s2-0 z) (* (sin (* (the float sv-112) (/ 65536.0 arg1))) f26-0))) - (vector-copy! (-> arg0 data s5-0) s0-0) - (vector-copy! (-> arg0 data (+ s5-0 1)) sv-80) - (vector-copy! (-> arg0 data (+ s5-0 2)) sv-96) - (+! s5-0 3) - (set! sv-112 (+ sv-112 1)) + (let ((sv-96 (new 'stack-no-clear 'vector))) + (set! (-> sv-96 quad) (the-as uint128 0)) + (set! (-> s0-0 y) (+ (-> s2-0 y) (* (cos (* (the float s1-0) (/ 32768.0 arg2))) f30-0))) + (set! (-> sv-80 y) (-> s0-0 y)) + (set! (-> sv-96 y) (+ (-> s2-0 y) (* (cos (* (the float (+ s1-0 1)) (/ 32768.0 arg2))) f30-0))) + (let ((sv-112 0)) + (while (< sv-112 (the int arg1)) + (set! (-> s0-0 x) (+ (-> s2-0 x) (* (cos (* (the float sv-112) (/ 65536.0 arg1))) f28-0))) + (set! (-> s0-0 z) (+ (-> s2-0 z) (* (sin (* (the float sv-112) (/ 65536.0 arg1))) f28-0))) + (set! (-> sv-80 x) (+ (-> s2-0 x) (* (cos (* (the float (+ sv-112 1)) (/ 65536.0 arg1))) f28-0))) + (set! (-> sv-80 z) (+ (-> s2-0 z) (* (sin (* (the float (+ sv-112 1)) (/ 65536.0 arg1))) f28-0))) + (set! (-> sv-96 x) (+ (-> s2-0 x) (* (cos (* (the float sv-112) (/ 65536.0 arg1))) f26-0))) + (set! (-> sv-96 z) (+ (-> s2-0 z) (* (sin (* (the float sv-112) (/ 65536.0 arg1))) f26-0))) + (vector-copy! (-> arg0 data s5-0) s0-0) + (vector-copy! (-> arg0 data (+ s5-0 1)) sv-80) + (vector-copy! (-> arg0 data (+ s5-0 2)) sv-96) + (+! s5-0 3) + (+! sv-112 1) + ) + ) ) ) ) @@ -55,7 +56,6 @@ ;; WARN: Return type mismatch int vs none. (defun add-debug-sphere-from-table ((arg0 bucket-id) (arg1 vector) (arg2 meters) (arg3 rgba) (arg4 int)) "Draw a sphere out of debug lines, using the precomputed table of lines." - (local-vars (sv-32 vector-array) (sv-36 vector)) (rlet ((vf1 :class vf) (vf2 :class vf) (vf3 :class vf) @@ -67,12 +67,12 @@ (make-debug-sphere-table (new 'debug 'vector-array (* (* 3 arg4) arg4)) (the float arg4) (the float arg4)) ) ) - (set! sv-32 (-> *debug-sphere-table* arg4)) - (set! sv-36 (the-as vector (new-stack-vector0))) - (let ((s2-1 (new-stack-vector0)) - (s1-1 (new-stack-vector0)) - (s0-0 (the-as object (-> sv-32 data))) - ) + (let* ((sv-32 (-> *debug-sphere-table* arg4)) + (sv-36 (the-as vector (new-stack-vector0))) + (s2-1 (new-stack-vector0)) + (s1-1 (new-stack-vector0)) + (s0-0 (the-as object (-> sv-32 data))) + ) (.lvf vf1 (&-> arg1 quad)) (.mov vf2 arg2) (countdown (s4-1 (/ (-> sv-32 length) 3)) diff --git a/test/decompiler/reference/jak3/engine/debug/debug_REF.gc b/test/decompiler/reference/jak3/engine/debug/debug_REF.gc index d56ed05c9f..8753d0effe 100644 --- a/test/decompiler/reference/jak3/engine/debug/debug_REF.gc +++ b/test/decompiler/reference/jak3/engine/debug/debug_REF.gc @@ -164,9 +164,8 @@ ;; WARN: Return type mismatch pointer vs symbol. (defun-debug internal-draw-debug-line ((bucket bucket-id) (p0 vector) (p1 vector) (color rgba) (mode symbol) (color2 rgba)) "Implementation of line drawing DMA." - (local-vars (sv-112 vector) (sv-128 vector) (sv-144 vector)) - (set! sv-112 p1) - (let ((s1-0 color) + (let ((sv-112 p1) + (s1-0 color) (s2-0 mode) (s5-0 color2) ) @@ -187,9 +186,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)) (the-as symbol (when (debug-line-clip? sv-128 sv-144 p0 sv-112) @@ -358,10 +357,9 @@ ;; INFO: Used lq/sq (defun-debug add-debug-flat-triangle ((enable symbol) (bucket bucket-id) (p0 vector) (p1 vector) (p2 vector) (color rgba)) "Draw a shaded triangle." - (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 (or enable *display-capture-mode*)) @@ -1037,73 +1035,61 @@ ;; WARN: Return type mismatch int vs none. (defun-debug add-debug-line-sphere ((enable symbol) (bucket bucket-id) (base vector) (dir vector) (rad float) (color rgba)) "Draw a capsule as a cylinder." - (local-vars - (sv-16 bucket-id) - (sv-24 vector) - (sv-28 vector) - (sv-32 float) - (sv-36 rgba) - (sv-112 matrix) - (sv-116 float) - ) (b! (not enable) cfg-8 :delay (nop!)) - (set! sv-16 bucket) - (set! sv-24 base) - (set! sv-28 dir) - (set! sv-32 rad) - (set! sv-36 color) - (set! sv-112 (new 'stack-no-clear 'matrix)) - (set! sv-116 (vector-length sv-28)) - (let ((gp-0 (new 'stack-no-clear 'vector)) - (s5-0 (new 'stack-no-clear 'vector)) - ) - (vector-normalize-copy! gp-0 sv-28 1.0) - (vector-reset! s5-0) - (let* ((f0-2 (-> gp-0 y)) - (f0-4 (* f0-2 f0-2)) - (f1-0 (-> gp-0 z)) - ) - (if (< f0-4 (* f1-0 f1-0)) + (let* ((sv-16 bucket) + (sv-24 base) + (sv-28 dir) + (sv-32 rad) + (sv-36 color) + (sv-112 (new 'stack-no-clear 'matrix)) + (sv-116 (vector-length sv-28)) + ) + (let ((gp-0 (new 'stack-no-clear 'vector)) + (s5-0 (new 'stack-no-clear 'vector)) + ) + (vector-normalize-copy! gp-0 sv-28 1.0) + (vector-reset! s5-0) + (if (< (square (-> gp-0 y)) (square (-> gp-0 z))) (set! (-> s5-0 y) -1.0) (set! (-> s5-0 z) -1.0) ) + (forward-down->inv-matrix sv-112 gp-0 s5-0) ) - (forward-down->inv-matrix sv-112 gp-0 s5-0) - ) - (vector-copy! (-> sv-112 trans) sv-24) - (set! (-> sv-112 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) + (vector-copy! (-> sv-112 trans) sv-24) + (set! (-> sv-112 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) (* sv-32 (-> s5-1 2 y))) - (set! (-> s1-0 y) (* sv-32 (-> gp-1 2 y))) - (vector-matrix*! s3-0 s1-0 sv-112) - (dotimes (s0-0 10) - (vector-copy! s4-0 s3-0) - (set! (-> s1-0 x) (* sv-32 (-> (&-> s5-1 0 data s0-0) 0))) - (set! (-> s1-0 y) (* sv-32 (-> (&-> gp-1 0 data s0-0) 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) (* sv-32 (-> s5-1 2 y))) + (set! (-> s1-0 y) (* sv-32 (-> gp-1 2 y))) (vector-matrix*! s3-0 s1-0 sv-112) - (add-debug-line #t sv-16 s4-0 s3-0 sv-36 #f (the-as rgba -1)) - (vector+float*! s2-0 s3-0 (-> sv-112 fvec) sv-116) - (add-debug-line #t sv-16 s3-0 s2-0 sv-36 #f (the-as rgba -1)) - (vector+float*! s4-0 s4-0 (-> sv-112 fvec) sv-116) - (add-debug-line #t sv-16 s4-0 s2-0 sv-36 #f (the-as rgba -1)) + (dotimes (s0-0 10) + (vector-copy! s4-0 s3-0) + (set! (-> s1-0 x) (* sv-32 (-> (&-> s5-1 0 data s0-0) 0))) + (set! (-> s1-0 y) (* sv-32 (-> (&-> gp-1 0 data s0-0) 0))) + (vector-matrix*! s3-0 s1-0 sv-112) + (add-debug-line #t sv-16 s4-0 s3-0 sv-36 #f (the-as rgba -1)) + (vector+float*! s2-0 s3-0 (-> sv-112 fvec) sv-116) + (add-debug-line #t sv-16 s3-0 s2-0 sv-36 #f (the-as rgba -1)) + (vector+float*! s4-0 s4-0 (-> sv-112 fvec) sv-116) + (add-debug-line #t sv-16 s4-0 s2-0 sv-36 #f (the-as rgba -1)) + ) ) ) (label cfg-8) @@ -1115,7 +1101,6 @@ ;; INFO: Used lq/sq (defun-debug add-debug-circle ((enable symbol) (bucket bucket-id) (origin vector) (radius float) (color rgba) (mat matrix)) "Draw a circle." - (local-vars (sv-48 int) (sv-64 vector) (sv-80 vector)) "note: you may pass #f for orientation" (if (not (or enable *display-capture-mode*)) (return #f) @@ -1123,20 +1108,22 @@ (let ((f30-0 0.0) (s1-0 (new-stack-vector0)) (s0-0 (new-stack-vector0)) + (sv-48 0) ) - (set! sv-48 0) (while (< sv-48 12) - (set! sv-64 s1-0) - (set! (-> sv-64 x) (* radius (cos f30-0))) - (set! (-> sv-64 y) 0.0) - (set! (-> sv-64 z) (* radius (sin f30-0))) - (set! (-> sv-64 w) 1.0) + (let ((sv-64 s1-0)) + (set! (-> sv-64 x) (* radius (cos f30-0))) + (set! (-> sv-64 y) 0.0) + (set! (-> sv-64 z) (* radius (sin f30-0))) + (set! (-> sv-64 w) 1.0) + ) (set! f30-0 (+ 5461.3335 f30-0)) - (set! sv-80 s0-0) - (set! (-> sv-80 x) (* radius (cos f30-0))) - (set! (-> sv-80 y) 0.0) - (set! (-> sv-80 z) (* radius (sin f30-0))) - (set! (-> sv-80 w) 1.0) + (let ((sv-80 s0-0)) + (set! (-> sv-80 x) (* radius (cos f30-0))) + (set! (-> sv-80 y) 0.0) + (set! (-> sv-80 z) (* radius (sin f30-0))) + (set! (-> sv-80 w) 1.0) + ) (when mat (vector-matrix*! s1-0 s1-0 mat) (vector-matrix*! s0-0 s0-0 mat) @@ -1144,7 +1131,7 @@ (vector+! s1-0 s1-0 origin) (vector+! s0-0 s0-0 origin) (add-debug-line #t bucket s1-0 s0-0 color #f (the-as rgba -1)) - (set! sv-48 (+ sv-48 1)) + (+! sv-48 1) ) ) #f @@ -1213,9 +1200,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 ((arg0 symbol) (arg1 bucket-id) (arg2 vector) (arg3 float) (arg4 float) (arg5 rgba)) - (local-vars (sv-32 float)) - (set! sv-32 arg3) - (let ((s0-0 arg4) + (let ((sv-32 arg3) + (s0-0 arg4) (s3-0 arg5) ) (if (not (or arg0 *display-capture-mode*)) @@ -1241,44 +1227,48 @@ (arg7 matrix) ) "note: you may pass #f for orientation" - (local-vars (sv-48 vector) (sv-64 vector) (sv-80 int) (sv-96 vector) (sv-112 vector)) (if (not (or arg0 *display-capture-mode*)) (return #f) ) - (let ((f30-0 arg3)) - (set! sv-48 (new 'stack-no-clear 'vector)) + (let ((f30-0 arg3) + (sv-48 (new 'stack-no-clear 'vector)) + ) (set! (-> sv-48 quad) (the-as uint128 0)) - (set! sv-64 (new 'stack-no-clear 'vector)) - (set! (-> sv-64 quad) (the-as uint128 0)) - (set! sv-80 0) - (while (< sv-80 12) - (set! sv-96 sv-48) - (set! (-> sv-96 x) (* arg5 (sin f30-0))) - (set! (-> sv-96 y) 0.0) - (set! (-> sv-96 z) (* arg5 (cos f30-0))) - (set! (-> sv-96 w) 1.0) - (+! f30-0 (the float (/ (the int (- arg4 arg3)) 12))) - (set! sv-112 sv-64) - (set! (-> sv-112 x) (* arg5 (sin f30-0))) - (set! (-> sv-112 y) 0.0) - (set! (-> sv-112 z) (* arg5 (cos f30-0))) - (set! (-> sv-112 w) 1.0) - (when arg7 - (vector-matrix*! sv-48 sv-48 arg7) - (vector-matrix*! sv-64 sv-64 arg7) + (let ((sv-64 (new 'stack-no-clear 'vector))) + (set! (-> sv-64 quad) (the-as uint128 0)) + (let ((sv-80 0)) + (while (< sv-80 12) + (let ((sv-96 sv-48)) + (set! (-> sv-96 x) (* arg5 (sin f30-0))) + (set! (-> sv-96 y) 0.0) + (set! (-> sv-96 z) (* arg5 (cos f30-0))) + (set! (-> sv-96 w) 1.0) + ) + (+! f30-0 (the float (/ (the int (- arg4 arg3)) 12))) + (let ((sv-112 sv-64)) + (set! (-> sv-112 x) (* arg5 (sin f30-0))) + (set! (-> sv-112 y) 0.0) + (set! (-> sv-112 z) (* arg5 (cos f30-0))) + (set! (-> sv-112 w) 1.0) + ) + (when arg7 + (vector-matrix*! sv-48 sv-48 arg7) + (vector-matrix*! sv-64 sv-64 arg7) + ) + (vector+! sv-48 sv-48 arg2) + (vector+! sv-64 sv-64 arg2) + (add-debug-line #t arg1 sv-48 sv-64 arg6 #f (the-as rgba -1)) + (cond + ((zero? sv-80) + (add-debug-line #t arg1 sv-48 arg2 arg6 #f (the-as rgba -1)) + ) + ((= sv-80 11) + (add-debug-line #t arg1 sv-64 arg2 arg6 #f (the-as rgba -1)) + ) + ) + (+! sv-80 1) + ) ) - (vector+! sv-48 sv-48 arg2) - (vector+! sv-64 sv-64 arg2) - (add-debug-line #t arg1 sv-48 sv-64 arg6 #f (the-as rgba -1)) - (cond - ((zero? sv-80) - (add-debug-line #t arg1 sv-48 arg2 arg6 #f (the-as rgba -1)) - ) - ((= sv-80 11) - (add-debug-line #t arg1 sv-64 arg2 arg6 #f (the-as rgba -1)) - ) - ) - (set! sv-80 (+ sv-80 1)) ) ) #f @@ -1294,21 +1284,23 @@ (arg5 int) (arg6 rgba) ) - (local-vars (sv-48 vector) (sv-64 int) (sv-80 int)) (if (not (or arg0 *display-capture-mode*)) (return #f) ) - (let ((s0-0 (new-stack-vector0))) - (set! sv-48 (new 'stack-no-clear 'vector)) + (let ((s0-0 (new-stack-vector0)) + (sv-48 (new 'stack-no-clear 'vector)) + ) (set! (-> sv-48 quad) (the-as uint128 0)) - (set! sv-64 (* arg3 4)) - (curve-evaluate! sv-48 (-> arg4 0) arg2 arg3 arg4 arg5) - (set! sv-80 0) - (while (< sv-80 sv-64) - (vector-copy! s0-0 sv-48) - (curve-evaluate! sv-48 (/ (the float (+ sv-80 1)) (the float sv-64)) arg2 arg3 arg4 arg5) - (add-debug-line #t arg1 s0-0 sv-48 arg6 #f (the-as rgba -1)) - (set! sv-80 (+ sv-80 1)) + (let ((sv-64 (* arg3 4))) + (curve-evaluate! sv-48 (-> arg4 0) arg2 arg3 arg4 arg5) + (let ((sv-80 0)) + (while (< sv-80 sv-64) + (vector-copy! s0-0 sv-48) + (curve-evaluate! sv-48 (/ (the float (+ sv-80 1)) (the float sv-64)) arg2 arg3 arg4 arg5) + (add-debug-line #t arg1 s0-0 sv-48 arg6 #f (the-as rgba -1)) + (+! sv-80 1) + ) + ) ) ) #f @@ -1325,48 +1317,26 @@ ;; definition (debug) for function add-debug-points ;; INFO: Used lq/sq (defun-debug add-debug-points ((arg0 symbol) (arg1 bucket-id) (arg2 (inline-array vector)) (arg3 int) (arg4 rgba) (arg5 float) (arg6 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)) - (sv-96 vector) - ) (when (and arg0 (not *display-capture-mode*)) (dotimes (s0-0 arg3) - (set! sv-96 (new 'stack-no-clear 'vector)) - (set! (-> sv-96 quad) (the-as uint128 0)) - (vector-copy! sv-96 (-> arg2 s0-0)) - (if (!= arg5 0.0) - (set! (-> sv-96 y) arg5) + (let ((sv-96 (new 'stack-no-clear 'vector))) + (set! (-> sv-96 quad) (the-as uint128 0)) + (vector-copy! sv-96 (-> arg2 s0-0)) + (if (!= arg5 0.0) + (set! (-> sv-96 y) arg5) + ) + (let ((sv-32 add-debug-text-3d) + (sv-48 #t) + (sv-64 arg1) + ) + (format (clear *temp-string*) "~d" s0-0) + (sv-32 sv-48 sv-64 *temp-string* sv-96 (font-color white) (the-as vector2h #f)) ) - (set! sv-32 add-debug-text-3d) - (set! sv-48 #t) - (set! sv-64 arg1) - (set! sv-80 format) - (let ((a0-5 (clear *temp-string*)) - (a1-1 "~d") - (a2-1 s0-0) - ) - (sv-80 a0-5 a1-1 a2-1) - ) - (let ((a2-2 *temp-string*) - (a3-1 sv-96) - (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 arg1) - (a3-2 (if (= s0-0 arg6) - (the-as uint #x80ffffff) - (the-as uint arg4) - ) - ) - ) - (t9-3 a0-7 a1-3 sv-96 (the-as rgba a3-2)) + (add-debug-x #t arg1 sv-96 (if (= s0-0 arg6) + (new 'static 'rgba :r #xff :g #xff :b #xff :a #x80) + (the-as rgba arg4) + ) + ) ) ) ) @@ -1378,10 +1348,9 @@ ;; WARN: Stack slot offset 32 signed mismatch ;; WARN: Stack slot offset 32 signed mismatch (defun-debug debug-percent-bar ((arg0 symbol) (arg1 bucket-id) (arg2 int) (arg3 int) (arg4 float) (arg5 rgba) (arg6 int) (arg7 int)) - (local-vars (sv-16 int) (sv-32 float)) - (set! sv-16 arg3) - (set! sv-32 arg4) - (let ((s3-0 arg5) + (let ((sv-16 arg3) + (sv-32 arg4) + (s3-0 arg5) (s1-0 arg6) (s2-0 arg7) ) @@ -1819,9 +1788,9 @@ ;; 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 ((arg0 bucket-id) (arg1 (inline-array vector)) (arg2 int) (arg3 rgba) (arg4 rgba) (arg5 int)) - (local-vars (sv-16 dma-packet) (sv-32 rgba) (sv-48 int) (sv-64 int) (sv-80 int)) - (set! sv-32 arg4) - (let ((s1-0 arg5)) + (let ((sv-32 arg4) + (s1-0 arg5) + ) (if (< arg2 3) (return 0) ) @@ -1833,22 +1802,16 @@ (test-1 (new 'static 'gs-test :zte #x1 :ztst (gs-ztest greater-equal))) (alpha-1 (new 'static 'gs-alpha :b #x1 :d #x1)) ) - (set! sv-16 (the-as dma-packet (-> s2-0 base))) - (&+! (-> s2-0 base) 16) - (add-boundary-shader (new 'static 'texture-id :index #x3 :page #x1) s2-0) - (let ((t9-1 add-debug-bound-internal) - (a0-9 s2-0) - (a1-13 arg1) - (a2-1 arg2) - (t1-1 s1-0) - ) - (t9-1 a0-9 a1-13 a2-1 arg3 sv-32 t1-1) - ) - (close-sky-buffer s2-0) - (let ((v1-16 (/ (+ (- -16 (the-as int sv-16)) (the-as int (-> s2-0 base))) 16))) - (set! (-> sv-16 dma) (new 'static 'dma-tag :id (dma-tag-id cnt) :qwc v1-16)) - (set! (-> 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-16)) + (let ((sv-16 (the-as dma-packet (-> s2-0 base)))) + (&+! (-> s2-0 base) 16) + (add-boundary-shader (new 'static 'texture-id :index #x3 :page #x1) s2-0) + (add-debug-bound-internal s2-0 arg1 arg2 arg3 sv-32 s1-0) + (close-sky-buffer s2-0) + (let ((v1-16 (/ (+ (- -16 (the-as int sv-16)) (the-as int (-> s2-0 base))) 16))) + (set! (-> sv-16 dma) (new 'static 'dma-tag :id (dma-tag-id cnt) :qwc v1-16)) + (set! (-> 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-16)) + ) ) (dma-buffer-add-gs-set s2-0 (zbuf-1 (new 'static 'gs-zbuf :zbp #x130 :psm (gs-psm ct24))) @@ -1865,21 +1828,22 @@ (add-debug-line #t arg0 (-> arg1 0) (-> arg1 1) (the-as rgba s1-1) #f (the-as rgba -1)) (add-debug-line #t arg0 (-> arg1 0) (-> arg1 2) (the-as rgba s1-1) #f (the-as rgba -1)) (add-debug-line #t arg0 (-> arg1 (+ arg2 -1)) (-> arg1 (+ arg2 -2)) (the-as rgba s1-1) #f (the-as rgba -1)) - (set! sv-48 0) - (while (< sv-48 s0-1) - (let* ((a2-5 (+ (* sv-48 2) 1)) - (v1-31 (+ a2-5 2)) - ) - (set! sv-64 (+ a2-5 1)) - (set! sv-80 (+ sv-64 2)) - (if (< sv-64 arg2) - (add-debug-line #t arg0 (-> arg1 a2-5) (-> arg1 v1-31) (the-as rgba s1-1) #f (the-as rgba -1)) - ) - ) - (if (< sv-80 arg2) - (add-debug-line #t arg0 (-> arg1 sv-64) (-> arg1 sv-80) (the-as rgba s1-1) #f (the-as rgba -1)) + (let ((sv-48 0)) + (while (< sv-48 s0-1) + (let* ((a2-5 (+ (* sv-48 2) 1)) + (v1-31 (+ a2-5 2)) + (sv-64 (+ a2-5 1)) + (sv-80 (+ sv-64 2)) + ) + (if (< sv-64 arg2) + (add-debug-line #t arg0 (-> arg1 a2-5) (-> arg1 v1-31) (the-as rgba s1-1) #f (the-as rgba -1)) + ) + (if (< sv-80 arg2) + (add-debug-line #t arg0 (-> arg1 sv-64) (-> arg1 sv-80) (the-as rgba s1-1) #f (the-as rgba -1)) + ) ) - (set! sv-48 (+ sv-48 1)) + (+! sv-48 1) + ) ) ) ) diff --git a/test/decompiler/reference/jak3/engine/debug/default-menu_REF.gc b/test/decompiler/reference/jak3/engine/debug/default-menu_REF.gc index 93a73237f1..6e9c4af281 100644 --- a/test/decompiler/reference/jak3/engine/debug/default-menu_REF.gc +++ b/test/decompiler/reference/jak3/engine/debug/default-menu_REF.gc @@ -799,7 +799,6 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch number vs object. (defun dm-debug-actor-lod-dist ((arg0 int) (arg1 debug-menu-msg) (arg2 float)) - (local-vars (sv-16 res-tag)) (when (= arg1 (debug-menu-msg press)) (when (and *debug-actor* (>= (-> (the-as process-drawable *debug-actor*) draw lod-set max-lod) (/ arg0 8))) (let ((a0-4 (&+ (-> (the-as process-drawable *debug-actor*) draw jgeo extra data-base) (* (/ arg0 8) 4)))) @@ -810,22 +809,21 @@ ) (cond (*debug-actor* - (let ((f30-0 0.00024414062)) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-21 (res-lump-data - (-> (the-as process-drawable *debug-actor*) draw jgeo extra) - 'lod-dist - (pointer float) - :tag-ptr (& sv-16) - ) - ) - ) - (* f30-0 (if (and v1-21 (< (/ arg0 8) (the-as int (-> sv-16 elt-count)))) - (-> v1-21 (/ arg0 8)) - 0.0 - ) + (let* ((f30-0 0.00024414062) + (sv-16 (new 'static 'res-tag)) + (v1-21 (res-lump-data + (-> (the-as process-drawable *debug-actor*) draw jgeo extra) + 'lod-dist + (pointer float) + :tag-ptr (& sv-16) + ) + ) ) - ) + (* f30-0 (if (and v1-21 (< (/ arg0 8) (the-as int (-> sv-16 elt-count)))) + (-> v1-21 (/ arg0 8)) + 0.0 + ) + ) ) ) (else @@ -2821,22 +2819,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) - (sv-208 symbol) - (sv-224 type) - ) (let ((s4-0 *level-load-list*) (s5-0 '()) ) @@ -2848,34 +2830,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)) ) @@ -2894,20 +2862,7 @@ (set! a2-6 (car s4-1)) ) ) - (let ((s4-2 (method-of-type pair new)) - (s3-1 'global) - (s2-1 pair) - (s1-1 'menu) - (s0-1 (method-of-type pair new)) - ) - (set! sv-208 'global) - (set! sv-224 pair) - (let ((a2-7 (symbol->string-debug arg1)) - (a3-6 s5-1) - ) - (s4-2 s3-1 s2-1 s1-1 (s0-1 sv-208 sv-224 a2-7 a3-6)) - ) - ) + (cons 'menu (cons (symbol->string-debug arg1) s5-1)) ) ) ) @@ -2915,77 +2870,27 @@ ;; definition for function debug-menu-make-task-sub-menu ;; INFO: Used lq/sq (defun debug-menu-make-task-sub-menu ((arg0 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 int) - (sv-208 symbol) - (sv-224 type) - ) (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) + ) ) - ) ) ) ) ) - (let ((s4-1 (method-of-type pair new)) - (s3-1 'global) - (s2-1 pair) - (s1-1 'menu) - (s0-1 (method-of-type pair new)) - ) - (set! sv-208 'global) - (set! sv-224 pair) - (let ((a2-5 (symbol->string-debug arg0)) - (a3-5 gp-0) - ) - (s4-1 s3-1 s2-1 s1-1 (s0-1 sv-208 sv-224 a2-5 a3-5)) - ) - ) + (cons 'menu (cons (symbol->string-debug arg0) gp-0)) ) ) ;; 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)) ) @@ -3011,14 +2916,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)) @@ -3090,43 +2990,7 @@ ;; 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 type) - (sv-32 (function symbol type object object pair)) - (sv-48 symbol) - (sv-64 type) - (sv-80 symbol) - (sv-96 (function symbol type object object pair)) - (sv-112 symbol) - (sv-128 type) - (sv-144 string) - (sv-160 (function symbol type object object pair)) - (sv-176 symbol) - (sv-192 type) - (sv-208 symbol) - (sv-224 type) - (sv-240 (function symbol type object object pair)) - (sv-256 symbol) - (sv-272 type) - (sv-288 symbol) - (sv-304 (function symbol type object object pair)) - (sv-320 symbol) - (sv-336 type) - (sv-352 (function symbol type object object pair)) - (sv-368 symbol) - (sv-384 type) - (sv-400 int) - (sv-416 type) - (sv-432 symbol) - (sv-448 (function symbol type object object pair)) - (sv-464 symbol) - (sv-480 type) - (sv-496 string) - (sv-512 (function symbol type object object pair)) - (sv-528 symbol) - (sv-544 type) - (sv-560 symbol) - ) + (local-vars (sv-144 string)) (let ((s5-0 '())) (let ((s2-0 #x200000)) (countdown (s4-0 (-> *game-info* play-list length)) @@ -3139,97 +3003,55 @@ (when (!= s1-0 s2-0) (let ((s2-1 (method-of-type pair new)) (s0-0 'global) + (sv-16 pair) + (sv-32 (method-of-type pair new)) + (sv-48 'global) + (sv-64 pair) + (sv-80 'function) + (sv-96 (method-of-type pair new)) + (sv-112 'global) + (sv-128 pair) ) - (set! sv-16 pair) - (set! sv-32 (method-of-type pair new)) - (set! sv-48 'global) - (set! sv-64 pair) - (set! sv-80 'function) - (set! sv-96 (method-of-type pair new)) - (set! sv-112 'global) - (set! sv-128 pair) - (cond - ((logtest? (game-task-node-flag act3) s1-0) - (set! sv-144 "=== Burning Bush ===") - ) - ((logtest? (game-task-node-flag act2) s1-0) - (set! sv-144 "====== ACT 3 ======") - ) - ((logtest? (game-task-node-flag act1) s1-0) - (set! sv-144 "====== ACT 2 ======") - ) - (else - (set! sv-144 "======= END =======") - ) - ) - (set! sv-160 (method-of-type pair new)) - (set! sv-176 'global) - (set! sv-192 pair) - (set! sv-208 (the-as symbol #f)) - (let* ((a3-1 (cons 'nothing '())) - (a3-2 (sv-160 sv-176 sv-192 sv-208 a3-1)) - (a3-3 (sv-96 sv-112 sv-128 sv-144 a3-2)) - (a2-4 (sv-32 sv-48 sv-64 sv-80 a3-3)) - ) - (set! s5-0 (s2-1 s0-0 sv-16 a2-4 s5-0)) - ) + (set! sv-144 (cond + ((logtest? (game-task-node-flag act3) s1-0) + (set! sv-144 "=== Burning Bush ===") + sv-144 + ) + ((logtest? (game-task-node-flag act2) s1-0) + (set! sv-144 "====== ACT 3 ======") + sv-144 + ) + ((logtest? (game-task-node-flag act1) s1-0) + (set! sv-144 "====== ACT 2 ======") + sv-144 + ) + (else + "======= END =======" + ) + ) + ) + (set! s5-0 + (s2-1 + s0-0 + sv-16 + (sv-32 sv-48 sv-64 sv-80 (sv-96 sv-112 sv-128 sv-144 (cons (the-as symbol #f) (cons 'nothing '())))) + s5-0 + ) + ) ) (set! s2-0 (the-as int s1-0)) ) ) - (let ((s1-1 (method-of-type pair new)) - (s0-1 'global) - ) - (set! sv-224 pair) - (set! sv-240 (method-of-type pair new)) - (set! sv-256 'global) - (set! sv-272 pair) - (set! sv-288 'function) - (set! sv-304 (method-of-type pair new)) - (set! sv-320 'global) - (set! sv-336 pair) - (let ((s3-1 (-> s3-0 name))) - (set! sv-352 (method-of-type pair new)) - (set! sv-368 'global) - (set! sv-384 pair) - (set! sv-400 (* s4-0 8)) - (let* ((a3-6 (cons 'dm-play-task '())) - (a3-7 (sv-352 sv-368 sv-384 sv-400 a3-6)) - (a3-8 (sv-304 sv-320 sv-336 s3-1 a3-7)) - (a2-9 (sv-240 sv-256 sv-272 sv-288 a3-8)) - (a3-9 s5-0) - ) - (set! s5-0 (s1-1 s0-1 sv-224 a2-9 a3-9)) - ) - ) - ) + (set! s5-0 (cons (cons 'function (cons (-> s3-0 name) (cons (* s4-0 8) (cons 'dm-play-task '())))) s5-0)) ) ) ) ) - (let ((s4-1 (method-of-type pair new)) - (s3-2 'global) - (s2-2 pair) - (s1-2 (method-of-type pair new)) - (s0-2 'global) + (let ((a3-15 + (cons (cons 'function (cons "====== ACT 1 ======" (cons (the-as symbol #f) (cons 'nothing '())))) s5-0) + ) ) - (set! sv-416 pair) - (set! sv-432 'function) - (set! sv-448 (method-of-type pair new)) - (set! sv-464 'global) - (set! sv-480 pair) - (set! sv-496 "====== ACT 1 ======") - (set! sv-512 (method-of-type pair new)) - (set! sv-528 'global) - (set! sv-544 pair) - (set! sv-560 (the-as symbol #f)) - (let* ((a3-11 (cons 'nothing '())) - (a3-12 (sv-512 sv-528 sv-544 sv-560 a3-11)) - (a3-13 (sv-448 sv-464 sv-480 sv-496 a3-12)) - (a3-15 (s4-1 s3-2 s2-2 (s1-2 s0-2 sv-416 sv-432 a3-13) s5-0)) - ) - (debug-menu-make-from-template arg0 (cons 'menu (cons "Play" a3-15))) - ) + (debug-menu-make-from-template arg0 (cons 'menu (cons "Play" a3-15))) ) ) ) @@ -3298,7 +3120,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 @@ -3961,14 +3782,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/jak3/engine/debug/editable-player_REF.gc b/test/decompiler/reference/jak3/engine/debug/editable-player_REF.gc index 5de433b6d5..dcb0abd9a8 100644 --- a/test/decompiler/reference/jak3/engine/debug/editable-player_REF.gc +++ b/test/decompiler/reference/jak3/engine/debug/editable-player_REF.gc @@ -211,31 +211,32 @@ ;; definition for function update-manipulator-position ;; INFO: Used lq/sq (defun update-manipulator-position ((arg0 editable-array) (arg1 manipulator)) - (local-vars (sv-32 vector) (sv-40 int) (sv-48 euler-angles)) - (set! sv-32 (new-stack-vector0)) - (set! sv-40 0) - (set! sv-48 (the-as euler-angles #f)) - (let* ((s4-0 (-> arg0 length)) - (s3-0 0) - (s2-0 (-> arg0 data s3-0)) - ) - (while (< s3-0 s4-0) - (when (and s2-0 (logtest? (-> s2-0 flags) (editable-flag selected))) - (set! sv-48 (the-as euler-angles (get-null-vec s2-0))) - (vector+! sv-32 sv-32 (editable-method-15 s2-0)) - (set! sv-40 (+ sv-40 1)) - (if (not (-> arg0 region-lock?)) - (set! (-> arg0 region) (-> s2-0 region)) - ) + (let ((sv-32 (new-stack-vector0)) + (sv-40 0) + (sv-48 (the-as euler-angles #f)) + ) + (let* ((s4-0 (-> arg0 length)) + (s3-0 0) + (s2-0 (-> arg0 data s3-0)) + ) + (while (< s3-0 s4-0) + (when (and s2-0 (logtest? (-> s2-0 flags) (editable-flag selected))) + (set! sv-48 (the-as euler-angles (get-null-vec s2-0))) + (vector+! sv-32 sv-32 (editable-method-15 s2-0)) + (+! sv-40 1) + (if (not (-> arg0 region-lock?)) + (set! (-> arg0 region) (-> s2-0 region)) + ) + ) + (+! s3-0 1) + (set! s2-0 (-> arg0 data s3-0)) ) - (+! s3-0 1) - (set! s2-0 (-> arg0 data s3-0)) ) - ) - (when (nonzero? sv-40) - (vector-float*! (-> arg1 position) sv-32 (/ 1.0 (the float sv-40))) - (set! (-> arg1 angles quad) (-> sv-48 quad)) - (eul->matrix (-> arg1 mat) sv-48) + (when (nonzero? sv-40) + (vector-float*! (-> arg1 position) sv-32 (/ 1.0 (the float sv-40))) + (set! (-> arg1 angles quad) (-> sv-48 quad)) + (eul->matrix (-> arg1 mat) sv-48) + ) ) ) @@ -701,277 +702,270 @@ ;; definition for function execute-mouse-move ;; INFO: Used lq/sq (defun execute-mouse-move ((arg0 editable-array) (arg1 editable-command) (arg2 mouse-info) (arg3 manipulator)) - (local-vars - (v0-2 object) - (sv-128 (function vector vector float vector)) - (sv-144 vector) - (sv-160 vector) - (sv-176 vector) - (sv-192 vector) - ) + (local-vars (v0-2 object)) (rlet ((vf0 :class vf) (vf4 :class vf) (vf5 :class vf) (vf6 :class vf) ) (init-vf0-vector) - (set! v0-2 (cond - ((= arg1 (editable-command camera-tumble)) - (set-setting! 'mouse-input 'abs #t 0) - (let ((s5-1 (new-stack-vector0)) - (f30-0 0.0) - ) - (let* ((s4-1 (-> arg0 length)) - (s3-0 0) - (a0-2 (-> arg0 data s3-0)) - ) - (while (< s3-0 s4-1) - (when (and a0-2 (logtest? (-> a0-2 flags) (editable-flag selected))) - (vector+! s5-1 s5-1 (editable-method-15 a0-2)) - (set! f30-0 (+ 1.0 f30-0)) - ) - (+! s3-0 1) - (set! a0-2 (-> arg0 data s3-0)) - ) + (set! v0-2 + (cond + ((= arg1 (editable-command camera-tumble)) + (set-setting! 'mouse-input 'abs #t 0) + (let ((s5-1 (new-stack-vector0)) + (f30-0 0.0) + ) + (let* ((s4-1 (-> arg0 length)) + (s3-0 0) + (a0-2 (-> arg0 data s3-0)) ) - (cond - ((= f30-0 0.0) - (remove-setting! 'mouse-tumble-point) - ) - (else - (vector-float/! s5-1 s5-1 f30-0) - (set-setting! 'mouse-tumble-point 'abs s5-1 0) - ) - ) - ) - ) - ((= arg1 (editable-command camera-xy)) - (set-setting! 'mouse-input 'abs #t 0) - ) - ((= arg1 (editable-command camera-xz)) - (set-setting! 'mouse-input 'abs #t 0) - ) - ((= arg1 (editable-command drag-move)) - (let* ((s4-2 (-> arg0 length)) - (s3-1 0) - (a0-8 (-> arg0 data s3-1)) - ) - (while (< s3-1 s4-2) - (if (and a0-8 (logtest? (-> a0-8 flags) (editable-flag selected))) - (editable-method-17 a0-8 (-> arg3 speed) (editable-flag no-update)) - ) - (+! s3-1 1) - (set! a0-8 (-> arg0 data s3-1)) - ) - ) - (let* ((s5-2 (-> arg0 length)) - (s4-3 0) - (a0-9 (-> arg0 data s4-3)) - ) - (while (< s4-3 s5-2) - (if (and a0-9 (logtest? (-> a0-9 flags) (editable-flag selected))) - (editable-method-30 a0-9 (editable-flag)) - ) - (+! s4-3 1) - (set! a0-9 (-> arg0 data s4-3)) - ) - ) - (cleanup-selection arg0) - ) - ((= arg1 (editable-command snap-rotate)) - (let* ((s4-4 (-> arg0 length)) - (s3-2 0) - (a0-11 (-> arg0 data s3-2)) - ) - (while (< s3-2 s4-4) - (if (and a0-11 (logtest? (-> a0-11 flags) (editable-flag selected))) - (editable-method-35 a0-11 (-> *editable* 0 mouse-normal)) - ) - (+! s3-2 1) - (set! a0-11 (-> arg0 data s3-2)) - ) - ) - (let* ((s4-5 (-> arg0 length)) - (s3-3 0) - (a0-12 (-> arg0 data s3-3)) - ) - (while (< s3-3 s4-5) - (if (and a0-12 (logtest? (-> a0-12 flags) (editable-flag selected))) - (editable-method-30 a0-12 (editable-flag)) - ) - (+! s3-3 1) - (set! a0-12 (-> arg0 data s3-3)) - ) - ) - (cleanup-selection arg0) - (update-manipulator-position arg0 arg3) - ) - ((= arg1 (editable-command drag-rotate)) - (let ((v1-70 0)) - (let* ((a0-15 (-> arg0 length)) - (a1-22 0) - (a3-5 (-> arg0 data a1-22)) - ) - (while (< a1-22 a0-15) - (if (and a3-5 (logtest? (-> a3-5 flags) (editable-flag selected))) - (+! v1-70 1) - ) - (+! a1-22 1) - (set! a3-5 (-> arg0 data a1-22)) - ) - ) - (cond - ((= v1-70 1) - (let* ((s4-6 (-> arg0 length)) - (s3-4 0) - (a0-19 (-> arg0 data s3-4)) - ) - (while (< s3-4 s4-6) - (if (and a0-19 (logtest? (-> a0-19 flags) (editable-flag selected))) - (get-null-vec2 a0-19 (-> arg3 angles)) - ) - (+! s3-4 1) - (set! a0-19 (-> arg0 data s3-4)) - ) - ) - ) - (else - (let* ((s3-5 (-> arg0 length)) - (s2-1 0) - (s1-2 (-> arg0 data s2-1)) - ) - (while (< s2-1 s3-5) - (when (and s1-2 (logtest? (-> s1-2 flags) (editable-flag selected))) - (let ((s0-0 (new 'stack-no-clear 'vector))) - (set! sv-176 (new 'stack-no-clear 'vector)) - (set! sv-128 vector-rotate-around-y!) - (set! sv-144 (new 'stack-no-clear 'vector)) - (set! sv-160 (new 'stack-no-clear 'vector)) - (let ((v1-92 (editable-method-15 s1-2)) - (a0-23 (-> arg3 position)) - ) - (.lvf vf4 (&-> v1-92 quad)) - (.lvf vf5 (&-> a0-23 quad)) - ) - (.mov.vf.w vf6 vf0) - (.sub.vf.xyz vf6 vf4 vf5) - (.svf (&-> sv-160 quad) vf6) - (let* ((a2-16 (* 182.04445 (- (-> arg2 posx) (-> arg2 pos 1 x)))) - (v0-11 (sv-128 sv-144 sv-160 a2-16)) - (v1-95 (-> arg3 position)) - ) - (.mov.vf.w vf6 vf0) - (.lvf vf4 (&-> v0-11 quad)) - (.lvf vf5 (&-> v1-95 quad)) - ) - (.add.vf.xyz vf6 vf4 vf5) - (.svf (&-> sv-176 quad) vf6) - (let* ((v1-98 (editable-method-15 s1-2)) - (s0-1 (vector-! s0-0 sv-176 v1-98)) - ) - (editable-method-17 s1-2 s0-1 (editable-flag no-update)) - ) - ) - ) - (+! s2-1 1) - (set! s1-2 (-> arg0 data s2-1)) - ) - ) - (let* ((s5-3 (-> arg0 length)) - (s4-7 0) - (a0-28 (-> arg0 data s4-7)) - ) - (while (< s4-7 s5-3) - (if (and a0-28 (logtest? (-> a0-28 flags) (editable-flag selected))) - (editable-method-30 a0-28 (editable-flag)) - ) - (+! s4-7 1) - (set! a0-28 (-> arg0 data s4-7)) - ) - ) - ) - ) - ) - (cleanup-selection arg0) - ) - ((= arg1 (editable-command drag-scale)) - (let* ((s3-6 (-> arg0 length)) - (s2-2 0) - (s1-3 (-> arg0 data s2-2)) - ) - (while (< s2-2 s3-6) - (when (and s1-3 (logtest? (-> s1-3 flags) (editable-flag selected))) - (let ((s0-2 (new 'stack-no-clear 'vector))) - (set! sv-192 (new 'stack-no-clear 'vector)) - (let ((v1-125 (editable-method-15 s1-3)) - (a0-33 (-> arg3 position)) - ) - (.lvf vf4 (&-> v1-125 quad)) - (.lvf vf5 (&-> a0-33 quad)) - ) - (.mov.vf.w vf6 vf0) - (.sub.vf.xyz vf6 vf4 vf5) - (.svf (&-> sv-192 quad) vf6) - (let* ((f0-5 (* 0.01 (- (-> arg2 posx) (-> arg2 pos 1 x)))) - (s0-3 (vector-float*! s0-2 sv-192 f0-5)) - ) - (case (-> arg3 action) - (((manipulator-action ma1)) - (set! (-> s0-3 y) 0.0) - (set! (-> s0-3 z) 0.0) - ) - (((manipulator-action ma2)) - (set! (-> s0-3 x) 0.0) - (set! (-> s0-3 z) 0.0) - ) - (((manipulator-action ma3)) - (set! (-> s0-3 x) 0.0) - (set! (-> s0-3 y) 0.0) - ) - (((manipulator-action ma4)) - (set! (-> s0-3 z) 0.0) - ) - (((manipulator-action ma5)) - (set! (-> s0-3 y) 0.0) - ) - (((manipulator-action ma6)) - (set! (-> s0-3 x) 0.0) - ) - (((manipulator-action ma7)) - ) - (else - (set! (-> s0-3 x) 0.0) - (set! (-> s0-3 y) 0.0) - (set! (-> s0-3 z) 0.0) - ) - ) - (editable-method-17 s1-3 s0-3 (editable-flag no-update)) - ) - ) - ) - (+! s2-2 1) - (set! s1-3 (-> arg0 data s2-2)) - ) - ) - (let* ((s5-4 (-> arg0 length)) - (s4-8 0) - (a0-42 (-> arg0 data s4-8)) - ) - (while (< s4-8 s5-4) - (if (and a0-42 (logtest? (-> a0-42 flags) (editable-flag selected))) - (editable-method-30 a0-42 (editable-flag)) - ) - (+! s4-8 1) - (set! a0-42 (-> arg0 data s4-8)) - ) - ) - (cleanup-selection arg0) - ) - (else - (return #f) - v0-2 + (while (< s3-0 s4-1) + (when (and a0-2 (logtest? (-> a0-2 flags) (editable-flag selected))) + (vector+! s5-1 s5-1 (editable-method-15 a0-2)) + (set! f30-0 (+ 1.0 f30-0)) + ) + (+! s3-0 1) + (set! a0-2 (-> arg0 data s3-0)) ) ) + (cond + ((= f30-0 0.0) + (remove-setting! 'mouse-tumble-point) + ) + (else + (vector-float/! s5-1 s5-1 f30-0) + (set-setting! 'mouse-tumble-point 'abs s5-1 0) + ) + ) + ) + ) + ((= arg1 (editable-command camera-xy)) + (set-setting! 'mouse-input 'abs #t 0) + ) + ((= arg1 (editable-command camera-xz)) + (set-setting! 'mouse-input 'abs #t 0) + ) + ((= arg1 (editable-command drag-move)) + (let* ((s4-2 (-> arg0 length)) + (s3-1 0) + (a0-8 (-> arg0 data s3-1)) + ) + (while (< s3-1 s4-2) + (if (and a0-8 (logtest? (-> a0-8 flags) (editable-flag selected))) + (editable-method-17 a0-8 (-> arg3 speed) (editable-flag no-update)) + ) + (+! s3-1 1) + (set! a0-8 (-> arg0 data s3-1)) + ) + ) + (let* ((s5-2 (-> arg0 length)) + (s4-3 0) + (a0-9 (-> arg0 data s4-3)) + ) + (while (< s4-3 s5-2) + (if (and a0-9 (logtest? (-> a0-9 flags) (editable-flag selected))) + (editable-method-30 a0-9 (editable-flag)) + ) + (+! s4-3 1) + (set! a0-9 (-> arg0 data s4-3)) + ) + ) + (cleanup-selection arg0) + ) + ((= arg1 (editable-command snap-rotate)) + (let* ((s4-4 (-> arg0 length)) + (s3-2 0) + (a0-11 (-> arg0 data s3-2)) + ) + (while (< s3-2 s4-4) + (if (and a0-11 (logtest? (-> a0-11 flags) (editable-flag selected))) + (editable-method-35 a0-11 (-> *editable* 0 mouse-normal)) + ) + (+! s3-2 1) + (set! a0-11 (-> arg0 data s3-2)) + ) + ) + (let* ((s4-5 (-> arg0 length)) + (s3-3 0) + (a0-12 (-> arg0 data s3-3)) + ) + (while (< s3-3 s4-5) + (if (and a0-12 (logtest? (-> a0-12 flags) (editable-flag selected))) + (editable-method-30 a0-12 (editable-flag)) + ) + (+! s3-3 1) + (set! a0-12 (-> arg0 data s3-3)) + ) + ) + (cleanup-selection arg0) + (update-manipulator-position arg0 arg3) + ) + ((= arg1 (editable-command drag-rotate)) + (let ((v1-70 0)) + (let* ((a0-15 (-> arg0 length)) + (a1-22 0) + (a3-5 (-> arg0 data a1-22)) + ) + (while (< a1-22 a0-15) + (if (and a3-5 (logtest? (-> a3-5 flags) (editable-flag selected))) + (+! v1-70 1) + ) + (+! a1-22 1) + (set! a3-5 (-> arg0 data a1-22)) + ) + ) + (cond + ((= v1-70 1) + (let* ((s4-6 (-> arg0 length)) + (s3-4 0) + (a0-19 (-> arg0 data s3-4)) + ) + (while (< s3-4 s4-6) + (if (and a0-19 (logtest? (-> a0-19 flags) (editable-flag selected))) + (get-null-vec2 a0-19 (-> arg3 angles)) + ) + (+! s3-4 1) + (set! a0-19 (-> arg0 data s3-4)) + ) + ) + ) + (else + (let* ((s3-5 (-> arg0 length)) + (s2-1 0) + (s1-2 (-> arg0 data s2-1)) + ) + (while (< s2-1 s3-5) + (when (and s1-2 (logtest? (-> s1-2 flags) (editable-flag selected))) + (let ((s0-0 (new 'stack-no-clear 'vector)) + (sv-176 (new 'stack-no-clear 'vector)) + ) + (let ((sv-128 vector-rotate-around-y!) + (sv-144 (new 'stack-no-clear 'vector)) + (sv-160 (new 'stack-no-clear 'vector)) + ) + (let ((v1-92 (editable-method-15 s1-2)) + (a0-23 (-> arg3 position)) + ) + (.lvf vf4 (&-> v1-92 quad)) + (.lvf vf5 (&-> a0-23 quad)) + ) + (.mov.vf.w vf6 vf0) + (.sub.vf.xyz vf6 vf4 vf5) + (.svf (&-> sv-160 quad) vf6) + (let ((v0-11 (sv-128 sv-144 sv-160 (* 182.04445 (- (-> arg2 posx) (-> arg2 pos 1 x))))) + (v1-95 (-> arg3 position)) + ) + (.mov.vf.w vf6 vf0) + (.lvf vf4 (&-> v0-11 quad)) + (.lvf vf5 (&-> v1-95 quad)) + ) + ) + (.add.vf.xyz vf6 vf4 vf5) + (.svf (&-> sv-176 quad) vf6) + (let ((s0-1 (vector-! s0-0 sv-176 (editable-method-15 s1-2)))) + (editable-method-17 s1-2 s0-1 (editable-flag no-update)) + ) + ) + ) + (+! s2-1 1) + (set! s1-2 (-> arg0 data s2-1)) + ) + ) + (let* ((s5-3 (-> arg0 length)) + (s4-7 0) + (a0-28 (-> arg0 data s4-7)) + ) + (while (< s4-7 s5-3) + (if (and a0-28 (logtest? (-> a0-28 flags) (editable-flag selected))) + (editable-method-30 a0-28 (editable-flag)) + ) + (+! s4-7 1) + (set! a0-28 (-> arg0 data s4-7)) + ) + ) + ) + ) + ) + (cleanup-selection arg0) + ) + ((= arg1 (editable-command drag-scale)) + (let* ((s3-6 (-> arg0 length)) + (s2-2 0) + (s1-3 (-> arg0 data s2-2)) + ) + (while (< s2-2 s3-6) + (when (and s1-3 (logtest? (-> s1-3 flags) (editable-flag selected))) + (let ((s0-2 (new 'stack-no-clear 'vector)) + (sv-192 (new 'stack-no-clear 'vector)) + ) + (let ((v1-125 (editable-method-15 s1-3)) + (a0-33 (-> arg3 position)) + ) + (.lvf vf4 (&-> v1-125 quad)) + (.lvf vf5 (&-> a0-33 quad)) + ) + (.mov.vf.w vf6 vf0) + (.sub.vf.xyz vf6 vf4 vf5) + (.svf (&-> sv-192 quad) vf6) + (let ((s0-3 (vector-float*! s0-2 sv-192 (* 0.01 (- (-> arg2 posx) (-> arg2 pos 1 x)))))) + (case (-> arg3 action) + (((manipulator-action ma1)) + (set! (-> s0-3 y) 0.0) + (set! (-> s0-3 z) 0.0) + ) + (((manipulator-action ma2)) + (set! (-> s0-3 x) 0.0) + (set! (-> s0-3 z) 0.0) + ) + (((manipulator-action ma3)) + (set! (-> s0-3 x) 0.0) + (set! (-> s0-3 y) 0.0) + ) + (((manipulator-action ma4)) + (set! (-> s0-3 z) 0.0) + ) + (((manipulator-action ma5)) + (set! (-> s0-3 y) 0.0) + ) + (((manipulator-action ma6)) + (set! (-> s0-3 x) 0.0) + ) + (((manipulator-action ma7)) + ) + (else + (set! (-> s0-3 x) 0.0) + (set! (-> s0-3 y) 0.0) + (set! (-> s0-3 z) 0.0) + ) + ) + (editable-method-17 s1-3 s0-3 (editable-flag no-update)) + ) + ) + ) + (+! s2-2 1) + (set! s1-3 (-> arg0 data s2-2)) + ) + ) + (let* ((s5-4 (-> arg0 length)) + (s4-8 0) + (a0-42 (-> arg0 data s4-8)) + ) + (while (< s4-8 s5-4) + (if (and a0-42 (logtest? (-> a0-42 flags) (editable-flag selected))) + (editable-method-30 a0-42 (editable-flag)) + ) + (+! s4-8 1) + (set! a0-42 (-> arg0 data s4-8)) + ) + ) + (cleanup-selection arg0) + ) + (else + (return #f) + v0-2 + ) + ) ) #t ) @@ -3226,7 +3220,3 @@ *debug-hook* ) ) - - - - diff --git a/test/decompiler/reference/jak3/engine/debug/editable_REF.gc b/test/decompiler/reference/jak3/engine/debug/editable_REF.gc index 435dde50af..7d0556293a 100644 --- a/test/decompiler/reference/jak3/engine/debug/editable_REF.gc +++ b/test/decompiler/reference/jak3/engine/debug/editable_REF.gc @@ -64,7 +64,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)) @@ -85,28 +84,10 @@ (clear s5-0) (format s5-0 "delete from region_point where region_face_id in (") (dotimes (s2-0 (-> s3-0 length)) - (cond - ((zero? s2-0) - (let ((s1-0 format) - (s0-0 s5-0) - ) - (set! sv-16 "~D") - (let ((a2-4 (string->int (the-as string (-> s3-0 sql-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 (the-as string (-> s3-0 sql-data s2-0))))) - (s1-1 s0-1 sv-32 a2-5) - ) - ) + (if (zero? s2-0) + (format s5-0 "~D" (string->int (the-as string (-> s3-0 sql-data s2-0)))) + (format s5-0 ",~D" (string->int (the-as string (-> s3-0 sql-data s2-0)))) ) - ) ) (format s5-0 ")") (let ((a2-6 (sql-query s5-0))) @@ -323,52 +304,52 @@ ;; definition for method 11 of type editable-region ;; WARN: Return type mismatch int vs none. (defmethod print-region-info ((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 (the-as rgba (new 'static 'rgba :r #xff :g #xff :a #x80))) - (let ((s3-0 add-debug-text-3d) - (s2-0 #t) - (s1-0 577) - ) - (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 577) - ) - (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 (the-as rgba (new 'static 'rgba :r #xff :g #xff :a #x80))) + (let ((s3-0 add-debug-text-3d) + (s2-0 #t) + (s1-0 577) ) - (+! (-> 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 577) - ) - (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 577) + ) + (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 577) - ) - (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 577) + ) + (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 577) + ) + (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) ) ) ) @@ -596,10 +577,10 @@ ;; definition for method 22 of type editable ;; WARN: Return type mismatch int vs none. (defmethod editable-method-22 ((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 (editable-method-15 this))) + (let ((sv-48 (new 'stack-no-clear 'vector)) + (sv-52 (new 'stack-no-clear 'vector)) + (s4-0 (editable-method-15 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) @@ -789,26 +770,26 @@ ;; definition for method 34 of type editable (defmethod get-level-offset ((this editable) (arg0 editable-array)) - (local-vars (sv-16 sql-result)) (when (!= (-> this region level) (-> arg0 level)) - (let ((gp-0 (new 'static 'vector))) - (let ((s3-0 sql-query)) - (format - (clear *temp-string*) - "select translate_x,translate_y,translate_z from level_info where name='~S'" - (-> this region level) + (let ((gp-0 (new 'static 'vector)) + (s3-0 sql-query) ) - (set! sv-16 (s3-0 *temp-string*)) + (format + (clear *temp-string*) + "select translate_x,translate_y,translate_z from level_info where name='~S'" + (-> this region level) ) - (when (= (-> sv-16 content-type) 'select) - (set-vector! - gp-0 - (* 4096.0 (string->float (the-as string (-> sv-16 sql-data 0)))) - (* 4096.0 (string->float (the-as string (-> sv-16 sql-data 1)))) - (* 4096.0 (string->float (the-as string (-> sv-16 sql-data 2)))) - 1.0 + (let ((sv-16 (s3-0 *temp-string*))) + (when (= (-> sv-16 content-type) 'select) + (set-vector! + gp-0 + (* 4096.0 (string->float (the-as string (-> sv-16 sql-data 0)))) + (* 4096.0 (string->float (the-as string (-> sv-16 sql-data 1)))) + (* 4096.0 (string->float (the-as string (-> sv-16 sql-data 2)))) + 1.0 + ) + (return gp-0) ) - (return gp-0) ) ) ) @@ -2016,15 +1997,14 @@ ;; definition for method 14 of type editable-face ;; INFO: Used lq/sq (defmethod editable-method-14 ((this editable-face) (arg0 vector) (arg1 vector)) - (local-vars (sv-560 editable-face) (sv-576 vector)) - (set! sv-560 this) - (let ((s3-0 arg0) - (s4-0 arg1) - (s2-0 (new 'stack-no-clear 'vector)) - (s5-0 (editable-face-method-37 sv-560 (new 'stack-no-clear 'vector))) - (s1-0 (new 'stack-no-clear 'vector)) - (gp-0 (new 'stack-no-clear 'inline-array 'vector 4)) - ) + (let* ((sv-560 this) + (s3-0 arg0) + (s4-0 arg1) + (s2-0 (new 'stack-no-clear 'vector)) + (s5-0 (editable-face-method-37 sv-560 (new 'stack-no-clear 'vector))) + (s1-0 (new 'stack-no-clear 'vector)) + (gp-0 (new 'stack-no-clear 'inline-array 'vector 4)) + ) (dotimes (v1-1 4) (set! (-> gp-0 v1-1 quad) (the-as uint128 0)) ) @@ -2098,23 +2078,19 @@ (let ((s3-2 (editable-face-method-36 sv-560 s0-1))) 0 (let ((s2-1 (vector-negate! (new 'stack-no-clear 'vector) s5-0))) - (set! sv-576 (new 'stack-no-clear 'vector)) - (let ((f30-0 0.0) - (t9-10 (method-of-object sv-560 editable-face-method-37)) - (a1-10 (new 'stack-no-clear 'vector)) - ) - (when (< f30-0 (vector-dot - (t9-10 sv-560 a1-10) - (vector-! (new 'stack-no-clear 'vector) (-> *math-camera* trans) (-> s0-1 0)) - ) + (let ((sv-576 (new 'stack-no-clear 'vector))) + (when (< 0.0 (vector-dot + (editable-face-method-37 sv-560 (new 'stack-no-clear 'vector)) + (vector-! (new 'stack-no-clear 'vector) (-> *math-camera* trans) (-> s0-1 0)) + ) ) (vector-copy! s2-1 s5-0) #t ) + (vector-copy! sv-576 (-> s0-1 2)) + (vector-copy! (-> s0-1 2) (-> s0-1 3)) + (vector-copy! (-> s0-1 3) sv-576) ) - (vector-copy! sv-576 (-> s0-1 2)) - (vector-copy! (-> s0-1 2) (-> s0-1 3)) - (vector-copy! (-> s0-1 3) sv-576) (dotimes (v1-40 4) (vector-! (-> s4-2 v1-40) (-> s0-1 v1-40) s1-0) (vector+*! (-> s4-2 v1-40) (-> s4-2 v1-40) s5-0 (- (vector-dot s5-0 (-> s4-2 v1-40)))) @@ -2212,18 +2188,6 @@ ;; WARN: Return type mismatch int vs none. ;; WARN: Function (method 31 editable-face) has a return type of none, but the expression builder found a return statement. (defmethod editable-method-31 ((this editable-face) (arg0 editable-flag)) - (local-vars - (sv-208 (inline-array vector)) - (sv-216 int) - (sv-288 (array editable-point)) - (sv-292 int) - (sv-296 int) - (sv-368 matrix) - (sv-372 editable-point) - (sv-376 number) - (sv-380 symbol) - (sv-400 float) - ) (if (or (logtest? arg0 (editable-flag no-update)) (logtest? (-> this flags) (editable-flag mark))) (return #f) ) @@ -2249,22 +2213,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))) - (vector-copy! (-> sv-208 sv-216) (editable-method-15 (-> this vertex s2-2))) - (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))) + (vector-copy! (-> sv-208 sv-216) (editable-method-15 (-> this vertex s2-2))) + (+! sv-216 1) + ) + ) + (dotimes (s2-3 s4-0) + (when (logtest? (-> this vertex s2-3 flags) (editable-flag selected)) + (vector-copy! (-> sv-208 sv-216) (editable-method-15 (-> this vertex s2-3))) + (+! 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)) - (vector-copy! (-> sv-208 sv-216) (editable-method-15 (-> this vertex s2-3))) - (set! sv-216 (+ sv-216 1)) - ) - ) - (normal-of-plane (-> this normal) (-> sv-208 0) (-> sv-208 1) (-> sv-208 2)) (vector-copy! (-> this center) (editable-method-15 this)) ) ) @@ -2290,69 +2256,70 @@ ) ) ) - (set! sv-288 - (the-as - (array editable-point) - ((method-of-type array new) - (the-as symbol (new 'stack-no-clear 'array 'editable-point 6)) - array - editable-point - 6 - ) - ) + (let ((sv-288 (the-as (array editable-point) ((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-37 this (-> this normal)) - (dotimes (v1-85 sv-292) - (set! (-> 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 0.0) - (set! sv-380 #t) - (vector-normalize! - (vector-! (-> sv-368 fvec) (editable-method-15 this) (editable-method-15 (-> this vertex 0))) - 1.0 - ) - (vector-normalize! (editable-face-method-37 this (-> sv-368 uvec)) 1.0) - (vector-normalize! (vector-cross! (-> sv-368 rvec) (-> sv-368 fvec) (-> sv-368 uvec)) 1.0) - (vector-copy! (-> sv-368 trans) (editable-method-15 (-> this vertex 0))) - (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 (-> sv-288 s5-4) - (let* ((a1-27 (editable-method-15 (-> 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-37 this (-> this normal)) + (dotimes (v1-85 sv-292) + (set! (-> sv-288 v1-85) (-> this vertex (+ v1-85 1))) + ) + (let ((sv-368 (new-stack-matrix0)) + (sv-372 (the-as editable-point #f)) + (sv-376 0.0) + (sv-380 #t) ) - (cond - (sv-380 - (when (or (not sv-372) (< (the-as float sv-376) sv-400)) - (set! sv-372 (-> sv-288 s5-4)) - (set! sv-376 sv-400) - ) - ) - (else - (when (or (not sv-372) (< sv-400 (the-as float sv-376))) - (set! sv-372 (-> sv-288 s5-4)) - (set! sv-376 sv-400) + (vector-normalize! + (vector-! (-> sv-368 fvec) (editable-method-15 this) (editable-method-15 (-> this vertex 0))) + 1.0 + ) + (vector-normalize! (editable-face-method-37 this (-> sv-368 uvec)) 1.0) + (vector-normalize! (vector-cross! (-> sv-368 rvec) (-> sv-368 fvec) (-> sv-368 uvec)) 1.0) + (vector-copy! (-> sv-368 trans) (editable-method-15 (-> this vertex 0))) + (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 (-> sv-288 s5-4) + (let* ((a1-27 (editable-method-15 (-> 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) (< (the-as float sv-376) sv-400)) + (set! sv-372 (-> sv-288 s5-4)) + (set! sv-376 sv-400) + ) + ) + (else + (when (or (not sv-372) (< sv-400 (the-as float sv-376))) + (set! sv-372 (-> sv-288 s5-4)) + (set! sv-376 sv-400) + ) + ) + ) ) ) ) + (set! (-> this vertex sv-296) sv-372) + (dotimes (v1-131 sv-292) + (if (= sv-372 (-> sv-288 v1-131)) + (set! (-> sv-288 v1-131) #f) + ) + ) + (+! sv-296 1) + (set! sv-380 (not sv-380)) ) ) - (set! (-> this vertex sv-296) sv-372) - (dotimes (v1-131 sv-292) - (if (= sv-372 (-> sv-288 v1-131)) - (set! (-> sv-288 v1-131) #f) - ) - ) - (set! sv-296 (+ sv-296 1)) - (set! sv-380 (not sv-380)) ) (if (< (vector-dot (-> this normal) (editable-face-method-37 this (new 'stack-no-clear 'vector))) 0.0) (logxor! (-> this flags) (editable-flag orient)) @@ -2370,45 +2337,45 @@ ;; 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-36 this gp-0)) - (when (>= sv-112 3) - (let ((s1-0 (editable-face-method-37 this (new 'stack-no-clear 'vector)))) - (add-debug-vector - #t - (bucket-id debug-no-zbuf1) - (editable-method-15 this) - s1-0 - (meters 2) - (the-as rgba (new 'static 'rgba :r #xff :g #xff :a #x80)) + (let ((sv-112 (editable-face-method-36 this gp-0))) + (when (>= sv-112 3) + (let ((s1-0 (editable-face-method-37 this (new 'stack-no-clear 'vector)))) + (add-debug-vector + #t + (bucket-id debug-no-zbuf1) + (editable-method-15 this) + s1-0 + (meters 2) + (the-as rgba (new 'static 'rgba :r #xff :g #xff :a #x80)) + ) ) - ) - (let ((t1-1 (if (logtest? (-> this flags) (editable-flag selected)) - 1 - 0 - ) - ) - ) - (if (or (= t1-1 1) (not (-> *editable-work* hide))) - (add-debug-bound - (bucket-id debug) - gp-0 - sv-112 - (if (logtest? (-> this flags) (editable-flag orient)) - (new 'static 'rgba :r #x80 :a #x40) - (new 'static 'rgba :r #x80 :g #x80 :a #x40) - ) - (if (not (logtest? (-> this flags) (editable-flag orient))) - (new 'static 'rgba :r #x80 :a #x40) - (new 'static 'rgba :r #x80 :g #x80 :a #x40) - ) - t1-1 + (let ((t1-1 (if (logtest? (-> this flags) (editable-flag selected)) + 1 + 0 + ) + ) ) - ) + (if (or (= t1-1 1) (not (-> *editable-work* hide))) + (add-debug-bound + (bucket-id debug) + gp-0 + sv-112 + (if (logtest? (-> this flags) (editable-flag orient)) + (new 'static 'rgba :r #x80 :a #x40) + (new 'static 'rgba :r #x80 :g #x80 :a #x40) + ) + (if (not (logtest? (-> this flags) (editable-flag orient))) + (new 'static 'rgba :r #x80 :a #x40) + (new 'static 'rgba :r #x80 :g #x80 :a #x40) + ) + t1-1 + ) + ) + ) ) ) ) @@ -2871,97 +2838,97 @@ ;; definition for function load-editable-lights (defun load-editable-lights ((arg0 editable-array)) - (local-vars (sv-16 sql-result)) (let ((s5-0 sql-query)) (format (clear *temp-string*) "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,shadow_ambi,shadow_dir_0,shadow_dir_1,shadow_dir_2,shadow_dir_3 from light where level_name='~S'" (-> arg0 level) ) - (set! sv-16 (s5-0 *temp-string*)) - ) - (format #t "sql: read light ~D~%" (/ (-> sv-16 length) 16)) - (if (!= (-> sv-16 content-type) 'select) - (return #f) - ) - (let ((s5-1 0)) - (while (< s5-1 (-> sv-16 length)) - (let ((s3-0 (get-length arg0))) - (when (>= s3-0 0) - (let ((s4-1 (new 'stack-no-clear 'vector))) - (set! (-> s4-1 x) (* 4096.0 (string->float (the-as string (-> sv-16 sql-data (+ s5-1 2)))))) - (set! (-> s4-1 y) (* 4096.0 (string->float (the-as string (-> sv-16 sql-data (+ s5-1 3)))))) - (set! (-> s4-1 z) (* 4096.0 (string->float (the-as string (-> sv-16 sql-data (+ s5-1 4)))))) - (set! (-> s4-1 w) 1.0) - (vector+! s4-1 s4-1 (-> arg0 level-offset)) - (let ((s4-2 (new 'debug 'editable-light s4-1 2048.0 *editable-light-region*))) - (set! (-> arg0 data s3-0) s4-2) - (set! (-> s4-2 id) (the-as uint (string->int (the-as string (-> sv-16 sql-data s5-1))))) - (set! (-> s4-2 name) (the-as string (-> sv-16 sql-data (+ s5-1 1)))) - (set! (-> s4-2 radius) (* 4096.0 (string->float (the-as string (-> sv-16 sql-data (+ s5-1 5)))))) - (set-vector! - (-> s4-2 direction) - (string->float (the-as string (-> sv-16 sql-data (+ s5-1 6)))) - (string->float (the-as string (-> sv-16 sql-data (+ s5-1 7)))) - (string->float (the-as string (-> sv-16 sql-data (+ s5-1 8)))) - 1.0 - ) - (set-vector! - (-> s4-2 color) - (string->float (the-as string (-> sv-16 sql-data (+ s5-1 9)))) - (string->float (the-as string (-> sv-16 sql-data (+ s5-1 10)))) - (string->float (the-as string (-> sv-16 sql-data (+ s5-1 11)))) - (string->float (the-as string (-> sv-16 sql-data (+ s5-1 12)))) - ) - (if (or (= (-> s4-2 color w) -2.0) - (and (= (-> s4-2 direction x) 0.0) (= (-> s4-2 direction y) 0.0) (= (-> s4-2 direction z) 0.0)) + (let ((sv-16 (s5-0 *temp-string*))) + (format #t "sql: read light ~D~%" (/ (-> sv-16 length) 16)) + (if (!= (-> sv-16 content-type) 'select) + (return #f) + ) + (let ((s5-1 0)) + (while (< s5-1 (-> sv-16 length)) + (let ((s3-0 (get-length arg0))) + (when (>= s3-0 0) + (let ((s4-1 (new 'stack-no-clear 'vector))) + (set! (-> s4-1 x) (* 4096.0 (string->float (the-as string (-> sv-16 sql-data (+ s5-1 2)))))) + (set! (-> s4-1 y) (* 4096.0 (string->float (the-as string (-> sv-16 sql-data (+ s5-1 3)))))) + (set! (-> s4-1 z) (* 4096.0 (string->float (the-as string (-> sv-16 sql-data (+ s5-1 4)))))) + (set! (-> s4-1 w) 1.0) + (vector+! s4-1 s4-1 (-> arg0 level-offset)) + (let ((s4-2 (new 'debug 'editable-light s4-1 2048.0 *editable-light-region*))) + (set! (-> arg0 data s3-0) s4-2) + (set! (-> s4-2 id) (the-as uint (string->int (the-as string (-> sv-16 sql-data s5-1))))) + (set! (-> s4-2 name) (the-as string (-> sv-16 sql-data (+ s5-1 1)))) + (set! (-> s4-2 radius) (* 4096.0 (string->float (the-as string (-> sv-16 sql-data (+ s5-1 5)))))) + (set-vector! + (-> s4-2 direction) + (string->float (the-as string (-> sv-16 sql-data (+ s5-1 6)))) + (string->float (the-as string (-> sv-16 sql-data (+ s5-1 7)))) + (string->float (the-as string (-> sv-16 sql-data (+ s5-1 8)))) + 1.0 + ) + (set-vector! + (-> s4-2 color) + (string->float (the-as string (-> sv-16 sql-data (+ s5-1 9)))) + (string->float (the-as string (-> sv-16 sql-data (+ s5-1 10)))) + (string->float (the-as string (-> sv-16 sql-data (+ s5-1 11)))) + (string->float (the-as string (-> sv-16 sql-data (+ s5-1 12)))) + ) + (if (or (= (-> s4-2 color w) -2.0) + (and (= (-> s4-2 direction x) 0.0) (= (-> s4-2 direction y) 0.0) (= (-> s4-2 direction z) 0.0)) + ) + (set! (-> s4-2 direction w) 0.0) ) - (set! (-> s4-2 direction w) 0.0) - ) - (set! (-> s4-2 decay-start) (string->float (the-as string (-> sv-16 sql-data (+ s5-1 13))))) - (set! (-> s4-2 ambient-point-ratio) (string->float (the-as string (-> sv-16 sql-data (+ s5-1 14))))) - (set! (-> s4-2 brightness) (string->float (the-as string (-> sv-16 sql-data (+ s5-1 15))))) - (set! (-> s4-2 shadow-ambi) - (* 0.0625 (the float (string->int (the-as string (-> sv-16 sql-data (+ s5-1 16)))))) - ) - (set! (-> s4-2 shadow-dir0) - (* 0.0625 (the float (string->int (the-as string (-> sv-16 sql-data (+ s5-1 17)))))) - ) - (set! (-> s4-2 shadow-dir1) - (* 0.0625 (the float (string->int (the-as string (-> sv-16 sql-data (+ s5-1 18)))))) - ) - (set! (-> s4-2 shadow-dir2) - (* 0.0625 (the float (string->int (the-as string (-> sv-16 sql-data (+ s5-1 19)))))) - ) - (set! (-> s4-2 shadow-dir3) - (* 0.0625 (the float (string->int (the-as string (-> sv-16 sql-data (+ s5-1 20)))))) - ) - (let ((a0-51 0) - (v1-92 0) - ) - (let ((a1-5 (-> s4-2 shadows))) - (dotimes (a2-3 5) - (when (!= (-> a1-5 a2-3) 1.0) - (set! a0-51 (logior a0-51 (ash 1 a2-3))) - (set! v1-92 (logior v1-92 (ash (logand (the int (* 16.0 (-> a1-5 a2-3))) 15) (* a2-3 4)))) - ) - ) - ) - (set! (-> s4-2 direction x) - (the-as - float - (logior (logand (the-as uint (-> s4-2 direction x)) (the-as uint #xffffffff00ffffff)) (shr (shl a0-51 56) 32)) + (set! (-> s4-2 decay-start) (string->float (the-as string (-> sv-16 sql-data (+ s5-1 13))))) + (set! (-> s4-2 ambient-point-ratio) (string->float (the-as string (-> sv-16 sql-data (+ s5-1 14))))) + (set! (-> s4-2 brightness) (string->float (the-as string (-> sv-16 sql-data (+ s5-1 15))))) + (set! (-> s4-2 shadow-ambi) + (* 0.0625 (the float (string->int (the-as string (-> sv-16 sql-data (+ s5-1 16)))))) + ) + (set! (-> s4-2 shadow-dir0) + (* 0.0625 (the float (string->int (the-as string (-> sv-16 sql-data (+ s5-1 17)))))) + ) + (set! (-> s4-2 shadow-dir1) + (* 0.0625 (the float (string->int (the-as string (-> sv-16 sql-data (+ s5-1 18)))))) + ) + (set! (-> s4-2 shadow-dir2) + (* 0.0625 (the float (string->int (the-as string (-> sv-16 sql-data (+ s5-1 19)))))) + ) + (set! (-> s4-2 shadow-dir3) + (* 0.0625 (the float (string->int (the-as string (-> sv-16 sql-data (+ s5-1 20)))))) + ) + (let ((a0-51 0) + (v1-92 0) + ) + (let ((a1-5 (-> s4-2 shadows))) + (dotimes (a2-3 5) + (when (!= (-> a1-5 a2-3) 1.0) + (set! a0-51 (logior a0-51 (ash 1 a2-3))) + (set! v1-92 (logior v1-92 (ash (logand (the int (* 16.0 (-> a1-5 a2-3))) 15) (* a2-3 4)))) + ) ) ) - (set! (-> s4-2 direction x) - (the-as float (logior (logand (the-as int (-> s4-2 direction x)) -16777216) (shr (shl v1-92 40) 40))) - ) + (set! (-> s4-2 direction x) + (the-as + float + (logior (logand (the-as uint (-> s4-2 direction x)) (the-as uint #xffffffff00ffffff)) (shr (shl a0-51 56) 32)) + ) + ) + (set! (-> s4-2 direction x) + (the-as float (logior (logand (the-as int (-> s4-2 direction x)) -16777216) (shr (shl v1-92 40) 40))) + ) + ) + ) ) ) ) + (+! s5-1 21) ) ) - (+! s5-1 21) ) ) (set! (-> *editable-light-region* changed) #f) @@ -2970,34 +2937,6 @@ ;; definition for method 13 of type editable-array (defmethod editable-array-method-13 ((this editable-array) (arg0 symbol)) - (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 number) - (sv-44 number) - (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 object) - (sv-176 vector) - (sv-180 editable) - (sv-184 int) - (sv-192 int) - (sv-200 editable-point) - (sv-208 int) - (sv-216 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)) @@ -3011,17 +2950,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 content-type) 'select) (>= (-> sv-16 length) 3)) - (set-vector! - (-> this level-offset) - (* 4096.0 (string->float (the-as string (-> sv-16 sql-data 0)))) - (* 4096.0 (string->float (the-as string (-> sv-16 sql-data 1)))) - (* 4096.0 (string->float (the-as string (-> sv-16 sql-data 2)))) - 1.0 + (let ((sv-16 (s4-0 *temp-string*))) + (when (and (= (-> sv-16 content-type) 'select) (>= (-> sv-16 length) 3)) + (set-vector! + (-> this level-offset) + (* 4096.0 (string->float (the-as string (-> sv-16 sql-data 0)))) + (* 4096.0 (string->float (the-as string (-> sv-16 sql-data 1)))) + (* 4096.0 (string->float (the-as string (-> sv-16 sql-data 2)))) + 1.0 + ) + (set! (-> this level-info-id) (the-as uint (string->int (the-as string (-> sv-16 sql-data 3))))) + ) ) - (set! (-> this level-info-id) (the-as uint (string->int (the-as string (-> sv-16 sql-data 3))))) ) (let ((s4-2 sql-query)) (format @@ -3029,234 +2969,256 @@ "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 content-type) 'select) - (return #f) - ) - (format #t "sql: read region ~D~%" (/ (-> sv-20 length) 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 content-type) 'select) - (return #f) - ) - (format #t "sql: read face ~D~%" (/ (-> sv-24 length) 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 content-type) 'select) - (return #f) - ) - (format #t "sql: read point ~D~%" (/ (-> sv-28 length) 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 content-type) 'select) - (return #f) - ) - (format #t "sql: read sphere ~D~%" (/ (-> sv-32 length) 5)) - (let ((s4-6 0)) - (while (< s4-6 (-> sv-20 length)) - (set! sv-36 (new 'debug 'editable-region)) - (set! sv-40 4095996000.0) - (set! sv-44 -4095996000.0) - (set! (-> sv-36 id) (the-as uint (string->int (the-as string (-> sv-20 sql-data s4-6))))) - (set! (-> sv-36 level) (the-as string (string->symbol (the-as string (-> sv-20 sql-data (+ s4-6 1)))))) - (set! (-> sv-36 tree) (string->symbol (the-as string (-> sv-20 sql-data (+ s4-6 2))))) - (set! (-> sv-36 on-enter) (the-as pair (if (string= (the-as string (-> sv-20 sql-data (+ s4-6 3))) "") - #f - (-> sv-20 sql-data (+ s4-6 3)) - ) - ) - ) - (set! (-> sv-36 on-exit) (the-as pair (if (string= (the-as string (-> sv-20 sql-data (+ s4-6 4))) "") - #f - (-> sv-20 sql-data (+ s4-6 4)) - ) - ) - ) - (set! (-> sv-36 on-inside) (the-as pair (if (string= (the-as string (-> sv-20 sql-data (+ s4-6 5))) "") - #f - (-> sv-20 sql-data (+ s4-6 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 content-type) 'select) + (return #f) ) - ) - (let ((s3-5 0)) - (while (< s3-5 (-> sv-32 length)) - (when (= (-> sv-36 id) (string->int (the-as string (-> sv-32 sql-data s3-5)))) - (let ((s2-0 (get-length this))) - (when (>= s2-0 0) - (let ((s1-1 (new 'stack-no-clear 'vector))) - (set! (-> s1-1 x) (string->float (the-as string (-> sv-32 sql-data (+ s3-5 1))))) - (set! (-> s1-1 y) (string->float (the-as string (-> sv-32 sql-data (+ s3-5 2))))) - (set! (-> s1-1 z) (string->float (the-as string (-> sv-32 sql-data (+ s3-5 3))))) - (set! (-> s1-1 w) 1.0) - (vector+! s1-1 s1-1 (-> this level-offset)) - (let ((s1-2 (new 'debug 'editable-sphere s1-1 2048.0 sv-36))) - (set! (-> s1-2 radius) (string->float (the-as string (-> sv-32 sql-data (+ s3-5 4))))) - (set! (-> this data s2-0) s1-2) + (format #t "sql: read region ~D~%" (/ (-> sv-20 length) 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 content-type) 'select) + (return #f) + ) + (format #t "sql: read face ~D~%" (/ (-> sv-24 length) 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 content-type) 'select) + (return #f) + ) + (format #t "sql: read point ~D~%" (/ (-> sv-28 length) 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 content-type) 'select) + (return #f) + ) + (format #t "sql: read sphere ~D~%" (/ (-> sv-32 length) 5)) + (let ((s4-6 0)) + (while (< s4-6 (-> sv-20 length)) + (let ((sv-36 (new 'debug 'editable-region))) + (let ((sv-40 4095996000.0) + (sv-44 -4095996000.0) + ) + (set! (-> sv-36 id) (the-as uint (string->int (the-as string (-> sv-20 sql-data s4-6))))) + (set! (-> sv-36 level) (the-as string (string->symbol (the-as string (-> sv-20 sql-data (+ s4-6 1)))))) + (set! (-> sv-36 tree) (string->symbol (the-as string (-> sv-20 sql-data (+ s4-6 2))))) + (set! (-> sv-36 on-enter) (the-as pair (if (string= (the-as string (-> sv-20 sql-data (+ s4-6 3))) "") + #f + (-> sv-20 sql-data (+ s4-6 3)) + ) + ) + ) + (set! (-> sv-36 on-exit) (the-as pair (if (string= (the-as string (-> sv-20 sql-data (+ s4-6 4))) "") + #f + (-> sv-20 sql-data (+ s4-6 4)) + ) + ) + ) + (set! (-> sv-36 on-inside) (the-as pair (if (string= (the-as string (-> sv-20 sql-data (+ s4-6 5))) "") + #f + (-> sv-20 sql-data (+ s4-6 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 ((s3-5 0)) + (while (< s3-5 (-> sv-32 length)) + (when (= (-> sv-36 id) (string->int (the-as string (-> sv-32 sql-data s3-5)))) + (let ((s2-0 (get-length this))) + (when (>= s2-0 0) + (let ((s1-1 (new 'stack-no-clear 'vector))) + (set! (-> s1-1 x) (string->float (the-as string (-> sv-32 sql-data (+ s3-5 1))))) + (set! (-> s1-1 y) (string->float (the-as string (-> sv-32 sql-data (+ s3-5 2))))) + (set! (-> s1-1 z) (string->float (the-as string (-> sv-32 sql-data (+ s3-5 3))))) + (set! (-> s1-1 w) 1.0) + (vector+! s1-1 s1-1 (-> this level-offset)) + (let ((s1-2 (new 'debug 'editable-sphere s1-1 2048.0 sv-36))) + (set! (-> s1-2 radius) (string->float (the-as string (-> sv-32 sql-data (+ s3-5 4))))) + (set! (-> this data s2-0) s1-2) + ) + ) + ) + ) + ) + (+! s3-5 5) + ) + ) + (let ((sv-64 0)) + (while (< sv-64 (-> sv-24 length)) + (when (= (-> sv-36 id) (string->int (the-as string (-> sv-24 sql-data sv-64)))) + (cond + ((string= (the-as string (-> sv-24 sql-data (+ sv-64 2))) "plane") + (let ((sv-72 (get-length this)) + (sv-80 (new 'debug 'editable-plane sv-36)) + (sv-84 (the-as string (-> sv-24 sql-data (+ sv-64 1)))) + ) + (when (>= sv-72 0) + (set! (-> this data sv-72) sv-80) + (set! (-> sv-80 radius) (string->float (the-as string (-> sv-24 sql-data (+ sv-64 4))))) + (countdown (s3-6 (/ (-> sv-28 length) 5)) + (when (string= (the-as string (-> (the-as sql-result (+ (* 20 s3-6) (the-as int sv-28))) sql-data 0)) sv-84) + (let ((s2-1 (new 'stack-no-clear 'vector))) + (set! (-> s2-1 x) (string->float (the-as string (-> sv-28 sql-data (+ (* 5 s3-6) 2))))) + (set! (-> s2-1 y) (string->float (the-as string (-> sv-28 sql-data (+ (* 5 s3-6) 3))))) + (set! (-> s2-1 z) (string->float (the-as string (-> sv-28 sql-data (+ (* 5 s3-6) 4))))) + (set! (-> s2-1 w) 1.0) + (let ((sv-112 s2-1)) + (vector+! sv-112 sv-112 (-> this level-offset)) + (let ((sv-120 (get-length this))) + (when (>= sv-120 0) + (let ((sv-128 (new 'debug 'editable-point sv-112 sv-36))) + (let ((sv-136 (string->int (the-as string (-> sv-28 sql-data (+ (* 5 s3-6) 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-30 sv-80 (editable-flag no-plane-snap)) + (editable-method-31 sv-80 (editable-flag no-plane-snap)) + ) + ) + ) + ((string= (the-as string (-> sv-24 sql-data (+ sv-64 2))) "face") + (let ((sv-144 (get-length this)) + (sv-152 (new 'debug 'editable-face sv-36)) + (sv-156 (-> sv-24 sql-data (+ sv-64 1))) + ) + (when (>= sv-144 0) + (set! (-> this data sv-144) sv-152) + (if (string= (the-as string (-> sv-24 sql-data (+ sv-64 3))) "orient") + (logior! (-> sv-152 flags) (editable-flag orient)) + ) + (let ((s3-7 (/ (-> sv-28 length) 5))) + (while (begin (label cfg-78) (nonzero? s3-7)) + (+! s3-7 -1) + (when (string= + (the-as string (-> (the-as sql-result (+ (* 20 s3-7) (the-as int sv-28))) sql-data 0)) + (the-as string sv-156) + ) + (let ((s2-2 (new 'stack-no-clear 'vector))) + (set! (-> s2-2 x) (string->float (the-as string (-> sv-28 sql-data (+ (* 5 s3-7) 2))))) + (set! (-> s2-2 y) (string->float (the-as string (-> sv-28 sql-data (+ (* 5 s3-7) 3))))) + (set! (-> s2-2 z) (string->float (the-as string (-> sv-28 sql-data (+ (* 5 s3-7) 4))))) + (set! (-> s2-2 w) 1.0) + (let ((sv-176 s2-2)) + (vector+! sv-176 sv-176 (-> this level-offset)) + (let* ((s2-3 (-> this length)) + (s1-3 0) + (s0-0 (-> this data s1-3)) + ) + (while (< s1-3 s2-3) + (when (and s0-0 (= (-> s0-0 region) sv-36) (type? s0-0 editable-point)) + (when (vector= (the-as vector (&+ s0-0 28)) sv-176) + (let ((sv-180 s0-0)) + (let ((sv-184 (string->int (the-as string (-> sv-28 sql-data (+ (* 5 s3-7) 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) + ) + ) + (+! s1-3 1) + (set! s0-0 (-> this data s1-3)) + ) + ) + (if (< (-> sv-176 y) (the-as float sv-40)) + (set! sv-40 (-> sv-176 y)) + ) + (if (< (the-as float sv-44) (-> sv-176 y)) + (set! sv-44 (-> sv-176 y)) + ) + (let ((sv-192 (get-length this))) + (when (>= sv-192 0) + (let ((sv-200 (new 'debug 'editable-point sv-176 sv-36))) + (let ((sv-208 (string->int (the-as string (-> sv-28 sql-data (+ (* 5 s3-7) 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-30 sv-152 (editable-flag no-plane-snap)) + (editable-method-31 sv-152 (editable-flag no-plane-snap)) + ) + ) + ) + ) + ) + (+! sv-64 5) + ) + ) + (let* ((v1-291 (-> this length)) + (a0-158 0) + (a1-57 (-> this data a0-158)) + ) + (while (< a0-158 v1-291) + (when (and a1-57 (= (-> a1-57 region) sv-36) (= (-> a1-57 type) editable-point)) + (let ((a2-29 (&+ a1-57 28))) + (if (= (the-as float (-> a2-29 name)) (the-as float sv-40)) + (logior! (-> a1-57 flags) (editable-flag bot-set)) + ) + (if (= (the-as float (-> a2-29 name)) (the-as float 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) + ) + (+! s4-6 6) + ) ) ) ) ) ) - (+! s3-5 5) ) ) - (set! sv-64 0) - (while (< sv-64 (-> sv-24 length)) - (when (= (-> sv-36 id) (string->int (the-as string (-> sv-24 sql-data sv-64)))) - (cond - ((string= (the-as string (-> sv-24 sql-data (+ sv-64 2))) "plane") - (set! sv-72 (get-length this)) - (set! sv-80 (new 'debug 'editable-plane sv-36)) - (set! sv-84 (the-as string (-> sv-24 sql-data (+ sv-64 1)))) - (when (>= sv-72 0) - (set! (-> this data sv-72) sv-80) - (set! (-> sv-80 radius) (string->float (the-as string (-> sv-24 sql-data (+ sv-64 4))))) - (countdown (s3-6 (/ (-> sv-28 length) 5)) - (when (string= (the-as string (-> (the-as sql-result (+ (* 20 s3-6) (the-as int sv-28))) sql-data 0)) sv-84) - (let ((s2-1 (new 'stack-no-clear 'vector))) - (set! (-> s2-1 x) (string->float (the-as string (-> sv-28 sql-data (+ (* 5 s3-6) 2))))) - (set! (-> s2-1 y) (string->float (the-as string (-> sv-28 sql-data (+ (* 5 s3-6) 3))))) - (set! (-> s2-1 z) (string->float (the-as string (-> sv-28 sql-data (+ (* 5 s3-6) 4))))) - (set! (-> s2-1 w) 1.0) - (set! sv-112 s2-1) - ) - (vector+! sv-112 sv-112 (-> this level-offset)) - (set! sv-120 (get-length this)) - (when (>= sv-120 0) - (set! sv-128 (new 'debug 'editable-point sv-112 sv-36)) - (set! sv-136 (string->int (the-as string (-> sv-28 sql-data (+ (* 5 s3-6) 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-30 sv-80 (editable-flag no-plane-snap)) - (editable-method-31 sv-80 (editable-flag no-plane-snap)) - ) - ) - ((string= (the-as string (-> sv-24 sql-data (+ sv-64 2))) "face") - (set! sv-144 (get-length this)) - (set! sv-152 (new 'debug 'editable-face sv-36)) - (set! sv-156 (-> sv-24 sql-data (+ sv-64 1))) - (when (>= sv-144 0) - (set! (-> this data sv-144) sv-152) - (if (string= (the-as string (-> sv-24 sql-data (+ sv-64 3))) "orient") - (logior! (-> sv-152 flags) (editable-flag orient)) - ) - (let ((s3-7 (/ (-> sv-28 length) 5))) - (while (begin (label cfg-78) (nonzero? s3-7)) - (+! s3-7 -1) - (when (string= - (the-as string (-> (the-as sql-result (+ (* 20 s3-7) (the-as int sv-28))) sql-data 0)) - (the-as string sv-156) - ) - (let ((s2-2 (new 'stack-no-clear 'vector))) - (set! (-> s2-2 x) (string->float (the-as string (-> sv-28 sql-data (+ (* 5 s3-7) 2))))) - (set! (-> s2-2 y) (string->float (the-as string (-> sv-28 sql-data (+ (* 5 s3-7) 3))))) - (set! (-> s2-2 z) (string->float (the-as string (-> sv-28 sql-data (+ (* 5 s3-7) 4))))) - (set! (-> s2-2 w) 1.0) - (set! sv-176 s2-2) - ) - (vector+! sv-176 sv-176 (-> this level-offset)) - (let* ((s2-3 (-> this length)) - (s1-3 0) - (s0-0 (-> this data s1-3)) - ) - (while (< s1-3 s2-3) - (when (and s0-0 (= (-> s0-0 region) sv-36) (type? s0-0 editable-point)) - (when (vector= (the-as vector (&+ s0-0 28)) sv-176) - (set! sv-180 s0-0) - (set! sv-184 (string->int (the-as string (-> sv-28 sql-data (+ (* 5 s3-7) 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) - ) - ) - (+! s1-3 1) - (set! s0-0 (-> this data s1-3)) - ) - ) - (if (< (-> sv-176 y) (the-as float sv-40)) - (set! sv-40 (-> sv-176 y)) - ) - (if (< (the-as float sv-44) (-> sv-176 y)) - (set! sv-44 (-> sv-176 y)) - ) - (set! sv-192 (get-length this)) - (when (>= sv-192 0) - (set! sv-200 (new 'debug 'editable-point sv-176 sv-36)) - (set! sv-208 (string->int (the-as string (-> sv-28 sql-data (+ (* 5 s3-7) 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-30 sv-152 (editable-flag no-plane-snap)) - (editable-method-31 sv-152 (editable-flag no-plane-snap)) - ) - ) - ) - ) - (set! sv-64 (+ sv-64 5)) - ) - (let* ((v1-291 (-> this length)) - (a0-158 0) - (a1-57 (-> this data a0-158)) - ) - (while (< a0-158 v1-291) - (when (and a1-57 (= (-> a1-57 region) sv-36) (= (-> a1-57 type) editable-point)) - (let ((a2-29 (&+ a1-57 28))) - (if (= (the-as float (-> a2-29 name)) (the-as float sv-40)) - (logior! (-> a1-57 flags) (editable-flag bot-set)) - ) - (if (= (the-as float (-> a2-29 name)) (the-as float 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) - (+! s4-6 6) ) ) (let ((s4-7 sql-query)) @@ -3265,26 +3227,27 @@ "select x,y,z from sample_point where level_info_id='~D' and source='manual'" (-> this level-info-id) ) - (set! sv-216 (s4-7 *temp-string*)) - ) - (if (!= (-> sv-216 content-type) 'select) - (return #f) - ) - (let ((s4-8 0)) - (while (< s4-8 (-> sv-216 length)) - (let ((s3-9 (get-length this))) - (when (>= s3-9 0) - (let ((s2-4 (new 'stack-no-clear 'vector))) - (set! (-> s2-4 x) (* 4096.0 (string->float (the-as string (-> sv-216 sql-data s4-8))))) - (set! (-> s2-4 y) (* 4096.0 (string->float (the-as string (-> sv-216 sql-data (+ s4-8 1)))))) - (set! (-> s2-4 z) (* 4096.0 (string->float (the-as string (-> sv-216 sql-data (+ s4-8 2)))))) - (set! (-> s2-4 w) 1.0) - (vector+! s2-4 s2-4 (-> this level-offset)) - (set! (-> this data s3-9) (new 'debug 'editable-sample s2-4 *editable-sample-region*)) + (let ((sv-216 (s4-7 *temp-string*))) + (if (!= (-> sv-216 content-type) 'select) + (return #f) + ) + (let ((s4-8 0)) + (while (< s4-8 (-> sv-216 length)) + (let ((s3-9 (get-length this))) + (when (>= s3-9 0) + (let ((s2-4 (new 'stack-no-clear 'vector))) + (set! (-> s2-4 x) (* 4096.0 (string->float (the-as string (-> sv-216 sql-data s4-8))))) + (set! (-> s2-4 y) (* 4096.0 (string->float (the-as string (-> sv-216 sql-data (+ s4-8 1)))))) + (set! (-> s2-4 z) (* 4096.0 (string->float (the-as string (-> sv-216 sql-data (+ s4-8 2)))))) + (set! (-> s2-4 w) 1.0) + (vector+! s2-4 s2-4 (-> this level-offset)) + (set! (-> this data s3-9) (new 'debug 'editable-sample s2-4 *editable-sample-region*)) + ) + ) ) + (+! s4-8 3) ) ) - (+! s4-8 3) ) ) (set! (-> *editable-sample-region* changed) #f) @@ -3296,57 +3259,57 @@ ;; definition for method 19 of type editable-array (defmethod editable-array-method-19 ((this editable-array) (arg0 string)) - (local-vars (sv-16 sql-result)) (let ((s4-0 sql-query)) (format (clear *temp-string*) "select entity_id,name,idx,position_x,position_y,position_z,rot_x,rot_y,rot_z from entity where level_id=~D and path like 'region-editor-%'" (-> this level-info-id) ) - (set! sv-16 (s4-0 *temp-string*)) - ) - (format #t "sql: read entity ~D~%" (/ (-> sv-16 length) 9)) - (if (!= (-> sv-16 content-type) 'select) - (return #f) - ) - (let ((s4-1 0)) - (while (< s4-1 (-> sv-16 length)) - (let ((s3-1 (get-length this))) - (when (>= s3-1 0) - (let ((s2-0 (new 'stack-no-clear 'vector))) - (set! (-> s2-0 x) (* 4096.0 (string->float (the-as string (-> sv-16 sql-data (+ s4-1 3)))))) - (set! (-> s2-0 y) (* 4096.0 (string->float (the-as string (-> sv-16 sql-data (+ s4-1 4)))))) - (set! (-> s2-0 z) (* 4096.0 (string->float (the-as string (-> sv-16 sql-data (+ s4-1 5)))))) - (set! (-> s2-0 w) 1.0) - (vector+! s2-0 s2-0 (-> this level-offset)) - (let ((s1-0 (new 'debug 'editable-region))) - (let ((v1-22 s1-0)) - (set! (-> v1-22 locked) #t) - (set! (-> v1-22 changed) #f) - (set! (-> v1-22 tree) 'entity) - (set! (-> v1-22 filter) (editable-filter entity)) - (set! (-> v1-22 level) arg0) - ) - (let ((s2-1 (new 'debug 'editable-entity s2-0 6144.0 s1-0))) - (logclear! (-> s2-1 flags) (editable-flag changed)) - (set! (-> s1-0 changed) #f) - (set! (-> this data s3-1) s2-1) - (set! (-> s2-1 id) (the-as uint (string->int (the-as string (-> sv-16 sql-data s4-1))))) - (copy-string<-string (-> s2-1 name) (the-as string (-> sv-16 sql-data (+ s4-1 1)))) - (set! (-> s2-1 idx) (string->int (the-as string (-> sv-16 sql-data (+ s4-1 2))))) - (set-eul! - (-> s2-1 angles) - (* 182.04445 (string->float (the-as string (-> sv-16 sql-data (+ s4-1 6))))) - (* 182.04445 (string->float (the-as string (-> sv-16 sql-data (+ s4-1 7))))) - (* 182.04445 (string->float (the-as string (-> sv-16 sql-data (+ s4-1 8))))) - 21 + (let ((sv-16 (s4-0 *temp-string*))) + (format #t "sql: read entity ~D~%" (/ (-> sv-16 length) 9)) + (if (!= (-> sv-16 content-type) 'select) + (return #f) + ) + (let ((s4-1 0)) + (while (< s4-1 (-> sv-16 length)) + (let ((s3-1 (get-length this))) + (when (>= s3-1 0) + (let ((s2-0 (new 'stack-no-clear 'vector))) + (set! (-> s2-0 x) (* 4096.0 (string->float (the-as string (-> sv-16 sql-data (+ s4-1 3)))))) + (set! (-> s2-0 y) (* 4096.0 (string->float (the-as string (-> sv-16 sql-data (+ s4-1 4)))))) + (set! (-> s2-0 z) (* 4096.0 (string->float (the-as string (-> sv-16 sql-data (+ s4-1 5)))))) + (set! (-> s2-0 w) 1.0) + (vector+! s2-0 s2-0 (-> this level-offset)) + (let ((s1-0 (new 'debug 'editable-region))) + (let ((v1-22 s1-0)) + (set! (-> v1-22 locked) #t) + (set! (-> v1-22 changed) #f) + (set! (-> v1-22 tree) 'entity) + (set! (-> v1-22 filter) (editable-filter entity)) + (set! (-> v1-22 level) arg0) + ) + (let ((s2-1 (new 'debug 'editable-entity s2-0 6144.0 s1-0))) + (logclear! (-> s2-1 flags) (editable-flag changed)) + (set! (-> s1-0 changed) #f) + (set! (-> this data s3-1) s2-1) + (set! (-> s2-1 id) (the-as uint (string->int (the-as string (-> sv-16 sql-data s4-1))))) + (copy-string<-string (-> s2-1 name) (the-as string (-> sv-16 sql-data (+ s4-1 1)))) + (set! (-> s2-1 idx) (string->int (the-as string (-> sv-16 sql-data (+ s4-1 2))))) + (set-eul! + (-> s2-1 angles) + (* 182.04445 (string->float (the-as string (-> sv-16 sql-data (+ s4-1 6))))) + (* 182.04445 (string->float (the-as string (-> sv-16 sql-data (+ s4-1 7))))) + (* 182.04445 (string->float (the-as string (-> sv-16 sql-data (+ s4-1 8))))) + 21 + ) + ) ) ) ) ) + (+! s4-1 9) ) ) - (+! s4-1 9) ) ) (set! (-> *editable-entity-region* changed) #f) @@ -3426,7 +3389,3 @@ (set! *editable-entity-region* v0-108) ) ) - - - - diff --git a/test/decompiler/reference/jak3/engine/debug/history_REF.gc b/test/decompiler/reference/jak3/engine/debug/history_REF.gc index 667c953eb6..3afcb244b9 100644 --- a/test/decompiler/reference/jak3/engine/debug/history_REF.gc +++ b/test/decompiler/reference/jak3/engine/debug/history_REF.gc @@ -447,150 +447,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 (the-as int (-> 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 (the-as int (-> 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) - ) - ) + ) + ) + ) ) ) ) @@ -605,115 +598,116 @@ ;; 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 number)) - (set! sv-16 (the-as vector #f)) - (set! sv-20 (the-as vector #f)) - (set! sv-24 0) - (until #f - (let ((s5-0 (update-entries! arg0))) - (if (not s5-0) - (goto cfg-34) - ) - (when (logtest? (-> arg0 channel-mask) (ash 1 (the-as int (-> 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 0.0) + ) + (until #f + (let ((s5-0 (update-entries! arg0))) + (if (not s5-0) + (goto cfg-34) + ) + (when (logtest? (-> arg0 channel-mask) (ash 1 (the-as int (-> 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* (shr (shl (the-as int sv-24) 54) 61) 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 (-> 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* (shr (shl (the-as int sv-24) 54) 61) 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 (-> 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/jak3/engine/debug/manipulator_REF.gc b/test/decompiler/reference/jak3/engine/debug/manipulator_REF.gc index 66f737a2bc..f5f1c64877 100644 --- a/test/decompiler/reference/jak3/engine/debug/manipulator_REF.gc +++ b/test/decompiler/reference/jak3/engine/debug/manipulator_REF.gc @@ -52,17 +52,6 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch symbol vs none. (defun draw-axis ((arg0 vector) (arg1 vector) (arg2 float) (arg3 float) (arg4 rgba)) - (local-vars - (sv-160 int) - (sv-176 (function symbol bucket-id vector vector vector rgba symbol)) - (sv-192 symbol) - (sv-208 int) - (sv-224 vector) - (sv-240 vector) - (sv-256 vector) - (sv-272 vector) - (sv-288 vector) - ) (rlet ((acc :class vf) (vf0 :class vf) (vf4 :class vf) @@ -85,67 +74,72 @@ ) (vector-cross! s1-0 s1-0 arg1) (vector-normalize! s1-0 1.0) - (let ((s0-1 (vector+*! (new 'stack-no-clear 'vector) arg0 arg1 arg2))) - (set! sv-160 0) + (let ((s0-1 (vector+*! (new 'stack-no-clear 'vector) arg0 arg1 arg2)) + (sv-160 0) + ) (while (< sv-160 8) - (set! sv-176 add-debug-flat-triangle) - (set! sv-192 #t) - (set! sv-208 584) - (set! sv-224 (new 'stack-no-clear 'vector)) - (let ((v1-16 s0-1)) - (let ((a0-9 arg1)) - (let ((a1-10 arg3)) - (.mov vf7 a1-10) + (let ((sv-176 add-debug-flat-triangle) + (sv-192 #t) + (sv-208 584) + (sv-224 (new 'stack-no-clear 'vector)) ) - (.lvf vf5 (&-> a0-9 quad)) + (let ((v1-16 s0-1)) + (let ((a0-9 arg1)) + (let ((a1-10 arg3)) + (.mov vf7 a1-10) + ) + (.lvf vf5 (&-> a0-9 quad)) + ) + (.lvf vf4 (&-> v1-16 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-224 quad) vf6) - (set! sv-256 (new 'stack-no-clear 'vector)) - (set! sv-240 s0-1) - (let* ((a2-3 - (quaternion-vector-angle! (new 'stack-no-clear 'quaternion) arg1 (* 182.04445 (the float (* 45 sv-160)))) - ) - (v1-22 (vector-orient-by-quat! (new 'stack-no-clear 'vector) s1-0 a2-3)) - ) - (let ((a0-13 (/ arg3 4))) - (.mov vf7 a0-13) - ) - (.lvf vf5 (&-> v1-22 quad)) - ) - (.lvf vf4 (&-> sv-240 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-256 quad) vf6) - (set! sv-288 (new 'stack-no-clear 'vector)) - (set! sv-272 s0-1) - (let* ((a2-7 (quaternion-vector-angle! - (new 'stack-no-clear 'quaternion) - arg1 - (* 182.04445 (the float (* 45 (+ sv-160 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 (&-> sv-224 quad) vf6) + (let ((sv-256 (new 'stack-no-clear 'vector))) + (let ((sv-240 s0-1)) + (let* ((a2-3 + (quaternion-vector-angle! (new 'stack-no-clear 'quaternion) arg1 (* 182.04445 (the float (* 45 sv-160)))) ) + (v1-22 (vector-orient-by-quat! (new 'stack-no-clear 'vector) s1-0 a2-3)) ) - (v1-29 (vector-orient-by-quat! (new 'stack-no-clear 'vector) s1-0 a2-7)) - ) - (let ((a0-17 (/ arg3 4))) - (.mov vf7 a0-17) + (let ((a0-13 (/ arg3 4))) + (.mov vf7 a0-13) + ) + (.lvf vf5 (&-> v1-22 quad)) + ) + (.lvf vf4 (&-> sv-240 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-256 quad) vf6) + (let ((sv-288 (new 'stack-no-clear 'vector))) + (let ((sv-272 s0-1)) + (let* ((a2-7 (quaternion-vector-angle! + (new 'stack-no-clear 'quaternion) + arg1 + (* 182.04445 (the float (* 45 (+ sv-160 1)))) + ) + ) + (v1-29 (vector-orient-by-quat! (new 'stack-no-clear 'vector) s1-0 a2-7)) + ) + (let ((a0-17 (/ arg3 4))) + (.mov vf7 a0-17) + ) + (.lvf vf5 (&-> v1-29 quad)) + ) + (.lvf vf4 (&-> sv-272 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-288 quad) vf6) + (sv-176 sv-192 (the-as bucket-id sv-208) sv-224 sv-256 sv-288 arg4) + ) ) - (.lvf vf5 (&-> v1-29 quad)) ) - (.lvf vf4 (&-> sv-272 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-288 quad) vf6) - (let ((t1-0 arg4)) - (sv-176 sv-192 (the-as bucket-id sv-208) sv-224 sv-256 sv-288 t1-0) - ) - (set! sv-160 (+ sv-160 1)) + (+! sv-160 1) ) ) ) @@ -166,9 +160,10 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defmethod manipulator-method-10 ((this manipulator) (arg0 vector) (arg1 vector)) - (local-vars (v1-11 symbol) (sv-160 symbol) (sv-176 vector)) - (set! sv-176 arg1) - (let ((s4-0 (-> this position))) + (local-vars (v1-11 symbol)) + (let ((sv-176 arg1) + (s4-0 (-> this position)) + ) 0.0 (let* ((v0-0 (vector-normalize! (vector-! (new 'stack-no-clear 'vector) (-> *math-camera* trans) (-> this position)) 1.0) @@ -177,106 +172,104 @@ (s2-0 (< (fabs (vector-dot v0-0 (-> this mat uvec))) 0.9)) ) (b! (< (fabs (vector-dot v0-0 (-> this mat fvec))) 0.9) cfg-6 :delay (set! v1-11 #t)) - (set! sv-160 v1-11) - (set! sv-160 #f) - (label cfg-6) - (let ((f28-0 (the-as float #x7f800000)) - (f30-1 (* 0.15 (vector-vector-distance (-> *math-camera* trans) s4-0))) - ) - (set! (-> this action) (manipulator-action ma0)) - (let ((s1-0 (new 'stack-no-clear 'vector))) - 0.0 - (let* ((s0-0 (new 'stack-no-clear 'vector)) - (v1-16 arg0) - (s0-1 (vector-! s0-0 sv-176 v1-16)) - ) - (let ((f0-14 (ray-sphere-intersect arg0 s0-1 s4-0 (/ f30-1 5)))) - (when (and (< 0.0 f0-14) (>= f28-0 f0-14)) - (set! f28-0 f0-14) - (set! (-> this action) (manipulator-action ma7)) - ) + (let ((sv-160 v1-11)) + (set! sv-160 #f) + (label cfg-6) + (let ((f28-0 (the-as float #x7f800000)) + (f30-1 (* 0.15 (vector-vector-distance (-> *math-camera* trans) s4-0))) ) - (when (= (-> this action) (manipulator-action ma0)) - (when (and s3-0 s2-0) - (let ((f0-18 (ray-sphere-intersect - arg0 - s0-1 - (vector+*! - (new 'stack-no-clear 'vector) - s4-0 - (vector+! (new 'stack-no-clear 'vector) (-> this mat rvec) (-> this mat uvec)) - f30-1 + (set! (-> this action) (manipulator-action ma0)) + (let ((s1-0 (new 'stack-no-clear 'vector))) + 0.0 + (let ((s0-1 (vector-! (new 'stack-no-clear 'vector) sv-176 arg0))) + (let ((f0-14 (ray-sphere-intersect arg0 s0-1 s4-0 (/ f30-1 5)))) + (when (and (< 0.0 f0-14) (>= f28-0 f0-14)) + (set! f28-0 f0-14) + (set! (-> this action) (manipulator-action ma7)) + ) + ) + (when (= (-> this action) (manipulator-action ma0)) + (when (and s3-0 s2-0) + (let ((f0-18 (ray-sphere-intersect + arg0 + s0-1 + (vector+*! + (new 'stack-no-clear 'vector) + s4-0 + (vector+! (new 'stack-no-clear 'vector) (-> this mat rvec) (-> this mat uvec)) + f30-1 + ) + (* 0.3 f30-1) ) - (* 0.3 f30-1) ) - ) + ) + (when (and (< 0.0 f0-18) (>= f28-0 f0-18)) + (set! f28-0 f0-18) + (set! (-> this action) (manipulator-action ma4)) ) - (when (and (< 0.0 f0-18) (>= f28-0 f0-18)) - (set! f28-0 f0-18) - (set! (-> this action) (manipulator-action ma4)) ) ) - ) - (when (and s3-0 sv-160) - (let ((f0-22 (ray-sphere-intersect - arg0 - s0-1 - (vector+*! - (new 'stack-no-clear 'vector) - s4-0 - (vector+! (new 'stack-no-clear 'vector) (-> this mat rvec) (-> this mat fvec)) - f30-1 + (when (and s3-0 sv-160) + (let ((f0-22 (ray-sphere-intersect + arg0 + s0-1 + (vector+*! + (new 'stack-no-clear 'vector) + s4-0 + (vector+! (new 'stack-no-clear 'vector) (-> this mat rvec) (-> this mat fvec)) + f30-1 + ) + (* 0.3 f30-1) ) - (* 0.3 f30-1) ) - ) + ) + (when (and (< 0.0 f0-22) (>= f28-0 f0-22)) + (set! f28-0 f0-22) + (set! (-> this action) (manipulator-action ma5)) ) - (when (and (< 0.0 f0-22) (>= f28-0 f0-22)) - (set! f28-0 f0-22) - (set! (-> this action) (manipulator-action ma5)) ) ) - ) - (when (and s2-0 sv-160) - (let ((f0-26 (ray-sphere-intersect - arg0 - s0-1 - (vector+*! - (new 'stack-no-clear 'vector) - s4-0 - (vector+! (new 'stack-no-clear 'vector) (-> this mat uvec) (-> this mat fvec)) - f30-1 + (when (and s2-0 sv-160) + (let ((f0-26 (ray-sphere-intersect + arg0 + s0-1 + (vector+*! + (new 'stack-no-clear 'vector) + s4-0 + (vector+! (new 'stack-no-clear 'vector) (-> this mat uvec) (-> this mat fvec)) + f30-1 + ) + (* 0.3 f30-1) ) - (* 0.3 f30-1) ) - ) + ) + (when (and (< 0.0 f0-26) (>= f28-0 f0-26)) + (set! f28-0 f0-26) + (set! (-> this action) (manipulator-action ma6)) ) - (when (and (< 0.0 f0-26) (>= f28-0 f0-26)) - (set! f28-0 f0-26) - (set! (-> this action) (manipulator-action ma6)) ) ) - ) - (when s3-0 - (let ((f0-31 (ray-cylinder-intersect arg0 s0-1 s4-0 (-> this mat rvec) (/ f30-1 10) (* 1.3 f30-1) s1-0))) - (when (and (< 0.0 f0-31) (>= f28-0 f0-31)) - (set! f28-0 f0-31) - (set! (-> this action) (manipulator-action ma1)) + (when s3-0 + (let ((f0-31 (ray-cylinder-intersect arg0 s0-1 s4-0 (-> this mat rvec) (/ f30-1 10) (* 1.3 f30-1) s1-0))) + (when (and (< 0.0 f0-31) (>= f28-0 f0-31)) + (set! f28-0 f0-31) + (set! (-> this action) (manipulator-action ma1)) + ) ) ) - ) - (when s2-0 - (let ((f0-36 (ray-cylinder-intersect arg0 s0-1 s4-0 (-> this mat uvec) (/ f30-1 10) (* 1.3 f30-1) s1-0))) - (if (and (< 0.0 f0-36) (>= f28-0 f0-36)) - (set! (-> this action) (manipulator-action ma2)) - ) + (when s2-0 + (let ((f0-36 (ray-cylinder-intersect arg0 s0-1 s4-0 (-> this mat uvec) (/ f30-1 10) (* 1.3 f30-1) s1-0))) + (if (and (< 0.0 f0-36) (>= f28-0 f0-36)) + (set! (-> this action) (manipulator-action ma2)) + ) + ) ) - ) - (when sv-160 - (let ((f0-41 (ray-cylinder-intersect arg0 s0-1 s4-0 (-> this mat fvec) (/ f30-1 10) (* 1.3 f30-1) s1-0))) - (if (and (< 0.0 f0-41) (>= f0-41 f0-41)) - (set! (-> this action) (manipulator-action ma3)) - ) + (when sv-160 + (let ((f0-41 (ray-cylinder-intersect arg0 s0-1 s4-0 (-> this mat fvec) (/ f30-1 10) (* 1.3 f30-1) s1-0))) + (if (and (< 0.0 f0-41) (>= f0-41 f0-41)) + (set! (-> this action) (manipulator-action ma3)) + ) + ) ) ) ) @@ -293,7 +286,7 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defmethod manipulator-method-11 ((this manipulator)) - (local-vars (sv-240 rgba) (sv-256 vector) (sv-272 vector)) + (local-vars (sv-240 rgba)) (format *stdcon* "~M ~M ~M~%" (-> this position x) (-> this position y) (-> this position z)) (let ((s5-0 (-> this position))) 0.0 @@ -330,10 +323,16 @@ (s0-0 (new 'stack-no-clear 'vector)) ) (let ((f28-0 0.1)) - (if (= (-> this action) (manipulator-action ma7)) - (set! sv-240 *color-yellow*) - (set! sv-240 *color-light-blue*) - ) + (set! sv-240 (cond + ((= (-> this action) (manipulator-action ma7)) + (set! sv-240 *color-yellow*) + sv-240 + ) + (else + *color-light-blue* + ) + ) + ) (vector+*! s1-0 s5-0 @@ -355,44 +354,37 @@ (vector-copy! s1-0 s0-0) (vector+*! s0-0 s0-0 (-> *math-camera* inv-camera-rot rvec) (* 2.0 f30-1 f28-0)) ) - (let ((t9-9 add-debug-line) - (a0-31 #t) - (a1-20 577) - (t1-3 #f) - (t2-3 -1) - ) - (t9-9 a0-31 (the-as bucket-id a1-20) s1-0 s0-0 sv-240 t1-3 (the-as rgba t2-3)) - ) + (add-debug-line #t (bucket-id debug-no-zbuf1) s1-0 s0-0 sv-240 #f (the-as rgba -1)) ) (let ((s1-1 (new 'stack-no-clear 'vector))) (when (and s3-0 s2-0) (vector+*! s1-1 s5-0 (vector+! (new 'stack-no-clear 'vector) (-> this mat fvec) (-> this mat uvec)) f30-1) - (let ((s0-1 draw-axis)) - (set! sv-256 s1-1) - (let ((a1-24 (vector-negate! (new 'stack-no-clear 'vector) (-> this mat uvec))) - (a2-15 (* 0.15 f30-1)) - (a3-11 (* 0.15 f30-1)) - (t0-11 (if (= (-> this action) (manipulator-action ma6)) - *color-yellow* - *color-green* - ) - ) + (let ((s0-1 draw-axis) + (sv-256 s1-1) + ) + (s0-1 + sv-256 + (vector-negate! (new 'stack-no-clear 'vector) (-> this mat uvec)) + (* 0.15 f30-1) + (* 0.15 f30-1) + (if (= (-> this action) (manipulator-action ma6)) + *color-yellow* + *color-green* ) - (s0-1 sv-256 a1-24 a2-15 a3-11 t0-11) ) ) - (let ((s0-2 draw-axis)) - (set! sv-272 s1-1) - (let ((a1-26 (vector-negate! (new 'stack-no-clear 'vector) (-> this mat fvec))) - (a2-16 (* 0.15 f30-1)) - (a3-12 (* 0.15 f30-1)) - (t0-12 (if (= (-> this action) (manipulator-action ma6)) - *color-yellow* - *color-blue* - ) - ) + (let ((s0-2 draw-axis) + (sv-272 s1-1) + ) + (s0-2 + sv-272 + (vector-negate! (new 'stack-no-clear 'vector) (-> this mat fvec)) + (* 0.15 f30-1) + (* 0.15 f30-1) + (if (= (-> this action) (manipulator-action ma6)) + *color-yellow* + *color-blue* ) - (s0-2 sv-272 a1-26 a2-16 a3-12 t0-12) ) ) ) @@ -610,7 +602,3 @@ 0 (none) ) - - - - diff --git a/test/decompiler/reference/jak3/engine/debug/memory-usage_REF.gc b/test/decompiler/reference/jak3/engine/debug/memory-usage_REF.gc index 9124065c95..f9a34216d5 100644 --- a/test/decompiler/reference/jak3/engine/debug/memory-usage_REF.gc +++ b/test/decompiler/reference/jak3/engine/debug/memory-usage_REF.gc @@ -302,7 +302,6 @@ ;; definition for method 11 of type memory-usage-block ;; INFO: Used lq/sq (defmethod print-mem-usage ((this memory-usage-block) (arg0 level) (arg1 object)) - (local-vars (sv-16 object) (sv-32 string) (sv-48 symbol)) (let ((s3-0 (&- (-> arg0 heap current) (the-as uint (-> arg0 heap base))))) (let ((v1-2 (+ (-> this data 62 total) (-> this data 63 total)))) (< #x10000 v1-2) @@ -380,220 +379,219 @@ (if (< (- s1-0 (the-as int (shl (-> arg0 info buffer-size) 10))) s3-0) (format arg1 "~3L") ) - (let ((s0-0 format)) - (set! sv-16 arg1) - (set! sv-32 "~0K~10,'-S--~5,'-DK-of-~5,'-DK--~5,'-DK-of-~5,'-DK--") - (set! sv-48 (-> arg0 name)) - (let* ((s3-1 (sar s3-0 10)) - (s4-1 (- (sar s1-0 10) (the-as int (-> arg0 info buffer-size)))) - (s1-1 (sar (memory-used *nk-dead-pool*) 10)) - (t2-0 (sar (memory-total *nk-dead-pool*) 10)) - (t0-0 s4-1) - (t1-0 s1-1) - ) - (s0-0 sv-16 sv-32 sv-48 s3-1 t0-0 t1-0 t2-0) - (format arg1 "~5,'-DK/~5,'-DK--~%" (shr s2-0 10) (sar *max-dma* 10)) - (when *stats-memory-short* - (let ((s3-2 (if (cpad-hold? 1 l3) - #t - arg1 - ) - ) - (s4-2 format) - (s2-1 "heap-~5,'-DK/~5,'-DK----~D---~D/~D~%") - (s1-2 (sar (memory-used *nk-dead-pool*) 10)) - (s0-1 (sar (memory-total *nk-dead-pool*) 10)) - ) - (set! t0-0 (the-as int (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-1 s1-2 s0-1 (the-as uint t0-0) (the-as uint t1-0) (the-as uint t2-0)) - ) + (let* ((s0-0 format) + (sv-16 arg1) + (sv-32 "~0K~10,'-S--~5,'-DK-of-~5,'-DK--~5,'-DK-of-~5,'-DK--") + (sv-48 (-> arg0 name)) + (s3-1 (sar s3-0 10)) + (s4-1 (- (sar s1-0 10) (the-as int (-> arg0 info buffer-size)))) + (s1-1 (sar (memory-used *nk-dead-pool*) 10)) + (t2-0 (sar (memory-total *nk-dead-pool*) 10)) + (t0-0 s4-1) + (t1-0 s1-1) + ) + (s0-0 sv-16 sv-32 sv-48 s3-1 t0-0 t1-0 t2-0) + (format arg1 "~5,'-DK/~5,'-DK--~%" (shr s2-0 10) (sar *max-dma* 10)) + (when *stats-memory-short* + (let ((s3-2 (if (cpad-hold? 1 l3) + #t + arg1 + ) + ) + (s4-2 format) + (s2-1 "heap-~5,'-DK/~5,'-DK----~D---~D/~D~%") + (s1-2 (sar (memory-used *nk-dead-pool*) 10)) + (s0-1 (sar (memory-total *nk-dead-pool*) 10)) + ) + (set! t0-0 (the-as int (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-1 s1-2 s0-1 (the-as uint t0-0) (the-as uint t1-0) (the-as uint t2-0)) ) - (when (not *stats-memory-short*) - (set! (-> *dma-mem-usage* data 88 total) - (* (dma-buffer-length (-> *display* frames (-> *display* last-screen) debug-buf)) 16) + ) + (when (not *stats-memory-short*) + (set! (-> *dma-mem-usage* data 88 total) + (* (dma-buffer-length (-> *display* frames (-> *display* last-screen) debug-buf)) 16) + ) + (let ((t9-11 format) + (a0-47 arg1) + (a1-28 " bsp ~192H~5DK ~280Hdebug~456H~5DK~%") + (a2-12 (sar (+ (-> this data 59 total) (-> this data 60 total) (-> this data 61 total)) 10)) + (a3-5 (sar (-> *dma-mem-usage* data 88 total) 10)) + ) + (t9-11 a0-47 a1-28 a2-12 a3-5 (the-as none t0-0) (the-as none t1-0) (the-as none t2-0)) + (format + arg1 + " bsp-leaf-vis ~192H~5DK~%" + (sar (+ (-> this data 62 total) (-> this data 63 total)) 10) + (the-as none a3-5) + ) + (format arg1 " level-code ~192H~5DK~%" (sar (-> this data 66 total) 10) (the-as none a3-5)) + ) + (format + arg1 + " 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 + arg1 + " 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 89 total) 10) + ) + (format + arg1 + " 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 + arg1 + " 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 + arg1 + " shrub-instance ~192H~5DK ~280Hshrubbery~456H~5DK~%" + (sar (-> this data 34 total) 10) + (sar (-> *dma-mem-usage* data 27 total) 10) + ) + (format + arg1 + " hfragment ~192H~5DK ~280Hhfragment~456H~5DK~%" + (sar (-> this data 43 total) 10) + (sar (-> *dma-mem-usage* data 43 total) 10) + (the-as none t0-0) + (the-as none t1-0) + (the-as none t2-0) + ) + (format + arg1 + " collision ~192H~5DK ~280Htie-generic~456H~5DK~%" + (sar + (+ (-> 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) + (-> this data 58 total) + ) + 10 + ) + (sar (-> *dma-mem-usage* data 17 total) 10) + ) + (format + arg1 + " 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 74 total) + (-> this data 75 total) + (-> this data 76 total) + (-> this data 77 total) + (-> this data 79 total) + (-> this data 82 total) + (-> this data 81 total) + (-> this data 112 total) + ) + 10 + ) + (sar (-> *dma-mem-usage* data 35 total) 10) + ) + (format + arg1 + " pris-anim ~192H~5DK ~280Hpris-generic~456H~5DK~%" + (sar + (+ (-> this data 68 total) + (-> this data 69 total) + (-> this data 70 total) + (-> this data 71 total) + (-> this data 72 total) + (-> this data 78 total) + (-> this data 80 total) + (-> this data 73 total) + ) + 10 + ) + (sar (-> *dma-mem-usage* data 90 total) 10) + ) + (format + arg1 + " textures ~192H~5DK ~280Htextures~456H~5DK~%" + (sar (-> this data 83 total) 10) + (sar (-> *dma-mem-usage* data 83 total) 10) + ) + (format arg1 " entity ~192H~5DK~%" (sar + (+ (-> this data 67 total) + (-> this data 44 total) + (-> this data 45 total) + (-> this data 46 total) + (-> this data 50 total) + (-> this data 49 total) + (-> this data 47 total) + (-> this data 48 total) + ) + 10 + ) ) - (let ((t9-11 format) - (a0-47 arg1) - (a1-28 " bsp ~192H~5DK ~280Hdebug~456H~5DK~%") - (a2-12 (sar (+ (-> this data 59 total) (-> this data 60 total) (-> this data 61 total)) 10)) - (a3-5 (sar (-> *dma-mem-usage* data 88 total) 10)) - ) - (t9-11 a0-47 a1-28 a2-12 a3-5 (the-as none t0-0) (the-as none t1-0) (the-as none t2-0)) - (format - arg1 - " bsp-leaf-vis ~192H~5DK~%" - (sar (+ (-> this data 62 total) (-> this data 63 total)) 10) - (the-as none a3-5) - ) - (format arg1 " level-code ~192H~5DK~%" (sar (-> this data 66 total) 10) (the-as none a3-5)) - ) - (format - arg1 - " 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 - arg1 - " 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 89 total) 10) - ) - (format - arg1 - " 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 - arg1 - " 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 - arg1 - " shrub-instance ~192H~5DK ~280Hshrubbery~456H~5DK~%" - (sar (-> this data 34 total) 10) - (sar (-> *dma-mem-usage* data 27 total) 10) - ) - (format - arg1 - " hfragment ~192H~5DK ~280Hhfragment~456H~5DK~%" - (sar (-> this data 43 total) 10) - (sar (-> *dma-mem-usage* data 43 total) 10) - (the-as none t0-0) - (the-as none t1-0) - (the-as none t2-0) - ) - (format - arg1 - " collision ~192H~5DK ~280Htie-generic~456H~5DK~%" - (sar - (+ (-> 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) - (-> this data 58 total) - ) - 10 - ) - (sar (-> *dma-mem-usage* data 17 total) 10) - ) - (format - arg1 - " 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 74 total) - (-> this data 75 total) - (-> this data 76 total) - (-> this data 77 total) - (-> this data 79 total) - (-> this data 82 total) - (-> this data 81 total) - (-> this data 112 total) - ) - 10 - ) - (sar (-> *dma-mem-usage* data 35 total) 10) - ) - (format - arg1 - " pris-anim ~192H~5DK ~280Hpris-generic~456H~5DK~%" - (sar - (+ (-> this data 68 total) - (-> this data 69 total) - (-> this data 70 total) - (-> this data 71 total) - (-> this data 72 total) - (-> this data 78 total) - (-> this data 80 total) - (-> this data 73 total) - ) - 10 - ) - (sar (-> *dma-mem-usage* data 90 total) 10) - ) - (format - arg1 - " textures ~192H~5DK ~280Htextures~456H~5DK~%" - (sar (-> this data 83 total) 10) - (sar (-> *dma-mem-usage* data 83 total) 10) - ) - (format arg1 " entity ~192H~5DK~%" (sar - (+ (-> this data 67 total) - (-> this data 44 total) - (-> this data 45 total) - (-> this data 46 total) - (-> this data 50 total) - (-> this data 49 total) - (-> this data 47 total) - (-> this data 48 total) - ) - 10 - ) - ) - (format - arg1 - " misc ~192H~5DK ~280Hsprite~456H~5DK~%" - (sar - (+ (-> this data 0 total) - (-> this data 64 total) - (-> this data 65 total) - (-> this data 84 total) - (-> this data 85 total) - ) - 10 - ) - (sar (-> *dma-mem-usage* data 86 total) 10) + (format + arg1 + " misc ~192H~5DK ~280Hsprite~456H~5DK~%" + (sar + (+ (-> this data 0 total) + (-> this data 64 total) + (-> this data 65 total) + (-> this data 84 total) + (-> this data 85 total) + ) + 10 ) + (sar (-> *dma-mem-usage* data 86 total) 10) ) ) ) @@ -603,7 +601,3 @@ (format arg1 "~1K~0L") this ) - - - - diff --git a/test/decompiler/reference/jak3/engine/debug/menu_REF.gc b/test/decompiler/reference/jak3/engine/debug/menu_REF.gc index 1f0d67cd6c..e17d95d838 100644 --- a/test/decompiler/reference/jak3/engine/debug/menu_REF.gc +++ b/test/decompiler/reference/jak3/engine/debug/menu_REF.gc @@ -672,18 +672,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) @@ -758,79 +747,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 ) @@ -1065,7 +1019,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)) @@ -1110,23 +1063,25 @@ ) ) (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)) - (set-context! *font-work* (-> arg0 context font)) - (draw-string ">" sv-16 (-> arg0 context font)) - (let ((a3-3 (-> sv-16 base))) - (when (!= sv-32 a3-3) - (let ((v1-35 (the-as object (-> sv-16 base)))) - (set! (-> (the-as dma-packet v1-35) dma) (new 'static 'dma-tag :id (dma-tag-id next))) - (set! (-> (the-as dma-packet v1-35) vif0) (new 'static 'vif-tag)) - (set! (-> (the-as dma-packet v1-35) vif1) (new 'static 'vif-tag)) - (set! (-> sv-16 base) (&+ (the-as pointer v1-35) 16)) - ) - (dma-bucket-insert-tag - (-> *display* frames (-> *display* on-screen) bucket-group) - (bucket-id debug-menu) - sv-32 - (the-as (pointer dma-tag) a3-3) + (let* ((sv-16 (-> *display* frames (-> *display* on-screen) debug-buf)) + (sv-32 (-> sv-16 base)) + ) + (set-context! *font-work* (-> arg0 context font)) + (draw-string ">" sv-16 (-> arg0 context font)) + (let ((a3-3 (-> sv-16 base))) + (when (!= sv-32 a3-3) + (let ((v1-35 (the-as object (-> sv-16 base)))) + (set! (-> (the-as dma-packet v1-35) dma) (new 'static 'dma-tag :id (dma-tag-id next))) + (set! (-> (the-as dma-packet v1-35) vif0) (new 'static 'vif-tag)) + (set! (-> (the-as dma-packet v1-35) vif1) (new 'static 'vif-tag)) + (set! (-> sv-16 base) (&+ (the-as pointer v1-35) 16)) + ) + (dma-bucket-insert-tag + (-> *display* frames (-> *display* on-screen) bucket-group) + (bucket-id debug-menu) + sv-32 + (the-as (pointer dma-tag) a3-3) + ) ) ) ) diff --git a/test/decompiler/reference/jak3/engine/debug/nav-mesh-editor_REF.gc b/test/decompiler/reference/jak3/engine/debug/nav-mesh-editor_REF.gc index 400c2f653e..45a14b4343 100644 --- a/test/decompiler/reference/jak3/engine/debug/nav-mesh-editor_REF.gc +++ b/test/decompiler/reference/jak3/engine/debug/nav-mesh-editor_REF.gc @@ -7,7 +7,6 @@ ;; definition for function snap-level-navmesh ;; INFO: Used lq/sq (defun snap-level-navmesh ((arg0 vector) (arg1 vector)) - (local-vars (sv-96 nav-poly) (sv-112 vector) (sv-128 int)) (dotimes (s4-0 (-> *level* length)) (let ((v1-3 (-> *level* level s4-0))) (when (= (-> v1-3 status) 'active) @@ -21,22 +20,24 @@ (let ((s1-1 (-> v1-8 nav-mesh))) (new 'stack-no-clear 'vector) (dotimes (s0-0 (the-as int (-> s1-1 poly-count))) - (set! sv-96 (-> s1-1 poly-array s0-0)) - (set! sv-112 (new 'stack-no-clear 'vector)) - (set! sv-128 0) - (while (< sv-128 (the-as int (-> sv-96 vertex-count))) - (when (transform-point-vector! - sv-112 - (vector+! (new 'stack-no-clear 'vector) (the-as vector (-> s1-1 bounds)) (-> sv-96 vertex sv-128)) - ) - (when (and (< (fabs (- (-> arg0 x) (+ -2048.0 (-> sv-112 x)))) 8.0) - (< (fabs (- (-> arg0 y) (+ -2048.0 (-> sv-112 y)))) 8.0) - ) - (vector+! arg1 (the-as vector (-> s1-1 bounds)) (-> sv-96 vertex sv-128)) - (return #t) + (let ((sv-96 (-> s1-1 poly-array s0-0)) + (sv-112 (new 'stack-no-clear 'vector)) + (sv-128 0) ) + (while (< sv-128 (the-as int (-> sv-96 vertex-count))) + (when (transform-point-vector! + sv-112 + (vector+! (new 'stack-no-clear 'vector) (the-as vector (-> s1-1 bounds)) (-> sv-96 vertex sv-128)) + ) + (when (and (< (fabs (- (-> arg0 x) (+ -2048.0 (-> sv-112 x)))) 8.0) + (< (fabs (- (-> arg0 y) (+ -2048.0 (-> sv-112 y)))) 8.0) + ) + (vector+! arg1 (the-as vector (-> s1-1 bounds)) (-> sv-96 vertex sv-128)) + (return #t) + ) + ) + (+! sv-128 1) ) - (set! sv-128 (+ sv-128 1)) ) ) ) @@ -2369,7 +2370,6 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs object. (defmethod nav-mesh-editable-method-17 ((this nav-mesh-editable)) - (local-vars (sv-16 symbol) (sv-32 int) (sv-48 vector)) (let ((s5-0 0)) (let ((s4-0 0)) (b! #t cfg-33 :delay (nop!)) @@ -2382,37 +2382,40 @@ ) (b! #t cfg-28 :delay (nop!)) (label cfg-2) - (set! sv-16 (the-as symbol #f)) - (set! sv-48 (-> this verts data (-> s3-0 index data s1-0))) - (b! (not #t) cfg-25 :delay (nop!)) - (let ((v1-10 (or (= s0-0 -1) - (< 204.8 (vector-vector-distance (-> *clean-vertex-array* (-> *clean-index-array* s0-0)) sv-48)) - ) - ) + (let ((sv-16 (the-as symbol #f)) + (sv-48 (-> this verts data (-> s3-0 index data s1-0))) ) - (b! (not v1-10) cfg-13 :likely-delay (set! v1-13 v1-10)) - ) - (let ((a0-10 (!= s1-0 (+ (-> s3-0 index length) -1)))) - (b! a0-10 cfg-13 :likely-delay (set! v1-17 a0-10)) - ) - (< 204.8 (vector-vector-distance (-> *clean-vertex-array* (-> *clean-index-array* 0)) sv-48)) - (label cfg-13) - (set! sv-32 0) - (while (< sv-32 s5-0) - (when (and (not sv-16) (< (vector-vector-distance (-> *clean-vertex-array* sv-32) sv-48) 204.8)) - (set! sv-16 #t) - (set! s0-0 sv-32) - (set! (-> *clean-index-array* s2-0) sv-32) - (+! s2-0 1) + (b! (not #t) cfg-25 :delay (nop!)) + (let ((v1-10 (or (= s0-0 -1) + (< 204.8 (vector-vector-distance (-> *clean-vertex-array* (-> *clean-index-array* s0-0)) sv-48)) + ) + ) + ) + (b! (not v1-10) cfg-13 :likely-delay (set! v1-13 v1-10)) + ) + (let ((a0-10 (!= s1-0 (+ (-> s3-0 index length) -1)))) + (b! a0-10 cfg-13 :likely-delay (set! v1-17 a0-10)) + ) + (< 204.8 (vector-vector-distance (-> *clean-vertex-array* (-> *clean-index-array* 0)) sv-48)) + (label cfg-13) + (let ((sv-32 0)) + (while (< sv-32 s5-0) + (when (and (not sv-16) (< (vector-vector-distance (-> *clean-vertex-array* sv-32) sv-48) 204.8)) + (set! sv-16 #t) + (set! s0-0 sv-32) + (set! (-> *clean-index-array* s2-0) sv-32) + (+! s2-0 1) + ) + (+! sv-32 1) + ) + ) + (when (not sv-16) + (vector-copy! (-> *clean-vertex-array* s5-0) sv-48) + (set! s0-0 s5-0) + (set! (-> *clean-index-array* s2-0) s5-0) + (+! s2-0 1) + (+! s5-0 1) ) - (set! sv-32 (+ sv-32 1)) - ) - (when (not sv-16) - (vector-copy! (-> *clean-vertex-array* s5-0) sv-48) - (set! s0-0 s5-0) - (set! (-> *clean-index-array* s2-0) s5-0) - (+! s2-0 1) - (+! s5-0 1) ) (b! #t cfg-27 :delay (nop!)) (label cfg-25) @@ -3125,16 +3128,9 @@ (defun segments-intersect ((arg0 vector) (arg1 vector) (arg2 vector) (arg3 vector)) (let* ((v1-1 (vector-! (new 'stack-no-clear 'vector) arg2 arg0)) (f0-2 (- (* (-> arg1 x) (-> arg3 z)) (* (-> arg1 z) (-> arg3 x)))) - (f1-3 f0-2) - (f1-5 (* f1-3 f1-3)) - (f2-1 (-> arg1 x)) - (f2-3 (* f2-1 f2-1)) - (f3-0 (-> arg1 z)) - (f2-4 (+ f2-3 (* f3-0 f3-0))) - (f3-3 (-> arg3 x)) - (f3-5 (* f3-3 f3-3)) - (f4-0 (-> arg3 z)) - (f3-6 (+ f3-5 (* f4-0 f4-0))) + (f1-5 (square f0-2)) + (f2-4 (+ (square (-> arg1 x)) (square (-> arg1 z)))) + (f3-6 (+ (square (-> arg3 x)) (square (-> arg3 z)))) ) (when (< (* (/ f3-6 10000) f2-4) f1-5) (let ((f1-9 (/ (- (* (-> v1-1 x) (-> arg3 z)) (* (-> v1-1 z) (-> arg3 x))) f0-2))) @@ -3736,26 +3732,6 @@ ;; WARN: Return type mismatch int vs none. ;; WARN: Function (method 10 nav-mesh-poly) has a return type of none, but the expression builder found a return statement. (defmethod nav-mesh-poly-method-10 ((this nav-mesh-poly) (arg0 nav-mesh-editable)) - (local-vars - (sv-288 int) - (sv-304 int) - (sv-320 int) - (sv-336 int) - (sv-352 int) - (sv-368 vector) - (sv-384 vector) - (sv-400 vector) - (sv-416 int) - (sv-432 int) - (sv-448 int) - (sv-464 int) - (sv-480 int) - (sv-496 int) - (sv-512 vector) - (sv-528 vector) - (sv-544 vector) - (sv-560 vector) - ) (rlet ((vf0 :class vf) (vf4 :class vf) (vf5 :class vf) @@ -3773,226 +3749,240 @@ (set! (-> s4-0 v1-2 index) (the-as uint (-> this index data v1-2))) ) (while (< 3 s1-0) - (set! sv-288 0) - (set! sv-304 1) - (set! sv-320 2) - (let ((s0-0 0)) - (set! sv-336 -1) - -1 - (let ((f30-0 0.0)) - (set! sv-352 0) - (while (< sv-352 s1-0) - (set! (-> s4-0 sv-304 ear?) #f) - (when (is-diagonal s1-0 s4-0 s3-0 sv-288 sv-304 sv-320) - 1.0 - (new 'stack-no-clear 'vector) - (set! sv-400 (new 'stack-no-clear 'vector)) - (let ((v1-25 (-> s3-0 data (-> s4-0 sv-288 index))) - (a0-11 (-> s3-0 data (-> s4-0 sv-304 index))) - ) - (.lvf vf4 (&-> v1-25 quad)) - (.lvf vf5 (&-> a0-11 quad)) - ) - (.mov.vf.w vf6 vf0) - (.sub.vf.xyz vf6 vf4 vf5) - (.svf (&-> sv-400 quad) vf6) - (set! sv-368 (new 'stack-no-clear 'vector)) - (let ((v1-34 (-> s3-0 data (-> s4-0 sv-304 index))) - (a0-18 (-> s3-0 data (-> s4-0 sv-320 index))) - ) - (.lvf vf4 (&-> v1-34 quad)) - (.lvf vf5 (&-> a0-18 quad)) - ) - (.mov.vf.w vf6 vf0) - (.sub.vf.xyz vf6 vf4 vf5) - (.svf (&-> sv-368 quad) vf6) - (set! sv-384 (new 'stack-no-clear 'vector)) - (let ((v1-43 (-> s3-0 data (-> s4-0 sv-320 index))) - (a0-25 (-> s3-0 data (-> s4-0 sv-288 index))) - ) - (.lvf vf4 (&-> v1-43 quad)) - (.lvf vf5 (&-> a0-25 quad)) - ) - (.mov.vf.w vf6 vf0) - (.sub.vf.xyz vf6 vf4 vf5) - (.svf (&-> sv-384 quad) vf6) - 0.0 - 0.0 - (let* ((f28-0 (vector-vector-angle-safe sv-400 sv-368)) - (t9-2 vector-vector-angle-safe) - (a1-6 sv-384) - (f0-5 (* f28-0 (t9-2 sv-368 a1-6) (vector-vector-angle-safe sv-384 sv-400))) - ) - (set! (-> s4-0 sv-304 ear?) #t) - (when (or (= sv-336 -1) (< f30-0 f0-5)) - (set! sv-336 sv-304) - (set! f30-0 f0-5) - ) - ) - ) - (set! sv-288 (mod (+ sv-288 1) s1-0)) - (set! sv-304 (mod (+ sv-304 1) s1-0)) - (set! sv-320 (mod (+ sv-320 1) s1-0)) - (set! sv-352 (+ sv-352 1)) + (let ((sv-288 0) + (sv-304 1) + (sv-320 2) + (s0-0 0) ) - ) - (set! sv-416 0) - (set! sv-432 1) - (set! sv-448 2) - (set! sv-464 -1) - (let ((f30-1 0.0)) - (set! sv-480 3) - (set! sv-496 0) - (while (< sv-496 s1-0) - (when (and (-> s4-0 sv-432 ear?) - (-> s4-0 sv-448 ear?) - (is-diagonal s1-0 s4-0 s3-0 sv-480 sv-416 sv-432) - (is-diagonal s1-0 s4-0 s3-0 sv-448 sv-480 sv-416) - ) - 1.0 - (set! sv-560 (new 'stack-no-clear 'vector)) - (let ((v1-90 (-> s3-0 data (-> s4-0 sv-416 index))) - (a0-41 (-> s3-0 data (-> s4-0 sv-432 index))) - ) - (.lvf vf4 (&-> v1-90 quad)) - (.lvf vf5 (&-> a0-41 quad)) - ) - (.mov.vf.w vf6 vf0) - (.sub.vf.xyz vf6 vf4 vf5) - (.svf (&-> sv-560 quad) vf6) - (set! sv-512 (new 'stack-no-clear 'vector)) - (let ((v1-99 (-> s3-0 data (-> s4-0 sv-432 index))) - (a0-48 (-> s3-0 data (-> s4-0 sv-448 index))) - ) - (.lvf vf4 (&-> v1-99 quad)) - (.lvf vf5 (&-> a0-48 quad)) - ) - (.mov.vf.w vf6 vf0) - (.sub.vf.xyz vf6 vf4 vf5) - (.svf (&-> sv-512 quad) vf6) - (set! sv-528 (new 'stack-no-clear 'vector)) - (let ((v1-108 (-> s3-0 data (-> s4-0 sv-448 index))) - (a0-55 (-> s3-0 data (-> s4-0 sv-480 index))) - ) - (.lvf vf4 (&-> v1-108 quad)) - (.lvf vf5 (&-> a0-55 quad)) - ) - (.mov.vf.w vf6 vf0) - (.sub.vf.xyz vf6 vf4 vf5) - (.svf (&-> sv-528 quad) vf6) - (set! sv-544 (new 'stack-no-clear 'vector)) - (let ((v1-117 (-> s3-0 data (-> s4-0 sv-480 index))) - (a0-62 (-> s3-0 data (-> s4-0 sv-416 index))) - ) - (.lvf vf4 (&-> v1-117 quad)) - (.lvf vf5 (&-> a0-62 quad)) - ) - (.mov.vf.w vf6 vf0) - (.sub.vf.xyz vf6 vf4 vf5) - (.svf (&-> sv-544 quad) vf6) - 0.0 - 0.0 - (let* ((f28-2 (vector-vector-angle-safe sv-560 sv-512)) - (t9-7 vector-vector-angle-safe) - (a1-11 sv-528) - (f28-3 (* f28-2 (t9-7 sv-512 a1-11))) - (t9-8 vector-vector-angle-safe) - (a1-12 sv-544) - (f0-12 (* f28-3 (t9-8 sv-528 a1-12) (vector-vector-angle-safe sv-544 sv-560))) - ) - (when (or (= sv-464 -1) (< f30-1 f0-12)) - (set! sv-336 sv-432) - (set! sv-464 sv-448) - (set! f30-1 f0-12) - ) - ) - ) - (set! sv-416 (mod (+ sv-416 1) s1-0)) - (set! sv-432 (mod (+ sv-432 1) s1-0)) - (set! sv-448 (mod (+ sv-448 1) s1-0)) - (set! sv-480 (mod (+ sv-480 1) s1-0)) - (set! sv-496 (+ sv-496 1)) - ) - ) - (when (= sv-336 -1) - (format *stdcon* "cannot find any ear~%") - (return #f) - ) - (let ((a0-70 0) - (a1-15 1) - (a2-3 2) - (a3-3 3) - ) - (dotimes (v1-146 s1-0) - (cond - ((= a1-15 sv-336) - (cond - ((!= sv-464 -1) - (let ((t0-9 (-> arg0 quads data (-> arg0 quads length))) - (t1-6 (vector-cross! - (new 'stack-no-clear 'vector) - (vector-! - (new 'stack-no-clear 'vector) - (-> s3-0 data (-> s4-0 a0-70 index)) - (-> s3-0 data (-> s4-0 a1-15 index)) - ) - (vector-! - (new 'stack-no-clear 'vector) - (-> s3-0 data (-> s4-0 a2-3 index)) - (-> s3-0 data (-> s4-0 a1-15 index)) - ) - ) - ) + (let ((sv-336 -1)) + -1 + (let ((f30-0 0.0)) + (let ((sv-352 0)) + (while (< sv-352 s1-0) + (set! (-> s4-0 sv-304 ear?) #f) + (when (is-diagonal s1-0 s4-0 s3-0 sv-288 sv-304 sv-320) + 1.0 + (new 'stack-no-clear 'vector) + (let ((sv-400 (new 'stack-no-clear 'vector))) + (let ((v1-25 (-> s3-0 data (-> s4-0 sv-288 index))) + (a0-11 (-> s3-0 data (-> s4-0 sv-304 index))) + ) + (.lvf vf4 (&-> v1-25 quad)) + (.lvf vf5 (&-> a0-11 quad)) + ) + (.mov.vf.w vf6 vf0) + (.sub.vf.xyz vf6 vf4 vf5) + (.svf (&-> sv-400 quad) vf6) + (let ((sv-368 (new 'stack-no-clear 'vector))) + (let ((v1-34 (-> s3-0 data (-> s4-0 sv-304 index))) + (a0-18 (-> s3-0 data (-> s4-0 sv-320 index))) + ) + (.lvf vf4 (&-> v1-34 quad)) + (.lvf vf5 (&-> a0-18 quad)) + ) + (.mov.vf.w vf6 vf0) + (.sub.vf.xyz vf6 vf4 vf5) + (.svf (&-> sv-368 quad) vf6) + (let ((sv-384 (new 'stack-no-clear 'vector))) + (let ((v1-43 (-> s3-0 data (-> s4-0 sv-320 index))) + (a0-25 (-> s3-0 data (-> s4-0 sv-288 index))) + ) + (.lvf vf4 (&-> v1-43 quad)) + (.lvf vf5 (&-> a0-25 quad)) + ) + (.mov.vf.w vf6 vf0) + (.sub.vf.xyz vf6 vf4 vf5) + (.svf (&-> sv-384 quad) vf6) + 0.0 + 0.0 + (let ((f0-5 (* (vector-vector-angle-safe sv-400 sv-368) + (vector-vector-angle-safe sv-368 sv-384) + (vector-vector-angle-safe sv-384 sv-400) + ) + ) + ) + (set! (-> s4-0 sv-304 ear?) #t) + (when (or (= sv-336 -1) (< f30-0 f0-5)) + (set! sv-336 sv-304) + (set! f30-0 f0-5) + ) + ) ) - (when (< 0.01 (vector-length t1-6)) - (set! (-> t0-9 indices 0) (-> s4-0 a0-70 index)) - (set! (-> t0-9 indices 1) (-> s4-0 a1-15 index)) - (set! (-> t0-9 indices 2) (-> s4-0 a2-3 index)) - (set! (-> t0-9 indices 3) (-> s4-0 a3-3 index)) - (set! (-> t0-9 poly) (-> this poly-id)) - (+! (-> arg0 quads length) 1) ) ) ) - (else - (let ((t0-17 (-> arg0 tris data (-> arg0 tris length))) - (t1-25 (vector-cross! - (new 'stack-no-clear 'vector) - (vector-! + (set! sv-288 (mod (+ sv-288 1) s1-0)) + (set! sv-304 (mod (+ sv-304 1) s1-0)) + (set! sv-320 (mod (+ sv-320 1) s1-0)) + (+! sv-352 1) + ) + ) + ) + (let ((sv-416 0) + (sv-432 1) + (sv-448 2) + (sv-464 -1) + ) + (let ((f30-1 0.0)) + (let ((sv-480 3) + (sv-496 0) + ) + (while (< sv-496 s1-0) + (when (and (-> s4-0 sv-432 ear?) + (-> s4-0 sv-448 ear?) + (is-diagonal s1-0 s4-0 s3-0 sv-480 sv-416 sv-432) + (is-diagonal s1-0 s4-0 s3-0 sv-448 sv-480 sv-416) + ) + 1.0 + (let ((sv-560 (new 'stack-no-clear 'vector))) + (let ((v1-90 (-> s3-0 data (-> s4-0 sv-416 index))) + (a0-41 (-> s3-0 data (-> s4-0 sv-432 index))) + ) + (.lvf vf4 (&-> v1-90 quad)) + (.lvf vf5 (&-> a0-41 quad)) + ) + (.mov.vf.w vf6 vf0) + (.sub.vf.xyz vf6 vf4 vf5) + (.svf (&-> sv-560 quad) vf6) + (let ((sv-512 (new 'stack-no-clear 'vector))) + (let ((v1-99 (-> s3-0 data (-> s4-0 sv-432 index))) + (a0-48 (-> s3-0 data (-> s4-0 sv-448 index))) + ) + (.lvf vf4 (&-> v1-99 quad)) + (.lvf vf5 (&-> a0-48 quad)) + ) + (.mov.vf.w vf6 vf0) + (.sub.vf.xyz vf6 vf4 vf5) + (.svf (&-> sv-512 quad) vf6) + (let ((sv-528 (new 'stack-no-clear 'vector))) + (let ((v1-108 (-> s3-0 data (-> s4-0 sv-448 index))) + (a0-55 (-> s3-0 data (-> s4-0 sv-480 index))) + ) + (.lvf vf4 (&-> v1-108 quad)) + (.lvf vf5 (&-> a0-55 quad)) + ) + (.mov.vf.w vf6 vf0) + (.sub.vf.xyz vf6 vf4 vf5) + (.svf (&-> sv-528 quad) vf6) + (let ((sv-544 (new 'stack-no-clear 'vector))) + (let ((v1-117 (-> s3-0 data (-> s4-0 sv-480 index))) + (a0-62 (-> s3-0 data (-> s4-0 sv-416 index))) + ) + (.lvf vf4 (&-> v1-117 quad)) + (.lvf vf5 (&-> a0-62 quad)) + ) + (.mov.vf.w vf6 vf0) + (.sub.vf.xyz vf6 vf4 vf5) + (.svf (&-> sv-544 quad) vf6) + 0.0 + 0.0 + (let ((f0-12 (* (vector-vector-angle-safe sv-560 sv-512) + (vector-vector-angle-safe sv-512 sv-528) + (vector-vector-angle-safe sv-528 sv-544) + (vector-vector-angle-safe sv-544 sv-560) + ) + ) + ) + (when (or (= sv-464 -1) (< f30-1 f0-12)) + (set! sv-336 sv-432) + (set! sv-464 sv-448) + (set! f30-1 f0-12) + ) + ) + ) + ) + ) + ) + ) + (set! sv-416 (mod (+ sv-416 1) s1-0)) + (set! sv-432 (mod (+ sv-432 1) s1-0)) + (set! sv-448 (mod (+ sv-448 1) s1-0)) + (set! sv-480 (mod (+ sv-480 1) s1-0)) + (+! sv-496 1) + ) + ) + ) + (when (= sv-336 -1) + (format *stdcon* "cannot find any ear~%") + (return #f) + ) + (let ((a0-70 0) + (a1-15 1) + (a2-3 2) + (a3-3 3) + ) + (dotimes (v1-146 s1-0) + (cond + ((= a1-15 sv-336) + (cond + ((!= sv-464 -1) + (let ((t0-9 (-> arg0 quads data (-> arg0 quads length))) + (t1-6 (vector-cross! (new 'stack-no-clear 'vector) - (-> s3-0 data (-> s4-0 a0-70 index)) - (-> s3-0 data (-> s4-0 a1-15 index)) - ) - (vector-! - (new 'stack-no-clear 'vector) - (-> s3-0 data (-> s4-0 a2-3 index)) - (-> s3-0 data (-> s4-0 a1-15 index)) + (vector-! + (new 'stack-no-clear 'vector) + (-> s3-0 data (-> s4-0 a0-70 index)) + (-> s3-0 data (-> s4-0 a1-15 index)) + ) + (vector-! + (new 'stack-no-clear 'vector) + (-> s3-0 data (-> s4-0 a2-3 index)) + (-> s3-0 data (-> s4-0 a1-15 index)) + ) ) ) - ) + ) + (when (< 0.01 (vector-length t1-6)) + (set! (-> t0-9 indices 0) (-> s4-0 a0-70 index)) + (set! (-> t0-9 indices 1) (-> s4-0 a1-15 index)) + (set! (-> t0-9 indices 2) (-> s4-0 a2-3 index)) + (set! (-> t0-9 indices 3) (-> s4-0 a3-3 index)) + (set! (-> t0-9 poly) (-> this poly-id)) + (+! (-> arg0 quads length) 1) + ) + ) + ) + (else + (let ((t0-17 (-> arg0 tris data (-> arg0 tris length))) + (t1-25 (vector-cross! + (new 'stack-no-clear 'vector) + (vector-! + (new 'stack-no-clear 'vector) + (-> s3-0 data (-> s4-0 a0-70 index)) + (-> s3-0 data (-> s4-0 a1-15 index)) + ) + (vector-! + (new 'stack-no-clear 'vector) + (-> s3-0 data (-> s4-0 a2-3 index)) + (-> s3-0 data (-> s4-0 a1-15 index)) + ) + ) + ) + ) + (when (< 0.01 (vector-length t1-25)) + (set! (-> t0-17 indices 0) (-> s4-0 a0-70 index)) + (set! (-> t0-17 indices 1) (-> s4-0 a1-15 index)) + (set! (-> t0-17 indices 2) (-> s4-0 a2-3 index)) + (set! (-> t0-17 poly) (-> this poly-id)) + (+! (-> arg0 tris length) 1) + ) ) - (when (< 0.01 (vector-length t1-25)) - (set! (-> t0-17 indices 0) (-> s4-0 a0-70 index)) - (set! (-> t0-17 indices 1) (-> s4-0 a1-15 index)) - (set! (-> t0-17 indices 2) (-> s4-0 a2-3 index)) - (set! (-> t0-17 poly) (-> this poly-id)) - (+! (-> arg0 tris length) 1) ) ) ) - ) - ) - ((= a1-15 sv-464) - ) - (else - (set! (-> s2-0 s0-0 index) (-> s4-0 a1-15 index)) - (+! s0-0 1) + ((= a1-15 sv-464) + ) + (else + (set! (-> s2-0 s0-0 index) (-> s4-0 a1-15 index)) + (+! s0-0 1) + ) + ) + (set! a0-70 (mod (+ a0-70 1) s1-0)) + (set! a1-15 (mod (+ a1-15 1) s1-0)) + (set! a2-3 (mod (+ a2-3 1) s1-0)) + (set! a3-3 (mod (+ a3-3 1) s1-0)) ) ) - (set! a0-70 (mod (+ a0-70 1) s1-0)) - (set! a1-15 (mod (+ a1-15 1) s1-0)) - (set! a2-3 (mod (+ a2-3 1) s1-0)) - (set! a3-3 (mod (+ a3-3 1) s1-0)) ) ) (set! s1-0 s0-0) diff --git a/test/decompiler/reference/jak3/engine/debug/nav/mysql-nav-graph_REF.gc b/test/decompiler/reference/jak3/engine/debug/nav/mysql-nav-graph_REF.gc index 2e6bbb2a54..0779f346bb 100644 --- a/test/decompiler/reference/jak3/engine/debug/nav/mysql-nav-graph_REF.gc +++ b/test/decompiler/reference/jak3/engine/debug/nav/mysql-nav-graph_REF.gc @@ -879,7 +879,6 @@ ;; WARN: new jak 2 until loop case, check carefully ;; WARN: new jak 2 until loop case, check carefully (defmethod init-from-sql! ((this mysql-nav-graph) (arg0 symbol) (arg1 string)) - (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) @@ -935,41 +934,42 @@ (set! (-> s0-1 angle) (* 182.04445 (string->float (the-as string (-> s2-1 sql-data (+ s1-0 5)))))) (set! (-> s0-1 radius) (* 4096.0 (string->float (the-as string (-> s2-1 sql-data (+ s1-0 6)))))) (set! (-> s0-1 nav_node_flag) (nav-node-flag)) - (set! sv-16 (new 'global 'string 0 (the-as string (-> s2-1 sql-data (+ s1-0 7))))) - (copy-string<-string sv-16 (the-as string (-> s2-1 sql-data (+ s1-0 7)))) - (until #f - (cond - ((string-prefix= "blocker" sv-16) - (logior! (-> s0-1 nav_node_flag) (nav-node-flag blocker)) - ) - ((string-prefix= "pov" sv-16) - (logior! (-> s0-1 nav_node_flag) (nav-node-flag pov)) - ) - ((string-prefix= "visited" sv-16) - (logior! (-> s0-1 nav_node_flag) (nav-node-flag visited)) - ) - ((string-prefix= "blocked" sv-16) - (logior! (-> s0-1 nav_node_flag) (nav-node-flag blocked)) - ) - ((string-prefix= "pedestrian" sv-16) - (logior! (-> s0-1 nav_node_flag) (nav-node-flag pedestrian)) - ) - ((string-prefix= "selected" sv-16) - (logior! (-> s0-1 nav_node_flag) (nav-node-flag selected)) - ) - ((string-prefix= "hidden" sv-16) - (logior! (-> s0-1 nav_node_flag) (nav-node-flag hidden)) - ) - (else - #t - (goto cfg-33) - ) - ) - (let ((a1-22 (string-skip-to-char (-> sv-16 data) (the-as uint 44)))) - (if (= (-> a1-22 0) 44) - (set! a1-22 (&-> a1-22 1)) + (let ((sv-16 (new 'global 'string 0 (the-as string (-> s2-1 sql-data (+ s1-0 7)))))) + (copy-string<-string sv-16 (the-as string (-> s2-1 sql-data (+ s1-0 7)))) + (until #f + (cond + ((string-prefix= "blocker" sv-16) + (logior! (-> s0-1 nav_node_flag) (nav-node-flag blocker)) + ) + ((string-prefix= "pov" sv-16) + (logior! (-> s0-1 nav_node_flag) (nav-node-flag pov)) + ) + ((string-prefix= "visited" sv-16) + (logior! (-> s0-1 nav_node_flag) (nav-node-flag visited)) + ) + ((string-prefix= "blocked" sv-16) + (logior! (-> s0-1 nav_node_flag) (nav-node-flag blocked)) + ) + ((string-prefix= "pedestrian" sv-16) + (logior! (-> s0-1 nav_node_flag) (nav-node-flag pedestrian)) + ) + ((string-prefix= "selected" sv-16) + (logior! (-> s0-1 nav_node_flag) (nav-node-flag selected)) + ) + ((string-prefix= "hidden" sv-16) + (logior! (-> s0-1 nav_node_flag) (nav-node-flag hidden)) + ) + (else + #t + (goto cfg-33) ) - (string-suck-up! sv-16 a1-22) + ) + (let ((a1-22 (string-skip-to-char (-> sv-16 data) (the-as uint 44)))) + (if (= (-> a1-22 0) 44) + (set! a1-22 (&-> a1-22 1)) + ) + (string-suck-up! sv-16 a1-22) + ) ) ) #f @@ -1013,149 +1013,149 @@ (let ((s2-2 0)) (while (< s2-2 (-> s3-3 length)) (when (= (string->int (the-as string (-> s3-3 sql-data (+ s2-2 12)))) (-> this nav_graph_id)) - (let ((s0-2 (string->int (the-as string (-> s3-3 sql-data (+ s2-2 1)))))) - (set! sv-32 (string->int (the-as string (-> s3-3 sql-data (+ s2-2 2))))) - (set! sv-48 (indexof-nav-node this s0-2)) - (set! sv-64 (indexof-nav-node this sv-32)) - (let ((s1-2 (-> this edge-array data (-> this edge-array length)))) - (when (and (!= sv-48 -1) (!= sv-64 -1)) - (set! (-> s1-2 nav_graph_id) (-> this nav_graph_id)) - (set! (-> s1-2 nav_edge_id) (the-as uint (string->int (the-as string (-> s3-3 sql-data s2-2))))) - (set! (-> s1-2 nav_node_id_1) (the-as uint s0-2)) - (set! (-> s1-2 nav_node_id_2) (the-as uint sv-32)) - (set! (-> s1-2 mysql-save-flag) (mysql-save-flag)) - (set! (-> s1-2 runtime-id) (the-as uint (-> this edge-array length))) - (set! (-> s1-2 runtime-node-id-1) sv-48) - (set! (-> s1-2 runtime-node-id-2) sv-64) - (let ((s0-3 (-> s3-3 sql-data (+ s2-2 3)))) - (cond - ((string= "default" (the-as string s0-3)) - (set! (-> s1-2 directionality) (nav-directionality default)) - 0 - ) - ((string= "directed" (the-as string s0-3)) - (set! (-> s1-2 directionality) (nav-directionality directed)) - ) - ((string= "bi_directional" (the-as string s0-3)) - (set! (-> s1-2 directionality) (nav-directionality bi_directional)) - ) - ) + (let* ((s0-2 (string->int (the-as string (-> s3-3 sql-data (+ s2-2 1))))) + (sv-32 (string->int (the-as string (-> s3-3 sql-data (+ s2-2 2))))) + (sv-48 (indexof-nav-node this s0-2)) + (sv-64 (indexof-nav-node this sv-32)) + (s1-2 (-> this edge-array data (-> this edge-array length))) + ) + (when (and (!= sv-48 -1) (!= sv-64 -1)) + (set! (-> s1-2 nav_graph_id) (-> this nav_graph_id)) + (set! (-> s1-2 nav_edge_id) (the-as uint (string->int (the-as string (-> s3-3 sql-data s2-2))))) + (set! (-> s1-2 nav_node_id_1) (the-as uint s0-2)) + (set! (-> s1-2 nav_node_id_2) (the-as uint sv-32)) + (set! (-> s1-2 mysql-save-flag) (mysql-save-flag)) + (set! (-> s1-2 runtime-id) (the-as uint (-> this edge-array length))) + (set! (-> s1-2 runtime-node-id-1) sv-48) + (set! (-> s1-2 runtime-node-id-2) sv-64) + (let ((s0-3 (-> s3-3 sql-data (+ s2-2 3)))) + (cond + ((string= "default" (the-as string s0-3)) + (set! (-> s1-2 directionality) (nav-directionality default)) + 0 + ) + ((string= "directed" (the-as string s0-3)) + (set! (-> s1-2 directionality) (nav-directionality directed)) + ) + ((string= "bi_directional" (the-as string s0-3)) + (set! (-> s1-2 directionality) (nav-directionality bi_directional)) + ) ) - (set! (-> s1-2 speed_limit) (* 4096.0 (string->float (the-as string (-> s3-3 sql-data (+ s2-2 4)))))) - (set! (-> s1-2 density) (string->float (the-as string (-> s3-3 sql-data (+ s2-2 5))))) - (set! (-> s1-2 traffic_edge_flag) 0) - (let ((s0-4 (new 'global 'string 0 (the-as string (-> s3-3 sql-data (+ s2-2 6)))))) - (copy-string<-string s0-4 (the-as string (-> s3-3 sql-data (+ s2-2 6)))) - (until #f - (cond - ((string-prefix= "pedestrian" s0-4) - (logior! (-> s1-2 traffic_edge_flag) 1) - ) - (else - #t - (goto cfg-64) - ) - ) - (let ((a1-38 (string-skip-to-char (-> s0-4 data) (the-as uint 44)))) - (if (= (-> a1-38 0) 44) - (set! a1-38 (&-> a1-38 1)) - ) - (string-suck-up! s0-4 a1-38) - ) - ) - ) - #f - (label cfg-64) - (set! (-> s1-2 nav_clock_mask) (nav-clock-mask)) - (let ((s0-5 (new 'global 'string 0 (the-as string (-> s3-3 sql-data (+ s2-2 7)))))) - (copy-string<-string s0-5 (the-as string (-> s3-3 sql-data (+ s2-2 7)))) - (until #f - (cond - ((string-prefix= "phase-1a" s0-5) - (logior! (-> s1-2 nav_clock_mask) (nav-clock-mask phase-1a)) - ) - ((string-prefix= "phase-1" s0-5) - (logior! (-> s1-2 nav_clock_mask) (nav-clock-mask phase-1)) - ) - ((string-prefix= "phase-2a" s0-5) - (logior! (-> s1-2 nav_clock_mask) (nav-clock-mask phase-2a)) - ) - ((string-prefix= "phase-2" s0-5) - (logior! (-> s1-2 nav_clock_mask) (nav-clock-mask phase-2)) - ) - ((string-prefix= "phase-3a" s0-5) - (logior! (-> s1-2 nav_clock_mask) (nav-clock-mask phase-3a)) - ) - ((string-prefix= "phase-3" s0-5) - (logior! (-> s1-2 nav_clock_mask) (nav-clock-mask phase-3)) - ) - ((string-prefix= "phase-4a" s0-5) - (logior! (-> s1-2 nav_clock_mask) (nav-clock-mask phase-4a)) - ) - ((string-prefix= "phase-4" s0-5) - (logior! (-> s1-2 nav_clock_mask) (nav-clock-mask phase-4)) - ) - (else - #t - (goto cfg-86) - ) - ) - (let ((a1-50 (string-skip-to-char (-> s0-5 data) (the-as uint 44)))) - (if (= (-> a1-50 0) 44) - (set! a1-50 (&-> a1-50 1)) - ) - (string-suck-up! s0-5 a1-50) - ) - ) - ) - #f - (label cfg-86) - (set! (-> s1-2 nav_territory_type) (the-as uint (string->int (the-as string (-> s3-3 sql-data (+ s2-2 8)))))) - (set! (-> s1-2 exclusive_data) (the-as uint (string->int (the-as string (-> s3-3 sql-data (+ s2-2 9)))))) - (set! (-> s1-2 width) (* 4096.0 (string->float (the-as string (-> s3-3 sql-data (+ s2-2 10)))))) - (set! (-> s1-2 minimap_edge_flag) (nav-minimap-edge-flag)) - (let ((s0-6 (new 'global 'string 0 (the-as string (-> s3-3 sql-data (+ s2-2 11)))))) - (copy-string<-string s0-6 (the-as string (-> s3-3 sql-data (+ s2-2 11)))) - (until #f - (cond - ((string-prefix= "blocker" s0-6) - (logior! (-> s1-2 minimap_edge_flag) (nav-minimap-edge-flag blocker)) - ) - ((string-prefix= "one-way" s0-6) - (logior! (-> s1-2 minimap_edge_flag) (nav-minimap-edge-flag one-way)) - ) - ((string-prefix= "pass-port-mh" s0-6) - (logior! (-> s1-2 minimap_edge_flag) (nav-minimap-edge-flag pass-port-mh)) - ) - ((string-prefix= "pass-port-inda" s0-6) - (logior! (-> s1-2 minimap_edge_flag) (nav-minimap-edge-flag pass-port-inda)) - ) - ((string-prefix= "pass-inda-indb" s0-6) - (logior! (-> s1-2 minimap_edge_flag) (nav-minimap-edge-flag pass-inda-indb)) - ) - ((string-prefix= "pass-indb-sluma" s0-6) - (logior! (-> s1-2 minimap_edge_flag) (nav-minimap-edge-flag pass-indb-sluma)) - ) - ((string-prefix= "pass-slumb-genb" s0-6) - (logior! (-> s1-2 minimap_edge_flag) (nav-minimap-edge-flag pass-slumb-genb)) - ) - (else - #t - (goto cfg-106) - ) - ) - (let ((a1-61 (string-skip-to-char (-> s0-6 data) (the-as uint 44)))) - (if (= (-> a1-61 0) 44) - (set! a1-61 (&-> a1-61 1)) - ) - (string-suck-up! s0-6 a1-61) - ) - ) - ) - #f - (label cfg-106) - (+! (-> this edge-array length) 1) ) + (set! (-> s1-2 speed_limit) (* 4096.0 (string->float (the-as string (-> s3-3 sql-data (+ s2-2 4)))))) + (set! (-> s1-2 density) (string->float (the-as string (-> s3-3 sql-data (+ s2-2 5))))) + (set! (-> s1-2 traffic_edge_flag) 0) + (let ((s0-4 (new 'global 'string 0 (the-as string (-> s3-3 sql-data (+ s2-2 6)))))) + (copy-string<-string s0-4 (the-as string (-> s3-3 sql-data (+ s2-2 6)))) + (until #f + (cond + ((string-prefix= "pedestrian" s0-4) + (logior! (-> s1-2 traffic_edge_flag) 1) + ) + (else + #t + (goto cfg-64) + ) + ) + (let ((a1-38 (string-skip-to-char (-> s0-4 data) (the-as uint 44)))) + (if (= (-> a1-38 0) 44) + (set! a1-38 (&-> a1-38 1)) + ) + (string-suck-up! s0-4 a1-38) + ) + ) + ) + #f + (label cfg-64) + (set! (-> s1-2 nav_clock_mask) (nav-clock-mask)) + (let ((s0-5 (new 'global 'string 0 (the-as string (-> s3-3 sql-data (+ s2-2 7)))))) + (copy-string<-string s0-5 (the-as string (-> s3-3 sql-data (+ s2-2 7)))) + (until #f + (cond + ((string-prefix= "phase-1a" s0-5) + (logior! (-> s1-2 nav_clock_mask) (nav-clock-mask phase-1a)) + ) + ((string-prefix= "phase-1" s0-5) + (logior! (-> s1-2 nav_clock_mask) (nav-clock-mask phase-1)) + ) + ((string-prefix= "phase-2a" s0-5) + (logior! (-> s1-2 nav_clock_mask) (nav-clock-mask phase-2a)) + ) + ((string-prefix= "phase-2" s0-5) + (logior! (-> s1-2 nav_clock_mask) (nav-clock-mask phase-2)) + ) + ((string-prefix= "phase-3a" s0-5) + (logior! (-> s1-2 nav_clock_mask) (nav-clock-mask phase-3a)) + ) + ((string-prefix= "phase-3" s0-5) + (logior! (-> s1-2 nav_clock_mask) (nav-clock-mask phase-3)) + ) + ((string-prefix= "phase-4a" s0-5) + (logior! (-> s1-2 nav_clock_mask) (nav-clock-mask phase-4a)) + ) + ((string-prefix= "phase-4" s0-5) + (logior! (-> s1-2 nav_clock_mask) (nav-clock-mask phase-4)) + ) + (else + #t + (goto cfg-86) + ) + ) + (let ((a1-50 (string-skip-to-char (-> s0-5 data) (the-as uint 44)))) + (if (= (-> a1-50 0) 44) + (set! a1-50 (&-> a1-50 1)) + ) + (string-suck-up! s0-5 a1-50) + ) + ) + ) + #f + (label cfg-86) + (set! (-> s1-2 nav_territory_type) (the-as uint (string->int (the-as string (-> s3-3 sql-data (+ s2-2 8)))))) + (set! (-> s1-2 exclusive_data) (the-as uint (string->int (the-as string (-> s3-3 sql-data (+ s2-2 9)))))) + (set! (-> s1-2 width) (* 4096.0 (string->float (the-as string (-> s3-3 sql-data (+ s2-2 10)))))) + (set! (-> s1-2 minimap_edge_flag) (nav-minimap-edge-flag)) + (let ((s0-6 (new 'global 'string 0 (the-as string (-> s3-3 sql-data (+ s2-2 11)))))) + (copy-string<-string s0-6 (the-as string (-> s3-3 sql-data (+ s2-2 11)))) + (until #f + (cond + ((string-prefix= "blocker" s0-6) + (logior! (-> s1-2 minimap_edge_flag) (nav-minimap-edge-flag blocker)) + ) + ((string-prefix= "one-way" s0-6) + (logior! (-> s1-2 minimap_edge_flag) (nav-minimap-edge-flag one-way)) + ) + ((string-prefix= "pass-port-mh" s0-6) + (logior! (-> s1-2 minimap_edge_flag) (nav-minimap-edge-flag pass-port-mh)) + ) + ((string-prefix= "pass-port-inda" s0-6) + (logior! (-> s1-2 minimap_edge_flag) (nav-minimap-edge-flag pass-port-inda)) + ) + ((string-prefix= "pass-inda-indb" s0-6) + (logior! (-> s1-2 minimap_edge_flag) (nav-minimap-edge-flag pass-inda-indb)) + ) + ((string-prefix= "pass-indb-sluma" s0-6) + (logior! (-> s1-2 minimap_edge_flag) (nav-minimap-edge-flag pass-indb-sluma)) + ) + ((string-prefix= "pass-slumb-genb" s0-6) + (logior! (-> s1-2 minimap_edge_flag) (nav-minimap-edge-flag pass-slumb-genb)) + ) + (else + #t + (goto cfg-106) + ) + ) + (let ((a1-61 (string-skip-to-char (-> s0-6 data) (the-as uint 44)))) + (if (= (-> a1-61 0) 44) + (set! a1-61 (&-> a1-61 1)) + ) + (string-suck-up! s0-6 a1-61) + ) + ) + ) + #f + (label cfg-106) + (+! (-> this edge-array length) 1) ) ) ) @@ -1510,7 +1510,3 @@ ) ) ) - - - - diff --git a/test/decompiler/reference/jak3/engine/debug/nav/nav-graph-editor_REF.gc b/test/decompiler/reference/jak3/engine/debug/nav/nav-graph-editor_REF.gc index 35ec7ff285..a62d83b783 100644 --- a/test/decompiler/reference/jak3/engine/debug/nav/nav-graph-editor_REF.gc +++ b/test/decompiler/reference/jak3/engine/debug/nav/nav-graph-editor_REF.gc @@ -490,16 +490,6 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defmethod nav-graph-editor-method-29 ((this nav-graph-editor)) - (local-vars - (sv-224 int) - (sv-240 (function _varargs_ object)) - (sv-256 mysql-nav-node) - (sv-272 vector) - (sv-288 vector) - (sv-304 symbol) - (sv-320 int) - (sv-336 (function _varargs_ object)) - ) (rlet ((vf0 :class vf) (vf4 :class vf) (vf5 :class vf) @@ -521,11 +511,7 @@ (set! (-> s1-0 w) (-> s2-0 radius)) ) (set! (-> s2-0 cam-dist) (vector-vector-distance-squared s3-0 (camera-pos))) - (let ((f0-2 (-> s2-0 cam-dist)) - (f1-0 (-> this clipping-dist)) - ) - (set! (-> s2-0 visible) (< f0-2 (* 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)))) ) @@ -576,48 +562,46 @@ (add-debug-x #t (bucket-id debug) s3-0 *color-red*) (let ((s1-2 add-debug-text-3d) (s0-1 #t) + (sv-224 583) ) - (set! sv-224 583) - (set! sv-240 format) - (let ((a0-18 (clear *temp-string*)) - (a1-6 "~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-29 (-> s2-0 level_name)) ) - (sv-240 a0-18 a1-6 a2-6) - ) - (let* ((a2-7 *temp-string*) - (a3-2 s3-0) - (v1-29 (-> s2-0 level_name)) - (t0-1 (cond - ((= v1-29 'ctyport) - 3 - ) - ((= v1-29 'ctyinda) - 4 - ) - ((= v1-29 'ctyindb) - 5 - ) - ((= v1-29 'ctypal) - 6 - ) - ((= v1-29 'ctysluma) - 7 - ) - ((= v1-29 'ctyslumb) - 8 - ) - ((= v1-29 'ctyslumc) - 9 - ) - (else - 1 - ) - ) - ) - (t1-0 #f) + (s1-2 + s0-1 + (the-as bucket-id sv-224) + a2-7 + a3-2 + (cond + ((= v1-29 'ctyport) + (font-color red) ) - (s1-2 s0-1 (the-as bucket-id sv-224) a2-7 a3-2 (the-as font-color t0-1) (the-as vector2h t1-0)) + ((= v1-29 'ctyinda) + (font-color orange) + ) + ((= v1-29 'ctyindb) + (font-color yellow) + ) + ((= v1-29 'ctypal) + (font-color green) + ) + ((= v1-29 'ctysluma) + (font-color blue) + ) + ((= v1-29 'ctyslumb) + (font-color cyan) + ) + ((= v1-29 'ctyslumc) + (font-color pink) + ) + (else + (font-color white) + ) + ) + (the-as vector2h #f) + ) ) ) (let ((s1-3 (new 'stack-no-clear 'vector))) @@ -638,10 +622,11 @@ (dotimes (s4-1 (-> s5-0 edge-array length)) (let ((s3-1 (-> s5-0 edge-array data s4-1))) (when (not (logtest? (-> s3-1 mysql-save-flag) (mysql-save-flag delete))) - (let ((s1-4 (-> s5-0 node-array data (-> s3-1 runtime-node-id-1)))) - (set! sv-256 (-> s5-0 node-array data (-> s3-1 runtime-node-id-2))) - (set! sv-272 (new 'stack-no-clear 'vector)) - (set! sv-288 (new 'stack-no-clear 'vector)) + (let ((s1-4 (-> s5-0 node-array data (-> s3-1 runtime-node-id-1))) + (sv-256 (-> s5-0 node-array data (-> s3-1 runtime-node-id-2))) + (sv-272 (new 'stack-no-clear 'vector)) + (sv-288 (new 'stack-no-clear 'vector)) + ) (new 'stack-no-clear 'vector) (let ((s2-1 (new 'stack-no-clear 'vector)) (s0-3 (new 'stack-no-clear 'vector)) @@ -654,10 +639,8 @@ (or (-> s1-4 visible) (-> sv-256 visible)) ) (vector-! sv-272 s0-3 s2-1) - (let* ((f0-11 (vector-length sv-272)) - (f1-5 (fmax (* 0.75 f0-11) (+ -8192.0 f0-11))) - ) - (vector-float*! sv-272 sv-272 (/ f1-5 f0-11)) + (let ((f0-11 (vector-length sv-272))) + (vector-float*! sv-272 sv-272 (/ (fmax (* 0.75 f0-11) (+ -8192.0 f0-11)) f0-11)) ) (let ((v1-64 sv-288)) (let ((a0-40 s2-1)) @@ -689,22 +672,18 @@ #f *color-white* ) - (let ((s1-5 add-debug-text-3d)) - (set! sv-304 #t) - (set! sv-320 577) - (set! sv-336 format) - (let ((a0-48 (clear *temp-string*)) - (a1-18 "~d") - (a2-12 (-> s3-1 nav_territory_type)) - ) - (sv-336 a0-48 a1-18 a2-12) - ) - (let ((a2-13 *temp-string*) - (a3-7 (vector-float*! (new 'stack-no-clear 'vector) (vector+! (new 'stack-no-clear 'vector) s2-1 s0-3) 0.5)) - (t0-5 3) - (t1-4 #f) - ) - (s1-5 sv-304 (the-as bucket-id sv-320) a2-13 a3-7 (the-as font-color t0-5) (the-as vector2h t1-4)) + (let ((s1-5 add-debug-text-3d) + (sv-304 #t) + (sv-320 577) + ) + (format (clear *temp-string*) "~d" (-> s3-1 nav_territory_type)) + (s1-5 + sv-304 + (the-as bucket-id sv-320) + *temp-string* + (vector-float*! (new 'stack-no-clear 'vector) (vector+! (new 'stack-no-clear 'vector) s2-1 s0-3) 0.5) + (font-color red) + (the-as vector2h #f) ) ) ) @@ -1132,7 +1111,6 @@ ;; definition for method 49 of type nav-graph-editor ;; INFO: Used lq/sq (defmethod nav-graph-editor-method-49 ((this nav-graph-editor)) - (local-vars (sv-80 mysql-nav-node) (sv-96 vector)) (set! (-> this closest-edge) -1) (set! (-> this dist-closest-edge) 0.0) (let ((s5-0 (-> this nav-graph))) @@ -1142,11 +1120,12 @@ (when (and (not (logtest? (-> s3-0 mysql-save-flag) (mysql-save-flag delete))) (not (logtest? (-> s3-0 minimap_edge_flag) (nav-minimap-edge-flag blocker))) ) - (let ((s2-0 (-> s5-0 node-array data (-> s3-0 runtime-node-id-1)))) - (set! sv-80 (-> s5-0 node-array data (-> s3-0 runtime-node-id-2))) + (let ((s2-0 (-> s5-0 node-array data (-> s3-0 runtime-node-id-1))) + (sv-80 (-> s5-0 node-array data (-> s3-0 runtime-node-id-2))) + ) (new 'stack-no-clear 'vector) - (set! sv-96 (new 'stack-no-clear 'vector)) - (let ((s0-0 (new 'stack-no-clear 'vector)) + (let ((sv-96 (new 'stack-no-clear 'vector)) + (s0-0 (new 'stack-no-clear 'vector)) (s1-0 (new 'stack-no-clear 'vector)) ) (get-node-draw-position s0-0 s2-0) @@ -1174,14 +1153,6 @@ ;; definition for method 47 of type nav-graph-editor ;; INFO: Used lq/sq (defmethod nav-graph-editor-method-47 ((this nav-graph-editor)) - (local-vars - (sv-160 mysql-nav-node) - (sv-176 mysql-nav-node) - (sv-192 vector) - (sv-208 vector) - (sv-224 vector) - (sv-240 vector) - ) (rlet ((vf0 :class vf) (vf4 :class vf) (vf5 :class vf) @@ -1192,62 +1163,59 @@ (dotimes (s4-0 (-> s5-0 edge-array length)) (let ((s1-0 (-> s5-0 edge-array data s4-0))) (when (not (logtest? (-> s1-0 mysql-save-flag) (mysql-save-flag delete))) - (set! sv-160 (-> s5-0 node-array data (-> s1-0 runtime-node-id-1))) - (set! sv-176 (-> s5-0 node-array data (-> s1-0 runtime-node-id-2))) - (let ((s2-0 (new 'stack-no-clear 'vector)) + (let ((sv-160 (-> s5-0 node-array data (-> s1-0 runtime-node-id-1))) + (sv-176 (-> s5-0 node-array data (-> s1-0 runtime-node-id-2))) + (s2-0 (new 'stack-no-clear 'vector)) (s3-0 (new 'stack-no-clear 'vector)) + (sv-192 (new 'stack-no-clear 'vector)) + (s0-0 (new 'stack-no-clear 'vector)) ) - (set! sv-192 (new 'stack-no-clear 'vector)) - (let ((s0-0 (new 'stack-no-clear 'vector))) - (get-node-draw-position sv-192 sv-160) - (get-node-draw-position s0-0 sv-176) - (when (and (>= (-> s1-0 runtime-node-id-1) 0) - (>= (-> s1-0 runtime-node-id-2) 0) - (or (-> sv-160 visible) (-> sv-176 visible)) - ) - (vector-! s2-0 s0-0 sv-192) - (let ((s1-1 (new 'stack-no-clear 'vector))) - (vector-copy! s1-1 sv-192) - (set! sv-208 (new 'stack-no-clear 'vector)) - (let ((v1-26 (-> s0-0 quad))) - (set! (-> sv-208 quad) v1-26) - ) + (get-node-draw-position sv-192 sv-160) + (get-node-draw-position s0-0 sv-176) + (when (and (>= (-> s1-0 runtime-node-id-1) 0) + (>= (-> s1-0 runtime-node-id-2) 0) + (or (-> sv-160 visible) (-> sv-176 visible)) + ) + (vector-! s2-0 s0-0 sv-192) + (let ((s1-1 (new 'stack-no-clear 'vector))) + (vector-copy! s1-1 sv-192) + (let ((sv-208 (new 'stack-no-clear 'vector))) + (vector-copy! sv-208 s0-0) (let ((v0-2 (vector-normalize-copy! (new 'stack-no-clear 'vector) s2-0 4915.2))) (vector+! s1-1 s1-1 v0-2) (vector-! sv-208 sv-208 v0-2) ) - (let ((a1-8 s2-0) - (v1-29 s1-1) - ) - (vector-! a1-8 sv-208 v1-29) - ) - (let ((f30-0 0.0) - (s0-1 ray-cylinder-intersect) - ) - (set! sv-224 (-> this mouse-pos)) - (set! sv-240 (new 'stack-no-clear 'vector)) - (let ((v1-32 (-> this mouse-hit-pick)) - (a0-17 (-> this mouse-pos)) - ) - (.lvf vf4 (&-> v1-32 quad)) - (.lvf vf5 (&-> a0-17 quad)) + (vector-! s2-0 sv-208 s1-1) + ) + (let ((f30-0 0.0) + (s0-1 ray-cylinder-intersect) + (sv-224 (-> this mouse-pos)) + (sv-240 (new 'stack-no-clear 'vector)) ) - (.mov.vf.w vf6 vf0) - (.sub.vf.xyz vf6 vf4 vf5) - (.svf (&-> sv-240 quad) vf6) - (let ((a3-0 (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-224 sv-240 s1-1 a3-0 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) - ) - ) + (let ((v1-32 (-> this mouse-hit-pick)) + (a0-17 (-> this mouse-pos)) + ) + (.lvf vf4 (&-> v1-32 quad)) + (.lvf vf5 (&-> a0-17 quad)) + ) + (.mov.vf.w vf6 vf0) + (.sub.vf.xyz vf6 vf4 vf5) + (.svf (&-> sv-240 quad) vf6) + (when (< f30-0 (s0-1 + sv-224 + sv-240 + s1-1 + (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) ) ) ) @@ -2551,16 +2519,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) @@ -2581,52 +2539,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)) @@ -2682,7 +2642,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* ((v1-0 *nav-graph-editor*) (s5-0 (-> (the-as nav-graph-editor (if v1-0 (the-as nav-graph-editor (-> v1-0 0 self)) @@ -2708,32 +2667,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-37 (-> 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-37 (-> 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/jak3/engine/debug/viewer_REF.gc b/test/decompiler/reference/jak3/engine/debug/viewer_REF.gc index 1fccbe6fc4..e4a4273f17 100644 --- a/test/decompiler/reference/jak3/engine/debug/viewer_REF.gc +++ b/test/decompiler/reference/jak3/engine/debug/viewer_REF.gc @@ -242,31 +242,24 @@ ;; 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 1)) - (when sv-48 - (let ((t9-2 (method-of-type viewer activate))) - (t9-2 (the-as viewer sv-48) arg4 "viewer" (the-as pointer #x70004000)) - ) - (let ((t9-3 run-function-in-process) - (a0-7 sv-48) - (a1-4 init-viewer-for-other) - (a2-4 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 1))) + (when sv-48 + ((method-of-type viewer activate) (the-as viewer sv-48) arg4 "viewer" (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-4 sv-64 t0-1) + ) ) - (-> sv-48 ppointer) + (+! sv-32 1) ) - (set! sv-32 (+ sv-32 1)) ) ) #f diff --git a/test/decompiler/reference/jak3/engine/dma/dma-disasm_REF.gc b/test/decompiler/reference/jak3/engine/dma/dma-disasm_REF.gc index fbb943a419..b459b8d974 100644 --- a/test/decompiler/reference/jak3/engine/dma/dma-disasm_REF.gc +++ b/test/decompiler/reference/jak3/engine/dma/dma-disasm_REF.gc @@ -315,136 +315,139 @@ ;; INFO: Used lq/sq (defun disasm-vif-tag ((tag (pointer vif-tag)) (count int) (format-dest symbol) (details? 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 uint)) (let ((gp-0 0)) (while (< gp-0 (* count 4)) (let ((s0-0 4)) (let ((s1-0 (-> tag 0))) (format format-dest " #x~X:" tag) (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 format-dest " (~s :irq ~D)~%" (-> *vif-disasm-table* v1-0 string1) (-> s1-0 irq)) - ) - ((= a0-12 1) - (format - format-dest - " (~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 format-dest " (~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 format-dest - " (~s :irq ~D :wl ~D :cl ~D)~%" + " (~s :irq ~D :~s #x~X)~%" (-> *vif-disasm-table* v1-0 string1) (-> s1-0 irq) - (shr (shl t1-1 48) 56) - (shr (shl t1-1 56) 56) + (-> *vif-disasm-table* v1-0 string2) + (-> s1-0 imm) ) ) - ) - ((= a0-12 3) - (set! s0-0 8) - (format - format-dest - " (~s :irq ~D :~s #x~X)~%" - (-> *vif-disasm-table* v1-0 string1) - (-> s1-0 irq) - (-> *vif-disasm-table* v1-0 string2) - (-> tag 1) - ) - ) - ((= a0-12 4) - (set! s0-0 20) - (format - format-dest - " (~s :irq ~D :~s " - (-> *vif-disasm-table* v1-0 string1) - (-> s1-0 irq) - (-> *vif-disasm-table* v1-0 string2) - ) - (format format-dest "#x~X #x~X #x~X #x~X)~%" (-> tag 1) (-> tag 2) (-> tag 3) (-> tag 4)) - ) - ((= a0-12 5) - (format - format-dest - " (~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 - format-dest - " (~s :irq ~D :qwc #x~D)~%" - (-> *vif-disasm-table* v1-0 string1) - (-> s1-0 irq) - (-> s1-0 imm) - ) - (set! sv-32 (&-> tag 1)) - (set! sv-48 0) - (while (< sv-48 (the-as int (-> s1-0 imm))) - (format - format-dest - " #x~X: #x~8x #x~8x #x~8x #x~8x~%" - (+ (+ (* sv-48 16) 4) (the-as int tag)) - (-> 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 (-> s1-0 imm)) - (format - format-dest - " (~s :irq ~D :num ~D :addr #x~X " - (-> *vif-disasm-table* v1-0 string1) - (-> s1-0 irq) - (-> s1-0 num) - (shr (shl sv-64 54) 54) - ) - (format - format-dest - ":msk ~D :flg ~D :usn ~D [skip ~d])~%" - (-> s1-0 msk) - (shr (shl sv-64 48) 63) - (shr (shl sv-64 49) 63) - (the-as uint s0-0) - ) - (if details? - (disasm-vif-details + ((= a0-12 2) + (let ((t1-1 (-> s1-0 imm))) + (format format-dest - (the-as (pointer uint8) tag) - (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 t1-1 48) 56) + (shr (shl t1-1 56) 56) ) ) - ) - ((= a0-12 8) - (format format-dest " (*unknown* vif-tag #x~X)~%" (-> s1-0 cmd)) - ) + ) + ((= a0-12 3) + (set! s0-0 8) + (format + format-dest + " (~s :irq ~D :~s #x~X)~%" + (-> *vif-disasm-table* v1-0 string1) + (-> s1-0 irq) + (-> *vif-disasm-table* v1-0 string2) + (-> tag 1) + ) + ) + ((= a0-12 4) + (set! s0-0 20) + (format + format-dest + " (~s :irq ~D :~s " + (-> *vif-disasm-table* v1-0 string1) + (-> s1-0 irq) + (-> *vif-disasm-table* v1-0 string2) + ) + (format format-dest "#x~X #x~X #x~X #x~X)~%" (-> tag 1) (-> tag 2) (-> tag 3) (-> tag 4)) + ) + ((= a0-12 5) + (format + format-dest + " (~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 + format-dest + " (~s :irq ~D :qwc #x~D)~%" + (-> *vif-disasm-table* v1-0 string1) + (-> s1-0 irq) + (-> s1-0 imm) + ) + (let ((sv-32 (&-> tag 1)) + (sv-48 0) + ) + (while (< sv-48 (the-as int (-> s1-0 imm))) + (format + format-dest + " #x~X: #x~8x #x~8x #x~8x #x~8x~%" + (+ (+ (* sv-48 16) 4) (the-as int tag)) + (-> 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 (-> s1-0 imm))) + (format + format-dest + " (~s :irq ~D :num ~D :addr #x~X " + (-> *vif-disasm-table* v1-0 string1) + (-> s1-0 irq) + (-> s1-0 num) + (shr (shl sv-64 54) 54) + ) + (format + format-dest + ":msk ~D :flg ~D :usn ~D [skip ~d])~%" + (-> s1-0 msk) + (shr (shl sv-64 48) 63) + (shr (shl sv-64 49) 63) + (the-as uint s0-0) + ) + ) + (if details? + (disasm-vif-details + format-dest + (the-as (pointer uint8) tag) + (logand sv-16 (vif-cmd cmd-mask)) + (the-as int (-> s1-0 num)) + ) + ) + ) + ((= a0-12 8) + (format format-dest " (*unknown* vif-tag #x~X)~%" (-> s1-0 cmd)) + ) + ) ) + (set! v1-0 (-> *vif-disasm-table* length)) ) - (set! v1-0 (-> *vif-disasm-table* length)) ) ) ) @@ -527,17 +530,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 object) - (sv-48 int) - (sv-64 object) - (sv-80 object) - (sv-96 int) - (sv-112 dma-tag) - ) - (set! sv-32 data) - (let ((s2-0 mode) + (let ((sv-32 data) + (s2-0 mode) (s3-0 verbose) (gp-0 stream) (s1-0 expected-size) @@ -549,188 +543,190 @@ (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") - ) - (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 (-> (the-as dma-packet 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) + (let ((sv-16 (the-as uint 0)) + (sv-48 0) + (sv-64 (the-as dma-packet 0)) + (sv-80 (the-as dma-packet 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") ) - (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) + (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 (-> (the-as dma-packet 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) + (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 - ((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 (the-as (pointer vif-tag) (&-> (the-as (pointer uint64) sv-32) 1)) 2 gp-0 (= s2-0 'details)) + (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 (the-as (pointer vif-tag) (&-> (the-as (pointer uint64) sv-32) 1)) 2 gp-0 (= s2-0 'details)) + ) ) + (disasm-vif-tag + (the-as (pointer vif-tag) (+ (the-as int sv-16) v0-10)) + (the-as int (- (* (the-as uint sv-48) 4) (the-as uint (/ v0-10 4)))) + gp-0 + (= s2-0 'details) ) - (disasm-vif-tag - (the-as (pointer vif-tag) (+ (the-as int sv-16) v0-10)) - (the-as int (- (* sv-48 4) (the-as uint (/ v0-10 4)))) - gp-0 - (= s2-0 'details) ) ) - ) - (set! sv-32 (&-> (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 uint sv-32) (* (+ sv-48 1) 16))) - (the-as int 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 (-> sv-112 addr)) - (the-as uint 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 (-> sv-112 addr)) - (set! sv-96 (+ sv-96 1)) - (cond - ((zero? sv-96) - (set! sv-64 (&+ (the-as (pointer uint64) sv-16) sv-48)) - (the-as (pointer uint64) sv-64) - ) - (else - (set! sv-80 (&+ (the-as (pointer uint64) 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 sv-64) - sv-32 - ) - ((= v1-123 1) - (set! sv-32 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 uint (&-> (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 uint (&-> (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 uint (&-> (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 dma-packet (&+ (the-as (pointer uint64) sv-16) (the-as uint sv-48)))) + sv-64 + ) + (else + (set! sv-80 (the-as dma-packet (&+ (the-as (pointer uint64) sv-16) (the-as uint sv-48)))) + 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 uint (&-> (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 sv-64) + sv-32 + ) + ((= v1-123 1) + (set! sv-32 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 uint (&-> (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) @@ -742,7 +738,3 @@ ) ) ) - - - - diff --git a/test/decompiler/reference/jak3/engine/draw/drawable_REF.gc b/test/decompiler/reference/jak3/engine/draw/drawable_REF.gc index 008c4377a7..250cf40408 100644 --- a/test/decompiler/reference/jak3/engine/draw/drawable_REF.gc +++ b/test/decompiler/reference/jak3/engine/draw/drawable_REF.gc @@ -418,7 +418,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) @@ -438,14 +437,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 @@ -523,17 +515,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 @@ -652,30 +633,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 @@ -690,56 +673,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~%" @@ -854,12 +834,7 @@ (.svf (&-> s4-0 quad) vf1) (vector-normalize! s4-0 -1.0) (when (< (- (-> s4-0 y)) 0.9063) - (let* ((f0-2 0.4226) - (f1-1 (-> s4-0 x)) - (f1-3 (* f1-1 f1-1)) - (f2-0 (-> s4-0 z)) - (f0-3 (/ f0-2 (sqrtf (+ f1-3 (* f2-0 f2-0))))) - ) + (let ((f0-3 (/ 0.4226 (sqrtf (+ (square (-> s4-0 x)) (square (-> s4-0 z))))))) (set! (-> s4-0 x) (* (-> s4-0 x) f0-3)) (set! (-> s4-0 y) -0.9063) (set! (-> s4-0 z) (* (-> s4-0 z) f0-3)) @@ -886,7 +861,7 @@ ;; WARN: Return type mismatch symbol vs none. ;; ERROR: Unsupported inline assembly instruction kind - [srl v1, v1, 24] (defun calc-shadow-masks ((arg0 light-group) (arg1 draw-control) (arg2 uint)) - (local-vars (v1-25 uint) (v1-26 int) (sv-64 light-hash) (sv-68 vector) (sv-72 mood-context) (sv-76 pointer)) + (local-vars (v1-25 uint) (v1-26 int)) (let ((s5-0 (the-as (array float) (new 'stack 'boxed-array float 6)))) (let ((v1-1 (-> arg1 shadow-mask)) (a0-2 (-> arg1 shadow-values)) @@ -904,30 +879,34 @@ (dotimes (s3-1 (-> *level* length)) (let ((v1-10 (-> *level* level s3-1))) (when (= (-> v1-10 status) 'active) - (set! sv-64 (-> v1-10 light-hash)) - (set! sv-68 (-> arg1 origin)) - (set! sv-72 (-> v1-10 mood-context)) - (when (nonzero? sv-64) - (let ((v1-13 (light-hash-get-bucket-index sv-64 (-> arg1 origin)))) - (when (!= v1-13 -1) - (let ((s2-0 (-> sv-64 bucket-array v1-13))) - (set! sv-76 (+ (+ (-> s2-0 index) 0) (the-as uint (-> sv-64 index-array)))) - (dotimes (s1-0 (the-as int (-> s2-0 count))) - (let ((s0-0 (-> sv-64 light-sphere-array (-> (the-as (pointer uint8) (&+ sv-76 s1-0)))))) - (when (= (-> s0-0 palette-index) -2) - (let* ((f0-3 (-> s0-0 bsphere w)) - (f28-0 (* f0-3 (-> s0-0 decay-start))) - (f26-0 (- f0-3 f28-0)) - (f0-8 (fmax 0.0 (fmin 1.0 (/ (- (vector-vector-distance (-> s0-0 bsphere) sv-68) f28-0) f26-0)))) - ) - (when (!= f0-8 1.0) - (.srl v1-26 v1-25 24) - (let ((a0-26 (shr (shl (-> s0-0 shadow) 40) 40))) - (dotimes (a1-6 5) - (when (logtest? v1-26 (ash 1 a1-6)) - (let ((f1-5 (* 0.0625 (the float (logand (ash a0-26 (* -4 a1-6)) 15))))) - 1.0 - (set! (-> s5-0 a1-6) (fmin (-> s5-0 a1-6) (+ f1-5 (* (- 1.0 f1-5) f0-8)))) + (let ((sv-64 (-> v1-10 light-hash)) + (sv-68 (-> arg1 origin)) + ) + (let ((sv-72 (-> v1-10 mood-context))) + ) + (when (nonzero? sv-64) + (let ((v1-13 (light-hash-get-bucket-index sv-64 (-> arg1 origin)))) + (when (!= v1-13 -1) + (let* ((s2-0 (-> sv-64 bucket-array v1-13)) + (sv-76 (+ (+ (-> s2-0 index) 0) (the-as uint (-> sv-64 index-array)))) + ) + (dotimes (s1-0 (the-as int (-> s2-0 count))) + (let ((s0-0 (-> sv-64 light-sphere-array (-> (the-as (pointer uint8) (&+ sv-76 s1-0)))))) + (when (= (-> s0-0 palette-index) -2) + (let* ((f0-3 (-> s0-0 bsphere w)) + (f28-0 (* f0-3 (-> s0-0 decay-start))) + (f26-0 (- f0-3 f28-0)) + (f0-8 (fmax 0.0 (fmin 1.0 (/ (- (vector-vector-distance (-> s0-0 bsphere) sv-68) f28-0) f26-0)))) + ) + (when (!= f0-8 1.0) + (.srl v1-26 v1-25 24) + (let ((a0-26 (shr (shl (-> s0-0 shadow) 40) 40))) + (dotimes (a1-6 5) + (when (logtest? v1-26 (ash 1 a1-6)) + (let ((f1-5 (* 0.0625 (the float (logand (ash a0-26 (* -4 a1-6)) 15))))) + 1.0 + (set! (-> s5-0 a1-6) (fmin (-> s5-0 a1-6) (+ f1-5 (* (- 1.0 f1-5) f0-8)))) + ) ) ) ) @@ -959,34 +938,35 @@ ;; definition for function calc-realtime-lights ;; WARN: Return type mismatch symbol vs none. (defun calc-realtime-lights ((arg0 light-group) (arg1 draw-control) (arg2 uint)) - (local-vars (sv-16 light-hash) (sv-20 vector) (sv-24 mood-context)) (when (or (and (>= (the-as int arg2) 10) (< (the-as int arg2) 18)) (and (>= (the-as int arg2) 30) (< (the-as int arg2) 38)) ) (dotimes (s4-0 (-> *level* length)) (let ((v1-5 (-> *level* level s4-0))) (when (= (-> v1-5 status) 'active) - (set! sv-16 (-> v1-5 light-hash)) - (set! sv-20 (-> arg1 origin)) - (set! sv-24 (-> v1-5 mood-context)) - (when (nonzero? sv-16) - (let ((v1-8 (light-hash-get-bucket-index sv-16 (-> arg1 origin)))) - (when (!= v1-8 -1) - (let* ((s3-0 (-> sv-16 bucket-array v1-8)) - (s2-0 (+ (+ (-> s3-0 index) 0) (the-as uint (-> sv-16 index-array)))) - ) - (dotimes (s1-0 (the-as int (-> s3-0 count))) - (let* ((a1-3 (-> sv-16 light-sphere-array (-> (the-as (pointer uint8) (&+ s2-0 s1-0))))) - (v1-14 (-> a1-3 palette-index)) - (f0-1 (if (= v1-14 -1) - 1.0 - (-> sv-24 times v1-14 w) - ) - ) - ) - (if (not (or (= (-> a1-3 palette-index) -2) (= (* (-> a1-3 brightness) f0-1) 0.0))) - (add-light-sphere-to-light-group arg0 a1-3 sv-20 sv-24) - ) + (let ((sv-16 (-> v1-5 light-hash)) + (sv-20 (-> arg1 origin)) + (sv-24 (-> v1-5 mood-context)) + ) + (when (nonzero? sv-16) + (let ((v1-8 (light-hash-get-bucket-index sv-16 (-> arg1 origin)))) + (when (!= v1-8 -1) + (let* ((s3-0 (-> sv-16 bucket-array v1-8)) + (s2-0 (+ (+ (-> s3-0 index) 0) (the-as uint (-> sv-16 index-array)))) + ) + (dotimes (s1-0 (the-as int (-> s3-0 count))) + (let* ((a1-3 (-> sv-16 light-sphere-array (-> (the-as (pointer uint8) (&+ s2-0 s1-0))))) + (v1-14 (-> a1-3 palette-index)) + (f0-1 (if (= v1-14 -1) + 1.0 + (-> sv-24 times v1-14 w) + ) + ) + ) + (if (not (or (= (-> a1-3 palette-index) -2) (= (* (-> a1-3 brightness) f0-1) 0.0))) + (add-light-sphere-to-light-group arg0 a1-3 sv-20 sv-24) + ) + ) ) ) ) @@ -1131,7 +1111,7 @@ ;; 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 ((arg0 process-drawable) (arg1 draw-control) (arg2 symbol) (arg3 dma-buffer)) "Generate DMA for foreground object, calculate lights/shadows, etc." - (local-vars (a0-41 int) (a0-43 int) (a3-9 uint128) (sv-16 process-drawable)) + (local-vars (a0-41 int) (a0-43 int) (a3-9 uint128)) (with-pp (rlet ((acc :class vf) (Q :class vf) @@ -1153,154 +1133,155 @@ (vf29 :class vf) ) (init-vf0-vector) - (set! sv-16 arg0) - (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) + (let ((sv-16 arg0)) + (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) - (.mtpc pcr0 0) - (.mtpc pcr1 0) - (.sync.l) - (.sync.p) - (.mtc0 Perf a0-1) - ) - (.sync.l) - (.sync.p) - (label cfg-2) - 0 - (when (get-menu-mode *blit-displays-work*) - (if (not (logtest? (-> arg1 status) (draw-control-status hud))) - (return #f) - ) - ) - (logclear! (-> arg1 status) (draw-control-status on-screen)) - (when (not (logtest? (-> arg1 status) (draw-control-status no-draw no-draw-temp uninited))) - (let ((s3-0 (-> (the-as foreground-work #x70000000) bounds)) - (s4-0 (-> (the-as foreground-work #x70000000) lights)) + (label cfg-2) + 0 + (when (get-menu-mode *blit-displays-work*) + (if (not (logtest? (-> arg1 status) (draw-control-status hud))) + (return #f) ) - (.lvf vf16 (&-> arg1 origin quad)) - (.svf (&-> s3-0 quad) vf16) - (when (or (sphere-in-view-frustum? s3-0) (logtest? (-> arg1 status) (draw-control-status no-bounds-check))) - (calc-vu1-lights s4-0 arg1 #t) - (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 rvec quad)) - (.lvf vf25 (&-> at-0 camera-rot uvec quad)) - (.lvf vf26 (&-> at-0 camera-rot fvec quad)) - (.lvf vf27 (&-> at-0 camera-rot trans quad)) - ) - (let ((v1-20 (-> (the-as foreground-work #x70000000) distance))) - (.lvf vf15 (&-> s3-0 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 (&-> v1-20 quad) vf15) - (when (< 0.0 (+ (-> v1-20 z) (-> arg1 bounds w))) - (let ((s4-1 0)) - (let ((f30-0 (-> v1-20 w))) - (if (and *debug-segment* (-> *screen-shot-work* highres-enable)) - (set! f30-0 0.0) - ) - (set! (-> arg1 distance) f30-0) - (when (nonzero? (-> arg1 lod-set max-lod)) - (cond - ((>= (-> arg1 force-lod) 0) - (set! s4-1 (-> arg1 force-lod)) - (if (< (-> arg1 lod-set lod (-> arg1 lod-set max-lod) dist) f30-0) - (return #f) - ) - ) - (else - (while (and (< s4-1 (-> arg1 lod-set max-lod)) (< (-> arg1 lod-set lod s4-1 dist) f30-0)) - (+! s4-1 1) + ) + (logclear! (-> arg1 status) (draw-control-status on-screen)) + (when (not (logtest? (-> arg1 status) (draw-control-status no-draw no-draw-temp uninited))) + (let ((s3-0 (-> (the-as foreground-work #x70000000) bounds)) + (s4-0 (-> (the-as foreground-work #x70000000) lights)) + ) + (.lvf vf16 (&-> arg1 origin quad)) + (.svf (&-> s3-0 quad) vf16) + (when (or (sphere-in-view-frustum? s3-0) (logtest? (-> arg1 status) (draw-control-status no-bounds-check))) + (calc-vu1-lights s4-0 arg1 #t) + (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 rvec quad)) + (.lvf vf25 (&-> at-0 camera-rot uvec quad)) + (.lvf vf26 (&-> at-0 camera-rot fvec quad)) + (.lvf vf27 (&-> at-0 camera-rot trans quad)) + ) + (let ((v1-20 (-> (the-as foreground-work #x70000000) distance))) + (.lvf vf15 (&-> s3-0 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 (&-> v1-20 quad) vf15) + (when (< 0.0 (+ (-> v1-20 z) (-> arg1 bounds w))) + (let ((s4-1 0)) + (let ((f30-0 (-> v1-20 w))) + (if (and *debug-segment* (-> *screen-shot-work* highres-enable)) + (set! f30-0 0.0) + ) + (set! (-> arg1 distance) f30-0) + (when (nonzero? (-> arg1 lod-set max-lod)) + (cond + ((>= (-> arg1 force-lod) 0) + (set! s4-1 (-> arg1 force-lod)) + (if (< (-> arg1 lod-set lod (-> arg1 lod-set max-lod) dist) f30-0) + (return #f) + ) + ) + (else + (while (and (< s4-1 (-> arg1 lod-set max-lod)) (< (-> arg1 lod-set lod s4-1 dist) f30-0)) + (+! s4-1 1) + ) ) ) ) - ) - (if (and (< (-> arg1 lod-set lod s4-1 dist) f30-0) (< (-> arg1 force-lod) 0)) - (return #f) - ) - (let ((v1-49 (-> *level* level (-> arg1 level-index))) - (f0-5 (* f30-0 (-> *math-camera* fov-correction-factor))) - (a0-18 (-> arg1 mgeo header texture-usage-group)) + (if (and (< (-> arg1 lod-set lod s4-1 dist) f30-0) (< (-> arg1 force-lod) 0)) + (return #f) ) - (dotimes (a1-4 7) - (let ((a2-2 (+ a1-4 12))) - (if (not (logtest? (-> arg1 status) (draw-control-status no-closest-distance))) - (set! (-> v1-49 closest-object a2-2) (fmin (-> v1-49 closest-object a2-2) f30-0)) - ) - ) - (let ((t0-0 (cond - ((>= f0-5 (-> a0-18 data a1-4 data 0 dist)) - 0 - ) - ((>= f0-5 (-> a0-18 data a1-4 data 1 dist)) - 1 - ) - (else - 2 + (let ((v1-49 (-> *level* level (-> arg1 level-index))) + (f0-5 (* f30-0 (-> *math-camera* fov-correction-factor))) + (a0-18 (-> arg1 mgeo header texture-usage-group)) + ) + (dotimes (a1-4 7) + (let ((a2-2 (+ a1-4 12))) + (if (not (logtest? (-> arg1 status) (draw-control-status no-closest-distance))) + (set! (-> v1-49 closest-object a2-2) (fmin (-> v1-49 closest-object a2-2) f30-0)) + ) + ) + (let ((t0-0 (cond + ((>= f0-5 (-> a0-18 data a1-4 data 0 dist)) + 0 + ) + ((>= f0-5 (-> a0-18 data a1-4 data 1 dist)) + 1 + ) + (else + 2 + ) ) ) - ) - (a2-12 (+ a1-4 12)) - ) - (let ((a3-8 (-> v1-49 texture-mask a2-12 mask quad)) - (t0-3 (-> (the-as (pointer int128) (+ (the-as uint a0-18) (* 48 a1-4) (* t0-0 16))) 0)) + (a2-12 (+ a1-4 12)) ) - (.por a3-9 a3-8 t0-3) + (let ((a3-8 (-> v1-49 texture-mask a2-12 mask quad)) + (t0-3 (-> (the-as (pointer int128) (+ (the-as uint a0-18) (* 48 a1-4) (* t0-0 16))) 0)) + ) + (.por a3-9 a3-8 t0-3) + ) + (set! (-> v1-49 texture-mask a2-12 mask quad) a3-9) ) - (set! (-> v1-49 texture-mask a2-12 mask quad) a3-9) ) ) + (if (or (guard-band-cull s3-0) (< f30-0 (* 1.2 (-> *math-camera* d)))) + (logior! (-> arg1 status) (draw-control-status close-to-screen)) + (logclear! (-> arg1 status) (draw-control-status close-to-screen)) + ) + (logior! (-> arg1 status) (draw-control-status on-screen)) + (if (logtest? (-> arg1 status) (draw-control-status no-draw-bounds no-draw-bounds2)) + (return #f) + ) + (set! (-> pp clock) (-> sv-16 clock)) + (if (or (= s4-1 (-> arg1 cur-lod)) (logtest? (-> arg1 status) (draw-control-status lod-set))) + (foreground-draw arg1 arg3 f30-0) + ) ) - (if (or (guard-band-cull s3-0) (< f30-0 (* 1.2 (-> *math-camera* d)))) - (logior! (-> arg1 status) (draw-control-status close-to-screen)) - (logclear! (-> arg1 status) (draw-control-status close-to-screen)) + (when (and (< s4-1 (-> arg1 cur-lod)) (logtest? (-> arg1 status) (draw-control-status math-skel))) + (let ((s5-1 *matrix-engine*)) + (when (= (-> s5-1 length) (-> s5-1 allocated-length)) + (format 0 "Matrix engine is too small!~%") + (format *stdcon* "Matrix engine is too small!~%") + (break!) + 0 + ) + (set! (-> s5-1 (-> s5-1 length)) (process->handle sv-16)) + (+! (-> s5-1 length) 1) ) - (logior! (-> arg1 status) (draw-control-status on-screen)) - (if (logtest? (-> arg1 status) (draw-control-status no-draw-bounds no-draw-bounds2)) - (return #f) - ) - (set! (-> pp clock) (-> sv-16 clock)) - (if (or (= s4-1 (-> arg1 cur-lod)) (logtest? (-> arg1 status) (draw-control-status lod-set))) - (foreground-draw arg1 arg3 f30-0) - ) - ) - (when (and (< s4-1 (-> arg1 cur-lod)) (logtest? (-> arg1 status) (draw-control-status math-skel))) - (let ((s5-1 *matrix-engine*)) - (when (= (-> s5-1 length) (-> s5-1 allocated-length)) - (format 0 "Matrix engine is too small!~%") - (format *stdcon* "Matrix engine is too small!~%") - (break!) - 0 - ) - (set! (-> s5-1 (-> s5-1 length)) (process->handle sv-16)) - (+! (-> s5-1 length) 1) ) + (lod-set! arg1 s4-1) ) - (lod-set! arg1 s4-1) + (logior! (-> arg1 status) (draw-control-status lod-set)) ) - (logior! (-> arg1 status) (draw-control-status lod-set)) ) ) ) diff --git a/test/decompiler/reference/jak3/engine/entity/actor-link-h_REF.gc b/test/decompiler/reference/jak3/engine/entity/actor-link-h_REF.gc index 8b5770ea0c..7dfddaaf1e 100644 --- a/test/decompiler/reference/jak3/engine/entity/actor-link-h_REF.gc +++ b/test/decompiler/reference/jak3/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 @@ -428,7 +428,3 @@ and use it for entity lookups." gp-0 ) ) - - - - diff --git a/test/decompiler/reference/jak3/engine/entity/entity_REF.gc b/test/decompiler/reference/jak3/engine/entity/entity_REF.gc index 4396507cda..40384e68d2 100644 --- a/test/decompiler/reference/jak3/engine/entity/entity_REF.gc +++ b/test/decompiler/reference/jak3/engine/entity/entity_REF.gc @@ -523,7 +523,6 @@ ) ;; definition for method 2 of type process -;; INFO: this function exists in multiple non-identical object files (defmethod print ((this process)) (cond ((and (-> this top-thread) (!= (-> this status) 'dead)) @@ -881,24 +880,24 @@ ;; definition for method 23 of type level-group ;; WARN: Return type mismatch int vs none. (defmethod update-vis-volumes ((this level-group)) - (local-vars (sv-16 (inline-array vector)) (sv-20 vector) (sv-24 vector) (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 (inline-array vector))) - (set! sv-20 (-> sv-16 0)) - (set! sv-24 (-> sv-16 1)) - (set! sv-28 (as-type (-> s2-0 extra process) process-drawable)) - ) - (when sv-28 - (update-actor-vis-box (the-as process-drawable sv-28) sv-20 sv-24) - (let ((s2-2 (-> sv-28 child))) - (while s2-2 - (update-actor-vis-box (the-as process-drawable (as-type (-> s2-2 0) process-drawable)) sv-20 sv-24) - (set! s2-2 (-> s2-2 0 brother)) + (let* ((s2-0 (-> s4-0 data s3-0 entity)) + (sv-16 (res-lump-data s2-0 'visvol (inline-array vector))) + (sv-20 (-> sv-16 0)) + (sv-24 (-> sv-16 1)) + (sv-28 (as-type (-> s2-0 extra process) process-drawable)) + ) + (when sv-28 + (update-actor-vis-box (the-as process-drawable sv-28) sv-20 sv-24) + (let ((s2-2 (-> sv-28 child))) + (while s2-2 + (update-actor-vis-box (the-as process-drawable (as-type (-> s2-2 0) process-drawable)) sv-20 sv-24) + (set! s2-2 (-> s2-2 0 brother)) + ) ) ) ) @@ -928,17 +927,17 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch symbol vs object. (defun expand-bounding-box-from-nav-meshes ((arg0 entity) (arg1 vector) (arg2 vector)) - (local-vars (sv-16 res-tag)) - (set! sv-16 (new 'static 'res-tag)) - (res-lump-data arg0 'nav-mesh-actor pointer :tag-ptr (& sv-16)) - (dotimes (s3-0 (the-as int (-> sv-16 elt-count))) - (let ((a0-3 (nav-mesh-from-res-tag arg0 'nav-mesh-actor s3-0))) - (when a0-3 - (let ((s2-0 (new 'stack-no-clear 'vector)) - (s1-0 (new 'stack-no-clear 'vector)) - ) - (compute-bounding-box-from-vertices a0-3 s2-0 s1-0) - (expand-bounding-box arg1 arg2 s2-0 s1-0) + (let ((sv-16 (new 'static 'res-tag))) + (res-lump-data arg0 'nav-mesh-actor pointer :tag-ptr (& sv-16)) + (dotimes (s3-0 (the-as int (-> sv-16 elt-count))) + (let ((a0-3 (nav-mesh-from-res-tag arg0 'nav-mesh-actor s3-0))) + (when a0-3 + (let ((s2-0 (new 'stack-no-clear 'vector)) + (s1-0 (new 'stack-no-clear 'vector)) + ) + (compute-bounding-box-from-vertices a0-3 s2-0 s1-0) + (expand-bounding-box arg1 arg2 s2-0 s1-0) + ) ) ) ) @@ -950,80 +949,74 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defmethod level-group-method-24 ((this level-group)) - (local-vars - (sv-16 (inline-array vector)) - (sv-20 vector) - (sv-24 vector) - (sv-28 float) - (sv-32 float) - (sv-36 vector) - (sv-40 entity) - (sv-48 res-tag) - ) (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 (inline-array vector))) - (set! sv-20 (-> sv-16 0)) - (set! sv-24 (-> sv-16 1)) - (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 ((v1-17 (entity-actor-lookup s2-0 'nav-mesh-actor 0))) - (if v1-17 - (set! sv-40 v1-17) + (let* ((s2-0 (-> s4-0 data s3-0 entity)) + (sv-16 (res-lump-data s2-0 'visvol (inline-array vector))) + (sv-20 (-> sv-16 0)) + (sv-24 (-> sv-16 1)) + (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 ((enemy-option (res-lump-value sv-40 'enemy-options enemy-option :time -1000000000.0))) - (cond - ((logtest? (enemy-option spawner) (the-as uint128 enemy-option)) - (vector-copy! sv-20 sv-36) - (vector-copy! sv-24 sv-36) - (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)) - (vector-copy! sv-20 sv-36) - (vector-copy! sv-24 sv-36) - (set! sv-48 (new 'static 'res-tag)) - (let ((v1-29 (res-lump-data sv-40 'actor-groups (pointer actor-group) :tag-ptr (& sv-48)))) - (when (and v1-29 (nonzero? (-> sv-48 elt-count))) - (let* ((s2-2 (-> v1-29 0)) - (s1-1 (-> s2-2 length)) + (let ((v1-17 (entity-actor-lookup s2-0 'nav-mesh-actor 0))) + (if v1-17 + (set! sv-40 v1-17) + ) + ) + (cond + ((type? sv-40 entity-actor) + (let ((enemy-option (res-lump-value sv-40 'enemy-options enemy-option :time -1000000000.0))) + (cond + ((logtest? (enemy-option spawner) (the-as uint128 enemy-option)) + (vector-copy! sv-20 sv-36) + (vector-copy! sv-24 sv-36) + (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)) + (vector-copy! sv-20 sv-36) + (vector-copy! sv-24 sv-36) + (let* ((sv-48 (new 'static 'res-tag)) + (v1-29 (res-lump-data sv-40 'actor-groups (pointer actor-group) :tag-ptr (& sv-48))) ) - (dotimes (s0-0 s1-1) - (let ((a0-26 (-> s2-2 data s0-0 actor))) - (expand-bounding-box-from-nav-meshes a0-26 sv-20 sv-24) + (when (and v1-29 (nonzero? (-> sv-48 elt-count))) + (let* ((s2-2 (-> v1-29 0)) + (s1-1 (-> s2-2 length)) + ) + (dotimes (s0-0 s1-1) + (let ((a0-26 (-> s2-2 data s0-0 actor))) + (expand-bounding-box-from-nav-meshes a0-26 sv-20 sv-24) + ) + ) ) ) ) ) - ) - ) - (else - (expand-bounding-box-from-nav-meshes sv-40 sv-20 sv-24) + (else + (expand-bounding-box-from-nav-meshes sv-40 sv-20 sv-24) + ) + ) ) ) - ) - ) - (else - (vector-copy! sv-20 sv-36) - (vector-copy! sv-24 sv-36) + (else + (vector-copy! sv-20 sv-36) + (vector-copy! sv-24 sv-36) + ) + ) ) + (+! (-> 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) ) ) ) @@ -1037,17 +1030,6 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defmethod print-volume-sizes ((this level-group)) - (local-vars - (sv-16 (inline-array vector)) - (sv-20 float) - (sv-24 vector) - (sv-28 type) - (sv-32 vector) - (sv-36 vector) - (sv-48 int) - (sv-64 entity) - (sv-80 string) - ) (let ((s5-0 0)) (dotimes (v1-0 (-> this length)) (let ((a0-4 (-> this level v1-0))) @@ -1065,16 +1047,19 @@ (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 string)) - (when (and (or (not s4-0) (string>? sv-80 s4-0)) (or (not s2-0) (string s0-0 data sv-48 entity)) + (sv-80 (res-lump-struct sv-64 'name string)) + ) + (when (and (or (not s4-0) (string>? sv-80 s4-0)) (or (not s2-0) (string (the-as entity-actor s3-0) extra trans)) - (set! sv-28 (if (type? s3-0 entity-actor) - (-> (the-as entity-actor s3-0) etype) - (the-as type #f) - ) + (let ((sv-16 (res-lump-data s3-0 'visvol (inline-array vector))) + (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 (-> sv-16 0)) - (set! sv-36 (-> sv-16 1)) - (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? s3-0 entity-actor) + (-> (the-as entity-actor s3-0) etype) + (the-as type #f) + ) + ) + ) + ) + (let ((sv-32 (-> sv-16 0)) + (sv-36 (-> sv-16 1)) + ) + (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)) + ) + ) ) ) ) @@ -1216,7 +1207,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 process-drawable arg0) root)) @@ -1253,81 +1243,83 @@ (-> (the-as process-drawable arg0) root trans) (new 'static 'rgba :r #x80 :g #xff :b #x80 :a #x80) ) - (set! sv-16 (-> arg0 entity)) - (cond - ((and sv-16 (= (-> sv-16 extra process) 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 :y 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 577) + (let ((sv-16 (-> arg0 entity))) + (cond + ((and sv-16 (= (-> sv-16 extra process) 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 :y 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 577) + ) + (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 :y 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 :y 24) ) ) - ) - (let ((a0-23 (res-lump-struct sv-16 'art-name string))) - (if (and a0-23 (logtest? (the-as int a0-23) 1)) - (add-debug-text-3d - #t - (bucket-id debug-no-zbuf1) - (symbol->string-debug (the-as symbol a0-23)) - (-> (the-as process-drawable arg0) root trans) - (font-color white) - (new 'static 'vector2h :y 24) - ) - ) - ) - (when *display-actor-vis* - (let ((v1-56 (res-lump-data sv-16 'visvol (inline-array vector))) - (a1-14 (-> sv-16 extra vis-id)) - ) - (if v1-56 - (add-debug-box + (let ((a0-23 (res-lump-struct sv-16 'art-name string))) + (if (and a0-23 (logtest? (the-as int a0-23) 1)) + (add-debug-text-3d #t (bucket-id debug-no-zbuf1) - (-> v1-56 0) - (-> v1-56 1) - (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-debug (the-as symbol a0-23)) + (-> (the-as process-drawable arg0) root trans) + (font-color white) + (new 'static 'vector2h :y 24) ) ) ) + (when *display-actor-vis* + (let ((v1-56 (res-lump-data sv-16 'visvol (inline-array vector))) + (a1-14 (-> sv-16 extra vis-id)) + ) + (if v1-56 + (add-debug-box + #t + (bucket-id debug-no-zbuf1) + (-> v1-56 0) + (-> v1-56 1) + (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-4 add-debug-text-3d) - (s4-4 #t) - (s3-4 577) + (else + (let ((s5-4 add-debug-text-3d) + (s4-4 #t) + (s3-4 577) + ) + (format (clear *temp-string*) "pid ~d" (-> arg0 pid)) + (s5-4 + s4-4 + (the-as bucket-id s3-4) + *temp-string* + (-> (the-as process-drawable arg0) root trans) + (font-color green) + (new 'static 'vector2h :y 8) ) - (format (clear *temp-string*) "pid ~d" (-> arg0 pid)) - (s5-4 - s4-4 - (the-as bucket-id s3-4) - *temp-string* - (-> (the-as process-drawable arg0) root trans) - (font-color green) - (new 'static 'vector2h :y 8) ) ) ) @@ -1352,17 +1344,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)) @@ -1381,44 +1362,46 @@ ) (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-21 (-> this level s5-2))) - (when (= (-> v1-21 status) 'active) - (let ((s4-1 (-> v1-21 bsp level entity))) - (dotimes (s3-1 (-> s4-1 length)) - (let ((s2-0 (-> s4-1 data s3-1 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) - ) - ) - (when (< (vector-vector-distance (math-camera-pos) sv-20) 491520.0) - (let ((s1-1 add-debug-text-3d) - (s0-0 #t) - ) - (set! sv-32 577) - (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 :y 8)) + (else + (dotimes (s5-2 (-> this length)) + (let ((v1-21 (-> this level s5-2))) + (when (= (-> v1-21 status) 'active) + (let ((s4-1 (-> v1-21 bsp level entity))) + (dotimes (s3-1 (-> s4-1 length)) + (let* ((s2-0 (-> s4-1 data s3-1 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) + ) + ) + (when (< (vector-vector-distance (math-camera-pos) sv-20) 491520.0) + (let ((s1-1 add-debug-text-3d) + (s0-0 #t) + (sv-32 577) ) - (s1-1 s0-0 (the-as bucket-id sv-32) (the-as string a2-4) a3-2 (the-as font-color t0-1) t1-1) + (s1-1 + 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 :y 8) + ) ) ) ) @@ -1444,18 +1427,22 @@ (a1-16 (-> s0-1 extra vis-id)) ) (when (and v0-9 (or (= s5-3 #t) (= s5-3 'box))) - (set! sv-48 add-debug-box) - (set! sv-64 #t) - (set! sv-80 577) - (set! sv-96 (&+ v0-9 0)) - (set! sv-112 (&+ v0-9 16)) - (let ((t0-3 (if (is-object-visible? s3-2 a1-16) - (the-as uint #x80808000) - (the-as uint #x80800080) - ) - ) + (let ((sv-48 add-debug-box) + (sv-64 #t) + (sv-80 577) + (sv-96 (&+ v0-9 0)) + (sv-112 (&+ v0-9 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-2 a1-16) + (new 'static 'rgba :g #x80 :b #x80 :a #x80) + (new 'static 'rgba :r #x80 :b #x80 :a #x80) + ) + ) ) ) ) @@ -1693,14 +1680,14 @@ (s1-4 (-> s4-8 bsp region-trees s2-4)) ) (while (< s2-4 s3-6) - (let ((s0-4 (-> s1-4 data2 (+ (-> s1-4 length) -1) length))) - (set! sv-128 0) - (let ((a0-128 (the-as object (+ (+ (* sv-128 32) 32) (the-as int (-> s1-4 data2 (+ (-> s1-4 length) -1))))))) - (while (< sv-128 s0-4) - (debug-draw-region (the-as drawable-region-prim a0-128) 0) - (set! sv-128 (+ sv-128 1)) - (set! a0-128 (+ (+ (* sv-128 32) 32) (the-as int (-> s1-4 data2 (+ (-> s1-4 length) -1))))) - ) + (let* ((s0-4 (-> s1-4 data2 (+ (-> s1-4 length) -1) length)) + (sv-128 0) + (a0-128 (the-as object (+ (+ (* sv-128 32) 32) (the-as int (-> s1-4 data2 (+ (-> s1-4 length) -1)))))) + ) + (while (< sv-128 s0-4) + (debug-draw-region (the-as drawable-region-prim a0-128) 0) + (+! sv-128 1) + (set! a0-128 (+ (+ (* sv-128 32) 32) (the-as int (-> s1-4 data2 (+ (-> s1-4 length) -1))))) ) ) (+! s2-4 1) @@ -1804,7 +1791,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-75 int) (s5-0 int) (sv-16 int)) + (local-vars (v1-75 int) (s5-0 int)) (.mfc0 s5-0 Count) (let ((a2-0 (if (nonzero? (-> this actors)) (-> this actors length) @@ -1853,13 +1840,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) (the-as entity-actor (entity-by-aid (-> s0-0 data sv-16 id)))) ) - (set! sv-16 (+ sv-16 1)) + (+! sv-16 1) ) ) ) @@ -2290,15 +2278,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) @@ -2333,152 +2312,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-53 (-> s4-2 data s2-0))) - (cond - ((and (logtest? (-> v1-53 kill-mask) (task-mask special)) (not (logtest? (-> v1-53 kill-mask) sv-32))) - (when (not (or (-> v1-53 process) (logtest? (-> v1-53 perm status) (entity-perm-status bit-0 dead)))) - (birth! (-> v1-53 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-53 process) - (not (logtest? (-> v1-53 perm status) (entity-perm-status no-kill))) - (not (logtest? (-> v1-53 process mask) (process-mask no-kill))) + (dotimes (s2-0 s3-1) + (let ((v1-53 (-> s4-2 data s2-0))) + (cond + ((and (logtest? (-> v1-53 kill-mask) (task-mask special)) (not (logtest? (-> v1-53 kill-mask) sv-32))) + (when (not (or (-> v1-53 process) (logtest? (-> v1-53 perm status) (entity-perm-status bit-0 dead)))) + (birth! (-> v1-53 entity)) + (+! sv-24 1) + (if (>= sv-24 (-> *ACTOR-bank* birth-max)) + (return #f) ) - (kill! (-> v1-53 entity)) - ) - ) - ) - ) - ) - ) - ) - ((= (-> s4-1 display?) 'actor) - (let* ((s4-3 (-> s4-1 entity)) - (s3-2 (-> s4-3 length)) - ) - (dotimes (s2-1 s3-2) - (let ((v1-66 (-> s4-3 data s2-1))) - (cond - ((not (logtest? (-> v1-66 kill-mask) sv-32)) - (when (not (or (-> v1-66 process) (logtest? (-> v1-66 perm status) (entity-perm-status bit-0 dead)))) - (birth! (-> v1-66 entity)) - (set! sv-24 (+ sv-24 1)) - (if (>= sv-24 (-> *ACTOR-bank* birth-max)) - (return #f) ) - ) - ) - (else - (if (and (-> v1-66 process) - (not (logtest? (-> v1-66 perm status) (entity-perm-status no-kill))) - (not (logtest? (-> v1-66 process mask) (process-mask no-kill))) - ) - (kill! (-> v1-66 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 (and *debug-segment* (not *display-capture-mode*)) - (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-53 process) + (not (logtest? (-> v1-53 perm status) (entity-perm-status no-kill))) + (not (logtest? (-> v1-53 process mask) (process-mask no-kill))) + ) + (kill! (-> v1-53 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-66 (-> s4-3 data s2-1))) + (cond + ((not (logtest? (-> v1-66 kill-mask) sv-32)) + (when (not (or (-> v1-66 process) (logtest? (-> v1-66 perm status) (entity-perm-status bit-0 dead)))) + (birth! (-> v1-66 entity)) + (+! sv-24 1) + (if (>= sv-24 (-> *ACTOR-bank* birth-max)) + (return #f) + ) + ) ) + (else + (if (and (-> v1-66 process) + (not (logtest? (-> v1-66 perm status) (entity-perm-status no-kill))) + (not (logtest? (-> v1-66 process mask) (process-mask no-kill))) + ) + (kill! (-> v1-66 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 (and *debug-segment* (not *display-capture-mode*)) + (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) - ) ) ) ) @@ -2624,15 +2605,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))) @@ -2641,14 +2613,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)) ) ) ) @@ -2656,14 +2622,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)) ) ) ) @@ -2671,14 +2631,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)) ) ) ) @@ -2686,14 +2640,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/jak3/engine/entity/res_REF.gc b/test/decompiler/reference/jak3/engine/entity/res_REF.gc index e35b788cf5..4ad7a44e57 100644 --- a/test/decompiler/reference/jak3/engine/entity/res_REF.gc +++ b/test/decompiler/reference/jak3/engine/entity/res_REF.gc @@ -763,9 +763,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)) @@ -777,20 +776,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))) @@ -803,18 +801,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))) @@ -831,7 +829,6 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs res-lump. (defmethod mem-usage ((this res-lump) (usage memory-usage-block) (flags int)) - (local-vars (sv-16 int)) (let ((s3-0 49) (s2-0 "res") ) @@ -891,12 +888,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/jak3/engine/game/effect-control_REF.gc b/test/decompiler/reference/jak3/engine/game/effect-control_REF.gc index 608b9228c1..41c1364beb 100644 --- a/test/decompiler/reference/jak3/engine/game/effect-control_REF.gc +++ b/test/decompiler/reference/jak3/engine/game/effect-control_REF.gc @@ -279,7 +279,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 string) (arg1 float) (arg2 int)) - (local-vars (sv-288 res-lump)) (let* ((v1-2 (rtype-of arg0)) (s3-0 (cond ((= v1-2 symbol) @@ -459,17 +458,16 @@ (set! (-> v1-131 death-timer-org) (-> v1-131 death-timer)) (set! (-> v1-131 death-draw-overlap) (-> (the-as death-info s3-1) overlap)) ) - (when (-> (the-as death-info s3-1) sound) - (let* ((s2-3 this) - (s1-0 (method-of-object s2-3 play-effect-sound)) - (s0-0 (-> (the-as death-info s3-1) sound)) - ) - (set! sv-288 (-> this res)) - (let ((t1-5 (string->sound-name (-> (the-as death-info s3-1) sound)))) - (s1-0 s2-3 (the-as symbol s0-0) arg1 arg2 sv-288 t1-5) + (if (-> (the-as death-info s3-1) sound) + (play-effect-sound + this + (the-as symbol (-> (the-as death-info s3-1) sound)) + arg1 + arg2 + (-> this res) + (string->sound-name (-> (the-as death-info s3-1) sound)) ) ) - ) (send-event (-> this process) 'death-start (the-as death-info s3-1)) ) ) @@ -487,473 +485,440 @@ ;; 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 symbol) - (sv-208 - (function sparticle-system sparticle-launcher matrix sparticle-launch-state sparticle-launch-control float none) - ) - (sv-224 sparticle-system) - (sv-240 vector) - (sv-256 matrix) - ) (let ((s1-0 (the-as sound-name #f))) (-> *display* frames (-> *display* last-screen) run-time) - (set! sv-192 arg0) - (cond - ((string= (the-as string sv-192) "effect-walk-step-left") - (set! s1-0 (sound-name-with-material "walk" arg4 "1")) - ) - ((string= (the-as string sv-192) "effect-run-step-left") - (set! s1-0 (sound-name-with-material "run" arg4 "1")) - ) - ((string= (the-as string sv-192) "effect-mech-step-left") - (set! s1-0 (sound-name-with-material "mwlk" arg4 "1")) - ) - ((string= (the-as string sv-192) "effect-walk-step-right") - (set! s1-0 (sound-name-with-material "walk" arg4 "2")) - ) - ((string= (the-as string sv-192) "effect-run-step-right") - (set! s1-0 (sound-name-with-material "run" arg4 "2")) - ) - ((string= (the-as string sv-192) "effect-mech-step-right") - (set! s1-0 (sound-name-with-material "mwlk" arg4 "2")) - ) - ((string= (the-as string sv-192) "effect-roll") - (set! s1-0 (sound-name-with-material "roll" arg4 "")) - ) - ((string= (the-as string sv-192) "effect-slide") - (set! s1-0 (sound-name-with-material "slide" arg4 "")) - ) - ((string= (the-as string sv-192) "effect-land") - (set! s1-0 (sound-name-with-material "land" arg4 "")) - ) - ((string= (the-as string sv-192) "effect-zoom-land") - (set! s1-0 (sound-name-with-material "zoom-land" arg4 "")) - ) - ((string= (the-as string sv-192) "effect-zoom-hit") - (set! s1-0 (sound-name-with-material "zoom-hit" arg4 "")) - ) - ((string= (the-as string sv-192) "effect-flut-land") - (set! s1-0 (sound-name-with-material "flut-land" arg4 "")) - ) - ((string= (the-as string sv-192) "effect-land-poof") - (do-effect - this - (-> (new 'static 'boxed-array :type string - "group-land-poof-unk" - "group-land-poof-ice" - "group-land-poof-qsd" - "group-land-poof-wtr" - "group-land-poof-tar" - "group-land-poof-san" - "group-land-poof-wod" - "group-land-poof-grs" - "group-land-poof-pmt" - "group-land-poof-snw" - "group-land-poof-dsn" - "group-land-poof-unk" - "group-land-poof-lav" - "group-land-poof-cwd" - "group-land-poof-grv" - "group-land-poof-drt" - "group-land-poof-mtl" - "group-land-poof-str" - "group-land-poof-pmt" - "group-land-poof-swm" - "group-land-poof-unk" - "group-land-poof-mtl" - "group-land-poof-neu" - "group-land-poof-stn" - "group-land-poof-cmt" - "group-land-poof-car" - "group-land-poof-gmt" - "group-land-poof-smt" - "group-land-poof-hwd" - "group-land-poof-sqi" - "group-land-poof-mhm" - "group-land-poof-for" - "group-land-poof-mhs" - "group-land-poof-dma" - ) - (-> arg4 material) - ) - arg1 - -1 + (let ((sv-192 arg0)) + (cond + ((string= (the-as string sv-192) "effect-walk-step-left") + (set! s1-0 (sound-name-with-material "walk" arg4 "1")) ) - ) - ((string= (the-as string sv-192) "effect-run-poof") - (do-effect - this - (-> (new 'static 'boxed-array :type string - "group-run-poof-unk" - "group-run-poof-ice" - "group-run-poof-qsd" - "group-run-poof-wtr" - "group-run-poof-tar" - "group-run-poof-san" - "group-run-poof-wod" - "group-run-poof-grs" - "group-run-poof-pmt" - "group-run-poof-snw" - "group-run-poof-dsn" - "group-run-poof-unk" - "group-run-poof-lav" - "group-run-poof-cwd" - "group-run-poof-grv" - "group-run-poof-drt" - "group-run-poof-mtl" - "group-run-poof-str" - "group-run-poof-pmt" - "group-run-poof-swm" - "group-run-poof-unk" - "group-run-poof-mtl" - "group-run-poof-neu" - "group-run-poof-stn" - "group-run-poof-cmt" - "group-run-poof-car" - "group-run-poof-gmt" - "group-run-poof-smt" - "group-run-poof-hwd" - "group-run-poof-sqi" - "group-run-poof-mhm" - "group-run-poof-for" - "group-run-poof-mhs" - "group-run-poof-dma" - ) - (-> arg4 material) - ) - arg1 - -1 + ((string= (the-as string sv-192) "effect-run-step-left") + (set! s1-0 (sound-name-with-material "run" arg4 "1")) ) - ) - ((string= (the-as string sv-192) "effect-just-footprint") - (do-effect - this - (-> (new 'static 'boxed-array :type string - "group-just-footprint-unk" - "group-just-footprint-ice" - "group-just-footprint-qsd" - "group-just-footprint-wtr" - "group-just-footprint-tar" - "group-just-footprint-san" - "group-just-footprint-wod" - "group-just-footprint-grs" - "group-just-footprint-pmt" - "group-just-footprint-snw" - "group-just-footprint-dsn" - "group-just-footprint-unk" - "group-just-footprint-lav" - "group-just-footprint-cwd" - "group-just-footprint-grv" - "group-just-footprint-drt" - "group-just-footprint-mtl" - "group-just-footprint-str" - "group-just-footprint-pmt" - "group-just-footprint-swm" - "group-just-footprint-unk" - "group-just-footprint-mtl" - "group-just-footprint-neu" - "group-just-footprint-stn" - "group-just-footprint-cmt" - "group-just-footprint-car" - "group-just-footprint-gmt" - "group-just-footprint-smt" - "group-just-footprint-hwd" - "group-just-footprint-sqi" - "group-just-footprint-mhm" - "group-just-footprint-for" - "group-just-footprint-mhs" - "group-just-footprint-dma" - ) - (-> arg4 material) - ) - arg1 - -1 + ((string= (the-as string sv-192) "effect-mech-step-left") + (set! s1-0 (sound-name-with-material "mwlk" arg4 "1")) ) - ) - ((string= (the-as string sv-192) "effect-just-poof") - (do-effect - this - (-> (new 'static 'boxed-array :type string - "group-just-poof-unk" - "group-just-poof-ice" - "group-just-poof-qsd" - "group-just-poof-wtr" - "group-just-poof-tar" - "group-just-poof-san" - "group-just-poof-wod" - "group-just-poof-grs" - "group-just-poof-pmt" - "group-just-poof-snw" - "group-just-poof-dsn" - "group-just-poof-unk" - "group-just-poof-lav" - "group-just-poof-cwd" - "group-just-poof-grv" - "group-just-poof-drt" - "group-just-poof-mtl" - "group-just-poof-str" - "group-just-poof-pmt" - "group-just-poof-swm" - "group-just-poof-unk" - "group-just-poof-mtl" - "group-just-poof-neu" - "group-just-poof-stn" - "group-just-poof-cmt" - "group-just-poof-car" - "group-just-poof-gmt" - "group-just-poof-smt" - "group-just-poof-hwd" - "group-just-poof-sqi" - "group-just-poof-mhm" - "group-just-poof-for" - "group-just-poof-mhs" - "group-just-poof-dma" - ) - (-> arg4 material) - ) - arg1 - -1 + ((string= (the-as string sv-192) "effect-walk-step-right") + (set! s1-0 (sound-name-with-material "walk" arg4 "2")) ) - ) - ((string= (the-as string sv-192) "effect-slide-poof") - (do-effect - this - (-> (new 'static 'boxed-array :type string - "group-slide-poof-unk" - "group-slide-poof-ice" - "group-slide-poof-qsd" - "group-slide-poof-wtr" - "group-slide-poof-tar" - "group-slide-poof-san" - "group-slide-poof-wod" - "group-slide-poof-grs" - "group-slide-poof-pmt" - "group-slide-poof-snw" - "group-slide-poof-dsn" - "group-slide-poof-unk" - "group-slide-poof-lav" - "group-slide-poof-cwd" - "group-slide-poof-grv" - "group-slide-poof-drt" - "group-slide-poof-mtl" - "group-slide-poof-str" - "group-slide-poof-pmt" - "group-slide-poof-swm" - "group-slide-poof-unk" - "group-slide-poof-mtl" - "group-slide-poof-neu" - "group-slide-poof-stn" - "group-slide-poof-cmt" - "group-slide-poof-car" - "group-slide-poof-gmt" - "group-slide-poof-smt" - "group-slide-poof-hwd" - "group-slide-poof-sqi" - "group-slide-poof-mhm" - "group-slide-poof-for" - "group-slide-poof-mhs" - "group-slide-poof-dma" - ) - (-> arg4 material) - ) - arg1 - -1 + ((string= (the-as string sv-192) "effect-run-step-right") + (set! s1-0 (sound-name-with-material "run" arg4 "2")) ) - ) - ((string= (the-as string sv-192) "effect-droppings") - (let ((s0-1 (-> *part-id-table* (-> (new 'static 'boxed-array :type uint32 - #x8e - #x2a9 - #x2aa - #x2ab - #x2ac - #x75 - #x8b - #x77 - #x2ad - #x79 - #x2ae - #x8e - #x2af - #x8d - #x2b0 - #x76 - #x2b1 - #x2b2 - #x2ad - #x2b3 - #x8e - #x2b1 - #x2b4 - #x8c - #x2b5 - #x2b6 - #x2b7 - #x2b8 - #x2b9 - #x2ba - #x2bb - #x78 - #x2bc - #x2bd - ) - (-> arg4 material) - ) - ) - ) - ) - (when (nonzero? s0-1) - (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-80 (-> (vector<-cspace! (new 'stack-no-clear 'vector) (-> this process node-list data arg2)) quad))) - (set! (-> sv-96 quad) v1-80) - ) - (let ((a3-6 #f) - (t0-1 #f) - (t1-1 1.0) + ((string= (the-as string sv-192) "effect-mech-step-right") + (set! s1-0 (sound-name-with-material "mwlk" arg4 "2")) + ) + ((string= (the-as string sv-192) "effect-roll") + (set! s1-0 (sound-name-with-material "roll" arg4 "")) + ) + ((string= (the-as string sv-192) "effect-slide") + (set! s1-0 (sound-name-with-material "slide" arg4 "")) + ) + ((string= (the-as string sv-192) "effect-land") + (set! s1-0 (sound-name-with-material "land" arg4 "")) + ) + ((string= (the-as string sv-192) "effect-zoom-land") + (set! s1-0 (sound-name-with-material "zoom-land" arg4 "")) + ) + ((string= (the-as string sv-192) "effect-zoom-hit") + (set! s1-0 (sound-name-with-material "zoom-hit" arg4 "")) + ) + ((string= (the-as string sv-192) "effect-flut-land") + (set! s1-0 (sound-name-with-material "flut-land" arg4 "")) + ) + ((string= (the-as string sv-192) "effect-land-poof") + (do-effect + this + (-> (new 'static 'boxed-array :type string + "group-land-poof-unk" + "group-land-poof-ice" + "group-land-poof-qsd" + "group-land-poof-wtr" + "group-land-poof-tar" + "group-land-poof-san" + "group-land-poof-wod" + "group-land-poof-grs" + "group-land-poof-pmt" + "group-land-poof-snw" + "group-land-poof-dsn" + "group-land-poof-unk" + "group-land-poof-lav" + "group-land-poof-cwd" + "group-land-poof-grv" + "group-land-poof-drt" + "group-land-poof-mtl" + "group-land-poof-str" + "group-land-poof-pmt" + "group-land-poof-swm" + "group-land-poof-unk" + "group-land-poof-mtl" + "group-land-poof-neu" + "group-land-poof-stn" + "group-land-poof-cmt" + "group-land-poof-car" + "group-land-poof-gmt" + "group-land-poof-smt" + "group-land-poof-hwd" + "group-land-poof-sqi" + "group-land-poof-mhm" + "group-land-poof-for" + "group-land-poof-mhs" + "group-land-poof-dma" ) - (sv-64 sv-80 s0-1 sv-112 (the-as sparticle-launch-state a3-6) (the-as sparticle-launch-control t0-1) t1-1) + (-> arg4 material) + ) + arg1 + -1 + ) + ) + ((string= (the-as string sv-192) "effect-run-poof") + (do-effect + this + (-> (new 'static 'boxed-array :type string + "group-run-poof-unk" + "group-run-poof-ice" + "group-run-poof-qsd" + "group-run-poof-wtr" + "group-run-poof-tar" + "group-run-poof-san" + "group-run-poof-wod" + "group-run-poof-grs" + "group-run-poof-pmt" + "group-run-poof-snw" + "group-run-poof-dsn" + "group-run-poof-unk" + "group-run-poof-lav" + "group-run-poof-cwd" + "group-run-poof-grv" + "group-run-poof-drt" + "group-run-poof-mtl" + "group-run-poof-str" + "group-run-poof-pmt" + "group-run-poof-swm" + "group-run-poof-unk" + "group-run-poof-mtl" + "group-run-poof-neu" + "group-run-poof-stn" + "group-run-poof-cmt" + "group-run-poof-car" + "group-run-poof-gmt" + "group-run-poof-smt" + "group-run-poof-hwd" + "group-run-poof-sqi" + "group-run-poof-mhm" + "group-run-poof-for" + "group-run-poof-mhs" + "group-run-poof-dma" + ) + (-> arg4 material) + ) + arg1 + -1 + ) + ) + ((string= (the-as string sv-192) "effect-just-footprint") + (do-effect + this + (-> (new 'static 'boxed-array :type string + "group-just-footprint-unk" + "group-just-footprint-ice" + "group-just-footprint-qsd" + "group-just-footprint-wtr" + "group-just-footprint-tar" + "group-just-footprint-san" + "group-just-footprint-wod" + "group-just-footprint-grs" + "group-just-footprint-pmt" + "group-just-footprint-snw" + "group-just-footprint-dsn" + "group-just-footprint-unk" + "group-just-footprint-lav" + "group-just-footprint-cwd" + "group-just-footprint-grv" + "group-just-footprint-drt" + "group-just-footprint-mtl" + "group-just-footprint-str" + "group-just-footprint-pmt" + "group-just-footprint-swm" + "group-just-footprint-unk" + "group-just-footprint-mtl" + "group-just-footprint-neu" + "group-just-footprint-stn" + "group-just-footprint-cmt" + "group-just-footprint-car" + "group-just-footprint-gmt" + "group-just-footprint-smt" + "group-just-footprint-hwd" + "group-just-footprint-sqi" + "group-just-footprint-mhm" + "group-just-footprint-for" + "group-just-footprint-mhs" + "group-just-footprint-dma" + ) + (-> arg4 material) + ) + arg1 + -1 + ) + ) + ((string= (the-as string sv-192) "effect-just-poof") + (do-effect + this + (-> (new 'static 'boxed-array :type string + "group-just-poof-unk" + "group-just-poof-ice" + "group-just-poof-qsd" + "group-just-poof-wtr" + "group-just-poof-tar" + "group-just-poof-san" + "group-just-poof-wod" + "group-just-poof-grs" + "group-just-poof-pmt" + "group-just-poof-snw" + "group-just-poof-dsn" + "group-just-poof-unk" + "group-just-poof-lav" + "group-just-poof-cwd" + "group-just-poof-grv" + "group-just-poof-drt" + "group-just-poof-mtl" + "group-just-poof-str" + "group-just-poof-pmt" + "group-just-poof-swm" + "group-just-poof-unk" + "group-just-poof-mtl" + "group-just-poof-neu" + "group-just-poof-stn" + "group-just-poof-cmt" + "group-just-poof-car" + "group-just-poof-gmt" + "group-just-poof-smt" + "group-just-poof-hwd" + "group-just-poof-sqi" + "group-just-poof-mhm" + "group-just-poof-for" + "group-just-poof-mhs" + "group-just-poof-dma" + ) + (-> arg4 material) + ) + arg1 + -1 + ) + ) + ((string= (the-as string sv-192) "effect-slide-poof") + (do-effect + this + (-> (new 'static 'boxed-array :type string + "group-slide-poof-unk" + "group-slide-poof-ice" + "group-slide-poof-qsd" + "group-slide-poof-wtr" + "group-slide-poof-tar" + "group-slide-poof-san" + "group-slide-poof-wod" + "group-slide-poof-grs" + "group-slide-poof-pmt" + "group-slide-poof-snw" + "group-slide-poof-dsn" + "group-slide-poof-unk" + "group-slide-poof-lav" + "group-slide-poof-cwd" + "group-slide-poof-grv" + "group-slide-poof-drt" + "group-slide-poof-mtl" + "group-slide-poof-str" + "group-slide-poof-pmt" + "group-slide-poof-swm" + "group-slide-poof-unk" + "group-slide-poof-mtl" + "group-slide-poof-neu" + "group-slide-poof-stn" + "group-slide-poof-cmt" + "group-slide-poof-car" + "group-slide-poof-gmt" + "group-slide-poof-smt" + "group-slide-poof-hwd" + "group-slide-poof-sqi" + "group-slide-poof-mhm" + "group-slide-poof-for" + "group-slide-poof-mhs" + "group-slide-poof-dma" + ) + (-> arg4 material) + ) + arg1 + -1 + ) + ) + ((string= (the-as string sv-192) "effect-droppings") + (let ((s0-1 (-> *part-id-table* (-> (new 'static 'boxed-array :type uint32 + #x8e + #x2a9 + #x2aa + #x2ab + #x2ac + #x75 + #x8b + #x77 + #x2ad + #x79 + #x2ae + #x8e + #x2af + #x8d + #x2b0 + #x76 + #x2b1 + #x2b2 + #x2ad + #x2b3 + #x8e + #x2b1 + #x2b4 + #x8c + #x2b5 + #x2b6 + #x2b7 + #x2b8 + #x2b9 + #x2ba + #x2bb + #x78 + #x2bc + #x2bd + ) + (-> arg4 material) + ) + ) + ) + ) + (when (nonzero? s0-1) + (let ((sv-64 sp-launch-particles-var) + (sv-80 *sp-particle-system-2d*) + (sv-112 *launch-matrix*) + ) + (vector-copy! + (-> sv-112 trans) + (vector<-cspace! (new 'stack-no-clear 'vector) (-> this process node-list data arg2)) + ) + (sv-64 sv-80 s0-1 sv-112 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0) + ) ) ) ) - ) - ((string= (the-as string sv-192) "effect-jump-droppings") - (let ((s0-2 (-> *part-id-table* (-> (new 'static 'boxed-array :type uint32 - #x2be - #x2bf - #x2c0 - #x2c1 - #x2c2 - #x86 - #x2c3 - #x89 - #x2c4 - #x88 - #x2c5 - #x2be - #x2c6 - #x2c7 - #x2c8 - #x87 - #x2c9 - #x2ca - #x2c4 - #x2cb - #x2be - #x2c9 - #x2cc - #x2cd - #x2ce - #x2cf - #x2d0 - #x2d1 - #x2d2 - #x2d3 - #x2d4 - #x8a - #x2d5 - #x2d6 + ((string= (the-as string sv-192) "effect-jump-droppings") + (let ((s0-2 (-> *part-id-table* (-> (new 'static 'boxed-array :type uint32 + #x2be + #x2bf + #x2c0 + #x2c1 + #x2c2 + #x86 + #x2c3 + #x89 + #x2c4 + #x88 + #x2c5 + #x2be + #x2c6 + #x2c7 + #x2c8 + #x87 + #x2c9 + #x2ca + #x2c4 + #x2cb + #x2be + #x2c9 + #x2cc + #x2cd + #x2ce + #x2cf + #x2d0 + #x2d1 + #x2d2 + #x2d3 + #x2d4 + #x8a + #x2d5 + #x2d6 + ) + (-> arg4 material) ) - (-> arg4 material) - ) - ) + ) + ) + ) + (when (nonzero? s0-2) + (let ((sv-128 sp-launch-particles-var) + (sv-144 *sp-particle-system-2d*) + (sv-176 *launch-matrix*) ) - ) - (when (nonzero? s0-2) - (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-97 (-> (vector<-cspace! (new 'stack-no-clear 'vector) (-> this process node-list data arg2)) quad))) - (set! (-> sv-160 quad) v1-97) - ) - (let ((a3-7 #f) - (t0-2 #f) - (t1-2 1.0) + (vector-copy! + (-> sv-176 trans) + (vector<-cspace! (new 'stack-no-clear 'vector) (-> this process node-list data arg2)) ) - (sv-128 sv-144 s0-2 sv-176 (the-as sparticle-launch-state a3-7) (the-as sparticle-launch-control t0-2) t1-2) + (sv-128 sv-144 s0-2 sv-176 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0) + ) ) ) ) - ) - ((let ((t9-40 string=) - (a1-45 "effect-board-poof") - ) - (t9-40 (the-as string sv-192) a1-45) - ) - (let ((s0-3 (-> *part-id-table* (-> (new 'static 'boxed-array :type uint32 - #x2d7 - #x2d8 - #x2d9 - #x2da - #x2db - #x2dc - #x2dd - #x2de - #x2df - #x2e0 - #x2e1 - #x2d7 - #x2e2 - #x2e3 - #x2e4 - #x2e5 - #x2e6 - #x2e7 - #x2df - #x2e8 - #x2d7 - #x2e6 - #x2e9 - #x2a2 - #x2ea - #x2eb - #x2ec - #x2ed - #x2ee - #x2ef - #x2f0 - #x2f1 - #x2f2 - #x2f3 + ((string= (the-as string sv-192) "effect-board-poof") + (let ((s0-3 (-> *part-id-table* (-> (new 'static 'boxed-array :type uint32 + #x2d7 + #x2d8 + #x2d9 + #x2da + #x2db + #x2dc + #x2dd + #x2de + #x2df + #x2e0 + #x2e1 + #x2d7 + #x2e2 + #x2e3 + #x2e4 + #x2e5 + #x2e6 + #x2e7 + #x2df + #x2e8 + #x2d7 + #x2e6 + #x2e9 + #x2a2 + #x2ea + #x2eb + #x2ec + #x2ed + #x2ee + #x2ef + #x2f0 + #x2f1 + #x2f2 + #x2f3 + ) + (-> arg4 material) ) - (-> arg4 material) - ) - ) + ) + ) + ) + (when (nonzero? s0-3) + (let ((sv-208 sp-launch-particles-var) + (sv-224 *sp-particle-system-2d*) + (sv-256 *launch-matrix*) ) - ) - (when (nonzero? s0-3) - (set! sv-208 sp-launch-particles-var) - (set! sv-224 *sp-particle-system-2d*) - (set! sv-256 *launch-matrix*) - (set! sv-240 (-> sv-256 trans)) - (let ((v1-114 (-> (vector<-cspace! (new 'stack-no-clear 'vector) (-> this process node-list data arg2)) quad))) - (set! (-> sv-240 quad) v1-114) - ) - (let ((a3-8 #f) - (t0-3 #f) - (t1-3 1.0) + (vector-copy! + (-> sv-256 trans) + (vector<-cspace! (new 'stack-no-clear 'vector) (-> this process node-list data arg2)) ) - (sv-208 sv-224 s0-3 sv-256 (the-as sparticle-launch-state a3-8) (the-as sparticle-launch-control t0-3) t1-3) + (sv-208 sv-224 s0-3 sv-256 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0) + ) ) ) ) - ) + ) ) (if s1-0 (play-effect-sound this arg0 arg1 arg2 arg3 s1-0) @@ -966,9 +931,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) @@ -980,15 +944,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 @@ -1013,22 +979,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 ~S (~S) frame ~F joint ~D " diff --git a/test/decompiler/reference/jak3/engine/game/fact-h_REF.gc b/test/decompiler/reference/jak3/engine/game/fact-h_REF.gc index 7fbf32c757..79268e5198 100644 --- a/test/decompiler/reference/jak3/engine/game/fact-h_REF.gc +++ b/test/decompiler/reference/jak3/engine/game/fact-h_REF.gc @@ -1005,51 +1005,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 @@ -1087,7 +1089,6 @@ ;; definition for method 0 of type fact-info-enemy ;; INFO: Used lq/sq (defmethod new fact-info-enemy ((allocation symbol) (type-to-make type) (arg0 process) (arg1 (pointer float))) - (local-vars (sv-16 res-tag) (sv-32 res-tag)) (let ((gp-0 (the-as fact-info-enemy @@ -1105,8 +1106,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)) @@ -1129,8 +1131,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/jak3/engine/game/game-info_REF.gc b/test/decompiler/reference/jak3/engine/game/game-info_REF.gc index 6d4179143b..9d0d10a87d 100644 --- a/test/decompiler/reference/jak3/engine/game/game-info_REF.gc +++ b/test/decompiler/reference/jak3/engine/game/game-info_REF.gc @@ -407,13 +407,6 @@ ;; definition for method 9 of type game-info ;; INFO: Used lq/sq (defmethod initialize! ((this game-info) (mode symbol) (arg2 game-save) (continue-name string) (reset-spec resetter-spec)) - (local-vars - (sv-96 process) - (sv-112 process-tree) - (sv-128 cpu-thread) - (sv-144 (function symbol symbol continue-point game-save resetter-spec none :behavior process)) - (sv-160 symbol) - ) (when reset-spec (if (not continue-name) (set! continue-name (-> reset-spec continue)) @@ -651,57 +644,46 @@ (v1-149 (when s1-2 (let ((s0-1 (method-of-type process activate))) - (set! sv-96 s1-2) - (set! sv-112 *default-pool*) - (let ((a2-12 (symbol->string (-> process symbol))) - (a3-5 #x70004000) - (t9-30 s0-1) - ) - (t9-30 sv-96 sv-112 a2-12 (the-as pointer a3-5)) - ) + (s0-1 s1-2 *default-pool* (symbol->string (-> process symbol)) (the-as pointer #x70004000)) ) - (let ((s0-2 set-to-run)) - (set! sv-128 (-> s1-2 main-thread)) - (set! sv-144 (lambda :behavior process - ((arg0 symbol) (arg1 symbol) (arg2 continue-point) (arg3 game-save) (arg4 resetter-spec)) - (set! (-> self mask) (process-mask)) - (stop arg0) - (reset-actors arg1) - (open! (-> *game-info* sub-task-list (game-task-node city-start-start)) 'event) - (if (and arg4 (nonzero? (-> arg4 node))) - (task-node-open! (-> arg4 node) 'event) - ) - (set-continue! *game-info* arg2 #t) - (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) - ) - ) - (set! sv-160 (-> this mode)) - (let ((t0-4 (if (the-as basic continue-name) - (the-as basic continue-name) - (get-current-continue-forced this) + (let ((s0-2 set-to-run) + (sv-128 (-> s1-2 main-thread)) + (sv-144 (lambda :behavior process + ((arg0 symbol) (arg1 symbol) (arg2 continue-point) (arg3 game-save) (arg4 resetter-spec)) + (set! (-> self mask) (process-mask)) + (stop arg0) + (reset-actors arg1) + (open! (-> *game-info* sub-task-list (game-task-node city-start-start)) 'event) + (if (and arg4 (nonzero? (-> arg4 node))) + (task-node-open! (-> arg4 node) 'event) + ) + (set-continue! *game-info* arg2 #t) + (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) + ) ) - (t1-3 arg2) - (t2-0 reset-spec) - ) - ((the-as (function cpu-thread function symbol symbol continue-point game-save resetter-spec none) s0-2) - sv-128 - sv-144 - sv-160 - mode - (the-as continue-point t0-4) - t1-3 - t2-0 - ) - ) + (sv-160 (-> this mode)) + ) + ((the-as (function cpu-thread function symbol symbol continue-point game-save resetter-spec none) s0-2) + sv-128 + sv-144 + sv-160 + mode + (the-as continue-point (if (the-as basic continue-name) + (the-as basic continue-name) + (get-current-continue-forced this) + ) + ) + arg2 + reset-spec + ) ) (-> s1-2 ppointer) ) @@ -930,7 +912,6 @@ ;; definition for method 11 of type fact-info-target ;; INFO: Used lq/sq (defmethod pickup-collectable! ((this fact-info-target) (pickup pickup-type) (amount float) (pickup-handle handle)) - (local-vars (sv-112 vector) (sv-128 matrix)) (case pickup (((pickup-type health)) (cond @@ -1051,18 +1032,13 @@ (s2-3 sp-launch-particles-var) (s1-0 *sp-particle-system-2d*) (s0-0 (-> *part-id-table* 1)) + (sv-128 *launch-matrix*) ) - (set! sv-128 *launch-matrix*) - (set! sv-112 (-> sv-128 trans)) - (let ((v1-122 (-> (vector<-cspace! (new 'stack-no-clear 'vector) (-> this process node-list data v0-21)) quad))) - (set! (-> sv-112 quad) v1-122) - ) - (let ((a3-13 #f) - (t0-4 #f) - (t1-4 1.0) - ) - (s2-3 s1-0 s0-0 sv-128 (the-as sparticle-launch-state a3-13) (the-as sparticle-launch-control t0-4) t1-4) + (vector-copy! + (-> sv-128 trans) + (vector<-cspace! (new 'stack-no-clear 'vector) (-> this process node-list data v0-21)) ) + (s2-3 s1-0 s0-0 sv-128 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0) ) ) (sound-play "get-light-eco") @@ -1659,18 +1635,7 @@ ;; definition for method 17 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:~%") @@ -1681,48 +1646,50 @@ ) (while (>= (the-as uint game-task-max) (the-as uint game-task)) (when (task-complete? this (the-as game-task game-task)) - (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 ((subtask (-> game-subtasks i))) - (when (= (-> subtask task) game-task) - (when (zero? sv-24) - (set! sv-24 (the-as int (-> subtask close-time))) - (set! sv-16 (the-as int (-> subtask close-time))) - ) - (when (logtest? (-> subtask flags) (game-task-node-flag closed)) - (set! sv-32 (the-as int (-> subtask close-time))) - (set! sv-40 (the-as int (-> subtask gem-count))) - (set! sv-48 (the-as int (-> subtask skill-count))) - ) - (set! sv-56 (+ sv-56 (-> subtask death-count))) - (if (logtest? (-> subtask 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 ((subtask (-> game-subtasks i))) + (when (= (-> subtask task) game-task) + (when (zero? sv-24) + (set! sv-24 (the-as int (-> subtask close-time))) + (set! sv-16 (the-as int (-> subtask close-time))) ) + (when (logtest? (-> subtask flags) (game-task-node-flag closed)) + (set! sv-32 (the-as int (-> subtask close-time))) + (set! sv-40 (the-as int (-> subtask gem-count))) + (set! sv-48 (the-as int (-> subtask skill-count))) + ) + (+! sv-56 (-> subtask death-count)) + (if (logtest? (-> subtask flags) (game-task-node-flag close-task)) + (goto cfg-19) + ) + ) ) ) ) ) - ) - (label cfg-19) - (if (nonzero? (-> this task-start-time game-task)) - (set! sv-24 (max sv-24 (-> this task-start-time game-task))) + (label cfg-19) + (if (nonzero? (-> this task-start-time game-task)) + (set! sv-24 (max sv-24 (-> this task-start-time game-task))) + ) + (format + #t + "~T~T~-32S ~6,,1f min ~6,,1f min ~3d ~3d ~3d~%" + (game-task->string (the-as game-task game-task)) + (* 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 game-task)) - (* 0.000055555556 (the float (- sv-24 sv-16))) - (* 0.000055555556 (the float (- sv-32 sv-24))) - sv-56 - sv-40 - sv-48 ) ) (+! game-task 1) @@ -1733,30 +1700,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") - ) - ((game-task-node-info-method-12 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 + ) + ((game-task-node-info-method-12 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/jak3/engine/game/game-save_REF.gc b/test/decompiler/reference/jak3/engine/game/game-save_REF.gc index ad7059f72b..8cccf1e40f 100644 --- a/test/decompiler/reference/jak3/engine/game/game-save_REF.gc +++ b/test/decompiler/reference/jak3/engine/game/game-save_REF.gc @@ -420,7 +420,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)) @@ -446,19 +445,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-4 (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-4 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))) @@ -470,31 +465,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-5 (-> (the-as (inline-array game-save-tag) s4-0) 1 user-uint16 s2-1)) - ) - (s1-1 s0-1 sv-32 a2-15 a3-5) - ) + (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-6 - (-> (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-6) - ) + (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/jak3/engine/game/task/task-arrow_REF.gc b/test/decompiler/reference/jak3/engine/game/task/task-arrow_REF.gc index b5681367fb..a1e6d97342 100644 --- a/test/decompiler/reference/jak3/engine/game/task/task-arrow_REF.gc +++ b/test/decompiler/reference/jak3/engine/game/task/task-arrow_REF.gc @@ -179,18 +179,16 @@ (when (< (-> this rod-of-god-scale) 0.0) (set! (-> this rod-of-god-scale) 0.0) (set! (-> this moving) #f) - (let ((f0-26 81920.0)) - (cond - ((< (* f0-26 f0-26) (vector-vector-xz-distance-squared (-> this pos) (-> this root trans))) - (kill-callback (-> *minimap* engine) (-> this minimap)) - (vector-copy! (-> this root trans) (-> this pos)) - (if (not (logtest? (-> this flags) (task-arrow-flags taf5))) - (set! (-> this minimap) (add-icon! *minimap* this (-> this map-icon) (the-as int #f) (the-as vector #t) 0)) - ) - ) - (else - (vector-copy! (-> this root trans) (-> this pos)) - ) + (cond + ((< (square 81920.0) (vector-vector-xz-distance-squared (-> this pos) (-> this root trans))) + (kill-callback (-> *minimap* engine) (-> this minimap)) + (vector-copy! (-> this root trans) (-> this pos)) + (if (not (logtest? (-> this flags) (task-arrow-flags taf5))) + (set! (-> this minimap) (add-icon! *minimap* this (-> this map-icon) (the-as int #f) (the-as vector #t) 0)) + ) + ) + (else + (vector-copy! (-> this root trans) (-> this pos)) ) ) ) @@ -270,12 +268,10 @@ (if (logtest? (-> self flags) (task-arrow-flags taf3)) (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/jak3/engine/game/task/task-control_REF.gc b/test/decompiler/reference/jak3/engine/game/task/task-control_REF.gc index 35eff190b8..a2e2fdd4ee 100644 --- a/test/decompiler/reference/jak3/engine/game/task/task-control_REF.gc +++ b/test/decompiler/reference/jak3/engine/game/task/task-control_REF.gc @@ -99,7 +99,7 @@ ;; definition for function update-task-masks (defun update-task-masks ((arg0 symbol)) - (local-vars (a3-2 symbol) (sv-176 game-task-event)) + (local-vars (a3-2 symbol)) (if (= arg0 'none) (return 0) ) @@ -275,38 +275,39 @@ (let ((s0-0 (-> s1-0 when-open length))) (while (begin (label cfg-75) (nonzero? s0-0)) (+! s0-0 -1) - (set! sv-176 (-> s1-0 when-open s0-0)) - (case (-> sv-176 actor) - (((game-task-actor minimap)) - (if (not (minimap-class-node-method-9 (-> *minimap-class-list* (-> sv-176 icon)))) - (goto cfg-75) - ) - (let ((v1-89 (add-icon! *minimap* *dproc* (-> sv-176 icon) (the-as int (-> sv-176 icon)) (the-as vector #f) s2-0))) - (when v1-89 - (logior! (-> v1-89 flags) (minimap-flag task-graph)) - (cond - ((and (logtest? (minimap-flag ctywide) (-> v1-89 class flags)) - (logtest? (minimap-flag transport) (-> v1-89 class flags)) - ) - (let ((v1-91 (add-icon! *minimap* *dproc* (the-as uint 21) 21 (the-as vector #f) s2-0))) - (if v1-91 - (logior! (-> v1-91 flags) (minimap-flag task-graph)) - ) + (let ((sv-176 (-> s1-0 when-open s0-0))) + (case (-> sv-176 actor) + (((game-task-actor minimap)) + (if (not (minimap-class-node-method-9 (-> *minimap-class-list* (-> sv-176 icon)))) + (goto cfg-75) + ) + (let ((v1-89 (add-icon! *minimap* *dproc* (-> sv-176 icon) (the-as int (-> sv-176 icon)) (the-as vector #f) s2-0))) + (when v1-89 + (logior! (-> v1-89 flags) (minimap-flag task-graph)) + (cond + ((and (logtest? (minimap-flag ctywide) (-> v1-89 class flags)) + (logtest? (minimap-flag transport) (-> v1-89 class flags)) + ) + (let ((v1-91 (add-icon! *minimap* *dproc* (the-as uint 21) 21 (the-as vector #f) s2-0))) + (if v1-91 + (logior! (-> v1-91 flags) (minimap-flag task-graph)) + ) + ) ) - ) - ((and (logtest? (minimap-flag wasall waswide desert) (-> v1-89 class flags)) - (logtest? (minimap-flag transport) (-> v1-89 class flags)) - ) - (let ((v1-96 (add-icon! *minimap* *dproc* (the-as uint 18) 18 (the-as vector #f) s2-0))) - (if v1-96 - (logior! (-> v1-96 flags) (minimap-flag task-graph)) - ) + ((and (logtest? (minimap-flag wasall waswide desert) (-> v1-89 class flags)) + (logtest? (minimap-flag transport) (-> v1-89 class flags)) + ) + (let ((v1-96 (add-icon! *minimap* *dproc* (the-as uint 18) 18 (the-as vector #f) s2-0))) + (if v1-96 + (logior! (-> v1-96 flags) (minimap-flag task-graph)) + ) + ) ) - ) + ) ) ) ) - ) + ) ) ) ) diff --git a/test/decompiler/reference/jak3/engine/geometry/geometry_REF.gc b/test/decompiler/reference/jak3/engine/geometry/geometry_REF.gc index e6c80628fb..a5ecb417c4 100644 --- a/test/decompiler/reference/jak3/engine/geometry/geometry_REF.gc +++ b/test/decompiler/reference/jak3/engine/geometry/geometry_REF.gc @@ -285,11 +285,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))) ) ) @@ -306,7 +302,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)) ) ) ) @@ -559,9 +555,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) ) @@ -576,21 +570,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) ) - ) ) ) @@ -644,21 +627,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) ) - ) ) ) @@ -674,13 +646,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) ) ) ) @@ -799,7 +766,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) (vector-copy! arg0 arg1) @@ -813,15 +779,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) ) ) ) @@ -1287,9 +1249,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/jak3/engine/geometry/path-h_REF.gc b/test/decompiler/reference/jak3/engine/geometry/path-h_REF.gc index ebb6c57a2f..defc7ca60c 100644 --- a/test/decompiler/reference/jak3/engine/geometry/path-h_REF.gc +++ b/test/decompiler/reference/jak3/engine/geometry/path-h_REF.gc @@ -101,9 +101,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) @@ -117,14 +117,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/jak3/engine/geometry/path_REF.gc b/test/decompiler/reference/jak3/engine/geometry/path_REF.gc index d88ee73617..6e03d36a4f 100644 --- a/test/decompiler/reference/jak3/engine/geometry/path_REF.gc +++ b/test/decompiler/reference/jak3/engine/geometry/path_REF.gc @@ -357,89 +357,78 @@ ;; definition for method 28 of type path-control ;; INFO: Used lq/sq (defmethod path-control-method-28 ((this path-control) (arg0 vector) (arg1 vector) (arg2 symbol)) - (local-vars - (sv-96 vector) - (sv-100 vector) - (sv-104 vector) - (sv-108 vector) - (sv-112 number) - (sv-116 vector) - (sv-120 symbol) - (sv-124 float) - ) - (set! sv-96 (new 'stack-no-clear 'vector)) - (set! sv-100 (new 'stack-no-clear 'vector)) - (set! sv-104 (new 'stack-no-clear 'vector)) - (set! sv-108 (new 'stack-no-clear 'vector)) - (set! sv-112 -1.0) - (set! sv-116 (new 'stack-no-clear 'vector)) - (set! sv-120 (the-as symbol #f)) - (set! sv-124 (the-as float -1.0)) - (get-point-in-path! this sv-96 0.0 'interp) - (set! sv-112 (gpr->fpr #x7f800000)) - (when (not arg2) - (set! sv-124 (path-control-method-22 this arg0)) - (get-point-in-path! this sv-108 sv-124 'interp) - (set! sv-112 (vector-vector-distance-squared sv-108 arg0)) - ) - (let ((s3-1 (new 'stack-no-clear 'vector))) - (vector+! s3-1 arg0 arg1) - (dotimes (s2-0 (+ (-> this curve num-cverts) -1)) - (get-point-in-path! this sv-100 (the float (+ s2-0 1)) 'interp) - (vector-! sv-104 sv-100 sv-96) - (let ((s0-0 #f)) - 0.0 - (let ((s1-0 (new 'stack-no-clear 'vector))) - (set! (-> s1-0 x) -1.0) - (set! (-> s1-0 y) -1.0) - (line-line-find-intersection-xz arg0 arg1 sv-96 sv-104 s1-0) - (when (>= (-> s1-0 x) 0.0) - (if (and (< 0.0 (-> s1-0 y)) (>= 1.0 (-> s1-0 y))) - (set! s0-0 #t) - ) - (vector+float*! sv-116 arg0 arg1 (-> s1-0 x)) - (cond - ((and s0-0 (not sv-120)) - (vector-copy! sv-108 sv-116) - (set! sv-112 (vector-vector-distance-squared sv-116 arg0)) - (set! sv-124 (lerp (the float s2-0) (the float (+ s2-0 1)) (-> s1-0 y))) - (set! sv-120 #t) - ) - ((and s0-0 sv-120) - (let ((f0-22 (vector-vector-distance-squared sv-116 arg0))) - (when (< f0-22 (the-as float sv-112)) - (vector-copy! sv-108 sv-116) - (set! sv-112 f0-22) - (set! sv-124 (lerp (the float s2-0) (the float (+ s2-0 1)) (-> s1-0 y))) - ) + (let ((sv-96 (new 'stack-no-clear 'vector)) + (sv-100 (new 'stack-no-clear 'vector)) + (sv-104 (new 'stack-no-clear 'vector)) + (sv-108 (new 'stack-no-clear 'vector)) + (sv-112 -1.0) + (sv-116 (new 'stack-no-clear 'vector)) + (sv-120 (the-as symbol #f)) + (sv-124 (the-as float -1.0)) + ) + (get-point-in-path! this sv-96 0.0 'interp) + (set! sv-112 (gpr->fpr #x7f800000)) + (when (not arg2) + (set! sv-124 (path-control-method-22 this arg0)) + (get-point-in-path! this sv-108 sv-124 'interp) + (set! sv-112 (vector-vector-distance-squared sv-108 arg0)) + ) + (let ((s3-1 (new 'stack-no-clear 'vector))) + (vector+! s3-1 arg0 arg1) + (dotimes (s2-0 (+ (-> this curve num-cverts) -1)) + (get-point-in-path! this sv-100 (the float (+ s2-0 1)) 'interp) + (vector-! sv-104 sv-100 sv-96) + (let ((s0-0 #f)) + 0.0 + (let ((s1-0 (new 'stack-no-clear 'vector))) + (set! (-> s1-0 x) -1.0) + (set! (-> s1-0 y) -1.0) + (line-line-find-intersection-xz arg0 arg1 sv-96 sv-104 s1-0) + (when (>= (-> s1-0 x) 0.0) + (if (and (< 0.0 (-> s1-0 y)) (>= 1.0 (-> s1-0 y))) + (set! s0-0 #t) + ) + (vector+float*! sv-116 arg0 arg1 (-> s1-0 x)) + (cond + ((and s0-0 (not sv-120)) + (vector-copy! sv-108 sv-116) + (set! sv-112 (vector-vector-distance-squared sv-116 arg0)) + (set! sv-124 (lerp (the float s2-0) (the float (+ s2-0 1)) (-> s1-0 y))) + (set! sv-120 #t) ) - ) - ((not (or s0-0 sv-120)) - (let ((s0-1 (new 'stack-no-clear 'vector)) - (a3-5 (new 'stack-no-clear 'vector)) - ) - (set! (-> s1-0 y) (fmax 0.0 (fmin 1.0 (-> s1-0 y)))) - (vector+float*! s0-1 sv-96 sv-104 (-> s1-0 y)) - (let* ((f0-32 (vector-segment-distance-point! s0-1 arg0 s3-1 a3-5)) - (f0-33 (* f0-32 f0-32)) - ) - (when (< f0-33 (the-as float sv-112)) - (vector-copy! sv-108 s0-1) - (set! sv-112 f0-33) + ((and s0-0 sv-120) + (let ((f0-22 (vector-vector-distance-squared sv-116 arg0))) + (when (< f0-22 (the-as float sv-112)) + (vector-copy! sv-108 sv-116) + (set! sv-112 f0-22) (set! sv-124 (lerp (the float s2-0) (the float (+ s2-0 1)) (-> s1-0 y))) ) ) ) - ) + ((not (or s0-0 sv-120)) + (let ((s0-1 (new 'stack-no-clear 'vector)) + (a3-5 (new 'stack-no-clear 'vector)) + ) + (set! (-> s1-0 y) (fmax 0.0 (fmin 1.0 (-> s1-0 y)))) + (vector+float*! s0-1 sv-96 sv-104 (-> s1-0 y)) + (let ((f0-33 (square (vector-segment-distance-point! s0-1 arg0 s3-1 a3-5)))) + (when (< f0-33 (the-as float sv-112)) + (vector-copy! sv-108 s0-1) + (set! sv-112 f0-33) + (set! sv-124 (lerp (the float s2-0) (the float (+ s2-0 1)) (-> s1-0 y))) + ) + ) + ) + ) + ) ) ) ) + (vector-copy! sv-96 sv-100) ) - (vector-copy! sv-96 sv-100) ) + (/ sv-124 (the float (+ (-> this curve num-cverts) -1))) ) - (set! sv-124 (/ sv-124 (the float (+ (-> this curve num-cverts) -1)))) - sv-124 ) ;; definition for method 29 of type path-control diff --git a/test/decompiler/reference/jak3/engine/geometry/vol_REF.gc b/test/decompiler/reference/jak3/engine/geometry/vol_REF.gc index bcbbac108f..57c93e56f2 100644 --- a/test/decompiler/reference/jak3/engine/geometry/vol_REF.gc +++ b/test/decompiler/reference/jak3/engine/geometry/vol_REF.gc @@ -16,140 +16,143 @@ ;; definition for method 9 of type plane-volume ;; INFO: Used lq/sq (defmethod plane-volume-method-9 ((this plane-volume) (arg0 symbol) (arg1 vector-array) (arg2 vector-array)) - (local-vars - (sv-144 vector) - (sv-148 float) - (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 (the-as float 0.0)) - (set! sv-152 0) - (set! sv-160 (new-stack-vector0)) - (vector-copy! sv-144 sv-224) - (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) - (vector-copy! sv-160 (-> s2-0 sv-256)) - (set! sv-148 (the-as float 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 sv-148)) - (set! sv-148 f0-6) - (set! sv-152 (+ sv-152 1)) - ) - ) - (else - (vector+float*! sv-144 sv-144 sv-192 f0-6) - (vector-copy! sv-160 (-> s2-0 sv-256)) - (set! sv-152 (+ sv-152 1)) - (if (< (fabs f0-6) (fabs sv-148)) - (set! sv-148 (- sv-148 f0-6)) - (set! sv-148 (the-as float 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 (the-as float 0.0)) + (sv-152 0) + ) + (let ((sv-160 (new-stack-vector0))) + (vector-copy! sv-144 sv-224) + (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) + (vector-copy! sv-160 (-> s2-0 sv-256)) + (set! sv-148 (the-as float 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 sv-148)) + (set! sv-148 f0-6) + (+! sv-152 1) + ) + ) + (else + (vector+float*! sv-144 sv-144 sv-192 f0-6) + (vector-copy! sv-160 (-> s2-0 sv-256)) + (+! sv-152 1) + (set! sv-148 (cond + ((< (fabs f0-6) (fabs sv-148)) + (set! sv-148 (- sv-148 f0-6)) + sv-148 + ) + (else + (the-as float 0.0) + ) + ) + ) + ) + ) + ) + ) + (+! sv-256 1) + ) + ) ) + (cond + ((zero? sv-152) + ) + ((= sv-148 0.0) + ) + (else + (dotimes (v1-75 (-> this num-planes)) + (when (and (!= v1-75 s3-0) (!= v1-75 sv-240)) + (if (< 4096.0 (- (vector-dot sv-144 (the-as vector (-> s2-0 v1-75))) (-> s2-0 v1-75 w))) + (goto cfg-42) + ) + ) + ) + (vector+float*! sv-224 sv-144 sv-192 sv-148) + (cond + ((< (-> arg1 allocated-length) (+ (-> arg1 length) 2)) + (format 0 "ERROR : vol-control #x~X out of volume points~%" this) + ) + (else + (vector-copy! (-> arg1 data (-> arg1 length)) sv-144) + (vector-copy! (-> arg1 data (+ (-> arg1 length) 1)) sv-224) + (+! (-> 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) - ) - ((= sv-148 0.0) - ) - (else - (dotimes (v1-75 (-> this num-planes)) - (when (and (!= v1-75 s3-0) (!= v1-75 sv-240)) - (if (< 4096.0 (- (vector-dot sv-144 (the-as vector (-> s2-0 v1-75))) (-> s2-0 v1-75 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 + (vector-copy! (-> arg2 data (-> arg2 length)) s1-0) + (vector-copy! (-> arg2 data (+ (-> arg2 length) 1)) (-> s2-0 s3-0)) + (+! (-> arg2 length) 2) + (set! (-> this normal-count) (+ (-> this normal-count) 2)) ) - (vector+float*! sv-224 sv-144 sv-192 sv-148) - (cond - ((< (-> arg1 allocated-length) (+ (-> arg1 length) 2)) - (format 0 "ERROR : vol-control #x~X out of volume points~%" this) - ) - (else - (vector-copy! (-> arg1 data (-> arg1 length)) sv-144) - (vector-copy! (-> arg1 data (+ (-> arg1 length) 1)) sv-224) - (+! (-> 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 - (vector-copy! (-> arg2 data (-> arg2 length)) s1-0) - (vector-copy! (-> arg2 data (+ (-> arg2 length) 1)) (-> s2-0 s3-0)) - (+! (-> arg2 length) 2) - (set! (-> this normal-count) (+ (-> this normal-count) 2)) - ) - ) ) ) ) diff --git a/test/decompiler/reference/jak3/engine/gfx/background/hfrag/hfrag_REF.gc b/test/decompiler/reference/jak3/engine/gfx/background/hfrag/hfrag_REF.gc index 4172ba73c7..a3a0df621e 100644 --- a/test/decompiler/reference/jak3/engine/gfx/background/hfrag/hfrag_REF.gc +++ b/test/decompiler/reference/jak3/engine/gfx/background/hfrag/hfrag_REF.gc @@ -707,60 +707,52 @@ ;; definition for method 19 of type hfragment ;; WARN: Return type mismatch int vs none. (defmethod add-tri-to-collide-cache ((this hfragment) (arg0 collide-cache) (arg1 collide-query) (arg2 int) (arg3 int) (arg4 int) (arg5 int)) - (local-vars - (sv-16 uint) - (sv-24 uint) - (sv-32 uint) - (sv-40 uint) - (sv-48 int) - (sv-56 int) - (sv-64 int) - (sv-72 int) - ) (let ((v1-0 (-> this verts)) (a0-2 (+ (* arg3 512) arg2)) (s2-0 (-> this pat-array 0)) ) (when (not (logtest? (-> arg1 ignore-pat) s2-0)) (when (nonzero? (-> (the-as hfrag-vertex (-> v1-0 a0-2)) packed-index bit11)) - (set! sv-16 (-> v1-0 a0-2 height)) - (set! sv-24 (-> v1-0 (+ a0-2 1) height)) - (set! sv-32 (-> v1-0 (+ a0-2 512) height)) - (set! sv-40 (-> v1-0 (+ a0-2 513) height)) - (set! sv-48 0) - (set! sv-56 0) - (set! sv-64 0) - (set! sv-72 0) - (if (< (the-as int sv-16) arg4) - (set! sv-48 1) - ) - (if (< arg5 (the-as int sv-16)) - (set! sv-48 (logior sv-48 2)) - ) - (if (< (the-as int sv-24) arg4) - (set! sv-56 1) - ) - (if (< arg5 (the-as int sv-24)) - (set! sv-56 (logior sv-56 2)) - ) - (if (< (the-as int sv-32) arg4) - (set! sv-64 1) - ) - (if (< arg5 (the-as int sv-32)) - (set! sv-64 (logior sv-64 2)) - ) - (if (< (the-as int sv-40) arg4) - (set! sv-72 1) - ) - (if (< arg5 (the-as int sv-40)) - (set! sv-72 (logior sv-72 2)) - ) - (if (not (logtest? (logand sv-48 sv-56) sv-64)) - (add-tri-a-xy-zzz-to-collide-cache this arg0 arg2 arg3 sv-16 sv-24 sv-32 s2-0) - ) - (if (not (logtest? (logand sv-56 sv-64) sv-72)) - (add-tri-b-xy-zzz-to-collide-cache this arg0 arg2 arg3 sv-24 sv-32 sv-40 s2-0) - ) + (let ((sv-16 (-> v1-0 a0-2 height)) + (sv-24 (-> v1-0 (+ a0-2 1) height)) + (sv-32 (-> v1-0 (+ a0-2 512) height)) + (sv-40 (-> v1-0 (+ a0-2 513) height)) + (sv-48 0) + (sv-56 0) + (sv-64 0) + (sv-72 0) + ) + (if (< (the-as int sv-16) arg4) + (set! sv-48 1) + ) + (if (< arg5 (the-as int sv-16)) + (logior! sv-48 2) + ) + (if (< (the-as int sv-24) arg4) + (set! sv-56 1) + ) + (if (< arg5 (the-as int sv-24)) + (logior! sv-56 2) + ) + (if (< (the-as int sv-32) arg4) + (set! sv-64 1) + ) + (if (< arg5 (the-as int sv-32)) + (logior! sv-64 2) + ) + (if (< (the-as int sv-40) arg4) + (set! sv-72 1) + ) + (if (< arg5 (the-as int sv-40)) + (logior! sv-72 2) + ) + (if (not (logtest? (logand sv-48 sv-56) sv-64)) + (add-tri-a-xy-zzz-to-collide-cache this arg0 arg2 arg3 sv-16 sv-24 sv-32 s2-0) + ) + (if (not (logtest? (logand sv-56 sv-64) sv-72)) + (add-tri-b-xy-zzz-to-collide-cache this arg0 arg2 arg3 sv-24 sv-32 sv-40 s2-0) + ) + ) ) ) ) @@ -771,30 +763,31 @@ ;; definition for method 17 of type hfragment ;; WARN: Return type mismatch int vs none. (defmethod bounding-box-query ((this hfragment) (arg0 collide-cache) (arg1 collide-query)) - (local-vars (sv-16 int) (sv-24 int) (sv-32 int) (sv-40 int) (sv-48 int) (sv-56 int)) - (set! sv-16 (the int (* 0.000030517578 (- (-> arg1 bbox min x) (-> this start-corner x))))) - (set! sv-24 (the int (* 0.000030517578 (- (-> arg1 bbox min z) (-> this start-corner z))))) - (set! sv-32 (the int (* 0.000030517578 (- (-> arg1 bbox max x) (-> this start-corner x))))) - (set! sv-40 (the int (* 0.000030517578 (- (-> arg1 bbox max z) (-> this start-corner z))))) - (set! sv-48 (the int (/ (-> arg1 bbox min y) 8))) - (set! sv-56 (the int (/ (-> arg1 bbox max y) 8))) - (set! sv-16 (max 0 (min 511 sv-16))) - (set! sv-32 (max 0 (min 511 sv-32))) - (set! sv-24 (max 0 (min 511 sv-24))) - (set! sv-40 (max 0 (min 511 sv-40))) - (let ((s3-0 sv-24) - (s2-0 sv-40) + (let ((sv-16 (the int (* 0.000030517578 (- (-> arg1 bbox min x) (-> this start-corner x))))) + (sv-24 (the int (* 0.000030517578 (- (-> arg1 bbox min z) (-> this start-corner z))))) + (sv-32 (the int (* 0.000030517578 (- (-> arg1 bbox max x) (-> this start-corner x))))) + (sv-40 (the int (* 0.000030517578 (- (-> arg1 bbox max z) (-> this start-corner z))))) + (sv-48 (the int (/ (-> arg1 bbox min y) 8))) + (sv-56 (the int (/ (-> arg1 bbox max y) 8))) ) - (while (>= s2-0 s3-0) - (let ((s1-0 sv-16) - (s0-0 sv-32) - ) - (while (>= s0-0 s1-0) - (add-tri-to-collide-cache this arg0 arg1 s1-0 s3-0 sv-48 sv-56) - (+! s1-0 1) + (set! sv-16 (max 0 (min 511 sv-16))) + (set! sv-32 (max 0 (min 511 sv-32))) + (set! sv-24 (max 0 (min 511 sv-24))) + (set! sv-40 (max 0 (min 511 sv-40))) + (let ((s3-0 sv-24) + (s2-0 sv-40) ) + (while (>= s2-0 s3-0) + (let ((s1-0 sv-16) + (s0-0 sv-32) + ) + (while (>= s0-0 s1-0) + (add-tri-to-collide-cache this arg0 arg1 s1-0 s3-0 sv-48 sv-56) + (+! s1-0 1) + ) + ) + (+! s3-0 1) ) - (+! s3-0 1) ) ) 0 @@ -816,69 +809,58 @@ (a0-36 int) (s3-0 int) (s3-2 int) - (sv-64 vector) - (sv-68 vector) - (sv-72 vector) - (sv-76 float) - (sv-80 float) - (sv-128 int) - (sv-144 int) - (sv-160 int) - (sv-176 int) - (sv-192 int) - (sv-208 int) ) - (set! sv-64 (new 'stack-no-clear 'vector)) - (set! sv-68 (new 'stack-no-clear 'vector)) - (set! sv-72 (new 'stack-no-clear 'vector)) - (set! sv-76 (the-as float 0.000030517578)) - (set! sv-80 (/ (-> arg1 radius) (meters 8))) - (vector-! sv-64 (-> arg1 start-pos) (-> this start-corner)) - (vector-float*! sv-64 sv-64 sv-76) - (vector-float*! sv-72 (-> arg1 move-dist) sv-76) - (vector+! sv-68 sv-64 sv-72) - (cond - ((< (fabs (-> sv-72 z)) (fabs (-> sv-72 x))) - (when (< (-> sv-72 x) 0.0) - (let ((v1-15 (new 'stack-no-clear 'vector))) - (vector-copy! v1-15 sv-64) - (vector-copy! sv-64 sv-68) - (vector-copy! sv-68 v1-15) - ) - (vector-negate! sv-72 sv-72) - ) - (let* ((a0-9 (the int (- (-> sv-64 x) sv-80))) - (v1-20 (the int (+ (-> sv-68 x) sv-80))) - (f0-15 (fmax 1.0 (the float (- v1-20 a0-9)))) - (f30-0 (/ (-> sv-72 y) f0-15)) - (f28-0 (/ (-> sv-72 z) f0-15)) - (f26-0 (+ sv-80 (* 0.5 (fabs f30-0)))) - (f24-0 (+ sv-80 (* 0.5 (fabs f28-0)))) - ) - (cond - ((< a0-9 0) - (+! (-> sv-64 y) (* f30-0 (- (the float a0-9)))) - (+! (-> sv-64 z) (* f28-0 (- (the float a0-9)))) - (set! s3-0 0) - ) - (else - (set! s3-0 (min 511 a0-9)) + (let ((sv-64 (new 'stack-no-clear 'vector)) + (sv-68 (new 'stack-no-clear 'vector)) + (sv-72 (new 'stack-no-clear 'vector)) + (sv-76 (the-as float 0.000030517578)) + (sv-80 (/ (-> arg1 radius) (meters 8))) + ) + (vector-! sv-64 (-> arg1 start-pos) (-> this start-corner)) + (vector-float*! sv-64 sv-64 sv-76) + (vector-float*! sv-72 (-> arg1 move-dist) sv-76) + (vector+! sv-68 sv-64 sv-72) + (cond + ((< (fabs (-> sv-72 z)) (fabs (-> sv-72 x))) + (when (< (-> sv-72 x) 0.0) + (let ((v1-15 (new 'stack-no-clear 'vector))) + (vector-copy! v1-15 sv-64) + (vector-copy! sv-64 sv-68) + (vector-copy! sv-68 v1-15) ) + (vector-negate! sv-72 sv-72) ) - (let ((s2-1 (max 0 (min 511 v1-20))) - (s1-0 s3-0) + (let* ((a0-9 (the int (- (-> sv-64 x) sv-80))) + (v1-20 (the int (+ (-> sv-68 x) sv-80))) + (f0-15 (fmax 1.0 (the float (- v1-20 a0-9)))) + (f30-0 (/ (-> sv-72 y) f0-15)) + (f28-0 (/ (-> sv-72 z) f0-15)) + (f26-0 (+ sv-80 (* 0.5 (fabs f30-0)))) + (f24-0 (+ sv-80 (* 0.5 (fabs f28-0)))) + ) + (cond + ((< a0-9 0) + (+! (-> sv-64 y) (* f30-0 (- (the float a0-9)))) + (+! (-> sv-64 z) (* f28-0 (- (the float a0-9)))) + (set! s3-0 0) + ) + (else + (set! s3-0 (min 511 a0-9)) ) - (while (>= s2-1 s1-0) - (let* ((f0-23 (the float (- s1-0 s3-0))) - (f1-23 (+ (-> sv-64 y) (* f30-0 f0-23))) - (f0-25 (+ (-> sv-64 z) (* f28-0 f0-23))) - (s0-0 (the int (* 4096.0 (+ (- -0.5 f26-0) f1-23)))) - ) - (set! sv-128 (the int (* 4096.0 (+ 0.5 f26-0 f1-23)))) - (let ((a0-15 (the int (- f0-25 f24-0))) - (v1-29 (the int (+ f0-25 f24-0))) - ) - (set! sv-144 0) + ) + (let ((s2-1 (max 0 (min 511 v1-20))) + (s1-0 s3-0) + ) + (while (>= s2-1 s1-0) + (let* ((f0-23 (the float (- s1-0 s3-0))) + (f1-23 (+ (-> sv-64 y) (* f30-0 f0-23))) + (f0-25 (+ (-> sv-64 z) (* f28-0 f0-23))) + (s0-0 (the int (* 4096.0 (+ (- -0.5 f26-0) f1-23)))) + (sv-128 (the int (* 4096.0 (+ 0.5 f26-0 f1-23)))) + (a0-15 (the int (- f0-25 f24-0))) + (v1-29 (the int (+ f0-25 f24-0))) + (sv-144 0) + ) (let ((a2-1 sv-144) (a1-21 (min 511 a0-15)) ) @@ -886,66 +868,65 @@ (move-if-not-zero a0-17 a1-21 a0-16 a0-16) ) (set! sv-144 a0-17) - (set! sv-160 0) - (let ((a1-22 sv-160) - (a0-20 (min 511 v1-29)) - ) - (set-on-less-than v1-30 a1-22 a0-20) - (move-if-not-zero v1-31 a0-20 v1-30 v1-30) + (let ((sv-160 0)) + (let ((a1-22 sv-160) + (a0-20 (min 511 v1-29)) + ) + (set-on-less-than v1-30 a1-22 a0-20) + (move-if-not-zero v1-31 a0-20 v1-30 v1-30) + ) + (set! sv-160 v1-31) + (while (>= sv-160 sv-144) + (add-tri-to-collide-cache this arg0 arg1 s1-0 sv-144 s0-0 sv-128) + (+! sv-144 1) + ) ) ) - (set! sv-160 v1-31) - (while (>= sv-160 sv-144) - (add-tri-to-collide-cache this arg0 arg1 s1-0 sv-144 s0-0 sv-128) - (set! sv-144 (+ sv-144 1)) - ) + (+! s1-0 1) ) - (+! s1-0 1) ) ) ) - ) - (else - (when (< (-> sv-72 z) 0.0) - (let ((v1-42 (new 'stack-no-clear 'vector))) - (vector-copy! v1-42 sv-64) - (vector-copy! sv-64 sv-68) - (vector-copy! sv-68 v1-42) - ) - (vector-negate! sv-72 sv-72) - ) - (let* ((a0-27 (the int (- (-> sv-64 z) sv-80))) - (v1-47 (the int (+ (-> sv-68 z) sv-80))) - (f0-36 (fmax 1.0 (the float (- v1-47 a0-27)))) - (f30-1 (/ (-> sv-72 y) f0-36)) - (f28-1 (/ (-> sv-72 x) f0-36)) - (f26-1 (+ sv-80 (* 0.5 (fabs f30-1)))) - (f24-1 (+ sv-80 (* 0.5 (fabs f28-1)))) - ) - (cond - ((< a0-27 0) - (+! (-> sv-64 y) (* f30-1 (the float (- a0-27)))) - (+! (-> sv-64 x) (* f28-1 (the float (- a0-27)))) - (set! s3-2 0) - ) - (else - (set! s3-2 (min 511 a0-27)) + (else + (when (< (-> sv-72 z) 0.0) + (let ((v1-42 (new 'stack-no-clear 'vector))) + (vector-copy! v1-42 sv-64) + (vector-copy! sv-64 sv-68) + (vector-copy! sv-68 v1-42) ) + (vector-negate! sv-72 sv-72) ) - (let ((s2-3 (max 0 (min 511 v1-47))) - (s1-1 s3-2) + (let* ((a0-27 (the int (- (-> sv-64 z) sv-80))) + (v1-47 (the int (+ (-> sv-68 z) sv-80))) + (f0-36 (fmax 1.0 (the float (- v1-47 a0-27)))) + (f30-1 (/ (-> sv-72 y) f0-36)) + (f28-1 (/ (-> sv-72 x) f0-36)) + (f26-1 (+ sv-80 (* 0.5 (fabs f30-1)))) + (f24-1 (+ sv-80 (* 0.5 (fabs f28-1)))) + ) + (cond + ((< a0-27 0) + (+! (-> sv-64 y) (* f30-1 (the float (- a0-27)))) + (+! (-> sv-64 x) (* f28-1 (the float (- a0-27)))) + (set! s3-2 0) + ) + (else + (set! s3-2 (min 511 a0-27)) ) - (while (>= s2-3 s1-1) - (let* ((f0-44 (the float (- s1-1 s3-2))) - (f1-47 (+ (-> sv-64 y) (* f30-1 f0-44))) - (f0-46 (+ (-> sv-64 x) (* f28-1 f0-44))) - (s0-1 (the int (* 4096.0 (+ (- -0.5 f26-1) f1-47)))) - ) - (set! sv-176 (the int (* 4096.0 (+ 0.5 f26-1 f1-47)))) - (let ((a0-34 (the int (- f0-46 f24-1))) - (v1-56 (the int (+ f0-46 f24-1))) - ) - (set! sv-192 0) + ) + (let ((s2-3 (max 0 (min 511 v1-47))) + (s1-1 s3-2) + ) + (while (>= s2-3 s1-1) + (let* ((f0-44 (the float (- s1-1 s3-2))) + (f1-47 (+ (-> sv-64 y) (* f30-1 f0-44))) + (f0-46 (+ (-> sv-64 x) (* f28-1 f0-44))) + (s0-1 (the int (* 4096.0 (+ (- -0.5 f26-1) f1-47)))) + (sv-176 (the int (* 4096.0 (+ 0.5 f26-1 f1-47)))) + (a0-34 (the int (- f0-46 f24-1))) + (v1-56 (the int (+ f0-46 f24-1))) + (sv-192 0) + ) (let ((a2-3 sv-192) (a1-41 (min 511 a0-34)) ) @@ -953,21 +934,22 @@ (move-if-not-zero a0-36 a1-41 a0-35 a0-35) ) (set! sv-192 a0-36) - (set! sv-208 0) - (let ((a1-42 sv-208) - (a0-39 (min 511 v1-56)) - ) - (set-on-less-than v1-57 a1-42 a0-39) - (move-if-not-zero v1-58 a0-39 v1-57 v1-57) + (let ((sv-208 0)) + (let ((a1-42 sv-208) + (a0-39 (min 511 v1-56)) + ) + (set-on-less-than v1-57 a1-42 a0-39) + (move-if-not-zero v1-58 a0-39 v1-57 v1-57) + ) + (set! sv-208 v1-58) + (while (>= sv-208 sv-192) + (add-tri-to-collide-cache this arg0 arg1 sv-192 s1-1 s0-1 sv-176) + (+! sv-192 1) + ) ) ) - (set! sv-208 v1-58) - (while (>= sv-208 sv-192) - (add-tri-to-collide-cache this arg0 arg1 sv-192 s1-1 s0-1 sv-176) - (set! sv-192 (+ sv-192 1)) - ) + (+! s1-1 1) ) - (+! s1-1 1) ) ) ) diff --git a/test/decompiler/reference/jak3/engine/gfx/background/tfrag/tfrag-methods_REF.gc b/test/decompiler/reference/jak3/engine/gfx/background/tfrag/tfrag-methods_REF.gc index 212eb39696..a0d9b7e01a 100644 --- a/test/decompiler/reference/jak3/engine/gfx/background/tfrag/tfrag-methods_REF.gc +++ b/test/decompiler/reference/jak3/engine/gfx/background/tfrag/tfrag-methods_REF.gc @@ -31,7 +31,6 @@ ;; WARN: Return type mismatch drawable-tree-tfrag vs none. (defun draw-drawable-tree-tfrag ((arg0 drawable-tree-tfrag)) "Top-level function to generate DMA for 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) @@ -55,76 +54,75 @@ (let* ((v1-14 (-> arg0 arrays s5-0)) (s4-1 (&+ v1-14 32)) (s3-0 (-> v1-14 length)) + (sv-16 (+ (/ (-> s4-1 id) 8) #x3800 #x70000000)) + (s5-1 (-> *display* frames (-> *display* on-screen) global-buf base)) ) - (set! sv-16 (+ (/ (-> s4-1 id) 8) #x3800 #x70000000)) - (let ((s5-1 (-> *display* frames (-> *display* on-screen) global-buf base))) - (with-dma-buffer-add-bucket ((s1-0 (-> *display* frames (-> *display* on-screen) global-buf)) - (-> (new 'static 'array bucket-id 10 - (bucket-id tfrag-l0-tfrag) - (bucket-id tfrag-l1-tfrag) - (bucket-id tfrag-l2-tfrag) - (bucket-id tfrag-l3-tfrag) - (bucket-id tfrag-l4-tfrag) - (bucket-id tfrag-l5-tfrag) - (bucket-id tfrag-l6-tfrag) - (bucket-id tfrag-l7-tfrag) - (bucket-id tfrag-l8-tfrag) - (bucket-id tfrag-l9-tfrag) - ) - *draw-index* + (with-dma-buffer-add-bucket ((s1-0 (-> *display* frames (-> *display* on-screen) global-buf)) + (-> (new 'static 'array bucket-id 10 + (bucket-id tfrag-l0-tfrag) + (bucket-id tfrag-l1-tfrag) + (bucket-id tfrag-l2-tfrag) + (bucket-id tfrag-l3-tfrag) + (bucket-id tfrag-l4-tfrag) + (bucket-id tfrag-l5-tfrag) + (bucket-id tfrag-l6-tfrag) + (bucket-id tfrag-l7-tfrag) + (bucket-id tfrag-l8-tfrag) + (bucket-id tfrag-l9-tfrag) ) - ) - (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) (-> *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) - ) + *draw-index* + ) + ) + (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) (-> *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) ) - (with-dma-buffer-add-bucket ((s1-1 (-> *display* frames (-> *display* on-screen) global-buf)) - (-> (new 'static 'array bucket-id 10 - (bucket-id tfrag-scissor-l0-tfrag) - (bucket-id tfrag-scissor-l1-tfrag) - (bucket-id tfrag-scissor-l2-tfrag) - (bucket-id tfrag-scissor-l3-tfrag) - (bucket-id tfrag-scissor-l4-tfrag) - (bucket-id tfrag-scissor-l5-tfrag) - (bucket-id tfrag-scissor-l6-tfrag) - (bucket-id tfrag-scissor-l7-tfrag) - (bucket-id tfrag-scissor-l8-tfrag) - (bucket-id tfrag-scissor-l9-tfrag) - ) - *draw-index* + ) + (with-dma-buffer-add-bucket ((s1-1 (-> *display* frames (-> *display* on-screen) global-buf)) + (-> (new 'static 'array bucket-id 10 + (bucket-id tfrag-scissor-l0-tfrag) + (bucket-id tfrag-scissor-l1-tfrag) + (bucket-id tfrag-scissor-l2-tfrag) + (bucket-id tfrag-scissor-l3-tfrag) + (bucket-id tfrag-scissor-l4-tfrag) + (bucket-id tfrag-scissor-l5-tfrag) + (bucket-id tfrag-scissor-l6-tfrag) + (bucket-id tfrag-scissor-l7-tfrag) + (bucket-id tfrag-scissor-l8-tfrag) + (bucket-id tfrag-scissor-l9-tfrag) ) - ) - (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) (-> *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) - ) + *draw-index* + ) + ) + (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) (-> *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 ((a0-33 *dma-mem-usage*)) - (when (nonzero? a0-33) - (set! (-> a0-33 length) (max 2 (-> a0-33 length))) - (set! (-> a0-33 data 1 name) "tfragment") - (+! (-> a0-33 data 1 count) 1) - (+! (-> a0-33 data 1 used) - (&- (-> *display* frames (-> *display* on-screen) global-buf base) (the-as uint s5-1)) - ) - (set! (-> a0-33 data 1 total) (-> a0-33 data 1 used)) - ) + ) + (let ((a0-33 *dma-mem-usage*)) + (when (nonzero? a0-33) + (set! (-> a0-33 length) (max 2 (-> a0-33 length))) + (set! (-> a0-33 data 1 name) "tfragment") + (+! (-> a0-33 data 1 count) 1) + (+! (-> a0-33 data 1 used) + (&- (-> *display* frames (-> *display* on-screen) global-buf base) (the-as uint s5-1)) + ) + (set! (-> a0-33 data 1 total) (-> a0-33 data 1 used)) ) ) ) @@ -137,7 +135,6 @@ ;; WARN: Return type mismatch drawable-tree-tfrag vs none. (defun draw-drawable-tree-tfrag-trans ((arg0 drawable-tree-tfrag)) "Top-level function to generate DMA for 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) @@ -161,8 +158,8 @@ (let* ((v1-13 (-> arg0 arrays s5-0)) (s5-1 (&+ v1-13 32)) (s4-1 (-> v1-13 length)) + (sv-16 (+ (/ (-> s5-1 id) 8) #x3800 #x70000000)) ) - (set! sv-16 (+ (/ (-> s5-1 id) 8) #x3800 #x70000000)) (with-dma-buffer-add-bucket ((s2-0 (-> *display* frames (-> *display* on-screen) global-buf)) (-> (new 'static 'array bucket-id 12 (bucket-id tfrag-l0-alpha) @@ -234,7 +231,6 @@ ;; WARN: Return type mismatch drawable-tree-tfrag vs none. (defun draw-drawable-tree-tfrag-water ((arg0 drawable-tree-tfrag)) "Top-level function to generate DMA for 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) @@ -258,8 +254,8 @@ (let* ((v1-13 (-> arg0 arrays s5-0)) (s5-1 (&+ v1-13 32)) (s4-1 (-> v1-13 length)) + (sv-16 (+ (/ (-> s5-1 id) 8) #x3800 #x70000000)) ) - (set! sv-16 (+ (/ (-> s5-1 id) 8) #x3800 #x70000000)) (with-dma-buffer-add-bucket ((s2-0 (-> *display* frames (-> *display* on-screen) global-buf)) (-> (new 'static 'array bucket-id 12 (bucket-id tfrag-l0-water) @@ -892,7 +888,3 @@ 0 (none) ) - - - - diff --git a/test/decompiler/reference/jak3/engine/gfx/background/tie/tie-methods_REF.gc b/test/decompiler/reference/jak3/engine/gfx/background/tie/tie-methods_REF.gc index e6fe5138ca..23df40122a 100644 --- a/test/decompiler/reference/jak3/engine/gfx/background/tie/tie-methods_REF.gc +++ b/test/decompiler/reference/jak3/engine/gfx/background/tie/tie-methods_REF.gc @@ -806,7 +806,7 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defun draw-drawable-tree-instance-tie ((arg0 drawable-tree-instance-tie) (arg1 level)) - (local-vars (v0-9 object) (a0-42 int) (a0-44 int) (a0-55 int) (a0-57 int) (sv-16 int)) + (local-vars (v0-9 object) (a0-42 int) (a0-44 int) (a0-55 int) (a0-57 int)) (when (logtest? (vu1-renderer-mask tie-scissor tie @@ -871,8 +871,8 @@ ) (let* ((s1-2 (&+ s2-0 32)) (s0-1 (+ (/ (-> s1-2 id) 8) #x3800 #x70000000)) + (sv-16 (-> (the-as drawable-inline-array-instance-tie s2-0) length)) ) - (set! sv-16 (-> (the-as drawable-inline-array-instance-tie s2-0) length)) (when (nonzero? sv-16) (let* ((v1-41 (logand (the-as int *gsf-buffer*) 8191)) (v1-43 (the-as @@ -908,11 +908,7 @@ (.sync.p) (label cfg-23) 0 - (let ((t9-3 draw-inline-array-instance-tie) - (a3-1 s5-1) - ) - (t9-3 (the-as pointer s0-1) (the-as (inline-array instance-tie) s1-2) sv-16 a3-1) - ) + (draw-inline-array-instance-tie (the-as pointer s0-1) (the-as (inline-array instance-tie) s1-2) sv-16 s5-1) (let ((v1-64 (-> *perf-stats* data 46))) (b! (zero? (-> v1-64 ctrl)) cfg-25 :delay (nop!)) (.mtc0 Perf 0) diff --git a/test/decompiler/reference/jak3/engine/gfx/background/tie/tie_REF.gc b/test/decompiler/reference/jak3/engine/gfx/background/tie/tie_REF.gc index edb6c7f4a9..c6a9e9b3ba 100644 --- a/test/decompiler/reference/jak3/engine/gfx/background/tie/tie_REF.gc +++ b/test/decompiler/reference/jak3/engine/gfx/background/tie/tie_REF.gc @@ -664,22 +664,18 @@ ;; WARN: Return type mismatch symbol vs none. (defun-debug tie-ints () "Dump TIE integer regs for debug." - (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) ) ) ) @@ -691,7 +687,6 @@ ;; WARN: Return type mismatch symbol vs none. (defun-debug tie-floats () "Dump TIE float regs for debug." - (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) @@ -706,17 +701,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/jak3/engine/gfx/blit-displays_REF.gc b/test/decompiler/reference/jak3/engine/gfx/blit-displays_REF.gc index 734c2b02be..0761225314 100644 --- a/test/decompiler/reference/jak3/engine/gfx/blit-displays_REF.gc +++ b/test/decompiler/reference/jak3/engine/gfx/blit-displays_REF.gc @@ -887,14 +887,14 @@ (arg5 level) (arg6 int) ) - (local-vars (sv-16 blit-displays-work) (sv-32 int)) - (set! sv-16 *blit-displays-work*) - (with-dma-buffer-add-bucket ((s1-0 (-> *display* frames (-> *display* on-screen) global-buf)) - arg1 - ) + (let* ((sv-16 *blit-displays-work*) + (s1-0 (-> *display* frames (-> *display* on-screen) global-buf)) + (s5-0 (-> s1-0 base)) + ) (upload-vram-data s1-0 0 (the-as pointer arg2) (the int (-> arg3 y)) (the int (-> arg3 x))) - (set! sv-32 (+ (log2 (+ (the int (-> arg3 x)) -1)) 1)) - (let ((v1-9 (+ (log2 (+ (the int (-> arg3 y)) -1)) 1))) + (let ((sv-32 (+ (log2 (+ (the int (-> arg3 x)) -1)) 1)) + (v1-9 (+ (log2 (+ (the int (-> arg3 y)) -1)) 1)) + ) (dma-buffer-add-gs-set s1-0 (test-1 (new 'static 'gs-test :ate #x1 :afail #x3 :zte #x1 :ztst (gs-ztest always))) (alpha-1 (new 'static 'gs-alpha)) @@ -935,6 +935,22 @@ ) (&+! (-> s1-0 base) 112) (set-dirty-mask! arg5 arg6 (* (* (the int (-> arg3 y)) (the int (-> arg3 x))) 4) 0) + (let ((a3-10 (-> s1-0 base))) + (when (!= s5-0 a3-10) + (let ((v1-26 (the-as object (-> s1-0 base)))) + (set! (-> (the-as dma-packet v1-26) dma) (new 'static 'dma-tag :id (dma-tag-id next))) + (set! (-> (the-as dma-packet v1-26) vif0) (new 'static 'vif-tag)) + (set! (-> (the-as dma-packet v1-26) vif1) (new 'static 'vif-tag)) + (set! (-> s1-0 base) (&+ (the-as pointer v1-26) 16)) + ) + (dma-bucket-insert-tag + (-> *display* frames (-> *display* on-screen) bucket-group) + arg1 + s5-0 + (the-as (pointer dma-tag) a3-10) + ) + ) + ) ) (none) ) diff --git a/test/decompiler/reference/jak3/engine/gfx/foreground/eye_REF.gc b/test/decompiler/reference/jak3/engine/gfx/foreground/eye_REF.gc index d2e8087b64..684bfd4d00 100644 --- a/test/decompiler/reference/jak3/engine/gfx/foreground/eye_REF.gc +++ b/test/decompiler/reference/jak3/engine/gfx/foreground/eye_REF.gc @@ -94,7 +94,6 @@ ;; definition for function render-eyes-32 ;; INFO: Used lq/sq (defun render-eyes-32 ((arg0 dma-buffer) (arg1 eye-control) (arg2 int)) - (local-vars (sv-16 float)) (let ((v1-0 *display*) (a0-1 1776) ) @@ -114,8 +113,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-16 (the-as object (-> arg0 base)))) (set! (-> (the-as dma-gif-packet v1-16) dma-vif quad) (-> *eye-work* adgif-tmpl dma-vif quad)) @@ -384,7 +383,6 @@ ;; definition for function render-eyes-64 ;; INFO: Used lq/sq (defun render-eyes-64 ((arg0 dma-buffer) (arg1 eye-control) (arg2 int)) - (local-vars (sv-16 float)) (let ((v1-0 *display*) (a0-1 1776) ) @@ -404,8 +402,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-16 (the-as object (-> arg0 base)))) (set! (-> (the-as dma-gif-packet v1-16) dma-vif quad) (-> *eye-work* adgif-tmpl dma-vif quad)) @@ -1124,7 +1122,3 @@ 0 (none) ) - - - - diff --git a/test/decompiler/reference/jak3/engine/gfx/foreground/merc/merc-blend-shape_REF.gc b/test/decompiler/reference/jak3/engine/gfx/foreground/merc/merc-blend-shape_REF.gc index ea9ebf4ee2..239e55b5c8 100644 --- a/test/decompiler/reference/jak3/engine/gfx/foreground/merc/merc-blend-shape_REF.gc +++ b/test/decompiler/reference/jak3/engine/gfx/foreground/merc/merc-blend-shape_REF.gc @@ -291,71 +291,61 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defun setup-blerc-chains ((arg0 merc-ctrl) (arg1 (pointer int16)) (arg2 dma-buffer)) - (local-vars - (sv-16 uint) - (sv-20 pointer) - (sv-24 merc-effect) - (sv-28 uint) - (sv-32 object) - (sv-48 int) - (sv-64 int) - ) - (set! sv-16 (-> arg0 header effect-count)) - (let ((s3-0 (-> arg0 header blend-target-count)) - (v1-1 (-> arg2 base)) + (let* ((sv-16 (-> arg0 header effect-count)) + (s3-0 (-> arg0 header blend-target-count)) + (v1-1 (-> arg2 base)) + (sv-20 (&+ v1-1 0)) + (a2-1 (the-as object (&+ v1-1 16))) + ) + (if (zero? (-> *blerc-globals* first)) + (set! (-> *blerc-globals* first) (the-as uint a2-1)) ) - (set! sv-20 (&+ v1-1 0)) - (let ((a2-1 (the-as object (&+ v1-1 16)))) - (if (zero? (-> *blerc-globals* first)) - (set! (-> *blerc-globals* first) (the-as uint a2-1)) - ) - (dotimes (s2-0 (the-as int sv-16)) - (set! sv-24 (-> arg0 effect s2-0)) - (set! sv-28 (-> sv-24 blend-frag-count)) + (dotimes (s2-0 (the-as int sv-16)) + (let* ((sv-24 (-> arg0 effect s2-0)) + (sv-28 (-> sv-24 blend-frag-count)) + ) (when (nonzero? sv-28) (let ((v1-15 (the-as object (-> sv-24 frag-geo))) (s1-0 (the-as structure (-> sv-24 frag-ctrl))) (s0-0 (the-as object (-> sv-24 blend-data))) + (sv-32 (-> sv-24 blend-ctrl)) + (sv-48 0) ) - (set! sv-32 (-> sv-24 blend-ctrl)) - (set! sv-48 0) (while (< sv-48 (the-as int sv-28)) - (set! sv-64 (+ (the-as int v1-15) - (logand (* (+ (-> (the-as merc-fragment-control s1-0) unsigned-four-count) 3) 4) #xfff0) - ) + (let ((sv-64 (+ (the-as int v1-15) + (logand (* (+ (-> (the-as merc-fragment-control s1-0) unsigned-four-count) 3) 4) #xfff0) + ) + ) ) - (if (nonzero? (-> (the-as (pointer uint8) sv-32) 0)) - (set! a2-1 (setup-blerc-chains-for-one-fragment s3-0 arg1 a2-1 s0-0 sv-32 sv-64)) + (if (nonzero? (-> (the-as (pointer uint8) sv-32) 0)) + (set! a2-1 (setup-blerc-chains-for-one-fragment s3-0 arg1 a2-1 s0-0 sv-32 sv-64)) + ) + (let ((a0-14 (logand (+ (* (the-as uint 6) (-> (the-as merc-blend-ctrl sv-32) blend-vtx-count)) 15) #xfff0))) + (set! v1-15 + (+ sv-64 + (logand (* (+ (-> (the-as merc-fragment-control s1-0) lump-four-count) 3) 4) #xfff0) + (* (-> (the-as merc-fragment-control s1-0) fp-qwc) 16) + ) + ) + (set! s1-0 (+ (the-as uint s1-0) (* (-> (the-as merc-fragment-control s1-0) mat-xfer-count) 2) 4)) + (set! s0-0 + (+ (the-as int s0-0) (* (the-as uint a0-14) (+ (-> (the-as merc-blend-ctrl sv-32) nonzero-index-count) 1))) + ) ) - (let ((a0-14 (logand (+ (* (the-as uint 6) (-> (the-as merc-blend-ctrl sv-32) blend-vtx-count)) 15) #xfff0))) - (set! v1-15 - (+ sv-64 - (logand (* (+ (-> (the-as merc-fragment-control s1-0) lump-four-count) 3) 4) #xfff0) - (* (-> (the-as merc-fragment-control s1-0) fp-qwc) 16) - ) - ) - (set! s1-0 (+ (the-as uint s1-0) (* (-> (the-as merc-fragment-control s1-0) mat-xfer-count) 2) 4)) - (set! s0-0 - (+ (the-as int s0-0) (* (the-as uint a0-14) (+ (-> (the-as merc-blend-ctrl sv-32) nonzero-index-count) 1))) - ) ) (set! sv-32 (+ (the-as int sv-32) s3-0 2)) - (the-as int sv-32) - (set! sv-48 (+ sv-48 1)) + (the-as int (the-as int sv-32)) + (+! sv-48 1) ) ) ) ) - (set! (-> (the-as (pointer int64) sv-20)) (logior #x20000000 (shr (shl (the-as int a2-1) 33) 1))) - (set! (-> (the-as (pointer uint32) sv-20) 2) (the-as uint 0)) - (set! (-> (the-as (pointer uint32) sv-20) 3) (the-as uint 0)) - (set! (-> arg2 base) (the-as pointer a2-1)) ) + (set! (-> (the-as (pointer int64) sv-20)) (logior #x20000000 (shr (shl (the-as int a2-1) 33) 1))) + (set! (-> (the-as (pointer uint32) sv-20) 2) (the-as uint 0)) + (set! (-> (the-as (pointer uint32) sv-20) 3) (the-as uint 0)) + (set! (-> arg2 base) (the-as pointer a2-1)) ) 0 (none) ) - - - - diff --git a/test/decompiler/reference/jak3/engine/gfx/foreground/merc/merc_REF.gc b/test/decompiler/reference/jak3/engine/gfx/foreground/merc/merc_REF.gc index e567c296c4..a3e5fb6c99 100644 --- a/test/decompiler/reference/jak3/engine/gfx/foreground/merc/merc_REF.gc +++ b/test/decompiler/reference/jak3/engine/gfx/foreground/merc/merc_REF.gc @@ -71,7 +71,7 @@ ;; definition for method 9 of type merc-fragment ;; INFO: Used lq/sq (defmethod login-adgifs ((this merc-fragment)) - (local-vars (v0-5 symbol) (sv-16 uint) (sv-32 int)) + (local-vars (v0-5 symbol) (sv-32 int)) (let* ((s5-0 (merc-fragment-fp-data this)) (v1-1 (-> *texture-login-data* merc-ctrl-header)) (s4-0 (if (nonzero? (-> v1-1 eye-ctrl)) @@ -90,12 +90,19 @@ (set! v0-5 (cond ((and s4-0 (!= v1-2 -1) (or (= a0-4 s3-0) (= a0-4 s2-0))) - (let ((v1-5 (-> *eye-control-array* data v1-2))) - (set! sv-16 (-> v1-5 eye-slot)) - (if (= a0-4 s2-0) - (set! sv-32 1) - (set! sv-32 0) - ) + (let* ((v1-5 (-> *eye-control-array* data v1-2)) + (sv-16 (-> v1-5 eye-slot)) + ) + (set! sv-32 (cond + ((= a0-4 s2-0) + (set! sv-32 1) + sv-32 + ) + (else + 0 + ) + ) + ) (let ((a0-10 (-> v1-5 eyes sv-32))) (set! (-> a0-10 shader (-> a0-10 shader-count)) s1-0) (+! (-> a0-10 shader-count) 1) diff --git a/test/decompiler/reference/jak3/engine/gfx/foreground/ripple_REF.gc b/test/decompiler/reference/jak3/engine/gfx/foreground/ripple_REF.gc index 267323bdbf..1a1337376c 100644 --- a/test/decompiler/reference/jak3/engine/gfx/foreground/ripple_REF.gc +++ b/test/decompiler/reference/jak3/engine/gfx/foreground/ripple_REF.gc @@ -174,9 +174,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) ) @@ -210,20 +210,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/jak3/engine/gfx/generic/lightning/lightning-new_REF.gc b/test/decompiler/reference/jak3/engine/gfx/generic/lightning/lightning-new_REF.gc index a9e0cfcca4..57c1ee19b2 100644 --- a/test/decompiler/reference/jak3/engine/gfx/generic/lightning/lightning-new_REF.gc +++ b/test/decompiler/reference/jak3/engine/gfx/generic/lightning/lightning-new_REF.gc @@ -106,35 +106,37 @@ ;; definition for method 21 of type lightning-bolt ;; WARN: Return type mismatch int vs none. (defmethod lightning-bolt-method-21 ((this lightning-bolt) (arg0 int) (arg1 int) (arg2 float)) - (local-vars (sv-16 int) (sv-24 vector) (sv-28 vector) (sv-32 float)) (let ((v1-0 (-> this desired-points))) (when (< 1 (- arg1 arg0)) - (set! sv-16 (/ (+ arg0 arg1) 2)) - (set! sv-24 (-> v1-0 data arg0)) - (set! sv-28 (-> v1-0 data arg1)) - (set! sv-32 (the-as float 1.0)) - (set! sv-32 (-> sv-28 z)) - (let ((s2-0 (-> v1-0 data sv-16))) - (let* ((f30-0 (* 0.5 (+ (-> sv-24 x) (-> sv-28 x)))) - (f28-0 arg2) - (f26-0 -0.5) - (v1-6 (/ (the-as int (rand-uint31-gen *random-generator*)) 256)) - (v1-7 (the-as number (logior #x3f800000 v1-6))) - ) - (set! (-> s2-0 x) (+ f30-0 (* f28-0 (+ f26-0 (+ -1.0 (the-as float v1-7)))))) + (let ((sv-16 (/ (+ arg0 arg1) 2))) + (let ((sv-24 (-> v1-0 data arg0)) + (sv-28 (-> v1-0 data arg1)) + (sv-32 (the-as float 1.0)) + ) + (set! sv-32 (-> sv-28 z)) + (let ((s2-0 (-> v1-0 data sv-16))) + (let* ((f30-0 (* 0.5 (+ (-> sv-24 x) (-> sv-28 x)))) + (f28-0 arg2) + (f26-0 -0.5) + (v1-6 (/ (the-as int (rand-uint31-gen *random-generator*)) 256)) + (v1-7 (the-as number (logior #x3f800000 v1-6))) + ) + (set! (-> s2-0 x) (+ f30-0 (* f28-0 (+ f26-0 (+ -1.0 (the-as float v1-7)))))) + ) + (let* ((f30-1 (* 0.5 (+ (-> sv-24 y) (-> sv-28 y)))) + (f28-1 arg2) + (f26-1 -0.5) + (v1-14 (/ (the-as int (rand-uint31-gen *random-generator*)) 256)) + (v1-15 (the-as number (logior #x3f800000 v1-14))) + ) + (set! (-> s2-0 y) (+ f30-1 (* f28-1 (+ f26-1 (+ -1.0 (the-as float v1-15)))))) + ) + (set! (-> s2-0 z) (lerp (-> sv-24 z) sv-32 0.5)) + ) ) - (let* ((f30-1 (* 0.5 (+ (-> sv-24 y) (-> sv-28 y)))) - (f28-1 arg2) - (f26-1 -0.5) - (v1-14 (/ (the-as int (rand-uint31-gen *random-generator*)) 256)) - (v1-15 (the-as number (logior #x3f800000 v1-14))) - ) - (set! (-> s2-0 y) (+ f30-1 (* f28-1 (+ f26-1 (+ -1.0 (the-as float v1-15)))))) - ) - (set! (-> s2-0 z) (lerp (-> sv-24 z) sv-32 0.5)) + (lightning-bolt-method-21 this arg0 sv-16 (* arg2 (-> this fractal-reduction))) + (lightning-bolt-method-21 this sv-16 arg1 (* arg2 (-> this fractal-reduction))) ) - (lightning-bolt-method-21 this arg0 sv-16 (* arg2 (-> this fractal-reduction))) - (lightning-bolt-method-21 this sv-16 arg1 (* arg2 (-> this fractal-reduction))) ) ) 0 @@ -226,15 +228,6 @@ ;; WARN: Return type mismatch int vs none. ;; WARN: Function (method 11 lightning-bolt) has a return type of none, but the expression builder found a return statement. (defmethod lightning-bolt-method-11 ((this lightning-bolt)) - (local-vars - (sv-16 time-frame) - (sv-24 float) - (sv-32 time-frame) - (sv-40 float) - (sv-64 vector) - (sv-68 float) - (sv-72 float) - ) (with-pp (case (-> this fade-mode) ((2) @@ -362,36 +355,40 @@ ) ) (else - (set! sv-16 (- (current-time) (- (current-time) (-> pp clock old-frame-counter)))) - (set! sv-24 (the-as float 0.0)) - (set! sv-32 (current-time)) - (set! sv-40 (the-as float 0.0)) - (set! sv-24 - (/ (the float (- sv-16 (-> this last-generate-time))) (the float (-> this inner-point-travel-time))) + (let ((sv-16 (- (current-time) (- (current-time) (-> pp clock old-frame-counter)))) + (sv-24 (the-as float 0.0)) + (sv-32 (current-time)) + (sv-40 (the-as float 0.0)) ) - (set! sv-40 - (/ (the float (- sv-32 (-> this last-generate-time))) (the float (-> this inner-point-travel-time))) - ) - (set! sv-24 (fmax 0.0 (fmin 1.0 sv-24))) - (set! sv-40 (fmax 0.0 (fmin 1.0 sv-40))) - (let ((f30-1 (- 1.0 sv-24))) - (dotimes (s2-1 s3-2) - (set! sv-64 (new 'stack-no-clear 'vector)) - (set! sv-68 (the-as float 0.0)) - (set! sv-72 (the-as float 0.0)) - (set-vector! - sv-64 - (- (-> this desired-points data (+ s2-1 s5-2) x) (-> this current-points data (+ s2-1 s5-2) x)) - (- (-> this desired-points data (+ s2-1 s5-2) y) (-> this current-points data (+ s2-1 s5-2) y)) - 0.0 - 1.0 - ) - (set! sv-68 (vector-normalize-ret-len! sv-64 1.0)) - (when (< 0.0 f30-1) - (set! sv-72 (/ sv-68 f30-1)) - (vector-float*! sv-64 sv-64 (* sv-72 (- sv-40 sv-24))) - (vector+! (-> this current-points data (+ s2-1 s5-2)) (-> this current-points data (+ s2-1 s5-2)) sv-64) - (set! (-> this current-points data (+ s2-1 s5-2) z) (-> this desired-points data (+ s2-1 s5-2) z)) + (set! sv-24 + (/ (the float (- sv-16 (-> this last-generate-time))) (the float (-> this inner-point-travel-time))) + ) + (set! sv-40 + (/ (the float (- sv-32 (-> this last-generate-time))) (the float (-> this inner-point-travel-time))) + ) + (set! sv-24 (fmax 0.0 (fmin 1.0 sv-24))) + (set! sv-40 (fmax 0.0 (fmin 1.0 sv-40))) + (let ((f30-1 (- 1.0 sv-24))) + (dotimes (s2-1 s3-2) + (let ((sv-64 (new 'stack-no-clear 'vector)) + (sv-68 (the-as float 0.0)) + ) + (let ((sv-72 (the-as float 0.0))) + ) + (set-vector! + sv-64 + (- (-> this desired-points data (+ s2-1 s5-2) x) (-> this current-points data (+ s2-1 s5-2) x)) + (- (-> this desired-points data (+ s2-1 s5-2) y) (-> this current-points data (+ s2-1 s5-2) y)) + 0.0 + 1.0 + ) + (set! sv-68 (vector-normalize-ret-len! sv-64 1.0)) + (when (< 0.0 f30-1) + (vector-float*! sv-64 sv-64 (* (/ sv-68 f30-1) (- sv-40 sv-24))) + (vector+! (-> this current-points data (+ s2-1 s5-2)) (-> this current-points data (+ s2-1 s5-2)) sv-64) + (set! (-> this current-points data (+ s2-1 s5-2) z) (-> this desired-points data (+ s2-1 s5-2) z)) + ) + ) ) ) ) @@ -499,15 +496,10 @@ ;; definition for function choose-nice-perp (defun choose-nice-perp ((arg0 vector)) - (let* ((f0-0 (-> arg0 x)) - (f0-2 (* f0-0 f0-0)) - (f1-0 (-> arg0 z)) - ) - (if (< (+ f0-2 (* f1-0 f1-0)) 0.01) - *x-vector* - *up-vector* - ) - ) + (if (< (+ (square (-> arg0 x)) (square (-> arg0 z))) 0.01) + *x-vector* + *up-vector* + ) ) ;; definition for method 12 of type lightning-bolt @@ -515,118 +507,110 @@ ;; WARN: Return type mismatch int vs none. ;; WARN: Function (method 12 lightning-bolt) has a return type of none, but the expression builder found a return statement. (defmethod lightning-bolt-method-12 ((this lightning-bolt)) - (local-vars - (sv-48 int) - (sv-56 float) - (sv-60 vector) - (sv-64 matrix) - (sv-96 lightning-span) - (sv-100 lightning-span-internal) - (sv-104 vector) - (sv-224 matrix) - (sv-228 vector) - (sv-232 vector) - (sv-236 float) - (sv-240 vector) - (sv-244 float) - (sv-248 float) - (sv-256 int) - (sv-288 lightning-span) - (sv-292 lightning-span-internal) - (sv-296 vector) - (sv-416 matrix) - (sv-420 vector) - (sv-424 vector) - (sv-428 vector) - (sv-432 float) - ) (when (= (-> this fade-mode) 3) (set! (-> this strip1 num-verts) (the-as uint 0)) (set! (-> this strip2 num-verts) (the-as uint 0)) (return 0) ) - (set! sv-48 0) - (set! sv-56 (the-as float 0.0)) - (set! sv-60 (new 'stack-no-clear 'vector)) - (set! sv-64 (new 'stack-no-clear 'matrix)) - (lightning-bolt-method-22 this) - (set! (-> sv-60 x) 0.0) - (set! (-> sv-60 y) 0.0) - (dotimes (s5-0 (-> this num-active-spans)) - (set! sv-96 (-> this spans data s5-0)) - (set! sv-100 (-> this spans-internal data s5-0)) - (set! sv-104 (new 'stack-no-clear 'vector)) - (set! sv-224 (new 'stack-no-clear 'matrix)) - (set! sv-228 (new 'stack-no-clear 'vector)) - (set! sv-232 (new 'stack-no-clear 'vector)) - (set! sv-236 (the-as float 0.0)) - (set! sv-240 - (vector-! - (new 'stack-no-clear 'vector) - (-> this span-pts-start data (+ s5-0 1)) - (-> this span-pts-start data s5-0) + (let ((sv-48 0) + (sv-56 (the-as float 0.0)) + (sv-60 (new 'stack-no-clear 'vector)) + (sv-64 (new 'stack-no-clear 'matrix)) + ) + (lightning-bolt-method-22 this) + (set! (-> sv-60 x) 0.0) + (set! (-> sv-60 y) 0.0) + (dotimes (s5-0 (-> this num-active-spans)) + (let ((sv-96 (-> this spans data s5-0)) + (sv-100 (-> this spans-internal data s5-0)) + (sv-104 (new 'stack-no-clear 'vector)) ) + (let ((sv-224 (new 'stack-no-clear 'matrix)) + (sv-228 (new 'stack-no-clear 'vector)) + (sv-232 (new 'stack-no-clear 'vector)) + (sv-236 (the-as float 0.0)) + ) + (let ((sv-240 + (vector-! + (new 'stack-no-clear 'vector) + (-> this span-pts-start data (+ s5-0 1)) + (-> this span-pts-start data s5-0) + ) + ) + (sv-244 (the float (-> sv-100 index))) + ) + (vector-normalize! sv-240 1.0) + (set! sv-236 + (vector-vector-distance (-> this span-pts-start data s5-0) (-> this span-pts-start data (+ s5-0 1))) + ) + (matrix<-vector-yz2! sv-224 sv-240 (choose-nice-perp sv-240)) + (let ((f30-0 (-> sv-96 random-offset-size-start))) + (lightning-bolt-method-19 this sv-104 sv-48 (+ sv-48 1) sv-224 f30-0 sv-236) + (vector-copy! sv-232 (-> this current-points data sv-48)) + (set! (-> sv-232 x) (* (-> sv-232 x) f30-0)) + (set! (-> sv-232 y) (* (-> sv-232 y) f30-0)) + ) + (set! (-> sv-232 z) (- (-> sv-232 z) sv-244)) + (set! (-> sv-232 z) (* (-> sv-232 z) sv-236)) + (vector-rotate*! sv-228 sv-232 sv-224) + (vector+! sv-228 sv-228 (-> this span-pts-start data s5-0)) + (lightning-bolt-method-16 this sv-228 (vector-length sv-232) sv-56 sv-60 (the-as matrix sv-104)) + (let ((sv-248 (-> sv-96 inner-random-offset-size))) + (dotimes (s4-1 (-> sv-100 num-inner-points)) + (let ((sv-256 (+ sv-48 1 s4-1))) + (lightning-bolt-method-19 this sv-104 (+ sv-256 -1) sv-256 sv-224 sv-248 sv-236) + (vector-copy! sv-232 (-> this current-points data sv-256)) + ) + (set! (-> sv-232 x) (* (-> sv-232 x) sv-248)) + (set! (-> sv-232 y) (* (-> sv-232 y) sv-248)) + (set! (-> sv-232 z) (- (-> sv-232 z) sv-244)) + (set! (-> sv-232 z) (* (-> sv-232 z) sv-236)) + (vector-rotate*! sv-228 sv-232 sv-224) + (vector+! sv-228 sv-228 (-> this span-pts-start data s5-0)) + (lightning-bolt-method-16 this sv-228 (vector-length sv-232) sv-56 sv-60 (the-as matrix sv-104)) + ) + ) + ) + (+! sv-56 sv-236) ) - (set! sv-244 (the float (-> sv-100 index))) - (vector-normalize! sv-240 1.0) - (set! sv-236 - (vector-vector-distance (-> this span-pts-start data s5-0) (-> this span-pts-start data (+ s5-0 1))) + (set! sv-48 (+ (-> sv-100 num-inner-points) 1 sv-48)) + (set! (-> sv-64 rvec quad) (-> sv-104 quad)) + ) + ) + (let* ((s5-1 (-> this num-active-spans)) + (sv-288 (-> this spans data s5-1)) + (sv-292 (-> this spans-internal data s5-1)) + ) + (let ((sv-296 (new 'stack-no-clear 'vector))) + ) + (let ((sv-416 (new 'stack-no-clear 'matrix)) + (sv-420 (new 'stack-no-clear 'vector)) + ) + (let ((sv-424 (new 'stack-no-clear 'vector))) + (let ((sv-428 (vector-! + (new 'stack-no-clear 'vector) + (-> this span-pts-start data s5-1) + (-> this span-pts-start data (+ s5-1 -1)) + ) + ) + (sv-432 (the float (-> sv-292 index))) + ) + (vector-normalize! sv-428 1.0) + (matrix<-vector-yz2! sv-416 sv-428 (choose-nice-perp sv-428)) + (let ((f0-33 (-> sv-288 random-offset-size-start))) + (vector-copy! sv-424 (-> this current-points data sv-48)) + (set! (-> sv-424 x) (* (-> sv-424 x) f0-33)) + (set! (-> sv-424 y) (* (-> sv-424 y) f0-33)) + ) + (set! (-> sv-424 z) (- (-> sv-424 z) sv-432)) + ) + (vector-rotate*! sv-420 sv-424 sv-416) ) - (matrix<-vector-yz2! sv-224 sv-240 (choose-nice-perp sv-240)) - (let ((f30-0 (-> sv-96 random-offset-size-start))) - (lightning-bolt-method-19 this sv-104 sv-48 (+ sv-48 1) sv-224 f30-0 sv-236) - (vector-copy! sv-232 (-> this current-points data sv-48)) - (set! (-> sv-232 x) (* (-> sv-232 x) f30-0)) - (set! (-> sv-232 y) (* (-> sv-232 y) f30-0)) + (vector+! sv-420 sv-420 (-> this span-pts-start data s5-1)) + (lightning-bolt-method-16 this sv-420 0.0 sv-56 sv-60 sv-64) + ) ) - (set! (-> sv-232 z) (- (-> sv-232 z) sv-244)) - (set! (-> sv-232 z) (* (-> sv-232 z) sv-236)) - (vector-rotate*! sv-228 sv-232 sv-224) - (vector+! sv-228 sv-228 (-> this span-pts-start data s5-0)) - (lightning-bolt-method-16 this sv-228 (vector-length sv-232) sv-56 sv-60 (the-as matrix sv-104)) - (set! sv-248 (-> sv-96 inner-random-offset-size)) - (dotimes (s4-1 (-> sv-100 num-inner-points)) - (set! sv-256 (+ sv-48 1 s4-1)) - (lightning-bolt-method-19 this sv-104 (+ sv-256 -1) sv-256 sv-224 sv-248 sv-236) - (vector-copy! sv-232 (-> this current-points data sv-256)) - (set! (-> sv-232 x) (* (-> sv-232 x) sv-248)) - (set! (-> sv-232 y) (* (-> sv-232 y) sv-248)) - (set! (-> sv-232 z) (- (-> sv-232 z) sv-244)) - (set! (-> sv-232 z) (* (-> sv-232 z) sv-236)) - (vector-rotate*! sv-228 sv-232 sv-224) - (vector+! sv-228 sv-228 (-> this span-pts-start data s5-0)) - (lightning-bolt-method-16 this sv-228 (vector-length sv-232) sv-56 sv-60 (the-as matrix sv-104)) - ) - (set! sv-56 (+ sv-56 sv-236)) - (set! sv-48 (+ (-> sv-100 num-inner-points) 1 sv-48)) - (set! (-> sv-64 rvec quad) (-> sv-104 quad)) ) - (let ((s5-1 (-> this num-active-spans))) - (set! sv-288 (-> this spans data s5-1)) - (set! sv-292 (-> this spans-internal data s5-1)) - (set! sv-296 (new 'stack-no-clear 'vector)) - (set! sv-416 (new 'stack-no-clear 'matrix)) - (set! sv-420 (new 'stack-no-clear 'vector)) - (set! sv-424 (new 'stack-no-clear 'vector)) - (set! sv-428 (vector-! - (new 'stack-no-clear 'vector) - (-> this span-pts-start data s5-1) - (-> this span-pts-start data (+ s5-1 -1)) - ) - ) - (set! sv-432 (the float (-> sv-292 index))) - (vector-normalize! sv-428 1.0) - (matrix<-vector-yz2! sv-416 sv-428 (choose-nice-perp sv-428)) - (let ((f0-33 (-> sv-288 random-offset-size-start))) - (vector-copy! sv-424 (-> this current-points data sv-48)) - (set! (-> sv-424 x) (* (-> sv-424 x) f0-33)) - (set! (-> sv-424 y) (* (-> sv-424 y) f0-33)) - ) - (set! (-> sv-424 z) (- (-> sv-424 z) sv-432)) - (vector-rotate*! sv-420 sv-424 sv-416) - (vector+! sv-420 sv-420 (-> this span-pts-start data s5-1)) - ) - (lightning-bolt-method-16 this sv-420 0.0 sv-56 sv-60 sv-64) 0 (none) ) @@ -689,7 +673,6 @@ ;; definition for method 16 of type lightning-bolt ;; WARN: Return type mismatch int vs none. (defmethod lightning-bolt-method-16 ((this lightning-bolt) (arg0 vector) (arg1 float) (arg2 float) (arg3 vector) (arg4 matrix)) - (local-vars (sv-160 vector) (sv-164 vector) (sv-168 vector) (sv-172 vector) (sv-176 rgba)) 0.0 0.0 0.0 @@ -738,14 +721,13 @@ (let* ((a2-4 (-> (camera-matrix) uvec)) (v1-13 (matrix-f-u-compose (new 'stack-no-clear 'matrix) (-> arg4 rvec) a2-4)) (f26-1 6.0) + (sv-160 (vector+float*! (new 'stack-no-clear 'vector) arg0 (-> v1-13 rvec) (/ f22-0 2))) + (sv-164 (vector+float*! (new 'stack-no-clear 'vector) arg0 (-> v1-13 rvec) (/ f22-0 -2))) + (sv-168 (vector+float*! (new 'stack-no-clear 'vector) arg0 (-> v1-13 uvec) (/ f22-0 2))) + (sv-172 (vector+float*! (new 'stack-no-clear 'vector) arg0 (-> v1-13 uvec) (/ f22-0 -2))) + (sv-176 (the-as rgba (new 'stack-no-clear 'array 'rgba 1))) ) - (set! sv-160 (vector+float*! (new 'stack-no-clear 'vector) arg0 (-> v1-13 rvec) (/ f22-0 2))) - (set! sv-164 (vector+float*! (new 'stack-no-clear 'vector) arg0 (-> v1-13 rvec) (/ f22-0 -2))) - (set! sv-168 (vector+float*! (new 'stack-no-clear 'vector) arg0 (-> v1-13 uvec) (/ f22-0 2))) - (set! sv-172 (vector+float*! (new 'stack-no-clear 'vector) arg0 (-> v1-13 uvec) (/ f22-0 -2))) - (set! sv-176 (the-as rgba (new 'stack-no-clear 'array 'rgba 1))) - (set! sv-176 (-> this base-color)) - (set! sv-176 (copy-and-set-field sv-176 a (the int (* 128.0 f24-0)))) + (set! sv-176 (copy-and-set-field (-> this base-color) a (the int (* 128.0 f24-0)))) (when (< f28-1 (-> arg3 x)) (let ((s3-1 (new 'stack-no-clear 'vector)) (s4-1 (new 'stack-no-clear 'vector)) @@ -774,11 +756,11 @@ (lightning-bolt-method-18 this (-> this strip2) s4-1 sv-176 0.0 0.0) ) ) + (lightning-bolt-method-18 this (-> this strip1) sv-160 sv-176 0.0 f28-1) + (lightning-bolt-method-18 this (-> this strip1) sv-164 sv-176 1.0 f28-1) + (lightning-bolt-method-18 this (-> this strip2) sv-168 sv-176 1.0 f28-1) + (lightning-bolt-method-18 this (-> this strip2) sv-172 sv-176 0.0 f28-1) ) - (lightning-bolt-method-18 this (-> this strip1) sv-160 sv-176 0.0 f28-1) - (lightning-bolt-method-18 this (-> this strip1) sv-164 sv-176 1.0 f28-1) - (lightning-bolt-method-18 this (-> this strip2) sv-168 sv-176 1.0 f28-1) - (lightning-bolt-method-18 this (-> this strip2) sv-172 sv-176 0.0 f28-1) (set! (-> arg3 y) f30-0) (set! (-> arg3 x) f28-1) ) diff --git a/test/decompiler/reference/jak3/engine/gfx/generic/lightning/lightning_REF.gc b/test/decompiler/reference/jak3/engine/gfx/generic/lightning/lightning_REF.gc index b48ccd0984..ff7511caf1 100644 --- a/test/decompiler/reference/jak3/engine/gfx/generic/lightning/lightning_REF.gc +++ b/test/decompiler/reference/jak3/engine/gfx/generic/lightning/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) @@ -308,7 +312,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 @@ -317,8 +321,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)))) ) @@ -352,24 +356,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) 1)) + (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) 1)) - (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 lsf4)) (let ((f1-1 (vector-vector-distance (-> sv-24 data 0) (-> sv-24 data s4-0)))) @@ -444,22 +440,7 @@ ;; definition for function lightning-draw ;; INFO: Used lq/sq (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) @@ -473,246 +454,260 @@ (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-24 (-> sv-20 sv-80))) - (set! (-> v1-24 tex x) 0) - (set! (-> v1-24 tex y) (* (/ 4096 s3-0) (/ sv-80 2))) - (set! (-> v1-24 tex z) 4096) - (set! (-> v1-24 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-33 (-> sv-20 sv-80))) - (set! (-> v1-33 tex x) 4096) - (set! (-> v1-33 tex y) (* (/ 4096 s3-0) (/ sv-80 2))) - (set! (-> v1-33 tex z) 4096) - (set! (-> v1-33 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-24 (-> sv-20 sv-80))) + (set! (-> v1-24 tex x) 0) + (set! (-> v1-24 tex y) (* (/ 4096 s3-0) (/ sv-80 2))) + (set! (-> v1-24 tex z) 4096) + (set! (-> v1-24 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-33 (-> sv-20 sv-80))) + (set! (-> v1-33 tex x) 4096) + (set! (-> v1-33 tex y) (* (/ 4096 s3-0) (/ sv-80 2))) + (set! (-> v1-33 tex z) 4096) + (set! (-> v1-33 tex w) 0) + ) + ) + ) + (+! sv-80 1) ) ) ) - (set! sv-80 (+ sv-80 1)) - ) - ) - ((logtest? (-> sv-24 flags) (lightning-spec-flags lsf1)) - (dotimes (v1-43 (* s3-0 2)) - (cond - ((not (logtest? v1-43 1)) - (let ((a0-26 (-> sv-20 v1-43))) - (set! (-> a0-26 tex x) 0) - (set! (-> a0-26 tex y) (* (/ 4096 s3-0) (/ v1-43 2))) - (set! (-> a0-26 tex z) 4096) - (set! (-> a0-26 tex w) 0) - ) - ) - (else - (let ((a0-30 (-> sv-20 v1-43))) - (set! (-> a0-30 tex x) 4096) - (set! (-> a0-30 tex y) (* (/ 4096 s3-0) (/ v1-43 2))) - (set! (-> a0-30 tex z) 4096) - (set! (-> a0-30 tex w) 0) + ((logtest? (-> sv-24 flags) (lightning-spec-flags lsf1)) + (dotimes (v1-43 (* s3-0 2)) + (cond + ((not (logtest? v1-43 1)) + (let ((a0-26 (-> sv-20 v1-43))) + (set! (-> a0-26 tex x) 0) + (set! (-> a0-26 tex y) (* (/ 4096 s3-0) (/ v1-43 2))) + (set! (-> a0-26 tex z) 4096) + (set! (-> a0-26 tex w) 0) + ) + ) + (else + (let ((a0-30 (-> sv-20 v1-43))) + (set! (-> a0-30 tex x) 4096) + (set! (-> a0-30 tex y) (* (/ 4096 s3-0) (/ v1-43 2))) + (set! (-> a0-30 tex z) 4096) + (set! (-> a0-30 tex w) 0) + ) + ) + ) + ) + (dotimes (v1-46 (* s2-0 2)) + (set! (-> sv-20 v1-46 clr x) (the-as int (-> arg1 state start-color r))) + (set! (-> sv-20 v1-46 clr y) (the-as int (-> arg1 state start-color g))) + (set! (-> sv-20 v1-46 clr z) (the-as int (-> arg1 state start-color b))) + (set! (-> sv-20 v1-46 clr w) (the-as int (-> arg1 state start-color a))) + ) + (dotimes (v1-49 2) + (let ((a0-45 (+ v1-49 (* 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-46 (* s2-0 2)) - (set! (-> sv-20 v1-46 clr x) (the-as int (-> arg1 state start-color r))) - (set! (-> sv-20 v1-46 clr y) (the-as int (-> arg1 state start-color g))) - (set! (-> sv-20 v1-46 clr z) (the-as int (-> arg1 state start-color b))) - (set! (-> sv-20 v1-46 clr w) (the-as int (-> arg1 state start-color a))) - ) - (dotimes (v1-49 2) - (let ((a0-45 (+ v1-49 (* 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-56 (* s3-0 2)) - (cond - ((not (logtest? v1-56 1)) - (let ((a0-52 (-> sv-20 v1-56))) - (set! (-> a0-52 tex x) 0) - (set! (-> a0-52 tex y) (* (/ 4096 s3-0) (/ v1-56 2))) - (set! (-> a0-52 tex z) 4096) - (set! (-> a0-52 tex w) 0) - ) - ) - (else - (let ((a0-56 (-> sv-20 v1-56))) - (set! (-> a0-56 tex x) 4096) - (set! (-> a0-56 tex y) (* (/ 4096 s3-0) (/ v1-56 2))) - (set! (-> a0-56 tex z) 4096) - (set! (-> a0-56 tex w) 0) + ((logtest? (-> sv-24 flags) (lightning-spec-flags lsf2)) + (dotimes (v1-56 (* s3-0 2)) + (cond + ((not (logtest? v1-56 1)) + (let ((a0-52 (-> sv-20 v1-56))) + (set! (-> a0-52 tex x) 0) + (set! (-> a0-52 tex y) (* (/ 4096 s3-0) (/ v1-56 2))) + (set! (-> a0-52 tex z) 4096) + (set! (-> a0-52 tex w) 0) + ) + ) + (else + (let ((a0-56 (-> sv-20 v1-56))) + (set! (-> a0-56 tex x) 4096) + (set! (-> a0-56 tex y) (* (/ 4096 s3-0) (/ v1-56 2))) + (set! (-> a0-56 tex z) 4096) + (set! (-> a0-56 tex w) 0) + ) + ) + ) + ) + (dotimes (v1-59 (* (+ s3-0 -2) 2)) + (let ((a0-58 (+ v1-59 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-62 2) + (let ((a0-63 v1-62)) + (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-65 2) + (let ((a0-67 (+ v1-65 (* 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-59 (* (+ s3-0 -2) 2)) - (let ((a0-58 (+ v1-59 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-62 2) - (let ((a0-63 v1-62)) - (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-65 2) - (let ((a0-67 (+ v1-65 (* 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-71 (-> sv-48 data)) - (a0-71 (the-as object (-> sv-20 0))) - (a1-82 (the-as object (-> sv-20 1))) ) - 1 - (.lvf vf1 (&-> s0-0 rvec quad)) - (.lvf vf2 (&-> s0-0 uvec quad)) - (.lvf vf3 (&-> s0-0 fvec quad)) - (.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 (&-> v1-71 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 uint128) a1-82) 6)) - (set! a0-71 (&-> (the-as (pointer uint128) a0-71) 6)) - (.add.x.vf vf9 vf8 vf0) - (set! v1-71 (the-as (inline-array vector) (-> v1-71 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-71 (-> sv-48 data)) + (a0-71 (the-as object (-> sv-20 0))) + (a1-82 (the-as object (-> sv-20 1))) + ) + 1 + (.lvf vf1 (&-> s0-0 rvec quad)) + (.lvf vf2 (&-> s0-0 uvec quad)) + (.lvf vf3 (&-> s0-0 fvec quad)) + (.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-81 arg0) - (a0-73 (the-as object (-> v1-81 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-81 base) (the-as pointer (the-as dma-packet (&+ (the-as dma-packet a0-73) 16)))) - ) - (set! sv-176 (the-as gcf-control (-> arg0 base))) - (matrix-copy! (-> sv-176 matrix) (-> sv-16 perspective)) - (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)) - (when sv-32 - (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-miptbp :tbp1 #x48 :tbw2 #x20)) - (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 (&-> v1-71 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 uint128) a1-82) 6)) + (set! a0-71 (&-> (the-as (pointer uint128) a0-71) 6)) + (.add.x.vf vf9 vf8 vf0) + (set! v1-71 (the-as (inline-array vector) (-> v1-71 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-81 arg0) + (a0-73 (the-as object (-> v1-81 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-81 base) (the-as pointer (the-as dma-packet (&+ (the-as dma-packet a0-73) 16)))) + ) + (let ((sv-176 (the-as gcf-control (-> arg0 base)))) + (matrix-copy! (-> sv-176 matrix) (-> sv-16 perspective)) + (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)) + (when sv-32 + (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-miptbp :tbp1 #x48 :tbw2 #x20)) + (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/jak3/engine/gfx/math-camera_REF.gc b/test/decompiler/reference/jak3/engine/gfx/math-camera_REF.gc index 91a11efc87..ede862bf42 100644 --- a/test/decompiler/reference/jak3/engine/gfx/math-camera_REF.gc +++ b/test/decompiler/reference/jak3/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/jak3/engine/gfx/mood/mood_REF.gc b/test/decompiler/reference/jak3/engine/gfx/mood/mood_REF.gc index 5c4f0913ce..e79fac0e63 100644 --- a/test/decompiler/reference/jak3/engine/gfx/mood/mood_REF.gc +++ b/test/decompiler/reference/jak3/engine/gfx/mood/mood_REF.gc @@ -431,7 +431,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) @@ -479,18 +479,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) - (vector-copy! (-> arg0 times 2) sv-64) - (vector-copy! (-> arg0 times 3) sv-64) - (vector-copy! (-> arg0 times 4) sv-64) - (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) + (vector-copy! (-> arg0 times 2) sv-64) + (vector-copy! (-> arg0 times 3) sv-64) + (vector-copy! (-> arg0 times 4) sv-64) + (set! (-> s0-0 0 ambi color quad) (-> s1-0 0 quad)) ) (vector4-lerp! (-> arg0 current-sky-color) diff --git a/test/decompiler/reference/jak3/engine/gfx/ocean/ocean-mid_REF.gc b/test/decompiler/reference/jak3/engine/gfx/ocean/ocean-mid_REF.gc index a3a967df92..e48aa446b4 100644 --- a/test/decompiler/reference/jak3/engine/gfx/ocean/ocean-mid_REF.gc +++ b/test/decompiler/reference/jak3/engine/gfx/ocean/ocean-mid_REF.gc @@ -534,9 +534,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) @@ -1012,42 +1011,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) @@ -1063,7 +1063,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-48 int)) + (local-vars (v1-8 float) (v1-9 float)) (rlet ((vf16 :class vf) (vf17 :class vf) (vf18 :class vf) @@ -1123,8 +1123,9 @@ ) (dotimes (s2-0 6) (dotimes (s1-0 6) - (let ((s0-0 (+ (* 6 s2-0) s1-0))) - (set! sv-48 (-> (the-as (pointer int16) (+ (* s0-0 2) (the-as int (-> this ocean-mid-indices)))))) + (let* ((s0-0 (+ (* 6 s2-0) s1-0)) + (sv-48 (-> (the-as (pointer int16) (+ (* s0-0 2) (the-as int (-> this ocean-mid-indices)))))) + ) (when (-> this all-on) (set! sv-48 0) sv-48 @@ -1138,15 +1139,7 @@ ((< sv-48 0) ) ((let ((f24-0 (- (vector-vector-distance s3-0 s4-0) (-> s3-0 r)))) - (let ((a0-16 this) - (t9-6 (method-of-type ocean ocean-mid-add-upload)) - (a1-9 arg0) - (a2-2 s2-0) - (a3-0 s1-0) - (t2-0 f24-0) - ) - (t9-6 a0-16 a1-9 a2-2 a3-0 sv-48 s0-0 t2-0) - ) + (ocean-mid-add-upload this arg0 s2-0 s1-0 sv-48 s0-0 f24-0) (< f24-0 786432.0) ) (ocean-mid-add-call this arg0 73) diff --git a/test/decompiler/reference/jak3/engine/gfx/ocean/ocean-near_REF.gc b/test/decompiler/reference/jak3/engine/gfx/ocean/ocean-near_REF.gc index aa642b9833..1b905090d9 100644 --- a/test/decompiler/reference/jak3/engine/gfx/ocean/ocean-near_REF.gc +++ b/test/decompiler/reference/jak3/engine/gfx/ocean/ocean-near_REF.gc @@ -654,7 +654,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))) ) @@ -677,8 +676,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/jak3/engine/gfx/ocean/ocean-texture_REF.gc b/test/decompiler/reference/jak3/engine/gfx/ocean/ocean-texture_REF.gc index 0cf64b625d..a672506320 100644 --- a/test/decompiler/reference/jak3/engine/gfx/ocean/ocean-texture_REF.gc +++ b/test/decompiler/reference/jak3/engine/gfx/ocean/ocean-texture_REF.gc @@ -643,7 +643,6 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defmethod ocean-method-84 ((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)) @@ -657,9 +656,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) @@ -796,7 +796,6 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defmethod ocean-method-87 ((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 @@ -850,34 +849,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-85)) - (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-85 this s0-0 sv-80 (-> s2-2 sun0-color) (-> s2-2 ambi-color)) (ocean-method-85 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-86)) - (a3-2 s4-1) - ) - (t9-5 a0-44 sv-96 sv-112 a3-2) + (ocean-method-86 this sv-96 sv-112 s4-1) ) ) ) diff --git a/test/decompiler/reference/jak3/engine/gfx/ocean/ocean-transition_REF.gc b/test/decompiler/reference/jak3/engine/gfx/ocean/ocean-transition_REF.gc index 41e4aaf0f9..fa2e3e4447 100644 --- a/test/decompiler/reference/jak3/engine/gfx/ocean/ocean-transition_REF.gc +++ b/test/decompiler/reference/jak3/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/jak3/engine/gfx/ocean/ocean_REF.gc b/test/decompiler/reference/jak3/engine/gfx/ocean/ocean_REF.gc index 6b0c64c144..b84980b387 100644 --- a/test/decompiler/reference/jak3/engine/gfx/ocean/ocean_REF.gc +++ b/test/decompiler/reference/jak3/engine/gfx/ocean/ocean_REF.gc @@ -146,7 +146,6 @@ ;; INFO: Used lq/sq ;; 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 ((s4-0 (the-as (inline-array ocean-vertex) #x70000000))) (let ((f0-0 (-> this start-corner z))) (let ((f1-1 (+ -5898240.0 f0-0))) @@ -160,79 +159,81 @@ (set! (-> s4-0 1 pos w) 0.5) (set! (-> s4-0 2 pos w) 1.0) (set! (-> s4-0 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 (the-as (pointer int32) (-> 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! (-> s4-0 0 pos x) f0-8) - (set! (-> s4-0 1 pos x) f1-6) - (set! (-> s4-0 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 (the-as (pointer int32) (-> 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! (-> s4-0 0 pos x) f0-8) + (set! (-> s4-0 1 pos x) f1-6) + (set! (-> s4-0 2 pos x) f1-6) + ) + (set! (-> s4-0 3 pos x) f0-8) ) - (set! (-> s4-0 3 pos x) f0-8) - ) - (rgba-to-vector! this sv-56 (the-as (pointer int32) (&+ (-> s3-0 colors) (* (+ s1-0 1) 4)))) - (vector-copy! (-> s4-0 0 col) sv-52) - (vector-copy! (-> s4-0 1 col) sv-56) - (vector-copy! (-> s4-0 2 col) sv-56) - (vector-copy! (-> s4-0 3 col) sv-52) - (vector-copy! sv-52 sv-56) - (cond - ((render-ocean-quad s4-0 arg0) - (set! s2-0 #t) - ) - (else - (if s2-0 - (goto cfg-9) - ) + (rgba-to-vector! this sv-56 (the-as (pointer int32) (&+ (-> s3-0 colors) (* (+ s1-0 1) 4)))) + (vector-copy! (-> s4-0 0 col) sv-52) + (vector-copy! (-> s4-0 1 col) sv-56) + (vector-copy! (-> s4-0 2 col) sv-56) + (vector-copy! (-> s4-0 3 col) sv-52) + (vector-copy! sv-52 sv-56) + (cond + ((render-ocean-quad s4-0 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! (-> s4-0 0 pos z) f1-9) - (set! (-> s4-0 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! (-> s4-0 0 pos z) f1-9) + (set! (-> s4-0 1 pos z) f1-9) + ) + (set! (-> s4-0 2 pos z) f0-10) + (set! (-> s4-0 3 pos z) f0-10) ) - (set! (-> s4-0 2 pos z) f0-10) - (set! (-> s4-0 3 pos z) f0-10) - ) - (set! (-> s4-0 0 pos w) 0.0) - (set! (-> s4-0 1 pos w) 0.0) - (set! (-> s4-0 2 pos w) 0.5) - (set! (-> s4-0 3 pos w) 0.5) - (let ((s3-1 (-> this ocean-colors))) - (let ((s2-1 #f)) - (rgba-to-vector! this sv-52 (the-as (pointer int32) (-> 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! (-> s4-0 0 pos x) f0-17) - (set! (-> s4-0 1 pos x) f1-14) - (set! (-> s4-0 2 pos x) f1-14) + (set! (-> s4-0 0 pos w) 0.0) + (set! (-> s4-0 1 pos w) 0.0) + (set! (-> s4-0 2 pos w) 0.5) + (set! (-> s4-0 3 pos w) 0.5) + (let ((s3-1 (-> this ocean-colors))) + (let ((s2-1 #f)) + (rgba-to-vector! this sv-52 (the-as (pointer int32) (-> 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! (-> s4-0 0 pos x) f0-17) + (set! (-> s4-0 1 pos x) f1-14) + (set! (-> s4-0 2 pos x) f1-14) + ) + (set! (-> s4-0 3 pos x) f0-17) ) - (set! (-> s4-0 3 pos x) f0-17) - ) - (rgba-to-vector! this sv-56 (the-as (pointer int32) (&+ (-> s3-1 colors) (* (+ s1-1 1) 4)))) - (add-colors! this (-> s4-0 0 col) (-> s4-0 0)) - (add-colors! this (-> s4-0 1 col) (-> s4-0 1)) - (vector-copy! (-> s4-0 2 col) sv-56) - (vector-copy! (-> s4-0 3 col) sv-52) - (vector-copy! sv-52 sv-56) - (cond - ((render-ocean-quad s4-0 arg0) - (set! s2-1 #t) - ) - (else - (if s2-1 - (goto cfg-18) - ) + (rgba-to-vector! this sv-56 (the-as (pointer int32) (&+ (-> s3-1 colors) (* (+ s1-1 1) 4)))) + (add-colors! this (-> s4-0 0 col) (-> s4-0 0)) + (add-colors! this (-> s4-0 1 col) (-> s4-0 1)) + (vector-copy! (-> s4-0 2 col) sv-56) + (vector-copy! (-> s4-0 3 col) sv-52) + (vector-copy! sv-52 sv-56) + (cond + ((render-ocean-quad s4-0 arg0) + (set! s2-1 #t) + ) + (else + (if s2-1 + (goto cfg-18) + ) + ) ) ) ) @@ -248,7 +249,6 @@ ;; INFO: Used lq/sq ;; 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 ((s4-0 (the-as (inline-array ocean-vertex) #x70000000))) (let* ((f0-1 (+ 18874368.0 (-> this start-corner z))) (f1-2 (+ 5898240.0 f0-1)) @@ -262,79 +262,81 @@ (set! (-> s4-0 1 pos w) 1.0) (set! (-> s4-0 2 pos w) 0.5) (set! (-> s4-0 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 (the-as (pointer int32) (&-> 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! (-> s4-0 0 pos x) f0-9) - (set! (-> s4-0 1 pos x) f1-7) - (set! (-> s4-0 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 (the-as (pointer int32) (&-> 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! (-> s4-0 0 pos x) f0-9) + (set! (-> s4-0 1 pos x) f1-7) + (set! (-> s4-0 2 pos x) f1-7) + ) + (set! (-> s4-0 3 pos x) f0-9) ) - (set! (-> s4-0 3 pos x) f0-9) - ) - (rgba-to-vector! this sv-56 (the-as (pointer int32) (&+ (-> s3-0 colors) (* (+ s1-0 2445) 4)))) - (vector-copy! (-> s4-0 0 col) sv-52) - (vector-copy! (-> s4-0 1 col) sv-56) - (vector-copy! (-> s4-0 2 col) sv-56) - (vector-copy! (-> s4-0 3 col) sv-52) - (vector-copy! sv-52 sv-56) - (cond - ((render-ocean-quad s4-0 arg0) - (set! s2-0 #t) - ) - (else - (if s2-0 - (goto cfg-9) - ) + (rgba-to-vector! this sv-56 (the-as (pointer int32) (&+ (-> s3-0 colors) (* (+ s1-0 2445) 4)))) + (vector-copy! (-> s4-0 0 col) sv-52) + (vector-copy! (-> s4-0 1 col) sv-56) + (vector-copy! (-> s4-0 2 col) sv-56) + (vector-copy! (-> s4-0 3 col) sv-52) + (vector-copy! sv-52 sv-56) + (cond + ((render-ocean-quad s4-0 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! (-> s4-0 0 pos z) f0-11) - (set! (-> s4-0 1 pos z) f0-11) - (set! (-> s4-0 2 pos z) f1-10) - (set! (-> s4-0 3 pos z) f1-10) - ) - (set! (-> s4-0 0 pos w) 0.5) - (set! (-> s4-0 1 pos w) 0.5) - (set! (-> s4-0 2 pos w) 0.0) - (set! (-> s4-0 3 pos w) 0.0) - (let ((s3-1 (-> this ocean-colors))) - (let ((s2-1 #f)) - (rgba-to-vector! this sv-52 (the-as (pointer int32) (&-> 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! (-> s4-0 0 pos x) f0-18) - (set! (-> s4-0 1 pos x) f1-15) - (set! (-> s4-0 2 pos x) f1-15) - ) - (set! (-> s4-0 3 pos x) f0-18) - ) - (rgba-to-vector! this sv-56 (the-as (pointer int32) (&+ (-> s3-1 colors) (* (+ s1-1 2445) 4)))) - (vector-copy! (-> s4-0 0 col) sv-52) - (vector-copy! (-> s4-0 1 col) sv-56) - (add-colors! this (-> s4-0 2 col) (-> s4-0 2)) - (add-colors! this (-> s4-0 3 col) (-> s4-0 3)) - (vector-copy! sv-52 sv-56) - (cond - ((render-ocean-quad s4-0 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! (-> s4-0 0 pos z) f0-11) + (set! (-> s4-0 1 pos z) f0-11) + (set! (-> s4-0 2 pos z) f1-10) + (set! (-> s4-0 3 pos z) f1-10) + ) + (set! (-> s4-0 0 pos w) 0.5) + (set! (-> s4-0 1 pos w) 0.5) + (set! (-> s4-0 2 pos w) 0.0) + (set! (-> s4-0 3 pos w) 0.0) + (let ((s3-1 (-> this ocean-colors))) + (let ((s2-1 #f)) + (rgba-to-vector! this sv-52 (the-as (pointer int32) (&-> 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! (-> s4-0 0 pos x) f0-18) + (set! (-> s4-0 1 pos x) f1-15) + (set! (-> s4-0 2 pos x) f1-15) + ) + (set! (-> s4-0 3 pos x) f0-18) + ) + (rgba-to-vector! this sv-56 (the-as (pointer int32) (&+ (-> s3-1 colors) (* (+ s1-1 2445) 4)))) + (vector-copy! (-> s4-0 0 col) sv-52) + (vector-copy! (-> s4-0 1 col) sv-56) + (add-colors! this (-> s4-0 2 col) (-> s4-0 2)) + (add-colors! this (-> s4-0 3 col) (-> s4-0 3)) + (vector-copy! sv-52 sv-56) + (cond + ((render-ocean-quad s4-0 arg0) + (set! s2-1 #t) + ) + (else + (if s2-1 + (goto cfg-18) + ) + ) ) ) ) @@ -350,7 +352,6 @@ ;; INFO: Used lq/sq ;; 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 ((s4-0 (the-as (inline-array ocean-vertex) #x70000000))) (let* ((f0-0 (-> this start-corner x)) (f1-1 (+ -5898240.0 f0-0)) @@ -364,79 +365,81 @@ (set! (-> s4-0 1 pos w) 1.0) (set! (-> s4-0 2 pos w) 1.0) (set! (-> s4-0 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 (the-as (pointer int32) (-> 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! (-> s4-0 0 pos z) f0-8) - (set! (-> s4-0 1 pos z) f0-8) - (set! (-> s4-0 2 pos z) f1-6) - (set! (-> s4-0 3 pos z) f1-6) - ) - (rgba-to-vector! this sv-56 (the-as (pointer int32) (&+ (-> s3-0 colors) (* 208 (+ s1-0 1))))) - (vector-copy! (-> s4-0 0 col) sv-52) - (vector-copy! (-> s4-0 1 col) sv-52) - (vector-copy! (-> s4-0 2 col) sv-56) - (vector-copy! (-> s4-0 3 col) sv-56) - (vector-copy! sv-52 sv-56) - (cond - ((render-ocean-quad s4-0 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 (the-as (pointer int32) (-> 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! (-> s4-0 0 pos z) f0-8) + (set! (-> s4-0 1 pos z) f0-8) + (set! (-> s4-0 2 pos z) f1-6) + (set! (-> s4-0 3 pos z) f1-6) + ) + (rgba-to-vector! this sv-56 (the-as (pointer int32) (&+ (-> s3-0 colors) (* 208 (+ s1-0 1))))) + (vector-copy! (-> s4-0 0 col) sv-52) + (vector-copy! (-> s4-0 1 col) sv-52) + (vector-copy! (-> s4-0 2 col) sv-56) + (vector-copy! (-> s4-0 3 col) sv-56) + (vector-copy! sv-52 sv-56) + (cond + ((render-ocean-quad s4-0 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! (-> s4-0 0 pos x) f1-9) - (set! (-> s4-0 1 pos x) f0-10) - (set! (-> s4-0 2 pos x) f0-10) - (set! (-> s4-0 3 pos x) f1-9) - ) - (set! (-> s4-0 0 pos w) 0.0) - (set! (-> s4-0 1 pos w) 0.5) - (set! (-> s4-0 2 pos w) 0.5) - (set! (-> s4-0 3 pos w) 0.0) - (let ((s3-1 (-> this ocean-colors))) - (let ((s2-1 #f)) - (rgba-to-vector! this sv-52 (the-as (pointer int32) (-> 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! (-> s4-0 0 pos z) f0-17) - (set! (-> s4-0 1 pos z) f0-17) - (set! (-> s4-0 2 pos z) f1-14) - (set! (-> s4-0 3 pos z) f1-14) - ) - (rgba-to-vector! this sv-56 (the-as (pointer int32) (&+ (-> s3-1 colors) (* 208 (+ s1-1 1))))) - (add-colors! this (-> s4-0 0 col) (-> s4-0 0)) - (vector-copy! (-> s4-0 1 col) sv-52) - (vector-copy! (-> s4-0 2 col) sv-56) - (add-colors! this (-> s4-0 3 col) (-> s4-0 3)) - (vector-copy! sv-52 sv-56) - (cond - ((render-ocean-quad s4-0 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! (-> s4-0 0 pos x) f1-9) + (set! (-> s4-0 1 pos x) f0-10) + (set! (-> s4-0 2 pos x) f0-10) + (set! (-> s4-0 3 pos x) f1-9) + ) + (set! (-> s4-0 0 pos w) 0.0) + (set! (-> s4-0 1 pos w) 0.5) + (set! (-> s4-0 2 pos w) 0.5) + (set! (-> s4-0 3 pos w) 0.0) + (let ((s3-1 (-> this ocean-colors))) + (let ((s2-1 #f)) + (rgba-to-vector! this sv-52 (the-as (pointer int32) (-> 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! (-> s4-0 0 pos z) f0-17) + (set! (-> s4-0 1 pos z) f0-17) + (set! (-> s4-0 2 pos z) f1-14) + (set! (-> s4-0 3 pos z) f1-14) + ) + (rgba-to-vector! this sv-56 (the-as (pointer int32) (&+ (-> s3-1 colors) (* 208 (+ s1-1 1))))) + (add-colors! this (-> s4-0 0 col) (-> s4-0 0)) + (vector-copy! (-> s4-0 1 col) sv-52) + (vector-copy! (-> s4-0 2 col) sv-56) + (add-colors! this (-> s4-0 3 col) (-> s4-0 3)) + (vector-copy! sv-52 sv-56) + (cond + ((render-ocean-quad s4-0 arg0) + (set! s2-1 #t) + ) + (else + (if s2-1 + (goto cfg-18) + ) + ) ) ) ) @@ -452,7 +455,6 @@ ;; INFO: Used lq/sq ;; 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 ((s4-0 (the-as (inline-array ocean-vertex) #x70000000))) (let ((f0-1 (+ 18874368.0 (-> this start-corner x)))) (let ((f1-2 (+ 5898240.0 f0-1))) @@ -466,79 +468,81 @@ (set! (-> s4-0 1 pos w) 0.5) (set! (-> s4-0 2 pos w) 0.5) (set! (-> s4-0 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 (the-as (pointer int32) (&-> 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! (-> s4-0 0 pos z) f0-9) - (set! (-> s4-0 1 pos z) f0-9) - (set! (-> s4-0 2 pos z) f1-7) - (set! (-> s4-0 3 pos z) f1-7) - ) - (rgba-to-vector! this sv-56 (the-as (pointer int32) (&+ (-> s3-0 colors) (* (+ (* 52 (+ s1-0 1)) 47) 4)))) - (vector-copy! (-> s4-0 0 col) sv-52) - (vector-copy! (-> s4-0 1 col) sv-52) - (vector-copy! (-> s4-0 2 col) sv-56) - (vector-copy! (-> s4-0 3 col) sv-56) - (vector-copy! sv-52 sv-56) - (cond - ((render-ocean-quad s4-0 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 (the-as (pointer int32) (&-> 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! (-> s4-0 0 pos z) f0-9) + (set! (-> s4-0 1 pos z) f0-9) + (set! (-> s4-0 2 pos z) f1-7) + (set! (-> s4-0 3 pos z) f1-7) + ) + (rgba-to-vector! this sv-56 (the-as (pointer int32) (&+ (-> s3-0 colors) (* (+ (* 52 (+ s1-0 1)) 47) 4)))) + (vector-copy! (-> s4-0 0 col) sv-52) + (vector-copy! (-> s4-0 1 col) sv-52) + (vector-copy! (-> s4-0 2 col) sv-56) + (vector-copy! (-> s4-0 3 col) sv-56) + (vector-copy! sv-52 sv-56) + (cond + ((render-ocean-quad s4-0 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! (-> s4-0 0 pos x) f0-11) - (set! (-> s4-0 1 pos x) f1-10) - (set! (-> s4-0 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! (-> s4-0 0 pos x) f0-11) + (set! (-> s4-0 1 pos x) f1-10) + (set! (-> s4-0 2 pos x) f1-10) + ) + (set! (-> s4-0 3 pos x) f0-11) ) - (set! (-> s4-0 3 pos x) f0-11) - ) - (set! (-> s4-0 0 pos w) 0.5) - (set! (-> s4-0 1 pos w) 0.0) - (set! (-> s4-0 2 pos w) 0.0) - (set! (-> s4-0 3 pos w) 0.5) - (let ((s3-1 (-> this ocean-colors))) - (let ((s2-1 #f)) - (rgba-to-vector! this sv-52 (the-as (pointer int32) (&-> 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! (-> s4-0 0 pos z) f0-18) - (set! (-> s4-0 1 pos z) f0-18) - (set! (-> s4-0 2 pos z) f1-15) - (set! (-> s4-0 3 pos z) f1-15) - ) - (rgba-to-vector! this sv-56 (the-as (pointer int32) (&+ (-> s3-1 colors) (* (+ (* 52 (+ s1-1 1)) 47) 4)))) - (vector-copy! (-> s4-0 0 col) sv-52) - (add-colors! this (-> s4-0 1 col) (-> s4-0 1)) - (add-colors! this (-> s4-0 2 col) (-> s4-0 2)) - (vector-copy! (-> s4-0 3 col) sv-56) - (vector-copy! sv-52 sv-56) - (cond - ((render-ocean-quad s4-0 arg0) - (set! s2-1 #t) - ) - (else - (if s2-1 - (goto cfg-18) - ) + (set! (-> s4-0 0 pos w) 0.5) + (set! (-> s4-0 1 pos w) 0.0) + (set! (-> s4-0 2 pos w) 0.0) + (set! (-> s4-0 3 pos w) 0.5) + (let ((s3-1 (-> this ocean-colors))) + (let ((s2-1 #f)) + (rgba-to-vector! this sv-52 (the-as (pointer int32) (&-> 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! (-> s4-0 0 pos z) f0-18) + (set! (-> s4-0 1 pos z) f0-18) + (set! (-> s4-0 2 pos z) f1-15) + (set! (-> s4-0 3 pos z) f1-15) + ) + (rgba-to-vector! this sv-56 (the-as (pointer int32) (&+ (-> s3-1 colors) (* (+ (* 52 (+ s1-1 1)) 47) 4)))) + (vector-copy! (-> s4-0 0 col) sv-52) + (add-colors! this (-> s4-0 1 col) (-> s4-0 1)) + (add-colors! this (-> s4-0 2 col) (-> s4-0 2)) + (vector-copy! (-> s4-0 3 col) sv-56) + (vector-copy! sv-52 sv-56) + (cond + ((render-ocean-quad s4-0 arg0) + (set! s2-1 #t) + ) + (else + (if s2-1 + (goto cfg-18) + ) + ) ) ) ) diff --git a/test/decompiler/reference/jak3/engine/gfx/shrub/shrubbery_REF.gc b/test/decompiler/reference/jak3/engine/gfx/shrub/shrubbery_REF.gc index 94a90c0e9a..9c26ae70a2 100644 --- a/test/decompiler/reference/jak3/engine/gfx/shrub/shrubbery_REF.gc +++ b/test/decompiler/reference/jak3/engine/gfx/shrub/shrubbery_REF.gc @@ -457,16 +457,7 @@ ;; INFO: Used lq/sq ;; ERROR: Failed load: (set! a2-11 (l.d (+ a0-14 96))) at op 102 (defun draw-prototype-inline-array-shrub ((arg0 int) (arg1 (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 object arg1)) (a0-6 (-> *display* frames (-> *display* on-screen) global-buf)) ) @@ -657,36 +648,51 @@ (let ((s1-0 (the-as prototype-bucket-shrub arg1))) (countdown (s0-0 arg0) (when (nonzero? (-> s1-0 count 1)) - (if (logtest? (-> s1-0 flags) (prototype-flags tpage-alpha)) - (set! sv-16 (-> s1-0 geometry 2)) - (set! sv-16 (-> s1-0 geometry 1)) - ) - (set! sv-32 (-> s1-0 next 1)) - (if (logtest? (-> 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 prototype-shrubbery sv-16) length)) - (shrub-upload-model - (the-as shrubbery sv-64) - s2-2 - (the-as int (-> *instance-shrub-work* start-bank (-> 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? (-> s1-0 flags) (prototype-flags tpage-alpha)) + (set! sv-16 (-> s1-0 geometry 2)) + sv-16 + ) + (else + (-> s1-0 geometry 1) + ) + ) + ) + (let ((sv-32 (-> s1-0 next 1))) + (set! sv-48 (cond + ((logtest? (-> 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 prototype-shrubbery sv-16) length)) + (shrub-upload-model + (the-as shrubbery sv-64) + s2-2 + (the-as int (-> *instance-shrub-work* start-bank (-> s1-0 mod-count 1))) + ) + (if (zero? sv-80) + (dma-buffer-add-gs-set s2-2 (test-1 sv-48)) + ) + (let* ((v1-98 s2-2) + (a0-44 (-> v1-98 base)) + ) + (set! (-> (the-as (pointer uint64) a0-44)) (logior #x50000000 (shr (shl sv-32 33) 1))) + (s.w! (+ a0-44 8) 0) + (s.w! (+ a0-44 12) 0) + (set! (-> v1-98 base) (&+ a0-44 16)) + ) + (&+! sv-64 32) + (+! sv-80 1) ) - (let* ((v1-98 s2-2) - (a0-44 (-> v1-98 base)) - ) - (set! (-> (the-as (pointer uint64) a0-44)) (logior #x50000000 (shr (shl sv-32 33) 1))) - (s.w! (+ a0-44 8) 0) - (s.w! (+ a0-44 12) 0) - (set! (-> v1-98 base) (&+ a0-44 16)) ) - (set! sv-64 (&+ sv-64 32)) - (set! sv-80 (+ sv-80 1)) ) ) (&+! s1-0 112) @@ -738,27 +744,28 @@ (let ((s1-1 (the-as prototype-bucket-shrub arg1))) (countdown (s0-1 arg0) (when (nonzero? (-> s1-1 count 2)) - (let ((v1-134 (-> s1-1 geometry 2))) - (set! sv-96 (-> s1-1 next 2)) - (set! sv-112 (&+ v1-134 32)) - (set! sv-128 (-> (the-as prototype-shrubbery v1-134) 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 (-> s1-1 mod-count 2))) + (let* ((v1-134 (-> s1-1 geometry 2)) + (sv-96 (-> s1-1 next 2)) + (sv-112 (&+ v1-134 32)) + (sv-128 (-> (the-as prototype-shrubbery v1-134) 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 (-> s1-1 mod-count 2))) + ) + (let* ((v1-140 s2-3) + (a0-60 (-> v1-140 base)) + ) + (set! (-> (the-as (pointer uint64) a0-60)) (logior #x50000000 (shr (shl sv-96 33) 1))) + (s.w! (+ a0-60 8) 0) + (s.w! (+ a0-60 12) 0) + (set! (-> v1-140 base) (&+ a0-60 16)) + ) + (&+! sv-112 32) ) - (let* ((v1-140 s2-3) - (a0-60 (-> v1-140 base)) - ) - (set! (-> (the-as (pointer uint64) a0-60)) (logior #x50000000 (shr (shl sv-96 33) 1))) - (s.w! (+ a0-60 8) 0) - (s.w! (+ a0-60 12) 0) - (set! (-> v1-140 base) (&+ a0-60 16)) - ) - (set! sv-112 (&+ sv-112 32)) ) ) (&+! s1-1 112) diff --git a/test/decompiler/reference/jak3/engine/gfx/sky/sky-tng_REF.gc b/test/decompiler/reference/jak3/engine/gfx/sky/sky-tng_REF.gc index 80a59abca8..4080a8d69d 100644 --- a/test/decompiler/reference/jak3/engine/gfx/sky/sky-tng_REF.gc +++ b/test/decompiler/reference/jak3/engine/gfx/sky/sky-tng_REF.gc @@ -293,7 +293,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) ) @@ -331,13 +331,15 @@ (set-tex-offset (the-as int (-> this off-s)) (the-as int (-> this off-t))) (let ((s4-1 (-> 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))) @@ -349,9 +351,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))) @@ -461,23 +463,24 @@ ;; definition for method 28 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 (-> 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/jak3/engine/gfx/sprite/particles/light-trails_REF.gc b/test/decompiler/reference/jak3/engine/gfx/sprite/particles/light-trails_REF.gc index 7c59feba58..b0d43d1315 100644 --- a/test/decompiler/reference/jak3/engine/gfx/sprite/particles/light-trails_REF.gc +++ b/test/decompiler/reference/jak3/engine/gfx/sprite/particles/light-trails_REF.gc @@ -330,28 +330,6 @@ ;; WARN: Return type mismatch int vs none. (defmethod build-prim-strip! ((this light-trail)) "Build the mesh for this light trail." - (local-vars - (sv-64 time-frame) - (sv-72 uint) - (sv-80 int) - (sv-88 float) - (sv-92 float) - (sv-96 float) - (sv-100 rgbaf) - (sv-104 vector) - (sv-128 vector) - (sv-132 vector) - (sv-136 float) - (sv-140 float) - (sv-144 float) - (sv-148 float) - (sv-152 float) - (sv-156 float) - (sv-192 float) - (sv-196 float) - (sv-200 vector) - (sv-204 vector) - ) (set! (-> *dist-cache-array* 0) 0.0) (set! *total-length* 0.0) (let ((s5-0 (new 'stack-no-clear 'array 'int32 4))) @@ -376,227 +354,229 @@ (+! s4-0 1) ) ) - (set! sv-64 (-> this appearance max-age)) - (set! sv-72 (- (-> this start-marker) (-> this end-marker))) - (set! sv-80 0) - (set! sv-88 (the-as float 0.0)) - (set! sv-92 (the-as float -100.0)) - (set! sv-96 (the-as float 0.0)) - (set! sv-100 (new 'stack-no-clear 'rgbaf)) - (set! sv-104 (new 'stack-no-clear 'vector)) - (if (= (-> this appearance uv-mode) 3) - (set! sv-92 (the-as float 100.0)) + (let ((sv-64 (-> this appearance max-age))) + (let ((sv-72 (- (-> this start-marker) (-> this end-marker)))) ) - (set! sv-128 (math-camera-pos)) - (set! sv-132 (new 'stack-no-clear 'vector)) - (set! (-> this strip num-verts) (the-as uint 0)) - (set! (-> this strip tex-id) (-> this appearance tex-id)) - (cond - ((not (-> this appearance zbuffer?)) - (set! (-> this strip adnops 0 cmds) (gs-reg64 test-1)) - (set! (-> this strip data0) (new 'static 'gs-test - :ate #x1 - :atst (gs-atest greater-equal) - :aref #x80 - :afail #x1 - :zte #x1 - :ztst (gs-ztest greater-equal) - ) + (let ((sv-80 0) + (sv-88 (the-as float 0.0)) + (sv-92 (the-as float -100.0)) + (sv-96 (the-as float 0.0)) + (sv-100 (new 'stack-no-clear 'rgbaf)) + (sv-104 (new 'stack-no-clear 'vector)) + ) + (if (= (-> this appearance uv-mode) 3) + (set! sv-92 (the-as float 100.0)) + ) + (let ((sv-128 (math-camera-pos)) + (sv-132 (new 'stack-no-clear 'vector)) + ) + (set! (-> this strip num-verts) (the-as uint 0)) + (set! (-> this strip tex-id) (-> this appearance tex-id)) + (cond + ((not (-> this appearance zbuffer?)) + (set! (-> this strip adnops 0 cmds) (gs-reg64 test-1)) + (set! (-> this strip data0) (new 'static 'gs-test + :ate #x1 + :atst (gs-atest greater-equal) + :aref #x80 + :afail #x1 + :zte #x1 + :ztst (gs-ztest greater-equal) + ) + ) ) - ) - (else - (set! (-> this strip adnops 0 cmds) (gs-reg64 hack)) - (set! (-> this strip data0) (new 'static 'gs-test)) - 0 - ) - ) - (let ((v1-34 (-> this appearance blend-mode))) - (cond - ((= v1-34 1) - (set! (-> this strip alpha) (new 'static 'gs-alpha :b #x2 :d #x1)) - ) - ((zero? v1-34) - (set! (-> this strip alpha) (new 'static 'gs-alpha :b #x1 :d #x1)) - ) - ((= v1-34 2) - (set! (-> this strip alpha) (new 'static 'gs-alpha :a #x2 :d #x1)) - ) - ) - ) - (when (-> this strip2) - (set! (-> this strip2 num-verts) (the-as uint 0)) - (set! (-> this strip2 tex-id) (-> this appearance tex-id)) - (cond - ((not (-> this appearance zbuffer?)) - (set! (-> this strip2 adnops 0 cmds) (gs-reg64 test-1)) - (set! (-> this strip2 data0) (new 'static 'gs-test - :ate #x1 - :atst (gs-atest greater-equal) - :aref #x80 - :afail #x1 - :zte #x1 - :ztst (gs-ztest greater-equal) - ) + (else + (set! (-> this strip adnops 0 cmds) (gs-reg64 hack)) + (set! (-> this strip data0) (new 'static 'gs-test)) + 0 + ) + ) + (let ((v1-34 (-> this appearance blend-mode))) + (cond + ((= v1-34 1) + (set! (-> this strip alpha) (new 'static 'gs-alpha :b #x2 :d #x1)) + ) + ((zero? v1-34) + (set! (-> this strip alpha) (new 'static 'gs-alpha :b #x1 :d #x1)) + ) + ((= v1-34 2) + (set! (-> this strip alpha) (new 'static 'gs-alpha :a #x2 :d #x1)) ) - ) - (else - (set! (-> this strip2 adnops 0 cmds) (gs-reg64 hack)) - (set! (-> this strip2 data0) (new 'static 'gs-test)) - 0 - ) - ) - (let ((v1-52 (-> this appearance blend-mode))) - (cond - ((= v1-52 1) - (set! (-> this strip2 alpha) (new 'static 'gs-alpha :b #x2 :d #x1)) - ) - ((zero? v1-52) - (set! (-> this strip2 alpha) (new 'static 'gs-alpha :b #x1 :d #x1)) - ) - ((= v1-52 2) - (set! (-> this strip2 alpha) (new 'static 'gs-alpha :a #x2 :d #x1)) - ) - ) - ) - ) - (countdown (s5-1 (-> s5-0 0)) - (let* ((s3-1 s5-1) - (s4-1 (the-as object (&+ (-> this crumb-array data) (* (the-as int (-> this crumb-size)) s3-1)))) - ) - (set! sv-136 - (/ (the float (+ (- (-> this start-marker) (-> (the-as light-trail-breadcrumb s4-1) birth-time)) sv-80)) - (the float sv-64) - ) ) - (when (or (< 1.0 sv-136) (< sv-136 0.0)) - ) - (when (and (>= 1.0 sv-136) (>= sv-136 0.0)) - (let* ((f30-1 (-> *dist-cache-array* s5-1)) - (f28-0 (- *total-length* f30-1)) - (f26-0 (- (-> this total-distance-traveled) f28-0)) - ) - (set! sv-140 (the-as float 1.0)) - (set! sv-144 (the-as float 1.0)) - (set! sv-148 (the-as float 1.0)) - (set! sv-152 (the-as float 0.0)) - (set! sv-156 (the-as float 0.0)) - (when (-> this appearance alpha-curve-1) - (set! sv-140 - (compute-trail-scaled-t - (-> this appearance alpha-1-mode) - sv-136 - f30-1 - f28-0 - f26-0 - (-> this appearance alpha-repeat-dist) - (the-as vector (&+ (the-as (pointer uint8) s4-1) 0)) - ) - ) - (set! sv-140 (evaluate (-> this appearance alpha-curve-1) sv-140 (loop-behavior use-default))) - ) - (when (-> this appearance alpha-curve-2) - (set! sv-144 - (compute-trail-scaled-t - (-> this appearance alpha-2-mode) - sv-136 - f30-1 - f28-0 - f26-0 - (-> this appearance alpha-repeat-dist) - (the-as vector (&+ (the-as (pointer uint8) s4-1) 0)) - ) - ) - (set! sv-144 (evaluate (-> this appearance alpha-curve-2) sv-144 (loop-behavior use-default))) - ) - (when (-> this appearance width-curve) - (set! sv-148 - (compute-trail-scaled-t - (-> this appearance width-mode) - sv-136 - f30-1 - f28-0 - f26-0 - (-> this appearance width-repeat-dist) - (the-as vector (&+ (the-as (pointer uint8) s4-1) 0)) - ) - ) - (set! sv-148 (evaluate (-> this appearance width-curve) sv-148 (loop-behavior use-default))) - ) - (set! sv-152 - (compute-trail-scaled-t - (-> this appearance uv-mode) - sv-136 - f30-1 - f28-0 - f26-0 - (-> this appearance uv-repeat-dist) - (the-as vector (&+ (the-as (pointer uint8) s4-1) 0)) - ) - ) - (when (or (< 1.0 sv-152) (< sv-152 0.0)) - (let ((f0-43 sv-152)) - (set! sv-152 (- f0-43 (the float (the int f0-43)))) + ) + (when (-> this strip2) + (set! (-> this strip2 num-verts) (the-as uint 0)) + (set! (-> this strip2 tex-id) (-> this appearance tex-id)) + (cond + ((not (-> this appearance zbuffer?)) + (set! (-> this strip2 adnops 0 cmds) (gs-reg64 test-1)) + (set! (-> this strip2 data0) (new 'static 'gs-test + :ate #x1 + :atst (gs-atest greater-equal) + :aref #x80 + :afail #x1 + :zte #x1 + :ztst (gs-ztest greater-equal) + ) + ) + ) + (else + (set! (-> this strip2 adnops 0 cmds) (gs-reg64 hack)) + (set! (-> this strip2 data0) (new 'static 'gs-test)) + 0 ) ) - (set! sv-192 (* sv-140 sv-144 (-> this appearance base-alpha))) - (set! sv-196 (* sv-148 (-> this appearance base-width))) - (set! sv-200 (new 'stack-no-clear 'vector)) - (set! sv-204 (new 'stack-no-clear 'vector)) - (when (-> this appearance color-curve) - (set! sv-156 - (compute-trail-scaled-t - (-> this appearance color-mode) - sv-136 - f30-1 - f28-0 - f26-0 - (-> this appearance color-repeat-dist) - (the-as vector (&+ (the-as (pointer uint8) s4-1) 0)) + (let ((v1-52 (-> this appearance blend-mode))) + (cond + ((= v1-52 1) + (set! (-> this strip2 alpha) (new 'static 'gs-alpha :b #x2 :d #x1)) + ) + ((zero? v1-52) + (set! (-> this strip2 alpha) (new 'static 'gs-alpha :b #x1 :d #x1)) + ) + ((= v1-52 2) + (set! (-> this strip2 alpha) (new 'static 'gs-alpha :a #x2 :d #x1)) + ) + ) + ) + ) + (countdown (s5-1 (-> s5-0 0)) + (let* ((s3-1 s5-1) + (s4-1 (the-as object (&+ (-> this crumb-array data) (* (the-as int (-> this crumb-size)) s3-1)))) + (sv-136 + (/ (the float (+ (- (-> this start-marker) (-> (the-as light-trail-breadcrumb s4-1) birth-time)) sv-80)) + (the float sv-64) + ) + ) + ) + (when (or (< 1.0 sv-136) (< sv-136 0.0)) + ) + (when (and (>= 1.0 sv-136) (>= sv-136 0.0)) + (let* ((f30-1 (-> *dist-cache-array* s5-1)) + (f28-0 (- *total-length* f30-1)) + (f26-0 (- (-> this total-distance-traveled) f28-0)) + (sv-140 (the-as float 1.0)) + (sv-144 (the-as float 1.0)) + (sv-148 (the-as float 1.0)) + (sv-152 (the-as float 0.0)) + (sv-156 (the-as float 0.0)) + ) + (when (-> this appearance alpha-curve-1) + (set! sv-140 (compute-trail-scaled-t + (-> this appearance alpha-1-mode) + sv-136 + f30-1 + f28-0 + f26-0 + (-> this appearance alpha-repeat-dist) + (the-as vector (&+ (the-as (pointer uint8) s4-1) 0)) + ) + ) + (set! sv-140 (evaluate (-> this appearance alpha-curve-1) sv-140 (loop-behavior use-default))) + ) + (when (-> this appearance alpha-curve-2) + (set! sv-144 (compute-trail-scaled-t + (-> this appearance alpha-2-mode) + sv-136 + f30-1 + f28-0 + f26-0 + (-> this appearance alpha-repeat-dist) + (the-as vector (&+ (the-as (pointer uint8) s4-1) 0)) + ) + ) + (set! sv-144 (evaluate (-> this appearance alpha-curve-2) sv-144 (loop-behavior use-default))) + ) + (when (-> this appearance width-curve) + (set! sv-148 (compute-trail-scaled-t + (-> this appearance width-mode) + sv-136 + f30-1 + f28-0 + f26-0 + (-> this appearance width-repeat-dist) + (the-as vector (&+ (the-as (pointer uint8) s4-1) 0)) + ) + ) + (set! sv-148 (evaluate (-> this appearance width-curve) sv-148 (loop-behavior use-default))) + ) + (set! sv-152 (compute-trail-scaled-t + (-> this appearance uv-mode) + sv-136 + f30-1 + f28-0 + f26-0 + (-> this appearance uv-repeat-dist) + (the-as vector (&+ (the-as (pointer uint8) s4-1) 0)) + ) + ) + (when (or (< 1.0 sv-152) (< sv-152 0.0)) + (let ((f0-43 sv-152)) + (set! sv-152 (- f0-43 (the float (the int f0-43)))) ) ) - (evaluate (-> this appearance color-curve) sv-156 (the-as rgbaf sv-200) (loop-behavior use-default)) - ) - ) - (set! (-> sv-200 w) (* (-> sv-200 w) sv-192)) - (calc-vertex-pos! this (the-as light-trail-breadcrumb s4-1) s3-1 sv-128 sv-204) - (when (or (and (= (-> this appearance uv-mode) 3) (< sv-92 sv-152)) - (and (!= (-> this appearance uv-mode) 3) (< sv-152 sv-92)) + (let ((sv-192 (* sv-140 sv-144 (-> this appearance base-alpha))) + (sv-196 (* sv-148 (-> this appearance base-width))) + (sv-200 (new 'stack-no-clear 'vector)) + (sv-204 (new 'stack-no-clear 'vector)) + ) + (when (-> this appearance color-curve) + (set! sv-156 + (compute-trail-scaled-t + (-> this appearance color-mode) + sv-136 + f30-1 + f28-0 + f26-0 + (-> this appearance color-repeat-dist) + (the-as vector (&+ (the-as (pointer uint8) s4-1) 0)) + ) + ) + (evaluate (-> this appearance color-curve) sv-156 (the-as rgbaf sv-200) (loop-behavior use-default)) + ) + (set! (-> sv-200 w) (* (-> sv-200 w) sv-192)) + (calc-vertex-pos! this (the-as light-trail-breadcrumb s4-1) s3-1 sv-128 sv-204) + (when (or (and (= (-> this appearance uv-mode) 3) (< sv-92 sv-152)) + (and (!= (-> this appearance uv-mode) 3) (< sv-152 sv-92)) + ) + (let ((s2-0 (new 'stack-no-clear 'inline-array 'vector 5))) + (set! (-> s2-0 3 z) (- sv-152)) + (set! (-> s2-0 3 w) (- sv-92 (-> s2-0 3 z))) + (set! (-> s2-0 4 x) (/ sv-92 (-> s2-0 3 w))) + (vector-lerp! (-> s2-0 0) sv-104 (the-as vector (&+ (the-as (pointer uint8) s4-1) 0)) (-> s2-0 4 x)) + (rgbaf-lerp! (the-as rgbaf (-> s2-0 2)) sv-100 (the-as rgbaf sv-200) (-> s2-0 4 x)) + (set! (-> s2-0 3 y) (lerp sv-96 sv-196 (-> s2-0 4 x))) + (vector-lerp! (-> s2-0 1) sv-132 sv-204 (-> s2-0 4 x)) + (set! (-> s2-0 3 x) (the-as float (rgba<-rgbaf (the-as rgba (-> s2-0 3 x)) (the-as rgbaf (-> s2-0 2))))) + (add-tri-pair-to-prim! this (-> s2-0 0) (the-as rgba (-> s2-0 3 x)) (-> s2-0 3 y) (-> s2-0 1) 0.0) + (add-tri-pair-to-prim! this (-> s2-0 0) (the-as rgba (-> s2-0 3 x)) (-> s2-0 3 y) (-> s2-0 1) 1.0) + ) + ) + (add-tri-pair-to-prim! + this + (the-as vector (&+ (the-as (pointer uint8) s4-1) 0)) + (rgba<-rgbaf (the-as rgba (new 'stack-no-clear 'rgbaf)) (the-as rgbaf sv-200)) + sv-196 + sv-204 + sv-152 + ) + (when (> s3-1 0) + (let ((v1-149 (&+ (-> this crumb-array data) (* (the-as int (-> this crumb-size)) (+ s3-1 -1))))) + (+! sv-88 + (vector-vector-distance (the-as vector (&+ (the-as (pointer uint8) s4-1) 0)) (the-as vector (&+ v1-149 0))) + ) + ) + ) + (set! sv-92 sv-152) + (vector-copy! sv-104 (the-as vector (&+ (the-as (pointer uint8) s4-1) 0))) + (set! sv-96 sv-196) + (set! (-> sv-100 quad) (-> sv-200 quad)) + (vector-copy! sv-132 sv-204) ) - (let ((s2-0 (new 'stack-no-clear 'inline-array 'vector 5))) - (set! (-> s2-0 3 z) (- sv-152)) - (set! (-> s2-0 3 w) (- sv-92 (-> s2-0 3 z))) - (set! (-> s2-0 4 x) (/ sv-92 (-> s2-0 3 w))) - (vector-lerp! (-> s2-0 0) sv-104 (the-as vector (&+ (the-as (pointer uint8) s4-1) 0)) (-> s2-0 4 x)) - (rgbaf-lerp! (the-as rgbaf (-> s2-0 2)) sv-100 (the-as rgbaf sv-200) (-> s2-0 4 x)) - (set! (-> s2-0 3 y) (lerp sv-96 sv-196 (-> s2-0 4 x))) - (vector-lerp! (-> s2-0 1) sv-132 sv-204 (-> s2-0 4 x)) - (set! (-> s2-0 3 x) (the-as float (rgba<-rgbaf (the-as rgba (-> s2-0 3 x)) (the-as rgbaf (-> s2-0 2))))) - (add-tri-pair-to-prim! this (-> s2-0 0) (the-as rgba (-> s2-0 3 x)) (-> s2-0 3 y) (-> s2-0 1) 0.0) - (add-tri-pair-to-prim! this (-> s2-0 0) (the-as rgba (-> s2-0 3 x)) (-> s2-0 3 y) (-> s2-0 1) 1.0) + ) + ) ) ) - (add-tri-pair-to-prim! - this - (the-as vector (&+ (the-as (pointer uint8) s4-1) 0)) - (rgba<-rgbaf (the-as rgba (new 'stack-no-clear 'rgbaf)) (the-as rgbaf sv-200)) - sv-196 - sv-204 - sv-152 - ) - (when (> s3-1 0) - (let ((v1-149 (&+ (-> this crumb-array data) (* (the-as int (-> this crumb-size)) (+ s3-1 -1))))) - (set! sv-88 - (+ sv-88 - (vector-vector-distance (the-as vector (&+ (the-as (pointer uint8) s4-1) 0)) (the-as vector (&+ v1-149 0))) - ) - ) - ) - ) - (set! sv-92 sv-152) - (vector-copy! sv-104 (the-as vector (&+ (the-as (pointer uint8) s4-1) 0))) - (set! sv-96 sv-196) - (set! (-> sv-100 quad) (-> sv-200 quad)) - (vector-copy! sv-132 sv-204) ) ) ) diff --git a/test/decompiler/reference/jak3/engine/gfx/sprite/particles/sparticle-launcher_REF.gc b/test/decompiler/reference/jak3/engine/gfx/sprite/particles/sparticle-launcher_REF.gc index 221a32b2d6..b5524b08dd 100644 --- a/test/decompiler/reference/jak3/engine/gfx/sprite/particles/sparticle-launcher_REF.gc +++ b/test/decompiler/reference/jak3/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) ) @@ -842,132 +842,127 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defun sp-relaunch-setup-fields ((arg0 object) (arg1 sparticle-launcher) (arg2 sparticle-cpuinfo) (arg3 sprite-vec-data-3d)) - (local-vars - (sv-80 (inline-array sp-field-init-spec)) - (sv-88 sp-cpuinfo-flag) - (sv-96 matrix) - (sv-100 symbol) - (sv-104 symbol) - ) - (set! sv-80 (the-as (inline-array sp-field-init-spec) (-> arg1 init-specs 0))) - (set! sv-88 (logand (-> arg2 flags) (sp-cpuinfo-flag sp-cpuinfo-flag-9 level0 level1 sp-cpuinfo-flag-12))) - (set! sv-96 (new 'stack-no-clear 'matrix)) - (set! sv-100 (the-as symbol #f)) - (set! sv-104 (the-as symbol #f)) - (set! (-> arg2 next-launcher) (the-as basic 0)) - (when (nonzero? (-> arg2 key)) - (let ((s3-0 #t)) - (cond - ((logtest? (sp-cpuinfo-flag left-multiply-quat) (-> arg2 flags)) - (quaternion->matrix sv-96 (-> arg2 key proc root quat)) - ) - ((logtest? (-> arg2 key group flags) (sp-group-flag sp12)) - (matrix-copy! sv-96 (-> arg2 key local-space-binding mat-new)) - ) - (else - (set! s3-0 #f) - ) + (let ((sv-80 (the-as (inline-array sp-field-init-spec) (-> arg1 init-specs 0))) + (sv-88 (logand (-> arg2 flags) (sp-cpuinfo-flag sp-cpuinfo-flag-9 level0 level1 sp-cpuinfo-flag-12))) + (sv-96 (new 'stack-no-clear 'matrix)) + (sv-100 (the-as symbol #f)) + (sv-104 (the-as symbol #f)) ) - (when s3-0 - (matrix-transpose! sv-96 sv-96) - (when (or (get-field-spec-by-id arg1 (sp-field-id spt-accel-x)) - (get-field-spec-by-id arg1 (sp-field-id spt-accel-y)) - (get-field-spec-by-id arg1 (sp-field-id spt-accel-z)) - ) - (set! sv-100 #t) - (vector3s-rotate*! (the-as vector3s (-> arg2 acc)) (the-as vector3s (-> arg2 acc)) sv-96) + (set! (-> arg2 next-launcher) (the-as basic 0)) + (when (nonzero? (-> arg2 key)) + (let ((s3-0 #t)) + (cond + ((logtest? (sp-cpuinfo-flag left-multiply-quat) (-> arg2 flags)) + (quaternion->matrix sv-96 (-> arg2 key proc root quat)) + ) + ((logtest? (-> arg2 key group flags) (sp-group-flag sp12)) + (matrix-copy! sv-96 (-> arg2 key local-space-binding mat-new)) + ) + (else + (set! s3-0 #f) + ) ) - (when (or (get-field-spec-by-id arg1 (sp-field-id spt-vel-x)) - (get-field-spec-by-id arg1 (sp-field-id spt-vel-y)) - (get-field-spec-by-id arg1 (sp-field-id spt-vel-z)) - ) - (set! sv-104 #t) - (vector3s-rotate*! (the-as vector3s (-> arg2 vel-sxvel)) (the-as vector3s (-> arg2 vel-sxvel)) sv-96) + (when s3-0 + (matrix-transpose! sv-96 sv-96) + (when (or (get-field-spec-by-id arg1 (sp-field-id spt-accel-x)) + (get-field-spec-by-id arg1 (sp-field-id spt-accel-y)) + (get-field-spec-by-id arg1 (sp-field-id spt-accel-z)) + ) + (set! sv-100 #t) + (vector3s-rotate*! (the-as vector3s (-> arg2 acc)) (the-as vector3s (-> arg2 acc)) sv-96) + ) + (when (or (get-field-spec-by-id arg1 (sp-field-id spt-vel-x)) + (get-field-spec-by-id arg1 (sp-field-id spt-vel-y)) + (get-field-spec-by-id arg1 (sp-field-id spt-vel-z)) + ) + (set! sv-104 #t) + (vector3s-rotate*! (the-as vector3s (-> arg2 vel-sxvel)) (the-as vector3s (-> arg2 vel-sxvel)) sv-96) + ) + (matrix-transpose! sv-96 sv-96) ) - (matrix-transpose! sv-96 sv-96) ) ) - ) - (cond - ((and (logtest? (-> arg2 flags) (sp-cpuinfo-flag sp-cpuinfo-flag-13)) - (not (logtest? (-> arg2 flags) (sp-cpuinfo-flag distort))) - (not (logtest? (-> arg2 flags) (sp-cpuinfo-flag glow))) - ) - (let ((f20-0 (-> arg3 r-g-b-a x)) - (f22-0 (-> arg3 r-g-b-a y)) - (f24-0 (-> arg3 r-g-b-a z)) - (f26-0 (-> arg2 fade x)) - (f28-0 (-> arg2 fade y)) - (f30-0 (-> arg2 fade z)) - ) - (set! (-> arg3 r-g-b-a x) 99999.0) - (set! (-> arg3 r-g-b-a y) 99999.0) - (set! (-> arg3 r-g-b-a z) 99999.0) - (set! (-> arg2 fade x) 99999.0) - (set! (-> arg2 fade y) 99999.0) - (set! (-> arg2 fade z) 99999.0) - (set! sv-80 - (sp-init-fields! - (&-> arg3 x-y-z-sx x) - sv-80 - (sp-field-id sprite-fields-start) - (sp-field-id sprite-fields-end) - #f + (set! sv-80 + (cond + ((and (logtest? (-> arg2 flags) (sp-cpuinfo-flag sp-cpuinfo-flag-13)) + (not (logtest? (-> arg2 flags) (sp-cpuinfo-flag distort))) + (not (logtest? (-> arg2 flags) (sp-cpuinfo-flag glow))) + ) + (let ((f20-0 (-> arg3 r-g-b-a x)) + (f22-0 (-> arg3 r-g-b-a y)) + (f24-0 (-> arg3 r-g-b-a z)) + (f26-0 (-> arg2 fade x)) + (f28-0 (-> arg2 fade y)) + (f30-0 (-> arg2 fade z)) + ) + (set! (-> arg3 r-g-b-a x) 99999.0) + (set! (-> arg3 r-g-b-a y) 99999.0) + (set! (-> arg3 r-g-b-a z) 99999.0) + (set! (-> arg2 fade x) 99999.0) + (set! (-> arg2 fade y) 99999.0) + (set! (-> arg2 fade z) 99999.0) + (set! sv-80 + (sp-init-fields! + (&-> arg3 x-y-z-sx x) + sv-80 + (sp-field-id sprite-fields-start) + (sp-field-id sprite-fields-end) + #f + ) + ) + (set! sv-80 + (sp-init-fields! (&-> arg2 omega) sv-80 (sp-field-id cpu-fields-start) (sp-field-id cpu-fields-end) #f) + ) + (logior! (-> arg2 flags) sv-88) + (let ((v1-54 (-> *time-of-day-context* current-prt-color))) + (if (= (-> arg3 r-g-b-a x) 99999.0) + (set! (-> arg3 r-g-b-a x) f20-0) + (set! (-> arg3 r-g-b-a x) (* (-> arg3 r-g-b-a x) (-> v1-54 x))) + ) + (if (= (-> arg3 r-g-b-a y) 99999.0) + (set! (-> arg3 r-g-b-a y) f22-0) + (set! (-> arg3 r-g-b-a y) (* (-> arg3 r-g-b-a y) (-> v1-54 y))) + ) + (if (= (-> arg3 r-g-b-a z) 99999.0) + (set! (-> arg3 r-g-b-a z) f24-0) + (set! (-> arg3 r-g-b-a z) (* (-> arg3 r-g-b-a z) (-> v1-54 z))) + ) + (if (= (-> arg2 fade x) 99999.0) + (set! (-> arg2 fade x) f26-0) + (set! (-> arg2 fade x) (* (-> arg2 fade x) (-> v1-54 x))) + ) + (if (= (-> arg2 fade y) 99999.0) + (set! (-> arg2 fade y) f28-0) + (set! (-> arg2 fade y) (* (-> arg2 fade y) (-> v1-54 y))) + ) + (if (= (-> arg2 fade z) 99999.0) + (set! (-> arg2 fade z) f30-0) + (set! (-> arg2 fade z) (* (-> arg2 fade z) (-> v1-54 z))) + ) + ) ) + sv-80 ) - (set! sv-80 - (sp-init-fields! (&-> arg2 omega) sv-80 (sp-field-id cpu-fields-start) (sp-field-id cpu-fields-end) #f) - ) - (logior! (-> arg2 flags) sv-88) - (let ((v1-54 (-> *time-of-day-context* current-prt-color))) - (if (= (-> arg3 r-g-b-a x) 99999.0) - (set! (-> arg3 r-g-b-a x) f20-0) - (set! (-> arg3 r-g-b-a x) (* (-> arg3 r-g-b-a x) (-> v1-54 x))) - ) - (if (= (-> arg3 r-g-b-a y) 99999.0) - (set! (-> arg3 r-g-b-a y) f22-0) - (set! (-> arg3 r-g-b-a y) (* (-> arg3 r-g-b-a y) (-> v1-54 y))) - ) - (if (= (-> arg3 r-g-b-a z) 99999.0) - (set! (-> arg3 r-g-b-a z) f24-0) - (set! (-> arg3 r-g-b-a z) (* (-> arg3 r-g-b-a z) (-> v1-54 z))) - ) - (if (= (-> arg2 fade x) 99999.0) - (set! (-> arg2 fade x) f26-0) - (set! (-> arg2 fade x) (* (-> arg2 fade x) (-> v1-54 x))) - ) - (if (= (-> arg2 fade y) 99999.0) - (set! (-> arg2 fade y) f28-0) - (set! (-> arg2 fade y) (* (-> arg2 fade y) (-> v1-54 y))) - ) - (if (= (-> arg2 fade z) 99999.0) - (set! (-> arg2 fade z) f30-0) - (set! (-> arg2 fade z) (* (-> arg2 fade z) (-> v1-54 z))) - ) - ) - ) - ) - (else - (set! sv-80 - (sp-init-fields! - (&-> arg3 x-y-z-sx x) - sv-80 - (sp-field-id sprite-fields-start) - (sp-field-id sprite-fields-end) - #f + (else + (set! sv-80 (sp-init-fields! + (&-> arg3 x-y-z-sx x) + sv-80 + (sp-field-id sprite-fields-start) + (sp-field-id sprite-fields-end) + #f + ) + ) + (sp-init-fields! (&-> arg2 omega) sv-80 (sp-field-id cpu-fields-start) (sp-field-id cpu-fields-end) #f) ) ) - (set! sv-80 - (sp-init-fields! (&-> arg2 omega) sv-80 (sp-field-id cpu-fields-start) (sp-field-id cpu-fields-end) #f) - ) - ) + ) + (if sv-100 + (vector3s-rotate*! (the-as vector3s (-> arg2 acc)) (the-as vector3s (-> arg2 acc)) sv-96) + ) + (if sv-104 + (vector3s-rotate*! (the-as vector3s (-> arg2 vel-sxvel)) (the-as vector3s (-> arg2 vel-sxvel)) sv-96) + ) ) - (if sv-100 - (vector3s-rotate*! (the-as vector3s (-> arg2 acc)) (the-as vector3s (-> arg2 acc)) sv-96) - ) - (if sv-104 - (vector3s-rotate*! (the-as vector3s (-> arg2 vel-sxvel)) (the-as vector3s (-> arg2 vel-sxvel)) sv-96) - ) 0 0 (none) @@ -1007,7 +1002,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) @@ -1624,7 +1619,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*) @@ -1641,17 +1635,19 @@ (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))) - (matrix-copy! s3-0 (-> a1-8 bone transform)) - (vector<-cspace! (-> s3-0 trans) a1-8) + (let ((sv-96 (-> s4-0 (-> (the-as connection v1-1) param2))) + (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))) + (matrix-copy! s3-0 (-> a1-8 bone transform)) + (vector<-cspace! (-> s3-0 trans) a1-8) + ) + (vector-copy! s2-0 (the-as vector s0-0)) + (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) ) - (vector-copy! s2-0 (the-as vector s0-0)) - (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) ) ) ) @@ -1899,7 +1895,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)) @@ -1958,7 +1954,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)) @@ -2365,7 +2361,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) ) @@ -2532,7 +2528,7 @@ (set! (-> v1-2 x) f0-0) (set! (-> v1-2 y) f1-0) (set! (-> v1-2 z) f2-0) - (set! (-> v1-2 w) (sqrtf (- (- (- 1.0 (* f2-0 f2-0)) (* f1-0 f1-0)) (* f0-0 f0-0)))) + (set! (-> v1-2 w) (sqrtf (- (- (- 1.0 (square f2-0)) (square f1-0)) (square f0-0)))) ) (quaternion->matrix (-> arg4 control origin) a1-1) ) @@ -2920,68 +2916,65 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defun spt-func-relative-pos ((arg0 sparticle-system) (arg1 sparticle-cpuinfo) (arg2 sprite-vec-data-3d)) - (local-vars - (sv-256 vector) - (sv-260 vector) - (sv-264 vector) - (sv-268 matrix) - (sv-272 matrix) - (sv-276 matrix) - (sv-280 matrix) - (sv-284 matrix) - ) (let ((v1-0 (new 'stack-no-clear 'vector))) (set! (-> v1-0 x) (-> arg2 x-y-z-sx x)) (set! (-> v1-0 y) (-> arg2 x-y-z-sx y)) (set! (-> v1-0 z) (-> arg2 x-y-z-sx z)) (set! (-> v1-0 w) 1.0) - (set! sv-256 v1-0) + (let ((sv-256 v1-0) + (v1-1 (new 'stack-no-clear 'vector)) + ) + (set! (-> v1-1 x) (-> arg1 vel-sxvel x)) + (set! (-> v1-1 y) (-> arg1 vel-sxvel y)) + (set! (-> v1-1 z) (-> arg1 vel-sxvel z)) + (set! (-> v1-1 w) 1.0) + (let ((sv-260 v1-1) + (v1-2 (new 'stack-no-clear 'vector)) + ) + (set! (-> v1-2 x) (-> arg1 acc x)) + (set! (-> v1-2 y) (-> arg1 acc y)) + (set! (-> v1-2 z) (-> arg1 acc z)) + (set! (-> v1-2 w) 1.0) + (let ((sv-264 v1-2)) + (let ((sv-268 (-> arg1 key local-space-binding mat-prev)) + (sv-272 (-> arg1 key local-space-binding mat-new)) + (sv-276 (new 'stack-no-clear 'matrix)) + ) + (let ((sv-280 (new 'stack-no-clear 'matrix)) + (sv-284 (new 'stack-no-clear 'matrix)) + ) + (matrix-copy! sv-280 sv-268) + (matrix-copy! sv-284 sv-272) + (dotimes (s4-0 3) + (vector-normalize! (the-as vector (&-> sv-280 quad s4-0)) 1.0) + (vector-normalize! (the-as vector (&-> sv-284 quad s4-0)) 1.0) + ) + (set! (-> sv-256 w) 1.0) + (set! (-> sv-260 w) 0.0) + (set! (-> sv-264 w) 0.0) + (let ((a1-6 (matrix-inverse-of-rot-trans! (new 'stack-no-clear 'matrix) sv-280))) + (matrix*! sv-276 a1-6 sv-284) + ) + ) + (vector-matrix*! sv-256 sv-256 sv-276) + (set! (-> arg2 x-y-z-sx x) (-> sv-256 x)) + (set! (-> arg2 x-y-z-sx y) (-> sv-256 y)) + (set! (-> arg2 x-y-z-sx z) (-> sv-256 z)) + (-> arg2 x-y-z-sx) + (vector-matrix*! sv-260 sv-260 sv-276) + (set! (-> arg1 vel-sxvel x) (-> sv-260 x)) + (set! (-> arg1 vel-sxvel y) (-> sv-260 y)) + (set! (-> arg1 vel-sxvel z) (-> sv-260 z)) + (-> arg1 vel-sxvel) + (vector-matrix*! sv-264 sv-264 sv-276) + ) + (set! (-> arg1 acc x) (-> sv-264 x)) + (set! (-> arg1 acc y) (-> sv-264 y)) + (set! (-> arg1 acc z) (-> sv-264 z)) + ) + ) + ) ) - (let ((v1-1 (new 'stack-no-clear 'vector))) - (set! (-> v1-1 x) (-> arg1 vel-sxvel x)) - (set! (-> v1-1 y) (-> arg1 vel-sxvel y)) - (set! (-> v1-1 z) (-> arg1 vel-sxvel z)) - (set! (-> v1-1 w) 1.0) - (set! sv-260 v1-1) - ) - (let ((v1-2 (new 'stack-no-clear 'vector))) - (set! (-> v1-2 x) (-> arg1 acc x)) - (set! (-> v1-2 y) (-> arg1 acc y)) - (set! (-> v1-2 z) (-> arg1 acc z)) - (set! (-> v1-2 w) 1.0) - (set! sv-264 v1-2) - ) - (set! sv-268 (-> arg1 key local-space-binding mat-prev)) - (set! sv-272 (-> arg1 key local-space-binding mat-new)) - (set! sv-276 (new 'stack-no-clear 'matrix)) - (set! sv-280 (new 'stack-no-clear 'matrix)) - (set! sv-284 (new 'stack-no-clear 'matrix)) - (matrix-copy! sv-280 sv-268) - (matrix-copy! sv-284 sv-272) - (dotimes (s4-0 3) - (vector-normalize! (the-as vector (&-> sv-280 quad s4-0)) 1.0) - (vector-normalize! (the-as vector (&-> sv-284 quad s4-0)) 1.0) - ) - (set! (-> sv-256 w) 1.0) - (set! (-> sv-260 w) 0.0) - (set! (-> sv-264 w) 0.0) - (let ((a1-6 (matrix-inverse-of-rot-trans! (new 'stack-no-clear 'matrix) sv-280))) - (matrix*! sv-276 a1-6 sv-284) - ) - (vector-matrix*! sv-256 sv-256 sv-276) - (set! (-> arg2 x-y-z-sx x) (-> sv-256 x)) - (set! (-> arg2 x-y-z-sx y) (-> sv-256 y)) - (set! (-> arg2 x-y-z-sx z) (-> sv-256 z)) - (-> arg2 x-y-z-sx) - (vector-matrix*! sv-260 sv-260 sv-276) - (set! (-> arg1 vel-sxvel x) (-> sv-260 x)) - (set! (-> arg1 vel-sxvel y) (-> sv-260 y)) - (set! (-> arg1 vel-sxvel z) (-> sv-260 z)) - (-> arg1 vel-sxvel) - (vector-matrix*! sv-264 sv-264 sv-276) - (set! (-> arg1 acc x) (-> sv-264 x)) - (set! (-> arg1 acc y) (-> sv-264 y)) - (set! (-> arg1 acc z) (-> sv-264 z)) (-> arg1 acc) 0 (none) diff --git a/test/decompiler/reference/jak3/engine/gfx/sprite/particles/sparticle_REF.gc b/test/decompiler/reference/jak3/engine/gfx/sprite/particles/sparticle_REF.gc index 109ef1a517..2b0ab0e7e0 100644 --- a/test/decompiler/reference/jak3/engine/gfx/sprite/particles/sparticle_REF.gc +++ b/test/decompiler/reference/jak3/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 352) - (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 352) + (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/jak3/engine/gfx/sprite/sprite-distort_REF.gc b/test/decompiler/reference/jak3/engine/gfx/sprite/sprite-distort_REF.gc index 3534fbcab5..458c7bdbba 100644 --- a/test/decompiler/reference/jak3/engine/gfx/sprite/sprite-distort_REF.gc +++ b/test/decompiler/reference/jak3/engine/gfx/sprite/sprite-distort_REF.gc @@ -155,15 +155,7 @@ ;; ERROR: Unsupported inline assembly instruction kind - [cfc2.i v1, Clipping] (defun sprite-draw-distorters ((arg0 dma-buffer)) "Generate DMA to draw all distort sprites." - (local-vars - (v1-15 float) - (v1-21 float) - (v1-26 int) - (v1-65 float) - (sv-16 sprite-vec-data-2d) - (sv-32 vector) - (sv-48 vector) - ) + (local-vars (v1-15 float) (v1-21 float) (v1-26 int) (v1-65 float)) (rlet ((acc :class vf) (Q :class vf) (vf0 :class vf) @@ -190,10 +182,11 @@ (dotimes (s1-0 s2-0) (let ((v1-5 (-> s3-0 data s1-0))) (when (= (-> v1-5 aux-type) (sprite-aux-type distort)) - (set! sv-16 (-> v1-5 vec-data)) - (let ((a0-3 (the-as object (-> arg0 base)))) - (set! sv-32 (the-as vector (&+ (the-as pointer a0-3) 16))) - (set! sv-48 (the-as vector (&+ (the-as pointer a0-3) 32))) + (let* ((sv-16 (-> v1-5 vec-data)) + (a0-3 (the-as object (-> arg0 base))) + (sv-32 (the-as vector (&+ (the-as pointer a0-3) 16))) + (sv-48 (the-as vector (&+ (the-as pointer a0-3) 32))) + ) (cond ((= (the-as int (-> sv-16 flag-rot-sy y)) 1) (.lvf vf3 (&-> *math-camera* sprite-2d rvec quad)) @@ -233,32 +226,32 @@ (set! (-> (the-as vector a0-3) w) 255.0) (set! (-> sv-32 x) (+ 0.0009765625 (* 0.001953125 (+ -1792.0 (-> (the-as vector a0-3) x))))) (set! (-> sv-32 y) (+ 0.0009765625 (* 0.001953125 (+ -1840.0 (-> (the-as vector a0-3) y))))) - ) - (set! (-> sv-32 z) 1.0) - (when (or (< (-> sv-16 flag) 3) (< 11 (-> sv-16 flag))) - (format 0 "Turns = ~D!!!~%" (-> sv-16 flag)) - (set! (-> sv-16 flag) 11) - ) - (set! (-> sv-32 w) (the-as float (-> sv-16 flag))) - (let* ((f1-4 (- (-> *math-camera* perspective uvec y))) - (f2-4 (-> sv-32 y)) - (f4-0 (+ f2-4 (* (-> sv-48 x) f1-4))) - (f3-2 256.0) - (f0-9 (-> sv-48 x)) - ) - (if (< 416.0 f4-0) - (set! f3-2 (/ (- 416.0 f2-4) f1-4)) + (set! (-> sv-32 z) 1.0) + (when (or (< (-> sv-16 flag) 3) (< 11 (-> sv-16 flag))) + (format 0 "Turns = ~D!!!~%" (-> sv-16 flag)) + (set! (-> sv-16 flag) 11) + ) + (set! (-> sv-32 w) (the-as float (-> sv-16 flag))) + (let* ((f1-4 (- (-> *math-camera* perspective uvec y))) + (f2-4 (-> sv-32 y)) + (f4-0 (+ f2-4 (* (-> sv-48 x) f1-4))) + (f3-2 256.0) + (f0-9 (-> sv-48 x)) + ) + (if (< 416.0 f4-0) + (set! f3-2 (/ (- 416.0 f2-4) f1-4)) + ) + (if (< 128.0 f3-2) + (set! f3-2 128.0) + ) + (when (< f3-2 f0-9) + (let ((v1-63 (/ f3-2 f0-9))) + (.mov vf1 v1-63) + ) + (.mul.x.vf vf2 vf2 vf1) + (.svf (&-> sv-48 quad) vf2) + (.mov v1-65 vf2) ) - (if (< 128.0 f3-2) - (set! f3-2 128.0) - ) - (when (< f3-2 f0-9) - (let ((v1-63 (/ f3-2 f0-9))) - (.mov vf1 v1-63) - ) - (.mul.x.vf vf2 vf2 vf1) - (.svf (&-> sv-48 quad) vf2) - (.mov v1-65 vf2) ) ) (&+! (-> arg0 base) 48) diff --git a/test/decompiler/reference/jak3/engine/gfx/sprite/sprite-glow_REF.gc b/test/decompiler/reference/jak3/engine/gfx/sprite/sprite-glow_REF.gc index 621a751818..988e4d9cc3 100644 --- a/test/decompiler/reference/jak3/engine/gfx/sprite/sprite-glow_REF.gc +++ b/test/decompiler/reference/jak3/engine/gfx/sprite/sprite-glow_REF.gc @@ -718,24 +718,26 @@ ;; WARN: Return type mismatch int vs none. (defmethod draw-all-sprites! ((this simple-sprite-system) (arg0 dma-buffer)) "Submit all sprites to the sprite-glow renderer" - (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/jak3/engine/gfx/sprite/sprite_REF.gc b/test/decompiler/reference/jak3/engine/gfx/sprite/sprite_REF.gc index 839decb04e..ce3883eae5 100644 --- a/test/decompiler/reference/jak3/engine/gfx/sprite/sprite_REF.gc +++ b/test/decompiler/reference/jak3/engine/gfx/sprite/sprite_REF.gc @@ -518,7 +518,7 @@ The glow and distort renderers will pull sprites from here." (set! (-> arg0 x) f0-0) (set! (-> arg0 y) f1-0) (set! (-> arg0 z) f2-0) - (set! (-> arg0 w) (sqrtf (- (- (- 1.0 (* f2-0 f2-0)) (* f1-0 f1-0)) (* f0-0 f0-0)))) + (set! (-> arg0 w) (sqrtf (- (- (- 1.0 (square f2-0)) (square f1-0)) (square f0-0)))) ) arg0 ) diff --git a/test/decompiler/reference/jak3/engine/gfx/texture/texture_REF.gc b/test/decompiler/reference/jak3/engine/gfx/texture/texture_REF.gc index ec9c2c06f3..0a8c4448ee 100644 --- a/test/decompiler/reference/jak3/engine/gfx/texture/texture_REF.gc +++ b/test/decompiler/reference/jak3/engine/gfx/texture/texture_REF.gc @@ -789,7 +789,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 (sv-16 pointer) (sv-20 uint) (sv-24 int) (sv-32 int) (sv-40 int) (sv-48 uint)) (if (not page) (return 0) ) @@ -808,57 +807,60 @@ (let* ((s3-0 (-> *display* frames (-> *display* on-screen) global-buf)) (s4-0 (-> s3-0 base)) ) - (set! sv-16 (-> page segment 0 block-data)) - (set! sv-20 (shr (-> page segment 0 dest) 12)) - (set! sv-24 (the-as int (-> page segment 0 size))) - (set! sv-32 0) - (set! sv-40 0) - (set! sv-48 (-> page id)) - (case mode - (((tex-upload-mode none)) - (return 0) - ) - (((tex-upload-mode seg0)) - ) - (((tex-upload-mode seg0-1)) - (set! sv-24 (the-as int (+ sv-24 (-> page segment 1 size)))) - ) - (((tex-upload-mode seg0-1-2)) - (set! sv-24 (the-as int (-> page size))) - ) - (((tex-upload-mode seg2)) - (set! sv-16 (-> page segment 2 block-data)) - (set! sv-20 (shr (-> page segment 2 dest) 12)) - (set! sv-24 (the-as int (-> page segment 2 size))) - ) - ) - (set! sv-24 (shr (min (the-as int (-> pool-segment size)) (the-as int (+ sv-24 4095))) 12)) - (dotimes (s1-0 sv-24) - (let ((v1-30 (+ sv-20 s1-0))) - (cond - ((zero? sv-32) - (when (!= (-> pool ids v1-30) sv-48) - (set! sv-40 s1-0) - (set! (-> pool ids v1-30) sv-48) - (set! sv-32 (+ sv-32 1)) - ) + (let ((sv-16 (-> page segment 0 block-data)) + (sv-20 (shr (-> page segment 0 dest) 12)) + (sv-24 (the-as int (-> page segment 0 size))) + (sv-32 0) + (sv-40 0) + ) + (let ((sv-48 (-> page id))) + (case mode + (((tex-upload-mode none)) + (return 0) ) - ((= (-> pool ids v1-30) sv-48) - (upload-vram-data s3-0 (the-as int (* (+ sv-20 sv-40) 64)) (&+ sv-16 (shl sv-40 14)) (* sv-32 32) 128) - (+! s5-0 sv-32) - (set! sv-32 0) - 0 + (((tex-upload-mode seg0)) ) - (else - (set! (-> pool ids v1-30) sv-48) - (set! sv-32 (+ sv-32 1)) + (((tex-upload-mode seg0-1)) + (set! sv-24 (the-as int (+ (the-as uint sv-24) (-> page segment 1 size)))) + ) + (((tex-upload-mode seg0-1-2)) + (set! sv-24 (the-as int (-> page size))) + ) + (((tex-upload-mode seg2)) + (set! sv-16 (-> page segment 2 block-data)) + (set! sv-20 (shr (-> page segment 2 dest) 12)) + (set! sv-24 (the-as int (-> page segment 2 size))) + ) + ) + (set! sv-24 (shr (min (the-as int (-> pool-segment size)) (the-as int (+ (the-as uint sv-24) 4095))) 12)) + (dotimes (s1-0 sv-24) + (let ((v1-30 (+ sv-20 s1-0))) + (cond + ((zero? sv-32) + (when (!= (-> pool ids v1-30) sv-48) + (set! sv-40 s1-0) + (set! (-> pool ids v1-30) sv-48) + (+! sv-32 1) + ) + ) + ((= (-> pool ids v1-30) sv-48) + (upload-vram-data s3-0 (the-as int (* (+ sv-20 sv-40) 64)) (&+ sv-16 (shl sv-40 14)) (* sv-32 32) 128) + (+! s5-0 sv-32) + (set! sv-32 0) + 0 + ) + (else + (set! (-> pool ids v1-30) sv-48) + (+! sv-32 1) + ) + ) ) ) ) - ) - (when (nonzero? sv-32) - (upload-vram-data s3-0 (the-as int (* (+ sv-20 sv-40) 64)) (&+ sv-16 (shl sv-40 14)) (* sv-32 32) 128) - (+! s5-0 sv-32) + (when (nonzero? sv-32) + (upload-vram-data s3-0 (the-as int (* (+ sv-20 sv-40) 64)) (&+ sv-16 (shl sv-40 14)) (* sv-32 32) 128) + (+! s5-0 sv-32) + ) ) (dma-buffer-add-gs-set s3-0 (texflush 1)) (let ((a3-3 (-> s3-0 base))) @@ -951,7 +953,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 (sv-16 pointer) (sv-20 uint) (sv-24 int) (sv-32 int) (sv-40 int) (sv-48 uint) (sv-52 symbol)) (if (not page) (return 0) ) @@ -970,42 +971,45 @@ (let* ((s3-0 (-> *display* frames (-> *display* on-screen) global-buf)) (s4-0 (-> s3-0 base)) ) - (set! sv-16 (-> page segment 0 block-data)) - (set! sv-20 (shr (-> page segment 0 dest) 12)) - (set! sv-24 (the-as int (-> page size))) - (set! sv-32 0) - (set! sv-40 0) - (set! sv-48 (-> page id)) - (set! sv-24 (shr (min (the-as int (-> pool-segment size)) (the-as int (+ sv-24 4095))) 12)) - (dotimes (s0-0 sv-24) - (let ((v1-19 (+ sv-20 s0-0))) - (let ((a1-1 (-> mask (/ s0-0 32)))) - (set! sv-52 (logtest? a1-1 (ash 1 (logand s0-0 31)))) + (let ((sv-16 (-> page segment 0 block-data)) + (sv-20 (shr (-> page segment 0 dest) 12)) + (sv-24 (the-as int (-> page size))) + (sv-32 0) + (sv-40 0) ) - (cond - ((zero? sv-32) - (when (and (!= (-> pool ids v1-19) sv-48) sv-52) - (set! sv-40 s0-0) - (set! (-> pool ids v1-19) sv-48) - (set! sv-32 (+ sv-32 1)) - ) - ) - ((or (= (-> pool ids v1-19) sv-48) (not sv-52)) - (upload-vram-data s3-0 (the-as int (* (+ sv-20 sv-40) 64)) (&+ sv-16 (shl sv-40 14)) (* sv-32 32) 128) - (+! s5-0 sv-32) - (set! sv-32 0) - 0 - ) - (else - (set! (-> pool ids v1-19) sv-48) - (set! sv-32 (+ sv-32 1)) + (let ((sv-48 (-> page id))) + (set! sv-24 (shr (min (the-as int (-> pool-segment size)) (the-as int (+ (the-as uint sv-24) 4095))) 12)) + (dotimes (s0-0 sv-24) + (let* ((v1-19 (+ sv-20 s0-0)) + (a1-1 (-> mask (/ s0-0 32))) + (sv-52 (logtest? a1-1 (ash 1 (logand s0-0 31)))) + ) + (cond + ((zero? sv-32) + (when (and (!= (-> pool ids v1-19) sv-48) sv-52) + (set! sv-40 s0-0) + (set! (-> pool ids v1-19) sv-48) + (+! sv-32 1) + ) + ) + ((or (= (-> pool ids v1-19) sv-48) (not sv-52)) + (upload-vram-data s3-0 (the-as int (* (+ sv-20 sv-40) 64)) (&+ sv-16 (shl sv-40 14)) (* sv-32 32) 128) + (+! s5-0 sv-32) + (set! sv-32 0) + 0 + ) + (else + (set! (-> pool ids v1-19) sv-48) + (+! sv-32 1) + ) + ) ) ) ) - ) - (when (nonzero? sv-32) - (upload-vram-data s3-0 (the-as int (* (+ sv-20 sv-40) 64)) (&+ sv-16 (shl sv-40 14)) (* sv-32 32) 128) - (+! s5-0 sv-32) + (when (nonzero? sv-32) + (upload-vram-data s3-0 (the-as int (* (+ sv-20 sv-40) 64)) (&+ sv-16 (shl sv-40 14)) (* sv-32 32) 128) + (+! s5-0 sv-32) + ) ) (dma-buffer-add-gs-set s3-0 (texflush 1)) (let ((a3-13 (-> s3-0 base))) @@ -1594,9 +1598,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 ) @@ -1610,16 +1613,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 @@ -1716,88 +1720,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 #xc) 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) (the-as pointer (+ (+ (-> v1-6 allocated-length) 28) (the-as int v1-6)))) - ) - (let ((s2-0 (get-texture font.12lo gamefont)) - (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 (get-texture font.12hi gamefont)) - (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 (get-texture font.24lo gamefont)) - (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 (get-texture font.24hi gamefont)) - (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 (get-texture font.24lo2 gamefont)) - (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 (get-texture font.24hi2 gamefont)) - (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-30 s4-0) - (a0-32 (-> v1-30 base)) - ) - (set! (-> (the-as (pointer int64) a0-32)) #x70000000) - (set! (-> (the-as (pointer uint64) a0-32) 1) (the-as uint 0)) - (set! (-> v1-30 base) (&+ 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 #xc) 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) (the-as pointer (+ (+ (-> v1-6 allocated-length) 28) (the-as int v1-6)))) + ) + (let ((s2-0 (get-texture font.12lo gamefont)) + (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 (get-texture font.12hi gamefont)) + (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 (get-texture font.24lo gamefont)) + (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 (get-texture font.24hi gamefont)) + (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 (get-texture font.24lo2 gamefont)) + (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 (get-texture font.24hi2 gamefont)) + (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-30 s4-0) + (a0-32 (-> v1-30 base)) + ) + (set! (-> (the-as (pointer int64) a0-32)) #x70000000) + (set! (-> (the-as (pointer uint64) a0-32) 1) (the-as uint 0)) + (set! (-> v1-30 base) (&+ 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) @@ -1988,18 +1990,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) + ) ) ) ) @@ -2013,16 +2015,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)) + ) + ) ) ) ) @@ -2057,16 +2059,16 @@ ;; WARN: Return type mismatch int vs texture-id. (defun lookup-tex-id-from-texture ((tex texture)) "Get the texture ID of a given texture. Slow." - (local-vars (sv-16 texture-page-dir)) - (set! sv-16 *texture-page-dir*) - (dotimes (v1-1 (-> sv-16 length)) - (let ((a1-2 (-> sv-16 entries v1-1 page))) - (when a1-2 - (dotimes (a2-3 (-> a1-2 length)) - (let ((a3-2 (-> a1-2 data a2-3))) - (if (and a3-2 (= a3-2 tex)) - (return (new 'static 'texture-id :page v1-1 :index a2-3)) - ) + (let ((sv-16 *texture-page-dir*)) + (dotimes (v1-1 (-> sv-16 length)) + (let ((a1-2 (-> sv-16 entries v1-1 page))) + (when a1-2 + (dotimes (a2-3 (-> a1-2 length)) + (let ((a3-2 (-> a1-2 data a2-3))) + (if (and a3-2 (= a3-2 tex)) + (return (new 'static 'texture-id :page v1-1 :index a2-3)) + ) + ) ) ) ) diff --git a/test/decompiler/reference/jak3/engine/level/level_REF.gc b/test/decompiler/reference/jak3/engine/level/level_REF.gc index 3442752903..85a35b65cf 100644 --- a/test/decompiler/reference/jak3/engine/level/level_REF.gc +++ b/test/decompiler/reference/jak3/engine/level/level_REF.gc @@ -665,7 +665,6 @@ (defmethod load-continue ((this level)) "Main function to run level loading/linking. Called by the engine to make progress on loading levels." - (local-vars (sv-16 symbol)) (when (-> this linking) (when (nonzero? (link-resume)) (set! (-> this linking) #f) @@ -711,8 +710,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 dgo-header s5-0)) (+! (-> *level* load-size) (-> (the-as (pointer uint32) s5-0))) @@ -928,15 +928,6 @@ ;; definition for method 18 of type level (defmethod load-begin ((this level)) "Start loading data of a level." - (local-vars - (sv-16 level) - (memory-unused? (function level-group int symbol)) - (sv-24 int) - (mask int) - (sv-40 int) - (sv-48 int) - (sv-56 int) - ) (dotimes (v1-0 5) (set! (-> this borrow-level v1-0) #f) ) @@ -944,18 +935,19 @@ (set! (-> this memory-mask) (the-as uint 0)) (let ((mem-mode (-> this info memory-mode))) (dotimes (v1-4 10) - (set! sv-16 (-> *level* level v1-4)) - (when (and (or (= (-> sv-16 status) 'active) (= (-> sv-16 status) 'loaded)) (-> sv-16 info borrow)) - (dotimes (a0-16 5) - (when (and (-> sv-16 info borrow borrow-info a0-16) - (= (car (-> sv-16 info borrow borrow-info a0-16)) (-> this name)) - (nonzero? (-> sv-16 info borrow borrow-size a0-16)) - ) - (when (!= mem-mode (level-memory-mode borrow)) - (format 0 "WARNING: level ~A upgraded to borrow~%" (-> this name)) - (set! mem-mode (level-memory-mode borrow)) + (let ((sv-16 (-> *level* level v1-4))) + (when (and (or (= (-> sv-16 status) 'active) (= (-> sv-16 status) 'loaded)) (-> sv-16 info borrow)) + (dotimes (a0-16 5) + (when (and (-> sv-16 info borrow borrow-info a0-16) + (= (car (-> sv-16 info borrow borrow-info a0-16)) (-> this name)) + (nonzero? (-> sv-16 info borrow borrow-size a0-16)) + ) + (when (!= mem-mode (level-memory-mode borrow)) + (format 0 "WARNING: level ~A upgraded to borrow~%" (-> this name)) + (set! mem-mode (level-memory-mode borrow)) + ) + (goto cfg-28) ) - (goto cfg-28) ) ) ) @@ -973,591 +965,594 @@ (level-find-borrow-slot this mem-mode) ) (else - (set! memory-unused? (lambda ((arg0 level-group) (arg1 int)) - (dotimes (v1-0 11) - (if (logtest? (-> arg0 level v1-0 memory-mask) arg1) - (return #f) - ) - ) - #t - ) - ) - (set! sv-24 0) - (set! mask 0) - (set! sv-40 0) - (dotimes (v1-15 10) - (let ((lev (-> *level* level v1-15))) - (when (and (or (= (-> lev status) 'active) (= (-> lev status) 'loaded)) - (or (= (-> lev info memory-mode) (level-memory-mode micro)) - (= (-> lev info memory-mode) (level-memory-mode city-tiny-edge)) - ) - ) - (case (-> lev info memory-mode) - (((level-memory-mode city-tiny-edge)) - (set! mask (if (or (= (-> lev memory-mask) 60) (= (-> lev memory-mask) #x3c000)) - 3 - #x30000 + (let ((memory-unused? (lambda ((arg0 level-group) (arg1 int)) + (dotimes (v1-0 11) + (if (logtest? (-> arg0 level v1-0 memory-mask) arg1) + (return #f) + ) + ) + #t ) + ) + (sv-24 0) + (mask 0) + (sv-40 0) + ) + (dotimes (v1-15 10) + (let ((lev (-> *level* level v1-15))) + (when (and (or (= (-> lev status) 'active) (= (-> lev status) 'loaded)) + (or (= (-> lev info memory-mode) (level-memory-mode micro)) + (= (-> lev info memory-mode) (level-memory-mode city-tiny-edge)) + ) + ) + (case (-> lev info memory-mode) + (((level-memory-mode city-tiny-edge)) + (set! mask (if (or (= (-> lev memory-mask) 60) (= (-> lev memory-mask) #x3c000)) + 3 + #x30000 + ) + ) + (if (zero? sv-40) + (set! sv-40 (if (or (= (-> lev memory-mask) 15) (= (-> lev memory-mask) #x3c000)) + #x3c000 + 60 + ) + ) ) - (if (zero? sv-40) - (set! sv-40 (if (or (= (-> lev memory-mask) 15) (= (-> lev memory-mask) #x3c000)) - #x3c000 - 60 - ) - ) - ) - ) - (((level-memory-mode micro)) - (set! mask (the-as int (-> lev memory-mask))) - ) + ) + (((level-memory-mode micro)) + (set! mask (the-as int (-> lev memory-mask))) + ) + ) ) ) ) - ) - (let ((v1-18 mem-mode)) - (set! sv-48 (cond - ((= v1-18 (level-memory-mode large)) - #xbd0000 - ) - ((= v1-18 (level-memory-mode medium)) - #x8fb800 - ) - ((or (= v1-18 (level-memory-mode small-center)) (= v1-18 (level-memory-mode city-center))) - #x627000 - ) - ((or (= v1-18 (level-memory-mode city-tiny-edge)) - (= v1-18 (level-memory-mode tiny-center)) - (= v1-18 (level-memory-mode tiny-edge)) - (= v1-18 (level-memory-mode tiny)) - ) - #x3f0000 - ) - ((= v1-18 (level-memory-mode micro)) - #x1f8000 - ) - ((= v1-18 (level-memory-mode tiny-center-micro)) - #x2f4000 - ) - ((= v1-18 (level-memory-mode tiny-center-small)) - #x4ec000 - ) - (else - #x5e8000 + (let* ((v1-18 mem-mode) + (sv-48 (cond + ((= v1-18 (level-memory-mode large)) + #xbd0000 + ) + ((= v1-18 (level-memory-mode medium)) + #x8fb800 + ) + ((or (= v1-18 (level-memory-mode small-center)) (= v1-18 (level-memory-mode city-center))) + #x627000 + ) + ((or (= v1-18 (level-memory-mode city-tiny-edge)) + (= v1-18 (level-memory-mode tiny-center)) + (= v1-18 (level-memory-mode tiny-edge)) + (= v1-18 (level-memory-mode tiny)) + ) + #x3f0000 + ) + ((= v1-18 (level-memory-mode micro)) + #x1f8000 + ) + ((= v1-18 (level-memory-mode tiny-center-micro)) + #x2f4000 + ) + ((= v1-18 (level-memory-mode tiny-center-small)) + #x4ec000 + ) + (else + #x5e8000 + ) ) ) - ) - ) - (set! sv-56 0) - (case mem-mode - (((level-memory-mode large)) - (case mask - ((3) - (let ((s4-0 #x3ffc0)) - (when (memory-unused? *level* s4-0) - (set! sv-24 48) - (set! sv-56 s4-0) - (goto cfg-322) - ) - ) - (let ((s4-1 #x3ffc)) - (when (memory-unused? *level* s4-1) - (set! sv-24 16) - (set! sv-56 s4-1) - (goto cfg-322) - ) - ) - ) - ((#x30000) - (let ((s4-2 4095)) - (when (memory-unused? *level* s4-2) - (set! sv-24 0) - (set! sv-56 s4-2) - (goto cfg-322) - ) - ) - (let ((s4-3 #xfff0)) - (when (memory-unused? *level* s4-3) - (set! sv-24 32) - (set! sv-56 s4-3) - (goto cfg-322) - ) - ) - ) - (else - (let ((s4-4 4095)) - (when (memory-unused? *level* s4-4) - (set! sv-24 0) - (set! sv-56 s4-4) - (goto cfg-322) - ) + (sv-56 0) ) - (let ((s4-5 #x3ffc0)) - (when (memory-unused? *level* s4-5) - (set! sv-24 48) - (set! sv-56 s4-5) - (goto cfg-322) - ) - ) - ) - ) - ) - (((level-memory-mode medium)) - (let ((s4-6 511)) - (when (memory-unused? *level* s4-6) - (set! sv-24 0) - (set! sv-56 s4-6) - (goto cfg-322) - ) - ) - (let ((s4-7 #x3fe00)) - (when (memory-unused? *level* s4-7) - (set! sv-24 73) - (set! sv-56 s4-7) - (goto cfg-322) - ) - ) - ) - (((level-memory-mode small-center)) - (case mask - ((3) - (case sv-40 - ((#x3c000) - (let ((s4-8 #x3f00)) - (when (memory-unused? *level* s4-8) - (set! sv-24 64) - (set! sv-56 s4-8) - (goto cfg-322) - ) - ) - ) - (else - (let ((s4-9 4032)) - (when (memory-unused? *level* s4-9) + (case mem-mode + (((level-memory-mode large)) + (case mask + ((3) + (let ((s4-0 #x3ffc0)) + (when (memory-unused? *level* s4-0) (set! sv-24 48) - (set! sv-56 s4-9) + (set! sv-56 s4-0) + (goto cfg-322) + ) + ) + (let ((s4-1 #x3ffc)) + (when (memory-unused? *level* s4-1) + (set! sv-24 16) + (set! sv-56 s4-1) (goto cfg-322) ) ) ) - ) - ) - ((#x30000) - (case sv-40 - ((#x3c000) - (let ((s4-10 1008)) - (when (memory-unused? *level* s4-10) - (set! sv-24 32) - (set! sv-56 s4-10) - (goto cfg-322) - ) - ) - ) - (else - (let ((s4-11 4032)) - (when (memory-unused? *level* s4-11) - (set! sv-24 48) - (set! sv-56 s4-11) - (goto cfg-322) - ) - ) - ) - ) - ) - (else - (let ((s4-12 4032)) - (when (memory-unused? *level* s4-12) - (set! sv-24 48) - (set! sv-56 s4-12) - (goto cfg-322) - ) - ) - ) - ) - ) - (((level-memory-mode city-center)) - (let ((s4-13 4032)) - (when (memory-unused? *level* s4-13) - (set! sv-24 48) - (set! sv-56 s4-13) - (goto cfg-322) - ) - ) - ) - (((level-memory-mode small-edge)) - (case mask - ((3) - (case sv-40 - ((#x3c000) - (let ((s4-14 252)) - (when (memory-unused? *level* s4-14) - (set! sv-24 16) - (set! sv-56 s4-14) - (goto cfg-322) - ) - ) - (let ((s4-15 #x3f00)) - (when (memory-unused? *level* s4-15) - (set! sv-24 64) - (set! sv-56 s4-15) - (goto cfg-322) - ) - ) - ) - (else - (let ((s4-16 #x3f000)) - (when (memory-unused? *level* s4-16) - (set! sv-24 98) - (set! sv-56 s4-16) - (goto cfg-322) - ) - ) - (let ((s4-17 4032)) - (when (memory-unused? *level* s4-17) - (set! sv-24 48) - (set! sv-56 s4-17) - (goto cfg-322) - ) - ) - ) - ) - ) - ((#x30000) - (case sv-40 - ((#x3c000) - (let ((s4-18 #xfc00)) - (when (memory-unused? *level* s4-18) - (set! sv-24 82) - (set! sv-56 s4-18) - (goto cfg-322) - ) - ) - (let ((s4-19 1008)) - (when (memory-unused? *level* s4-19) - (set! sv-24 32) - (set! sv-56 s4-19) - (goto cfg-322) - ) - ) - ) - (else - (let ((s4-20 63)) - (when (memory-unused? *level* s4-20) + ((#x30000) + (let ((s4-2 4095)) + (when (memory-unused? *level* s4-2) (set! sv-24 0) - (set! sv-56 s4-20) + (set! sv-56 s4-2) (goto cfg-322) ) ) - (let ((s4-21 4032)) - (when (memory-unused? *level* s4-21) - (set! sv-24 48) - (set! sv-56 s4-21) + (let ((s4-3 #xfff0)) + (when (memory-unused? *level* s4-3) + (set! sv-24 32) + (set! sv-56 s4-3) (goto cfg-322) ) ) ) - ) - ) - (else - (let ((s4-22 63)) - (when (memory-unused? *level* s4-22) - (set! sv-24 0) - (set! sv-56 s4-22) - (goto cfg-322) - ) - ) - (let ((s4-23 #x3f000)) - (when (memory-unused? *level* s4-23) - (set! sv-24 98) - (set! sv-56 s4-23) - (goto cfg-322) - ) - ) - ) - ) - ) - (((level-memory-mode micro)) - (let ((s4-24 3)) - (when (memory-unused? *level* s4-24) - (set! sv-24 0) - (set! sv-56 s4-24) - (goto cfg-322) - ) - ) - (let ((s4-25 #x30000)) - (when (memory-unused? *level* s4-25) - (set! sv-24 130) - (set! sv-56 s4-25) - (goto cfg-322) - ) - ) - ) - (((level-memory-mode tiny-edge) (level-memory-mode city-tiny-edge)) - (let ((v1-126 mask)) - (cond - ((or (zero? v1-126) (= v1-126 3)) - (let ((s4-26 60)) - (when (memory-unused? *level* s4-26) - (set! sv-24 16) - (set! sv-56 s4-26) - (goto cfg-322) - ) - ) - (let ((s4-27 #x3c000)) - (when (memory-unused? *level* s4-27) - (set! sv-24 114) - (set! sv-56 s4-27) - (goto cfg-322) - ) - ) - ) - ((= v1-126 #x30000) - (let ((s4-28 #xf000)) - (when (memory-unused? *level* s4-28) - (set! sv-24 98) - (set! sv-56 s4-28) - (goto cfg-322) - ) - ) - (let ((s4-29 15)) - (when (memory-unused? *level* s4-29) - (set! sv-24 0) - (set! sv-56 s4-29) - (goto cfg-322) - ) - ) - ) - ) - ) - ) - (((level-memory-mode tiny)) - (let ((v1-143 mask)) - (cond - ((or (zero? v1-143) (= v1-143 3)) - (let ((s4-30 60)) - (when (memory-unused? *level* s4-30) - (set! sv-24 16) - (set! sv-56 s4-30) - (goto cfg-322) - ) - ) - (let ((s4-31 #x3c000)) - (when (memory-unused? *level* s4-31) - (set! sv-24 114) - (set! sv-56 s4-31) - (goto cfg-322) - ) - ) - (let ((s4-32 #x3c00)) - (when (memory-unused? *level* s4-32) - (set! sv-24 82) - (set! sv-56 s4-32) - (goto cfg-322) - ) - ) - (let ((s4-33 960)) - (when (memory-unused? *level* s4-33) - (set! sv-24 48) - (set! sv-56 s4-33) - (goto cfg-322) - ) - ) - ) - ((= v1-143 #x30000) - (let ((s4-34 #xf000)) - (when (memory-unused? *level* s4-34) - (set! sv-24 98) - (set! sv-56 s4-34) - (goto cfg-322) - ) - ) - (let ((s4-35 15)) - (when (memory-unused? *level* s4-35) - (set! sv-24 0) - (set! sv-56 s4-35) - (goto cfg-322) - ) - ) - (let ((s4-36 240)) - (when (memory-unused? *level* s4-36) - (set! sv-24 32) - (set! sv-56 s4-36) - (goto cfg-322) - ) - ) - (let ((s4-37 3840)) - (when (memory-unused? *level* s4-37) - (set! sv-24 64) - (set! sv-56 s4-37) - (goto cfg-322) - ) - ) - ) - ) - ) - ) - (((level-memory-mode tiny-center)) - (let ((v1-176 mask)) - (cond - ((or (zero? v1-176) (= v1-176 3)) - (let ((s4-38 #x3c00)) - (when (memory-unused? *level* s4-38) - (set! sv-24 82) - (set! sv-56 s4-38) - (goto cfg-322) - ) - ) - (let ((s4-39 960)) - (when (memory-unused? *level* s4-39) - (set! sv-24 48) - (set! sv-56 s4-39) - (goto cfg-322) - ) - ) - ) - ((= v1-176 #x30000) - (let ((s4-40 240)) - (when (memory-unused? *level* s4-40) - (set! sv-24 32) - (set! sv-56 s4-40) - (goto cfg-322) - ) - ) - (let ((s4-41 3840)) - (when (memory-unused? *level* s4-41) - (set! sv-24 64) - (set! sv-56 s4-41) - (goto cfg-322) - ) - ) - ) - ) - ) - ) - (((level-memory-mode tiny-center-small)) - (let ((v1-194 mask)) - (cond - ((or (zero? v1-194) (= v1-194 3)) - (let ((s4-42 #x3e00)) - (when (memory-unused? *level* s4-42) - (set! sv-24 72) - (set! sv-56 s4-42) - (goto cfg-322) - ) - ) - (let ((s4-43 1984)) - (when (memory-unused? *level* s4-43) - (set! sv-24 48) - (set! sv-56 s4-43) - (goto cfg-322) - ) - ) - ) - ((= v1-194 #x30000) - (let ((s4-44 496)) - (when (memory-unused? *level* s4-44) - (set! sv-24 32) - (set! sv-56 s4-44) - (goto cfg-322) - ) - ) - (let ((s4-45 3968)) - (when (memory-unused? *level* s4-45) - (set! sv-24 56) - (set! sv-56 s4-45) - (goto cfg-322) - ) - ) - ) - ) - ) - ) - (((level-memory-mode tiny-center-micro)) - (let ((v1-213 mask)) - (cond - ((or (zero? v1-213) (= v1-213 3)) - (let ((s4-46 448)) - (when (memory-unused? *level* s4-46) - (set! sv-24 48) - (set! sv-56 s4-46) - (goto cfg-322) - ) - ) - (let ((s4-47 #x3800)) - (when (memory-unused? *level* s4-47) - (set! sv-24 90) - (set! sv-56 s4-47) - (goto cfg-322) - ) - ) - ) - ((= v1-213 #x30000) - (let ((s4-48 3584)) - (when (memory-unused? *level* s4-48) - (set! sv-24 72) - (set! sv-56 s4-48) - (goto cfg-322) - ) - ) - (let ((s4-49 112)) - (when (memory-unused? *level* s4-49) - (set! sv-24 32) - (set! sv-56 s4-49) - (goto cfg-322) - ) - ) - ) - ) - ) - ) - ) - (label cfg-322) - (cond - ((zero? sv-56) - (format - 0 - "ERROR: level ~A could not find free ~S bank in the level-group heap (micro ~X tiny ~X)~%" - (-> this name) - (level-memory-mode->string mem-mode) - mask - sv-40 - ) - (dotimes (s5-1 11) - (let ((s4-51 (-> *level* level s5-1))) - (when (!= (-> s4-51 status) 'inactive) - (format 0 "~Tlevel ~2D ~16S " s5-1 (-> s4-51 name)) - (format - 0 - "~16S bits #b~18,'0B~%" - (if (nonzero? (-> s4-51 info)) - (level-memory-mode->string (-> s4-51 info memory-mode)) + (else + (let ((s4-4 4095)) + (when (memory-unused? *level* s4-4) + (set! sv-24 0) + (set! sv-56 s4-4) + (goto cfg-322) ) - (-> s4-51 memory-mask) + ) + (let ((s4-5 #x3ffc0)) + (when (memory-unused? *level* s4-5) + (set! sv-24 48) + (set! sv-56 s4-5) + (goto cfg-322) + ) + ) ) ) ) - ) - #t - (break!) - 0 - ) - (else - (set! (-> this memory-mask) (the-as uint sv-56)) - (format 0 "lev ~A ~X micro ~X tiny ~X~%" (-> this name) (-> this memory-mask) mask sv-40) - (cond - ((= (&- (-> *level* heap top) (the-as uint (-> *level* heap base))) #x1af2800) - (let ((v1-245 (-> this heap))) - (set! (-> v1-245 base) (&+ (-> *level* heap base) (* #x2f400 sv-24))) - (set! (-> v1-245 current) (-> v1-245 base)) - (set! (-> v1-245 top-base) (&+ (-> v1-245 base) (+ sv-48 (/ sv-48 2)))) - (set! (-> v1-245 top) (-> v1-245 top-base)) + (((level-memory-mode medium)) + (let ((s4-6 511)) + (when (memory-unused? *level* s4-6) + (set! sv-24 0) + (set! sv-56 s4-6) + (goto cfg-322) + ) ) + (let ((s4-7 #x3fe00)) + (when (memory-unused? *level* s4-7) + (set! sv-24 73) + (set! sv-56 s4-7) + (goto cfg-322) + ) + ) + ) + (((level-memory-mode small-center)) + (case mask + ((3) + (case sv-40 + ((#x3c000) + (let ((s4-8 #x3f00)) + (when (memory-unused? *level* s4-8) + (set! sv-24 64) + (set! sv-56 s4-8) + (goto cfg-322) + ) + ) + ) + (else + (let ((s4-9 4032)) + (when (memory-unused? *level* s4-9) + (set! sv-24 48) + (set! sv-56 s4-9) + (goto cfg-322) + ) + ) + ) + ) + ) + ((#x30000) + (case sv-40 + ((#x3c000) + (let ((s4-10 1008)) + (when (memory-unused? *level* s4-10) + (set! sv-24 32) + (set! sv-56 s4-10) + (goto cfg-322) + ) + ) + ) + (else + (let ((s4-11 4032)) + (when (memory-unused? *level* s4-11) + (set! sv-24 48) + (set! sv-56 s4-11) + (goto cfg-322) + ) + ) + ) + ) + ) + (else + (let ((s4-12 4032)) + (when (memory-unused? *level* s4-12) + (set! sv-24 48) + (set! sv-56 s4-12) + (goto cfg-322) + ) + ) + ) + ) + ) + (((level-memory-mode city-center)) + (let ((s4-13 4032)) + (when (memory-unused? *level* s4-13) + (set! sv-24 48) + (set! sv-56 s4-13) + (goto cfg-322) + ) + ) + ) + (((level-memory-mode small-edge)) + (case mask + ((3) + (case sv-40 + ((#x3c000) + (let ((s4-14 252)) + (when (memory-unused? *level* s4-14) + (set! sv-24 16) + (set! sv-56 s4-14) + (goto cfg-322) + ) + ) + (let ((s4-15 #x3f00)) + (when (memory-unused? *level* s4-15) + (set! sv-24 64) + (set! sv-56 s4-15) + (goto cfg-322) + ) + ) + ) + (else + (let ((s4-16 #x3f000)) + (when (memory-unused? *level* s4-16) + (set! sv-24 98) + (set! sv-56 s4-16) + (goto cfg-322) + ) + ) + (let ((s4-17 4032)) + (when (memory-unused? *level* s4-17) + (set! sv-24 48) + (set! sv-56 s4-17) + (goto cfg-322) + ) + ) + ) + ) + ) + ((#x30000) + (case sv-40 + ((#x3c000) + (let ((s4-18 #xfc00)) + (when (memory-unused? *level* s4-18) + (set! sv-24 82) + (set! sv-56 s4-18) + (goto cfg-322) + ) + ) + (let ((s4-19 1008)) + (when (memory-unused? *level* s4-19) + (set! sv-24 32) + (set! sv-56 s4-19) + (goto cfg-322) + ) + ) + ) + (else + (let ((s4-20 63)) + (when (memory-unused? *level* s4-20) + (set! sv-24 0) + (set! sv-56 s4-20) + (goto cfg-322) + ) + ) + (let ((s4-21 4032)) + (when (memory-unused? *level* s4-21) + (set! sv-24 48) + (set! sv-56 s4-21) + (goto cfg-322) + ) + ) + ) + ) + ) + (else + (let ((s4-22 63)) + (when (memory-unused? *level* s4-22) + (set! sv-24 0) + (set! sv-56 s4-22) + (goto cfg-322) + ) + ) + (let ((s4-23 #x3f000)) + (when (memory-unused? *level* s4-23) + (set! sv-24 98) + (set! sv-56 s4-23) + (goto cfg-322) + ) + ) + ) + ) + ) + (((level-memory-mode micro)) + (let ((s4-24 3)) + (when (memory-unused? *level* s4-24) + (set! sv-24 0) + (set! sv-56 s4-24) + (goto cfg-322) + ) + ) + (let ((s4-25 #x30000)) + (when (memory-unused? *level* s4-25) + (set! sv-24 130) + (set! sv-56 s4-25) + (goto cfg-322) + ) + ) + ) + (((level-memory-mode tiny-edge) (level-memory-mode city-tiny-edge)) + (let ((v1-126 mask)) + (cond + ((or (zero? v1-126) (= v1-126 3)) + (let ((s4-26 60)) + (when (memory-unused? *level* s4-26) + (set! sv-24 16) + (set! sv-56 s4-26) + (goto cfg-322) + ) + ) + (let ((s4-27 #x3c000)) + (when (memory-unused? *level* s4-27) + (set! sv-24 114) + (set! sv-56 s4-27) + (goto cfg-322) + ) + ) + ) + ((= v1-126 #x30000) + (let ((s4-28 #xf000)) + (when (memory-unused? *level* s4-28) + (set! sv-24 98) + (set! sv-56 s4-28) + (goto cfg-322) + ) + ) + (let ((s4-29 15)) + (when (memory-unused? *level* s4-29) + (set! sv-24 0) + (set! sv-56 s4-29) + (goto cfg-322) + ) + ) + ) + ) + ) + ) + (((level-memory-mode tiny)) + (let ((v1-143 mask)) + (cond + ((or (zero? v1-143) (= v1-143 3)) + (let ((s4-30 60)) + (when (memory-unused? *level* s4-30) + (set! sv-24 16) + (set! sv-56 s4-30) + (goto cfg-322) + ) + ) + (let ((s4-31 #x3c000)) + (when (memory-unused? *level* s4-31) + (set! sv-24 114) + (set! sv-56 s4-31) + (goto cfg-322) + ) + ) + (let ((s4-32 #x3c00)) + (when (memory-unused? *level* s4-32) + (set! sv-24 82) + (set! sv-56 s4-32) + (goto cfg-322) + ) + ) + (let ((s4-33 960)) + (when (memory-unused? *level* s4-33) + (set! sv-24 48) + (set! sv-56 s4-33) + (goto cfg-322) + ) + ) + ) + ((= v1-143 #x30000) + (let ((s4-34 #xf000)) + (when (memory-unused? *level* s4-34) + (set! sv-24 98) + (set! sv-56 s4-34) + (goto cfg-322) + ) + ) + (let ((s4-35 15)) + (when (memory-unused? *level* s4-35) + (set! sv-24 0) + (set! sv-56 s4-35) + (goto cfg-322) + ) + ) + (let ((s4-36 240)) + (when (memory-unused? *level* s4-36) + (set! sv-24 32) + (set! sv-56 s4-36) + (goto cfg-322) + ) + ) + (let ((s4-37 3840)) + (when (memory-unused? *level* s4-37) + (set! sv-24 64) + (set! sv-56 s4-37) + (goto cfg-322) + ) + ) + ) + ) + ) + ) + (((level-memory-mode tiny-center)) + (let ((v1-176 mask)) + (cond + ((or (zero? v1-176) (= v1-176 3)) + (let ((s4-38 #x3c00)) + (when (memory-unused? *level* s4-38) + (set! sv-24 82) + (set! sv-56 s4-38) + (goto cfg-322) + ) + ) + (let ((s4-39 960)) + (when (memory-unused? *level* s4-39) + (set! sv-24 48) + (set! sv-56 s4-39) + (goto cfg-322) + ) + ) + ) + ((= v1-176 #x30000) + (let ((s4-40 240)) + (when (memory-unused? *level* s4-40) + (set! sv-24 32) + (set! sv-56 s4-40) + (goto cfg-322) + ) + ) + (let ((s4-41 3840)) + (when (memory-unused? *level* s4-41) + (set! sv-24 64) + (set! sv-56 s4-41) + (goto cfg-322) + ) + ) + ) + ) + ) + ) + (((level-memory-mode tiny-center-small)) + (let ((v1-194 mask)) + (cond + ((or (zero? v1-194) (= v1-194 3)) + (let ((s4-42 #x3e00)) + (when (memory-unused? *level* s4-42) + (set! sv-24 72) + (set! sv-56 s4-42) + (goto cfg-322) + ) + ) + (let ((s4-43 1984)) + (when (memory-unused? *level* s4-43) + (set! sv-24 48) + (set! sv-56 s4-43) + (goto cfg-322) + ) + ) + ) + ((= v1-194 #x30000) + (let ((s4-44 496)) + (when (memory-unused? *level* s4-44) + (set! sv-24 32) + (set! sv-56 s4-44) + (goto cfg-322) + ) + ) + (let ((s4-45 3968)) + (when (memory-unused? *level* s4-45) + (set! sv-24 56) + (set! sv-56 s4-45) + (goto cfg-322) + ) + ) + ) + ) + ) + ) + (((level-memory-mode tiny-center-micro)) + (let ((v1-213 mask)) + (cond + ((or (zero? v1-213) (= v1-213 3)) + (let ((s4-46 448)) + (when (memory-unused? *level* s4-46) + (set! sv-24 48) + (set! sv-56 s4-46) + (goto cfg-322) + ) + ) + (let ((s4-47 #x3800)) + (when (memory-unused? *level* s4-47) + (set! sv-24 90) + (set! sv-56 s4-47) + (goto cfg-322) + ) + ) + ) + ((= v1-213 #x30000) + (let ((s4-48 3584)) + (when (memory-unused? *level* s4-48) + (set! sv-24 72) + (set! sv-56 s4-48) + (goto cfg-322) + ) + ) + (let ((s4-49 112)) + (when (memory-unused? *level* s4-49) + (set! sv-24 32) + (set! sv-56 s4-49) + (goto cfg-322) + ) + ) + ) + ) + ) + ) + ) + (label cfg-322) + (cond + ((zero? sv-56) + (format + 0 + "ERROR: level ~A could not find free ~S bank in the level-group heap (micro ~X tiny ~X)~%" + (-> this name) + (level-memory-mode->string mem-mode) + mask + sv-40 + ) + (dotimes (s5-1 11) + (let ((s4-51 (-> *level* level s5-1))) + (when (!= (-> s4-51 status) 'inactive) + (format 0 "~Tlevel ~2D ~16S " s5-1 (-> s4-51 name)) + (format + 0 + "~16S bits #b~18,'0B~%" + (if (nonzero? (-> s4-51 info)) + (level-memory-mode->string (-> s4-51 info memory-mode)) + ) + (-> s4-51 memory-mask) + ) + ) + ) + ) + #t + (break!) + 0 ) (else - (let ((v1-246 (-> this heap))) - (set! (-> v1-246 base) (&+ (-> *level* heap base) (* #x1f800 sv-24))) - (set! (-> v1-246 current) (-> v1-246 base)) - (set! (-> v1-246 top-base) (&+ (-> v1-246 base) sv-48)) - (set! (-> v1-246 top) (-> v1-246 top-base)) + (set! (-> this memory-mask) (the-as uint sv-56)) + (format 0 "lev ~A ~X micro ~X tiny ~X~%" (-> this name) (-> this memory-mask) mask sv-40) + (cond + ((= (&- (-> *level* heap top) (the-as uint (-> *level* heap base))) #x1af2800) + (let ((v1-245 (-> this heap))) + (set! (-> v1-245 base) (&+ (-> *level* heap base) (* #x2f400 sv-24))) + (set! (-> v1-245 current) (-> v1-245 base)) + (set! (-> v1-245 top-base) (&+ (-> v1-245 base) (+ sv-48 (/ sv-48 2)))) + (set! (-> v1-245 top) (-> v1-245 top-base)) + ) + ) + (else + (let ((v1-246 (-> this heap))) + (set! (-> v1-246 base) (&+ (-> *level* heap base) (* #x1f800 sv-24))) + (set! (-> v1-246 current) (-> v1-246 base)) + (set! (-> v1-246 top-base) (&+ (-> v1-246 base) sv-48)) + (set! (-> v1-246 top) (-> v1-246 top-base)) + ) + ) ) ) ) @@ -1736,17 +1731,7 @@ ;; ERROR: Unsupported inline assembly instruction kind - [mfc0 v1, Count] (defun level-update-after-load ((arg0 level) (arg1 login-state)) "Run the post-load state machine to login level data." - (local-vars - (v1-4 int) - (v1-244 int) - (s5-0 int) - (sv-16 drawable) - (sv-32 proxy-prototype-array-tie) - (sv-48 int) - (sv-64 prototype-bucket-tie) - (sv-80 int) - (sv-96 adgif-shader) - ) + (local-vars (v1-4 int) (v1-244 int) (s5-0 int)) (set! *level-index* (-> arg0 index)) 0 (let* ((s3-0 (-> arg0 bsp)) @@ -1817,117 +1802,123 @@ (goto cfg-1) ) (when (< (-> arg1 state) (the-as int (-> arg1 elts))) - (set! sv-16 (-> arg1 elt (-> arg1 state))) - (cond - ((= (-> sv-16 type) drawable-inline-array-tfrag) - (set! *texture-masks-array* (-> arg0 bsp tfrag-masks)) - (cond - ((< s0-0 (-> (the-as drawable-inline-array-tfrag sv-16) length)) - (dotimes (s1-2 200) - (when (< s0-0 (-> (the-as drawable-inline-array-tfrag sv-16) length)) - (login (-> (the-as drawable-inline-array-tfrag sv-16) data (the-as uint s0-0))) - (set! s0-0 (the-as int (+ (the-as uint s0-0) 1))) + (let ((sv-16 (-> arg1 elt (-> arg1 state)))) + (cond + ((= (-> sv-16 type) drawable-inline-array-tfrag) + (set! *texture-masks-array* (-> arg0 bsp tfrag-masks)) + (cond + ((< s0-0 (-> (the-as drawable-inline-array-tfrag sv-16) length)) + (dotimes (s1-2 200) + (when (< s0-0 (-> (the-as drawable-inline-array-tfrag sv-16) length)) + (login (-> (the-as drawable-inline-array-tfrag sv-16) data (the-as uint s0-0))) + (set! s0-0 (the-as int (+ (the-as uint s0-0) 1))) + ) ) + (set! (-> arg1 pos) (the-as uint s0-0)) ) - (set! (-> arg1 pos) (the-as uint s0-0)) - ) - (else - (set! (-> arg1 pos) (the-as uint 0)) - (set! s0-0 (+ (-> arg1 state) 1)) - (set! (-> arg1 state) s0-0) + (else + (set! (-> arg1 pos) (the-as uint 0)) + (set! s0-0 (+ (-> arg1 state) 1)) + (set! (-> arg1 state) s0-0) + ) ) ) - ) - ((= (-> sv-16 type) drawable-tree-instance-tie) - (let ((s1-3 (-> (the-as drawable-tree-instance-tie sv-16) prototypes prototype-array-tie))) - (set! sv-32 (-> (the-as drawable-tree-instance-tie sv-16) prototypes)) - (when (< s0-0 (-> s1-3 length)) - (set! sv-48 0) - (while (< sv-48 10) + ((= (-> sv-16 type) drawable-tree-instance-tie) + (let ((s1-3 (-> (the-as drawable-tree-instance-tie sv-16) prototypes prototype-array-tie))) + (let ((sv-32 (-> (the-as drawable-tree-instance-tie sv-16) prototypes))) (when (< s0-0 (-> s1-3 length)) - (set! sv-64 (-> s1-3 array-data (the-as uint s0-0))) - (+! (-> sv-32 prototype-max-qwc) 32) - (cond - ((logtest? (-> sv-64 flags) (prototype-flags tpage-alpha)) - (set! *texture-masks* (-> *level* level *level-index* bsp alpha-masks data (-> sv-64 texture-masks-index))) - ) - ((logtest? (-> sv-64 flags) (prototype-flags tpage-water)) - (set! *texture-masks* (-> *level* level *level-index* bsp water-masks data (-> sv-64 texture-masks-index))) - ) - (else - (set! *texture-masks* (-> *level* level *level-index* bsp tfrag-masks data (-> sv-64 texture-masks-index))) - ) - ) - (when (and *debug-segment* (-> *screen-shot-work* highres-enable)) - (dotimes (v1-116 4) - (+! (-> sv-64 dists data v1-116) 40960000.0) - (set! (-> sv-64 rdists data v1-116) (/ 1.0 (-> sv-64 dists data v1-116))) - ) - ) - (set! sv-80 0) - (while (< sv-80 4) - (let ((a0-63 (-> sv-64 tie-geom sv-80))) - (when (nonzero? a0-63) - (+! (-> sv-32 prototype-max-qwc) (* 7 (-> a0-63 length))) - (login a0-63) - ) - ) - (set! sv-80 (+ sv-80 1)) - ) - (set! s0-0 (the-as int (+ (the-as uint s0-0) 1))) - ) - (set! sv-48 (+ sv-48 1)) - ) - (set! (-> arg1 pos) (the-as uint s0-0)) - ) - (when (= (the-as uint s0-0) (-> s1-3 length)) - (dotimes (s0-3 (-> s1-3 length)) - (let ((v1-146 (-> s1-3 array-data s0-3))) - (cond - ((logtest? (-> v1-146 flags) (prototype-flags tpage-alpha)) - (set! *texture-masks* (-> *level* level *level-index* bsp alpha-masks data (-> v1-146 texture-masks-index))) - ) - ((logtest? (-> v1-146 flags) (prototype-flags tpage-water)) - (set! *texture-masks* (-> *level* level *level-index* bsp water-masks data (-> v1-146 texture-masks-index))) - ) - (else - (set! *texture-masks* (-> *level* level *level-index* bsp tfrag-masks data (-> v1-146 texture-masks-index))) - ) - ) - (set! sv-96 (-> v1-146 envmap-shader)) - ) - (when (nonzero? sv-96) - (let ((v0-8 (adgif-shader-login-no-remap sv-96))) - (when v0-8 - (dotimes (v1-150 3) - (dotimes (a0-82 3) - (set! (-> (the-as (pointer int32) (+ (+ (* v1-150 16) (* a0-82 4)) (the-as int *texture-masks*)))) - (logior (-> (the-as (pointer int32) (+ (* a0-82 4) (the-as int *texture-masks*) (* v1-150 16))) 0) - (-> (the-as (pointer int32) (+ (* a0-82 4) (the-as int v0-8) (* v1-150 16))) 15) - ) - ) - ) - (set! (-> *texture-masks* data v1-150 dist) - (fmax (-> *texture-masks* data v1-150 dist) (-> v0-8 masks data v1-150 dist)) + (let ((sv-48 0)) + (while (< sv-48 10) + (when (< s0-0 (-> s1-3 length)) + (let ((sv-64 (-> s1-3 array-data (the-as uint s0-0)))) + (+! (-> sv-32 prototype-max-qwc) 32) + (cond + ((logtest? (-> sv-64 flags) (prototype-flags tpage-alpha)) + (set! *texture-masks* (-> *level* level *level-index* bsp alpha-masks data (-> sv-64 texture-masks-index))) + ) + ((logtest? (-> sv-64 flags) (prototype-flags tpage-water)) + (set! *texture-masks* (-> *level* level *level-index* bsp water-masks data (-> sv-64 texture-masks-index))) + ) + (else + (set! *texture-masks* (-> *level* level *level-index* bsp tfrag-masks data (-> sv-64 texture-masks-index))) ) + ) + (when (and *debug-segment* (-> *screen-shot-work* highres-enable)) + (dotimes (v1-116 4) + (+! (-> sv-64 dists data v1-116) 40960000.0) + (set! (-> sv-64 rdists data v1-116) (/ 1.0 (-> sv-64 dists data v1-116))) + ) + ) + (let ((sv-80 0)) + (while (< sv-80 4) + (let ((a0-63 (-> sv-64 tie-geom sv-80))) + (when (nonzero? a0-63) + (+! (-> sv-32 prototype-max-qwc) (* 7 (-> a0-63 length))) + (login a0-63) + ) + ) + (+! sv-80 1) + ) + ) + ) + (set! s0-0 (the-as int (+ (the-as uint s0-0) 1))) + ) + (+! sv-48 1) + ) + ) + (set! (-> arg1 pos) (the-as uint s0-0)) + ) + ) + (when (= (the-as uint s0-0) (-> s1-3 length)) + (dotimes (s0-3 (-> s1-3 length)) + (let ((v1-146 (-> s1-3 array-data s0-3))) + (cond + ((logtest? (-> v1-146 flags) (prototype-flags tpage-alpha)) + (set! *texture-masks* (-> *level* level *level-index* bsp alpha-masks data (-> v1-146 texture-masks-index))) + ) + ((logtest? (-> v1-146 flags) (prototype-flags tpage-water)) + (set! *texture-masks* (-> *level* level *level-index* bsp water-masks data (-> v1-146 texture-masks-index))) + ) + (else + (set! *texture-masks* (-> *level* level *level-index* bsp tfrag-masks data (-> v1-146 texture-masks-index))) + ) + ) + (let ((sv-96 (-> v1-146 envmap-shader))) + (when (nonzero? sv-96) + (let ((v0-8 (adgif-shader-login-no-remap sv-96))) + (when v0-8 + (dotimes (v1-150 3) + (dotimes (a0-82 3) + (set! (-> (the-as (pointer int32) (+ (+ (* v1-150 16) (* a0-82 4)) (the-as int *texture-masks*)))) + (logior (-> (the-as (pointer int32) (+ (* a0-82 4) (the-as int *texture-masks*) (* v1-150 16))) 0) + (-> (the-as (pointer int32) (+ (* a0-82 4) (the-as int v0-8) (* v1-150 16))) 15) + ) + ) + ) + (set! (-> *texture-masks* data v1-150 dist) + (fmax (-> *texture-masks* data v1-150 dist) (-> v0-8 masks data v1-150 dist)) + ) + ) + ) + ) + (set! (-> sv-96 tex1) (new 'static 'gs-tex1 :mmag #x1 :mmin #x1)) + (set! (-> sv-96 clamp) (new 'static 'gs-clamp :wms (gs-tex-wrap-mode clamp) :wmt (gs-tex-wrap-mode clamp))) + (set! (-> sv-96 alpha) (new 'static 'gs-miptbp :tbp1 #x58)) + (set! (-> sv-96 reg-0) (gs-reg tex0-1)) + (set! (-> sv-96 reg-1) (gs-reg tex1-1)) + (set! (-> sv-96 reg-2) (gs-reg miptbp1-1)) + (set! (-> sv-96 reg-3) (gs-reg clamp-1)) + (set! (-> sv-96 reg-4) (gs-reg alpha-1)) ) ) ) - (set! (-> sv-96 tex1) (new 'static 'gs-tex1 :mmag #x1 :mmin #x1)) - (set! (-> sv-96 clamp) (new 'static 'gs-clamp :wms (gs-tex-wrap-mode clamp) :wmt (gs-tex-wrap-mode clamp))) - (set! (-> sv-96 alpha) (new 'static 'gs-miptbp :tbp1 #x58)) - (set! (-> sv-96 reg-0) (gs-reg tex0-1)) - (set! (-> sv-96 reg-1) (gs-reg tex1-1)) - (set! (-> sv-96 reg-2) (gs-reg miptbp1-1)) - (set! (-> sv-96 reg-3) (gs-reg clamp-1)) - (set! (-> sv-96 reg-4) (gs-reg alpha-1)) ) + (set! (-> arg1 pos) (the-as uint 0)) + (+! (-> arg1 state) 1) ) - (set! (-> arg1 pos) (the-as uint 0)) - (+! (-> arg1 state) 1) ) ) - ) + ) ) (goto cfg-1) ) @@ -2023,7 +2014,6 @@ ;; INFO: Used lq/sq (defmethod birth ((this level)) "Start running a level." - (local-vars (sv-96 int)) (case (-> this status) (('loaded) (let ((s5-0 loading-level) @@ -2067,10 +2057,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/jak3/engine/level/region_REF.gc b/test/decompiler/reference/jak3/engine/level/region_REF.gc index 68ac9f9d8c..b4f4f4f5ea 100644 --- a/test/decompiler/reference/jak3/engine/level/region_REF.gc +++ b/test/decompiler/reference/jak3/engine/level/region_REF.gc @@ -81,53 +81,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 577) - ) - (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 577) - ) - (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 577) - ) - (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 577) + ) + (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 577) - ) - (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 577) + ) + (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 577) + ) + (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 577) + ) + (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) ) ) ) @@ -286,7 +287,6 @@ ;; definition for method 18 of type drawable-region-face (defmethod track-region ((this drawable-region-face) (arg0 region-prim-area)) - (local-vars (sv-48 vector) (sv-52 vector) (sv-56 (inline-array vector))) (-> this region) (let* ((s4-0 (-> this data)) (v1-1 (-> s4-0 normal)) @@ -295,34 +295,36 @@ ) (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 (-> s4-0 points)) - (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)) + (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 (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) - ) - (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) (-> (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 + (-> (the-as (inline-array vector) sv-56) 0) + (-> (the-as (inline-array vector) sv-56) 1) + (-> (the-as (inline-array vector) sv-56) 2) + ) + (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) + ) + (+! s2-0 1) + (set! sv-56 (the-as (inline-array vector) (-> (the-as (inline-array vector) sv-56) 1))) + ) ) ) (set! s3-0 s3-0) @@ -423,7 +425,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))) @@ -434,9 +435,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? @@ -446,7 +448,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))))) ) ) @@ -489,33 +491,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 (-> (the-as region-prim-area #x70000000) pos)) arg1 0.0) - (sphere<-vector+r! (the-as sphere (-> (the-as region-prim-area #x70000000) exit-pos)) arg2 0.0) - (vector-! (-> (the-as region-prim-area #x70000000) ray) arg2 arg1) - (vector-! (-> (the-as region-prim-area #x70000000) exit-ray) 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 (-> (the-as region-prim-area #x70000000) pos)) arg1 0.0) + (sphere<-vector+r! (the-as sphere (-> (the-as region-prim-area #x70000000) exit-pos)) arg2 0.0) + (vector-! (-> (the-as region-prim-area #x70000000) ray) arg2 arg1) + (vector-! (-> (the-as region-prim-area #x70000000) exit-ray) 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/jak3/engine/load/decomp_REF.gc b/test/decompiler/reference/jak3/engine/load/decomp_REF.gc index f58bf62e19..106803c075 100644 --- a/test/decompiler/reference/jak3/engine/load/decomp_REF.gc +++ b/test/decompiler/reference/jak3/engine/load/decomp_REF.gc @@ -261,7 +261,7 @@ ;; INFO: Used lq/sq (defmethod update-vis! ((this level) (arg0 level-vis-info) (arg1 uint) (arg2 (pointer uint8))) "Load/decompress precomputed visibility." - (local-vars (t0-3 uint128) (sv-16 int) (sv-32 (pointer int8))) + (local-vars (t0-3 uint128)) (let* ((a0-1 (-> arg0 from-bsp current-leaf-idx)) (v1-1 (-> arg0 current-vis-string)) (s3-0 (-> arg0 vis-string a0-1)) @@ -351,9 +351,10 @@ (set! (-> (the-as (pointer int128) (&+ s1-0 (* a0-23 16)))) 0) ) ) - (set! sv-16 (-> this bsp extra-vis-list-length)) - (set! sv-32 (&+ s1-0 (- s4-1 sv-16))) - (let ((v1-45 (unpack-vis (-> this bsp drawable-trees) s1-0 (the-as (pointer int8) s3-1)))) + (let* ((sv-16 (-> this bsp extra-vis-list-length)) + (sv-32 (&+ s1-0 (- s4-1 sv-16))) + (v1-45 (unpack-vis (-> this bsp drawable-trees) s1-0 (the-as (pointer int8) s3-1))) + ) (dotimes (a0-25 sv-16) (let ((a1-9 (-> v1-45 0))) (set! v1-45 (&-> v1-45 1)) @@ -519,7 +520,3 @@ (the-as (pointer uint8) (+ s4-0 1)) ) ) - - - - diff --git a/test/decompiler/reference/jak3/engine/load/load-state_REF.gc b/test/decompiler/reference/jak3/engine/load/load-state_REF.gc index d71b99bcda..d682990db5 100644 --- a/test/decompiler/reference/jak3/engine/load/load-state_REF.gc +++ b/test/decompiler/reference/jak3/engine/load/load-state_REF.gc @@ -176,7 +176,7 @@ ;; WARN: Stack slot offset 24 signed mismatch ;; WARN: Return type mismatch pair vs object. (defun borrow-city-expansion ((arg0 pair)) - (local-vars (v1-12 type) (s2-2 int) (sv-16 pair) (sv-20 symbol) (sv-24 object)) + (local-vars (v1-12 type) (s2-2 int)) (let ((gp-0 *borrow-city-expansion-list*)) 0 (let ((s4-0 0)) @@ -213,37 +213,39 @@ (mark-permanent-holds gp-0) ) (dotimes (s4-1 (the-as int (-> *setting-control* user-current borrow-city-count))) - (set! sv-16 (-> *setting-control* user-current borrow-city s4-1)) - (let* ((s3-0 sv-16) + (let* ((sv-16 (-> *setting-control* user-current borrow-city s4-1)) + (s3-0 sv-16) (v1-20 (car s3-0)) ) (while (not (null? s3-0)) - (set! sv-20 (the-as symbol #f)) - (set! sv-24 v1-20) - (when sv-24 - (dotimes (s2-0 (/ s5-1 2)) - (when (= sv-24 (ref gp-0 (* s2-0 2))) - (set! sv-20 #t) - (if (= (ref gp-0 (+ (* s2-0 2) 1)) 'auto) - (set! (car (ref& gp-0 (+ (* s2-0 2) 1))) 'faction) - ) - 0 - (goto cfg-37) + (let ((sv-20 (the-as symbol #f)) + (sv-24 v1-20) ) - ) - (label cfg-37) - (when (not sv-20) - (dotimes (s2-1 (/ s5-1 2)) - (when (= (ref gp-0 (+ (* s2-1 2) 1)) 'auto) - (set! s2-2 s2-1) - (goto cfg-45) + (when sv-24 + (dotimes (s2-0 (/ s5-1 2)) + (when (= sv-24 (ref gp-0 (* s2-0 2))) + (set! sv-20 #t) + (if (= (ref gp-0 (+ (* s2-0 2) 1)) 'auto) + (set! (car (ref& gp-0 (+ (* s2-0 2) 1))) 'faction) + ) + 0 + (goto cfg-37) ) ) - (set! s2-2 -1) - (label cfg-45) - (when (> s2-2 0) - (set! (car (ref& gp-0 (* s2-2 2))) sv-24) - (set! (car (ref& gp-0 (+ (* s2-2 2) 1))) 'faction) + (label cfg-37) + (when (not sv-20) + (dotimes (s2-1 (/ s5-1 2)) + (when (= (ref gp-0 (+ (* s2-1 2) 1)) 'auto) + (set! s2-2 s2-1) + (goto cfg-45) + ) + ) + (set! s2-2 -1) + (label cfg-45) + (when (> s2-2 0) + (set! (car (ref& gp-0 (* s2-2 2))) sv-24) + (set! (car (ref& gp-0 (+ (* s2-2 2) 1))) 'faction) + ) ) ) ) @@ -362,7 +364,6 @@ ;; definition for method 21 of type load-state ;; WARN: Return type mismatch int vs none. (defmethod add-borrow-levels ((this load-state)) - (local-vars (sv-16 int)) (dotimes (s5-0 10) (let ((a0-1 (-> this want s5-0 name))) (when a0-1 @@ -377,25 +378,26 @@ ) ) ) - (set! sv-16 0) - (dotimes (s5-1 10) - (if (-> this want s5-1 name) - (add-want-level - (-> this want-exp) - (the-as (pointer int64) (& sv-16)) - (-> this want s5-1 name) - (-> this want s5-1 display?) - (-> this want s5-1 force-vis?) - (-> this want s5-1 force-inside?) + (let ((sv-16 0)) + (dotimes (s5-1 10) + (if (-> this want s5-1 name) + (add-want-level + (-> this want-exp) + (the-as (pointer int64) (& sv-16)) + (-> this want s5-1 name) + (-> this want s5-1 display?) + (-> this want s5-1 force-vis?) + (-> this want s5-1 force-inside?) + ) ) - ) - ) - (while (< sv-16 10) - (set! (-> this want-exp sv-16 name) #f) - (set! (-> this want-exp sv-16 display?) #f) - (set! (-> this want-exp sv-16 force-vis?) #f) - (set! (-> this want-exp sv-16 force-inside?) #f) - (set! sv-16 (+ sv-16 1)) + ) + (while (< sv-16 10) + (set! (-> this want-exp sv-16 name) #f) + (set! (-> this want-exp sv-16 display?) #f) + (set! (-> this want-exp sv-16 force-vis?) #f) + (set! (-> this want-exp sv-16 force-inside?) #f) + (+! sv-16 1) + ) ) (cond ((-> this update-callback) @@ -651,7 +653,3 @@ ;; failed to figure out what this is: (kmemclose) - - - - diff --git a/test/decompiler/reference/jak3/engine/load/loader_REF.gc b/test/decompiler/reference/jak3/engine/load/loader_REF.gc index 87cc82f701..406be32c2c 100644 --- a/test/decompiler/reference/jak3/engine/load/loader_REF.gc +++ b/test/decompiler/reference/jak3/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 @@ -846,7 +842,7 @@ (arg3 (function process-drawable symbol)) (arg4 spooler-flags) ) - (local-vars (v0-62 int) (sv-176 int)) + (local-vars (v0-62 int)) (let ((gp-0 (new 'stack 'spooler-block))) (let ((s5-0 gp-0)) (set! (-> s5-0 anim) arg0) @@ -1076,68 +1072,69 @@ (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-62) 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-139) - ) - (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-62) 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-139) + ) + (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)) + (if (and (logtest? (-> gp-0 flags) (spooler-flags blackout-on-stall)) (<= sv-176 0)) + (set-blackout-frames (seconds 0.05)) + ) + (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? (-> 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-62 (current-str-pos (-> gp-0 sid))) + (set! sv-176 v0-62) ) - (set! (-> gp-0 old-pos) sv-176) - (set-time! (-> gp-0 old-time)) - (if (and (logtest? (-> gp-0 flags) (spooler-flags blackout-on-stall)) (<= sv-176 0)) - (set-blackout-frames (seconds 0.05)) - ) - (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? (-> 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-62 (current-str-pos (-> gp-0 sid))) - (set! sv-176 v0-62) ) (set! (-> gp-0 part-audio-start) f28-0) ) @@ -1687,7 +1684,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))) @@ -1703,8 +1699,9 @@ ) (case a2-1 ((95) - (let ((s0-0 80)) - (set! sv-16 92) + (let ((s0-0 80) + (sv-16 92) + ) (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) @@ -1714,8 +1711,9 @@ ) ) ((79) - (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) @@ -1725,8 +1723,9 @@ ) ) ((47) - (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) @@ -1912,43 +1911,45 @@ (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 (-> 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 (-> (the-as gui-connection s1-0) id))) - (or (= arg2 (gui-channel none)) (= arg2 (-> (the-as gui-connection s1-0) channel))) - (or (= sv-17 (gui-action none)) (= sv-17 (-> (the-as gui-connection s1-0) action))) - (or (not sv-20) (string= sv-20 (-> (the-as gui-connection s1-0) name))) - (or (not arg5) (arg5 (the-as gui-connection s1-0))) - (or (not arg6) (= arg6 (get-process (the-as gui-connection s1-0)))) - ) - (cond - ((and (= sv-16 (gui-action hide)) - (!= (-> this ids (-> (the-as gui-connection s1-0) channel)) (-> (the-as gui-connection s1-0) id)) - ) - (set! (-> (the-as gui-connection s1-0) action) (gui-action hidden)) - ) - ((and (= sv-16 (gui-action play)) (= (-> (the-as gui-connection s1-0) action) (gui-action playing))) - ) - (else - (set! (-> (the-as gui-connection s1-0) action) sv-16) - (if (and (= sv-16 'play) - (handle-command-list this (-> (the-as gui-connection s1-0) channel) (the-as gui-connection s1-0)) - ) - (channel-id-set! this (the-as gui-connection s1-0) (-> (the-as gui-connection s1-0) id)) - ) + (let ((sv-16 arg0) + (sv-17 arg3) + (sv-20 arg4) + ) + (let ((sv-24 arg5)) + ) + (let ((s1-0 (-> 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 (-> (the-as gui-connection s1-0) id))) + (or (= arg2 (gui-channel none)) (= arg2 (-> (the-as gui-connection s1-0) channel))) + (or (= sv-17 (gui-action none)) (= sv-17 (-> (the-as gui-connection s1-0) action))) + (or (not sv-20) (string= sv-20 (-> (the-as gui-connection s1-0) name))) + (or (not arg5) (arg5 (the-as gui-connection s1-0))) + (or (not arg6) (= arg6 (get-process (the-as gui-connection s1-0)))) + ) + (cond + ((and (= sv-16 (gui-action hide)) + (!= (-> this ids (-> (the-as gui-connection s1-0) channel)) (-> (the-as gui-connection s1-0) id)) + ) + (set! (-> (the-as gui-connection s1-0) action) (gui-action hidden)) + ) + ((and (= sv-16 (gui-action play)) (= (-> (the-as gui-connection s1-0) action) (gui-action playing))) + ) + (else + (set! (-> (the-as gui-connection s1-0) action) sv-16) + (if (and (= sv-16 'play) + (handle-command-list this (-> (the-as gui-connection s1-0) channel) (the-as gui-connection s1-0)) + ) + (channel-id-set! this (the-as gui-connection s1-0) (-> (the-as gui-connection s1-0) id)) + ) + ) ) ) + (set! s1-0 s0-0) + (-> this engine) + (set! s0-0 (-> s0-0 next0)) ) - (set! s1-0 s0-0) - (-> this engine) - (set! s0-0 (-> s0-0 next0)) ) ) ) @@ -1966,68 +1967,66 @@ (arg4 float) (arg5 time-frame) ) - (local-vars - (sv-16 int) - (sv-20 gui-connection) - (sv-32 connectable) - (sv-48 connectable) - (sv-64 connectable) - (sv-80 int) - ) - (set! sv-32 (the-as connectable #f)) - (set! sv-48 (-> this engine alive-list next0)) - (-> this engine) - (set! sv-64 (-> 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)) - (= ((method-of-type gui-connection get-process) (the-as connection sv-48)) arg0) - ) - (set! sv-32 sv-48) - (goto cfg-12) - ) - (set! sv-48 sv-64) - (-> this engine) - (set! sv-64 (-> 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 (add-connection (-> this engine) arg0 arg4 0 arg3 sv-16)) - (the-as connection sv-32) - ) - (the-as sound-id (cond - (sv-32 - (set! (-> (the-as gui-connection sv-32) priority) arg4) - (set! (-> (the-as gui-connection sv-32) channel) arg1) - (set! (-> (the-as gui-connection sv-32) action) arg2) - (set! (-> (the-as gui-connection sv-32) param2) (the-as int arg3)) - (set! (-> (the-as gui-connection sv-32) hold-time) arg5) - (set! (-> (the-as gui-connection sv-32) flags) (gui-connection-flags gcf0)) - (set! (-> (the-as gui-connection 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 connectable #f))) + (let ((sv-48 (-> this engine alive-list next0))) + (-> this engine) + (let ((sv-64 (-> 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)) + (= ((method-of-type gui-connection get-process) (the-as connection sv-48)) arg0) ) + (set! sv-32 sv-48) + (goto cfg-12) + ) + (set! sv-48 sv-64) + (-> this engine) + (set! sv-64 (-> 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 (add-connection (-> this engine) arg0 arg4 0 arg3 sv-16)) + ) + (the-as connection (the-as connection sv-32)) + ) + (the-as sound-id (cond + (sv-32 + (set! (-> (the-as gui-connection sv-32) priority) arg4) + (set! (-> (the-as gui-connection sv-32) channel) arg1) + (set! (-> (the-as gui-connection sv-32) action) arg2) + (set! (-> (the-as gui-connection sv-32) param2) (the-as int arg3)) + (set! (-> (the-as gui-connection sv-32) hold-time) arg5) + (set! (-> (the-as gui-connection sv-32) flags) (gui-connection-flags gcf0)) + (set! (-> (the-as gui-connection 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 @@ -2060,89 +2059,86 @@ (arg5 float) (arg6 sound-id) ) - (local-vars - (sv-16 gui-connection) - (sv-20 int) - (sv-24 gui-connection) - (sv-28 process) - (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) + (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) + ) + ) ) ) - ) - (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))) + (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) (-> (the-as process-drawable sv-28) root trans)) + -1.0 + ) + ) ) ) - (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)) - ) - ) + (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)) ) - (when (= arg5 -99.0) - (set! sv-28 (as-type arg0 process-drawable)) - (set! arg5 (if sv-28 - (vector-vector-distance (target-pos 0) (-> (the-as process-drawable sv-28) root trans)) - -1.0 - ) - ) + (else + 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 ) ) ) diff --git a/test/decompiler/reference/jak3/engine/math/euler_REF.gc b/test/decompiler/reference/jak3/engine/math/euler_REF.gc index 9ce40ab2e4..4778dac915 100644 --- a/test/decompiler/reference/jak3/engine/math/euler_REF.gc +++ b/test/decompiler/reference/jak3/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/jak3/engine/math/math_REF.gc b/test/decompiler/reference/jak3/engine/math/math_REF.gc index 84d7677dd8..66826ba9e4 100644 --- a/test/decompiler/reference/jak3/engine/math/math_REF.gc +++ b/test/decompiler/reference/jak3/engine/math/math_REF.gc @@ -710,11 +710,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/jak3/engine/math/quaternion_REF.gc b/test/decompiler/reference/jak3/engine/math/quaternion_REF.gc index 1bd1ac68d2..29361981ab 100644 --- a/test/decompiler/reference/jak3/engine/math/quaternion_REF.gc +++ b/test/decompiler/reference/jak3/engine/math/quaternion_REF.gc @@ -49,12 +49,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)) @@ -600,11 +597,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! @@ -690,9 +683,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)) ) @@ -768,10 +759,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/jak3/engine/math/transformq_REF.gc b/test/decompiler/reference/jak3/engine/math/transformq_REF.gc index 74e3ec731c..0b85d76372 100644 --- a/test/decompiler/reference/jak3/engine/math/transformq_REF.gc +++ b/test/decompiler/reference/jak3/engine/math/transformq_REF.gc @@ -178,63 +178,47 @@ where an axis flips by 180 degrees. But now they use matrix-from-two-vectors-the-long-way-smooth to fix it! Good job. This additionally uses the fancy logic of matrix-from-two-vectors-smooth." - (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/jak3/engine/math/trigonometry_REF.gc b/test/decompiler/reference/jak3/engine/math/trigonometry_REF.gc index 03d112e732..846b4ba6eb 100644 --- a/test/decompiler/reference/jak3/engine/math/trigonometry_REF.gc +++ b/test/decompiler/reference/jak3/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/jak3/engine/math/vector-h_REF.gc b/test/decompiler/reference/jak3/engine/math/vector-h_REF.gc index 20dfd8e311..92dcc608fa 100644 --- a/test/decompiler/reference/jak3/engine/math/vector-h_REF.gc +++ b/test/decompiler/reference/jak3/engine/math/vector-h_REF.gc @@ -667,6 +667,7 @@ ) ;; definition for method 3 of type vector-array +;; INFO: this function exists in multiple non-identical object files (defmethod inspect ((this vector-array)) (when (not this) (set! this this) @@ -1016,16 +1017,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/jak3/engine/math/vector_REF.gc b/test/decompiler/reference/jak3/engine/math/vector_REF.gc index a9f3a198e7..7f2662a085 100644 --- a/test/decompiler/reference/jak3/engine/math/vector_REF.gc +++ b/test/decompiler/reference/jak3/engine/math/vector_REF.gc @@ -364,7 +364,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) @@ -396,7 +396,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) @@ -430,7 +430,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/jak3/engine/nav/nav-control_REF.gc b/test/decompiler/reference/jak3/engine/nav/nav-control_REF.gc index 2ebd4c49e4..70521098c7 100644 --- a/test/decompiler/reference/jak3/engine/nav/nav-control_REF.gc +++ b/test/decompiler/reference/jak3/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 ) ) @@ -256,52 +257,53 @@ ;; 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 #t (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) - ) - ) - (when (logtest? (-> this shape nav-flags) (nav-flags has-child-spheres)) - ) - (dotimes (s5-0 (-> this sphere-count)) - (let ((v1-23 (-> this state mesh work debug sphere-array s5-0))) - (vector+! sv-36 (the-as vector (-> sv-32 bounds)) (the-as vector v1-23)) - (add-debug-sphere - #t - (bucket-id debug-no-zbuf1) - sv-36 - (- (-> v1-23 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 debug) s4-0 (-> s4-0 r) *color-blue*) - (let ((s3-0 add-debug-text-3d) - (s2-0 #t) - (s1-0 577) + (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) + ) + ) + (when (logtest? (-> this shape nav-flags) (nav-flags has-child-spheres)) + ) + (dotimes (s5-0 (-> this sphere-count)) + (let ((v1-23 (-> this state mesh work debug sphere-array s5-0))) + (vector+! sv-36 (the-as vector (-> sv-32 bounds)) (the-as vector v1-23)) + (add-debug-sphere + #t + (bucket-id debug-no-zbuf1) + sv-36 + (- (-> v1-23 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 debug) s4-0 (-> s4-0 r) *color-blue*) + (let ((s3-0 add-debug-text-3d) + (s2-0 #t) + (s1-0 577) + ) + (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)) + ) ) ) ) @@ -388,10 +390,7 @@ (let ((f1-0 a2-4) (f0-1 (+ (-> arg1 r) (-> arg0 shape nav-radius))) ) - (when (and (< 0.0 f1-0) (let ((f2-3 (+ f0-1 (-> arg0 nav-cull-radius)))) - (< f1-0 (* f2-3 f2-3)) - ) - ) + (when (and (< 0.0 f1-0) (< f1-0 (square (+ f0-1 (-> arg0 nav-cull-radius))))) (vector-! (the-as vector v1-3) (the-as vector arg1) (the-as vector (-> arg0 state mesh bounds))) (set! (-> v1-3 r) f0-1) (+! (-> arg0 sphere-count) 1) @@ -434,10 +433,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) (the-as vector (-> v1-4 state mesh bounds))) (set! (-> a3-5 r) f0-2) (+! (-> v1-4 sphere-count) 1) @@ -468,10 +464,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 (the-as vector (-> v1-9 state mesh bounds))) (set! (-> a1-5 r) f0-4) (+! (-> v1-9 sphere-count) 1) @@ -625,10 +618,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)) @@ -651,19 +641,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 @@ -696,19 +680,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 @@ -790,9 +768,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)) @@ -806,12 +782,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) @@ -1082,9 +1055,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)) @@ -1098,12 +1069,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) @@ -1184,33 +1152,7 @@ ;; INFO: Used lq/sq ;; 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) @@ -1221,180 +1163,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 (the-as vector (-> this bounds))) - (set! (-> sv-112 current-poly) arg1) - (vector-copy! (-> sv-112 current-pos) sv-116) - (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 (the-as vector (-> this bounds))) + (set! (-> sv-112 current-poly) arg1) + (vector-copy! (-> sv-112 current-pos) sv-116) + (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) + (vector-copy! (-> v1-20 current-pos) (-> v1-20 dest-pos)) + (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) - (vector-copy! (-> v1-20 current-pos) (-> v1-20 dest-pos)) - (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) (the-as vector (-> 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 (the-as vector (-> this bounds))) + (vector+! (-> arg3 vert-1) sv-196 (the-as vector (-> this bounds))) + ) + (vector-copy! (-> sv-112 dest-pos) (-> sv-112 current-pos)) + (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) (the-as vector (-> 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 (the-as vector (-> this bounds))) - (vector+! (-> arg3 vert-1) sv-196 (the-as vector (-> this bounds))) - (vector-copy! (-> sv-112 dest-pos) (-> sv-112 current-pos)) - (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 @@ -1406,15 +1361,14 @@ ;; WARN: Return type mismatch object vs none. ;; WARN: Function (method 23 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) @@ -1486,34 +1440,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) @@ -1526,203 +1453,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) - (vector-copy! (-> sv-96 current-pos) arg0) - (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) + (vector-copy! (-> sv-96 current-pos) arg0) + (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) + (vector-copy! (-> v1-19 current-pos) (-> v1-19 dest-pos)) + (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) - (vector-copy! (-> v1-19 current-pos) (-> v1-19 dest-pos)) - (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) (the-as vector (-> 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 (the-as vector (-> this bounds))) + (vector+! (-> arg5 vert-1) sv-188 (the-as vector (-> this bounds))) + ) + (vector-copy! (-> sv-96 dest-pos) (-> sv-96 current-pos)) + (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) (the-as vector (-> 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 (the-as vector (-> this bounds))) - (vector+! (-> arg5 vert-1) sv-188 (the-as vector (-> this bounds))) - ) - (vector-copy! (-> sv-96 dest-pos) (-> sv-96 current-pos)) - (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 @@ -2181,9 +2123,9 @@ ;; definition for method 12 of type nav-control ;; WARN: Return type mismatch float vs nav-poly. (defmethod closest-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-poly))) + (let ((sv-16 arg0) + (gp-0 (new 'stack-no-clear 'nav-poly)) + ) (set! (-> gp-0 vertex1 z) (the-as float arg2)) (vector-! (-> gp-0 vertex 0) arg1 (the-as vector (-> this state mesh bounds))) (when (or (not (-> gp-0 vertex1 z)) @@ -2235,9 +2177,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) ) @@ -2263,10 +2203,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))) @@ -2276,7 +2213,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))) ) ) ) @@ -2292,167 +2229,162 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defmethod navigate-using-route-portals ((this nav-state)) - (local-vars (sv-112 vector) (sv-116 nav-route-portal) (sv-120 (inline-array vector)) (sv-124 symbol)) (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) (the-as vector (-> this mesh bounds))) - (vector-copy! (-> this virtual-current-pos-local) (-> this current-pos-local)) - (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-poly))) - (vector-! s5-0 (-> this target-pos) (the-as vector (-> this mesh bounds))) - (when (or (logtest? (-> this flags) (nav-state-flag target-poly-dirty)) (not (-> this target-poly))) - (set! (-> s4-0 vertex 0 quad) (-> s5-0 quad)) - (set! (-> s4-0 vertex1 x) (-> this nav nearest-y-threshold)) - (set! (-> s4-0 data 20) (the-as uint 3)) - (nav-mesh-method-46 (-> this mesh) s4-0) - (set! (-> this target-poly) (the-as nav-poly (-> s4-0 vertex1 z))) - (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) (the-as vector (-> this mesh bounds))) + (vector-copy! (-> this virtual-current-pos-local) (-> this current-pos-local)) + (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-poly))) + (vector-! s5-0 (-> this target-pos) (the-as vector (-> this mesh bounds))) + (when (or (logtest? (-> this flags) (nav-state-flag target-poly-dirty)) (not (-> this target-poly))) + (set! (-> s4-0 vertex 0 quad) (-> s5-0 quad)) + (set! (-> s4-0 vertex1 x) (-> this nav nearest-y-threshold)) + (set! (-> s4-0 data 20) (the-as uint 3)) + (nav-mesh-method-46 (-> this mesh) s4-0) + (set! (-> this target-poly) (the-as nav-poly (-> s4-0 vertex1 z))) + (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)) + (vector-copy! (-> sv-120 0) (-> sv-116 vertex 0)) + (vector-copy! (-> sv-120 1) (-> sv-116 vertex 1)) + (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)) - (vector-copy! (-> sv-120 0) (-> sv-116 vertex 0)) - (vector-copy! (-> sv-120 1) (-> sv-116 vertex 1)) - (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)) - (vector-copy! (-> sv-120 0) (-> sv-116 vertex 0)) - (vector-copy! (-> sv-120 1) (-> sv-116 vertex 1)) - 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)) + (vector-copy! (-> sv-120 0) (-> sv-116 vertex 0)) + (vector-copy! (-> sv-120 1) (-> sv-116 vertex 1)) + 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 rvec) (-> sv-120 1) (-> sv-120 0)) - (vector-normalize! (-> s5-1 rvec) 409.6) - (vector+! (-> sv-120 0) (-> sv-120 0) (-> s5-1 rvec)) - (vector-! (-> sv-120 1) (-> sv-120 1) (-> s5-1 rvec)) - ) - (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 rvec) (-> sv-120 1) (-> sv-120 0)) + (vector-normalize! (-> s5-1 rvec) 409.6) + (vector+! (-> sv-120 0) (-> sv-120 0) (-> s5-1 rvec)) + (vector-! (-> sv-120 1) (-> sv-120 1) (-> s5-1 rvec)) + ) + (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 + (vector-copy! s4-1 sv-112) + ) ) - (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 - (vector-copy! s4-1 sv-112) - ) - ) - (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) ) ) - (let ((f0-15 (vector-length-squared (-> this travel))) - (f1-10 (-> this nav nav-cull-radius)) - ) - (if (< (* f1-10 f1-10) f0-15) + (let ((f0-15 (vector-length-squared (-> this travel)))) + (if (< (square (-> this nav nav-cull-radius)) f0-15) (vector-float*! (-> this travel) (-> this travel) (/ (-> this nav nav-cull-radius) (sqrtf f0-15))) ) ) @@ -2464,21 +2396,6 @@ ;; INFO: Used lq/sq ;; 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) @@ -2489,13 +2406,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)) + ) (vector-copy! (-> this travel) (-> arg0 out-travel 0)) (let ((v1-10 (new 'stack-no-clear 'nav-ray))) (vector-copy! (-> v1-10 current-pos) (-> this virtual-current-pos-local)) @@ -2538,66 +2451,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) - (vector-copy! (-> a3-5 current-pos) (-> a3-5 dest-pos)) - (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) + (vector-copy! (-> a3-5 current-pos) (-> a3-5 dest-pos)) + (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) + ) ) ) ) @@ -2626,21 +2544,6 @@ ;; INFO: Used lq/sq ;; 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) @@ -2660,13 +2563,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)) + ) (vector-copy! (-> this travel) (-> s5-0 out-travel 0)) (let ((v1-15 (new 'stack-no-clear 'nav-ray))) (vector-copy! (-> v1-15 current-pos) (-> this virtual-current-pos-local)) @@ -2709,66 +2608,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) - (vector-copy! (-> a1-6 current-pos) (-> a1-6 dest-pos)) - (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) + (vector-copy! (-> a1-6 current-pos) (-> a1-6 dest-pos)) + (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) + ) ) ) ) @@ -2830,10 +2734,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)))) (vector-copy! (-> this heading) (-> this travel)) (set! (-> this heading y) 0.0) @@ -2877,10 +2780,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)))) (vector-copy! (-> this heading) (-> this travel)) (set! (-> this heading y) 0.0) @@ -2933,11 +2835,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)) ) ) @@ -2955,7 +2854,6 @@ ;; definition for method 11 of type nav-state ;; INFO: Used lq/sq (defmethod plan-over-pat1-polys-using-route ((this nav-state) (arg0 nav-gap-info)) - (local-vars (sv-48 vector) (sv-52 vector) (sv-56 number)) (let ((a1-1 (-> this next-poly))) (when (logtest? (-> a1-1 pat) 1) (while (and a1-1 (logtest? (-> a1-1 pat) 1)) @@ -2966,23 +2864,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 (the-as float sv-56)) - (set! sv-56 f0-1) - (vector-copy! sv-52 sv-48) - ) + (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 (the-as float sv-56)) + (set! sv-56 f0-1) + (vector-copy! sv-52 sv-48) ) - (set! v1-13 s0-0) ) + (set! v1-13 s0-0) ) ) (vector-copy! s4-0 sv-52) @@ -3086,7 +2983,6 @@ ;; definition for method 28 of type nav-state ;; 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 @@ -3103,11 +2999,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)) ) ) @@ -3122,17 +3015,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)) @@ -3140,16 +3035,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) ) @@ -3280,21 +3175,6 @@ ;; INFO: Used lq/sq ;; 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) @@ -3315,13 +3195,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)) + ) (vector-copy! (-> v1-5 travel) (-> s5-0 out-travel 0)) (let ((a0-20 (new 'stack-no-clear 'nav-ray))) (vector-copy! (-> a0-20 current-pos) (-> v1-5 virtual-current-pos-local)) @@ -3364,66 +3240,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) - (vector-copy! (-> a2-5 current-pos) (-> a2-5 dest-pos)) - (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) + (vector-copy! (-> a2-5 current-pos) (-> a2-5 dest-pos)) + (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) + ) ) ) ) @@ -3471,8 +3352,7 @@ (vector-! (-> s5-0 right-dir) (-> this current-pos-local) (the-as vector s3-0)) (let ((f30-0 (vector-length-squared (-> s5-0 right-dir)))) (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)) @@ -3485,10 +3365,8 @@ ) (set! (-> this target-dir y) 0.0) (vector+float*! (-> this velocity) (-> this velocity) (-> this target-dir) (-> this nav sec-per-frame)) - (let ((f0-11 (vector-length-squared (-> this velocity))) - (f1-4 (-> this nav target-speed)) - ) - (if (< (* f1-4 f1-4) f0-11) + (let ((f0-11 (vector-length-squared (-> this velocity)))) + (if (< (square (-> this nav target-speed)) f0-11) (vector-float*! (-> this velocity) (-> this velocity) (/ (-> this nav target-speed) (sqrtf f0-11))) ) ) @@ -3523,10 +3401,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)))) (vector-copy! (-> this heading) (-> this travel)) (set! (-> this heading y) 0.0) diff --git a/test/decompiler/reference/jak3/engine/nav/nav-enemy_REF.gc b/test/decompiler/reference/jak3/engine/nav/nav-enemy_REF.gc index c67090a7e7..2ce45fd361 100644 --- a/test/decompiler/reference/jak3/engine/nav/nav-enemy_REF.gc +++ b/test/decompiler/reference/jak3/engine/nav/nav-enemy_REF.gc @@ -181,9 +181,7 @@ ) (else (if (or (not (closest-point-on-mesh (-> this nav) s5-0 (-> gp-0 trans) (-> s3-0 current-poly))) - (let ((f0-0 32768.0)) - (< (* f0-0 f0-0) (vector-vector-xz-distance-squared s5-0 (-> gp-0 trans))) - ) + (< (square 32768.0) (vector-vector-xz-distance-squared s5-0 (-> gp-0 trans))) (< (- (-> gp-0 trans y) (-> s5-0 y)) -8192.0) ) (return #t) @@ -539,10 +537,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) ) ) @@ -696,7 +692,6 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs object. (defmethod setup-enemy! ((this nav-enemy) (arg0 nav-enemy-info)) - (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!)) @@ -800,8 +795,9 @@ ) (reset-to-collide-spec (-> this focus) (the-as collide-spec cspec)) ) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-104 (res-lump-data (-> this entity) 'actor-groups pointer :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-104 (res-lump-data (-> this entity) 'actor-groups pointer :tag-ptr (& sv-16))) + ) (cond ((and v1-104 (nonzero? (-> sv-16 elt-count))) (set! (-> this actor-group) (the-as (pointer actor-group) v1-104)) diff --git a/test/decompiler/reference/jak3/engine/nav/nav-engine_REF.gc b/test/decompiler/reference/jak3/engine/nav/nav-engine_REF.gc index 341ab5b1bf..2765727d47 100644 --- a/test/decompiler/reference/jak3/engine/nav/nav-engine_REF.gc +++ b/test/decompiler/reference/jak3/engine/nav/nav-engine_REF.gc @@ -390,13 +390,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) @@ -432,28 +431,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) ) @@ -473,10 +459,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) ) @@ -505,15 +491,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)) diff --git a/test/decompiler/reference/jak3/engine/nav/nav-mesh-h_REF.gc b/test/decompiler/reference/jak3/engine/nav/nav-mesh-h_REF.gc index 800d2af59b..1bb42175c2 100644 --- a/test/decompiler/reference/jak3/engine/nav/nav-mesh-h_REF.gc +++ b/test/decompiler/reference/jak3/engine/nav/nav-mesh-h_REF.gc @@ -648,24 +648,25 @@ Based on the implementation of point-poly-intersection?, these should likely be ;; INFO: Used lq/sq (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 number)) - (set! sv-48 (new 'stack-no-clear 'vector)) - (set! sv-52 (new 'stack-no-clear 'vector)) - (set! sv-56 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 (the-as float sv-56)) - (set! sv-56 f0-1) - (vector-copy! sv-52 sv-48) - ) + (let ((sv-48 (new 'stack-no-clear 'vector)) + (sv-52 (new 'stack-no-clear 'vector)) + ) + (let* ((sv-56 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 (the-as float sv-56)) + (set! sv-56 f0-1) + (vector-copy! sv-52 sv-48) + ) + ) + (set! v1-3 s2-0) ) - (set! v1-3 s2-0) ) + (vector-copy! arg1 sv-52) ) - (vector-copy! arg1 sv-52) arg1 ) @@ -673,17 +674,17 @@ Based on the implementation of point-poly-intersection?, these should likely be ;; INFO: Used lq/sq (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 number)) (cond ((point-in-poly? this arg0 arg2) (vector-copy! arg1 arg2) ) (else - (let ((s5-1 arg1)) - (set! sv-48 (new 'stack-no-clear 'vector)) - (set! sv-52 (new 'stack-no-clear 'vector)) - (set! sv-56 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 10000000000000000000000000000000000000.0) + (s2-0 (-> arg0 vertex-count)) (v1-6 (the-as int (+ s2-0 -1))) ) (dotimes (s1-0 (the-as int s2-0)) @@ -707,80 +708,71 @@ Based on the implementation of point-poly-intersection?, these should likely be ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defmethod advance-ray-to-nearest-poly-edge-or-dest! ((this nav-mesh) (arg0 nav-ray)) - (local-vars - (sv-16 int) - (sv-24 nav-mesh-work) - (sv-28 nav-poly) - (sv-32 uint) - (sv-36 (pointer int8)) - (sv-40 (pointer int8)) - (sv-44 float) - (sv-48 float) - (sv-52 vector) - (sv-56 vector) - (sv-60 float) - (sv-64 float) - (sv-68 uint) - ) - (set! sv-16 -1) - (set! sv-24 (-> this work)) - (set! sv-28 (-> arg0 current-poly)) - (set! sv-32 (-> arg0 current-poly vertex-count)) - (set! sv-36 (-> this work vert0-table)) - (set! sv-40 (-> this work vert1-table)) - (set! sv-44 (- (-> arg0 dest-pos x) (-> arg0 current-pos x))) - (set! sv-48 (- (-> arg0 dest-pos z) (-> arg0 current-pos z))) - (dotimes (v1-9 (the-as int sv-32)) - (set! sv-52 (-> sv-28 vertex (-> sv-36 v1-9))) - (set! sv-56 (-> sv-28 vertex (-> sv-40 v1-9))) - (set! sv-60 (- (-> sv-52 z) (-> sv-56 z))) - (set! sv-64 (- (-> sv-56 x) (-> sv-52 x))) - (let ((f0-10 (+ (* sv-44 sv-60) (* sv-48 sv-64)))) - (when (< 0.0 f0-10) - (let ((f1-10 - (+ (* sv-60 (- (-> sv-52 x) (-> arg0 current-pos x))) (* sv-64 (- (-> sv-52 z) (-> arg0 current-pos z)))) + (let ((sv-16 -1)) + (let ((sv-24 (-> this work))) + ) + (let ((sv-28 (-> arg0 current-poly)) + (sv-32 (-> arg0 current-poly vertex-count)) + (sv-36 (-> this work vert0-table)) + (sv-40 (-> this work vert1-table)) + (sv-44 (- (-> arg0 dest-pos x) (-> arg0 current-pos x))) + (sv-48 (- (-> arg0 dest-pos z) (-> arg0 current-pos z))) + ) + (dotimes (v1-9 (the-as int sv-32)) + (let* ((sv-52 (-> sv-28 vertex (-> sv-36 v1-9))) + (sv-56 (-> sv-28 vertex (-> sv-40 v1-9))) + (sv-60 (- (-> sv-52 z) (-> sv-56 z))) + (sv-64 (- (-> sv-56 x) (-> sv-52 x))) + (f0-10 (+ (* sv-44 sv-60) (* sv-48 sv-64))) + ) + (when (< 0.0 f0-10) + (let ((f1-10 + (+ (* sv-60 (- (-> sv-52 x) (-> arg0 current-pos x))) (* sv-64 (- (-> sv-52 z) (-> arg0 current-pos z)))) + ) + ) + (when (< f1-10 f0-10) + (set! sv-16 v1-9) + (let ((f0-12 (fmax 0.0 (/ f1-10 f0-10)))) + (set! sv-44 (* sv-44 f0-12)) + (set! sv-48 (* sv-48 f0-12)) + ) ) ) - (when (< f1-10 f0-10) - (set! sv-16 v1-9) - (let ((f0-12 (fmax 0.0 (/ f1-10 f0-10)))) - (set! sv-44 (* sv-44 f0-12)) - (set! sv-48 (* sv-48 f0-12)) - ) ) ) ) - ) - ) - (let ((f0-16 (+ (* sv-44 (-> arg0 dir x)) (* sv-48 (-> arg0 dir z))))) - (+! (-> arg0 len) f0-16) - ) - 0 - (set! (-> arg0 next-poly) #f) - (cond - ((= sv-16 -1) - (vector-copy! (-> arg0 current-pos) (-> arg0 dest-pos)) - (set! (-> arg0 reached-dest) #t) - (set! (-> arg0 terminated) #t) - ) - (else - (+! (-> arg0 current-pos x) sv-44) - (+! (-> arg0 current-pos z) sv-48) - (set! sv-68 (-> sv-28 adj-poly sv-16)) - (if (!= sv-68 255) - (set! (-> arg0 next-poly) (-> this poly-array sv-68)) - ) + (let ((f0-16 (+ (* sv-44 (-> arg0 dir x)) (* sv-48 (-> arg0 dir z))))) + (+! (-> arg0 len) f0-16) + ) + 0 + (set! (-> arg0 next-poly) #f) (cond - ((and (-> arg0 next-poly) (not (logtest? (-> arg0 next-poly pat) (-> arg0 ignore)))) - (set! (-> arg0 current-poly) (-> arg0 next-poly)) + ((= sv-16 -1) + (vector-copy! (-> arg0 current-pos) (-> arg0 dest-pos)) + (set! (-> arg0 reached-dest) #t) + (set! (-> arg0 terminated) #t) ) (else - (set! (-> arg0 last-edge) sv-16) - (if (-> arg0 next-poly) - (set! (-> arg0 hit-gap) #t) - (set! (-> arg0 hit-boundary) #t) + (+! (-> arg0 current-pos x) sv-44) + (+! (-> arg0 current-pos z) sv-48) + (let ((sv-68 (-> sv-28 adj-poly sv-16))) + (if (!= sv-68 255) + (set! (-> arg0 next-poly) (-> this poly-array sv-68)) + ) + ) + (cond + ((and (-> arg0 next-poly) (not (logtest? (-> arg0 next-poly pat) (-> arg0 ignore)))) + (set! (-> arg0 current-poly) (-> arg0 next-poly)) + ) + (else + (set! (-> arg0 last-edge) sv-16) + (if (-> arg0 next-poly) + (set! (-> arg0 hit-gap) #t) + (set! (-> arg0 hit-boundary) #t) + ) + (set! (-> arg0 terminated) #t) ) - (set! (-> arg0 terminated) #t) + ) ) ) ) diff --git a/test/decompiler/reference/jak3/engine/nav/nav-mesh_REF.gc b/test/decompiler/reference/jak3/engine/nav/nav-mesh_REF.gc index ea37e579dd..466556004e 100644 --- a/test/decompiler/reference/jak3/engine/nav/nav-mesh_REF.gc +++ b/test/decompiler/reference/jak3/engine/nav/nav-mesh_REF.gc @@ -497,12 +497,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 (the-as vector (-> gp-0 bounds))) (when (or (not (-> s5-1 poly)) (not (point-in-poly? gp-0 (-> s5-1 poly) (-> s5-1 point)))) @@ -829,11 +829,11 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defmethod init-from-entity ((this nav-mesh) (arg0 entity-nav-mesh)) - (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 (inline-array sphere) :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-2 (res-lump-data arg0 'nav-mesh-sphere (inline-array sphere) :tag-ptr (& sv-16))) + ) (when v1-2 (set! (-> this static-sphere-count) (-> sv-16 elt-count)) (set! (-> this static-sphere) v1-2) @@ -922,78 +922,79 @@ ;; 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 debug) - (-> this bounds) - (-> this bounds r) - (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 debug) - (-> 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 577) - ) - (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 debug) + (-> this bounds) + (-> this bounds r) + (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 debug) (-> 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 577) + ) + (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* - ) - ) - ((logtest? (-> s4-1 pat) 8) - *color-magenta* - ) - (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* + ) + ) + ((logtest? (-> s4-1 pat) 8) + *color-magenta* + ) + (else + *color-cyan* + ) ) - ) - ) - (when (logtest? sv-36 32) - (let ((s3-1 add-debug-text-3d) - (s2-1 #t) - (s1-1 577) + ) + (when (logtest? sv-36 32) + (let ((s3-1 add-debug-text-3d) + (s2-1 #t) + (s1-1 577) + ) + (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) ) ) ) @@ -1081,7 +1082,7 @@ ;; definition for method 45 of type nav-mesh (defmethod nav-mesh-method-45 ((this nav-mesh) (arg0 nav-poly)) - (local-vars (v1-15 int) (sv-16 nav-poly)) + (local-vars (v1-15 int)) (let ((s4-0 (search-for-point (-> this poly-hash) (-> arg0 vertex 0))) (s3-0 (-> this poly-hash bucket-size)) (s2-0 0) @@ -1095,11 +1096,11 @@ (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 vertex0 y)) - (f1-0 (-> arg0 vertex1 x)) - ) + (let* ((sv-16 (-> this poly-array s1-0)) + (v1-5 sv-16) + (f0-0 (-> arg0 vertex0 y)) + (f1-0 (-> arg0 vertex1 x)) + ) (when (and (and (>= (+ (-> v1-5 vertex3 w) f1-0) f0-0) (>= f0-0 (- (-> v1-5 vertex2 w) f1-0))) (not (logtest? (-> sv-16 pat) (-> arg0 data 20))) ) @@ -1127,15 +1128,12 @@ ;; definition for method 47 of type nav-mesh ;; INFO: Used lq/sq (defmethod is-in-mesh-local? ((this nav-mesh) (arg0 vector) (arg1 float) (arg2 float)) - (local-vars (sv-16 float) (sv-20 vector) (sv-24 float)) - (set! sv-16 arg2) - (set! sv-20 arg0) - (set! sv-24 arg1) - (let* ((f0-3 (+ sv-24 (-> this bounds r))) - (f0-5 (* f0-3 f0-3)) + (let* ((sv-16 arg2) + (sv-20 arg0) + (sv-24 arg1) (v1-1 sv-20) ) - (when (>= f0-5 (+ (* (-> v1-1 x) (-> v1-1 x)) (* (-> v1-1 z) (-> v1-1 z)))) + (when (>= (square (+ sv-24 (-> this bounds r))) (+ (* (-> v1-1 x) (-> v1-1 x)) (* (-> v1-1 z) (-> v1-1 z)))) (let ((s5-0 (new 'stack-no-clear 'nav-poly))) (set! (-> s5-0 vertex 0 quad) (-> sv-20 quad)) (set! (-> s5-0 vertex1 x) sv-16) @@ -1148,11 +1146,7 @@ (else (let ((s4-0 (new 'stack-no-clear 'vector))) (project-point-into-poly-2d this (the-as nav-poly (-> s5-0 vertex1 z)) s4-0 sv-20) - (let ((f0-7 (vector-vector-xz-distance-squared s4-0 sv-20)) - (f1-5 sv-24) - ) - (< f0-7 (* f1-5 f1-5)) - ) + (< (vector-vector-xz-distance-squared s4-0 sv-20) (square sv-24)) ) ) ) @@ -1316,30 +1310,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))) @@ -1366,114 +1346,108 @@ ;; definition for method 46 of type nav-mesh (defmethod nav-mesh-method-46 ((this nav-mesh) (arg0 nav-poly)) - (local-vars - (v1-16 int) - (v1-31 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 vertex 0) 12288.0)) - (set! (-> arg0 vertex2 x) (the-as float #f)) - (let ((s4-0 (-> this poly-hash bucket-size)) - (s3-0 sv-20) - (s2-0 0) - ) - (nop!) - (until (zero? v1-16) - (let ((s1-0 (* s2-0 8)) - (s0-0 (-> s3-0 0)) + (local-vars (v1-16 int) (v1-31 int)) + (let ((sv-16 (the-as nav-poly #f))) + (let ((sv-20 (search-for-sphere (-> this poly-hash) (-> arg0 vertex 0) 12288.0))) + (set! (-> arg0 vertex2 x) (the-as float #f)) + (let ((s4-0 (-> this poly-hash bucket-size)) + (s3-0 sv-20) + (s2-0 0) ) - (b! (zero? s0-0) cfg-17 :delay (nop!)) - (let ((v1-3 (logand s0-0 1))) - (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 vertex0 y)) - (f1-0 (-> arg0 vertex1 x)) - ) - (when (and (and (>= (+ (-> v1-6 vertex3 w) f1-0) f0-0) (>= f0-0 (- (-> v1-6 vertex2 w) f1-0))) - (not (logtest? (-> sv-24 pat) (-> arg0 data 20))) - ) - (when (point-in-poly? this sv-24 (-> arg0 vertex 0)) - (set! (-> arg0 vertex2 x) (the-as float #t)) - (set! (-> arg0 vertex1 w) 0.0) - (set! sv-16 sv-24) - (goto cfg-38) - ) - ) - ) - (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!) - ) - ) - (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-31) - (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 vertex0 y)) - (f1-2 (-> arg0 vertex1 x)) - ) - (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 data 20))) - ) - (set! sv-40 (+ sv-40 1)) - (set! sv-52 (point-poly-distance-min (-> this work) (the-as nav-poly (-> arg0 vertex)) sv-28 sv-48)) - (when (< sv-52 sv-28) - (set! sv-28 sv-52) - (set! sv-16 sv-48) + (until (zero? v1-16) + (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))) (nop!) + (b! (zero? v1-3) cfg-16 :delay (nop!)) ) + (let* ((sv-24 (-> this poly-array s1-0)) + (v1-6 sv-24) + (f0-0 (-> arg0 vertex0 y)) + (f1-0 (-> arg0 vertex1 x)) + ) + (when (and (and (>= (+ (-> v1-6 vertex3 w) f1-0) f0-0) (>= f0-0 (- (-> v1-6 vertex2 w) f1-0))) + (not (logtest? (-> sv-24 pat) (-> arg0 data 20))) + ) + (when (point-in-poly? this sv-24 (-> arg0 vertex 0)) + (set! (-> arg0 vertex2 x) (the-as float #t)) + (set! (-> arg0 vertex1 w) 0.0) + (set! sv-16 sv-24) + (goto cfg-38) + ) + ) + ) + (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!) + ) + ) + (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-31) + (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 vertex0 y)) + (f1-2 (-> arg0 vertex1 x)) + ) + (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 data 20))) + ) + (+! sv-40 1) + (let ((sv-52 (point-poly-distance-min (-> this work) (the-as nav-poly (-> arg0 vertex)) 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-31 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 vertex1 w) sv-28) ) - (label cfg-34) - (+! s2-1 1) - (set! s3-1 (&-> s3-1 1)) - (set-on-less-than v1-31 s2-1 s4-1) - (nop!) ) + (label cfg-38) + (set! (-> arg0 vertex1 z) (the-as float sv-16)) ) - (if (not sv-16) - (set! sv-16 (-> this poly-array 0)) - ) - (set! (-> arg0 vertex1 w) sv-28) - (label cfg-38) - (set! (-> arg0 vertex1 z) (the-as float sv-16)) arg0 ) @@ -1589,17 +1563,6 @@ ;; definition for method 17 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) @@ -1609,77 +1572,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) @@ -1737,72 +1704,69 @@ ;; definition for method 41 of type nav-mesh ;; INFO: Used lq/sq (defmethod nav-mesh-method-41 ((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)) - (vector-copy! arg2 arg3) - (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)) + ) + (vector-copy! arg2 arg3) + (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 + ) + ) + ) ) ) ) @@ -1905,30 +1869,29 @@ ;; definition for function find-nearest-nav-mesh (defun find-nearest-nav-mesh ((arg0 vector) (arg1 float)) - (local-vars (sv-64 nav-find-poly-parms) (sv-68 nav-mesh) (sv-72 float) (sv-76 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 (the-as vector (-> s3-0 bounds))) - (let ((f0-1 (vector-length-squared (-> sv-64 point))) - (f1-0 (-> s3-0 bounds r)) - ) - (when (< f0-1 (* f1-0 f1-0)) - (set! (-> sv-64 y-threshold) (-> s3-0 nearest-y-threshold)) - (nav-mesh-method-46 s3-0 (the-as nav-poly 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 (the-as vector (-> s3-0 bounds))) + (when (< (vector-length-squared (-> sv-64 point)) (square (-> s3-0 bounds r))) + (set! (-> sv-64 y-threshold) (-> s3-0 nearest-y-threshold)) + (nav-mesh-method-46 s3-0 (the-as nav-poly sv-64)) + (when (>= sv-72 (-> sv-64 dist)) + (set! sv-72 (-> sv-64 dist)) + (set! sv-68 s3-0) + ) ) ) ) @@ -1939,15 +1902,15 @@ ) ) ) + 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 (the-as vector (-> this bounds))) (when (or (not (-> gp-0 poly)) (not (point-in-poly? this (-> gp-0 poly) (-> gp-0 point)))) @@ -1997,54 +1960,55 @@ ;; definition for method 36 of type nav-mesh ;; INFO: Used lq/sq (defmethod nav-mesh-method-36 ((this nav-mesh) (arg0 vector) (arg1 vector) (arg2 float)) - (local-vars (v1-13 int) (sv-80 vector) (sv-84 (pointer uint8))) + (local-vars (v1-13 int)) (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) - (vector-copy! (-> gp-0 vertex1) arg1) - (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)) - (v1-7 a0-5) - (f0-3 (-> gp-0 vertex1 y)) - (f1-0 (-> this nearest-y-threshold)) - ) - (if (and (>= (+ (-> v1-7 vertex3 w) f1-0) f0-3) (>= f0-3 (- (-> v1-7 vertex2 w) f1-0))) - (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) + (vector-copy! (-> gp-0 vertex1) arg1) + (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)) + (v1-7 a0-5) + (f0-3 (-> gp-0 vertex1 y)) + (f1-0 (-> this nearest-y-threshold)) + ) + (if (and (>= (+ (-> v1-7 vertex3 w) f1-0) f0-3) (>= f0-3 (- (-> v1-7 vertex2 w) f1-0))) + (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 + (vector-copy! sv-80 (-> gp-0 vertex 0)) ) - 0 - (vector-copy! sv-80 (-> gp-0 vertex 0)) (-> gp-0 vertex3 y) ) ) @@ -2153,21 +2117,17 @@ (let ((a0-9 (-> gp-0 vec5))) (set! (-> gp-0 vec3 z) (+ (* (-> a0-9 x) (-> a0-9 x)) (* (-> a0-9 z) (-> a0-9 z)))) ) - (let ((f0-8 (-> gp-0 vec3 z)) - (f1-4 (+ (-> gp-0 vec3 y) (-> gp-0 vec4 w))) - ) - (when (< f0-8 (* f1-4 f1-4)) - (vector-copy! (-> gp-0 vec2) (-> gp-0 vec1)) - (set! (-> gp-0 vec3 w) (sqrtf (-> gp-0 vec3 z))) - (vector-float*! (-> gp-0 vec6) (-> gp-0 vec5) (/ 1.0 (-> gp-0 vec3 w))) - (vector+float*! - (-> gp-0 vec1) - (-> gp-0 vec1) - (-> gp-0 vec6) - (+ (- 410.0 (-> gp-0 vec3 w)) (-> gp-0 vec4 w) (-> gp-0 vec3 y)) - ) - 0 + (when (< (-> gp-0 vec3 z) (square (+ (-> gp-0 vec3 y) (-> gp-0 vec4 w)))) + (vector-copy! (-> gp-0 vec2) (-> gp-0 vec1)) + (set! (-> gp-0 vec3 w) (sqrtf (-> gp-0 vec3 z))) + (vector-float*! (-> gp-0 vec6) (-> gp-0 vec5) (/ 1.0 (-> gp-0 vec3 w))) + (vector+float*! + (-> gp-0 vec1) + (-> gp-0 vec1) + (-> gp-0 vec6) + (+ (- 410.0 (-> gp-0 vec3 w)) (-> gp-0 vec4 w) (-> gp-0 vec3 y)) ) + 0 ) ) (+! (-> gp-0 byte02) 1) diff --git a/test/decompiler/reference/jak3/engine/physics/chain-physics_REF.gc b/test/decompiler/reference/jak3/engine/physics/chain-physics_REF.gc index 89e2590cd2..bbebc9623c 100644 --- a/test/decompiler/reference/jak3/engine/physics/chain-physics_REF.gc +++ b/test/decompiler/reference/jak3/engine/physics/chain-physics_REF.gc @@ -82,26 +82,7 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defmethod update ((this chain-physics) (arg0 process-drawable)) - (local-vars - (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 vector) - (sv-464 vector) - (sv-480 vector) - (sv-496 vector) - (sv-512 vector) - (sv-528 vector) - ) + (local-vars (f0-11 float)) (rlet ((acc :class vf) (vf0 :class vf) (vf1 :class vf) @@ -144,201 +125,206 @@ ) ) (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 num-joints) -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)) - (f0-13 (vector-length-squared a2-9)) - (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))) - ) - ) - (vector-copy! (-> sv-272 position) sv-528) - (if (-> sv-272 joint-mod) - (vector-copy! (-> sv-272 joint-mod trans) sv-528) - ) - (when (< s0-0 (the-as int (-> this num-joints))) - (vector-! (-> s4-0 uvec) sv-528 s3-0) - (vector-normalize! (-> s4-0 uvec) 1.0) + (vector-copy! sv-528 (-> sv-272 position)) + (set! (-> sv-272 joint-mod flex-blend) f30-0) (if (-> this negate-y) - (vector-negate! (-> s4-0 uvec) (-> s4-0 uvec)) + (vector-negate! s1-0 s1-0) ) - (vector-cross! (-> s4-0 rvec) (-> s4-0 uvec) s2-0) - (vector-normalize! (-> s4-0 rvec) 1.0) - (set! sv-496 (new 'stack-no-clear 'vector)) - (let ((v1-97 (-> sv-272 old-x)) - (a0-51 (-> s4-0 rvec)) + (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 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 uvec)) - (vector-normalize! sv-496 1.0) - (cond - ((< (vector-dot (-> s4-0 rvec) sv-496) (cos (-> this axial-slop))) - (vector-cross! sv-496 sv-496 (-> s4-0 rvec)) - (vector-cross! sv-496 (-> s4-0 rvec) sv-496) - (vector-normalize! sv-496 1.0) - (set! sv-464 (-> s4-0 rvec)) - (set! sv-448 (-> s4-0 rvec)) - (let ((f0-20 (cos (-> this axial-slop)))) - (.lvf vf1 (&-> sv-448 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 quad) vf1) - (set! sv-512 (-> s4-0 rvec)) - (set! sv-480 (-> s4-0 rvec)) - (let ((f0-22 (sin (-> this axial-slop)))) - (.lvf vf2 (&-> sv-496 quad)) - (.lvf vf1 (&-> sv-480 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 quad) vf4) - (vector-copy! (-> sv-272 old-x) (-> s4-0 rvec)) - ) - (else - (vector-copy! (-> s4-0 rvec) sv-496) - (vector-copy! (-> sv-272 old-x) (-> s4-0 rvec)) + (.lvf vf5 (&-> sv-288 quad)) + (.add.vf.xyz vf6 vf4 vf5) + (.svf (&-> v1-34 quad) vf6) ) ) - (vector-cross! (-> s4-0 fvec) (-> s4-0 rvec) (-> s4-0 uvec)) - (matrix->quaternion (-> sv-272 joint-mod quat) s4-0) - (vector-copy! s1-0 (-> s4-0 uvec)) - (vector-copy! s2-0 (-> s4-0 fvec)) - 0 + (when (< s0-0 (the-as int (+ (-> this num-joints) -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)) + (f0-13 (vector-length-squared a2-9)) + (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))) + ) + ) + (vector-copy! (-> sv-272 position) sv-528) + (if (-> sv-272 joint-mod) + (vector-copy! (-> sv-272 joint-mod trans) sv-528) + ) + (when (< s0-0 (the-as int (-> this num-joints))) + (vector-! (-> s4-0 uvec) sv-528 s3-0) + (vector-normalize! (-> s4-0 uvec) 1.0) + (if (-> this negate-y) + (vector-negate! (-> s4-0 uvec) (-> s4-0 uvec)) + ) + (vector-cross! (-> s4-0 rvec) (-> s4-0 uvec) s2-0) + (vector-normalize! (-> s4-0 rvec) 1.0) + (let ((sv-496 (new 'stack-no-clear 'vector))) + (let ((v1-97 (-> sv-272 old-x)) + (a0-51 (-> s4-0 rvec)) + ) + (.lvf vf1 (&-> v1-97 quad)) + (.lvf vf2 (&-> a0-51 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 uvec)) + (vector-normalize! sv-496 1.0) + (cond + ((< (vector-dot (-> s4-0 rvec) sv-496) (cos (-> this axial-slop))) + (vector-cross! sv-496 sv-496 (-> s4-0 rvec)) + (vector-cross! sv-496 (-> s4-0 rvec) sv-496) + (vector-normalize! sv-496 1.0) + (let ((sv-464 (-> s4-0 rvec))) + (let ((sv-448 (-> s4-0 rvec)) + (f0-20 (cos (-> this axial-slop))) + ) + (.lvf vf1 (&-> sv-448 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 quad) vf1) + ) + (let ((sv-512 (-> s4-0 rvec))) + (let ((sv-480 (-> s4-0 rvec)) + (f0-22 (sin (-> this axial-slop))) + ) + (.lvf vf2 (&-> sv-496 quad)) + (.lvf vf1 (&-> sv-480 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 quad) vf4) + ) + (vector-copy! (-> sv-272 old-x) (-> s4-0 rvec)) + ) + (else + (vector-copy! (-> s4-0 rvec) sv-496) + (vector-copy! (-> sv-272 old-x) (-> s4-0 rvec)) + ) + ) + ) + (vector-cross! (-> s4-0 fvec) (-> s4-0 rvec) (-> s4-0 uvec)) + (matrix->quaternion (-> sv-272 joint-mod quat) s4-0) + (vector-copy! s1-0 (-> s4-0 uvec)) + (vector-copy! s2-0 (-> s4-0 fvec)) + 0 + ) + (vector-copy! s3-0 sv-528) ) - (vector-copy! s3-0 sv-528) 0 ) ) diff --git a/test/decompiler/reference/jak3/engine/physics/cloth_REF.gc b/test/decompiler/reference/jak3/engine/physics/cloth_REF.gc index 4f6894872f..f9a6217685 100644 --- a/test/decompiler/reference/jak3/engine/physics/cloth_REF.gc +++ b/test/decompiler/reference/jak3/engine/physics/cloth_REF.gc @@ -373,7 +373,6 @@ ;; WARN: Return type mismatch int vs none. (defmethod initialize-cloth-system! ((this cloth-system) (arg0 cloth-params)) "Set up this cloth system with the given [[cloth-params]]." - (local-vars (sv-16 int) (sv-20 int) (sv-24 int) (sv-28 int)) (if (or (zero? (-> this mesh)) (< (-> this mesh length) 4)) (go process-drawable-art-error "cloth-mesh (art-cloth-geo)") ) @@ -413,16 +412,15 @@ (set! (-> this particles data v1-38 pos quad) (-> this mesh mesh v1-38 pt quad)) (set! (-> this particles data v1-38 mass-scale) 1.0) ) - (set! sv-16 (* (+ (-> this cloth-width) -1) (-> this cloth-height))) - (set! sv-20 (* (+ (-> this cloth-height) -1) (-> this cloth-width))) - (set! sv-24 (+ (* (+ (-> this cloth-width) -2) 2) 2)) - (let ((v1-52 (* sv-24 (+ (-> this cloth-height) -1))) - (s4-0 (* (+ (-> this cloth-width) -2) (-> this cloth-height))) - ) - (set! sv-28 (+ s4-0 (* (-> this cloth-width) (+ (-> this cloth-height) -2)))) + (let* ((sv-16 (* (+ (-> this cloth-width) -1) (-> this cloth-height))) + (sv-20 (* (+ (-> this cloth-height) -1) (-> this cloth-width))) + (v1-52 (* (+ (* (+ (-> this cloth-width) -2) 2) 2) (+ (-> this cloth-height) -1))) + (s4-0 (* (+ (-> this cloth-width) -2) (-> this cloth-height))) + (sv-28 (+ s4-0 (* (-> this cloth-width) (+ (-> this cloth-height) -2)))) + ) (when (logtest? (-> this flags) (cloth-flag wraps)) (+! s4-0 (* (-> this cloth-height) 2)) - (set! sv-28 (+ sv-28 (* (-> this cloth-height) 2))) + (+! sv-28 (* (-> this cloth-height) 2)) ) (set! sv-28 (max 0 sv-28)) (let ((s3-1 (max 0 v1-52))) @@ -727,7 +725,7 @@ ) ) (set! (-> s4-0 one-over-two-times-constraint-length) (/ 1.0 (* 2.0 f0-1))) - (set! (-> s4-0 constraint-length-sqd) (* f0-1 f0-1)) + (set! (-> s4-0 constraint-length-sqd) (square f0-1)) (set! (-> s4-0 constraint-length-half) (/ f0-1 2)) ) ) @@ -799,9 +797,7 @@ ) (when (< -1 (-> this base-transform-index)) (let ((s5-2 (-> (the-as process-focusable s5-1) node-list data 3 bone transform trans))) - (let ((f0-0 12288.0)) - (when (< (* f0-0 f0-0) (vector-vector-distance-squared (-> this last-owner-pos) s5-2)) - ) + (when (< (square 12288.0) (vector-vector-distance-squared (-> this last-owner-pos) s5-2)) ) (vector-copy! (-> this last-owner-pos) s5-2) ) @@ -988,7 +984,7 @@ (a3-4 (vector-! (new 'stack-no-clear 'vector) (-> a2-6 pos) (-> a1-5 pos))) ) 0.0 - (let ((f1-2 (* f0-1 f0-1))) + (let ((f1-2 (square f0-1))) 0.0 0.0 (let* ((f1-4 (/ (+ f1-2 (vector-dot a3-4 a3-4)) (* 2.0 f0-1))) @@ -1026,80 +1022,75 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch symbol vs none. (defmethod cloth-system-method-23 ((this cloth-system)) - (local-vars - (sv-32 int) - (sv-40 int) - (sv-48 int) - (sv-56 int) - (sv-64 matrix) - (sv-68 verlet-particle) - (sv-72 verlet-particle) - (sv-76 verlet-particle) - (sv-80 verlet-particle) - (sv-144 vector) - (sv-148 vector) - (sv-152 float) - (sv-156 float) - (sv-160 vector) - (sv-164 float) - (sv-168 float) - (sv-208 vector) - (sv-212 float) - (sv-216 vector) - ) - (set! sv-32 0) - (set! sv-40 0) - (set! sv-48 0) - (set! sv-56 -1) - (set! sv-64 (new 'stack-no-clear 'matrix)) - (dotimes (s5-0 (+ (-> this cloth-height) -1)) - (dotimes (s4-0 (+ (-> this cloth-width) -1)) - (set! sv-68 (-> this particles data sv-32)) - (set! sv-72 (-> this particles data (+ sv-32 1))) - (set! sv-76 (-> this particles data (+ sv-32 (-> this cloth-width)))) - (set! sv-80 (-> this particles data (+ (-> this cloth-width) 1 sv-32))) - (set! sv-144 (vector-! (new 'stack-no-clear 'vector) (-> sv-80 pos) (-> sv-68 pos))) - (set! sv-148 (vector-! (new 'stack-no-clear 'vector) (-> sv-72 pos) (-> sv-76 pos))) - (set! sv-152 (the-as float 0.0)) - (set! sv-156 (the-as float 0.0)) - (set! sv-160 (new 'stack-no-clear 'vector)) - (set! sv-164 (the-as float 0.0)) - (vector-float*! sv-160 (-> sv-72 pos) (-> sv-72 mass-scale)) - (vector+float*! sv-160 sv-160 (-> sv-68 pos) (-> sv-68 mass-scale)) - (vector+float*! sv-160 sv-160 (-> sv-76 pos) (-> sv-76 mass-scale)) - (vector+float*! sv-160 sv-160 (-> sv-80 pos) (-> sv-80 mass-scale)) - (vector-float*! sv-160 sv-160 0.25) - (set! sv-40 0) - (set! sv-56 -1) - (set! (-> sv-64 rvec quad) (the-as uint128 0)) - (dotimes (s3-0 (-> this collision-constraints length)) - (when (!= s3-0 sv-56) - (let ((v1-39 (-> this collision-constraints data s3-0))) - (set! sv-164 (the-as float 204.8)) - (set! sv-168 (the-as float 0.0)) - (set! sv-168 (+ (-> v1-39 r) (the-as float sv-164))) - (set! sv-208 (vector-! (new 'stack-no-clear 'vector) sv-160 (the-as vector v1-39))) - ) - (set! sv-212 (the-as float 0.0)) - (set! sv-216 (new 'stack-no-clear 'vector)) - (set! sv-212 (vector-dot sv-208 sv-208)) - (when (< sv-212 (* sv-168 sv-168)) - (vector-normalize-copy! sv-216 sv-208 sv-168) - (vector-! sv-216 sv-216 sv-208) - (when (and (> sv-40 0) (< (vector-dot sv-216 (-> sv-64 rvec)) 0.0)) - ) - (vector+float*! (-> sv-68 pos) (-> sv-68 pos) sv-216 (-> sv-68 mass-scale)) - (vector+float*! (-> sv-72 pos) (-> sv-72 pos) sv-216 (-> sv-72 mass-scale)) - (vector+float*! (-> sv-76 pos) (-> sv-76 pos) sv-216 (-> sv-76 mass-scale)) - (vector+float*! (-> sv-80 pos) (-> sv-80 pos) sv-216 (-> sv-80 mass-scale)) - (vector+! sv-160 sv-160 sv-216) - (set! sv-40 (+ sv-40 1)) - ) - ) + (let ((sv-32 0) + (sv-40 0) + ) + (let ((sv-48 0)) + ) + (let ((sv-56 -1) + (sv-64 (new 'stack-no-clear 'matrix)) + ) + (dotimes (s5-0 (+ (-> this cloth-height) -1)) + (dotimes (s4-0 (+ (-> this cloth-width) -1)) + (let ((sv-68 (-> this particles data sv-32)) + (sv-72 (-> this particles data (+ sv-32 1))) + (sv-76 (-> this particles data (+ sv-32 (-> this cloth-width)))) + (sv-80 (-> this particles data (+ (-> this cloth-width) 1 sv-32))) + ) + (let ((sv-144 (vector-! (new 'stack-no-clear 'vector) (-> sv-80 pos) (-> sv-68 pos)))) + ) + (let ((sv-148 (vector-! (new 'stack-no-clear 'vector) (-> sv-72 pos) (-> sv-76 pos)))) + ) + (let ((sv-152 (the-as float 0.0))) + ) + (let ((sv-156 (the-as float 0.0))) + ) + (let ((sv-160 (new 'stack-no-clear 'vector)) + (sv-164 (the-as float 0.0)) + ) + (vector-float*! sv-160 (-> sv-72 pos) (-> sv-72 mass-scale)) + (vector+float*! sv-160 sv-160 (-> sv-68 pos) (-> sv-68 mass-scale)) + (vector+float*! sv-160 sv-160 (-> sv-76 pos) (-> sv-76 mass-scale)) + (vector+float*! sv-160 sv-160 (-> sv-80 pos) (-> sv-80 mass-scale)) + (vector-float*! sv-160 sv-160 0.25) + (set! sv-40 0) + (set! sv-56 -1) + (set! (-> sv-64 rvec quad) (the-as uint128 0)) + (dotimes (s3-0 (-> this collision-constraints length)) + (when (!= s3-0 sv-56) + (let ((v1-39 (-> this collision-constraints data s3-0))) + (set! sv-164 (the-as float 204.8)) + (let ((sv-168 (the-as float 0.0))) + (set! sv-168 (+ (-> v1-39 r) (the-as float sv-164))) + (let ((sv-208 (vector-! (new 'stack-no-clear 'vector) sv-160 (the-as vector v1-39)))) + (let ((sv-212 (the-as float 0.0))) + ) + (let ((sv-216 (new 'stack-no-clear 'vector))) + (when (< (vector-dot sv-208 sv-208) (* sv-168 sv-168)) + (vector-normalize-copy! sv-216 sv-208 sv-168) + (vector-! sv-216 sv-216 sv-208) + (when (and (> sv-40 0) (< (vector-dot sv-216 (-> sv-64 rvec)) 0.0)) + ) + (vector+float*! (-> sv-68 pos) (-> sv-68 pos) sv-216 (-> sv-68 mass-scale)) + (vector+float*! (-> sv-72 pos) (-> sv-72 pos) sv-216 (-> sv-72 mass-scale)) + (vector+float*! (-> sv-76 pos) (-> sv-76 pos) sv-216 (-> sv-76 mass-scale)) + (vector+float*! (-> sv-80 pos) (-> sv-80 pos) sv-216 (-> sv-80 mass-scale)) + (vector+! sv-160 sv-160 sv-216) + (+! sv-40 1) + ) + ) + ) + ) + ) + ) + ) + ) + ) + (+! sv-32 1) + ) + (+! sv-32 1) ) - (set! sv-32 (+ sv-32 1)) ) - (set! sv-32 (+ sv-32 1)) ) (none) ) @@ -1107,63 +1098,54 @@ ;; definition for method 22 of type cloth-system ;; WARN: Return type mismatch symbol vs none. (defmethod cloth-system-method-22 ((this cloth-system)) - (local-vars - (sv-16 sphere) - (sv-24 int) - (sv-32 verlet-particle) - (sv-36 verlet-particle) - (sv-40 verlet-particle) - (sv-44 verlet-particle) - (sv-96 vector) - (sv-100 vector) - (sv-104 float) - (sv-108 float) - (sv-112 vector) - (sv-116 float) - (sv-120 float) - (sv-160 float) - (sv-164 float) - (sv-168 vector) - ) (dotimes (s5-0 (-> this collision-constraints length)) - (set! sv-16 (-> this collision-constraints data s5-0)) - (set! sv-24 0) - (dotimes (s4-0 (+ (-> this cloth-height) -1)) - (dotimes (s3-0 (+ (-> this cloth-width) -1)) - (set! sv-32 (-> this particles data sv-24)) - (set! sv-36 (-> this particles data (+ sv-24 1))) - (set! sv-40 (-> this particles data (+ sv-24 (-> this cloth-width)))) - (set! sv-44 (-> this particles data (+ (-> this cloth-width) 1 sv-24))) - (set! sv-96 (vector-! (new 'stack-no-clear 'vector) (-> sv-44 pos) (-> sv-32 pos))) - (set! sv-100 (vector-! (new 'stack-no-clear 'vector) (-> sv-36 pos) (-> sv-40 pos))) - (set! sv-104 (the-as float 0.0)) - (set! sv-108 (the-as float 0.0)) - (set! sv-112 (new 'stack-no-clear 'vector)) - (set! sv-116 (the-as float 0.0)) - (set! sv-104 (vector-length-squared sv-96)) - (set! sv-108 (vector-length-squared sv-100)) - (if (< sv-108 sv-104) - (vector+float*! sv-112 (-> sv-32 pos) sv-96 0.5) - (vector+float*! sv-112 (-> sv-40 pos) sv-100 0.5) - ) - (set! sv-116 (the-as float 0.0)) - (set! sv-120 (the-as float 0.0)) - (set! sv-120 (-> sv-16 r)) - (set! sv-160 (the-as float (vector-! (new 'stack-no-clear 'vector) sv-112 (the-as vector sv-16)))) - (set! sv-164 (the-as float 0.0)) - (set! sv-168 (new 'stack-no-clear 'vector)) - (set! sv-164 (vector-dot (the-as vector sv-160) (the-as vector sv-160))) - (when (< sv-164 (* sv-120 sv-120)) - (vector-normalize-copy! sv-168 (the-as vector sv-160) sv-120) - (vector-! sv-168 sv-168 (the-as vector sv-160)) - (vector+! (-> sv-32 pos) (-> sv-32 pos) sv-168) - (vector+! (-> sv-36 pos) (-> sv-36 pos) sv-168) - (vector+! (-> sv-40 pos) (-> sv-40 pos) sv-168) - (vector+! (-> sv-44 pos) (-> sv-44 pos) sv-168) + (let ((sv-16 (-> this collision-constraints data s5-0)) + (sv-24 0) ) - (set! sv-24 (+ sv-24 1)) + (dotimes (s4-0 (+ (-> this cloth-height) -1)) + (dotimes (s3-0 (+ (-> this cloth-width) -1)) + (let* ((sv-32 (-> this particles data sv-24)) + (sv-36 (-> this particles data (+ sv-24 1))) + (sv-40 (-> this particles data (+ sv-24 (-> this cloth-width)))) + (sv-44 (-> this particles data (+ (-> this cloth-width) 1 sv-24))) + (sv-96 (vector-! (new 'stack-no-clear 'vector) (-> sv-44 pos) (-> sv-32 pos))) + (sv-100 (vector-! (new 'stack-no-clear 'vector) (-> sv-36 pos) (-> sv-40 pos))) + (sv-104 (the-as float 0.0)) + ) + (let ((sv-108 (the-as float 0.0))) + ) + (let ((sv-112 (new 'stack-no-clear 'vector))) + (let ((sv-116 (the-as float 0.0))) + (set! sv-104 (vector-length-squared sv-96)) + (if (< (vector-length-squared sv-100) sv-104) + (vector+float*! sv-112 (-> sv-32 pos) sv-96 0.5) + (vector+float*! sv-112 (-> sv-40 pos) sv-100 0.5) + ) + (set! sv-116 (the-as float 0.0)) + ) + (let ((sv-120 (the-as float 0.0))) + (set! sv-120 (-> sv-16 r)) + (let ((sv-160 (the-as float (vector-! (new 'stack-no-clear 'vector) sv-112 (the-as vector sv-16))))) + (let ((sv-164 (the-as float 0.0))) + ) + (let ((sv-168 (new 'stack-no-clear 'vector))) + (when (< (vector-dot (the-as vector sv-160) (the-as vector sv-160)) (* sv-120 sv-120)) + (vector-normalize-copy! sv-168 (the-as vector sv-160) sv-120) + (vector-! sv-168 sv-168 (the-as vector sv-160)) + (vector+! (-> sv-32 pos) (-> sv-32 pos) sv-168) + (vector+! (-> sv-36 pos) (-> sv-36 pos) sv-168) + (vector+! (-> sv-40 pos) (-> sv-40 pos) sv-168) + (vector+! (-> sv-44 pos) (-> sv-44 pos) sv-168) + ) + ) + ) + ) + ) + ) + (+! sv-24 1) + ) + (+! sv-24 1) ) - (set! sv-24 (+ sv-24 1)) ) ) (none) @@ -1365,69 +1347,65 @@ ;; definition for method 28 of type cloth-system ;; INFO: Used lq/sq (defmethod cloth-system-method-28 ((this cloth-system) (arg0 int) (arg1 int) (arg2 current-position-info)) - (local-vars - (sv-16 verlet-particle) - (sv-80 vector) - (sv-84 vector) - (sv-88 vector) - (sv-92 symbol) - (sv-112 vector) - ) (rlet ((vf0 :class vf) (vf4 :class vf) (vf5 :class vf) (vf6 :class vf) ) (init-vf0-vector) - (set! sv-16 (-> this particles data (+ arg0 (* arg1 (-> this cloth-width))))) - (set! sv-80 (vector-! - (new 'stack-no-clear 'vector) - (the-as vector (+ (the-as uint (-> this strip data 0 pos)) - (* (- (-> arg2 current-vert-index) (the-as uint (-> arg2 cross-index0))) 32) - ) - ) - (-> sv-16 pos) + (let* ((sv-16 (-> this particles data (+ arg0 (* arg1 (-> this cloth-width))))) + (sv-80 (vector-! + (new 'stack-no-clear 'vector) + (the-as vector (+ (the-as uint (-> this strip data 0 pos)) + (* (- (-> arg2 current-vert-index) (the-as uint (-> arg2 cross-index0))) 32) + ) + ) + (-> sv-16 pos) + ) ) - ) - (set! sv-84 (vector-! - (new 'stack-no-clear 'vector) - (the-as vector (+ (the-as uint (-> this strip data 0 pos)) - (* (- (-> arg2 current-vert-index) (the-as uint (-> arg2 cross-index1))) 32) - ) - ) - (-> sv-16 pos) + (sv-84 (vector-! + (new 'stack-no-clear 'vector) + (the-as vector (+ (the-as uint (-> this strip data 0 pos)) + (* (- (-> arg2 current-vert-index) (the-as uint (-> arg2 cross-index1))) 32) + ) + ) + (-> sv-16 pos) + ) ) - ) - (set! sv-88 (new 'stack-no-clear 'vector)) - (set! sv-92 (the-as symbol #f)) - (vector-cross! sv-88 sv-80 sv-84) - (let ((a0-10 (-> arg2 cross-index0))) - (set! (-> arg2 cross-index0) (-> arg2 cross-index1)) - (set! (-> arg2 cross-index1) a0-10) - ) - (let ((s2-0 sv-88) - (s0-0 sv-16) - (s1-0 (new 'stack-no-clear 'vector)) - ) - (set! sv-112 s1-0) - (let ((v0-0 (math-camera-pos))) - (.lvf vf4 (&-> s0-0 pos quad)) - (.lvf vf5 (&-> v0-0 quad)) + (sv-88 (new 'stack-no-clear 'vector)) + ) + (let ((sv-92 (the-as symbol #f))) ) - (.mov.vf.w vf6 vf0) - (.sub.vf.xyz vf6 vf4 vf5) - (.svf (&-> sv-112 quad) vf6) - (let ((v1-12 (< 0.0 (vector-dot s1-0 s2-0)))) - (when (!= v1-12 (-> arg2 face-normal-needs-flip?)) - (set! (-> arg2 face-normal-needs-flip?) (not (-> arg2 face-normal-needs-flip?))) - (cloth-system-method-30 - this - (the-as int (-> arg2 last-2-x-index)) - (the-as int (-> arg2 last-2-y-index)) - arg2 - 1 + (vector-cross! sv-88 sv-80 sv-84) + (let ((a0-10 (-> arg2 cross-index0))) + (set! (-> arg2 cross-index0) (-> arg2 cross-index1)) + (set! (-> arg2 cross-index1) a0-10) + ) + (let ((s2-0 sv-88) + (s0-0 sv-16) + (s1-0 (new 'stack-no-clear 'vector)) + ) + (let ((sv-112 s1-0)) + (let ((v0-0 (math-camera-pos))) + (.lvf vf4 (&-> s0-0 pos quad)) + (.lvf vf5 (&-> v0-0 quad)) + ) + (.mov.vf.w vf6 vf0) + (.sub.vf.xyz vf6 vf4 vf5) + (.svf (&-> sv-112 quad) vf6) + ) + (let ((v1-12 (< 0.0 (vector-dot s1-0 s2-0)))) + (when (!= v1-12 (-> arg2 face-normal-needs-flip?)) + (set! (-> arg2 face-normal-needs-flip?) (not (-> arg2 face-normal-needs-flip?))) + (cloth-system-method-30 + this + (the-as int (-> arg2 last-2-x-index)) + (the-as int (-> arg2 last-2-y-index)) + arg2 + 1 + ) + (cloth-system-method-30 this (the-as int (-> arg2 last-x-index)) (the-as int (-> arg2 last-y-index)) arg2 1) ) - (cloth-system-method-30 this (the-as int (-> arg2 last-x-index)) (the-as int (-> arg2 last-y-index)) arg2 1) ) ) ) @@ -1599,7 +1577,7 @@ ;; definition for method 25 of type cloth-system ;; INFO: Used lq/sq (defmethod cloth-system-method-25 ((this cloth-system)) - (local-vars (v0-1 texture-id) (v0-4 texture-id) (a0-72 int) (a0-74 int) (sv-224 int)) + (local-vars (v0-1 texture-id) (v0-4 texture-id) (a0-72 int) (a0-74 int)) (cond ((and (not (logtest? (cloth-flag using-alt-tex) (-> this flags))) (and (>= (-> *game-info* skill-total) 600.0) (-> this params alt-tex-name)) @@ -1686,15 +1664,16 @@ (set-vector! (-> s5-0 scale) 128.0 128.0 128.0 128.0) (set-vector! (-> s5-0 clamp-col) 255.0 255.0 255.0 128.0) (dotimes (s0-0 (+ (-> this cloth-height) -1)) - (set! sv-224 0) - (while (< sv-224 (-> this cloth-width)) - (set! (-> s5-0 face-normal-needs-flip?) #f) - (cloth-system-method-29 this s4-0 s3-0 s5-0 0) - (cloth-system-method-31 this s5-0) - (cloth-system-method-29 this s4-0 (+ s3-0 s1-0) s5-0 0) - (cloth-system-method-31 this s5-0) - (+! s4-0 s2-0) - (set! sv-224 (+ sv-224 1)) + (let ((sv-224 0)) + (while (< sv-224 (-> this cloth-width)) + (set! (-> s5-0 face-normal-needs-flip?) #f) + (cloth-system-method-29 this s4-0 s3-0 s5-0 0) + (cloth-system-method-31 this s5-0) + (cloth-system-method-29 this s4-0 (+ s3-0 s1-0) s5-0 0) + (cloth-system-method-31 this s5-0) + (+! s4-0 s2-0) + (+! sv-224 1) + ) ) (set! (-> (the-as (pointer uint128) (+ (the-as uint (-> this strip data 0 pos)) (* (-> s5-0 current-vert-index) 32))) ) @@ -1853,13 +1832,13 @@ ;; definition for method 24 of type cloth-system ;; INFO: Used lq/sq (defmethod cloth-system-method-24 ((this cloth-system)) - (local-vars (sv-16 int) (sv-24 int) (sv-32 int) (sv-40 int)) (cloth-system-method-26 this) - (set! sv-16 0) - (set! sv-24 1) - (set! sv-32 1) - (set! sv-40 -1) - (let ((s5-0 (new 'stack-no-clear 'current-position-info))) + (let ((sv-16 0) + (sv-24 1) + (sv-32 1) + (sv-40 -1) + (s5-0 (new 'stack-no-clear 'current-position-info)) + ) (set! (-> s5-0 current-vert-index) (the-as uint 0)) (set! (-> s5-0 last-x-index) (the-as uint -1)) (set! (-> s5-0 last-y-index) (the-as uint -1)) @@ -1882,14 +1861,14 @@ (cloth-system-method-30 this sv-16 (+ sv-24 sv-40) s5-0 0) (set! (-> s5-0 cross-index0) 2) (set! (-> s5-0 cross-index1) 1) - (set! sv-16 (+ sv-16 sv-32)) + (+! sv-16 sv-32) (let ((s3-1 1) (s2-1 (+ (-> this cloth-width) -1)) ) (while (>= s2-1 s3-1) (cloth-system-method-28 this sv-16 sv-24 s5-0) (cloth-system-method-28 this sv-16 (+ sv-24 sv-40) s5-0) - (set! sv-16 (+ sv-16 sv-32)) + (+! sv-16 sv-32) (+! s3-1 1) ) ) @@ -1908,9 +1887,9 @@ (+! (-> s5-0 current-vert-index) 1) (set! sv-32 (* -1 sv-32)) (set! sv-40 (* -1 sv-40)) - (set! sv-16 (+ sv-16 sv-32)) + (+! sv-16 sv-32) (if (< sv-40 0) - (set! sv-24 (+ sv-24 2)) + (+! sv-24 2) ) ) (set! (-> this strip num-verts) (-> s5-0 current-vert-index)) diff --git a/test/decompiler/reference/jak3/engine/physics/ragdoll-edit_REF.gc b/test/decompiler/reference/jak3/engine/physics/ragdoll-edit_REF.gc index 941fabdbce..02f187ecc7 100644 --- a/test/decompiler/reference/jak3/engine/physics/ragdoll-edit_REF.gc +++ b/test/decompiler/reference/jak3/engine/physics/ragdoll-edit_REF.gc @@ -231,18 +231,6 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch symbol vs none. (defmethod ragdoll-edit-info-method-16 ((this ragdoll-edit-info) (arg0 ragdoll) (arg1 process-drawable)) - (local-vars - (sv-4352 ragdoll-joint) - (sv-4368 matrix) - (sv-4384 vector) - (sv-4400 matrix) - (sv-4416 matrix) - (sv-4432 vector) - (sv-4448 quaternion) - (sv-4464 matrix) - (sv-4480 matrix) - (sv-4496 matrix) - ) (let ((s3-0 (new 'stack-no-clear 'inline-array 'matrix 60))) (dotimes (v1-0 60) (let ((a0-2 (-> s3-0 v1-0))) @@ -253,16 +241,16 @@ ) ) (dotimes (s2-0 (the-as int (-> arg0 num-joints))) - (let ((s0-0 (-> arg0 ragdoll-joints s2-0))) - (set! sv-4352 (get-parent-joint arg0 (the-as (inline-array ragdoll-joint) s0-0))) - (set! sv-4368 (-> s3-0 s2-0)) - (let ((s1-0 (new 'stack-no-clear 'matrix))) - (cond - (sv-4352 - (set! sv-4416 - (matrix-axis-angle! (new 'stack-no-clear 'matrix) (-> s0-0 pre-tform) (- (-> s0-0 pre-tform w))) - ) - (set! sv-4432 (new 'stack-no-clear 'vector)) + (let* ((s0-0 (-> arg0 ragdoll-joints s2-0)) + (sv-4352 (get-parent-joint arg0 (the-as (inline-array ragdoll-joint) s0-0))) + (sv-4368 (-> s3-0 s2-0)) + (s1-0 (new 'stack-no-clear 'matrix)) + ) + (cond + (sv-4352 + (let ((sv-4416 (matrix-axis-angle! (new 'stack-no-clear 'matrix) (-> s0-0 pre-tform) (- (-> s0-0 pre-tform w)))) + (sv-4432 (new 'stack-no-clear 'vector)) + ) (matrix-copy! s1-0 (-> s3-0 @@ -276,118 +264,112 @@ (when (and (-> this auto-setup-now) (ragdoll-edit-info-method-10 this arg0 (the-as ragdoll-joint (-> s0-0 joint-index))) ) - (set! sv-4384 (vector-normalize! (vector-! (new 'stack-no-clear 'vector) (-> s0-0 position) sv-4432) 1.0)) - (set! sv-4400 (new 'stack-no-clear 'matrix)) - (matrix*! sv-4416 sv-4416 s1-0) - (matrix-from-two-vectors! sv-4400 (-> sv-4416 uvec) sv-4384) - (matrix*! sv-4416 sv-4416 sv-4400) - (matrix-transpose! sv-4400 s1-0) - (matrix*! sv-4416 sv-4416 sv-4400) + (let ((sv-4384 (vector-normalize! (vector-! (new 'stack-no-clear 'vector) (-> s0-0 position) sv-4432) 1.0)) + (sv-4400 (new 'stack-no-clear 'matrix)) + ) + (matrix*! sv-4416 sv-4416 s1-0) + (matrix-from-two-vectors! sv-4400 (-> sv-4416 uvec) sv-4384) + (matrix*! sv-4416 sv-4416 sv-4400) + (matrix-transpose! sv-4400 s1-0) + (matrix*! sv-4416 sv-4416 sv-4400) + ) (matrix->axis-angle (-> s0-0 pre-tform) sv-4416) ) - (let ((t9-10 matrix*!) - (a0-21 s1-0) - (a2-8 s1-0) - ) - (t9-10 a0-21 sv-4416 a2-8) - ) + (matrix*! s1-0 sv-4416 s1-0) (vector-copy! (-> s1-0 trans) sv-4432) - (vector-! (-> sv-4368 uvec) (-> s0-0 position) (-> sv-4352 position)) - (vector-normalize! (-> sv-4368 uvec) 1.0) - (vector-flatten! (-> sv-4368 rvec) (-> s1-0 rvec) (-> sv-4368 uvec)) - (vector-normalize! (-> sv-4368 rvec) 1.0) - (vector-cross! (-> sv-4368 fvec) (-> sv-4368 rvec) (-> sv-4368 uvec)) - (vector-copy! (-> sv-4368 trans) (-> s0-0 position)) - (set! (-> sv-4368 rvec w) 0.0) - (set! (-> sv-4368 uvec w) 0.0) - (set! (-> sv-4368 fvec w) 0.0) - ) - ((= s0-0 (-> arg0 ragdoll-joints)) - (quaternion->matrix sv-4368 (-> s0-0 quat)) - (vector-copy! (-> sv-4368 trans) (-> s0-0 position)) - (quaternion->matrix s1-0 (-> arg1 root quat)) - (vector-copy! (-> s1-0 trans) (-> arg1 root trans)) - ) - (else - (matrix-copy! sv-4368 (-> arg1 node-list data (-> s0-0 joint-index) bone transform)) - (vector-copy! (-> sv-4368 trans) (-> s0-0 position)) - (matrix-copy! s1-0 sv-4368) - (vector<-cspace! (-> s1-0 trans) (-> arg1 node-list data (-> s0-0 parent-joint))) ) + (vector-! (-> sv-4368 uvec) (-> s0-0 position) (-> sv-4352 position)) + (vector-normalize! (-> sv-4368 uvec) 1.0) + (vector-flatten! (-> sv-4368 rvec) (-> s1-0 rvec) (-> sv-4368 uvec)) + (vector-normalize! (-> sv-4368 rvec) 1.0) + (vector-cross! (-> sv-4368 fvec) (-> sv-4368 rvec) (-> sv-4368 uvec)) + (vector-copy! (-> sv-4368 trans) (-> s0-0 position)) + (set! (-> sv-4368 rvec w) 0.0) + (set! (-> sv-4368 uvec w) 0.0) + (set! (-> sv-4368 fvec w) 0.0) ) - (when (and (-> this auto-setup-now) - (ragdoll-edit-info-method-10 this arg0 (the-as ragdoll-joint (-> s0-0 joint-index))) - ) - (set! sv-4464 (new 'stack-no-clear 'matrix)) - (set! sv-4480 (new 'stack-no-clear 'matrix)) + ((= s0-0 (-> arg0 ragdoll-joints)) + (quaternion->matrix sv-4368 (-> s0-0 quat)) + (vector-copy! (-> sv-4368 trans) (-> s0-0 position)) + (quaternion->matrix s1-0 (-> arg1 root quat)) + (vector-copy! (-> s1-0 trans) (-> arg1 root trans)) + ) + (else + (matrix-copy! sv-4368 (-> arg1 node-list data (-> s0-0 joint-index) bone transform)) + (vector-copy! (-> sv-4368 trans) (-> s0-0 position)) + (matrix-copy! s1-0 sv-4368) + (vector<-cspace! (-> s1-0 trans) (-> arg1 node-list data (-> s0-0 parent-joint))) + ) + ) + (when (and (-> this auto-setup-now) + (ragdoll-edit-info-method-10 this arg0 (the-as ragdoll-joint (-> s0-0 joint-index))) + ) + (let ((sv-4464 (new 'stack-no-clear 'matrix)) + (sv-4480 (new 'stack-no-clear 'matrix)) + ) (matrix-copy! sv-4464 sv-4368) (vector-reset! (-> sv-4464 trans)) (matrix-transpose! sv-4464 sv-4464) - (set! sv-4448 (matrix->quaternion - (new 'stack-no-clear 'quaternion) - (-> arg1 node-list data (-> s0-0 joint-index) bone transform) - ) + (let ((sv-4448 (matrix->quaternion + (new 'stack-no-clear 'quaternion) + (-> arg1 node-list data (-> s0-0 joint-index) bone transform) + ) + ) ) - (quaternion-normalize! sv-4448) - (quaternion->matrix sv-4480 sv-4448) + (quaternion-normalize! sv-4448) + (quaternion->matrix sv-4480 sv-4448) + ) (matrix*! sv-4480 sv-4480 sv-4464) (matrix->axis-angle (-> s0-0 geo-tform) sv-4480) ) - (case (-> this skel-visible) - ((1) - (add-debug-line - #t - (bucket-id debug-no-zbuf1) - (-> sv-4368 trans) - (-> s1-0 trans) - (new 'static 'rgba :r #xff :b #xff :a #x80) - #f - (the-as rgba -1) - ) - (when (or (not (logtest? (-> *display* real-frame-clock integral-frame-counter) 8)) - (zero? (-> this analog-func)) - (not (ragdoll-edit-info-method-10 this arg0 (the-as ragdoll-joint (-> s0-0 joint-index)))) - ) - (let ((f30-0 0.25)) - (if (and (nonzero? (-> this analog-func)) - (ragdoll-edit-info-method-10 this arg0 (the-as ragdoll-joint (-> s0-0 joint-index))) - ) - (set! f30-0 0.35) + ) + (case (-> this skel-visible) + ((1) + (add-debug-line + #t + (bucket-id debug-no-zbuf1) + (-> sv-4368 trans) + (-> s1-0 trans) + (new 'static 'rgba :r #xff :b #xff :a #x80) + #f + (the-as rgba -1) + ) + (when (or (not (logtest? (-> *display* real-frame-clock integral-frame-counter) 8)) + (zero? (-> this analog-func)) + (not (ragdoll-edit-info-method-10 this arg0 (the-as ragdoll-joint (-> s0-0 joint-index)))) ) - (add-debug-matrix #t (bucket-id debug-no-zbuf1) sv-4368 (* 4096.0 f30-0)) - ) - ) - (set! sv-4496 - (matrix-axis-angle! (new 'stack-no-clear 'matrix) (-> s0-0 geo-tform) (- (-> s0-0 geo-tform w))) + (let ((f30-0 0.25)) + (if (and (nonzero? (-> this analog-func)) + (ragdoll-edit-info-method-10 this arg0 (the-as ragdoll-joint (-> s0-0 joint-index))) + ) + (set! f30-0 0.35) ) - (matrix*! sv-4496 sv-4496 sv-4368) - (vector-copy! (-> sv-4496 trans) (-> (the-as matrix sv-4368) trans)) - (let ((t9-30 add-debug-matrix) - (a0-66 #t) - (a1-46 577) - (a3-10 #x4419999a) - ) - (t9-30 a0-66 (the-as bucket-id a1-46) sv-4496 (the-as meters a3-10)) - ) - (let ((a2-22 (quaternion->matrix (new 'stack-no-clear 'matrix) (-> s0-0 quat)))) - (vector-copy! (-> a2-22 trans) (-> (the-as matrix sv-4368) trans)) - (add-debug-matrix #t (bucket-id debug-no-zbuf1) a2-22 (meters 0.15)) - ) - (when (or (not (logtest? (-> *display* real-frame-clock integral-frame-counter) 8)) - (nonzero? (-> this analog-func)) - (not (ragdoll-edit-info-method-10 this arg0 (the-as ragdoll-joint (-> s0-0 joint-index)))) - ) - (let ((f30-1 0.25)) - (if (and (zero? (-> this analog-func)) - (ragdoll-edit-info-method-10 this arg0 (the-as ragdoll-joint (-> s0-0 joint-index))) - ) - (set! f30-1 0.35) - ) - (add-debug-matrix #t (bucket-id debug-no-zbuf1) s1-0 (* 4096.0 f30-1)) - ) + (add-debug-matrix #t (bucket-id debug-no-zbuf1) sv-4368 (* 4096.0 f30-0)) ) ) - ) + (let ((sv-4496 (matrix-axis-angle! (new 'stack-no-clear 'matrix) (-> s0-0 geo-tform) (- (-> s0-0 geo-tform w))))) + (matrix*! sv-4496 sv-4496 sv-4368) + (vector-copy! (-> sv-4496 trans) (-> (the-as matrix sv-4368) trans)) + (add-debug-matrix #t (bucket-id debug-no-zbuf1) sv-4496 (meters 0.15)) + ) + (let ((a2-22 (quaternion->matrix (new 'stack-no-clear 'matrix) (-> s0-0 quat)))) + (vector-copy! (-> a2-22 trans) (-> (the-as matrix sv-4368) trans)) + (add-debug-matrix #t (bucket-id debug-no-zbuf1) a2-22 (meters 0.15)) + ) + (when (or (not (logtest? (-> *display* real-frame-clock integral-frame-counter) 8)) + (nonzero? (-> this analog-func)) + (not (ragdoll-edit-info-method-10 this arg0 (the-as ragdoll-joint (-> s0-0 joint-index)))) + ) + (let ((f30-1 0.25)) + (if (and (zero? (-> this analog-func)) + (ragdoll-edit-info-method-10 this arg0 (the-as ragdoll-joint (-> s0-0 joint-index))) + ) + (set! f30-1 0.35) + ) + (add-debug-matrix #t (bucket-id debug-no-zbuf1) s1-0 (* 4096.0 f30-1)) + ) + ) + ) ) ) ) @@ -399,7 +381,6 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defun show-maya-skeleton ((arg0 process-drawable) (arg1 int) (arg2 int)) - (local-vars (sv-96 symbol) (sv-112 int) (sv-128 (function _varargs_ object))) (when arg0 (dotimes (s3-0 (-> arg0 node-list length)) (let ((s2-0 (new 'stack-no-clear 'matrix)) @@ -409,28 +390,18 @@ (vector<-cspace! (-> s2-0 trans) (-> arg0 node-list data s3-0)) (when (or (= arg1 -1) (= arg1 s3-0)) (add-debug-matrix #t (bucket-id debug-no-zbuf1) s2-0 (the-as meters arg2)) - (let ((s0-0 add-debug-text-3d)) - (set! sv-96 #t) - (set! sv-112 577) - (set! sv-128 format) - (let ((a0-9 (clear *temp-string*)) - (a1-6 "~%~D ~S~%") - (a2-3 s3-0) - (a3-5 (if (-> arg0 node-list data s3-0 joint) - (-> arg0 node-list data s3-0 joint name) - "?" - ) - ) - ) - (sv-128 a0-9 a1-6 a2-3 a3-5) - ) - (let ((a2-4 *temp-string*) - (a3-6 (-> s2-0 trans)) - (t0-0 4) - (t1-0 #f) - ) - (s0-0 sv-96 (the-as bucket-id sv-112) a2-4 a3-6 (the-as font-color t0-0) (the-as vector2h t1-0)) + (let ((s0-0 add-debug-text-3d) + (sv-96 #t) + (sv-112 577) + ) + (let ((sv-128 format)) + (sv-128 (clear *temp-string*) "~%~D ~S~%" s3-0 (if (-> arg0 node-list data s3-0 joint) + (-> arg0 node-list data s3-0 joint name) + "?" + ) + ) ) + (s0-0 sv-96 (the-as bucket-id sv-112) *temp-string* (-> s2-0 trans) (font-color orange) (the-as vector2h #f)) ) ) (let ((a1-8 (-> arg0 node-list data s3-0 parent))) @@ -489,7 +460,7 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defmethod ragdoll-edit-info-method-17 ((this ragdoll-edit-info) (arg0 ragdoll) (arg1 process-drawable)) - (local-vars (v0-23 object) (v0-32 object) (sv-848 matrix) (sv-864 matrix) (sv-880 matrix)) + (local-vars (v0-23 object) (v0-32 object)) (set! (-> this last-frame-dur) (- (current-time) (-> this last-frame))) (set-time! (-> this last-frame)) (when (cpad-pressed? 0 l2) @@ -1038,8 +1009,9 @@ (set! (-> a1-72 y) f28-0) (set! (-> a1-72 z) f26-0) (set! (-> a1-72 w) 1.0) - (let ((s0-1 (t9-55 a0-105 a1-72))) - (set! sv-848 (new 'stack-no-clear 'matrix)) + (let ((s0-1 (t9-55 a0-105 a1-72)) + (sv-848 (new 'stack-no-clear 'matrix)) + ) (let ((a2-51 (new 'stack-no-clear 'vector))) (ragdoll-edit-info-method-14 this @@ -1052,15 +1024,10 @@ ) (matrix*! s1-1 sv-848 s1-1) (matrix*! s1-1 s0-1 s1-1) + (matrix-transpose! sv-848 sv-848) + (matrix*! s1-1 sv-848 s1-1) ) ) - (matrix-transpose! sv-848 sv-848) - (let ((t9-60 matrix*!) - (a0-110 s1-1) - (a2-54 s1-1) - ) - (t9-60 a0-110 sv-848 a2-54) - ) (matrix->axis-angle s2-4 s1-1) ) ) @@ -1076,36 +1043,28 @@ (set! (-> a1-80 y) f28-0) (set! (-> a1-80 z) f26-0) (set! (-> a1-80 w) 1.0) - (set! sv-864 (t9-63 a0-114 a1-80)) - ) - (set! sv-880 (new 'stack-no-clear 'matrix)) - (let ((a2-56 (new 'stack-no-clear 'vector))) - (ragdoll-edit-info-method-14 - this - sv-880 - a2-56 - (the-as (inline-array ragdoll-joint) (-> this child-stack s3-3)) - arg0 - arg1 + (let ((sv-864 (t9-63 a0-114 a1-80)) + (sv-880 (new 'stack-no-clear 'matrix)) + ) + (let ((a2-56 (new 'stack-no-clear 'vector))) + (ragdoll-edit-info-method-14 + this + sv-880 + a2-56 + (the-as (inline-array ragdoll-joint) (-> this child-stack s3-3)) + arg0 + arg1 + ) + ) + (let ((a2-58 (matrix-axis-angle! (new 'stack-no-clear 'matrix) (-> s2-3 pre-tform) (- (-> s2-3 pre-tform w))))) + (matrix*! sv-880 sv-880 a2-58) + ) + (matrix*! s0-2 sv-880 s0-2) + (matrix*! s0-2 sv-864 s0-2) + (matrix-transpose! sv-880 sv-880) + (matrix*! s0-2 sv-880 s0-2) ) ) - (let ((a2-58 (matrix-axis-angle! (new 'stack-no-clear 'matrix) (-> s2-3 pre-tform) (- (-> s2-3 pre-tform w))))) - (matrix*! sv-880 sv-880 a2-58) - ) - (matrix*! s0-2 sv-880 s0-2) - (let ((t9-68 matrix*!) - (a0-119 s0-2) - (a2-60 s0-2) - ) - (t9-68 a0-119 sv-864 a2-60) - ) - (matrix-transpose! sv-880 sv-880) - (let ((t9-70 matrix*!) - (a0-121 s0-2) - (a2-61 s0-2) - ) - (t9-70 a0-121 sv-880 a2-61) - ) (matrix->axis-angle s1-2 s0-2) ) ) diff --git a/test/decompiler/reference/jak3/engine/physics/ragdoll_REF.gc b/test/decompiler/reference/jak3/engine/physics/ragdoll_REF.gc index 6e0e2b9134..c0f548cc36 100644 --- a/test/decompiler/reference/jak3/engine/physics/ragdoll_REF.gc +++ b/test/decompiler/reference/jak3/engine/physics/ragdoll_REF.gc @@ -146,11 +146,9 @@ ) (set! f1-1 24576.0) ) - (let ((f2-0 f1-1)) - (if (< (* f2-0 f2-0) f0-6) - (vector-float*! arg0 arg0 (/ f1-1 (sqrtf f0-6))) - ) - ) + (if (< (square f1-1) f0-6) + (vector-float*! arg0 arg0 (/ f1-1 (sqrtf f0-6))) + ) ) (when (nonzero? (-> this rotate-adj-count)) (quaternion-slerp! (-> this rotate-vel) (-> this rotate-vel) (-> this rotate-adj) 0.5) @@ -300,12 +298,7 @@ (logclear! (-> s4-1 ragdoll-joint-flags) (ragdoll-joint-flag rjf0 rjf2)) (set! (-> s4-1 original-speed) 0.0) (vector-copy! arg0 (-> s4-1 position)) - (until (or (< 6 s1-1) (let ((f0-13 (vector-length-squared s3-2)) - (f1-4 409.6) - ) - (< f0-13 (* f1-4 f1-4)) - ) - ) + (until (or (< 6 s1-1) (< (vector-length-squared s3-2) (square 409.6))) (+! s1-1 1) (vector-copy! (-> s2-1 start-pos) arg0) (vector-copy! (-> s2-1 move-dist) s3-2) @@ -437,9 +430,8 @@ ;; definition for function ragdoll-matrix-interp ;; INFO: Used lq/sq (defun ragdoll-matrix-interp ((arg0 matrix) (arg1 matrix) (arg2 matrix) (arg3 float)) - (local-vars (sv-208 matrix)) - (set! sv-208 arg1) - (let ((s5-0 arg2) + (let ((sv-208 arg1) + (s5-0 arg2) (s4-0 arg3) (s1-0 (new 'stack-no-clear 'matrix)) ) @@ -519,7 +511,7 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defun ragdoll-joint-callback ((arg0 cspace) (arg1 transformq) (arg2 process-drawable) (arg3 ragdoll-proc)) - (local-vars (a2-10 matrix) (sv-240 int) (sv-256 quaternion) (sv-272 vector) (sv-288 matrix)) + (local-vars (a2-10 matrix)) (when *debug-segment* (let ((s2-0 (-> *display* frames (-> *display* on-screen) profile-array data 0)) (v1-7 'ragdoll-callback) @@ -527,9 +519,10 @@ ) (when (and *dproc* *debug-segment*) (let ((s0-0 (-> s2-0 data (-> s2-0 count)))) - (set! sv-240 (-> s2-0 base-time)) - (set! (-> s0-0 name) v1-7) - (set! (-> s0-0 start-time) (the-as int (- (timer-count (the-as timer-bank #x10000800)) (the-as uint sv-240)))) + (let ((sv-240 (-> s2-0 base-time))) + (set! (-> s0-0 name) v1-7) + (set! (-> s0-0 start-time) (the-as int (- (timer-count (the-as timer-bank #x10000800)) (the-as uint sv-240)))) + ) (set! (-> s0-0 depth) (the-as uint (-> s2-0 depth))) (set! (-> s0-0 color) s1-0) (set! (-> s2-0 segment (-> s2-0 depth)) s0-0) @@ -553,26 +546,29 @@ (cspace<-parented-transformq-joint! arg0 arg1) ) (let ((s2-1 (new 'stack-no-clear 'matrix))) - (set! sv-256 - (quaternion-vector-angle! (new 'stack-no-clear 'quaternion) (-> s1-1 geo-tform) (-> s1-1 geo-tform w)) + (let ((sv-256 + (quaternion-vector-angle! (new 'stack-no-clear 'quaternion) (-> s1-1 geo-tform) (-> s1-1 geo-tform w)) + ) ) - (quaternion-normalize! (quaternion*! sv-256 (-> s1-1 quat) sv-256)) - (quaternion->matrix s2-1 sv-256) + (quaternion-normalize! (quaternion*! sv-256 (-> s1-1 quat) sv-256)) + (quaternion->matrix s2-1 sv-256) + ) (when (logtest? (-> s3-1 ragdoll-flags) (ragdoll-flag rf10)) (let ((v1-40 (&+ s1-1 188))) (when (and (!= v1-40 (-> s3-1 ragdoll-joints (-> s3-1 num-joints))) (= (-> v1-40 parent-joint) -1)) - (let ((s0-3 (vector-! (new 'stack-no-clear 'vector) (-> v1-40 position) (-> s1-1 position)))) - (set! sv-272 (new 'stack-no-clear 'vector)) - (set! sv-288 (new 'stack-no-clear 'matrix)) + (let ((s0-3 (vector-! (new 'stack-no-clear 'vector) (-> v1-40 position) (-> s1-1 position))) + (sv-272 (new 'stack-no-clear 'vector)) + (sv-288 (new 'stack-no-clear 'matrix)) + ) (vector-flatten! sv-272 s0-3 (-> s2-1 rvec)) (vector-normalize! sv-272 1.0) (matrix-from-two-vectors! sv-288 (-> s2-1 uvec) sv-272) (matrix*! s2-1 s2-1 sv-288) (vector-flatten! sv-272 s0-3 (-> s2-1 fvec)) + (vector-normalize! sv-272 1.0) + (matrix-from-two-vectors! sv-288 (-> s2-1 uvec) sv-272) + (matrix*! s2-1 s2-1 sv-288) ) - (vector-normalize! sv-272 1.0) - (matrix-from-two-vectors! sv-288 (-> s2-1 uvec) sv-272) - (matrix*! s2-1 s2-1 sv-288) ) ) ) @@ -710,7 +706,6 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch ragdoll-flag vs none. (defmethod ragdoll-method-10 ((this ragdoll) (arg0 process-drawable) (arg1 symbol) (arg2 vector) (arg3 symbol)) - (local-vars (sv-144 vector)) (with-pp (set! (-> this turn-off-start) 0) (logclear! (-> this ragdoll-flags) (ragdoll-flag rf2)) @@ -781,13 +776,14 @@ (cond ((logtest? (-> this ragdoll-flags) (ragdoll-flag rf5)) (logclear! (-> this ragdoll-flags) (ragdoll-flag rf5)) - (set! sv-144 (vector<-cspace! (new 'stack-no-clear 'vector) (-> arg0 node-list data (-> s1-0 joint-index)))) - (if (logtest? (-> this ragdoll-flags) (ragdoll-flag mirror)) - (vector-matrix*! sv-144 sv-144 (-> this mirror)) - ) - (vector-! (-> s1-0 velocity) sv-144 (-> s1-0 position)) - (vector-float*! (-> s1-0 velocity) (-> s1-0 velocity) (/ 1.0 (-> pp clock time-adjust-ratio))) - (vector-copy! (-> s1-0 position) sv-144) + (let ((sv-144 (vector<-cspace! (new 'stack-no-clear 'vector) (-> arg0 node-list data (-> s1-0 joint-index))))) + (if (logtest? (-> this ragdoll-flags) (ragdoll-flag mirror)) + (vector-matrix*! sv-144 sv-144 (-> this mirror)) + ) + (vector-! (-> s1-0 velocity) sv-144 (-> s1-0 position)) + (vector-float*! (-> s1-0 velocity) (-> s1-0 velocity) (/ 1.0 (-> pp clock time-adjust-ratio))) + (vector-copy! (-> s1-0 position) sv-144) + ) ) (else (vector<-cspace! (-> s1-0 position) (-> arg0 node-list data (-> s1-0 joint-index))) @@ -993,26 +989,7 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defmethod ragdoll-method-15 ((this ragdoll) (arg0 process-drawable) (arg1 ragdoll-edit-info)) - (local-vars - (at-0 int) - (f0-14 float) - (sv-320 vector) - (sv-336 vector) - (sv-352 (function vector float vector)) - (sv-368 vector) - (sv-384 vector) - (sv-400 vector) - (sv-416 vector) - (sv-432 vector) - (sv-448 vector) - (sv-464 vector) - (sv-480 vector) - (sv-496 vector) - (sv-512 vector) - (sv-528 vector) - (sv-544 vector) - (sv-560 vector) - ) + (local-vars (at-0 int) (f0-14 float)) (with-pp (rlet ((acc :class vf) (vf0 :class vf) @@ -1096,251 +1073,245 @@ (new 'stack-no-clear 'vector) (dotimes (s1-1 (the-as int (-> this num-joints))) (let ((s0-1 (-> this ragdoll-joints s1-1))) - (set! sv-560 (new 'stack-no-clear 'vector)) - (let ((v1-74 (-> s0-1 position quad))) - (set! (-> sv-560 quad) v1-74) - ) - (if (and (logtest? (-> s0-1 ragdoll-joint-flags) (ragdoll-joint-flag rjf2)) - (not (logtest? (-> s0-1 ragdoll-joint-flags) (ragdoll-joint-flag rjf3))) - ) - (vector-float*! (-> s0-1 velocity) (-> s0-1 velocity) 0.1) - ) - (ragdoll-method-14 this arg0 s0-1 s1-1 s2-1) - (cond - ((or (zero? (the-as object arg1)) - (and (= (-> arg1 single-step) 1) (cpad-pressed? 0 r2)) - (zero? (-> arg1 single-step)) - ) - (when (or (zero? (the-as object arg1)) (-> arg1 gravity)) - (set! sv-320 (new 'stack-no-clear 'vector)) - (ragdoll-method-19 this sv-320 s1-1 arg0 s2-1) - (let ((v1-93 sv-560)) - (let ((a0-39 sv-560)) - (.mov.vf.w vf6 vf0) - (.lvf vf4 (&-> a0-39 quad)) - ) - (.lvf vf5 (&-> sv-320 quad)) - (.add.vf.xyz vf6 vf4 vf5) - (.svf (&-> v1-93 quad) vf6) - ) - ) - (when (and (< s1-1 (the-as int (+ (-> this num-joints) -1))) - (= (-> this ragdoll-joints (+ s1-1 1) parent-joint) -1) - ) - (set! sv-336 (new 'stack-no-clear 'vector)) - (reset-vec! this sv-336) - (let ((v1-104 sv-560)) - (let ((a0-45 sv-560)) - (.mov.vf.w vf6 vf0) - (.lvf vf4 (&-> a0-45 quad)) - ) - (.lvf vf5 (&-> sv-336 quad)) - (.add.vf.xyz vf6 vf4 vf5) - (.svf (&-> v1-104 quad) vf6) - ) - ) - (when (or (> s1-1 0) (!= (-> s0-1 parent-joint) -1)) - (ragdoll-method-21 this sv-560 (-> s2-1 trans) (-> s0-1 joint-length)) - (set! sv-432 (new 'stack-no-clear 'vector)) - (let ((v1-110 sv-560) - (a0-50 (-> s2-1 trans)) + (let ((sv-560 (new 'stack-no-clear 'vector))) + (vector-copy! sv-560 (-> s0-1 position)) + (if (and (logtest? (-> s0-1 ragdoll-joint-flags) (ragdoll-joint-flag rjf2)) + (not (logtest? (-> s0-1 ragdoll-joint-flags) (ragdoll-joint-flag rjf3))) ) - (.lvf vf4 (&-> v1-110 quad)) - (.lvf vf5 (&-> a0-50 quad)) - ) - (.mov.vf.w vf6 vf0) - (.sub.vf.xyz vf6 vf4 vf5) - (.svf (&-> sv-432 quad) vf6) - (let ((f30-2 (vector-normalize-ret-len! sv-432 1.0)) - (f26-0 (vector-dot sv-432 (-> s2-1 uvec))) - (f28-1 (get-max-angle-for-joint-idx this s1-1)) - ) - (when (< f26-0 (cos f28-1)) - (vector--float*! sv-432 sv-432 (-> s2-1 uvec) f26-0) - (set! sv-352 vector-normalize!) - (set! sv-368 sv-432) - (let ((a1-15 (sin f28-1))) - (sv-352 sv-368 a1-15) - ) - (set! sv-416 sv-432) - (set! sv-384 sv-432) - (set! sv-400 (-> s2-1 uvec)) - (let ((f0-9 (cos f28-1))) - (.lvf vf2 (&-> sv-400 quad)) - (.lvf vf1 (&-> sv-384 quad)) - (let ((v1-123 f0-9)) - (.mov vf3 v1-123) - ) - ) - (.add.x.vf.w vf4 vf0 vf0) - (.mul.x.vf acc vf2 vf3) - (.add.mul.w.vf.xyz vf4 vf1 vf0 acc) - (.svf (&-> sv-416 quad) vf4) - (vector+float*! sv-560 (-> s2-1 trans) sv-432 f30-2) - ) - ) - ) - (if (or (zero? (the-as object arg1)) (-> arg1 collision)) - (ragdoll-method-24 this sv-560 s1-1) - ) - (cond - ((or (> s1-1 0) (!= (-> s0-1 parent-joint) -1)) - (set! sv-448 (new 'stack-no-clear 'vector)) - (let ((v1-134 (-> s2-1 trans)) - (a0-63 sv-560) - ) - (.lvf vf4 (&-> v1-134 quad)) - (.lvf vf5 (&-> a0-63 quad)) - ) - (.mov.vf.w vf6 vf0) - (.sub.vf.xyz vf6 vf4 vf5) - (.svf (&-> sv-448 quad) vf6) - (vector-normalize-ret-len! sv-448 1.0) - (set! sv-464 (new 'stack-no-clear 'vector)) - (let ((v1-137 sv-560) - (a0-65 (-> s0-1 position)) - ) - (.lvf vf4 (&-> v1-137 quad)) - (.lvf vf5 (&-> a0-65 quad)) - ) - (.mov.vf.w vf6 vf0) - (.sub.vf.xyz vf6 vf4 vf5) - (.svf (&-> sv-464 quad) vf6) - (let ((f30-3 (vector-dot sv-448 sv-464))) - (vector--float*! sv-464 sv-464 sv-448 f30-3) - (cond - ((< f30-3 0.0) - (set! f0-14 (* f30-3 (-> this compress-vel-parallel))) - (vector-float*! sv-464 sv-464 (-> this compress-vel)) - ) - (else - (set! f0-14 (* f30-3 (-> this stretch-vel-parallel))) - (vector-float*! sv-464 sv-464 (-> this stretch-vel)) - ) - ) - ) - (vector+float*! sv-464 sv-464 sv-448 f0-14) - (vector+! sv-560 (-> s0-1 position) sv-464) - (let ((f0-16 (-> this momentum))) - (if (logtest? (-> s0-1 ragdoll-joint-flags) (ragdoll-joint-flag rjf2)) - (set! f0-16 0.1) - ) - (let ((t9-20 vector-lerp!) - (a0-72 (-> s0-1 velocity)) - (a1-23 (-> s0-1 velocity)) - (a3-6 f0-16) - ) - (t9-20 a0-72 a1-23 sv-464 a3-6) - ) - ) - (let* ((a2-12 (vector-! (new 'stack-no-clear 'vector) (-> s2-1 trans) sv-560)) - (f0-17 (vector-length-squared a2-12)) - (f1-6 (* (-> this maximum-stretch) (-> s0-1 joint-length))) - (f2-3 f1-6) - ) - (if (< (* f2-3 f2-3) f0-17) - (vector--float*! sv-560 (-> s2-1 trans) a2-12 (/ f1-6 (sqrtf f0-17))) - ) - ) + (vector-float*! (-> s0-1 velocity) (-> s0-1 velocity) 0.1) ) - (else - (let ((a2-14 (vector-! (new 'stack-no-clear 'vector) sv-560 (-> s0-1 position))) - (f0-20 (-> this momentum)) + (ragdoll-method-14 this arg0 s0-1 s1-1 s2-1) + (cond + ((or (zero? (the-as object arg1)) + (and (= (-> arg1 single-step) 1) (cpad-pressed? 0 r2)) + (zero? (-> arg1 single-step)) + ) + (when (or (zero? (the-as object arg1)) (-> arg1 gravity)) + (let ((sv-320 (new 'stack-no-clear 'vector))) + (ragdoll-method-19 this sv-320 s1-1 arg0 s2-1) + (let ((v1-93 sv-560)) + (let ((a0-39 sv-560)) + (.mov.vf.w vf6 vf0) + (.lvf vf4 (&-> a0-39 quad)) ) - (if (logtest? (-> s0-1 ragdoll-joint-flags) (ragdoll-joint-flag rjf2)) - (set! f0-20 0.1) - ) - (vector-lerp! (-> s0-1 velocity) (-> s0-1 velocity) a2-14 f0-20) + (.lvf vf5 (&-> sv-320 quad)) + (.add.vf.xyz vf6 vf4 vf5) + (.svf (&-> v1-93 quad) vf6) + ) ) ) - ) - (let ((f0-21 (vector-vector-distance-squared (-> s0-1 position) sv-560)) - (f1-7 40.96) + (when (and (< s1-1 (the-as int (+ (-> this num-joints) -1))) + (= (-> this ragdoll-joints (+ s1-1 1) parent-joint) -1) + ) + (let ((sv-336 (new 'stack-no-clear 'vector))) + (reset-vec! this sv-336) + (let ((v1-104 sv-560)) + (let ((a0-45 sv-560)) + (.mov.vf.w vf6 vf0) + (.lvf vf4 (&-> a0-45 quad)) + ) + (.lvf vf5 (&-> sv-336 quad)) + (.add.vf.xyz vf6 vf4 vf5) + (.svf (&-> v1-104 quad) vf6) + ) ) - (if (< f0-21 (* f1-7 f1-7)) + ) + (when (or (> s1-1 0) (!= (-> s0-1 parent-joint) -1)) + (ragdoll-method-21 this sv-560 (-> s2-1 trans) (-> s0-1 joint-length)) + (let ((sv-432 (new 'stack-no-clear 'vector))) + (let ((v1-110 sv-560) + (a0-50 (-> s2-1 trans)) + ) + (.lvf vf4 (&-> v1-110 quad)) + (.lvf vf5 (&-> a0-50 quad)) + ) + (.mov.vf.w vf6 vf0) + (.sub.vf.xyz vf6 vf4 vf5) + (.svf (&-> sv-432 quad) vf6) + (let ((f30-2 (vector-normalize-ret-len! sv-432 1.0)) + (f26-0 (vector-dot sv-432 (-> s2-1 uvec))) + (f28-1 (get-max-angle-for-joint-idx this s1-1)) + ) + (when (< f26-0 (cos f28-1)) + (vector--float*! sv-432 sv-432 (-> s2-1 uvec) f26-0) + (vector-normalize! sv-432 (sin f28-1)) + (let ((sv-416 sv-432)) + (let ((sv-384 sv-432) + (sv-400 (-> s2-1 uvec)) + (f0-9 (cos f28-1)) + ) + (.lvf vf2 (&-> sv-400 quad)) + (.lvf vf1 (&-> sv-384 quad)) + (let ((v1-123 f0-9)) + (.mov vf3 v1-123) + ) + ) + (.add.x.vf.w vf4 vf0 vf0) + (.mul.x.vf acc vf2 vf3) + (.add.mul.w.vf.xyz vf4 vf1 vf0 acc) + (.svf (&-> sv-416 quad) vf4) + ) + (vector+float*! sv-560 (-> s2-1 trans) sv-432 f30-2) + ) + ) + ) + ) + (if (or (zero? (the-as object arg1)) (-> arg1 collision)) + (ragdoll-method-24 this sv-560 s1-1) + ) + (cond + ((or (> s1-1 0) (!= (-> s0-1 parent-joint) -1)) + (let ((sv-448 (new 'stack-no-clear 'vector))) + (let ((a0-63 sv-560)) + (.lvf vf4 (&-> (-> s2-1 trans) quad)) + (.lvf vf5 (&-> a0-63 quad)) + ) + (.mov.vf.w vf6 vf0) + (.sub.vf.xyz vf6 vf4 vf5) + (.svf (&-> sv-448 quad) vf6) + (vector-normalize-ret-len! sv-448 1.0) + (let ((sv-464 (new 'stack-no-clear 'vector))) + (let ((v1-137 sv-560) + (a0-65 (-> s0-1 position)) + ) + (.lvf vf4 (&-> v1-137 quad)) + (.lvf vf5 (&-> a0-65 quad)) + ) + (.mov.vf.w vf6 vf0) + (.sub.vf.xyz vf6 vf4 vf5) + (.svf (&-> sv-464 quad) vf6) + (let ((f30-3 (vector-dot sv-448 sv-464))) + (vector--float*! sv-464 sv-464 sv-448 f30-3) + (cond + ((< f30-3 0.0) + (set! f0-14 (* f30-3 (-> this compress-vel-parallel))) + (vector-float*! sv-464 sv-464 (-> this compress-vel)) + ) + (else + (set! f0-14 (* f30-3 (-> this stretch-vel-parallel))) + (vector-float*! sv-464 sv-464 (-> this stretch-vel)) + ) + ) + ) + (vector+float*! sv-464 sv-464 sv-448 f0-14) + (vector+! sv-560 (-> s0-1 position) sv-464) + (let ((f0-16 (-> this momentum))) + (if (logtest? (-> s0-1 ragdoll-joint-flags) (ragdoll-joint-flag rjf2)) + (set! f0-16 0.1) + ) + (vector-lerp! (-> s0-1 velocity) (-> s0-1 velocity) sv-464 f0-16) + ) + ) + ) + (let* ((a2-12 (vector-! (new 'stack-no-clear 'vector) (-> s2-1 trans) sv-560)) + (f0-17 (vector-length-squared a2-12)) + (f1-6 (* (-> this maximum-stretch) (-> s0-1 joint-length))) + ) + (if (< (square f1-6) f0-17) + (vector--float*! sv-560 (-> s2-1 trans) a2-12 (/ f1-6 (sqrtf f0-17))) + ) + ) + ) + (else + (let ((a2-14 (vector-! (new 'stack-no-clear 'vector) sv-560 (-> s0-1 position))) + (f0-20 (-> this momentum)) + ) + (if (logtest? (-> s0-1 ragdoll-joint-flags) (ragdoll-joint-flag rjf2)) + (set! f0-20 0.1) + ) + (vector-lerp! (-> s0-1 velocity) (-> s0-1 velocity) a2-14 f0-20) + ) + ) + ) + (if (< (vector-vector-distance-squared (-> s0-1 position) sv-560) (square 40.96)) (+! (-> this stable-joints) 1) ) - ) - (when (and (zero? s1-1) (< (-> s0-1 parent-joint) 0) (logtest? (-> this ragdoll-flags) (ragdoll-flag rf7))) - (let ((v1-176 (-> arg0 root transv))) - (.lvf vf1 (&-> (vector-! (new 'stack-no-clear 'vector) sv-560 (-> s0-1 position)) quad)) - (let ((f0-22 (-> pp clock frames-per-second))) - (.mov at-0 f0-22) - ) - (.mov vf2 at-0) - (.mov.vf.w vf1 vf0) - (.mul.x.vf.xyz vf1 vf1 vf2) - (.svf (&-> v1-176 quad) vf1) - ) - ) - (vector-copy! (-> s0-1 position) sv-560) - (cond - ((or (> s1-1 0) (!= (-> s0-1 parent-joint) -1)) - (vector-! (-> s3-1 uvec) sv-560 (-> s2-1 trans)) - (vector-normalize! (-> s3-1 uvec) 1.0) - (vector-cross! (-> s3-1 rvec) (-> s3-1 uvec) (-> s2-1 fvec)) - (vector-normalize! (-> s3-1 rvec) 1.0) - (set! sv-528 (new 'stack-no-clear 'vector)) - (let ((v1-183 (-> s0-1 old-x)) - (a0-91 (-> s3-1 rvec)) - ) - (.lvf vf1 (&-> v1-183 quad)) - (.lvf vf2 (&-> a0-91 quad)) - ) - (.outer.product.a.vf acc vf1 vf2) - (.outer.product.b.vf vf3 vf2 vf1 acc) - (.svf (&-> sv-528 quad) vf3) - (vector-flatten! sv-528 (-> s0-1 old-x) (-> s3-1 uvec)) - (vector-normalize! sv-528 1.0) - (cond - ((and (< (-> s0-1 axial-slop) 65536.0) (< (vector-dot (-> s3-1 rvec) sv-528) (cos (-> s0-1 axial-slop)))) - (vector-cross! sv-528 sv-528 (-> s3-1 rvec)) - (vector-cross! sv-528 (-> s3-1 rvec) sv-528) - (vector-normalize! sv-528 1.0) - (set! sv-496 (-> s3-1 rvec)) - (set! sv-480 (-> s3-1 rvec)) - (let ((f0-28 (cos (-> s0-1 axial-slop)))) - (.lvf vf1 (&-> sv-480 quad)) - (let ((v1-195 f0-28)) - (.mov vf2 v1-195) - ) + (when (and (zero? s1-1) (< (-> s0-1 parent-joint) 0) (logtest? (-> this ragdoll-flags) (ragdoll-flag rf7))) + (let ((v1-176 (-> arg0 root transv))) + (.lvf vf1 (&-> (vector-! (new 'stack-no-clear 'vector) sv-560 (-> s0-1 position)) quad)) + (let ((f0-22 (-> pp clock frames-per-second))) + (.mov at-0 f0-22) ) - (.add.x.vf.w vf1 vf0 vf0) + (.mov vf2 at-0) + (.mov.vf.w vf1 vf0) (.mul.x.vf.xyz vf1 vf1 vf2) - (.svf (&-> sv-496 quad) vf1) - (set! sv-544 (-> s3-1 rvec)) - (set! sv-512 (-> s3-1 rvec)) - (let ((f0-30 (sin (-> s0-1 axial-slop)))) - (.lvf vf2 (&-> sv-528 quad)) - (.lvf vf1 (&-> sv-512 quad)) - (let ((v1-201 f0-30)) - (.mov vf3 v1-201) - ) - ) - (.add.x.vf.w vf4 vf0 vf0) - (.mul.x.vf acc vf2 vf3) - (.add.mul.w.vf.xyz vf4 vf1 vf0 acc) - (.svf (&-> sv-544 quad) vf4) - (vector-copy! (-> s0-1 old-x) (-> s3-1 rvec)) + (.svf (&-> v1-176 quad) vf1) ) - (else - (vector-copy! (-> s3-1 rvec) sv-528) - (vector-copy! (-> s0-1 old-x) (-> s3-1 rvec)) + ) + (vector-copy! (-> s0-1 position) sv-560) + (cond + ((or (> s1-1 0) (!= (-> s0-1 parent-joint) -1)) + (vector-! (-> s3-1 uvec) sv-560 (-> s2-1 trans)) + (vector-normalize! (-> s3-1 uvec) 1.0) + (vector-cross! (-> s3-1 rvec) (-> s3-1 uvec) (-> s2-1 fvec)) + (vector-normalize! (-> s3-1 rvec) 1.0) + (let ((sv-528 (new 'stack-no-clear 'vector))) + (let ((v1-183 (-> s0-1 old-x)) + (a0-91 (-> s3-1 rvec)) + ) + (.lvf vf1 (&-> v1-183 quad)) + (.lvf vf2 (&-> a0-91 quad)) + ) + (.outer.product.a.vf acc vf1 vf2) + (.outer.product.b.vf vf3 vf2 vf1 acc) + (.svf (&-> sv-528 quad) vf3) + (vector-flatten! sv-528 (-> s0-1 old-x) (-> s3-1 uvec)) + (vector-normalize! sv-528 1.0) + (cond + ((and (< (-> s0-1 axial-slop) 65536.0) (< (vector-dot (-> s3-1 rvec) sv-528) (cos (-> s0-1 axial-slop)))) + (vector-cross! sv-528 sv-528 (-> s3-1 rvec)) + (vector-cross! sv-528 (-> s3-1 rvec) sv-528) + (vector-normalize! sv-528 1.0) + (let ((sv-496 (-> s3-1 rvec))) + (let ((sv-480 (-> s3-1 rvec)) + (f0-28 (cos (-> s0-1 axial-slop))) + ) + (.lvf vf1 (&-> sv-480 quad)) + (let ((v1-195 f0-28)) + (.mov vf2 v1-195) + ) + ) + (.add.x.vf.w vf1 vf0 vf0) + (.mul.x.vf.xyz vf1 vf1 vf2) + (.svf (&-> sv-496 quad) vf1) + ) + (let ((sv-544 (-> s3-1 rvec))) + (let ((sv-512 (-> s3-1 rvec)) + (f0-30 (sin (-> s0-1 axial-slop))) + ) + (.lvf vf2 (&-> sv-528 quad)) + (.lvf vf1 (&-> sv-512 quad)) + (let ((v1-201 f0-30)) + (.mov vf3 v1-201) + ) + ) + (.add.x.vf.w vf4 vf0 vf0) + (.mul.x.vf acc vf2 vf3) + (.add.mul.w.vf.xyz vf4 vf1 vf0 acc) + (.svf (&-> sv-544 quad) vf4) + ) + (vector-copy! (-> s0-1 old-x) (-> s3-1 rvec)) + ) + (else + (vector-copy! (-> s3-1 rvec) sv-528) + (vector-copy! (-> s0-1 old-x) (-> s3-1 rvec)) + ) + ) ) + (vector-cross! (-> s3-1 fvec) (-> s3-1 rvec) (-> s3-1 uvec)) + (matrix->quaternion (-> s0-1 quat) s3-1) ) - (vector-cross! (-> s3-1 fvec) (-> s3-1 rvec) (-> s3-1 uvec)) - (matrix->quaternion (-> s0-1 quat) s3-1) - ) - (else - (quaternion->matrix s3-1 (-> s0-1 quat)) + (else + (quaternion->matrix s3-1 (-> s0-1 quat)) + ) ) ) - ) - (else - (quaternion->matrix s3-1 (-> s0-1 quat)) + (else + (quaternion->matrix s3-1 (-> s0-1 quat)) + ) ) + (vector-copy! (-> s3-1 trans) sv-560) ) - (vector-copy! (-> s3-1 trans) sv-560) (set! (-> s3-1 rvec w) 0.0) (set! (-> s3-1 uvec w) 0.0) (set! (-> s3-1 fvec w) 0.0) diff --git a/test/decompiler/reference/jak3/engine/physics/rigid-body_REF.gc b/test/decompiler/reference/jak3/engine/physics/rigid-body_REF.gc index 09778468e1..97f12914bb 100644 --- a/test/decompiler/reference/jak3/engine/physics/rigid-body_REF.gc +++ b/test/decompiler/reference/jak3/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 rvec x) (* f0-4 (+ f1-3 (* f2-0 f2-0)))) - ) - (let ((f1-6 f28-0)) - (set! (-> this inertial-tensor uvec y) (* f0-4 (+ (* f1-6 f1-6) (* f26-0 f26-0)))) - ) - (set! (-> this inertial-tensor fvec z) (* f0-4 (+ (* f28-0 f28-0) (* f30-0 f30-0)))) + (set! (-> this inertial-tensor rvec x) (* f0-4 (+ (square f30-0) (square f26-0)))) + (set! (-> this inertial-tensor uvec y) (* f0-4 (+ (square f28-0) (square f26-0)))) + (set! (-> this inertial-tensor fvec z) (* f0-4 (+ (square f28-0) (square f30-0)))) ) ) (let ((f0-6 (-> this inertial-tensor rvec x))) @@ -196,10 +189,8 @@ (defmethod rigid-body-control-method-12 ((this rigid-body-control) (arg0 float)) (vector+*! (-> this lin-momentum) (-> this lin-momentum) (-> this force) arg0) (vector+*! (-> this ang-momentum) (-> this ang-momentum) (-> this torque) arg0) - (let* ((f0-3 (* 500000000.0 (-> this info mass))) - (f1-1 f0-3) - ) - (if (< (* f1-1 f1-1) (vector-length-squared (-> this ang-momentum))) + (let ((f0-3 (* 500000000.0 (-> this info mass)))) + (if (< (square f0-3) (vector-length-squared (-> this ang-momentum))) (vector-normalize! (-> this ang-momentum) f0-3) ) ) diff --git a/test/decompiler/reference/jak3/engine/physics/trajectory_REF.gc b/test/decompiler/reference/jak3/engine/physics/trajectory_REF.gc index 04212fe424..878eb7ba1a 100644 --- a/test/decompiler/reference/jak3/engine/physics/trajectory_REF.gc +++ b/test/decompiler/reference/jak3/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/jak3/engine/process-drawable/process-drawable_REF.gc b/test/decompiler/reference/jak3/engine/process-drawable/process-drawable_REF.gc index 66d5348cdc..999a8247b9 100644 --- a/test/decompiler/reference/jak3/engine/process-drawable/process-drawable_REF.gc +++ b/test/decompiler/reference/jak3/engine/process-drawable/process-drawable_REF.gc @@ -107,7 +107,6 @@ ;; definition (debug) for function cspace-inspect-tree ;; INFO: Used lq/sq (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)) ) @@ -133,15 +132,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*) ) ) ) @@ -256,7 +252,6 @@ ;; definition for method 9 of type lod-set ;; INFO: Used lq/sq (defmethod setup-lods! ((this lod-set) (skelgroup skeleton-group) (ag art-group) (entity entity)) - (local-vars (sv-16 res-tag)) (let ((v1-0 (-> ag length)) (max-lod (-> skelgroup max-lod)) ) @@ -279,13 +274,13 @@ (set! (-> this lod max-lod dist) (res-lump-float entity 'vis-dist :default 4095996000.0)) ) ) - (let ((jgeo (-> ag data (-> skelgroup jgeo)))) - (set! sv-16 (new 'static 'res-tag)) - (let ((dist (res-lump-data (-> jgeo extra) 'lod-dist pointer :tag-ptr (& sv-16)))) - (when dist - (dotimes (a0-6 (the-as int (-> sv-16 elt-count))) - (set! (-> this lod a0-6 dist) (-> (the-as (pointer float) (&+ dist (* a0-6 4))))) - ) + (let* ((jgeo (-> ag data (-> skelgroup jgeo))) + (sv-16 (new 'static 'res-tag)) + (dist (res-lump-data (-> jgeo extra) 'lod-dist pointer :tag-ptr (& sv-16))) + ) + (when dist + (dotimes (a0-6 (the-as int (-> sv-16 elt-count))) + (set! (-> this lod a0-6 dist) (-> (the-as (pointer float) (&+ dist (* a0-6 4))))) ) ) ) @@ -525,12 +520,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)) @@ -543,17 +532,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 577) - (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 577) + (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)) + ) ) ) ) @@ -670,11 +661,11 @@ ) ) :code (behavior ((arg0 string)) - (local-vars (sv-8 string)) - (set! sv-8 arg0) - (until #f - (process-drawable-error-print self sv-8) - (suspend) + (let ((sv-8 arg0)) + (until #f + (process-drawable-error-print self sv-8) + (suspend) + ) ) #f ) @@ -693,7 +684,7 @@ ;; WARN: Stack slot offset 20 signed mismatch ;; WARN: Stack slot offset 20 signed mismatch (defun skeleton-group->draw-control ((proc process-drawable) (skelgroup skeleton-group) (arg2 (pointer cspace-array))) - (local-vars (s1-0 art-group) (s2-0 draw-control) (sv-16 art-element) (sv-20 int)) + (local-vars (s1-0 art-group) (s2-0 draw-control)) (let ((s3-0 (if (= (-> skelgroup texture-level) 10) (-> *level* level-default) (-> proc level) @@ -729,61 +720,63 @@ (set! s2-0 (the-as draw-control #f)) (goto cfg-62) ) - (set! sv-16 (-> s1-0 data (-> skelgroup jgeo))) - (set! sv-20 (-> s1-0 length)) - (when (or (< (-> skelgroup jgeo) 0) (>= (-> skelgroup 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-62) - ) - (set! s2-0 (new 'process 'draw-control proc (the-as symbol sv-16))) - (let ((v1-35 s2-0)) - (set! (-> v1-35 status) (draw-control-status uninited)) - (set! (-> v1-35 art-group) s1-0) - (set! (-> v1-35 jgeo) (the-as art-joint-geo sv-16)) - (set! (-> v1-35 force-lod) -1) - (set! (-> v1-35 cur-lod) -1) - (set! (-> v1-35 shadow) #f) - (set! (-> v1-35 shadow-ctrl) #f) - (set! (-> v1-35 data-format) (draw-control-data-format merc)) - (set! (-> v1-35 color-mult quad) (-> (new 'static 'vector :x 1.0 :y 1.0 :z 1.0 :w 1.0) quad)) - (set! (-> v1-35 color-emissive quad) (-> (new 'static 'vector) quad)) - (set! (-> v1-35 longest-edge) (-> skelgroup longest-edge)) - (set! (-> v1-35 origin-joint-index) (the-as uint (-> skelgroup origin-joint-index))) - (set! (-> v1-35 shadow-joint-index) (the-as uint (-> skelgroup shadow-joint-index))) - ) - (vector-copy! (-> s2-0 bounds) (-> skelgroup bounds)) - (let ((v1-37 (-> skelgroup shadow))) - (when (and (> v1-37 0) (< v1-37 sv-20)) - (let ((s0-0 (-> s1-0 data v1-37))) - (if (and (not (logtest? (the-as int (res-lump-value (-> proc entity) 'options uint128 :time -1000000000.0)) 8192)) - s0-0 - (= (-> s0-0 type) shadow-geo) - ) - (set! (-> s2-0 shadow) (the-as shadow-geo s0-0)) + (let ((sv-16 (-> s1-0 data (-> skelgroup jgeo)))) + (let ((sv-20 (-> s1-0 length))) + (when (or (< (-> skelgroup jgeo) 0) (>= (-> skelgroup 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-62) + ) + (set! s2-0 (new 'process 'draw-control proc (the-as symbol sv-16))) + (let ((v1-35 s2-0)) + (set! (-> v1-35 status) (draw-control-status uninited)) + (set! (-> v1-35 art-group) s1-0) + (set! (-> v1-35 jgeo) (the-as art-joint-geo sv-16)) + (set! (-> v1-35 force-lod) -1) + (set! (-> v1-35 cur-lod) -1) + (set! (-> v1-35 shadow) #f) + (set! (-> v1-35 shadow-ctrl) #f) + (set! (-> v1-35 data-format) (draw-control-data-format merc)) + (set! (-> v1-35 color-mult quad) (-> (new 'static 'vector :x 1.0 :y 1.0 :z 1.0 :w 1.0) quad)) + (set! (-> v1-35 color-emissive quad) (-> (new 'static 'vector) quad)) + (set! (-> v1-35 longest-edge) (-> skelgroup longest-edge)) + (set! (-> v1-35 origin-joint-index) (the-as uint (-> skelgroup origin-joint-index))) + (set! (-> v1-35 shadow-joint-index) (the-as uint (-> skelgroup shadow-joint-index))) + ) + (vector-copy! (-> s2-0 bounds) (-> skelgroup bounds)) + (let ((v1-37 (-> skelgroup shadow))) + (when (and (> v1-37 0) (< v1-37 sv-20)) + (let ((s0-0 (-> s1-0 data v1-37))) + (if (and (not (logtest? (the-as int (res-lump-value (-> proc entity) 'options uint128 :time -1000000000.0)) 8192)) + s0-0 + (= (-> s0-0 type) shadow-geo) + ) + (set! (-> s2-0 shadow) (the-as shadow-geo s0-0)) + ) ) + ) ) ) - ) - (if (not (setup-lods! (-> s2-0 lod-set) skelgroup s1-0 (-> proc entity))) - (go process-drawable-art-error "mesh") - ) - (let ((v1-52 (res-lump-value (-> sv-16 extra) 'texture-bucket int :default (the-as uint128 1) :time -1000000000.0)) + (if (not (setup-lods! (-> s2-0 lod-set) skelgroup s1-0 (-> proc entity))) + (go process-drawable-art-error "mesh") ) - (case (if (= (-> skelgroup texture-level) 10) - 10 - (-> s3-0 index) - ) - ((10) - (set! v1-52 (-> skelgroup sort)) - ) + (let ((v1-52 (res-lump-value (-> sv-16 extra) 'texture-bucket int :default (the-as uint128 1) :time -1000000000.0)) + ) + (case (if (= (-> skelgroup texture-level) 10) + 10 + (-> s3-0 index) + ) + ((10) + (set! v1-52 (-> skelgroup sort)) + ) + ) + (set! (-> s2-0 default-texture-page) (the-as uint v1-52)) ) - (set! (-> s2-0 default-texture-page) (the-as uint v1-52)) + (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 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 (-> proc entity) 'shadow-mask uint :time -1000000000.0)) (set! (-> s2-0 shadow-values) (res-lump-value (-> proc entity) 'shadow-values uint :time -1000000000.0)) @@ -1060,14 +1053,15 @@ ;; definition for function ja-linear-vel ;; INFO: Used lq/sq (defbehavior ja-linear-vel process-drawable ((chan int)) - (local-vars (s4-1 vector) (sv-16 res-tag)) + (local-vars (s4-1 vector)) (let* ((s4-0 (-> self skel root-channel chan)) (v1-2 (-> s4-0 frame-group)) ) (cond ((-> v1-2 extra) - (set! sv-16 (new 'static 'res-tag)) - (let ((gp-0 (res-lump-data (-> v1-2 extra) 'linear-vel pointer :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (gp-0 (res-lump-data (-> v1-2 extra) 'linear-vel pointer :tag-ptr (& sv-16))) + ) (cond (gp-0 (let* ((s5-0 (the int (the float (the int (-> s4-0 frame-num))))) diff --git a/test/decompiler/reference/jak3/engine/ps2/pad_REF.gc b/test/decompiler/reference/jak3/engine/ps2/pad_REF.gc index 1432c8e1e1..0006de8f23 100644 --- a/test/decompiler/reference/jak3/engine/ps2/pad_REF.gc +++ b/test/decompiler/reference/jak3/engine/ps2/pad_REF.gc @@ -497,7 +497,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/jak3/engine/scene/scene_REF.gc b/test/decompiler/reference/jak3/engine/scene/scene_REF.gc index 2b3c494ea3..2188d771ae 100644 --- a/test/decompiler/reference/jak3/engine/scene/scene_REF.gc +++ b/test/decompiler/reference/jak3/engine/scene/scene_REF.gc @@ -184,7 +184,7 @@ ;; definition for method 9 of type scene-actor ;; INFO: Used lq/sq (defmethod setup-manipy-for-scene! ((this scene-actor) (arg0 scene-player)) - (local-vars (s4-0 (pointer process)) (sv-96 process)) + (local-vars (s4-0 (pointer process))) (let ((s2-0 (if (-> this level) (level-get *level* (-> this level)) (-> *level* level-default) @@ -231,26 +231,26 @@ ) ) ) - (set! sv-96 (get-process *default-dead-pool* manipy #x20000 0)) - (set! s4-0 (when sv-96 - (let ((t9-8 (method-of-type manipy activate))) - (t9-8 (the-as manipy sv-96) arg0 (-> this name) (the-as pointer #x70004000)) - ) - (run-now-in-process - sv-96 - manipy-init - (-> arg0 root trans) - s2-1 - s3-0 - #f - (if (and s1-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 #x20000 0))) + (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) + s2-1 + s3-0 + #f + (if (and s1-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) @@ -452,14 +452,8 @@ (v1-73 symbol) (v1-105 symbol) (sv-96 object) - (sv-112 object) (sv-128 object) - (sv-144 object) (sv-160 object) - (sv-176 object) - (sv-192 object) - (sv-208 object) - (sv-224 object) ) (dotimes (s3-0 (-> this scene actor length)) (let ((s2-0 (-> this scene actor s3-0))) @@ -490,8 +484,9 @@ ) (let ((s1-1 (handle->process (-> s2-0 process)))) (when (and s1-1 (nonzero? (-> (the-as process-drawable s1-1) draw))) - (let ((s0-1 (-> s2-0 scissor-frames))) - (set! sv-112 (car s0-1)) + (let* ((s0-1 (-> s2-0 scissor-frames)) + (sv-112 (car s0-1)) + ) (while (not (null? s0-1)) (when (and (pair? sv-112) (let ((a0-21 (car sv-112))) @@ -513,8 +508,9 @@ (logclear! (-> (the-as process-drawable s1-1) draw status) (draw-control-status force-vu1)) (logior! (-> (the-as process-drawable s1-1) draw status) (draw-control-status force-vu1)) ) - (let ((s0-2 (-> s2-0 shadow-frames))) - (set! sv-144 (car s0-2)) + (let* ((s0-2 (-> s2-0 shadow-frames)) + (sv-144 (car s0-2)) + ) (while (not (null? s0-2)) (when (and (pair? sv-144) (let ((a0-30 (car sv-144))) @@ -536,23 +532,22 @@ (send-event s1-1 'shadow #t) (send-event s1-1 'shadow #f) ) - (let ((s0-3 (-> s2-0 cloth-reset-frames))) - (set! sv-192 (car s0-3)) + (let* ((s0-3 (-> s2-0 cloth-reset-frames)) + (sv-192 (car s0-3)) + ) (while (not (null? s0-3)) (let ((v1-97 (cond ((pair? sv-192) - (let ((a0-38 (car sv-192))) - (set! sv-176 (car (cdr sv-192))) + (let ((a0-38 (car sv-192)) + (sv-176 (car (cdr sv-192))) + ) (and (or (= a0-38 'min) (>= arg0 (+ -1.0 (command-get-float a0-38 0.0)))) (or (= sv-176 'max) (< arg0 (+ 1.0 (command-get-float (car (cdr sv-192)) 0.0)))) ) ) ) (else - (let* ((t9-11 command-get-float) - (a1-18 0.0) - (f0-10 (t9-11 sv-192 a1-18)) - ) + (let ((f0-10 (command-get-float sv-192 0.0))) (and (< arg1 f0-10) (>= arg0 f0-10)) ) ) @@ -578,27 +573,25 @@ ) (while (not (null? s2-1)) (when (pair? s0-4) - (set! sv-224 (car s0-4)) - (let ((v1-121 (cond - ((pair? sv-224) - (let ((a0-44 (car sv-224))) - (set! sv-208 (car (cdr sv-224))) - (and (or (= a0-44 'min) (>= arg0 (command-get-float a0-44 0.0))) - (or (= sv-208 'max) (< arg0 (command-get-float (car (cdr sv-224)) 0.0))) + (let* ((sv-224 (car s0-4)) + (v1-121 (cond + ((pair? sv-224) + (let ((a0-44 (car sv-224)) + (sv-208 (car (cdr sv-224))) ) - ) - ) - (else - (let* ((t9-15 command-get-float) - (a1-23 0.0) - (f0-13 (t9-15 sv-224 a1-23)) + (and (or (= a0-44 'min) (>= arg0 (command-get-float a0-44 0.0))) + (or (= sv-208 'max) (< arg0 (command-get-float (car (cdr sv-224)) 0.0))) ) - (and (< arg1 f0-13) (>= arg0 f0-13)) ) ) - ) - ) - ) + (else + (let ((f0-13 (command-get-float sv-224 0.0))) + (and (< arg1 f0-13) (>= arg0 f0-13)) + ) + ) + ) + ) + ) (if v1-121 (process-drawable-cloth-command (the-as process-drawable s1-1) (cdr s0-4)) ) @@ -890,15 +883,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 hud-draw-pris2) ) @@ -910,16 +901,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/jak3/engine/sound/gsound_REF.gc b/test/decompiler/reference/jak3/engine/sound/gsound_REF.gc index 553514400a..a6717a4448 100644 --- a/test/decompiler/reference/jak3/engine/sound/gsound_REF.gc +++ b/test/decompiler/reference/jak3/engine/sound/gsound_REF.gc @@ -784,9 +784,9 @@ ;; INFO: Used lq/sq (defbehavior sound-play-by-name process-drawable ((name sound-name) (id sound-id) (vol int) (pitch int) (bend int) (group sound-group) (trans object)) "Send play rpc to play a sound!" - (local-vars (sv-16 sound-group)) - (set! sv-16 group) - (let ((s4-0 trans)) + (let ((sv-16 group) + (s4-0 trans) + ) (when *sound-player-enable* (let ((s5-0 (the-as sound-rpc-play (get-sound-buffer-entry)))) (set! (-> s5-0 command) (sound-command play)) @@ -958,115 +958,109 @@ ;; INFO: Used lq/sq (defmethod new ambient-sound ((allocation symbol) (type-to-make type) (spec basic) (trans vector) (lump-time float)) "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 (-> spec type) - ((entity-actor) - (let* ((a0-3 ((method-of-type res-lump get-property-struct) - (the-as res-lump spec) - 'effect-name - 'exact - lump-time - (the-as structure #f) - (the-as (pointer res-tag) #f) - *res-static-buf* - ) - ) - (v1-2 (when a0-3 - (case (rtype-of a0-3) - ((symbol) - (symbol->string (the-as symbol a0-3)) - ) - ((string) - a0-3 - ) - (else - "unknown" + (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 (-> spec type) + ((entity-actor) + (let* ((a0-3 ((method-of-type res-lump get-property-struct) + (the-as res-lump spec) + 'effect-name + 'exact + lump-time + (the-as structure #f) + (the-as (pointer res-tag) #f) + *res-static-buf* + ) + ) + (v1-2 (when a0-3 + (case (rtype-of a0-3) + ((symbol) + (symbol->string (the-as symbol a0-3)) + ) + ((string) + a0-3 + ) + (else + "unknown" + ) ) ) ) + ) + (when v1-2 + (set! sv-32 (string->sound-name (the-as string v1-2))) + (set! sv-48 (res-lump-data (the-as res-lump spec) 'cycle-speed (pointer float))) + (set! sv-16 *ambient-spec*) + (let* ((sv-64 (new 'static 'res-tag)) + (v1-9 ((method-of-type res-lump get-property-data) + (the-as res-lump spec) + 'effect-param + 'exact + lump-time + (the-as pointer #f) + (& sv-64) + *res-static-buf* + ) + ) ) - ) - (when v1-2 - (set! sv-32 (string->sound-name (the-as string v1-2))) - (set! sv-48 (res-lump-data (the-as res-lump spec) 'cycle-speed (pointer float))) - (set! sv-16 *ambient-spec*) - (set! sv-64 (new 'static 'res-tag)) - (let ((v1-9 ((method-of-type res-lump get-property-data) - (the-as res-lump spec) - 'effect-param - 'exact - lump-time - (the-as pointer #f) - (& sv-64) - *res-static-buf* - ) - ) + (when v1-9 + (set! sv-52 v1-9) + (set! sv-56 (the-as int (-> sv-64 elt-count))) ) - (when v1-9 - (set! sv-52 v1-9) - (set! sv-56 (the-as int (-> sv-64 elt-count))) ) ) ) ) - ) - ((sound-spec) - (set! sv-16 (the-as sound-spec spec)) - ) - ((string) - (set! sv-32 (string->sound-name (the-as string spec))) - ) - (else - (format 0 "ERROR: ambient sound was told to play an unknown ~A.~%" spec) + ((sound-spec) + (set! sv-16 (the-as sound-spec spec)) + ) + ((string) + (set! sv-32 (string->sound-name (the-as string spec))) + ) + (else + (format 0 "ERROR: ambient sound was told to play an unknown ~A.~%" spec) + ) ) - ) - (cond - ((or sv-16 (nonzero? sv-32)) - (let ((s5-1 (object-new allocation type-to-make (the-as int (-> type-to-make size))))) - (set! (-> s5-1 spec) sv-16) - (set! (-> s5-1 name) sv-32) - (set! (-> s5-1 playing-id) (new-sound-id)) - (set! (-> s5-1 params) (the-as (pointer float) sv-52)) - (set! (-> s5-1 param-count) sv-56) - (set! (-> s5-1 entity) #f) - (set! (-> s5-1 sound-count) 1) - (set! (-> s5-1 volume) 1024) - (set! (-> 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! (-> s5-1 volume) (-> (the-as sound-spec sv-16) volume)) - ) - (if (logtest? (-> (the-as sound-spec sv-16) mask) (sound-mask pitch)) - (set! (-> s5-1 pitch) (-> (the-as sound-spec sv-16) pitch-mod)) - ) - ) - (cond - (sv-48 - (set! (-> s5-1 time-base) (the-as time-frame (the int (* 300.0 (-> sv-48 0))))) - (set! (-> s5-1 time-random) (the-as time-frame (the int (* 300.0 (-> sv-48 1))))) + (cond + ((or sv-16 (nonzero? sv-32)) + (let ((s5-1 (object-new allocation type-to-make (the-as int (-> type-to-make size))))) + (set! (-> s5-1 spec) sv-16) + (set! (-> s5-1 name) sv-32) + (set! (-> s5-1 playing-id) (new-sound-id)) + (set! (-> s5-1 params) (the-as (pointer float) sv-52)) + (set! (-> s5-1 param-count) sv-56) + (set! (-> s5-1 entity) #f) + (set! (-> s5-1 sound-count) 1) + (set! (-> s5-1 volume) 1024) + (set! (-> 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! (-> s5-1 volume) (-> (the-as sound-spec sv-16) volume)) + ) + (if (logtest? (-> (the-as sound-spec sv-16) mask) (sound-mask pitch)) + (set! (-> s5-1 pitch) (-> (the-as sound-spec sv-16) pitch-mod)) + ) ) - (else - (set! (-> s5-1 time-base) -1) + (cond + (sv-48 + (set! (-> s5-1 time-base) (the-as time-frame (the int (* 300.0 (-> sv-48 0))))) + (set! (-> s5-1 time-random) (the-as time-frame (the int (* 300.0 (-> sv-48 1))))) + ) + (else + (set! (-> s5-1 time-base) -1) + ) ) + (vector-copy! (-> s5-1 trans) trans) + s5-1 ) - (vector-copy! (-> s5-1 trans) trans) - s5-1 ) - ) - (else - (the-as ambient-sound 0) + (else + (the-as ambient-sound 0) + ) ) ) ) diff --git a/test/decompiler/reference/jak3/engine/sound/speech_REF.gc b/test/decompiler/reference/jak3/engine/sound/speech_REF.gc index e850308729..25780e983d 100644 --- a/test/decompiler/reference/jak3/engine/sound/speech_REF.gc +++ b/test/decompiler/reference/jak3/engine/sound/speech_REF.gc @@ -263,11 +263,9 @@ (if (and (!= (-> this request handle) #f) (or (< (the-as time-frame (-> s5-1 request-timeout)) a0-8) (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)) + ) ) ) (reset-channel! this) @@ -442,14 +440,9 @@ (speech-channel-method-14 this arg1 1.0) (return 0) ) - (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 (-> s3-0 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 (-> s3-0 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/jak3/engine/spatial-hash/actor-hash_REF.gc b/test/decompiler/reference/jak3/engine/spatial-hash/actor-hash_REF.gc index afe115ea4c..6f13ee91f7 100644 --- a/test/decompiler/reference/jak3/engine/spatial-hash/actor-hash_REF.gc +++ b/test/decompiler/reference/jak3/engine/spatial-hash/actor-hash_REF.gc @@ -183,20 +183,15 @@ (while (!= v1-17 (-> this list alive-list-end)) (let* ((s4-0 (-> (the-as connection v1-17) param1)) (f0-7 (vector-vector-distance-squared (-> this tpos) (-> (the-as collide-shape s4-0) trans))) - (f1-2 102400.0) ) (cond - ((< f0-7 (* f1-2 f1-2)) + ((< f0-7 (square 102400.0)) ((method-of-type actor-hash-bucket add-actor-cshape) (-> this data 0) (the-as collide-shape s4-0)) ) - ((let ((f1-5 204800.0)) - (< f0-7 (* f1-5 f1-5)) - ) + ((< f0-7 (square 204800.0)) (add-actor-cshape (-> this data 1) (the-as collide-shape s4-0)) ) - ((let ((f1-8 307200.0)) - (< f0-7 (* f1-8 f1-8)) - ) + ((< f0-7 (square 307200.0)) (add-actor-cshape (-> this data 2) (the-as collide-shape s4-0)) ) (else diff --git a/test/decompiler/reference/jak3/engine/spatial-hash/collide-hash_REF.gc b/test/decompiler/reference/jak3/engine/spatial-hash/collide-hash_REF.gc index 467514a4fb..6e176e00d7 100644 --- a/test/decompiler/reference/jak3/engine/spatial-hash/collide-hash_REF.gc +++ b/test/decompiler/reference/jak3/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 long 3)))) + (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 long 0)))) - (.pextlh v1-12 v1-11 0) - (let ((a0-9 (the-as uint128 (-> s3-0 origin long 1)))) - (.pw.sra a1-3 v1-12 10) - (let ((v1-13 (the-as uint128 (-> s3-0 origin long 2)))) - (.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 long 3)))) + (nop!) + (let ((a2-2 (the-as uint128 (-> s3-0 origin long 0)))) + (.pextlh v1-12 v1-11 0) + (let ((a0-9 (the-as uint128 (-> s3-0 origin long 1)))) + (.pw.sra a1-3 v1-12 10) + (let ((v1-13 (the-as uint128 (-> s3-0 origin long 2)))) + (.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 rvec quad) vf1) - (nop!) - (.svf (&-> s2-0 instance-mat uvec quad) vf2) - (nop!) - (.svf (&-> s2-0 instance-mat fvec quad) 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 rvec quad)) - (nop!) - (.lvf vf2 (&-> s0-0 uvec quad)) - (nop!) - (.lvf vf3 (&-> s0-0 fvec quad)) - (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 rvec quad) vf1) + (nop!) + (.svf (&-> s2-0 instance-mat uvec quad) vf2) + (nop!) + (.svf (&-> s2-0 instance-mat fvec quad) 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 rvec quad)) + (nop!) + (.lvf vf2 (&-> s0-0 uvec quad)) + (nop!) + (.lvf vf3 (&-> s0-0 fvec quad)) + (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)) + ) ) ) ) @@ -379,8 +379,6 @@ (a1-3 uint128) (a2-3 uint128) (a2-4 uint128) - (sv-16 int) - (sv-640 int) ) (rlet ((acc :class vf) (vf0 :class vf) @@ -397,202 +395,204 @@ (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 long 3)))) + (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 long 0)))) - (.pextlh v1-12 v1-11 0) - (let ((a0-9 (the-as uint128 (-> s2-0 origin long 1)))) - (.pw.sra a1-3 v1-12 10) - (let ((v1-13 (the-as uint128 (-> s2-0 origin long 2)))) - (.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 long 3)))) + (nop!) + (let ((a2-2 (the-as uint128 (-> s2-0 origin long 0)))) + (.pextlh v1-12 v1-11 0) + (let ((a0-9 (the-as uint128 (-> s2-0 origin long 1)))) + (.pw.sra a1-3 v1-12 10) + (let ((v1-13 (the-as uint128 (-> s2-0 origin long 2)))) + (.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 rvec quad) vf1) - (nop!) - (.svf (&-> s1-0 instance-mat uvec quad) vf2) - (nop!) - (.svf (&-> s1-0 instance-mat fvec quad) 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 rvec quad)) - (nop!) - (.lvf vf2 (&-> s0-0 uvec quad)) - (nop!) - (.lvf vf3 (&-> s0-0 fvec quad)) - (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 rvec quad) vf1) + (nop!) + (.svf (&-> s1-0 instance-mat uvec quad) vf2) + (nop!) + (.svf (&-> s1-0 instance-mat fvec quad) 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 rvec quad)) + (nop!) + (.lvf vf2 (&-> s0-0 uvec quad)) + (nop!) + (.lvf vf3 (&-> s0-0 fvec quad)) + (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)) + ) + ) + (set! (-> s1-0 rlength w) (/ 1.0 (vector-length-squared (-> s1-0 move-dist)))) + (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)) - ) - ) - (set! (-> s1-0 rlength w) (/ 1.0 (vector-length-squared (-> s1-0 move-dist)))) - (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/jak3/engine/spatial-hash/spatial-hash_REF.gc b/test/decompiler/reference/jak3/engine/spatial-hash/spatial-hash_REF.gc index 780a4b0581..de30dbac71 100644 --- a/test/decompiler/reference/jak3/engine/spatial-hash/spatial-hash_REF.gc +++ b/test/decompiler/reference/jak3/engine/spatial-hash/spatial-hash_REF.gc @@ -577,44 +577,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 debug) 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 debug) 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 debug) 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 debug) 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 debug) 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 debug) sv-68 sv-72 arg3 #f (the-as rgba -1)) + ) ) ) 0 diff --git a/test/decompiler/reference/jak3/engine/target/board/board-states_REF.gc b/test/decompiler/reference/jak3/engine/target/board/board-states_REF.gc index 45a32490a6..fbb7f6d6a1 100644 --- a/test/decompiler/reference/jak3/engine/target/board/board-states_REF.gc +++ b/test/decompiler/reference/jak3/engine/target/board/board-states_REF.gc @@ -944,10 +944,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 manipy-options none :behavior manipy)) - (sv-160 entity-actor) - ) (if (= arg2 'hit) (set! arg2 #f) ) @@ -1005,36 +1001,21 @@ (part-tracker-spawn part-tracker :to self :group group-board-quick-jump) ) ) - (let* ((s1-1 (get-process *default-dead-pool* manipy #x20000 1)) - (s2-4 - (when s1-1 - (let ((t9-20 (method-of-type manipy activate))) - (t9-20 (the-as manipy s1-1) self "manipy" (the-as pointer #x70004000)) - ) - (let ((s2-5 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 level) #f))) - (t1-1 #f) - (t2-1 0) - ) - ((the-as (function object object object object object object object none) s2-5) - s0-1 - sv-144 - s3-5 - sv-160 - t0-2 - t1-1 - t2-1 - ) - ) - ) - (-> s1-1 ppointer) - ) - ) - ) + (let ((s2-4 + (process-spawn + manipy + :init manipy-init + s3-5 + (-> self entity) + (art-group-get-by-name *level* "skel-generic-blast" (the-as (pointer level) #f)) + #f + 0 + :name "manipy" + :to self + :stack-size #x20000 + ) + ) + ) (when s2-4 (quaternion-copy! (-> (the-as process-drawable (-> s2-4 0)) root quat) (-> self control quat-for-control)) (send-event (ppointer->process s2-4) 'anim-mode 'play1) diff --git a/test/decompiler/reference/jak3/engine/target/board/target-board_REF.gc b/test/decompiler/reference/jak3/engine/target/board/target-board_REF.gc index f14ef4d7c5..ef128de4d3 100644 --- a/test/decompiler/reference/jak3/engine/target/board/target-board_REF.gc +++ b/test/decompiler/reference/jak3/engine/target/board/target-board_REF.gc @@ -524,10 +524,8 @@ (when (!= *target* a0-11) (let ((v1-13 (vector-! (new 'stack-no-clear 'vector) (-> a0-11 root trans) gp-0))) 0.0 - (let ((f0-3 (vector-length-squared v1-13)) - (f1-0 (-> gp-0 w)) - ) - (if (>= (* f1-0 f1-0) f0-3) + (let ((f0-3 (vector-length-squared v1-13))) + (if (>= (square (-> gp-0 w)) f0-3) (send-event a0-11 'green-eco-attack) ) ) @@ -544,10 +542,8 @@ (when (!= *target* s5-2) (let ((v1-24 (vector-! (new 'stack-no-clear 'vector) (-> s5-2 control trans) gp-0))) 0.0 - (let ((f0-6 (vector-length-squared v1-24)) - (f1-4 (-> gp-0 w)) - ) - (if (>= (* f1-4 f1-4) f0-6) + (let ((f0-6 (vector-length-squared v1-24))) + (if (>= (square (-> gp-0 w)) f0-6) (send-event s5-2 'green-eco-attack) ) ) @@ -2327,7 +2323,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-752 int)) (let ((s4-0 *edge-grab-info*) (gp-0 (new 'stack-no-clear 'vector)) ) @@ -2519,8 +2514,8 @@ ) (s3-8 (new 'stack-no-clear 'collide-query)) (f26-0 81920.0) + (sv-752 8) ) - (set! sv-752 8) (let ((v1-205 s3-8)) (set! (-> v1-205 radius) 1228.8) (set! (-> v1-205 collide-with) diff --git a/test/decompiler/reference/jak3/engine/target/collide-reaction-target_REF.gc b/test/decompiler/reference/jak3/engine/target/collide-reaction-target_REF.gc index f05f83c50a..3b1253c1c5 100644 --- a/test/decompiler/reference/jak3/engine/target/collide-reaction-target_REF.gc +++ b/test/decompiler/reference/jak3/engine/target/collide-reaction-target_REF.gc @@ -4,31 +4,32 @@ ;; definition for function poly-find-nearest-edge ;; INFO: Used lq/sq (defun poly-find-nearest-edge ((arg0 nav-poly) (arg1 (inline-array vector)) (arg2 vector) (arg3 vector)) - (local-vars (sv-32 vector) (sv-36 number) (sv-40 int) (sv-48 number) (sv-80 vector)) - (set! sv-32 (new 'stack-no-clear 'vector)) - (set! sv-36 4095996000.0) - (set! sv-40 -1) - (set! sv-48 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 (the-as float sv-36)) (and (= f30-0 (the-as float sv-36)) (< (the-as float 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 4095996000.0) + (sv-40 -1) + ) + (let ((sv-48 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 (the-as float sv-36)) (and (= f30-0 (the-as float sv-36)) (< (the-as float 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)) + (vector-copy! (-> arg0 vertex1) (-> arg1 (mod (+ sv-40 1) 3))) ) - (set! (-> arg0 vertex 0 quad) (-> arg1 sv-40 quad)) - (vector-copy! (-> arg0 vertex1) (-> arg1 (mod (+ sv-40 1) 3))) arg0 ) @@ -42,158 +43,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)) - (vector-copy! (-> arg0 low-coverage-norm-of-next1) (-> s4-0 best-other-tri normal)) - 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)) - (vector-copy! (-> arg0 low-coverage-norm-of-next2) (-> s4-0 best-other-tri normal)) - 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)) + (vector-copy! (-> arg0 low-coverage-norm-of-next1) (-> s4-0 best-other-tri normal)) + 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)) + (vector-copy! (-> arg0 low-coverage-norm-of-next2) (-> s4-0 best-other-tri normal)) + 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) ) @@ -201,299 +196,294 @@ ;; 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)) - (vector-copy! (-> sv-88 rvec) arg3) - (vector-copy! (-> sv-88 uvec) arg3) - (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))) - (vector-copy! v1-24 (-> arg1 best-my-prim prim-core world-sphere)) - (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)) - ) - (vector-copy! (-> arg0 poly-normal) (-> arg1 best-other-tri normal)) - (collide-shape-moving-angle-set! arg0 sv-84 (-> sv-88 rvec)) - (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))) - (vector-copy! (-> arg0 transv-on-last-impact) (-> arg0 transv)) - (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 rvec 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 rvec))) - ) - 0.0 - (vector-! v1-113 (-> sv-88 rvec) (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 rvec) - (vector-float*! (-> sv-88 rvec) (-> 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))) + (vector-copy! (-> sv-88 rvec) arg3) + (vector-copy! (-> sv-88 uvec) arg3) + (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))) + (vector-copy! v1-24 (-> arg1 best-my-prim prim-core world-sphere)) + (vector-! sv-80 v1-24 (-> arg1 best-other-tri intersect)) ) - ) - ) - ) - (set! sv-96 (logior sv-96 (collide-status touch-surface))) - (cond - ((-> arg1 best-other-prim) - (set! sv-96 (logior sv-96 (collide-status touch-actor))) - (set! (-> arg0 actor-contact-pt quad) (-> arg1 best-other-tri intersect quad)) - (vector-copy! (-> arg0 actor-contact-normal) (-> arg0 poly-normal)) - (set! (-> arg0 actor-contact-handle) (process->handle (-> arg1 best-other-prim 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)) - (vector-copy! (-> arg0 wall-contact-poly-normal) (-> arg0 poly-normal)) - (vector-copy! (-> arg0 wall-contact-normal) sv-84) - (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 rvec) (-> 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)) + ) + (vector-copy! sv-84 sv-80) + (if (= (-> arg1 best-dist) 0.0) + (move-by-vector! arg0 (vector-normalize-copy! (new-stack-vector0) sv-84 3.0)) + ) + (vector-copy! (-> arg0 poly-normal) (-> arg1 best-other-tri normal)) + (collide-shape-moving-angle-set! arg0 sv-84 (-> sv-88 rvec)) + (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 rvec))) - ) - (else - (vector-reflect-flat! arg2 (-> sv-88 rvec) 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 ground-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))) + (vector-copy! (-> arg0 transv-on-last-impact) (-> arg0 transv)) + (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 rvec 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 rvec))) + ) + 0.0 + (vector-! v1-113 (-> sv-88 rvec) (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 ground-touch-point)) + (if (< f1-13 0.0) + (set! f1-13 (* f1-13 f0-21)) + ) + (vector+! + (-> sv-88 rvec) + (vector-float*! (-> sv-88 rvec) (-> 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))) - (not (logtest? (state-flags hang) (-> arg0 process state-flags))) + ) + ) + ) + (logior! sv-96 (collide-status touch-surface)) + (cond + ((-> arg1 best-other-prim) + (logior! sv-96 (collide-status touch-actor)) + (set! (-> arg0 actor-contact-pt quad) (-> arg1 best-other-tri intersect quad)) + (vector-copy! (-> arg0 actor-contact-normal) (-> arg0 poly-normal)) + (set! (-> arg0 actor-contact-handle) (process->handle (-> arg1 best-other-prim cshape process))) + ) + ((= (-> arg0 poly-pat material) (pat-material waterbottom)) + ) + (else + (logior! sv-96 (collide-status touch-background)) + ) + ) + (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)) + (vector-copy! (-> arg0 wall-contact-poly-normal) (-> arg0 poly-normal)) + (vector-copy! (-> arg0 wall-contact-normal) sv-84) + (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 rvec) (-> 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 rvec))) + ) + (else + (vector-reflect-flat! arg2 (-> sv-88 rvec) 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 ground-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 ground-touch-point)) + ) + 0.0 + ) + (and (< 0.0 (vector-dot (-> arg0 ground-poly-normal) arg2)) + (not (logtest? sv-104 (cshape-reaction-flags csrf05))) + (not (logtest? (state-flags hang) (-> arg0 process state-flags))) + ) + ) + (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 rvec) s3-4)) ) + (vector+! arg2 arg2 (-> arg0 poly-normal)) + ) + (else + ) + ) ) - (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 rvec) 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) - (vector-copy! (-> arg0 local-normal) sv-84) - ) - (cond - ((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 rvec) sv-84 (-> arg0 dynam gravity-normal)) - (vector+! arg2 arg2 sv-84) - ) - ((and (or (>= (fabs (-> arg0 trans x)) 16777216.0) (>= (fabs (-> arg0 trans z)) 16777216.0)) - (and (not (focus-test? (the-as process-focusable (-> arg0 process)) board)) (< 0.7 (-> arg0 surface-angle))) - ) - (vector-reflect-flat-above! arg2 (-> sv-88 rvec) sv-84) - ) - (else - (vector-reflect-flat! arg2 (-> sv-88 rvec) sv-84) - (vector+! arg2 arg2 sv-84) - ) - ) - (let ((f0-37 (-> arg0 current-surface slope-change-preserve))) - (when (< 0.0 f0-37) - (let ((v1-234 (new-stack-vector0))) - (let ((f1-28 (vector-dot (-> arg0 pre-collide-local-normal) (-> sv-88 rvec)))) - 0.0 - (vector-! v1-234 (-> sv-88 rvec) (vector-float*! v1-234 (-> arg0 pre-collide-local-normal) f1-28)) - ) - (let ((f1-29 (vector-length v1-234))) - f1-29 - (let ((f1-30 f1-29) - (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) + (vector-copy! (-> arg0 local-normal) sv-84) + ) + (cond + ((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 rvec) sv-84 (-> arg0 dynam gravity-normal)) + (vector+! arg2 arg2 sv-84) + ) + ((and (or (>= (fabs (-> arg0 trans x)) 16777216.0) (>= (fabs (-> arg0 trans z)) 16777216.0)) + (and (not (focus-test? (the-as process-focusable (-> arg0 process)) board)) (< 0.7 (-> arg0 surface-angle))) + ) + (vector-reflect-flat-above! arg2 (-> sv-88 rvec) sv-84) + ) + (else + (vector-reflect-flat! arg2 (-> sv-88 rvec) sv-84) + (vector+! arg2 arg2 sv-84) + ) + ) + (let ((f0-37 (-> arg0 current-surface slope-change-preserve))) + (when (< 0.0 f0-37) + (let ((v1-234 (new-stack-vector0))) + (let ((f1-28 (vector-dot (-> arg0 pre-collide-local-normal) (-> sv-88 rvec)))) + 0.0 + (vector-! v1-234 (-> sv-88 rvec) (vector-float*! v1-234 (-> arg0 pre-collide-local-normal) f1-28)) + ) + (let ((f1-29 (vector-length v1-234))) + f1-29 + (let ((f1-30 f1-29) + (f2-5 (vector-length arg2)) + ) + (if (and (< 409.6 (fabs (- f2-5 f1-30))) (< f2-5 f1-30)) + (vector-normalize! arg2 (lerp-scale f2-5 f1-30 f0-37 0.0 1.0)) + ) + ) + ) ) - (if (and (< 409.6 (fabs (- f2-5 f1-30))) (< f2-5 f1-30)) - (vector-normalize! arg2 (lerp-scale f2-5 f1-30 f0-37 0.0 1.0)) + ) + ) + (set! (-> arg0 ground-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)) + (vector-copy! (-> arg0 ground-poly-normal) (-> arg0 poly-normal)) + (vector-copy! (-> arg0 ground-contact-normal) sv-84) + (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 ground-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 ground-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))) - (vector-copy! (-> arg0 ground-poly-normal) (-> arg0 poly-normal)) - (vector-copy! (-> arg0 ground-contact-normal) sv-84) - (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 ground-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))) - ) + (when *debug-segment* + (+! (-> arg0 history-idx) 1) + (let ((v1-271 (clear-record-tags! *history* (history-channel surface-normal) (-> arg0 history-idx) (the-as uint 2))) + ) + (vector-copy! (-> v1-271 origin) (-> arg1 best-other-tri intersect)) + (vector-copy! (-> v1-271 vector) (-> arg0 surface-normal)) + ) + (let ((v1-274 (clear-record-tags! *history* (history-channel local-normal) (-> arg0 history-idx) (the-as uint 2)))) + (vector-copy! (-> v1-274 origin) (-> arg1 best-other-tri intersect)) + (vector-copy! (-> v1-274 vector) (-> arg0 local-normal)) + ) + (vector-copy! + (-> (clear-record-tags! *history* (history-channel intersect) (-> arg0 history-idx) (the-as uint 2)) vector) + (-> arg1 best-other-tri intersect) + ) + (let ((v1-280 (clear-record-tags! *history* (history-channel transv-out) (-> arg0 history-idx) (the-as uint 2)))) + (vector-copy! (-> v1-280 origin) (-> arg1 best-other-tri intersect)) + (vector-copy! (-> v1-280 vector) arg2) + ) + (let ((v1-283 (clear-record-tags! *history* (history-channel transv-in) (-> arg0 history-idx) (the-as uint 2)))) + (vector-copy! (-> v1-283 origin) (-> arg1 best-other-tri intersect)) + (vector-copy! (-> v1-283 vector) (-> sv-88 uvec)) + ) + (let ((v1-286 (clear-record-tags! *history* (history-channel transv) (-> arg0 history-idx) (the-as uint 2)))) + (vector-copy! (-> v1-286 origin) (-> arg0 trans)) + (vector-copy! (-> v1-286 vector) (-> arg0 transv)) + ) + (vector-copy! + (-> (clear-record-tags! *history* (history-channel trans) (-> arg0 history-idx) (the-as uint 2)) vector) + (-> arg0 trans) + ) + (let ((v1-292 (clear-record-tags! *history* (history-channel pat) (-> arg0 history-idx) (the-as uint 2)))) + (set! (-> v1-292 vector x) (the-as float (-> arg0 cur-pat))) + ) + (let ((v1-294 (clear-record-tags! *history* (history-channel collide-status) (-> arg0 history-idx) (the-as uint 2))) + ) + (set! (-> v1-294 collide-status) (-> arg0 status)) + (set! (-> v1-294 vector z) (the-as float (-> arg0 reaction-flag))) + ) ) + sv-96 ) ) - (logior! (-> arg0 status) sv-96) - (set! (-> arg0 reaction-flag) sv-104) - (when *debug-segment* - (+! (-> arg0 history-idx) 1) - (let ((v1-271 (clear-record-tags! *history* (history-channel surface-normal) (-> arg0 history-idx) (the-as uint 2))) - ) - (vector-copy! (-> v1-271 origin) (-> arg1 best-other-tri intersect)) - (vector-copy! (-> v1-271 vector) (-> arg0 surface-normal)) - ) - (let ((v1-274 (clear-record-tags! *history* (history-channel local-normal) (-> arg0 history-idx) (the-as uint 2)))) - (vector-copy! (-> v1-274 origin) (-> arg1 best-other-tri intersect)) - (vector-copy! (-> v1-274 vector) (-> arg0 local-normal)) - ) - (vector-copy! - (-> (clear-record-tags! *history* (history-channel intersect) (-> arg0 history-idx) (the-as uint 2)) vector) - (-> arg1 best-other-tri intersect) - ) - (let ((v1-280 (clear-record-tags! *history* (history-channel transv-out) (-> arg0 history-idx) (the-as uint 2)))) - (vector-copy! (-> v1-280 origin) (-> arg1 best-other-tri intersect)) - (vector-copy! (-> v1-280 vector) arg2) - ) - (let ((v1-283 (clear-record-tags! *history* (history-channel transv-in) (-> arg0 history-idx) (the-as uint 2)))) - (vector-copy! (-> v1-283 origin) (-> arg1 best-other-tri intersect)) - (vector-copy! (-> v1-283 vector) (-> sv-88 uvec)) - ) - (let ((v1-286 (clear-record-tags! *history* (history-channel transv) (-> arg0 history-idx) (the-as uint 2)))) - (vector-copy! (-> v1-286 origin) (-> arg0 trans)) - (vector-copy! (-> v1-286 vector) (-> arg0 transv)) - ) - (vector-copy! - (-> (clear-record-tags! *history* (history-channel trans) (-> arg0 history-idx) (the-as uint 2)) vector) - (-> arg0 trans) - ) - (let ((v1-292 (clear-record-tags! *history* (history-channel pat) (-> arg0 history-idx) (the-as uint 2)))) - (set! (-> v1-292 vector x) (the-as float (-> arg0 cur-pat))) - ) - (let ((v1-294 (clear-record-tags! *history* (history-channel collide-status) (-> arg0 history-idx) (the-as uint 2))) - ) - (set! (-> v1-294 collide-status) (-> arg0 status)) - (set! (-> v1-294 vector z) (the-as float (-> arg0 reaction-flag))) - ) - ) - sv-96 ) ;; definition for function target-collision-no-reaction diff --git a/test/decompiler/reference/jak3/engine/target/flut/flut-racer_REF.gc b/test/decompiler/reference/jak3/engine/target/flut/flut-racer_REF.gc index c0795ee333..09d14d9434 100644 --- a/test/decompiler/reference/jak3/engine/target/flut/flut-racer_REF.gc +++ b/test/decompiler/reference/jak3/engine/target/flut/flut-racer_REF.gc @@ -558,10 +558,8 @@ (when (and (!= *target* s2-1) (type? s2-1 civilian)) (let ((v1-25 (vector-! (new 'stack-no-clear 'vector) (-> s2-1 root trans) s5-1))) 0.0 - (let ((f0-10 (vector-length-squared v1-25)) - (f1-2 (-> s5-1 w)) - ) - (when (>= (* f1-2 f1-2) f0-10) + (let ((f0-10 (vector-length-squared v1-25))) + (when (>= (square (-> s5-1 w)) f0-10) (set! (-> this enemy-info attack-damage) 15) (send-attack-from-tshape this s2-1 (the-as touching-shapes-entry #f) (-> this attack-id)) (set! (-> this enemy-info attack-damage) 0) @@ -581,10 +579,8 @@ (when (and (!= *target* s4-2) (type? s4-2 civilian)) (let ((v1-39 (vector-! (new 'stack-no-clear 'vector) (-> s4-2 control trans) s5-1))) 0.0 - (let ((f0-13 (vector-length-squared v1-39)) - (f1-6 (-> s5-1 w)) - ) - (when (>= (* f1-6 f1-6) f0-13) + (let ((f0-13 (vector-length-squared v1-39))) + (when (>= (square (-> s5-1 w)) f0-13) (set! (-> this enemy-info attack-damage) 15) (send-attack-from-tshape this s4-2 (the-as touching-shapes-entry #f) (-> this attack-id)) (set! (-> this enemy-info attack-damage) 0) diff --git a/test/decompiler/reference/jak3/engine/target/flut/target-flut_REF.gc b/test/decompiler/reference/jak3/engine/target/flut/target-flut_REF.gc index eabd7b3c34..0e3ddaf236 100644 --- a/test/decompiler/reference/jak3/engine/target/flut/target-flut_REF.gc +++ b/test/decompiler/reference/jak3/engine/target/flut/target-flut_REF.gc @@ -404,7 +404,6 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs object. (defbehavior flut-update-ik target () - (local-vars (sv-720 vector)) (let ((gp-0 (new 'stack-no-clear 'collide-query)) (s5-0 (-> (the-as process-drawable (-> self parent 0)) root)) ) @@ -443,11 +442,9 @@ (-> s3-0 shoulder-matrix-no-ik) (let ((v1-17 (-> s3-0 elbow-matrix-no-ik)) (s0-0 (new 'stack-no-clear 'vector)) + (sv-720 (new 'stack-no-clear 'vector)) ) - (set! sv-720 (new 'stack-no-clear 'vector)) - (let ((a0-8 (-> *y-vector* quad))) - (set! (-> sv-720 quad) a0-8) - ) + (vector-copy! sv-720 *y-vector*) (let ((s2-0 (new 'stack-no-clear 'vector))) (new 'stack-no-clear 'vector) (new 'stack-no-clear 'vector) @@ -460,11 +457,7 @@ (seek! (-> s3-0 user-blend) f0-11 (* 4.0 (seconds-per-frame))) ) (vector+*! (-> gp-0 start-pos) s0-0 sv-720 6144.0) - (let ((v1-23 (-> gp-0 move-dist)) - (f0-16 -20480.0) - ) - (vector-float*! v1-23 sv-720 f0-16) - ) + (vector-float*! (-> gp-0 move-dist) sv-720 -20480.0) (let ((v1-25 gp-0)) (set! (-> v1-25 radius) 4.096) (set! (-> v1-25 collide-with) (-> gp-0 collide-with)) @@ -1002,12 +995,6 @@ ) ) :code (behavior ((arg0 handle) (arg1 symbol) (arg2 int)) - (local-vars - (sv-96 process) - (sv-112 (function vector entity-actor skeleton-group vector manipy-options none :behavior manipy)) - (sv-128 vector) - (sv-144 entity-actor) - ) (target-exit) (+! (-> *game-info* flut-count) 1) (set-setting! 'string-spline-accel 'abs (meters 1) 0) @@ -1104,39 +1091,20 @@ (s2-0 (-> self level)) ) (process-entity-set! self (-> self flut entity)) - (let ((s1-0 (get-process *8k-dead-pool* manipy #x20000 1))) - (set! (-> self manipy) - (the-as - (pointer manipy) - (when s1-0 - (let ((t9-18 (method-of-type manipy activate))) - (t9-18 (the-as manipy s1-0) self "manipy" (the-as pointer #x70004000)) - ) - (let ((s0-0 run-function-in-process)) - (set! sv-96 s1-0) - (set! sv-112 manipy-init) - (set! sv-128 (-> self control trans)) - (set! sv-144 (-> self entity)) - (let ((t0-10 (art-group-get-by-name *level* "skel-flut" (the-as (pointer level) #f))) - (t1-10 'collide-shape-moving) - (t2-0 0) - ) - ((the-as (function object object object object object object object none) s0-0) - sv-96 - sv-112 - sv-128 - sv-144 - t0-10 - t1-10 - t2-0 - ) - ) - ) - (-> s1-0 ppointer) - ) - ) - ) - ) + (set! (-> self manipy) (process-spawn + manipy + :init manipy-init + (-> self control trans) + (-> self entity) + (art-group-get-by-name *level* "skel-flut" (the-as (pointer level) #f)) + 'collide-shape-moving + 0 + :name "manipy" + :from *8k-dead-pool* + :to self + :stack-size #x20000 + ) + ) (set! (-> self entity) s3-0) (set! (-> self level) s2-0) ) diff --git a/test/decompiler/reference/jak3/engine/target/gun/gun-blue-shot_REF.gc b/test/decompiler/reference/jak3/engine/target/gun/gun-blue-shot_REF.gc index d7c6aef8c8..3a77f2ee7d 100644 --- a/test/decompiler/reference/jak3/engine/target/gun/gun-blue-shot_REF.gc +++ b/test/decompiler/reference/jak3/engine/target/gun/gun-blue-shot_REF.gc @@ -229,9 +229,7 @@ ((zero? v1-40) (let ((s5-1 (new 'stack-no-clear 'dist-dot-val))) (get-dist-and-dot (the-as gun-blue-shot arg0) s5-1) - (let* ((f0-4 (* 0.5 (+ 1.0 (-> s5-1 dot)))) - (f0-5 (* f0-4 f0-4)) - ) + (let ((f0-5 (square (* 0.5 (+ 1.0 (-> s5-1 dot)))))) (vector-normalize! (-> arg0 root transv) (lerp 122880.0 409600.0 f0-5)) ) ) @@ -285,8 +283,7 @@ ) ) (vector-copy! (-> arg0 root transv) (-> s3-0 current-dir-vec)) - (let* ((f0-26 (* 0.5 (+ 1.0 (-> s3-0 dot)))) - (f0-27 (* f0-26 f0-26)) + (let* ((f0-27 (square (* 0.5 (+ 1.0 (-> s3-0 dot))))) (f0-28 (lerp 122880.0 409600.0 f0-27)) ) (vector-normalize! (-> arg0 root transv) f0-28) @@ -533,79 +530,132 @@ ;; WARN: Stack slot offset 1300 signed mismatch ;; WARN: Return type mismatch (pointer process) vs object. (defbehavior gun-fire-blue-3 target () - (local-vars - (sv-144 gun-info) - (sv-148 projectile-init-by-other-params) - (sv-1280 vector) - (sv-1284 (inline-array target-quality-info)) - (sv-1288 int) - (sv-1296 float) - (sv-1300 object) - ) - (set! sv-144 (-> self gun)) - (set! sv-148 (new 'stack-no-clear 'projectile-init-by-other-params)) - (draw-beam (-> *part-id-table* 364) (-> sv-144 fire-point) (-> sv-144 fire-dir-out) #f) - (set! sv-1280 (new 'stack-no-clear 'vector)) - (set! sv-1284 (new 'stack-no-clear 'inline-array 'target-quality-info 384)) - (set! sv-1288 0) - (set! sv-1296 (the-as float 0.0)) - (set! sv-1300 (send-event *target* 'get-vehicle)) - (vector-copy! sv-1280 (-> sv-144 fire-point)) - (set! (-> sv-1280 w) 163840.0) - (let ((gp-0 (new 'stack-no-clear 'array 'collide-shape 384))) - (countdown (s5-0 (fill-actor-list-for-box *actor-hash* sv-1280 gp-0 384)) - (let ((v1-16 (as-type (-> gp-0 s5-0) collide-shape))) - (when v1-16 - (let ((s4-1 (as-type (-> v1-16 process) process-focusable))) - (when s4-1 - (when (and (!= *target* s4-1) - (!= sv-1300 s4-1) - (not (focus-test? (the-as process-focusable s4-1) disable dead inactive gun-no-target)) - (or (logtest? (process-mask crate enemy vehicle civilian) (-> s4-1 mask)) - (and (logtest? (process-mask guard) (-> s4-1 mask)) (-> *setting-control* user-current gun-target-guards?)) - ) - ) - (let ((s3-1 (new 'stack-no-clear 'collide-query))) - (vector+float*! (-> s3-1 start-pos) (-> sv-144 fire-point) (-> sv-144 fire-dir-out) 40960.0) - (+! (-> s3-1 start-pos y) 24576.0) - (vector-! (-> s3-1 move-dist) (get-trans (the-as process-focusable s4-1) 3) (-> sv-144 fire-point)) - (let ((v1-32 s3-1)) - (set! (-> v1-32 radius) 40.96) - (set! (-> v1-32 collide-with) (collide-spec backgnd)) - (set! (-> v1-32 ignore-process0) #f) - (set! (-> v1-32 ignore-process1) #f) - (set! (-> v1-32 ignore-pat) - (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) - ) - (set! (-> v1-32 action-mask) (collide-action solid)) - ) - (when (< (fill-and-probe-using-line-sphere *collide-cache* s3-1) 0.0) - (let ((s3-3 - (vector-! (new 'stack-no-clear 'vector) (get-trans (the-as process-focusable s4-1) 3) (-> self control trans)) + (let ((sv-144 (-> self gun)) + (sv-148 (new 'stack-no-clear 'projectile-init-by-other-params)) + ) + (draw-beam (-> *part-id-table* 364) (-> sv-144 fire-point) (-> sv-144 fire-dir-out) #f) + (let ((sv-1280 (new 'stack-no-clear 'vector)) + (sv-1284 (new 'stack-no-clear 'inline-array 'target-quality-info 384)) + (sv-1288 0) + (sv-1296 (the-as float 0.0)) + ) + (let ((a1-1 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-1 from) (process->ppointer self)) + (set! (-> a1-1 num-params) 0) + (set! (-> a1-1 message) 'get-vehicle) + (let ((sv-1300 (send-event-function *target* a1-1))) + (vector-copy! sv-1280 (-> sv-144 fire-point)) + (set! (-> sv-1280 w) 163840.0) + (let ((gp-0 (new 'stack-no-clear 'array 'collide-shape 384))) + (countdown (s5-0 (fill-actor-list-for-box *actor-hash* sv-1280 gp-0 384)) + (let ((v1-16 (as-type (-> gp-0 s5-0) collide-shape))) + (when v1-16 + (let ((s4-1 (as-type (-> v1-16 process) process-focusable))) + (when s4-1 + (when (and (!= *target* s4-1) + (!= sv-1300 s4-1) + (not (focus-test? (the-as process-focusable s4-1) disable dead inactive gun-no-target)) + (or (logtest? (process-mask crate enemy vehicle civilian) (-> s4-1 mask)) + (and (logtest? (process-mask guard) (-> s4-1 mask)) (-> *setting-control* user-current gun-target-guards?)) + ) + ) + (let ((s3-1 (new 'stack-no-clear 'collide-query))) + (vector+float*! (-> s3-1 start-pos) (-> sv-144 fire-point) (-> sv-144 fire-dir-out) 40960.0) + (+! (-> s3-1 start-pos y) 24576.0) + (vector-! (-> s3-1 move-dist) (get-trans (the-as process-focusable s4-1) 3) (-> sv-144 fire-point)) + (let ((v1-32 s3-1)) + (set! (-> v1-32 radius) 40.96) + (set! (-> v1-32 collide-with) (collide-spec backgnd)) + (set! (-> v1-32 ignore-process0) #f) + (set! (-> v1-32 ignore-process1) #f) + (set! (-> v1-32 ignore-pat) + (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) + ) + (set! (-> v1-32 action-mask) (collide-action solid)) + ) + (when (< (fill-and-probe-using-line-sphere *collide-cache* s3-1) 0.0) + (let ((s3-3 + (vector-! (new 'stack-no-clear 'vector) (get-trans (the-as process-focusable s4-1) 3) (-> self control trans)) + ) + ) + (vector-normalize! s3-3 1.0) + (when (< (-> s3-3 y) 0.5) + (set! (-> sv-1284 sv-1288 targ) (process->handle s4-1)) + (let ((f30-0 1.0)) + (if (and (nonzero? (-> s4-1 draw)) (logtest? (-> s4-1 draw status) (draw-control-status on-screen))) + (set! f30-0 (+ 2.0 f30-0)) + ) + (if (< (vector-vector-xz-distance-squared (-> sv-144 fire-point) (get-trans (the-as process-focusable s4-1) 3)) + 2415919000.0 + ) + (set! f30-0 (+ 4.0 f30-0)) + ) + (if (logtest? (process-mask enemy guard) (-> s4-1 mask)) + (set! f30-0 (+ 28.0 f30-0)) + ) + (if (logtest? (process-mask vehicle civilian) (-> s4-1 mask)) + (set! f30-0 (/ f30-0 4)) + ) + (set! (-> sv-1284 sv-1288 value) f30-0) + (+! sv-1296 f30-0) + ) + (+! sv-1288 1) + ) + ) ) ) - (vector-normalize! s3-3 1.0) - (when (< (-> s3-3 y) 0.5) - (set! (-> sv-1284 sv-1288 targ) (process->handle s4-1)) - (let ((f30-0 1.0)) - (if (and (nonzero? (-> s4-1 draw)) (logtest? (-> s4-1 draw status) (draw-control-status on-screen))) - (set! f30-0 (+ 2.0 f30-0)) - ) - (if (< (vector-vector-xz-distance-squared (-> sv-144 fire-point) (get-trans (the-as process-focusable s4-1) 3)) - 2415919000.0 - ) - (set! f30-0 (+ 4.0 f30-0)) - ) - (if (logtest? (process-mask enemy guard) (-> s4-1 mask)) - (set! f30-0 (+ 28.0 f30-0)) - ) - (if (logtest? (process-mask vehicle civilian) (-> s4-1 mask)) - (set! f30-0 (/ f30-0 4)) - ) - (set! (-> sv-1284 sv-1288 value) f30-0) - (set! sv-1296 (+ sv-1296 f30-0)) + ) + ) + ) + ) + ) + ) + ) + (let ((gp-1 (the-as target (as-type *target* process-focusable)))) + (when (and gp-1 (< (vector-vector-distance (get-trans gp-1 0) sv-1280) (-> sv-1280 w))) + (when (and (!= *target* gp-1) + (!= sv-1300 gp-1) + (not (focus-test? gp-1 disable dead inactive gun-no-target)) + (or (logtest? (process-mask crate enemy vehicle civilian) (-> gp-1 mask)) + (and (logtest? (process-mask guard) (-> gp-1 mask)) (-> *setting-control* user-current gun-target-guards?)) + ) + ) + (let ((s5-3 (new 'stack-no-clear 'collide-query))) + (vector+float*! (-> s5-3 start-pos) (-> sv-144 fire-point) (-> sv-144 fire-dir-out) 40960.0) + (+! (-> s5-3 start-pos y) 24576.0) + (vector-! (-> s5-3 move-dist) (get-trans gp-1 3) (-> sv-144 fire-point)) + (let ((v1-91 s5-3)) + (set! (-> v1-91 radius) 40.96) + (set! (-> v1-91 collide-with) (collide-spec backgnd)) + (set! (-> v1-91 ignore-process0) #f) + (set! (-> v1-91 ignore-process1) #f) + (set! (-> v1-91 ignore-pat) + (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) ) - (set! sv-1288 (+ sv-1288 1)) + (set! (-> v1-91 action-mask) (collide-action solid)) + ) + (when (< (fill-and-probe-using-line-sphere *collide-cache* s5-3) 0.0) + (let ((s5-5 (vector-! (new 'stack-no-clear 'vector) (get-trans gp-1 3) (-> self control trans)))) + (vector-normalize! s5-5 1.0) + (when (< (-> s5-5 y) 0.5) + (set! (-> sv-1284 sv-1288 targ) (process->handle gp-1)) + (let ((f30-1 1.0)) + (if (and (nonzero? (-> gp-1 draw)) (logtest? (-> gp-1 draw status) (draw-control-status on-screen))) + (set! f30-1 (+ 2.0 f30-1)) + ) + (if (< (vector-vector-xz-distance-squared (-> sv-144 fire-point) (get-trans gp-1 3)) 2415919000.0) + (set! f30-1 (+ 4.0 f30-1)) + ) + (if (logtest? (process-mask enemy guard) (-> gp-1 mask)) + (set! f30-1 (+ 28.0 f30-1)) + ) + (if (logtest? (process-mask vehicle civilian) (-> gp-1 mask)) + (set! f30-1 (/ f30-1 4)) + ) + (set! (-> sv-1284 sv-1288 value) f30-1) + (+! sv-1296 f30-1) + ) + (+! sv-1288 1) ) ) ) @@ -615,161 +665,109 @@ ) ) ) - ) - ) - (let ((gp-1 (the-as target (as-type *target* process-focusable)))) - (when (and gp-1 (< (vector-vector-distance (get-trans gp-1 0) sv-1280) (-> sv-1280 w))) - (when (and (!= *target* gp-1) - (!= sv-1300 gp-1) - (not (focus-test? gp-1 disable dead inactive gun-no-target)) - (or (logtest? (process-mask crate enemy vehicle civilian) (-> gp-1 mask)) - (and (logtest? (process-mask guard) (-> gp-1 mask)) (-> *setting-control* user-current gun-target-guards?)) + (let* ((v1-132 (/ (the-as int (rand-uint31-gen *random-generator*)) 256)) + (v1-133 (the-as number (logior #x3f800000 v1-132))) + (f0-32 (* (+ -1.0 (the-as float v1-133)) sv-1296)) + (s5-7 (the-as process #f)) + ) + (let ((f1-11 0.0) + (gp-2 (new 'stack-no-clear 'vector)) + ) + (dotimes (v1-136 sv-1288) + (+! f1-11 (-> sv-1284 v1-136 value)) + (when (< f0-32 f1-11) + (set! s5-7 (handle->process (-> sv-1284 v1-136 targ))) + 0 + (goto cfg-91) + ) + ) + (label cfg-91) + (let ((s4-5 (new 'stack-no-clear 'vector))) + (let ((s3-5 s4-5)) + (let* ((f30-2 -1.0) + (f28-0 2.0) + (v1-148 (/ (the-as int (rand-uint31-gen *random-generator*)) 256)) + (v1-149 (the-as number (logior #x3f800000 v1-148))) ) - ) - (let ((s5-3 (new 'stack-no-clear 'collide-query))) - (vector+float*! (-> s5-3 start-pos) (-> sv-144 fire-point) (-> sv-144 fire-dir-out) 40960.0) - (+! (-> s5-3 start-pos y) 24576.0) - (vector-! (-> s5-3 move-dist) (get-trans gp-1 3) (-> sv-144 fire-point)) - (let ((v1-91 s5-3)) - (set! (-> v1-91 radius) 40.96) - (set! (-> v1-91 collide-with) (collide-spec backgnd)) - (set! (-> v1-91 ignore-process0) #f) - (set! (-> v1-91 ignore-process1) #f) - (set! (-> v1-91 ignore-pat) - (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) - ) - (set! (-> v1-91 action-mask) (collide-action solid)) - ) - (when (< (fill-and-probe-using-line-sphere *collide-cache* s5-3) 0.0) - (let ((s5-5 (vector-! (new 'stack-no-clear 'vector) (get-trans gp-1 3) (-> self control trans)))) - (vector-normalize! s5-5 1.0) - (when (< (-> s5-5 y) 0.5) - (set! (-> sv-1284 sv-1288 targ) (process->handle gp-1)) - (let ((f30-1 1.0)) - (if (and (nonzero? (-> gp-1 draw)) (logtest? (-> gp-1 draw status) (draw-control-status on-screen))) - (set! f30-1 (+ 2.0 f30-1)) - ) - (if (< (vector-vector-xz-distance-squared (-> sv-144 fire-point) (get-trans gp-1 3)) 2415919000.0) - (set! f30-1 (+ 4.0 f30-1)) - ) - (if (logtest? (process-mask enemy guard) (-> gp-1 mask)) - (set! f30-1 (+ 28.0 f30-1)) - ) - (if (logtest? (process-mask vehicle civilian) (-> gp-1 mask)) - (set! f30-1 (/ f30-1 4)) - ) - (set! (-> sv-1284 sv-1288 value) f30-1) - (set! sv-1296 (+ sv-1296 f30-1)) - ) - (set! sv-1288 (+ sv-1288 1)) + (set! (-> s3-5 x) (+ f30-2 (* f28-0 (+ -1.0 (the-as float v1-149))))) ) + (let* ((f30-3 -0.2) + (f28-1 0.7) + (v1-154 (/ (the-as int (rand-uint31-gen *random-generator*)) 256)) + (v1-155 (the-as number (logior #x3f800000 v1-154))) + ) + (set! (-> s3-5 y) (+ f30-3 (* f28-1 (+ -1.0 (the-as float v1-155))))) + ) + (let* ((f30-4 -1.0) + (f28-2 2.0) + (v1-160 (/ (the-as int (rand-uint31-gen *random-generator*)) 256)) + (v1-161 (the-as number (logior #x3f800000 v1-160))) + ) + (set! (-> s3-5 z) (+ f30-4 (* f28-2 (+ -1.0 (the-as float v1-161))))) + ) + (set! (-> s3-5 w) 1.0) + ) + (vector-normalize! s4-5 163840.0) + (vector+! gp-2 (-> sv-144 fire-point) s4-5) + ) + (let ((s4-6 (new 'stack-no-clear 'vector))) + (vector-copy! s4-6 gp-2) + (if s5-7 + (vector-copy! s4-6 (get-trans (the-as process-focusable (as-type s5-7 process-focusable)) 3)) + ) + (let ((s3-7 (vector-rotate-y! (new 'stack-no-clear 'vector) (-> sv-144 fire-dir-out) 2730.6667)) + (v1-174 (vector-rotate-y! (new 'stack-no-clear 'vector) (-> sv-144 fire-dir-out) -2730.6667)) + (a0-114 (vector-! (new 'stack-no-clear 'vector) s4-6 (-> sv-144 fire-point))) + (s4-7 (new 'stack-no-clear 'vector)) + ) + (if (< (vector-dot s3-7 a0-114) (vector-dot v1-174 a0-114)) + (vector-copy! s4-7 s3-7) + (vector-copy! s4-7 v1-174) + ) + (vector-normalize! a0-114 1.0) + (let* ((s3-8 vector-rotate-y!) + (s2-4 s4-7) + (s1-0 s4-7) + (f30-5 -2730.6667) + (f28-3 5461.3335) + (v1-180 (/ (the-as int (rand-uint31-gen *random-generator*)) 256)) + (v1-181 (the-as number (logior #x3f800000 v1-180))) + ) + (s3-8 s2-4 s1-0 (+ f30-5 (* f28-3 (+ -1.0 (the-as float v1-181))))) + ) + (let* ((f30-6 -0.1) + (f28-4 0.5) + (v1-186 (/ (the-as int (rand-uint31-gen *random-generator*)) 256)) + (v1-187 (the-as number (logior #x3f800000 v1-186))) + ) + (set! (-> s4-7 y) (+ f30-6 (* f28-4 (+ -1.0 (the-as float v1-187))) (-> s4-7 y))) + ) + (vector-normalize! s4-7 1.0) + (set! (-> sv-148 ent) (-> self entity)) + (set! (-> sv-148 charge) 1.0) + (set! (-> sv-148 options) (projectile-options)) + (logclear! (-> sv-148 options) (projectile-options po14 po15 po16)) + (vector-copy! (-> sv-148 pos) (-> sv-144 fire-point)) + (set! (-> sv-148 notify-handle) (the-as handle #f)) + (set! (-> sv-148 owner-handle) (the-as handle #f)) + (set! (-> sv-148 target-handle) (process->handle s5-7)) + (vector-copy! (-> sv-148 target-pos) gp-2) + (set! (-> sv-148 ignore-handle) (process->handle (send-event self 'get-vehicle))) + (let* ((v1-209 *game-info*) + (a0-143 (+ (-> v1-209 attack-id) 1)) + ) + (set! (-> v1-209 attack-id) a0-143) + (set! (-> sv-148 attack-id) a0-143) + ) + (set! (-> sv-148 timeout) (seconds 4)) + (vector-float*! (-> sv-148 vel) s4-7 327680.0) ) ) ) ) ) + (spawn-projectile gun-blue-shot-3 sv-148 (ppointer->process (-> sv-144 gun)) *default-dead-pool*) ) - (let* ((v1-132 (/ (the-as int (rand-uint31-gen *random-generator*)) 256)) - (v1-133 (the-as number (logior #x3f800000 v1-132))) - (f0-32 (* (+ -1.0 (the-as float v1-133)) sv-1296)) - (s5-7 (the-as process #f)) - ) - (let ((f1-11 0.0) - (gp-2 (new 'stack-no-clear 'vector)) - ) - (dotimes (v1-136 sv-1288) - (+! f1-11 (-> sv-1284 v1-136 value)) - (when (< f0-32 f1-11) - (set! s5-7 (handle->process (-> sv-1284 v1-136 targ))) - 0 - (goto cfg-91) - ) - ) - (label cfg-91) - (let ((s4-5 (new 'stack-no-clear 'vector))) - (let ((s3-5 s4-5)) - (let* ((f30-2 -1.0) - (f28-0 2.0) - (v1-148 (/ (the-as int (rand-uint31-gen *random-generator*)) 256)) - (v1-149 (the-as number (logior #x3f800000 v1-148))) - ) - (set! (-> s3-5 x) (+ f30-2 (* f28-0 (+ -1.0 (the-as float v1-149))))) - ) - (let* ((f30-3 -0.2) - (f28-1 0.7) - (v1-154 (/ (the-as int (rand-uint31-gen *random-generator*)) 256)) - (v1-155 (the-as number (logior #x3f800000 v1-154))) - ) - (set! (-> s3-5 y) (+ f30-3 (* f28-1 (+ -1.0 (the-as float v1-155))))) - ) - (let* ((f30-4 -1.0) - (f28-2 2.0) - (v1-160 (/ (the-as int (rand-uint31-gen *random-generator*)) 256)) - (v1-161 (the-as number (logior #x3f800000 v1-160))) - ) - (set! (-> s3-5 z) (+ f30-4 (* f28-2 (+ -1.0 (the-as float v1-161))))) - ) - (set! (-> s3-5 w) 1.0) - ) - (vector-normalize! s4-5 163840.0) - (vector+! gp-2 (-> sv-144 fire-point) s4-5) - ) - (let ((s4-6 (new 'stack-no-clear 'vector))) - (vector-copy! s4-6 gp-2) - (if s5-7 - (vector-copy! s4-6 (get-trans (the-as process-focusable (as-type s5-7 process-focusable)) 3)) - ) - (let ((s3-7 (vector-rotate-y! (new 'stack-no-clear 'vector) (-> sv-144 fire-dir-out) 2730.6667)) - (v1-174 (vector-rotate-y! (new 'stack-no-clear 'vector) (-> sv-144 fire-dir-out) -2730.6667)) - (a0-114 (vector-! (new 'stack-no-clear 'vector) s4-6 (-> sv-144 fire-point))) - (s4-7 (new 'stack-no-clear 'vector)) - ) - (if (< (vector-dot s3-7 a0-114) (vector-dot v1-174 a0-114)) - (vector-copy! s4-7 s3-7) - (vector-copy! s4-7 v1-174) - ) - (vector-normalize! a0-114 1.0) - (let* ((s3-8 vector-rotate-y!) - (s2-4 s4-7) - (s1-0 s4-7) - (f30-5 -2730.6667) - (f28-3 5461.3335) - (v1-180 (/ (the-as int (rand-uint31-gen *random-generator*)) 256)) - (v1-181 (the-as number (logior #x3f800000 v1-180))) - ) - (s3-8 s2-4 s1-0 (+ f30-5 (* f28-3 (+ -1.0 (the-as float v1-181))))) - ) - (let* ((f30-6 -0.1) - (f28-4 0.5) - (v1-186 (/ (the-as int (rand-uint31-gen *random-generator*)) 256)) - (v1-187 (the-as number (logior #x3f800000 v1-186))) - ) - (set! (-> s4-7 y) (+ f30-6 (* f28-4 (+ -1.0 (the-as float v1-187))) (-> s4-7 y))) - ) - (vector-normalize! s4-7 1.0) - (set! (-> sv-148 ent) (-> self entity)) - (set! (-> sv-148 charge) 1.0) - (set! (-> sv-148 options) (projectile-options)) - (logclear! (-> sv-148 options) (projectile-options po14 po15 po16)) - (vector-copy! (-> sv-148 pos) (-> sv-144 fire-point)) - (set! (-> sv-148 notify-handle) (the-as handle #f)) - (set! (-> sv-148 owner-handle) (the-as handle #f)) - (set! (-> sv-148 target-handle) (process->handle s5-7)) - (vector-copy! (-> sv-148 target-pos) gp-2) - (set! (-> sv-148 ignore-handle) (process->handle (send-event self 'get-vehicle))) - (let* ((v1-209 *game-info*) - (a0-143 (+ (-> v1-209 attack-id) 1)) - ) - (set! (-> v1-209 attack-id) a0-143) - (set! (-> sv-148 attack-id) a0-143) - ) - (set! (-> sv-148 timeout) (seconds 4)) - (vector-float*! (-> sv-148 vel) s4-7 327680.0) - ) - ) - ) - ) - (spawn-projectile gun-blue-shot-3 sv-148 (ppointer->process (-> sv-144 gun)) *default-dead-pool*) ) ;; definition for function draw-beam-segment @@ -1051,7 +1049,6 @@ ;; definition for method 9 of type rope-constraint ;; INFO: Used lq/sq (defmethod rope-constraint-method-9 ((this rope-constraint) (arg0 int)) - (local-vars (sv-64 vector) (sv-80 vector) (sv-96 vector)) (rlet ((acc :class vf) (vf0 :class vf) (vf1 :class vf) @@ -1067,11 +1064,11 @@ ) (while (>= (the-as int s3-0) s4-0) (dotimes (s2-0 1) - (set! sv-64 (the-as vector (+ (the-as uint (-> this constraints 0 dir)) (* 48 s4-0)))) - (let ((s1-0 (-> this constraints s4-0)) + (let ((sv-64 (the-as vector (+ (the-as uint (-> this constraints 0 dir)) (* 48 s4-0)))) + (s1-0 (-> this constraints s4-0)) (s0-0 (-> this constraints (+ s4-0 1))) + (sv-96 (new 'stack-no-clear 'vector)) ) - (set! sv-96 (new 'stack-no-clear 'vector)) (let ((v1-6 s0-0) (a0-7 s1-0) ) @@ -1086,29 +1083,29 @@ (vector-normalize! sv-64 1.0) (let ((f0-2 (vector-dot sv-96 sv-64))) (when (< f0-2 0.9999) - (set! sv-80 (new 'stack-no-clear 'vector)) - 0.0 - (let* ((f28-0 (acos f0-2)) - (f0-4 (/ f28-0 (meters 8))) - ) + (let ((sv-80 (new 'stack-no-clear 'vector))) 0.0 - 0.0 - (- 32768.0 f28-0) - (let* ((f0-6 (fmax 0.0 (fmin 1.0 f0-4))) - (f0-7 (* f0-6 f0-6)) - (f28-1 - (fmin (fmin f28-0 (* (lerp 5461.3335 2184533.2 f0-7) (seconds-per-frame))) (* 131072.0 (seconds-per-frame))) - ) + (let* ((f28-0 (acos f0-2)) + (f0-4 (/ f28-0 (meters 8))) ) - (let ((v1-20 sv-80)) - (.lvf vf1 (&-> sv-96 quad)) - (.lvf vf2 (&-> sv-64 quad)) - (.outer.product.a.vf acc vf1 vf2) - (.outer.product.b.vf vf3 vf2 vf1 acc) - (.svf (&-> v1-20 quad) vf3) + 0.0 + 0.0 + (- 32768.0 f28-0) + (let* ((f0-7 (square (fmax 0.0 (fmin 1.0 f0-4)))) + (f28-1 + (fmin (fmin f28-0 (* (lerp 5461.3335 2184533.2 f0-7) (seconds-per-frame))) (* 131072.0 (seconds-per-frame))) + ) + ) + (let ((v1-20 sv-80)) + (.lvf vf1 (&-> sv-96 quad)) + (.lvf vf2 (&-> sv-64 quad)) + (.outer.product.a.vf acc vf1 vf2) + (.outer.product.b.vf vf3 vf2 vf1 acc) + (.svf (&-> v1-20 quad) vf3) + ) + (vector-normalize! sv-80 1.0) + (vector-rotate-around-axis! sv-96 sv-96 f28-1 sv-80) ) - (vector-normalize! sv-80 1.0) - (vector-rotate-around-axis! sv-96 sv-96 f28-1 sv-80) ) ) (vector-normalize! sv-96 1.0) @@ -1990,80 +1987,28 @@ ;; definition for function find-gun-blue-2-target ;; INFO: Used lq/sq (defun find-gun-blue-2-target ((arg0 vector) (arg1 int)) - (local-vars (sv-32 process-drawable) (sv-36 number) (sv-40 vector)) - (set! sv-32 (the-as process-drawable #f)) - (set! sv-36 4096000.0) - (let ((v1-1 (new 'stack-no-clear 'vector))) - (vector-copy! v1-1 arg0) - (set! sv-40 v1-1) - ) - (set! (-> sv-40 w) 0.0) - (let ((s4-0 (new 'stack-no-clear 'array 'collide-shape 384))) - (countdown (s3-0 (fill-actor-list-for-box *actor-hash* arg0 s4-0 384)) - (let ((a0-5 (as-type (-> s4-0 s3-0) collide-shape))) - (when a0-5 - (let ((s2-1 (as-type (-> a0-5 process) process-focusable))) - (when s2-1 - (when (is-valid-blue-2-target (the-as process-focusable s2-1) arg1) - (let* ((s1-2 (vector-! (new 'stack-no-clear 'vector) (get-trans (the-as process-focusable s2-1) 3) sv-40)) - (f0-2 (vector-normalize-ret-len! s1-2 1.0)) - ) - (when (< f0-2 (the-as float sv-36)) - (set! sv-32 s2-1) - (set! sv-36 f0-2) - ) - ) - ) - ) - ) + (let ((sv-32 (the-as process-drawable #f))) + (let ((sv-36 4096000.0) + (v1-1 (new 'stack-no-clear 'vector)) ) - ) - ) - ) - (let ((s4-1 (the-as target (as-type *target* process-focusable)))) - (when (and s4-1 (< (vector-vector-distance (get-trans s4-1 0) arg0) (-> arg0 w))) - (when (is-valid-blue-2-target s4-1 arg1) - (let* ((gp-2 (vector-! (new 'stack-no-clear 'vector) (get-trans s4-1 3) sv-40)) - (f0-4 (vector-normalize-ret-len! gp-2 1.0)) - ) - (when (< f0-4 (the-as float sv-36)) - (set! sv-32 s4-1) - (set! sv-36 f0-4) - ) - ) - ) - ) - ) - sv-32 - ) - -;; definition for function find-gun-blue-2-target-old -;; INFO: Used lq/sq -(defun find-gun-blue-2-target-old ((arg0 vector) (arg1 int) (arg2 vector)) - (local-vars (sv-32 process-drawable) (sv-36 number) (sv-40 vector)) - (set! sv-32 (the-as process-drawable #f)) - (set! sv-36 16384.0) - (let ((v1-1 (new 'stack-no-clear 'vector))) - (vector-copy! v1-1 arg0) - (set! sv-40 v1-1) - ) - (set! (-> arg0 w) 16384.0) - (set! (-> sv-40 w) 1.0) - (let ((s3-0 (new 'stack-no-clear 'array 'collide-shape 384))) - (countdown (s2-0 (fill-actor-list-for-box *actor-hash* arg0 s3-0 384)) - (let ((a0-5 (as-type (-> s3-0 s2-0) collide-shape))) - (when a0-5 - (let ((s1-1 (as-type (-> a0-5 process) process-focusable))) - (when s1-1 - (when (is-valid-blue-2-target (the-as process-focusable s1-1) arg1) - (let* ((s0-2 (vector-! (new 'stack-no-clear 'vector) (get-trans (the-as process-focusable s1-1) 3) sv-40)) - (f0-3 (vector-normalize-ret-len! s0-2 1.0)) - (f1-1 (vector-dot s0-2 arg2)) - ) - (when (< f0-3 (the-as float sv-36)) - (when (< 0.6 f1-1) - (set! sv-32 s1-1) - (set! sv-36 f0-3) + (vector-copy! v1-1 arg0) + (let ((sv-40 v1-1)) + (set! (-> sv-40 w) 0.0) + (let ((s4-0 (new 'stack-no-clear 'array 'collide-shape 384))) + (countdown (s3-0 (fill-actor-list-for-box *actor-hash* arg0 s4-0 384)) + (let ((a0-5 (as-type (-> s4-0 s3-0) collide-shape))) + (when a0-5 + (let ((s2-1 (as-type (-> a0-5 process) process-focusable))) + (when s2-1 + (when (is-valid-blue-2-target (the-as process-focusable s2-1) arg1) + (let* ((s1-2 (vector-! (new 'stack-no-clear 'vector) (get-trans (the-as process-focusable s2-1) 3) sv-40)) + (f0-2 (vector-normalize-ret-len! s1-2 1.0)) + ) + (when (< f0-2 (the-as float sv-36)) + (set! sv-32 s2-1) + (set! sv-36 f0-2) + ) + ) ) ) ) @@ -2071,27 +2016,83 @@ ) ) ) - ) - ) - ) - (let ((s3-1 (the-as target (as-type *target* process-focusable)))) - (when (and s3-1 (< (vector-vector-distance (get-trans s3-1 0) arg0) (-> arg0 w))) - (when (is-valid-blue-2-target s3-1 arg1) - (let* ((s5-2 (vector-! (new 'stack-no-clear 'vector) (get-trans s3-1 3) sv-40)) - (f0-5 (vector-normalize-ret-len! s5-2 1.0)) - (f1-4 (vector-dot s5-2 arg2)) - ) - (when (< f0-5 (the-as float sv-36)) - (when (< 0.6 f1-4) - (set! sv-32 s3-1) - (set! sv-36 f0-5) + (let ((s4-1 (the-as target (as-type *target* process-focusable)))) + (when (and s4-1 (< (vector-vector-distance (get-trans s4-1 0) arg0) (-> arg0 w))) + (when (is-valid-blue-2-target s4-1 arg1) + (let* ((gp-2 (vector-! (new 'stack-no-clear 'vector) (get-trans s4-1 3) sv-40)) + (f0-4 (vector-normalize-ret-len! gp-2 1.0)) + ) + (when (< f0-4 (the-as float sv-36)) + (set! sv-32 s4-1) + (set! sv-36 f0-4) + ) + ) ) ) ) ) ) + sv-32 + ) + ) + +;; definition for function find-gun-blue-2-target-old +;; INFO: Used lq/sq +(defun find-gun-blue-2-target-old ((arg0 vector) (arg1 int) (arg2 vector)) + (let ((sv-32 (the-as process-drawable #f))) + (let ((sv-36 16384.0) + (v1-1 (new 'stack-no-clear 'vector)) + ) + (vector-copy! v1-1 arg0) + (let ((sv-40 v1-1)) + (set! (-> arg0 w) 16384.0) + (set! (-> sv-40 w) 1.0) + (let ((s3-0 (new 'stack-no-clear 'array 'collide-shape 384))) + (countdown (s2-0 (fill-actor-list-for-box *actor-hash* arg0 s3-0 384)) + (let ((a0-5 (as-type (-> s3-0 s2-0) collide-shape))) + (when a0-5 + (let ((s1-1 (as-type (-> a0-5 process) process-focusable))) + (when s1-1 + (when (is-valid-blue-2-target (the-as process-focusable s1-1) arg1) + (let* ((s0-2 (vector-! (new 'stack-no-clear 'vector) (get-trans (the-as process-focusable s1-1) 3) sv-40)) + (f0-3 (vector-normalize-ret-len! s0-2 1.0)) + (f1-1 (vector-dot s0-2 arg2)) + ) + (when (< f0-3 (the-as float sv-36)) + (when (< 0.6 f1-1) + (set! sv-32 s1-1) + (set! sv-36 f0-3) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + (let ((s3-1 (the-as target (as-type *target* process-focusable)))) + (when (and s3-1 (< (vector-vector-distance (get-trans s3-1 0) arg0) (-> arg0 w))) + (when (is-valid-blue-2-target s3-1 arg1) + (let* ((s5-2 (vector-! (new 'stack-no-clear 'vector) (get-trans s3-1 3) sv-40)) + (f0-5 (vector-normalize-ret-len! s5-2 1.0)) + (f1-4 (vector-dot s5-2 arg2)) + ) + (when (< f0-5 (the-as float sv-36)) + (when (< 0.6 f1-4) + (set! sv-32 s3-1) + (set! sv-36 f0-5) + ) + ) + ) + ) + ) + ) + ) + ) + sv-32 ) - sv-32 ) ;; definition for symbol *lightning-pts-cache*, type (inline-array vector) @@ -2171,17 +2172,6 @@ ;; definition for method 25 of type gun-blue-2-lightning-tracker ;; INFO: Used lq/sq (defmethod gun-blue-2-lightning-tracker-method-25 ((this gun-blue-2-lightning-tracker)) - (local-vars - (sv-624 gun-info) - (sv-628 vector) - (sv-632 gun-blue-lightning-command) - (sv-640 int) - (sv-648 int) - (sv-656 (pointer int32)) - (sv-1440 symbol) - (sv-1456 collide-query) - (sv-1472 collide-query) - ) (let ((s5-1 (vector-! (new 'stack-no-clear 'vector) (target-pos 0) (-> this prev-targ-pos)))) (set! (-> s5-1 y) 0.0) (dotimes (v1-1 12) @@ -2193,169 +2183,176 @@ ) ) (vector-copy! (-> this prev-targ-pos) (target-pos 0)) - (set! sv-624 (-> *target* gun)) - (set! sv-628 (-> *target* gun laser-dir)) - (set! sv-632 (new 'stack-no-clear 'gun-blue-lightning-command)) - (set! sv-640 0) - (set! sv-648 -1) - (set! sv-656 (new 'static 'array int32 12 0 0 0 0 0 0 0 0 0 0 0 0)) - (vector-normalize! sv-628 1.0) - (set! (-> *blue-2-lightning-shape* constraints 0 pt quad) (-> sv-624 fire-point quad)) - (vector-copy! (-> *blue-2-lightning-shape* constraints 0 dir) sv-628) - (rope-constraint-method-9 *blue-2-lightning-shape* 0) - (if (zero? (-> this last-probe-index)) - (+! (-> this last-probe-index) 1) - ) - (dotimes (v1-22 12) - (vector-copy! (-> *lightning-pts-cache* v1-22) (-> *blue-2-lightning-shape* constraints v1-22 pt)) - ) - (if (not (gun-blue-2-lightning-tracker-method-26 this sv-628 (-> sv-624 fire-point) sv-632)) - (return 0) - ) - (set! (-> sv-632 msg) (gun-blue-lightning-cmd-msg active)) - (set! (-> sv-632 lightning-info num-pts) 1) - (set! (-> sv-632 lightning-info should-draw-terminal-sparks?) #f) - (set! (-> sv-632 lightning-info should-draw-extension?) #f) - (let ((s5-3 1) - (s4-0 (+ (-> *blue-2-lightning-shape* num-knots) -1)) + (let ((sv-624 (-> *target* gun)) + (sv-628 (-> *target* gun laser-dir)) + (sv-632 (new 'stack-no-clear 'gun-blue-lightning-command)) ) - (while (>= (the-as int s4-0) s5-3) - (let ((s3-0 (new 'stack-no-clear 'vector))) - (vector-copy! s3-0 (-> *lightning-pts-cache* s5-3)) - (let ((s2-0 (the-as process-drawable #f))) - (let ((a0-19 (new 'stack-no-clear 'vector))) - (new 'stack-no-clear 'vector) - (vector-copy! a0-19 s3-0) - (set! (-> a0-19 w) 12288.0) - (if (not (the-as symbol s2-0)) - (set! s2-0 (find-gun-blue-2-target-old - a0-19 - sv-640 - (the-as vector (+ (the-as uint (-> *blue-2-lightning-shape* constraints 0 dir)) (* 48 s5-3))) - ) + (let ((sv-640 0) + (sv-648 -1) + (sv-656 (new 'static 'array int32 12 0 0 0 0 0 0 0 0 0 0 0 0)) + ) + (vector-normalize! sv-628 1.0) + (set! (-> *blue-2-lightning-shape* constraints 0 pt quad) (-> sv-624 fire-point quad)) + (vector-copy! (-> *blue-2-lightning-shape* constraints 0 dir) sv-628) + (rope-constraint-method-9 *blue-2-lightning-shape* 0) + (if (zero? (-> this last-probe-index)) + (+! (-> this last-probe-index) 1) + ) + (dotimes (v1-22 12) + (vector-copy! (-> *lightning-pts-cache* v1-22) (-> *blue-2-lightning-shape* constraints v1-22 pt)) + ) + (if (not (gun-blue-2-lightning-tracker-method-26 this sv-628 (-> sv-624 fire-point) sv-632)) + (return 0) + ) + (set! (-> sv-632 msg) (gun-blue-lightning-cmd-msg active)) + (set! (-> sv-632 lightning-info num-pts) 1) + (set! (-> sv-632 lightning-info should-draw-terminal-sparks?) #f) + (set! (-> sv-632 lightning-info should-draw-extension?) #f) + (let ((s5-3 1) + (s4-0 (+ (-> *blue-2-lightning-shape* num-knots) -1)) + ) + (while (>= (the-as int s4-0) s5-3) + (let ((s3-0 (new 'stack-no-clear 'vector))) + (vector-copy! s3-0 (-> *lightning-pts-cache* s5-3)) + (let ((s2-0 (the-as process-drawable #f))) + (let ((a0-19 (new 'stack-no-clear 'vector))) + (new 'stack-no-clear 'vector) + (vector-copy! a0-19 s3-0) + (set! (-> a0-19 w) 12288.0) + (if (not (the-as symbol s2-0)) + (set! s2-0 (find-gun-blue-2-target-old + a0-19 + sv-640 + (the-as vector (+ (the-as uint (-> *blue-2-lightning-shape* constraints 0 dir)) (* 48 s5-3))) + ) + ) + ) + ) + (cond + (s2-0 + (set! (-> *found-objects* sv-640) (process->handle s2-0)) + (set! (-> *gun-blue-2-targets* s5-3 target) (process->handle s2-0)) + (set! (-> sv-656 s5-3) 1) + (+! sv-640 1) + (set! sv-648 s5-3) + (vector-copy! s3-0 (get-trans (the-as process-focusable s2-0) 3)) + (vector-copy! (-> *lightning-pts-cache* s5-3) s3-0) + (vector-! + (the-as vector (+ (the-as uint (-> *blue-2-lightning-shape* constraints 0 dir)) (* 48 s5-3))) + (-> *lightning-pts-cache* s5-3) + (-> *blue-2-lightning-shape* constraints (+ s5-3 -1) pt) + ) + (vector-normalize! + (the-as vector (+ (the-as uint (-> *blue-2-lightning-shape* constraints 0 dir)) (* 48 s5-3))) + 1.0 + ) + (dotimes (v1-65 1) + ) + ) + (else + (set! (-> sv-656 s5-3) 0) + 0 + ) + ) + (let ((s0-0 s3-0) + (s1-1 (new 'stack-no-clear 'vector)) + ) + (vector-copy! s1-1 (-> *lightning-pts-cache* (+ s5-3 -1))) + (let ((sv-1440 (the-as symbol #f))) + (let ((sv-1456 (new 'stack-no-clear 'collide-query))) + (vector-copy! (-> sv-1456 start-pos) s1-1) + (vector-! (-> sv-1456 move-dist) s0-0 s1-1) + (let ((sv-1472 sv-1456)) + (set! (-> sv-1472 radius) 860.16) + (set! (-> sv-1472 collide-with) + (collide-spec backgnd obstacle vehicle-sphere hit-by-others-list pusher impenetrable-obj) + ) + (set! (-> sv-1472 ignore-process0) (the-as process-tree (send-event *target* 'get-vehicle))) + (set! (-> sv-1472 ignore-process1) #f) + (set! (-> sv-1472 ignore-pat) + (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) + ) + (set! (-> sv-1472 action-mask) (collide-action solid)) ) - ) - ) - (cond - (s2-0 - (set! (-> *found-objects* sv-640) (process->handle s2-0)) - (set! (-> *gun-blue-2-targets* s5-3 target) (process->handle s2-0)) - (set! (-> sv-656 s5-3) 1) - (set! sv-640 (+ sv-640 1)) - (set! sv-648 s5-3) - (vector-copy! s3-0 (get-trans (the-as process-focusable s2-0) 3)) - (vector-copy! (-> *lightning-pts-cache* s5-3) s3-0) - (vector-! - (the-as vector (+ (the-as uint (-> *blue-2-lightning-shape* constraints 0 dir)) (* 48 s5-3))) - (-> *lightning-pts-cache* s5-3) - (-> *blue-2-lightning-shape* constraints (+ s5-3 -1) pt) - ) - (vector-normalize! - (the-as vector (+ (the-as uint (-> *blue-2-lightning-shape* constraints 0 dir)) (* 48 s5-3))) - 1.0 - ) - (dotimes (v1-65 1) - ) - ) - (else - (set! (-> sv-656 s5-3) 0) - 0 - ) - ) - (let ((s0-0 s3-0) - (s1-1 (new 'stack-no-clear 'vector)) - ) - (vector-copy! s1-1 (-> *lightning-pts-cache* (+ s5-3 -1))) - (set! sv-1440 (the-as symbol #f)) - (set! sv-1456 (new 'stack-no-clear 'collide-query)) - (vector-copy! (-> sv-1456 start-pos) s1-1) - (vector-! (-> sv-1456 move-dist) s0-0 s1-1) - (set! sv-1472 sv-1456) - (set! (-> sv-1472 radius) 860.16) - (set! (-> sv-1472 collide-with) - (collide-spec backgnd obstacle vehicle-sphere hit-by-others-list pusher impenetrable-obj) - ) - (set! (-> sv-1472 ignore-process0) (the-as process-tree (send-event *target* 'get-vehicle))) - (set! (-> sv-1472 ignore-process1) #f) - (set! (-> sv-1472 ignore-pat) - (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) - ) - (set! (-> sv-1472 action-mask) (collide-action solid)) - (let ((f0-3 (fill-and-probe-using-line-sphere *collide-cache* sv-1456))) - (when (>= f0-3 0.0) - (vector-float*! (-> sv-1456 move-dist) (-> sv-1456 move-dist) f0-3) - (vector+! s0-0 s1-1 (-> sv-1456 move-dist)) - (set! sv-1440 #t) - (set! (-> this last-probe-index) s5-3) - (cond - ((> s5-3 0) - (let ((v0-11 (vector-normalize-copy! (new 'stack-no-clear 'vector) (-> sv-1456 move-dist) 1.0))) - (vector+float*! (-> sv-632 lightning-info terminal-spark-pos) s0-0 v0-11 -6144.0) - ) - ) - (else - (vector-copy! (-> sv-632 lightning-info terminal-spark-pos) s0-0) + (let ((f0-3 (fill-and-probe-using-line-sphere *collide-cache* sv-1456))) + (when (>= f0-3 0.0) + (vector-float*! (-> sv-1456 move-dist) (-> sv-1456 move-dist) f0-3) + (vector+! s0-0 s1-1 (-> sv-1456 move-dist)) + (set! sv-1440 #t) + (set! (-> this last-probe-index) s5-3) + (cond + ((> s5-3 0) + (let ((v0-11 (vector-normalize-copy! (new 'stack-no-clear 'vector) (-> sv-1456 move-dist) 1.0))) + (vector+float*! (-> sv-632 lightning-info terminal-spark-pos) s0-0 v0-11 -6144.0) + ) + ) + (else + (vector-copy! (-> sv-632 lightning-info terminal-spark-pos) s0-0) + ) + ) + ) + ) + ) + (when (not s2-0) + ) + (vector-copy! (-> *lightning-pts-cache* s5-3) s3-0) + (+! (-> sv-632 lightning-info num-pts) 1) + (let ((s3-1 fire-projectile-if-necessary) + (a2-13 (if (< 1 sv-640) + (the-as int (-> *found-objects* (+ sv-640 -2))) + (process->handle (send-event this 'get-vehicle)) + ) + ) + ) + (s3-1 s1-1 s0-0 (the-as handle a2-13)) + ) + (when sv-1440 + (set! (-> sv-632 lightning-info should-draw-terminal-sparks?) #t) + (set! (-> sv-632 lightning-info should-draw-extension?) #f) + 0 + (goto cfg-54) ) ) ) ) - (when (not s2-0) - ) - (vector-copy! (-> *lightning-pts-cache* s5-3) s3-0) - (+! (-> sv-632 lightning-info num-pts) 1) - (let ((s3-1 fire-projectile-if-necessary) - (a2-13 (if (< 1 sv-640) - (the-as int (-> *found-objects* (+ sv-640 -2))) - (process->handle (send-event this 'get-vehicle)) - ) - ) + ) + (+! s5-3 1) + ) + ) + (label cfg-54) + (if (and (= sv-648 (+ (-> sv-632 lightning-info num-pts) -2)) + (not (-> sv-632 lightning-info should-draw-extension?)) + ) + (set! (-> sv-632 lightning-info should-draw-terminal-sparks?) #f) + ) + (dotimes (s5-4 (-> sv-632 lightning-info num-pts)) + (vector-copy! (-> sv-632 lightning-info pts s5-4) (-> *lightning-pts-cache* s5-4)) + (when (and (> s5-4 0) (zero? (-> sv-656 s5-4))) + (let ((s4-1 + (matrix-f-u-compose + (new 'stack-no-clear 'matrix) + (the-as vector (+ (the-as uint (-> *blue-2-lightning-shape* constraints 0 dir)) (* 48 s5-4))) + *up-vector* + ) ) - (s3-1 s1-1 s0-0 (the-as handle a2-13)) - ) - ) - ) - ) - (when sv-1440 - (set! (-> sv-632 lightning-info should-draw-terminal-sparks?) #t) - (set! (-> sv-632 lightning-info should-draw-extension?) #f) - 0 - (goto cfg-54) - ) - (+! s5-3 1) - ) - ) - (label cfg-54) - (if (and (= sv-648 (+ (-> sv-632 lightning-info num-pts) -2)) - (not (-> sv-632 lightning-info should-draw-extension?)) - ) - (set! (-> sv-632 lightning-info should-draw-terminal-sparks?) #f) - ) - (dotimes (s5-4 (-> sv-632 lightning-info num-pts)) - (vector-copy! (-> sv-632 lightning-info pts s5-4) (-> *lightning-pts-cache* s5-4)) - (when (and (> s5-4 0) (zero? (-> sv-656 s5-4))) - (let ((s4-1 - (matrix-f-u-compose - (new 'stack-no-clear 'matrix) - (the-as vector (+ (the-as uint (-> *blue-2-lightning-shape* constraints 0 dir)) (* 48 s5-4))) - *up-vector* + (f0-9 (the float (sar (shl (the int (+ (-> this revolve-angle) (* 6144.0 (the float s5-4)))) 48) 48))) + (s3-2 (-> sv-632 lightning-info pts s5-4)) ) + (the float (sar (shl (the int (+ (-> this sway-angle) (* 5461.3335 (the float s5-4)))) 48) 48)) + (vector-rotate-around-axis! + (-> s4-1 uvec) + (-> s4-1 uvec) + f0-9 + (the-as vector (+ (the-as uint (-> *blue-2-lightning-shape* constraints 0 dir)) (* 48 s5-4))) ) - (f0-9 (the float (sar (shl (the int (+ (-> this revolve-angle) (* 6144.0 (the float s5-4)))) 48) 48))) - (s3-2 (-> sv-632 lightning-info pts s5-4)) + (vector-normalize! (-> s4-1 uvec) 1.0) + (vector+float*! s3-2 s3-2 (-> s4-1 uvec) 2048.0) ) - (the float (sar (shl (the int (+ (-> this sway-angle) (* 5461.3335 (the float s5-4)))) 48) 48)) - (vector-rotate-around-axis! - (-> s4-1 uvec) - (-> s4-1 uvec) - f0-9 - (the-as vector (+ (the-as uint (-> *blue-2-lightning-shape* constraints 0 dir)) (* 48 s5-4))) ) - (vector-normalize! (-> s4-1 uvec) 1.0) - (vector+float*! s3-2 s3-2 (-> s4-1 uvec) 2048.0) ) ) + (setup-draw! this (-> sv-632 lightning-info)) ) - (setup-draw! this (-> sv-632 lightning-info)) ) ;; definition for function gun-fire-blue-2 @@ -2375,215 +2372,209 @@ ;; definition for function gun-fire-blue-2-old ;; INFO: Used lq/sq (defbehavior gun-fire-blue-2-old target () - (local-vars - (sv-608 gun-info) - (sv-612 vector) - (sv-616 gun-blue-lightning-command) - (sv-768 vector) - (sv-772 vector) - (sv-776 vector) - (sv-784 int) - (sv-792 int) - (sv-800 vector) - (sv-848 vector) - (sv-852 vector) - ) (create-lightning-tracker-if-necessary) - (set! sv-608 (-> self gun)) - (set! sv-612 (-> self gun fire-dir-out)) - (set! sv-616 (new 'stack-no-clear 'gun-blue-lightning-command)) - (cpad-set-buzz! (-> *cpad-list* cpads 0) 1 153 (seconds 0.1)) - (set! (-> sv-616 msg) (gun-blue-lightning-cmd-msg active)) - (set! (-> sv-616 lightning-info num-pts) 0) - (set! (-> sv-616 lightning-info should-draw-terminal-sparks?) #f) - (set! (-> sv-616 lightning-info should-draw-extension?) #t) - (vector-normalize! sv-612 1.0) - (when (not (do-fire-backcheck (-> sv-608 fire-point) sv-612)) - (let ((a0-5 (handle->process (-> sv-608 gun 0 extra)))) - (send-event a0-5 'gun-blue-lightning sv-616) + (let ((sv-608 (-> self gun)) + (sv-612 (-> self gun fire-dir-out)) + (sv-616 (new 'stack-no-clear 'gun-blue-lightning-command)) + ) + (cpad-set-buzz! (-> *cpad-list* cpads 0) 1 153 (seconds 0.1)) + (set! (-> sv-616 msg) (gun-blue-lightning-cmd-msg active)) + (set! (-> sv-616 lightning-info num-pts) 0) + (set! (-> sv-616 lightning-info should-draw-terminal-sparks?) #f) + (set! (-> sv-616 lightning-info should-draw-extension?) #t) + (vector-normalize! sv-612 1.0) + (when (not (do-fire-backcheck (-> sv-608 fire-point) sv-612)) + (let ((a0-5 (handle->process (-> sv-608 gun 0 extra)))) + (send-event a0-5 'gun-blue-lightning sv-616) + ) + (return 0) ) - (return 0) - ) - (let ((v1-23 (new 'stack-no-clear 'vector))) - (vector-copy! v1-23 (-> sv-608 fire-point)) - (set! sv-768 v1-23) - ) - (set! sv-772 (vector+float*! (new 'stack-no-clear 'vector) (-> sv-608 fire-point) sv-612 409600.0)) - (let ((v1-26 (new 'stack-no-clear 'vector))) - (vector-copy! v1-26 sv-612) - (set! sv-776 v1-26) - ) - (set! sv-784 0) - (set! sv-792 -1) - (set! sv-800 (new 'stack-no-clear 'vector)) - (vector-copy! (-> sv-616 lightning-info pts (-> sv-616 lightning-info num-pts)) sv-768) - (+! (-> sv-616 lightning-info num-pts) 1) - (vector-! sv-800 sv-772 sv-768) - (dotimes (gp-0 8) - (let ((f30-0 32768.0)) - (set! sv-848 (new 'stack-no-clear 'vector)) - (set! sv-852 (vector+float*! (new 'stack-no-clear 'vector) sv-768 sv-612 f30-0)) - (vector-copy! sv-848 sv-852) - (set! (-> sv-848 w) 20480.0) - (let ((s5-0 (the-as process #f))) - (let ((s4-0 #f)) - (when (< gp-0 7) - (when (and (handle->process (-> *gun-blue-2-targets* gp-0 target)) - (not (time-elapsed? (-> *gun-blue-2-targets* gp-0 start-time) (seconds 0.5))) - ) - (let ((s3-0 (as-type (handle->process (-> *gun-blue-2-targets* gp-0 target)) process-focusable))) - (when (is-valid-blue-2-target (the-as process-focusable s3-0) sv-784) - (let ((s2-2 (vector-! (new 'stack-no-clear 'vector) (get-trans (the-as process-focusable s3-0) 3) sv-852))) - (vector-normalize-ret-len! s2-2 1.0) - (let ((f0-5 (vector-dot s2-2 sv-776))) - (when (< 0.87 f0-5) - (set! s4-0 #t) - (set! s5-0 s3-0) + (let ((v1-23 (new 'stack-no-clear 'vector))) + (vector-copy! v1-23 (-> sv-608 fire-point)) + (let ((sv-768 v1-23) + (sv-772 (vector+float*! (new 'stack-no-clear 'vector) (-> sv-608 fire-point) sv-612 409600.0)) + (v1-26 (new 'stack-no-clear 'vector)) + ) + (vector-copy! v1-26 sv-612) + (let ((sv-776 v1-26) + (sv-784 0) + (sv-792 -1) + (sv-800 (new 'stack-no-clear 'vector)) + ) + (vector-copy! (-> sv-616 lightning-info pts (-> sv-616 lightning-info num-pts)) sv-768) + (+! (-> sv-616 lightning-info num-pts) 1) + (vector-! sv-800 sv-772 sv-768) + (dotimes (gp-0 8) + (let ((f30-0 32768.0)) + (let ((sv-848 (new 'stack-no-clear 'vector)) + (sv-852 (vector+float*! (new 'stack-no-clear 'vector) sv-768 sv-612 f30-0)) + ) + (vector-copy! sv-848 sv-852) + (set! (-> sv-848 w) 20480.0) + (let ((s5-0 (the-as process #f))) + (let ((s4-0 #f)) + (when (< gp-0 7) + (when (and (handle->process (-> *gun-blue-2-targets* gp-0 target)) + (not (time-elapsed? (-> *gun-blue-2-targets* gp-0 start-time) (seconds 0.5))) + ) + (let ((s3-0 (as-type (handle->process (-> *gun-blue-2-targets* gp-0 target)) process-focusable))) + (when (is-valid-blue-2-target (the-as process-focusable s3-0) sv-784) + (let ((s2-2 (vector-! (new 'stack-no-clear 'vector) (get-trans (the-as process-focusable s3-0) 3) sv-852))) + (vector-normalize-ret-len! s2-2 1.0) + (let ((f0-5 (vector-dot s2-2 sv-776))) + (when (< 0.87 f0-5) + (set! s4-0 #t) + (set! s5-0 s3-0) + ) + ) + ) + ) + ) + ) + (when (not s4-0) + (set! (-> *gun-blue-2-targets* gp-0 target) (the-as handle #f)) + (set-time! (-> *gun-blue-2-targets* gp-0 start-time)) + ) + (if (not s5-0) + (set! s5-0 (find-gun-blue-2-target-old sv-848 sv-784 sv-776)) + ) + ) + ) + (cond + (s5-0 + (set! (-> *found-objects* sv-784) (process->handle s5-0)) + (set! (-> *gun-blue-2-targets* gp-0 target) (process->handle s5-0)) + (+! sv-784 1) + (set! sv-792 gp-0) + (vector-! sv-800 (get-trans (the-as process-focusable s5-0) 3) sv-768) + (vector-normalize! sv-800 1.0) + ) + (else + (vector-normalize! sv-800 1.0) + (let ((f0-7 (vector-dot sv-800 sv-776))) + (when (< f0-7 0.866) + (let ((s5-1 (new 'stack-no-clear 'vector)) + (f28-0 0.0) + ) + (acos f0-7) + 5461.3335 + (vector-cross! s5-1 sv-800 sv-776) + (vector-normalize! s5-1 1.0) + (vector-rotate-around-axis! sv-800 sv-776 f28-0 s5-1) + ) + ) + ) + (vector-normalize! sv-800 1.0) + ) + ) + ) + ) + (vector-copy! sv-776 sv-800) + (let ((s5-3 (vector+float*! (new 'stack-no-clear 'vector) sv-768 sv-800 f30-0))) + (let ((s4-3 #f)) + (let ((s3-1 (new 'stack-no-clear 'collide-query))) + (vector-copy! (-> s3-1 start-pos) sv-768) + (vector-! (-> s3-1 move-dist) s5-3 sv-768) + (let ((v1-99 s3-1)) + (set! (-> v1-99 radius) 40.96) + (set! (-> v1-99 collide-with) + (collide-spec backgnd vehicle-sphere hit-by-others-list pusher impenetrable-obj) + ) + (set! (-> v1-99 ignore-process0) #f) + (set! (-> v1-99 ignore-process1) #f) + (set! (-> v1-99 ignore-pat) + (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) + ) + (set! (-> v1-99 action-mask) (collide-action solid)) + ) + (let ((f0-11 (fill-and-probe-using-line-sphere *collide-cache* s3-1))) + (when (>= f0-11 0.0) + (vector-float*! (-> s3-1 move-dist) (-> s3-1 move-dist) f0-11) + (vector+! s5-3 sv-768 (-> s3-1 move-dist)) + (set! s4-3 #t) + (cond + ((> gp-0 0) + (let ((a0-80 (vector-normalize-copy! (new 'stack-no-clear 'vector) (-> s3-1 move-dist) 1.0))) + (vector+float*! (-> sv-616 lightning-info terminal-spark-pos) s5-3 a0-80 -12288.0) + ) + ) + (else + (vector-copy! (-> sv-616 lightning-info terminal-spark-pos) s5-3) + ) + ) ) ) ) - ) - ) - ) - (when (not s4-0) - (set! (-> *gun-blue-2-targets* gp-0 target) (the-as handle #f)) - (set-time! (-> *gun-blue-2-targets* gp-0 start-time)) - ) - (if (not s5-0) - (set! s5-0 (find-gun-blue-2-target-old sv-848 sv-784 sv-776)) - ) - ) - ) - (cond - (s5-0 - (set! (-> *found-objects* sv-784) (process->handle s5-0)) - (set! (-> *gun-blue-2-targets* gp-0 target) (process->handle s5-0)) - (set! sv-784 (+ sv-784 1)) - (set! sv-792 gp-0) - (vector-! sv-800 (get-trans (the-as process-focusable s5-0) 3) sv-768) - (vector-normalize! sv-800 1.0) - ) - (else - (vector-normalize! sv-800 1.0) - (let ((f0-7 (vector-dot sv-800 sv-776))) - (when (< f0-7 0.866) - (let ((s5-1 (new 'stack-no-clear 'vector)) - (f28-0 0.0) - ) - (acos f0-7) - 5461.3335 - (vector-cross! s5-1 sv-800 sv-776) - (vector-normalize! s5-1 1.0) - (vector-rotate-around-axis! sv-800 sv-776 f28-0 s5-1) - ) - ) - ) - (vector-normalize! sv-800 1.0) - ) - ) - ) - (vector-copy! sv-776 sv-800) - (let ((s5-3 (vector+float*! (new 'stack-no-clear 'vector) sv-768 sv-800 f30-0))) - (let ((s4-3 #f)) - (let ((s3-1 (new 'stack-no-clear 'collide-query))) - (vector-copy! (-> s3-1 start-pos) sv-768) - (vector-! (-> s3-1 move-dist) s5-3 sv-768) - (let ((v1-99 s3-1)) - (set! (-> v1-99 radius) 40.96) - (set! (-> v1-99 collide-with) - (collide-spec backgnd vehicle-sphere hit-by-others-list pusher impenetrable-obj) + (vector-copy! (-> sv-616 lightning-info pts (-> sv-616 lightning-info num-pts)) s5-3) + (+! (-> sv-616 lightning-info num-pts) 1) + (let ((s3-2 fire-projectile-if-necessary) + (s2-3 sv-768) + (s1-0 s5-3) + (a2-7 (if (< 1 sv-784) + (the-as int (-> *found-objects* (+ sv-784 -2))) + (process->handle (send-event self 'get-vehicle)) + ) + ) + ) + (s3-2 s2-3 s1-0 (the-as handle a2-7)) ) - (set! (-> v1-99 ignore-process0) #f) - (set! (-> v1-99 ignore-process1) #f) - (set! (-> v1-99 ignore-pat) - (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) + (vector-copy! sv-768 s5-3) + (when s4-3 + (set! (-> sv-616 lightning-info should-draw-terminal-sparks?) #t) + (set! (-> sv-616 lightning-info should-draw-extension?) #f) + 0 + (goto cfg-70) ) - (set! (-> v1-99 action-mask) (collide-action solid)) + ) + (vector-copy! (-> sv-616 lightning-info terminal-spark-pos) s5-3) + ) ) - (let ((f0-11 (fill-and-probe-using-line-sphere *collide-cache* s3-1))) - (when (>= f0-11 0.0) - (vector-float*! (-> s3-1 move-dist) (-> s3-1 move-dist) f0-11) - (vector+! s5-3 sv-768 (-> s3-1 move-dist)) - (set! s4-3 #t) - (cond - ((> gp-0 0) - (let ((a0-80 (vector-normalize-copy! (new 'stack-no-clear 'vector) (-> s3-1 move-dist) 1.0))) - (vector+float*! (-> sv-616 lightning-info terminal-spark-pos) s5-3 a0-80 -12288.0) - ) + ) + (label cfg-70) + (if (and (= sv-792 (+ (-> sv-616 lightning-info num-pts) -2)) + (not (-> sv-616 lightning-info should-draw-extension?)) ) - (else - (vector-copy! (-> sv-616 lightning-info terminal-spark-pos) s5-3) + (set! (-> sv-616 lightning-info should-draw-terminal-sparks?) #f) + ) + (let ((s5-4 (-> sv-616 lightning-info pts (+ (-> sv-616 lightning-info num-pts) -1)))) + (when (-> sv-616 lightning-info should-draw-extension?) + (let ((gp-2 (vector+float*! (new 'stack-no-clear 'vector) s5-4 sv-800 409600.0)) + (s4-4 (new 'stack-no-clear 'collide-query)) ) + (vector-copy! (-> s4-4 start-pos) s5-4) + (vector-! (-> s4-4 move-dist) gp-2 s5-4) + (let ((v1-154 s4-4)) + (set! (-> v1-154 radius) 40.96) + (set! (-> v1-154 collide-with) + (collide-spec backgnd vehicle-sphere hit-by-others-list pusher impenetrable-obj) + ) + (set! (-> v1-154 ignore-process0) #f) + (set! (-> v1-154 ignore-process1) #f) + (set! (-> v1-154 ignore-pat) + (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) + ) + (set! (-> v1-154 action-mask) (collide-action solid)) + ) + (let ((f0-15 (fill-and-probe-using-line-sphere *collide-cache* s4-4))) + (when (>= f0-15 0.0) + (vector-float*! (-> s4-4 move-dist) (-> s4-4 move-dist) f0-15) + (vector+! gp-2 s5-4 (-> s4-4 move-dist)) + ) + ) + (vector-copy! (-> sv-616 lightning-info extension-end-point) gp-2) + (set! (-> sv-616 lightning-info should-draw-terminal-sparks?) #t) + (let ((a0-122 (vector-normalize-copy! (new 'stack-no-clear 'vector) (-> s4-4 move-dist) 1.0))) + (vector+float*! (-> sv-616 lightning-info terminal-spark-pos) gp-2 a0-122 -12288.0) ) ) ) ) - (vector-copy! (-> sv-616 lightning-info pts (-> sv-616 lightning-info num-pts)) s5-3) - (+! (-> sv-616 lightning-info num-pts) 1) - (let ((s3-2 fire-projectile-if-necessary) - (s2-3 sv-768) - (s1-0 s5-3) - (a2-7 (if (< 1 sv-784) - (the-as int (-> *found-objects* (+ sv-784 -2))) - (process->handle (send-event self 'get-vehicle)) - ) - ) - ) - (s3-2 s2-3 s1-0 (the-as handle a2-7)) - ) - (vector-copy! sv-768 s5-3) - (when s4-3 - (set! (-> sv-616 lightning-info should-draw-terminal-sparks?) #t) - (set! (-> sv-616 lightning-info should-draw-extension?) #f) - 0 - (goto cfg-70) - ) - ) - (vector-copy! (-> sv-616 lightning-info terminal-spark-pos) s5-3) - ) - ) - ) - (label cfg-70) - (if (and (= sv-792 (+ (-> sv-616 lightning-info num-pts) -2)) - (not (-> sv-616 lightning-info should-draw-extension?)) - ) - (set! (-> sv-616 lightning-info should-draw-terminal-sparks?) #f) - ) - (let ((s5-4 (-> sv-616 lightning-info pts (+ (-> sv-616 lightning-info num-pts) -1)))) - (when (-> sv-616 lightning-info should-draw-extension?) - (let ((gp-2 (vector+float*! (new 'stack-no-clear 'vector) s5-4 sv-800 409600.0)) - (s4-4 (new 'stack-no-clear 'collide-query)) - ) - (vector-copy! (-> s4-4 start-pos) s5-4) - (vector-! (-> s4-4 move-dist) gp-2 s5-4) - (let ((v1-154 s4-4)) - (set! (-> v1-154 radius) 40.96) - (set! (-> v1-154 collide-with) - (collide-spec backgnd vehicle-sphere hit-by-others-list pusher impenetrable-obj) - ) - (set! (-> v1-154 ignore-process0) #f) - (set! (-> v1-154 ignore-process1) #f) - (set! (-> v1-154 ignore-pat) - (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) - ) - (set! (-> v1-154 action-mask) (collide-action solid)) - ) - (let ((f0-15 (fill-and-probe-using-line-sphere *collide-cache* s4-4))) - (when (>= f0-15 0.0) - (vector-float*! (-> s4-4 move-dist) (-> s4-4 move-dist) f0-15) - (vector+! gp-2 s5-4 (-> s4-4 move-dist)) - ) - ) - (vector-copy! (-> sv-616 lightning-info extension-end-point) gp-2) - (set! (-> sv-616 lightning-info should-draw-terminal-sparks?) #t) - (let ((a0-122 (vector-normalize-copy! (new 'stack-no-clear 'vector) (-> s4-4 move-dist) 1.0))) - (vector+float*! (-> sv-616 lightning-info terminal-spark-pos) gp-2 a0-122 -12288.0) ) ) ) - ) - (let ((a0-124 (handle->process (-> sv-608 gun 0 extra)))) - (send-event a0-124 'gun-blue-lightning sv-616) + (let ((a0-124 (handle->process (-> sv-608 gun 0 extra)))) + (send-event a0-124 'gun-blue-lightning sv-616) + ) ) ) diff --git a/test/decompiler/reference/jak3/engine/target/gun/gun-dark-shot_REF.gc b/test/decompiler/reference/jak3/engine/target/gun/gun-dark-shot_REF.gc index 024fcd0d02..7728bf97ff 100644 --- a/test/decompiler/reference/jak3/engine/target/gun/gun-dark-shot_REF.gc +++ b/test/decompiler/reference/jak3/engine/target/gun/gun-dark-shot_REF.gc @@ -797,7 +797,7 @@ (set! (-> self launch-impact-state) (method-of-object self impact)) ) (set! (-> self launch-speed) (lerp 204800.0 552960.0 f30-0)) - (set! (-> self launch-height-t) (* f30-0 f30-0)) + (set! (-> self launch-height-t) (square f30-0)) ) (let ((v1-10 (-> self state parent))) (when v1-10 @@ -875,7 +875,6 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defmethod count-casualties ((this gun-dark-3-nuke)) - (local-vars (sv-1568 vector)) (set! (-> this num-dying-vehicles) (the-as uint 0)) (set! (-> this num-dying-guards) (the-as uint 0)) (set! (-> this num-dying-civilians) (the-as uint 0)) @@ -893,12 +892,8 @@ (when (and (!= *target* s1-1) (not (focus-test? (the-as process-focusable s1-1) disable dead inactive)) (or (logtest? (process-mask enemy guard vehicle civilian) (-> s1-1 mask)) - (and (logtest? (process-mask crate) (-> s1-1 mask)) (let ((s0-1 vector-vector-xz-distance)) - (set! sv-1568 (-> s1-1 root trans)) - (let ((a1-3 (camera-pos))) - (< (s0-1 sv-1568 a1-3) 204800.0) - ) - ) + (and (logtest? (process-mask crate) (-> s1-1 mask)) + (< (vector-vector-xz-distance (-> s1-1 root trans) (camera-pos)) 204800.0) ) ) ) @@ -1438,7 +1433,7 @@ (when (time-elapsed? (-> self state-time) (seconds 5)) (let ((f30-1 (* 0.00066666666 (the float (+ (- (seconds -5) (-> self state-time)) (current-time)))))) 0.0 - (let ((f24-0 (* f30-1 f30-1))) + (let ((f24-0 (square f30-1))) (set! f28-0 (* f28-0 (lerp 1.0 1.3 f24-0))) (set! f26-1 (* f26-1 (lerp 1.0 1.3 f24-0))) ) @@ -1449,7 +1444,7 @@ (vector-copy! (-> v1-144 pos) (-> self mushroom-top-pos)) (set! (-> v1-144 size-x) f28-0) (set! (-> v1-144 size-y) f26-1) - (set! (-> v1-144 alpha-val) (* f30-0 f30-0)) + (set! (-> v1-144 alpha-val) (square f30-0)) (send-event (handle->process (-> self warp)) 'set-pos-and-size v1-144) ) (let ((gp-6 (vector-float*! (new 'stack-no-clear 'vector) *up-vector* f26-1)) @@ -1870,84 +1865,65 @@ (arg5 sparticle-launcher) (arg6 sparticle-launcher) ) - (local-vars (sv-16 process) (sv-32 lightning-spec) (sv-48 process-focusable)) - (set! sv-48 arg0) - (let ((s0-0 arg1)) - (set! sv-32 arg2) - (let ((gp-0 arg4) - (s1-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 0)) - (let ((s2-0 (when sv-16 - (let ((t9-3 (method-of-type lightning-tracker activate))) - (t9-3 (the-as lightning-tracker sv-16) s0-0 "lightning-tracker" (the-as pointer #x70004000)) - ) - (let ((t9-4 run-function-in-process) - (a0-5 sv-16) - (a1-5 lightning-tracker-init) - (a3-3 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-5 - sv-32 - a3-3 - t0-1 - sv-48 - t2-1 - t3-0 - ) - ) - (-> sv-16 ppointer) - ) + (let* ((sv-48 arg0) + (s0-0 arg1) + (sv-32 arg2) + (gp-0 arg4) + (s1-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 0)) + (s2-0 (when sv-16 + ((method-of-type lightning-tracker activate) + (the-as lightning-tracker sv-16) + s0-0 + "lightning-tracker" + (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 s1-0 + (let ((t9-5 sp-launch-particles-var) + (a0-6 *sp-particle-system-2d*) + (a2-4 *launch-matrix*) ) - (when s1-0 - (let ((t9-5 sp-launch-particles-var) - (a0-6 *sp-particle-system-2d*) - (a2-4 *launch-matrix*) - ) - (vector-copy! (-> a2-4 trans) s4-0) - (t9-5 a0-6 s1-0 a2-4 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0) + (vector-copy! (-> a2-4 trans) s4-0) + (t9-5 a0-6 s1-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*) - ) - (vector-copy! (-> a2-5 trans) s4-0) - (t9-6 a0-7 s3-0 a2-5 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0) + (vector-copy! (-> a2-5 trans) s4-0) + (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 s2-0) + (let ((v1-13 (get-field-spec-by-id gp-0 (sp-field-id spt-timer)))) + (if v1-13 + (set! (-> v1-13 initial-valuef) (the-as float (-> (the-as lightning-tracker (-> s2-0 0)) duration))) ) - ) - (when (and gp-0 s2-0) - (let ((v1-13 (get-field-spec-by-id gp-0 (sp-field-id spt-timer)))) - (if v1-13 - (set! (-> v1-13 initial-valuef) (the-as float (-> (the-as lightning-tracker (-> s2-0 0)) duration))) - ) + ) + (let ((t9-8 sp-launch-particles-var) + (a0-12 *sp-particle-system-2d*) + (a1-13 gp-0) + (a2-6 *launch-matrix*) ) - (let ((t9-8 sp-launch-particles-var) - (a0-12 *sp-particle-system-2d*) - (a1-13 gp-0) - (a2-6 *launch-matrix*) - ) - (vector-copy! (-> a2-6 trans) s4-0) - (t9-8 a0-12 a1-13 a2-6 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0) + (vector-copy! (-> a2-6 trans) s4-0) + (t9-8 a0-12 a1-13 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*) - ) - (vector-copy! (-> a2-7 trans) s5-0) - (t9-9 a0-13 gp-0 a2-7 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0) - ) - ) + (vector-copy! (-> a2-7 trans) s5-0) + (t9-9 a0-13 gp-0 a2-7 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0) ) ) ) @@ -2130,9 +2106,7 @@ (!= s1-1 s5-1) ) (let* ((s0-1 (get-trans (the-as process-focusable s1-1) 3)) - (f0-2 (vector-vector-distance-squared (-> self root trans) s0-1)) - (f1-0 (-> s0-1 w)) - (f0-3 (- f0-2 (* f1-0 f1-0))) + (f0-3 (- (vector-vector-distance-squared (-> self root trans) s0-1) (square (-> s0-1 w)))) (v1-80 (+ (-> self result-count) -1)) ) (while (and (>= v1-80 0) (< f0-3 (-> gp-3 v1-80))) @@ -2167,9 +2141,7 @@ (!= s3-1 s5-1) ) (let* ((s5-2 (get-trans s3-1 3)) - (f0-5 (vector-vector-distance-squared (-> self root trans) s5-2)) - (f1-6 (-> s5-2 w)) - (f0-6 (- f0-5 (* f1-6 f1-6))) + (f0-6 (- (vector-vector-distance-squared (-> self root trans) s5-2) (square (-> s5-2 w)))) (v1-101 (+ (-> self result-count) -1)) ) (while (and (>= v1-101 0) (< f0-6 (-> gp-3 v1-101))) @@ -2491,8 +2463,7 @@ (* 10.0 (seconds-per-frame) (- 4096.0 f0-2)) ) ((< 14336.0 f0-2) - (let* ((f0-5 (+ -14336.0 f0-2)) - (f0-7 (* f0-5 f0-5)) + (let* ((f0-7 (square (+ -14336.0 f0-2))) (f0-9 (* 0.00008138021 (- f0-7))) (f0-10 (fmax -61440.0 f0-9)) ) @@ -2659,90 +2630,144 @@ ;; WARN: Stack slot offset 148 signed mismatch ;; WARN: Stack slot offset 148 signed mismatch (defmethod handle-impact ((this gravity-spinner) (arg0 symbol)) - (local-vars - (sv-144 sphere) - (sv-148 process) - (sv-152 vector) - (sv-156 float) - (sv-160 float) - (sv-164 vector) - (sv-168 symbol) - (sv-172 float) - (sv-1728 vector) - (sv-1732 vector) - (sv-1736 float) - (sv-2304 vector) - (sv-2308 vector) - (sv-2312 float) - ) - (let ((s5-0 (as-type (handle->process (-> this parent-hand)) process-focusable))) - (when s5-0 - (set! sv-144 (new 'stack 'sphere)) - (set! sv-148 (the-as process (send-event *target* 'get-vehicle))) - (let ((v1-7 (new 'stack-no-clear 'vector))) - (vector-copy! v1-7 (-> (the-as process-focusable s5-0) root transv)) - (set! sv-152 v1-7) - ) - (set! sv-156 (the-as float 0.0)) - (set! sv-160 (the-as float 102400.0)) - (set! sv-164 (new 'stack-no-clear 'vector)) - (set! sv-168 (the-as symbol #f)) - (set! sv-172 (the-as float 40960000.0)) - (if arg0 - (set! sv-160 (the-as float 163840.0)) - ) - (set! sv-156 (vector-normalize-ret-len! sv-152 1.0)) - (set! (-> sv-144 quad) (-> (get-trans (the-as process-focusable s5-0) 3) quad)) - (set! (-> sv-144 r) sv-160) - (let ((s3-2 (new 'stack-no-clear 'array 'collide-shape 384))) - (countdown (s2-0 (fill-actor-list-for-box *actor-hash* sv-144 s3-2 384)) - (let ((a0-15 (as-type (-> s3-2 s2-0) collide-shape))) - (when a0-15 - (let ((a0-17 (as-type (-> a0-15 process) process-focusable))) - (when a0-17 - (when (and (!= s5-0 a0-17) - (not (focus-test? (the-as process-focusable a0-17) disable dead inactive gun-no-target)) - (logtest? (process-mask enemy guard civilian) (-> a0-17 mask)) - (not (focus-test? (the-as process-focusable a0-17) no-gravity)) - (!= a0-17 sv-148) - ) - (set! sv-1728 (get-trans (the-as process-focusable a0-17) 3)) - (set! sv-1732 (new 'stack-no-clear 'vector)) - (set! sv-1736 (the-as float 0.0)) - (vector-! sv-1732 sv-1728 (the-as vector sv-144)) - (set! sv-1736 (vector-normalize-ret-len! sv-1732 1.0)) - (when (and (>= sv-160 sv-1736) (< sv-1736 sv-172) (< sv-1736 (* 4.5 sv-156))) - (let ((f30-0 (vector-dot sv-152 sv-1732)) - (f0-12 0.707) - ) - (if arg0 - (set! f0-12 0.5) - ) - (when (< f0-12 f30-0) - (let ((a1-19 (new 'stack 'collide-query))) - (vector-copy! (-> a1-19 start-pos) sv-144) - (vector-! (-> a1-19 move-dist) sv-1728 (-> a1-19 start-pos)) - (let ((v1-53 a1-19)) - (set! (-> v1-53 radius) (* 0.8 (-> (the-as process-focusable s5-0) root root-prim prim-core world-sphere w))) - (set! (-> v1-53 collide-with) (collide-spec backgnd obstacle)) - (set! (-> v1-53 ignore-process0) #f) - (set! (-> v1-53 ignore-process1) #f) - (set! (-> v1-53 ignore-pat) - (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) + (with-pp + (let ((s5-0 (as-type (handle->process (-> this parent-hand)) process-focusable))) + (when s5-0 + (let ((sv-144 (new 'stack 'sphere)) + (a1-4 (new 'stack-no-clear 'event-message-block)) + ) + (set! (-> a1-4 from) (process->ppointer pp)) + (set! (-> a1-4 num-params) 0) + (set! (-> a1-4 message) 'get-vehicle) + (let ((sv-148 (the-as process (send-event-function *target* a1-4))) + (v1-7 (new 'stack-no-clear 'vector)) + ) + (vector-copy! v1-7 (-> (the-as process-focusable s5-0) root transv)) + (let ((sv-152 v1-7) + (sv-156 (the-as float 0.0)) + (sv-160 (the-as float 102400.0)) + (sv-164 (new 'stack-no-clear 'vector)) + (sv-168 (the-as symbol #f)) + ) + (let ((sv-172 (the-as float 40960000.0))) + (if arg0 + (set! sv-160 (the-as float 163840.0)) + ) + (set! sv-156 (vector-normalize-ret-len! sv-152 1.0)) + (set! (-> sv-144 quad) (-> (get-trans (the-as process-focusable s5-0) 3) quad)) + (set! (-> sv-144 r) sv-160) + (let ((s3-2 (new 'stack-no-clear 'array 'collide-shape 384))) + (countdown (s2-0 (fill-actor-list-for-box *actor-hash* sv-144 s3-2 384)) + (let ((a0-15 (as-type (-> s3-2 s2-0) collide-shape))) + (when a0-15 + (let ((a0-17 (as-type (-> a0-15 process) process-focusable))) + (when a0-17 + (when (and (!= s5-0 a0-17) + (not (focus-test? (the-as process-focusable a0-17) disable dead inactive gun-no-target)) + (logtest? (process-mask enemy guard civilian) (-> a0-17 mask)) + (not (focus-test? (the-as process-focusable a0-17) no-gravity)) + (!= a0-17 sv-148) + ) + (let ((sv-1728 (get-trans (the-as process-focusable a0-17) 3)) + (sv-1732 (new 'stack-no-clear 'vector)) + (sv-1736 (the-as float 0.0)) ) - (set! (-> v1-53 action-mask) (collide-action solid)) - ) - (when (< (fill-and-probe-using-line-sphere *collide-cache* a1-19) 0.0) - (set! sv-172 (* sv-1736 (* f30-0 f30-0))) - (set! sv-168 #t) - (let ((f0-18 sv-156)) - (when arg0 - (set! f0-18 (fmin (fmax sv-156 (* 1.5 sv-1736)) (* 3.0 sv-156))) - (if (-> this was-hit-previously?) - (set! f0-18 (fmin f0-18 (* 2.0 sv-156))) + (vector-! sv-1732 sv-1728 (the-as vector sv-144)) + (set! sv-1736 (vector-normalize-ret-len! sv-1732 1.0)) + (when (and (>= sv-160 sv-1736) (< sv-1736 sv-172) (< sv-1736 (* 4.5 sv-156))) + (let ((f30-0 (vector-dot sv-152 sv-1732)) + (f0-12 0.707) + ) + (if arg0 + (set! f0-12 0.5) + ) + (when (< f0-12 f30-0) + (let ((a1-19 (new 'stack 'collide-query))) + (vector-copy! (-> a1-19 start-pos) sv-144) + (vector-! (-> a1-19 move-dist) sv-1728 (-> a1-19 start-pos)) + (let ((v1-53 a1-19)) + (set! (-> v1-53 radius) (* 0.8 (-> (the-as process-focusable s5-0) root root-prim prim-core world-sphere w))) + (set! (-> v1-53 collide-with) (collide-spec backgnd obstacle)) + (set! (-> v1-53 ignore-process0) #f) + (set! (-> v1-53 ignore-process1) #f) + (set! (-> v1-53 ignore-pat) + (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) + ) + (set! (-> v1-53 action-mask) (collide-action solid)) + ) + (when (< (fill-and-probe-using-line-sphere *collide-cache* a1-19) 0.0) + (set! sv-172 (* sv-1736 (square f30-0))) + (set! sv-168 #t) + (let ((f0-18 sv-156)) + (when arg0 + (set! f0-18 (fmin (fmax sv-156 (* 1.5 sv-1736)) (* 3.0 sv-156))) + (if (-> this was-hit-previously?) + (set! f0-18 (fmin f0-18 (* 2.0 sv-156))) + ) + ) + (vector-normalize-copy! sv-164 sv-1732 f0-18) + ) + ) + ) ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + (let ((s3-3 (the-as target (as-type *target* process-focusable)))) + (when (and s3-3 (< (vector-vector-distance (get-trans s3-3 0) sv-144) (-> sv-144 r))) + (when (and (!= s5-0 s3-3) + (not (focus-test? s3-3 disable dead inactive gun-no-target)) + (logtest? (process-mask enemy guard civilian) (-> s3-3 mask)) + (not (focus-test? s3-3 no-gravity)) + (!= s3-3 sv-148) + ) + (let ((sv-2304 (get-trans s3-3 3)) + (sv-2308 (new 'stack-no-clear 'vector)) + (sv-2312 (the-as float 0.0)) + ) + (vector-! sv-2308 sv-2304 (the-as vector sv-144)) + (set! sv-2312 (vector-normalize-ret-len! sv-2308 1.0)) + (when (and (>= sv-160 sv-2312) (< sv-2312 sv-172) (< sv-2312 (* 4.5 sv-156))) + (let ((f30-1 (vector-dot sv-152 sv-2308)) + (f0-28 0.707) + ) + (if arg0 + (set! f0-28 0.5) + ) + (when (< f0-28 f30-1) + (let ((a1-29 (new 'stack 'collide-query))) + (vector-copy! (-> a1-29 start-pos) sv-144) + (vector-! (-> a1-29 move-dist) sv-2304 (-> a1-29 start-pos)) + (let ((v1-103 a1-29)) + (set! (-> v1-103 radius) (* 0.8 (-> (the-as process-focusable s5-0) root root-prim prim-core world-sphere w))) + (set! (-> v1-103 collide-with) (collide-spec backgnd obstacle)) + (set! (-> v1-103 ignore-process0) #f) + (set! (-> v1-103 ignore-process1) #f) + (set! (-> v1-103 ignore-pat) + (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) + ) + (set! (-> v1-103 action-mask) (collide-action solid)) + ) + (when (< (fill-and-probe-using-line-sphere *collide-cache* a1-29) 0.0) + (set! sv-172 (* sv-2312 (square f30-1))) + (set! sv-168 #t) + (let ((f0-34 sv-156)) + (when arg0 + (set! f0-34 (fmin (fmax sv-156 (* 1.5 sv-2312)) (* 3.0 sv-156))) + (if (-> this was-hit-previously?) + (set! f0-34 (fmin f0-34 (* 2.0 sv-156))) + ) + ) + (vector-normalize-copy! sv-164 sv-2308 f0-34) + ) ) - (vector-normalize-copy! sv-164 sv-1732 f0-18) ) ) ) @@ -2752,70 +2777,16 @@ ) ) ) - ) - ) - ) - ) - (let ((s3-3 (the-as target (as-type *target* process-focusable)))) - (when (and s3-3 (< (vector-vector-distance (get-trans s3-3 0) sv-144) (-> sv-144 r))) - (when (and (!= s5-0 s3-3) - (not (focus-test? s3-3 disable dead inactive gun-no-target)) - (logtest? (process-mask enemy guard civilian) (-> s3-3 mask)) - (not (focus-test? s3-3 no-gravity)) - (!= s3-3 sv-148) - ) - (set! sv-2304 (get-trans s3-3 3)) - (set! sv-2308 (new 'stack-no-clear 'vector)) - (set! sv-2312 (the-as float 0.0)) - (vector-! sv-2308 sv-2304 (the-as vector sv-144)) - (set! sv-2312 (vector-normalize-ret-len! sv-2308 1.0)) - (when (and (>= sv-160 sv-2312) (< sv-2312 sv-172) (< sv-2312 (* 4.5 sv-156))) - (let ((f30-1 (vector-dot sv-152 sv-2308)) - (f0-28 0.707) - ) - (if arg0 - (set! f0-28 0.5) - ) - (when (< f0-28 f30-1) - (let ((a1-29 (new 'stack 'collide-query))) - (vector-copy! (-> a1-29 start-pos) sv-144) - (vector-! (-> a1-29 move-dist) sv-2304 (-> a1-29 start-pos)) - (let ((v1-103 a1-29)) - (set! (-> v1-103 radius) (* 0.8 (-> (the-as process-focusable s5-0) root root-prim prim-core world-sphere w))) - (set! (-> v1-103 collide-with) (collide-spec backgnd obstacle)) - (set! (-> v1-103 ignore-process0) #f) - (set! (-> v1-103 ignore-process1) #f) - (set! (-> v1-103 ignore-pat) - (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) - ) - (set! (-> v1-103 action-mask) (collide-action solid)) - ) - (when (< (fill-and-probe-using-line-sphere *collide-cache* a1-29) 0.0) - (set! sv-172 (* sv-2312 (* f30-1 f30-1))) - (set! sv-168 #t) - (let ((f0-34 sv-156)) - (when arg0 - (set! f0-34 (fmin (fmax sv-156 (* 1.5 sv-2312)) (* 3.0 sv-156))) - (if (-> this was-hit-previously?) - (set! f0-34 (fmin f0-34 (* 2.0 sv-156))) - ) - ) - (vector-normalize-copy! sv-164 sv-2308 f0-34) - ) - ) - ) + (when sv-168 + (let ((v0-1 (-> (the-as process-focusable s5-0) root transv))) + (vector-copy! v0-1 sv-164) + v0-1 ) ) ) ) ) ) - (when sv-168 - (let ((v0-1 (-> (the-as process-focusable s5-0) root transv))) - (vector-copy! v0-1 sv-164) - v0-1 - ) - ) ) ) ) @@ -2823,19 +2794,21 @@ ;; definition for method 16 of type gravity-spinner ;; WARN: Return type mismatch int vs none. (defmethod gravity-spinner-method-16 ((this gravity-spinner) (arg0 vector) (arg1 vector)) - (local-vars (sv-48 vector) (sv-52 vector) (sv-56 float)) (let ((s4-0 (as-type (handle->process (-> this parent-hand)) process-focusable))) (when s4-0 - (set! sv-48 (vector-! (new 'stack-no-clear 'vector) arg0 (get-trans (the-as process-focusable s4-0) 3))) - (set! sv-52 (new 'stack-no-clear 'vector)) - (let ((f30-0 1.0) - (f0-0 (gravity-spinner-method-18 this s4-0)) - (f1-1 (fmin 12288.0 (-> (the-as process-focusable s4-0) root root-prim prim-core world-sphere w))) + (let ((sv-48 (vector-! (new 'stack-no-clear 'vector) arg0 (get-trans (the-as process-focusable s4-0) 3))) + (sv-52 (new 'stack-no-clear 'vector)) + (sv-56 + (/ 1.0 + (* (gravity-spinner-method-18 this s4-0) + (square (fmin 12288.0 (-> (the-as process-focusable s4-0) root root-prim prim-core world-sphere w))) + ) + ) + ) ) - (set! sv-56 (/ f30-0 (* f0-0 (* f1-1 f1-1)))) + (vector-cross! sv-52 sv-48 arg1) + (vector+float*! (-> this rotation-accel) (-> this rotation-accel) sv-52 sv-56) ) - (vector-cross! sv-52 sv-48 arg1) - (vector+float*! (-> this rotation-accel) (-> this rotation-accel) sv-52 sv-56) ) ) 0 @@ -3065,7 +3038,6 @@ (defstate zero-g (gravity-spinner) :virtual #t :event (behavior ((proc process) (argc int) (message symbol) (block event-message-block)) - (local-vars (sv-32 vector) (sv-36 float) (sv-40 uint) (sv-48 uint)) (case message (('get-float-speed) (get-float-speed self) @@ -3095,45 +3067,49 @@ (if (!= proc (handle->process (-> self parent-hand))) (return 0) ) - (set! sv-32 (vector-normalize-copy! (new 'stack-no-clear 'vector) (the-as vector (-> block param 0)) 1.0)) - (set! sv-36 (the-as float 0.0)) - (set! sv-40 (-> block param 2)) - (set! sv-48 (-> block param 3)) - (set! sv-36 (if (logtest? (attack-mask damage) (-> (the-as attack-info sv-40) mask)) - (-> (the-as attack-info sv-40) damage) - (penetrate-using->damage (the-as penetrate sv-48)) - ) + (let ((sv-32 (vector-normalize-copy! (new 'stack-no-clear 'vector) (the-as vector (-> block param 0)) 1.0)) + (sv-36 (the-as float 0.0)) ) - (vector-float*! sv-32 sv-32 (fmin 184320.0 (vector-length (the-as vector (-> block param 4))))) - (if (!= sv-48 1024) - (vector-float*! sv-32 sv-32 (* 2.0 sv-36)) - ) - (set! (-> sv-32 y) (* 0.15 (-> sv-32 y))) - (+! (-> self cached-damage) sv-36) - (let ((s4-0 (as-type proc process-focusable))) - (when s4-0 - (vector-float*! sv-32 sv-32 (fmax 0.5 (gravity-spinner-method-18 self s4-0))) - (vector+float*! - (-> (the-as process-drawable s4-0) root transv) - (-> (the-as process-drawable s4-0) root transv) - sv-32 - 1.0 - ) - (let ((f0-17 (vector-normalize-ret-len! (-> (the-as process-drawable s4-0) root transv) 1.0))) - (vector-float*! - (-> (the-as process-drawable s4-0) root transv) - (-> (the-as process-drawable s4-0) root transv) - (fmin 143360.0 f0-17) + (let ((sv-40 (-> block param 2)) + (sv-48 (-> block param 3)) + ) + (set! sv-36 (if (logtest? (attack-mask damage) (-> (the-as attack-info sv-40) mask)) + (-> (the-as attack-info sv-40) damage) + (penetrate-using->damage (the-as penetrate sv-48)) + ) + ) + (vector-float*! sv-32 sv-32 (fmin 184320.0 (vector-length (the-as vector (-> block param 4))))) + (if (!= sv-48 1024) + (vector-float*! sv-32 sv-32 (* 2.0 sv-36)) ) - ) - (handle-impact self #t) - (gravity-spinner-method-16 self (the-as vector (-> block param 5)) sv-32) ) - ) - (when (< 0.0 sv-36) - (let ((v0-0 (the-as object #t))) - (set! (-> self was-hit-previously?) (the-as symbol v0-0)) - v0-0 + (set! (-> sv-32 y) (* 0.15 (-> sv-32 y))) + (+! (-> self cached-damage) sv-36) + (let ((s4-0 (as-type proc process-focusable))) + (when s4-0 + (vector-float*! sv-32 sv-32 (fmax 0.5 (gravity-spinner-method-18 self s4-0))) + (vector+float*! + (-> (the-as process-drawable s4-0) root transv) + (-> (the-as process-drawable s4-0) root transv) + sv-32 + 1.0 + ) + (let ((f0-17 (vector-normalize-ret-len! (-> (the-as process-drawable s4-0) root transv) 1.0))) + (vector-float*! + (-> (the-as process-drawable s4-0) root transv) + (-> (the-as process-drawable s4-0) root transv) + (fmin 143360.0 f0-17) + ) + ) + (handle-impact self #t) + (gravity-spinner-method-16 self (the-as vector (-> block param 5)) sv-32) + ) + ) + (when (< 0.0 sv-36) + (let ((v0-0 (the-as object #t))) + (set! (-> self was-hit-previously?) (the-as symbol v0-0)) + v0-0 + ) ) ) ) @@ -3494,8 +3470,7 @@ 0.0 0.0 0.0 - (let* ((f0-56 f26-1) - (f0-57 (* f0-56 f0-56)) + (let* ((f0-57 (square f26-1)) (f1-33 (fmax (lerp f30-1 0.0 f0-57) f28-0)) (f0-60 (fmax 0.0 (- f24-1 f1-33))) ) diff --git a/test/decompiler/reference/jak3/engine/target/gun/gun-part_REF.gc b/test/decompiler/reference/jak3/engine/target/gun/gun-part_REF.gc index f0451bfc55..afbaf583fe 100644 --- a/test/decompiler/reference/jak3/engine/target/gun/gun-part_REF.gc +++ b/test/decompiler/reference/jak3/engine/target/gun/gun-part_REF.gc @@ -4126,8 +4126,7 @@ gun (-> arg1 timer) 0.0 0.0 - (let* ((f0-3 (* 0.0022222223 (the float (-> arg1 timer)))) - (f0-4 (* f0-3 f0-3)) + (let* ((f0-4 (square (* 0.0022222223 (the float (-> arg1 timer))))) (f0-5 (- 1.0 f0-4)) ) (vector-normalize! s4-0 (lerp 10240.0 0.0 f0-5)) diff --git a/test/decompiler/reference/jak3/engine/target/gun/gun-red-shot_REF.gc b/test/decompiler/reference/jak3/engine/target/gun/gun-red-shot_REF.gc index 5291b30ddc..84d8950f76 100644 --- a/test/decompiler/reference/jak3/engine/target/gun/gun-red-shot_REF.gc +++ b/test/decompiler/reference/jak3/engine/target/gun/gun-red-shot_REF.gc @@ -279,10 +279,8 @@ ) ) 0.0 - (let ((f0-4 (vector-length-squared s0-2)) - (f1-1 (-> this blast-radius)) - ) - (if (>= (* f1-1 f1-1) f0-4) + (let ((f0-4 (vector-length-squared s0-2))) + (if (>= (square (-> this blast-radius)) f0-4) (send-event s1-1 'attack @@ -317,10 +315,8 @@ (+! (-> *game-info* shots-hit 1) 1.0) (let ((s5-2 (vector-! (new 'stack-no-clear 'vector) (get-trans s3-1 3) (-> this root trans)))) 0.0 - (let ((f0-12 (vector-length-squared s5-2)) - (f1-6 (-> this blast-radius)) - ) - (if (>= (* f1-6 f1-6) f0-12) + (let ((f0-12 (vector-length-squared s5-2))) + (if (>= (square (-> this blast-radius)) f0-12) (send-event s3-1 'attack @@ -349,18 +345,6 @@ ;; definition for method 45 of type gun-red-3-grenade ;; INFO: Used lq/sq (defmethod check-should-explode ((this gun-red-3-grenade)) - (local-vars - (sv-1680 vector) - (sv-1684 vector) - (sv-1688 float) - (sv-1692 float) - (sv-1696 symbol) - (sv-1744 vector) - (sv-1748 vector) - (sv-1752 float) - (sv-1756 float) - (sv-1760 symbol) - ) (with-pp (let ((s4-0 (new 'stack-no-clear 'vector)) (gp-0 #f) @@ -385,29 +369,31 @@ (and (logtest? (process-mask guard) (-> a0-10 mask)) (-> *setting-control* user-current gun-target-guards?)) ) ) - (set! sv-1680 - (vector-! (new 'stack-no-clear 'vector) (get-trans (the-as process-focusable a0-10) 3) (-> this root trans)) + (let ((sv-1680 + (vector-! (new 'stack-no-clear 'vector) (get-trans (the-as process-focusable a0-10) 3) (-> this root trans)) + ) + (sv-1684 (vector-normalize-copy! (new 'stack-no-clear 'vector) (-> this root transv) 1.0)) + (sv-1688 (the-as float 0.0)) + (sv-1692 (the-as float 0.0)) + (sv-1696 (time-elapsed? (-> this birth-time) (seconds 0.05))) + ) + (set! sv-1688 (vector-normalize-ret-len! sv-1680 1.0)) + (set! sv-1692 (vector-dot sv-1680 sv-1684)) + (when (< sv-1688 (-> s4-0 w)) + (cond + ((and (< 0.0 sv-1692) sv-1696) + (set! gp-0 #t) + (set! (-> this explode-delay-time) + (the-as time-frame (min 150 (the int (* 300.0 (/ sv-1688 (vector-length (-> this root transv))) sv-1692)))) + ) + ) + ((< sv-1688 8192.0) + (return 2) + ) + ((and (not sv-1696) (< (seconds 0.05) (- (current-time) (-> this birth-time)))) + (return 2) + ) ) - (set! sv-1684 (vector-normalize-copy! (new 'stack-no-clear 'vector) (-> this root transv) 1.0)) - (set! sv-1688 (the-as float 0.0)) - (set! sv-1692 (the-as float 0.0)) - (set! sv-1696 (time-elapsed? (-> this birth-time) (seconds 0.05))) - (set! sv-1688 (vector-normalize-ret-len! sv-1680 1.0)) - (set! sv-1692 (vector-dot sv-1680 sv-1684)) - (when (< sv-1688 (-> s4-0 w)) - (cond - ((and (< 0.0 sv-1692) sv-1696) - (set! gp-0 #t) - (set! (-> this explode-delay-time) - (the-as time-frame (min 150 (the int (* 300.0 (/ sv-1688 (vector-length (-> this root transv))) sv-1692)))) - ) - ) - ((< sv-1688 8192.0) - (return 2) - ) - ((and (not sv-1696) (< (seconds 0.05) (- (current-time) (-> this birth-time)))) - (return 2) - ) ) ) ) @@ -426,27 +412,29 @@ (and (logtest? (process-mask guard) (-> s2-1 mask)) (-> *setting-control* user-current gun-target-guards?)) ) ) - (set! sv-1744 (vector-! (new 'stack-no-clear 'vector) (get-trans s2-1 3) (-> this root trans))) - (set! sv-1748 (vector-normalize-copy! (new 'stack-no-clear 'vector) (-> this root transv) 1.0)) - (set! sv-1752 (the-as float 0.0)) - (set! sv-1756 (the-as float 0.0)) - (set! sv-1760 (time-elapsed? (-> this birth-time) (seconds 0.05))) - (set! sv-1752 (vector-normalize-ret-len! sv-1744 1.0)) - (set! sv-1756 (vector-dot sv-1744 sv-1748)) - (when (< sv-1752 (-> s4-0 w)) - (cond - ((and (< 0.0 sv-1756) sv-1760) - (set! gp-0 #t) - (set! (-> this explode-delay-time) - (the-as time-frame (min 150 (the int (* 300.0 (/ sv-1752 (vector-length (-> this root transv))) sv-1756)))) - ) - ) - ((< sv-1752 8192.0) - (return 2) - ) - ((and (not sv-1760) (< (seconds 0.05) (- (current-time) (-> this birth-time)))) - (return 2) - ) + (let ((sv-1744 (vector-! (new 'stack-no-clear 'vector) (get-trans s2-1 3) (-> this root trans))) + (sv-1748 (vector-normalize-copy! (new 'stack-no-clear 'vector) (-> this root transv) 1.0)) + (sv-1752 (the-as float 0.0)) + (sv-1756 (the-as float 0.0)) + (sv-1760 (time-elapsed? (-> this birth-time) (seconds 0.05))) + ) + (set! sv-1752 (vector-normalize-ret-len! sv-1744 1.0)) + (set! sv-1756 (vector-dot sv-1744 sv-1748)) + (when (< sv-1752 (-> s4-0 w)) + (cond + ((and (< 0.0 sv-1756) sv-1760) + (set! gp-0 #t) + (set! (-> this explode-delay-time) + (the-as time-frame (min 150 (the int (* 300.0 (/ sv-1752 (vector-length (-> this root transv))) sv-1756)))) + ) + ) + ((< sv-1752 8192.0) + (return 2) + ) + ((and (not sv-1760) (< (seconds 0.05) (- (current-time) (-> this birth-time)))) + (return 2) + ) + ) ) ) ) @@ -712,96 +700,87 @@ ;; definition for method 17 of type gun-red-2-shockwave ;; INFO: Used lq/sq (defmethod find-targets-and-attack! ((this gun-red-2-shockwave)) - (local-vars - (sv-32 vector) - (sv-2672 (function vector vector float)) - (sv-2688 vector) - (sv-2704 vector) - (sv-2720 collide-query) - ) (rlet ((vf0 :class vf) (vf4 :class vf) (vf5 :class vf) (vf6 :class vf) ) (init-vf0-vector) - (set! sv-32 (new 'stack-no-clear 'vector)) - (vector-copy! sv-32 (-> this origin)) - (set! (-> sv-32 w) (-> this current-radius)) - (let ((s5-0 (new 'stack-no-clear 'array 'collide-shape 384))) - (countdown (s4-0 (fill-actor-list-for-box *actor-hash* sv-32 s5-0 384)) - (let ((v1-6 (as-type (-> s5-0 s4-0) collide-shape))) - (when v1-6 - (let ((s3-1 (as-type (-> v1-6 process) process-focusable))) - (when s3-1 - (when (and (!= *target* s3-1) - (not (focus-test? (the-as process-focusable s3-1) disable dead inactive)) - (or (logtest? (process-mask crate enemy vehicle civilian) (-> s3-1 mask)) - (and (logtest? (process-mask guard) (-> s3-1 mask)) (-> *setting-control* user-current gun-target-guards?)) - ) - ) - (let ((s2-1 #f)) - (let ((s1-0 (process->handle s3-1))) - (dotimes (v1-18 (-> this num-previously-attacked-targets)) - (when (= (-> this previously-attacked-targets v1-18) s1-0) - (set! s2-1 #t) - 0 - (goto cfg-29) - ) - ) - (label cfg-29) - (when (not s2-1) - (let ((s0-0 #f)) - (set! sv-2672 vector-vector-xz-distance-squared) - (set! sv-2688 (-> this origin)) - (let* ((a1-4 (get-trans (the-as process-focusable s3-1) 3)) - (f0-1 (sv-2672 sv-2688 a1-4)) - (f1-0 24576.0) + (let ((sv-32 (new 'stack-no-clear 'vector))) + (vector-copy! sv-32 (-> this origin)) + (set! (-> sv-32 w) (-> this current-radius)) + (let ((s5-0 (new 'stack-no-clear 'array 'collide-shape 384))) + (countdown (s4-0 (fill-actor-list-for-box *actor-hash* sv-32 s5-0 384)) + (let ((v1-6 (as-type (-> s5-0 s4-0) collide-shape))) + (when v1-6 + (let ((s3-1 (as-type (-> v1-6 process) process-focusable))) + (when s3-1 + (when (and (!= *target* s3-1) + (not (focus-test? (the-as process-focusable s3-1) disable dead inactive)) + (or (logtest? (process-mask crate enemy vehicle civilian) (-> s3-1 mask)) + (and (logtest? (process-mask guard) (-> s3-1 mask)) (-> *setting-control* user-current gun-target-guards?)) ) + ) + (let ((s2-1 #f)) + (let ((s1-0 (process->handle s3-1))) + (dotimes (v1-18 (-> this num-previously-attacked-targets)) + (when (= (-> this previously-attacked-targets v1-18) s1-0) + (set! s2-1 #t) + 0 + (goto cfg-29) + ) + ) + (label cfg-29) + (when (not s2-1) + (let ((s0-0 #f)) (cond - ((< f0-1 (* f1-0 f1-0)) + ((< (vector-vector-xz-distance-squared (-> this origin) (get-trans (the-as process-focusable s3-1) 3)) + (square 24576.0) + ) (set! s0-0 #t) ) (else - (set! sv-2720 (new 'stack-no-clear 'collide-query)) - (vector-copy! (-> sv-2720 start-pos) (-> this origin)) - (set! sv-2704 (-> sv-2720 move-dist)) - (let ((v1-35 (get-trans (the-as process-focusable s3-1) 3)) - (a0-26 (-> this origin)) + (let ((sv-2720 (new 'stack-no-clear 'collide-query))) + (vector-copy! (-> sv-2720 start-pos) (-> this origin)) + (let ((sv-2704 (-> sv-2720 move-dist))) + (let ((v1-35 (get-trans (the-as process-focusable s3-1) 3)) + (a0-26 (-> this origin)) + ) + (.lvf vf4 (&-> v1-35 quad)) + (.lvf vf5 (&-> a0-26 quad)) ) - (.lvf vf4 (&-> v1-35 quad)) - (.lvf vf5 (&-> a0-26 quad)) - ) - (.mov.vf.w vf6 vf0) - (.sub.vf.xyz vf6 vf4 vf5) - (.svf (&-> sv-2704 quad) vf6) - (let ((v1-37 sv-2720)) - (set! (-> v1-37 radius) 40.96) - (set! (-> v1-37 collide-with) (collide-spec backgnd)) - (set! (-> v1-37 ignore-process0) #f) - (set! (-> v1-37 ignore-process1) #f) - (set! (-> v1-37 ignore-pat) - (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) - ) - (set! (-> v1-37 action-mask) (collide-action solid)) - ) - (if (= (fill-and-probe-using-line-sphere *collide-cache* sv-2720) -100000000.0) - (set! s0-0 #t) + (.mov.vf.w vf6 vf0) + (.sub.vf.xyz vf6 vf4 vf5) + (.svf (&-> sv-2704 quad) vf6) ) + (let ((v1-37 sv-2720)) + (set! (-> v1-37 radius) 40.96) + (set! (-> v1-37 collide-with) (collide-spec backgnd)) + (set! (-> v1-37 ignore-process0) #f) + (set! (-> v1-37 ignore-process1) #f) + (set! (-> v1-37 ignore-pat) + (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) + ) + (set! (-> v1-37 action-mask) (collide-action solid)) + ) + (if (= (fill-and-probe-using-line-sphere *collide-cache* sv-2720) -100000000.0) + (set! s0-0 #t) + ) + ) ) ) - ) - (when s0-0 - (send-attack! this (the-as process-focusable s3-1) #t) - (set! (-> this previously-attacked-targets (-> this num-previously-attacked-targets)) (the-as handle s1-0)) - (+! (-> this num-previously-attacked-targets) 1) + (when s0-0 + (send-attack! this (the-as process-focusable s3-1) #t) + (set! (-> this previously-attacked-targets (-> this num-previously-attacked-targets)) (the-as handle s1-0)) + (+! (-> this num-previously-attacked-targets) 1) + ) ) ) ) + (if (and s2-1 (logtest? (process-mask vehicle) (-> s3-1 mask))) + (send-attack! this (the-as process-focusable s3-1) #f) + ) ) - (if (and s2-1 (logtest? (process-mask vehicle) (-> s3-1 mask))) - (send-attack! this (the-as process-focusable s3-1) #f) - ) ) ) ) @@ -809,32 +788,28 @@ ) ) ) - ) - (let ((s5-1 (the-as target (as-type *target* process-focusable)))) - (when (and s5-1 (< (vector-vector-distance (get-trans s5-1 0) sv-32) (-> sv-32 w))) - (when (and (!= *target* s5-1) - (not (focus-test? s5-1 disable dead inactive)) - (or (logtest? (process-mask crate enemy vehicle civilian) (-> s5-1 mask)) - (and (logtest? (process-mask guard) (-> s5-1 mask)) (-> *setting-control* user-current gun-target-guards?)) - ) - ) - (let ((s4-3 #f)) - (let ((s3-2 (process->handle s5-1))) - (dotimes (v1-68 (-> this num-previously-attacked-targets)) - (when (= (-> this previously-attacked-targets v1-68) s3-2) - (set! s4-3 #t) - 0 - (goto cfg-71) + (let ((s5-1 (the-as target (as-type *target* process-focusable)))) + (when (and s5-1 (< (vector-vector-distance (get-trans s5-1 0) sv-32) (-> sv-32 w))) + (when (and (!= *target* s5-1) + (not (focus-test? s5-1 disable dead inactive)) + (or (logtest? (process-mask crate enemy vehicle civilian) (-> s5-1 mask)) + (and (logtest? (process-mask guard) (-> s5-1 mask)) (-> *setting-control* user-current gun-target-guards?)) + ) + ) + (let ((s4-3 #f)) + (let ((s3-2 (process->handle s5-1))) + (dotimes (v1-68 (-> this num-previously-attacked-targets)) + (when (= (-> this previously-attacked-targets v1-68) s3-2) + (set! s4-3 #t) + 0 + (goto cfg-71) + ) ) - ) - (label cfg-71) - (when (not s4-3) - (let ((s2-2 #f)) - (let ((f0-5 (vector-vector-xz-distance-squared (-> this origin) (get-trans s5-1 3))) - (f1-5 24576.0) - ) + (label cfg-71) + (when (not s4-3) + (let ((s2-2 #f)) (cond - ((< f0-5 (* f1-5 f1-5)) + ((< (vector-vector-xz-distance-squared (-> this origin) (get-trans s5-1 3)) (square 24576.0)) (set! s2-2 #t) ) (else @@ -857,18 +832,18 @@ ) ) ) - ) - (when s2-2 - (send-attack! this s5-1 #t) - (set! (-> this previously-attacked-targets (-> this num-previously-attacked-targets)) (the-as handle s3-2)) - (+! (-> this num-previously-attacked-targets) 1) + (when s2-2 + (send-attack! this s5-1 #t) + (set! (-> this previously-attacked-targets (-> this num-previously-attacked-targets)) (the-as handle s3-2)) + (+! (-> this num-previously-attacked-targets) 1) + ) ) ) ) + (if (and s4-3 (logtest? (process-mask vehicle) (-> s5-1 mask))) + (send-attack! this s5-1 #f) + ) ) - (if (and s4-3 (logtest? (process-mask vehicle) (-> s5-1 mask))) - (send-attack! this s5-1 #f) - ) ) ) ) @@ -1122,90 +1097,91 @@ ;; WARN: Stack slot offset 564 signed mismatch ;; WARN: Stack slot offset 564 signed mismatch (defmethod find-collision-point! ((this gun-red-2-shockwave)) - (local-vars (sv-560 collide-query) (sv-564 int) (sv-608 vector) (sv-612 vector) (sv-616 float)) (if (>= (-> this next-computed-collision-point) (-> this num-collision-pts-to-generate)) (return 0) ) - (set! sv-560 (new 'stack-no-clear 'collide-query)) - (set! sv-564 (-> this num-collision-pts-to-generate)) - (set! sv-608 (new 'stack-no-clear 'vector)) - (set! sv-612 (new 'stack-no-clear 'vector)) - (set! sv-616 (/ 65536.0 (the float (+ sv-564 -1)))) - (let ((f30-1 - (+ (* sv-616 (the float (-> this generate-order-array (-> this next-computed-collision-point)))) - (rand-vu-float-range (* -0.43478262 sv-616) (* 0.43478262 sv-616)) - ) - ) + (let ((sv-560 (new 'stack-no-clear 'collide-query)) + (sv-564 (-> this num-collision-pts-to-generate)) + (sv-608 (new 'stack-no-clear 'vector)) + (sv-612 (new 'stack-no-clear 'vector)) ) - (set! (-> this eventual-collision-points (-> this next-computed-collision-point) angle) f30-1) - (set-vector! - sv-608 - (* (rand-vu-float-range 0.7 0.9) (-> this max-ground-radius) (cos f30-1)) - 32768.0 - (* (rand-vu-float-range 0.7 0.9) (-> this max-ground-radius) (sin f30-1)) - 1.0 - ) - ) - (vector+! (-> sv-560 start-pos) (-> this origin) sv-608) - (set! (-> sv-560 start-pos y) (- (-> sv-560 start-pos y) (-> this height-off-ground))) - (+! (-> sv-560 start-pos y) 20480.0) - (set-vector! (-> sv-560 move-dist) 0.0 -65536.0 0.0 1.0) - (let ((v1-29 sv-560)) - (set! (-> v1-29 radius) 40.96) - (set! (-> v1-29 collide-with) (collide-spec backgnd hit-by-others-list pusher impenetrable-obj)) - (set! (-> v1-29 ignore-process0) #f) - (set! (-> v1-29 ignore-process1) #f) - (set! (-> v1-29 ignore-pat) - (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) - ) - (set! (-> v1-29 action-mask) (collide-action solid)) - ) - (let ((f0-25 (fill-and-probe-using-line-sphere *collide-cache* sv-560))) - (when (>= f0-25 0.0) - (vector+*! sv-612 (-> sv-560 start-pos) (-> sv-560 move-dist) f0-25) - (set! (-> this eventual-collision-points (-> this next-computed-collision-point) collision-pt quad) - (-> sv-612 quad) - ) - (+! (-> this eventual-collision-points (-> this next-computed-collision-point) collision-pt y) 204.8) - (set! (-> this eventual-collision-points (-> this next-computed-collision-point) found?) #t) - (set! (-> (the-as - (pointer uint128) - (+ (the-as uint (-> this eventual-collision-points 0 normal)) (* 48 (-> this next-computed-collision-point))) - ) + (let* ((sv-616 (/ 65536.0 (the float (+ sv-564 -1)))) + (f30-1 + (+ (* sv-616 (the float (-> this generate-order-array (-> this next-computed-collision-point)))) + (rand-vu-float-range (* -0.43478262 sv-616) (* 0.43478262 sv-616)) ) - (-> sv-560 best-other-tri normal quad) + ) + ) + (set! (-> this eventual-collision-points (-> this next-computed-collision-point) angle) f30-1) + (set-vector! + sv-608 + (* (rand-vu-float-range 0.7 0.9) (-> this max-ground-radius) (cos f30-1)) + 32768.0 + (* (rand-vu-float-range 0.7 0.9) (-> this max-ground-radius) (sin f30-1)) + 1.0 + ) + ) + (vector+! (-> sv-560 start-pos) (-> this origin) sv-608) + (set! (-> sv-560 start-pos y) (- (-> sv-560 start-pos y) (-> this height-off-ground))) + (+! (-> sv-560 start-pos y) 20480.0) + (set-vector! (-> sv-560 move-dist) 0.0 -65536.0 0.0 1.0) + (let ((v1-29 sv-560)) + (set! (-> v1-29 radius) 40.96) + (set! (-> v1-29 collide-with) (collide-spec backgnd hit-by-others-list pusher impenetrable-obj)) + (set! (-> v1-29 ignore-process0) #f) + (set! (-> v1-29 ignore-process1) #f) + (set! (-> v1-29 ignore-pat) + (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) ) - (let ((s5-1 (new 'stack-no-clear 'vector)) - (s4-0 (new 'stack-no-clear 'vector)) - (s3-1 (vector-float*! (new 'stack-no-clear 'vector) (-> sv-560 best-other-tri normal) 3072.0)) - ) - (let ((s2-0 (vector-normalize-copy! (new 'stack-no-clear 'vector) (-> sv-560 best-other-tri normal) 1.0)) - (s1-0 (new 'stack-no-clear 'vector)) + (set! (-> v1-29 action-mask) (collide-action solid)) + ) + (let ((f0-25 (fill-and-probe-using-line-sphere *collide-cache* sv-560))) + (when (>= f0-25 0.0) + (vector+*! sv-612 (-> sv-560 start-pos) (-> sv-560 move-dist) f0-25) + (set! (-> this eventual-collision-points (-> this next-computed-collision-point) collision-pt quad) + (-> sv-612 quad) ) - (vector-get-unique! s1-0 s2-0) - (vector-cross! s5-1 s2-0 s1-0) - ) - (vector-normalize! s5-1 1.0) - (dotimes (s2-1 4) - (vector-rotate-around-axis! s4-0 s5-1 (* 16384.0 (the float s2-1)) (-> sv-560 best-other-tri normal)) - (vector-normalize! s4-0 10240.0) - (vector+! s4-0 s4-0 s3-1) - (vector+! (-> sv-560 start-pos) sv-612 s4-0) - (vector-float*! (-> sv-560 move-dist) (-> sv-560 best-other-tri normal) -6144.0) - (let ((v1-60 sv-560)) - (set! (-> v1-60 radius) 40.96) - (set! (-> v1-60 collide-with) (collide-spec backgnd hit-by-others-list pusher impenetrable-obj)) - (set! (-> v1-60 ignore-process0) #f) - (set! (-> v1-60 ignore-process1) #f) - (set! (-> v1-60 ignore-pat) - (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) + (+! (-> this eventual-collision-points (-> this next-computed-collision-point) collision-pt y) 204.8) + (set! (-> this eventual-collision-points (-> this next-computed-collision-point) found?) #t) + (set! (-> (the-as + (pointer uint128) + (+ (the-as uint (-> this eventual-collision-points 0 normal)) (* 48 (-> this next-computed-collision-point))) + ) ) - (set! (-> v1-60 action-mask) (collide-action solid)) + (-> sv-560 best-other-tri normal quad) + ) + (let ((s5-1 (new 'stack-no-clear 'vector)) + (s4-0 (new 'stack-no-clear 'vector)) + (s3-1 (vector-float*! (new 'stack-no-clear 'vector) (-> sv-560 best-other-tri normal) 3072.0)) + ) + (let ((s2-0 (vector-normalize-copy! (new 'stack-no-clear 'vector) (-> sv-560 best-other-tri normal) 1.0)) + (s1-0 (new 'stack-no-clear 'vector)) + ) + (vector-get-unique! s1-0 s2-0) + (vector-cross! s5-1 s2-0 s1-0) ) - (when (< (fill-and-probe-using-line-sphere *collide-cache* sv-560) 0.0) - (set! (-> this eventual-collision-points (-> this next-computed-collision-point) found?) #f) - 0 - (goto cfg-11) + (vector-normalize! s5-1 1.0) + (dotimes (s2-1 4) + (vector-rotate-around-axis! s4-0 s5-1 (* 16384.0 (the float s2-1)) (-> sv-560 best-other-tri normal)) + (vector-normalize! s4-0 10240.0) + (vector+! s4-0 s4-0 s3-1) + (vector+! (-> sv-560 start-pos) sv-612 s4-0) + (vector-float*! (-> sv-560 move-dist) (-> sv-560 best-other-tri normal) -6144.0) + (let ((v1-60 sv-560)) + (set! (-> v1-60 radius) 40.96) + (set! (-> v1-60 collide-with) (collide-spec backgnd hit-by-others-list pusher impenetrable-obj)) + (set! (-> v1-60 ignore-process0) #f) + (set! (-> v1-60 ignore-process1) #f) + (set! (-> v1-60 ignore-pat) + (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) + ) + (set! (-> v1-60 action-mask) (collide-action solid)) + ) + (when (< (fill-and-probe-using-line-sphere *collide-cache* sv-560) 0.0) + (set! (-> this eventual-collision-points (-> this next-computed-collision-point) found?) #f) + 0 + (goto cfg-11) + ) ) ) ) @@ -1380,7 +1356,6 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch symbol vs none. (defmethod generate-shockwave-particles ((this gun-red-2-shockwave)) - (local-vars (sv-160 int) (sv-176 shockwave-collision-pt)) (when (and (not (-> this generated-particles?)) (time-elapsed? (-> this state-time) (seconds 0.067))) (set! (-> this generated-particles?) #t) (dotimes (s5-0 150) @@ -1401,28 +1376,30 @@ (s2-1 (new 'stack-no-clear 'vector)) (s1-0 (new 'stack-no-clear 'vector)) ) - (set! sv-160 0) - (while (< sv-160 (-> this next-computed-collision-point)) - (set! sv-176 (-> this eventual-collision-points sv-160)) - (when (-> sv-176 found?) - (let ((f0-9 (deg- (-> sv-176 angle) f26-0))) - (cond - ((and (< f0-9 0.0) (< f24-0 f0-9)) - (set! f24-0 f0-9) - (set! f30-0 (-> sv-176 collision-pt y)) - (set! s0-0 (logior s0-0 1)) - (vector-copy! s2-1 (-> sv-176 normal)) - ) - ((and (>= f0-9 0.0) (< f0-9 f22-0)) - (set! f22-0 f0-9) - (set! f28-0 (-> sv-176 collision-pt y)) - (set! s0-0 (logior s0-0 2)) - (vector-copy! s1-0 (-> sv-176 normal)) - ) + (let ((sv-160 0)) + (while (< sv-160 (-> this next-computed-collision-point)) + (let ((sv-176 (-> this eventual-collision-points sv-160))) + (when (-> sv-176 found?) + (let ((f0-9 (deg- (-> sv-176 angle) f26-0))) + (cond + ((and (< f0-9 0.0) (< f24-0 f0-9)) + (set! f24-0 f0-9) + (set! f30-0 (-> sv-176 collision-pt y)) + (set! s0-0 (logior s0-0 1)) + (vector-copy! s2-1 (-> sv-176 normal)) + ) + ((and (>= f0-9 0.0) (< f0-9 f22-0)) + (set! f22-0 f0-9) + (set! f28-0 (-> sv-176 collision-pt y)) + (set! s0-0 (logior s0-0 2)) + (vector-copy! s1-0 (-> sv-176 normal)) + ) + ) + ) ) ) + (+! sv-160 1) ) - (set! sv-160 (+ sv-160 1)) ) (let ((f26-1 0.0)) (cond @@ -1464,10 +1441,11 @@ ;; definition for method 24 of type gun-red-2-shockwave (defmethod adjust-warp-radius-and-alpha ((this gun-red-2-shockwave)) (let* ((f0-1 (/ (-> this max-radius) (-> this max-charge-radius))) - (f0-3 - (/ (the float (- (current-time) (-> this state-time))) (* f0-1 (the float (-> this warp-expansion-time)))) + (f0-4 + (square + (/ (the float (- (current-time) (-> this state-time))) (* f0-1 (the float (-> this warp-expansion-time)))) + ) ) - (f0-4 (* f0-3 f0-3)) ) (set! (-> this current-warp-radius) (lerp (-> this min-charge-radius) (-> this max-radius) f0-4)) ) @@ -1625,7 +1603,7 @@ (/ (-> self max-radius) (-> self max-charge-radius)) (let ((f0-15 (/ (-> self max-radius) (meters 20)))) 0.0 - (let ((f1-5 (/ (* 2.0 (- (* 163840.0 f0-15) (-> self max-radius))) (* f0-15 f0-15)))) + (let ((f1-5 (/ (* 2.0 (- (* 163840.0 f0-15) (-> self max-radius))) (square f0-15)))) (set! (-> *part-id-table* 353 init-specs 9 initial-valuef) (* 1.2 f1-5)) ) (let ((v1-15 (the int (* 150.0 f0-15)))) @@ -1868,101 +1846,82 @@ ;; ERROR: Unsupported inline assembly instruction kind - [madda.s f2, f5] ;; ERROR: Unsupported inline assembly instruction kind - [madd.s f1, f3, f6] (defbehavior gun-fire-red-3 target () - (local-vars - (f1-2 float) - (sv-16 gun-info) - (sv-20 vector) - (sv-24 vector) - (sv-28 float) - (sv-144 vector) - (sv-148 vector) - (sv-1952 vector) - (sv-1968 vector) - ) - (set! sv-16 (-> self gun)) - (set! sv-20 (-> self gun fire-dir-out)) - (set! sv-24 (-> self gun fire-point)) - (set! sv-28 (the-as float 266240.0)) - (draw-beam (-> *part-id-table* 217) sv-24 sv-20 #f) - (set! (-> sv-20 y) (fmax 0.3 (-> sv-20 y))) - (vector-normalize! sv-20 1.0) - (let ((v1-17 (cond - ((logtest? (-> group-gun-red3-shot-fired flags) (sp-group-flag sp13)) - (vector-copy! (-> *launch-matrix* trans) (-> sv-16 fire-point)) - (part-tracker-spawn part-tracker-subsampler :to *entity-pool* :group group-gun-red3-shot-fired) - ) - (else - (vector-copy! (-> *launch-matrix* trans) (-> sv-16 fire-point)) - (part-tracker-spawn part-tracker :to *entity-pool* :group group-gun-red3-shot-fired) + (local-vars (f1-2 float)) + (let ((sv-16 (-> self gun)) + (sv-20 (-> self gun fire-dir-out)) + (sv-24 (-> self gun fire-point)) + (sv-28 (the-as float 266240.0)) + ) + (draw-beam (-> *part-id-table* 217) sv-24 sv-20 #f) + (set! (-> sv-20 y) (fmax 0.3 (-> sv-20 y))) + (vector-normalize! sv-20 1.0) + (let ((v1-17 (cond + ((logtest? (-> group-gun-red3-shot-fired flags) (sp-group-flag sp13)) + (vector-copy! (-> *launch-matrix* trans) (-> sv-16 fire-point)) + (part-tracker-spawn part-tracker-subsampler :to *entity-pool* :group group-gun-red3-shot-fired) + ) + (else + (vector-copy! (-> *launch-matrix* trans) (-> sv-16 fire-point)) + (part-tracker-spawn part-tracker :to *entity-pool* :group group-gun-red3-shot-fired) + ) ) ) - ) - ) - (send-event (ppointer->process v1-17) 'clock self) - ) - (set! sv-144 (new 'stack-no-clear 'vector)) - (let ((v1-42 (new 'stack-no-clear 'vector))) - (vector-copy! v1-42 sv-20) - (set! sv-148 v1-42) - ) - (set! (-> sv-148 y) 0.0) - (vector-normalize! sv-148 1.0) - (vector+float*! sv-144 sv-24 sv-148 143360.0) - (set! (-> sv-144 w) 143360.0) - (let ((f30-0 4096000.0) - (s5-0 #f) - (gp-2 (the-as process-focusable #f)) - ) - (let ((a1-11 (new 'stack-no-clear 'event-message-block))) - (set! (-> a1-11 from) (process->ppointer self)) - (set! (-> a1-11 num-params) 0) - (set! (-> a1-11 message) 'get-vehicle) - (let ((s4-0 (send-event-function *target* a1-11))) - (let ((s3-0 (new 'stack-no-clear 'array 'collide-shape 384))) - (countdown (s2-0 (fill-actor-list-for-box *actor-hash* sv-144 s3-0 384)) - (let ((v1-54 (as-type (-> s3-0 s2-0) collide-shape))) - (when v1-54 - (let ((s1-1 (as-type (-> v1-54 process) process-focusable))) - (when s1-1 - (when (and (!= *target* s1-1) - (not (focus-test? (the-as process-focusable s1-1) disable dead inactive gun-no-target)) - (or (logtest? (process-mask crate enemy vehicle civilian) (-> s1-1 mask)) - (and (logtest? (process-mask guard) (-> s1-1 mask)) (-> *setting-control* user-current gun-target-guards?)) - ) - (!= s4-0 s1-1) - ) - (when (or (not s5-0) (logtest? (process-mask enemy guard) (-> s1-1 mask))) - (set! sv-1952 (new 'stack-no-clear 'vector)) - (let ((v1-71 (-> (get-trans (the-as process-focusable s1-1) 0) quad))) - (set! (-> sv-1952 quad) v1-71) - ) - (set! sv-1968 (vector-normalize-copy! (new 'stack-no-clear 'vector) sv-148 1.0)) - (let ((s0-1 (new 'stack-no-clear 'vector))) - (let ((a1-18 s0-1) - (v1-72 sv-24) - ) - (vector-! a1-18 sv-1952 v1-72) - ) - (let ((f0-7 (vector-normalize-ret-len! s0-1 1.0))) - (let* ((v1-73 s0-1) - (f1-1 (-> sv-1968 x)) - (f2-0 (-> sv-1968 y)) - (f3-0 (-> sv-1968 z)) - (f4-0 (-> v1-73 x)) - (f5-0 (-> v1-73 y)) - (f6-0 (-> v1-73 z)) - ) - (.mula.s f1-1 f4-0) - (.madda.s f2-0 f5-0) - (.madd.s f1-2 f3-0 f6-0) - ) - (let ((f1-3 f1-2) - (v1-75 (and (not s5-0) (logtest? (process-mask enemy guard) (-> s1-1 mask)))) + ) + (send-event (ppointer->process v1-17) 'clock self) + ) + (let ((sv-144 (new 'stack-no-clear 'vector)) + (v1-42 (new 'stack-no-clear 'vector)) + ) + (vector-copy! v1-42 sv-20) + (let ((sv-148 v1-42)) + (set! (-> sv-148 y) 0.0) + (vector-normalize! sv-148 1.0) + (vector+float*! sv-144 sv-24 sv-148 143360.0) + (set! (-> sv-144 w) 143360.0) + (let ((f30-0 4096000.0) + (s5-0 #f) + (gp-2 (the-as process-focusable #f)) + ) + (let ((a1-11 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-11 from) (process->ppointer self)) + (set! (-> a1-11 num-params) 0) + (set! (-> a1-11 message) 'get-vehicle) + (let ((s4-0 (send-event-function *target* a1-11))) + (let ((s3-0 (new 'stack-no-clear 'array 'collide-shape 384))) + (countdown (s2-0 (fill-actor-list-for-box *actor-hash* sv-144 s3-0 384)) + (let ((v1-54 (as-type (-> s3-0 s2-0) collide-shape))) + (when v1-54 + (let ((s1-1 (as-type (-> v1-54 process) process-focusable))) + (when s1-1 + (when (and (!= *target* s1-1) + (not (focus-test? (the-as process-focusable s1-1) disable dead inactive gun-no-target)) + (or (logtest? (process-mask crate enemy vehicle civilian) (-> s1-1 mask)) + (and (logtest? (process-mask guard) (-> s1-1 mask)) (-> *setting-control* user-current gun-target-guards?)) + ) + (!= s4-0 s1-1) + ) + (when (or (not s5-0) (logtest? (process-mask enemy guard) (-> s1-1 mask))) + (let ((sv-1952 (new 'stack-no-clear 'vector))) + (vector-copy! sv-1952 (get-trans (the-as process-focusable s1-1) 0)) + (let ((sv-1968 (vector-normalize-copy! (new 'stack-no-clear 'vector) sv-148 1.0)) + (s0-1 (new 'stack-no-clear 'vector)) + ) + (vector-! s0-1 sv-1952 sv-24) + (let ((f0-7 (vector-normalize-ret-len! s0-1 1.0))) + (let* ((v1-73 s0-1)) + (set! f1-2 (vector-dot sv-1968 v1-73)) + ) + (let ((f1-3 f1-2) + (v1-75 (and (not s5-0) (logtest? (process-mask enemy guard) (-> s1-1 mask)))) + ) + (when (and (< 0.707 f1-3) (< (fabs (-> s0-1 y)) 28672.0) (or v1-75 (< f0-7 f30-0))) + (set! s5-0 v1-75) + (set! f30-0 f0-7) + (set! gp-2 (the-as process-focusable s1-1)) + ) + ) + ) ) - (when (and (< 0.707 f1-3) (< (fabs (-> s0-1 y)) 28672.0) (or v1-75 (< f0-7 f30-0))) - (set! s5-0 v1-75) - (set! f30-0 f0-7) - (set! gp-2 (the-as process-focusable s1-1)) ) ) ) @@ -1972,79 +1931,79 @@ ) ) ) - ) - ) - ) - (let ((s3-1 (the-as target (as-type *target* process-focusable)))) - (when (and s3-1 (< (vector-vector-distance (get-trans s3-1 0) sv-144) (-> sv-144 w))) - (when (and (!= *target* s3-1) - (not (focus-test? s3-1 disable dead inactive gun-no-target)) - (or (logtest? (process-mask crate enemy vehicle civilian) (-> s3-1 mask)) - (and (logtest? (process-mask guard) (-> s3-1 mask)) (-> *setting-control* user-current gun-target-guards?)) - ) - (!= s4-0 s3-1) - ) - (when (or (not s5-0) (logtest? (process-mask enemy guard) (-> s3-1 mask))) - (let ((s1-2 (new 'stack-no-clear 'vector))) - (vector-copy! s1-2 (get-trans s3-1 0)) - (let ((s2-3 (vector-normalize-copy! (new 'stack-no-clear 'vector) sv-148 1.0)) - (s4-1 (new 'stack-no-clear 'vector)) + (let ((s3-1 (the-as target (as-type *target* process-focusable)))) + (when (and s3-1 (< (vector-vector-distance (get-trans s3-1 0) sv-144) (-> sv-144 w))) + (when (and (!= *target* s3-1) + (not (focus-test? s3-1 disable dead inactive gun-no-target)) + (or (logtest? (process-mask crate enemy vehicle civilian) (-> s3-1 mask)) + (and (logtest? (process-mask guard) (-> s3-1 mask)) (-> *setting-control* user-current gun-target-guards?)) + ) + (!= s4-0 s3-1) + ) + (when (or (not s5-0) (logtest? (process-mask enemy guard) (-> s3-1 mask))) + (let ((s1-2 (new 'stack-no-clear 'vector))) + (vector-copy! s1-2 (get-trans s3-1 0)) + (let ((s2-3 (vector-normalize-copy! (new 'stack-no-clear 'vector) sv-148 1.0)) + (s4-1 (new 'stack-no-clear 'vector)) + ) + (vector-! s4-1 s1-2 sv-24) + (let ((f0-9 (vector-normalize-ret-len! s4-1 1.0)) + (f1-8 (vector-dot s2-3 s4-1)) + (v1-101 (and (not s5-0) (logtest? (process-mask enemy guard) (-> s3-1 mask)))) + ) + (if (and (< 0.707 f1-8) (< (fabs (-> s4-1 y)) 28672.0) (or v1-101 (< f0-9 f0-9))) + (set! gp-2 s3-1) + ) + ) + ) ) - (vector-! s4-1 s1-2 sv-24) - (let ((f0-9 (vector-normalize-ret-len! s4-1 1.0)) - (f1-8 (vector-dot s2-3 s4-1)) - (v1-101 (and (not s5-0) (logtest? (process-mask enemy guard) (-> s3-1 mask)))) - ) - (if (and (< 0.707 f1-8) (< (fabs (-> s4-1 y)) 28672.0) (or v1-101 (< f0-9 f0-9))) - (set! gp-2 s3-1) - ) ) ) ) ) ) ) + (when gp-2 + (let ((s5-1 (new 'stack-no-clear 'vector))) + (vector-copy! s5-1 (get-trans gp-2 3)) + (let ((f0-10 (vector-vector-xz-distance s5-1 (-> sv-16 fire-point))) + (f1-13 (fabs (- (-> s5-1 y) (-> sv-16 fire-point y)))) + ) + 0.0 + (when (< f1-13 24576.0) + (let ((f0-14 (* 0.5 (asin (/ (* 184320.0 f0-10) (* sv-28 sv-28)))))) + (set! (-> sv-20 y) (sin f0-14)) + ) + (vector-normalize! sv-20 1.0) + ) + ) + ) + ) ) ) ) - (when gp-2 - (let ((s5-1 (new 'stack-no-clear 'vector))) - (vector-copy! s5-1 (get-trans gp-2 3)) - (let ((f0-10 (vector-vector-xz-distance s5-1 (-> sv-16 fire-point))) - (f1-13 (fabs (- (-> s5-1 y) (-> sv-16 fire-point y)))) - ) - 0.0 - (when (< f1-13 24576.0) - (let ((f0-14 (* 0.5 (asin (/ (* 184320.0 f0-10) (* sv-28 sv-28)))))) - (set! (-> sv-20 y) (sin f0-14)) - ) - (vector-normalize! sv-20 1.0) - ) - ) + (let ((a1-33 (new 'stack-no-clear 'projectile-init-by-other-params))) + (set! (-> a1-33 ent) (-> self entity)) + (set! (-> a1-33 charge) 1.0) + (set! (-> a1-33 options) (projectile-options)) + (logclear! (-> a1-33 options) (projectile-options po14 po15 po16)) + (vector-copy! (-> a1-33 pos) sv-24) + (vector-copy! (-> a1-33 vel) (vector-float*! (new 'stack-no-clear 'vector) sv-20 sv-28)) + (set! (-> a1-33 notify-handle) (the-as handle #f)) + (set! (-> a1-33 owner-handle) (process->handle self)) + (set! (-> a1-33 target-handle) (the-as handle #f)) + (set! (-> a1-33 target-pos quad) (the-as uint128 0)) + (set! (-> a1-33 ignore-handle) (process->handle self)) + (let* ((v1-127 *game-info*) + (a0-100 (+ (-> v1-127 attack-id) 1)) + ) + (set! (-> v1-127 attack-id) a0-100) + (set! (-> a1-33 attack-id) a0-100) ) + (set! (-> a1-33 timeout) (seconds 4)) + (the-as gun-red-3-grenade (spawn-projectile gun-red-3-grenade a1-33 self *default-dead-pool*)) ) ) - (let ((a1-33 (new 'stack-no-clear 'projectile-init-by-other-params))) - (set! (-> a1-33 ent) (-> self entity)) - (set! (-> a1-33 charge) 1.0) - (set! (-> a1-33 options) (projectile-options)) - (logclear! (-> a1-33 options) (projectile-options po14 po15 po16)) - (vector-copy! (-> a1-33 pos) sv-24) - (vector-copy! (-> a1-33 vel) (vector-float*! (new 'stack-no-clear 'vector) sv-20 sv-28)) - (set! (-> a1-33 notify-handle) (the-as handle #f)) - (set! (-> a1-33 owner-handle) (process->handle self)) - (set! (-> a1-33 target-handle) (the-as handle #f)) - (set! (-> a1-33 target-pos quad) (the-as uint128 0)) - (set! (-> a1-33 ignore-handle) (process->handle self)) - (let* ((v1-127 *game-info*) - (a0-100 (+ (-> v1-127 attack-id) 1)) - ) - (set! (-> v1-127 attack-id) a0-100) - (set! (-> a1-33 attack-id) a0-100) - ) - (set! (-> a1-33 timeout) (seconds 4)) - (the-as gun-red-3-grenade (spawn-projectile gun-red-3-grenade a1-33 self *default-dead-pool*)) - ) ) ;; definition for method 39 of type gun-red-3-grenade @@ -2464,14 +2423,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)) ) ) ) @@ -2505,14 +2460,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/jak3/engine/target/gun/gun-yellow-shot_REF.gc b/test/decompiler/reference/jak3/engine/target/gun/gun-yellow-shot_REF.gc index f8f82afcb8..e150e212c7 100644 --- a/test/decompiler/reference/jak3/engine/target/gun/gun-yellow-shot_REF.gc +++ b/test/decompiler/reference/jak3/engine/target/gun/gun-yellow-shot_REF.gc @@ -284,17 +284,6 @@ ;; definition for method 52 of type gun-yellow-3-saucer ;; INFO: Used lq/sq (defmethod find-targets ((this gun-yellow-3-saucer)) - (local-vars - (sv-16 int) - (sv-1072 vector) - (sv-1076 (inline-array target-quality-info-saucer)) - (sv-1080 int) - (sv-1088 float) - (sv-3792 (pointer int8)) - (sv-3800 int) - (sv-3808 float) - (sv-3812 symbol) - ) (if (not (-> this firing?)) (return 0) ) @@ -313,54 +302,56 @@ ) (set-time! (-> this last-deduct-ammo-time)) ) - (set! sv-16 2) - (set! sv-1072 (new 'stack-no-clear 'vector)) - (set! sv-1076 (new 'stack-no-clear 'inline-array 'target-quality-info-saucer 66)) - (set! sv-1080 0) - (set! sv-1088 (the-as float 0.0)) - (vector-copy! sv-1072 (-> this root trans)) - (set! (-> sv-1072 w) 143360.0) - (let ((s5-0 (new 'stack-no-clear 'array 'collide-shape 384))) - (countdown (s4-0 (fill-actor-list-for-box *actor-hash* sv-1072 s5-0 384)) - (let ((v1-34 (as-type (-> s5-0 s4-0) collide-shape))) - (when v1-34 - (let ((s3-1 (as-type (-> v1-34 process) process-focusable))) - (when s3-1 - (when (and (!= *target* s3-1) - (not (focus-test? (the-as process-focusable s3-1) disable dead inactive gun-no-target)) - (or (logtest? (process-mask enemy vehicle civilian) (-> s3-1 mask)) - (and (logtest? (process-mask guard) (-> s3-1 mask)) (-> *setting-control* user-current gun-target-guards?)) - ) - ) - (let ((s2-1 (new 'stack-no-clear 'collide-query))) - (vector-copy! (-> s2-1 start-pos) (-> this root trans)) - (vector-! (-> s2-1 move-dist) (get-trans (the-as process-focusable s3-1) 3) (-> this root trans)) - (let ((v1-47 s2-1)) - (set! (-> v1-47 radius) 40.96) - (set! (-> v1-47 collide-with) (collide-spec backgnd)) - (set! (-> v1-47 ignore-process0) #f) - (set! (-> v1-47 ignore-process1) #f) - (set! (-> v1-47 ignore-pat) - (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) - ) - (set! (-> v1-47 action-mask) (collide-action solid)) - ) - (when (< (fill-and-probe-using-line-sphere *collide-cache* s2-1) 0.0) - (set! (-> sv-1076 sv-1080 targ) (process->handle s3-1)) - (let ((f0-11 1.0)) - (if (and (nonzero? (-> s3-1 draw)) (logtest? (-> s3-1 draw status) (draw-control-status on-screen))) - (set! f0-11 (+ 2.0 f0-11)) - ) - (if (logtest? (process-mask enemy guard) (-> s3-1 mask)) - (set! f0-11 (+ 28.0 f0-11)) - ) - (if (logtest? (process-mask vehicle civilian) (-> s3-1 mask)) - (set! f0-11 (/ f0-11 4)) - ) - (set! (-> sv-1076 sv-1080 value) f0-11) - (set! sv-1088 (+ sv-1088 f0-11)) + (let ((sv-16 2) + (sv-1072 (new 'stack-no-clear 'vector)) + (sv-1076 (new 'stack-no-clear 'inline-array 'target-quality-info-saucer 66)) + (sv-1080 0) + (sv-1088 (the-as float 0.0)) + ) + (vector-copy! sv-1072 (-> this root trans)) + (set! (-> sv-1072 w) 143360.0) + (let ((s5-0 (new 'stack-no-clear 'array 'collide-shape 384))) + (countdown (s4-0 (fill-actor-list-for-box *actor-hash* sv-1072 s5-0 384)) + (let ((v1-34 (as-type (-> s5-0 s4-0) collide-shape))) + (when v1-34 + (let ((s3-1 (as-type (-> v1-34 process) process-focusable))) + (when s3-1 + (when (and (!= *target* s3-1) + (not (focus-test? (the-as process-focusable s3-1) disable dead inactive gun-no-target)) + (or (logtest? (process-mask enemy vehicle civilian) (-> s3-1 mask)) + (and (logtest? (process-mask guard) (-> s3-1 mask)) (-> *setting-control* user-current gun-target-guards?)) + ) + ) + (let ((s2-1 (new 'stack-no-clear 'collide-query))) + (vector-copy! (-> s2-1 start-pos) (-> this root trans)) + (vector-! (-> s2-1 move-dist) (get-trans (the-as process-focusable s3-1) 3) (-> this root trans)) + (let ((v1-47 s2-1)) + (set! (-> v1-47 radius) 40.96) + (set! (-> v1-47 collide-with) (collide-spec backgnd)) + (set! (-> v1-47 ignore-process0) #f) + (set! (-> v1-47 ignore-process1) #f) + (set! (-> v1-47 ignore-pat) + (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) + ) + (set! (-> v1-47 action-mask) (collide-action solid)) + ) + (when (< (fill-and-probe-using-line-sphere *collide-cache* s2-1) 0.0) + (set! (-> sv-1076 sv-1080 targ) (process->handle s3-1)) + (let ((f0-11 1.0)) + (if (and (nonzero? (-> s3-1 draw)) (logtest? (-> s3-1 draw status) (draw-control-status on-screen))) + (set! f0-11 (+ 2.0 f0-11)) + ) + (if (logtest? (process-mask enemy guard) (-> s3-1 mask)) + (set! f0-11 (+ 28.0 f0-11)) + ) + (if (logtest? (process-mask vehicle civilian) (-> s3-1 mask)) + (set! f0-11 (/ f0-11 4)) + ) + (set! (-> sv-1076 sv-1080 value) f0-11) + (+! sv-1088 f0-11) + ) + (+! sv-1080 1) ) - (set! sv-1080 (+ sv-1080 1)) ) ) ) @@ -369,98 +360,102 @@ ) ) ) - ) - (let ((s5-1 (the-as target (as-type *target* process-focusable)))) - (when (and s5-1 (< (vector-vector-distance (get-trans s5-1 0) sv-1072) (-> sv-1072 w))) - (when (and (!= *target* s5-1) - (not (focus-test? s5-1 disable dead inactive gun-no-target)) - (or (logtest? (process-mask enemy vehicle civilian) (-> s5-1 mask)) - (and (logtest? (process-mask guard) (-> s5-1 mask)) (-> *setting-control* user-current gun-target-guards?)) - ) - ) - (let ((s4-3 (new 'stack-no-clear 'collide-query))) - (vector-copy! (-> s4-3 start-pos) (-> this root trans)) - (vector-! (-> s4-3 move-dist) (get-trans s5-1 3) (-> this root trans)) - (let ((v1-94 s4-3)) - (set! (-> v1-94 radius) 40.96) - (set! (-> v1-94 collide-with) (collide-spec backgnd)) - (set! (-> v1-94 ignore-process0) #f) - (set! (-> v1-94 ignore-process1) #f) - (set! (-> v1-94 ignore-pat) - (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) - ) - (set! (-> v1-94 action-mask) (collide-action solid)) - ) - (when (< (fill-and-probe-using-line-sphere *collide-cache* s4-3) 0.0) - (set! (-> sv-1076 sv-1080 targ) (process->handle s5-1)) - (let ((f0-16 1.0)) - (if (and (nonzero? (-> s5-1 draw)) (logtest? (-> s5-1 draw status) (draw-control-status on-screen))) - (set! f0-16 (+ 2.0 f0-16)) - ) - (if (logtest? (process-mask enemy guard) (-> s5-1 mask)) - (set! f0-16 (+ 28.0 f0-16)) - ) - (if (logtest? (process-mask vehicle civilian) (-> s5-1 mask)) - (set! f0-16 (/ f0-16 4)) - ) - (set! (-> sv-1076 sv-1080 value) f0-16) - (set! sv-1088 (+ sv-1088 f0-16)) + (let ((s5-1 (the-as target (as-type *target* process-focusable)))) + (when (and s5-1 (< (vector-vector-distance (get-trans s5-1 0) sv-1072) (-> sv-1072 w))) + (when (and (!= *target* s5-1) + (not (focus-test? s5-1 disable dead inactive gun-no-target)) + (or (logtest? (process-mask enemy vehicle civilian) (-> s5-1 mask)) + (and (logtest? (process-mask guard) (-> s5-1 mask)) (-> *setting-control* user-current gun-target-guards?)) + ) + ) + (let ((s4-3 (new 'stack-no-clear 'collide-query))) + (vector-copy! (-> s4-3 start-pos) (-> this root trans)) + (vector-! (-> s4-3 move-dist) (get-trans s5-1 3) (-> this root trans)) + (let ((v1-94 s4-3)) + (set! (-> v1-94 radius) 40.96) + (set! (-> v1-94 collide-with) (collide-spec backgnd)) + (set! (-> v1-94 ignore-process0) #f) + (set! (-> v1-94 ignore-process1) #f) + (set! (-> v1-94 ignore-pat) + (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) + ) + (set! (-> v1-94 action-mask) (collide-action solid)) + ) + (when (< (fill-and-probe-using-line-sphere *collide-cache* s4-3) 0.0) + (set! (-> sv-1076 sv-1080 targ) (process->handle s5-1)) + (let ((f0-16 1.0)) + (if (and (nonzero? (-> s5-1 draw)) (logtest? (-> s5-1 draw status) (draw-control-status on-screen))) + (set! f0-16 (+ 2.0 f0-16)) + ) + (if (logtest? (process-mask enemy guard) (-> s5-1 mask)) + (set! f0-16 (+ 28.0 f0-16)) + ) + (if (logtest? (process-mask vehicle civilian) (-> s5-1 mask)) + (set! f0-16 (/ f0-16 4)) + ) + (set! (-> sv-1076 sv-1080 value) f0-16) + (+! sv-1088 f0-16) + ) + (+! sv-1080 1) ) - (set! sv-1080 (+ sv-1080 1)) ) ) ) ) - ) - (set! sv-3792 (new 'stack-no-clear 'array 'int8 100)) - (set! sv-3800 0) - (set! sv-3808 (the-as float 0.0)) - (set! sv-3812 (the-as symbol #f)) - (when (> sv-1080 0) - (dotimes (s5-2 sv-16) - (let ((f0-20 (rand-vu-float-range 0.0 sv-1088))) - (dotimes (v1-127 sv-1080) - (set! sv-3808 (+ sv-3808 (-> sv-1076 v1-127 value))) - (when (< f0-20 sv-3808) - (dotimes (a0-82 sv-3800) - (when (= (-> sv-3792 a0-82) v1-127) - 0 - (goto cfg-91) + (let ((sv-3792 (new 'stack-no-clear 'array 'int8 100)) + (sv-3800 0) + ) + (let ((sv-3808 (the-as float 0.0))) + (let ((sv-3812 (the-as symbol #f))) + ) + (when (> sv-1080 0) + (dotimes (s5-2 sv-16) + (let ((f0-20 (rand-vu-float-range 0.0 sv-1088))) + (dotimes (v1-127 sv-1080) + (+! sv-3808 (-> sv-1076 v1-127 value)) + (when (< f0-20 sv-3808) + (dotimes (a0-82 sv-3800) + (when (= (-> sv-3792 a0-82) v1-127) + 0 + (goto cfg-91) + ) + ) + (set! (-> sv-3792 sv-3800) v1-127) + (+! sv-3800 1) + 0 + (goto cfg-94) + ) + (label cfg-91) ) ) - (set! (-> sv-3792 sv-3800) v1-127) - (set! sv-3800 (+ sv-3800 1)) - 0 - (goto cfg-94) + (label cfg-94) ) - (label cfg-91) ) ) - (label cfg-94) - ) - ) - (dotimes (s5-3 sv-3800) - (let* ((a0-95 (as-type (handle->process (-> sv-1076 (-> sv-3792 s5-3) targ)) process-focusable)) - (s4-5 this) - (s3-4 (method-of-object s4-5 spawn-shot)) - (s2-2 (new 'stack-no-clear 'vector)) - ) - (vector-copy! s2-2 (get-trans (the-as process-focusable a0-95) 0)) - (s3-4 s4-5 s2-2) - ) - ) - (let ((s5-4 sv-3800) - (s4-6 (+ sv-16 -1)) + (dotimes (s5-3 sv-3800) + (let* ((a0-95 (as-type (handle->process (-> sv-1076 (-> sv-3792 s5-3) targ)) process-focusable)) + (s4-5 this) + (s3-4 (method-of-object s4-5 spawn-shot)) + (s2-2 (new 'stack-no-clear 'vector)) + ) + (vector-copy! s2-2 (get-trans (the-as process-focusable a0-95) 0)) + (s3-4 s4-5 s2-2) + ) ) - (while (>= s4-6 s5-4) - (let ((s3-5 (new 'stack-no-clear 'vector))) - (set! (-> s3-5 x) (rand-vu-float-range -1.0 1.0)) - (set! (-> s3-5 y) (rand-vu-float-range -0.85 -0.3)) - (set! (-> s3-5 z) (rand-vu-float-range -1.0 1.0)) - (vector+float*! s3-5 (-> this root trans) s3-5 40960.0) - (spawn-shot this s3-5) + (let ((s5-4 sv-3800) + (s4-6 (+ sv-16 -1)) + ) + (while (>= s4-6 s5-4) + (let ((s3-5 (new 'stack-no-clear 'vector))) + (set! (-> s3-5 x) (rand-vu-float-range -1.0 1.0)) + (set! (-> s3-5 y) (rand-vu-float-range -0.85 -0.3)) + (set! (-> s3-5 z) (rand-vu-float-range -1.0 1.0)) + (vector+float*! s3-5 (-> this root trans) s3-5 40960.0) + (spawn-shot this s3-5) + ) + (+! s5-4 1) + ) ) - (+! s5-4 1) ) ) (the-as int #f) @@ -1291,7 +1286,7 @@ ) (let ((f0-3 (vector-dot gp-1 (-> (camera-matrix) fvec)))) (when (< 0.0 f0-3) - (let ((f2-0 (* f0-3 f0-3)) + (let ((f2-0 (square f0-3)) (f0-4 (-> *part-id-table* 266 init-specs 8 initial-valuef)) (f1-3 (-> *part-id-table* 266 init-specs 8 random-rangef)) ) @@ -1494,78 +1489,67 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch symbol vs none. (defbehavior gun-yellow-shot-do-deflect gun-yellow-shot-2 ((arg0 gun-yellow-shot-2) (arg1 vector) (arg2 vector) (arg3 vector)) - (local-vars - (sv-32 vector) - (sv-36 gun-yellow-shot-2) - (sv-40 process) - (sv-80 vector) - (sv-84 vector) - (sv-112 vector) - (sv-116 number) - (sv-120 int) - (sv-128 symbol) - (sv-136 handle) - (sv-1680 vector) - (sv-1712 vector) - (sv-1716 float) - (sv-1720 float) - (sv-1724 vector) - (sv-1744 vector) - (sv-1748 float) - (sv-1752 float) + (let* ((f0-1 (vector-dot arg2 arg3)) + (sv-32 (vector-float*! (new 'stack-no-clear 'vector) arg3 (* -2.0 f0-1))) + ) + (vector+! arg1 arg2 sv-32) ) - (let ((f0-1 (vector-dot arg2 arg3))) - (set! sv-32 (vector-float*! (new 'stack-no-clear 'vector) arg3 (* -2.0 f0-1))) - ) - (vector+! arg1 arg2 sv-32) (if (< 0.2 (-> arg1 y)) (set! (-> arg1 y) (fmax 0.2 (-> arg2 y))) ) - (let ((s4-0 arg0)) - (set! sv-36 s4-0) - (set! sv-40 (handle->process (-> sv-36 last-hit-enemy))) + (let* ((s4-0 arg0) + (sv-36 s4-0) + (sv-40 (handle->process (-> sv-36 last-hit-enemy))) + ) (when (and (time-elapsed? (-> sv-36 last-collide-time) (seconds 0.05)) (rand-vu-percent? 0.75)) - (set! sv-80 (vector-normalize-copy! (new 'stack-no-clear 'vector) arg1 204800.0)) - (set! sv-84 (new 'stack-no-clear 'vector)) - (vector-copy! sv-84 (-> s4-0 root trans)) - (vector+! sv-84 sv-84 sv-80) - (set! (-> sv-84 w) 409600.0) - (set! (-> sv-80 y) 0.0) - (vector-normalize! sv-80 1.0) - (set! sv-112 (vector+! (new 'stack-no-clear 'vector) (-> s4-0 root trans) arg1)) - (set! sv-116 409600000000000000000000.0) - (set! sv-120 -55041728) - (set! sv-128 (the-as symbol #f)) - (set! sv-136 (the-as handle #f)) - (let ((s3-0 (new 'stack-no-clear 'array 'collide-shape 384))) - (countdown (s2-0 (fill-actor-list-for-box *actor-hash* sv-84 s3-0 384)) - (let ((v1-31 (as-type (-> s3-0 s2-0) collide-shape))) - (when v1-31 - (let ((s1-1 (as-type (-> v1-31 process) process-focusable))) - (when s1-1 - (when (and (!= s4-0 s1-1) - (!= s1-1 sv-40) - (not (focus-test? (the-as process-focusable s1-1) disable dead inactive gun-no-target)) - (or (logtest? (process-mask enemy civilian) (-> s1-1 mask)) - (and (logtest? (process-mask guard) (-> s1-1 mask)) (-> *setting-control* user-current gun-target-guards?)) + (let ((sv-80 (vector-normalize-copy! (new 'stack-no-clear 'vector) arg1 204800.0)) + (sv-84 (new 'stack-no-clear 'vector)) + ) + (vector-copy! sv-84 (-> s4-0 root trans)) + (vector+! sv-84 sv-84 sv-80) + (set! (-> sv-84 w) 409600.0) + (set! (-> sv-80 y) 0.0) + (vector-normalize! sv-80 1.0) + (let ((sv-112 (vector+! (new 'stack-no-clear 'vector) (-> s4-0 root trans) arg1)) + (sv-116 409600000000000000000000.0) + (sv-120 -55041728) + (sv-128 (the-as symbol #f)) + (sv-136 (the-as handle #f)) + ) + (let ((s3-0 (new 'stack-no-clear 'array 'collide-shape 384))) + (countdown (s2-0 (fill-actor-list-for-box *actor-hash* sv-84 s3-0 384)) + (let ((v1-31 (as-type (-> s3-0 s2-0) collide-shape))) + (when v1-31 + (let ((s1-1 (as-type (-> v1-31 process) process-focusable))) + (when s1-1 + (when (and (!= s4-0 s1-1) + (!= s1-1 sv-40) + (not (focus-test? (the-as process-focusable s1-1) disable dead inactive gun-no-target)) + (or (logtest? (process-mask enemy civilian) (-> s1-1 mask)) + (and (logtest? (process-mask guard) (-> s1-1 mask)) (-> *setting-control* user-current gun-target-guards?)) + ) ) - ) - (when (or (not sv-128) - (logtest? (process-mask enemy guard) (-> s1-1 mask)) - (not (is-in-ignore-list? sv-36 (process->handle s1-1))) + (when (or (not sv-128) + (logtest? (process-mask enemy guard) (-> s1-1 mask)) + (not (is-in-ignore-list? sv-36 (process->handle s1-1))) + ) + (let* ((sv-1680 (get-trans (the-as process-focusable s1-1) 3)) + (sv-1712 (vector-! (new 'stack-no-clear 'vector) sv-1680 (-> s4-0 root trans))) + (sv-1716 (the-as float 0.0)) + ) + (set! (-> sv-1712 y) 0.0) + (let ((sv-1720 (vector-normalize-ret-len! sv-1712 1.0))) + (set! sv-1716 (vector-dot sv-1712 sv-80)) + (when (or (< (the float sv-120) sv-1716) (and (< 0.707 sv-1716) (= sv-136 *last-hit-deflect-target-handle*))) + (set! sv-116 sv-1720) + (set! sv-120 (the int sv-1716)) + (vector-copy! sv-112 sv-1680) + (set! sv-128 (logtest? (process-mask enemy) (-> s1-1 mask))) + (set! sv-136 (process->handle s1-1)) + ) ) - (set! sv-1680 (get-trans (the-as process-focusable s1-1) 3)) - (set! sv-1712 (vector-! (new 'stack-no-clear 'vector) sv-1680 (-> s4-0 root trans))) - (set! sv-1716 (the-as float 0.0)) - (set! (-> sv-1712 y) 0.0) - (set! sv-1720 (vector-normalize-ret-len! sv-1712 1.0)) - (set! sv-1716 (vector-dot sv-1712 sv-80)) - (when (or (< (the float sv-120) sv-1716) (and (< 0.707 sv-1716) (= sv-136 *last-hit-deflect-target-handle*))) - (set! sv-116 sv-1720) - (set! sv-120 (the int sv-1716)) - (vector-copy! sv-112 sv-1680) - (set! sv-128 (logtest? (process-mask enemy) (-> s1-1 mask))) - (set! sv-136 (process->handle s1-1)) + ) + ) ) ) ) @@ -1573,40 +1557,43 @@ ) ) ) - ) - ) - (let ((s3-1 (the-as target (as-type *target* process-focusable)))) - (when (and s3-1 (< (vector-vector-distance (get-trans s3-1 0) sv-84) (-> sv-84 w))) - (when (and (!= s4-0 s3-1) - (!= s3-1 sv-40) - (not (focus-test? s3-1 disable dead inactive gun-no-target)) - (or (logtest? (process-mask enemy civilian) (-> s3-1 mask)) - (and (logtest? (process-mask guard) (-> s3-1 mask)) (-> *setting-control* user-current gun-target-guards?)) + (let ((s3-1 (the-as target (as-type *target* process-focusable)))) + (when (and s3-1 (< (vector-vector-distance (get-trans s3-1 0) sv-84) (-> sv-84 w))) + (when (and (!= s4-0 s3-1) + (!= s3-1 sv-40) + (not (focus-test? s3-1 disable dead inactive gun-no-target)) + (or (logtest? (process-mask enemy civilian) (-> s3-1 mask)) + (and (logtest? (process-mask guard) (-> s3-1 mask)) (-> *setting-control* user-current gun-target-guards?)) + ) ) - ) - (when (or (not sv-128) - (logtest? (process-mask enemy guard) (-> s3-1 mask)) - (not (is-in-ignore-list? sv-36 (process->handle s3-1))) + (when (or (not sv-128) + (logtest? (process-mask enemy guard) (-> s3-1 mask)) + (not (is-in-ignore-list? sv-36 (process->handle s3-1))) + ) + (let* ((sv-1724 (get-trans s3-1 3)) + (sv-1744 (vector-! (new 'stack-no-clear 'vector) sv-1724 (-> s4-0 root trans))) + (sv-1748 (the-as float 0.0)) + ) + (set! (-> sv-1744 y) 0.0) + (let ((sv-1752 (vector-normalize-ret-len! sv-1744 1.0))) + (set! sv-1748 (vector-dot sv-1744 sv-80)) + (when (or (< (the float sv-120) sv-1748) (and (< 0.707 sv-1748) (= sv-136 *last-hit-deflect-target-handle*))) + (set! sv-116 sv-1752) + (set! sv-120 (the int sv-1748)) + (vector-copy! sv-112 sv-1724) + (set! sv-128 (logtest? (process-mask enemy) (-> s3-1 mask))) + (set! sv-136 (process->handle s3-1)) + ) ) - (set! sv-1724 (get-trans s3-1 3)) - (set! sv-1744 (vector-! (new 'stack-no-clear 'vector) sv-1724 (-> s4-0 root trans))) - (set! sv-1748 (the-as float 0.0)) - (set! (-> sv-1744 y) 0.0) - (set! sv-1752 (vector-normalize-ret-len! sv-1744 1.0)) - (set! sv-1748 (vector-dot sv-1744 sv-80)) - (when (or (< (the float sv-120) sv-1748) (and (< 0.707 sv-1748) (= sv-136 *last-hit-deflect-target-handle*))) - (set! sv-116 sv-1752) - (set! sv-120 (the int sv-1748)) - (vector-copy! sv-112 sv-1724) - (set! sv-128 (logtest? (process-mask enemy) (-> s3-1 mask))) - (set! sv-136 (process->handle s3-1)) + ) + ) ) ) ) + (vector-! arg1 sv-112 (-> s4-0 root trans)) + (set! *last-hit-deflect-target-handle* (the-as (pointer process) sv-136)) ) ) - (vector-! arg1 sv-112 (-> s4-0 root trans)) - (set! *last-hit-deflect-target-handle* (the-as (pointer process) sv-136)) ) ) (vector-normalize! arg1 546133.3) diff --git a/test/decompiler/reference/jak3/engine/target/logic-target_REF.gc b/test/decompiler/reference/jak3/engine/target/logic-target_REF.gc index e1c774b718..efed1ba6d7 100644 --- a/test/decompiler/reference/jak3/engine/target/logic-target_REF.gc +++ b/test/decompiler/reference/jak3/engine/target/logic-target_REF.gc @@ -114,160 +114,150 @@ ;; definition (debug) for function target-history-print ;; WARN: new jak 2 until loop case, check carefully (defun-debug target-history-print ((arg0 history-iterator)) - (local-vars - (sv-16 object) - (sv-24 int) - (sv-32 collide-status) - (sv-40 number) - (sv-44 vector) - (sv-48 vector) - (sv-52 vector) - (sv-56 vector) - (sv-60 vector) - (sv-64 vector) - (sv-68 number) - (sv-72 history-elt) - (sv-80 time-frame) - (sv-88 uint) + (let ((sv-16 (-> arg0 out))) ) - (set! sv-16 (-> arg0 out)) - (set! sv-24 0) - (set! sv-32 (collide-status)) - (set! sv-40 0) - (set! sv-44 *zero-vector*) - (set! sv-48 *zero-vector*) - (set! sv-52 *zero-vector*) - (set! sv-56 *zero-vector*) - (set! sv-60 *zero-vector*) - (set! sv-64 *zero-vector*) - (set! sv-68 0) - (until #f - (set! sv-72 (update-entries! arg0)) - (if (not sv-72) - (return #f) + (let ((sv-24 0) + (sv-32 (collide-status)) + (sv-40 0.0) + (sv-44 *zero-vector*) + (sv-48 *zero-vector*) + (sv-52 *zero-vector*) + (sv-56 *zero-vector*) + (sv-60 *zero-vector*) + (sv-64 *zero-vector*) + (sv-68 0.0) ) - (set! sv-80 (frame-counter-delta arg0 sv-72)) - (set! sv-88 (-> sv-72 record-id)) - (when (!= sv-24 sv-88) - (set! sv-24 (the-as int sv-88)) - (format - (-> arg0 out) - "~6D ~8S #x~8X " - sv-80 - (if (logtest? sv-32 (collide-status no-touch)) - "air" - (-> *pat-mode-info* (shr (shl (the-as int sv-68) 54) 61) name) + (until #f + (let ((sv-72 (update-entries! arg0))) + (if (not sv-72) + (return #f) ) - sv-32 - ) - (format - (-> arg0 out) - "~C~C~C~C~C~C" - (if (not (logtest? (the-as int sv-40) 1)) - 103 - 87 - ) - (if (not (logtest? (the-as int sv-40) 2)) - 103 - 87 - ) - (cond - ((logtest? (the-as int sv-40) 2048) - 71 - ) - ((not (logtest? (the-as int sv-40) 4)) - 103 - ) - (else - 87 + (let ((sv-80 (frame-counter-delta arg0 sv-72)) + (sv-88 (-> sv-72 record-id)) + ) + (when (!= sv-24 sv-88) + (set! sv-24 (the-as int sv-88)) + (format + (-> arg0 out) + "~6D ~8S #x~8X " + sv-80 + (if (logtest? sv-32 (collide-status no-touch)) + "air" + (-> *pat-mode-info* (shr (shl (the-as int sv-68) 54) 61) name) + ) + sv-32 + ) + (format + (-> arg0 out) + "~C~C~C~C~C~C" + (if (not (logtest? (the-as int sv-40) 1)) + 103 + 87 + ) + (if (not (logtest? (the-as int sv-40) 2)) + 103 + 87 + ) + (cond + ((logtest? (the-as int sv-40) 2048) + 71 + ) + ((not (logtest? (the-as int sv-40) 4)) + 103 + ) + (else + 87 + ) + ) + (cond + ((logtest? (the-as int sv-40) 512) + 66 + ) + ((logtest? (the-as int sv-40) 8) + 76 + ) + (else + 99 + ) + ) + (if (not (logtest? (the-as int sv-40) 16)) + 110 + 66 + ) + (if (not (logtest? (the-as int sv-40) 32)) + 103 + 65 + ) + ) + (format + (-> arg0 out) + "~C~C " + (cond + ((logtest? #x10000 (the-as int sv-40)) + 80 + ) + ((logtest? (the-as int sv-40) #x8000) + 85 + ) + ((logtest? (the-as int sv-40) 64) + 78 + ) + (else + 95 + ) + ) + (cond + ((logtest? (the-as int sv-40) 1024) + 76 + ) + ((logtest? (the-as int sv-40) 256) + 67 + ) + ((logtest? (the-as int sv-40) 128) + 108 + ) + (else + 95 + ) + ) + ) + (format (-> arg0 out) "trans: ~6,,2m ~6,,2m ~6,,2m " (-> sv-44 x) (-> sv-44 y) (-> sv-44 z)) + (format (-> arg0 out) "int: ~6,,2m ~6,,2m ~6,,2m " (-> sv-56 x) (-> sv-56 y) (-> sv-56 z)) + (format (-> arg0 out) "vel: ~6,,2m ~6,,2m ~6,,2m " (-> sv-48 x) (-> sv-48 y) (-> sv-48 z)) + (format (-> arg0 out) "vel-out: ~6,,2m ~6,,2m ~6,,2m " (-> sv-52 x) (-> sv-52 y) (-> sv-52 z)) + (format (-> arg0 out) "normal: ~6,,2f ~6,,2f ~6,,2f " (-> sv-60 x) (-> sv-60 y) (-> sv-60 z)) + (format (-> arg0 out) "local: ~6,,2f ~6,,2f ~6,,2f " (-> sv-64 x) (-> sv-64 y) (-> sv-64 z)) + (format (-> arg0 out) "~%") ) ) - (cond - ((logtest? (the-as int sv-40) 512) - 66 + (case (-> sv-72 channel) + (((history-channel trans)) + (set! sv-44 (-> sv-72 vector)) ) - ((logtest? (the-as int sv-40) 8) - 76 + (((history-channel transv-in)) + (set! sv-48 (-> sv-72 vector)) ) - (else - 99 - ) - ) - (if (not (logtest? (the-as int sv-40) 16)) - 110 - 66 - ) - (if (not (logtest? (the-as int sv-40) 32)) - 103 - 65 - ) - ) - (format - (-> arg0 out) - "~C~C " - (cond - ((logtest? #x10000 (the-as int sv-40)) - 80 + (((history-channel transv-out)) + (set! sv-52 (-> sv-72 vector)) ) - ((logtest? (the-as int sv-40) #x8000) - 85 + (((history-channel intersect)) + (set! sv-56 (-> sv-72 vector)) ) - ((logtest? (the-as int sv-40) 64) - 78 + (((history-channel pat)) + (set! sv-68 (-> sv-72 vector x)) ) - (else - 95 - ) - ) - (cond - ((logtest? (the-as int sv-40) 1024) - 76 + (((history-channel collide-status)) + (set! sv-32 (-> sv-72 collide-status)) + (set! sv-40 (-> sv-72 vector z)) ) - ((logtest? (the-as int sv-40) 256) - 67 + (((history-channel surface-normal)) + (set! sv-60 (-> sv-72 vector)) ) - ((logtest? (the-as int sv-40) 128) - 108 + (((history-channel local-normal)) + (set! sv-64 (-> sv-72 vector)) ) - (else - 95 - ) ) ) - (format (-> arg0 out) "trans: ~6,,2m ~6,,2m ~6,,2m " (-> sv-44 x) (-> sv-44 y) (-> sv-44 z)) - (format (-> arg0 out) "int: ~6,,2m ~6,,2m ~6,,2m " (-> sv-56 x) (-> sv-56 y) (-> sv-56 z)) - (format (-> arg0 out) "vel: ~6,,2m ~6,,2m ~6,,2m " (-> sv-48 x) (-> sv-48 y) (-> sv-48 z)) - (format (-> arg0 out) "vel-out: ~6,,2m ~6,,2m ~6,,2m " (-> sv-52 x) (-> sv-52 y) (-> sv-52 z)) - (format (-> arg0 out) "normal: ~6,,2f ~6,,2f ~6,,2f " (-> sv-60 x) (-> sv-60 y) (-> sv-60 z)) - (format (-> arg0 out) "local: ~6,,2f ~6,,2f ~6,,2f " (-> sv-64 x) (-> sv-64 y) (-> sv-64 z)) - (format (-> arg0 out) "~%") - ) - (case (-> sv-72 channel) - (((history-channel trans)) - (set! sv-44 (-> sv-72 vector)) - ) - (((history-channel transv-in)) - (set! sv-48 (-> sv-72 vector)) - ) - (((history-channel transv-out)) - (set! sv-52 (-> sv-72 vector)) - ) - (((history-channel intersect)) - (set! sv-56 (-> sv-72 vector)) - ) - (((history-channel pat)) - (set! sv-68 (-> sv-72 vector x)) - ) - (((history-channel collide-status)) - (set! sv-32 (-> sv-72 collide-status)) - (set! sv-40 (-> sv-72 vector z)) - ) - (((history-channel surface-normal)) - (set! sv-60 (-> sv-72 vector)) - ) - (((history-channel local-normal)) - (set! sv-64 (-> sv-72 vector)) - ) ) ) #f @@ -276,72 +266,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) @@ -567,38 +526,29 @@ (let ((v1-175 (-> arg0 control trans))) (format arg1 "pos: ~6,,2m ~6,,2m ~6,,2m " (-> v1-175 x) (-> v1-175 y) (-> v1-175 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-79 format) (a0-147 arg1) @@ -649,22 +599,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 heap current) (the-as uint (-> sv-80 heap 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 heap current) (the-as uint (-> sv-80 heap base))) 10) - sv-72 - (sar sv-64 10) ) (debug-print-channels (-> arg0 skel) arg1) ) @@ -2905,7 +2857,7 @@ ;; WARN: Return type mismatch int vs none. ;; INFO: Process stack size was changed from 1024 to 2048 (defmethod target-init! ((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! (-> *setting-control* user-default kg-primary-target) (process->handle this)) (set! (-> *setting-control* user-default ff-primary-target) (process->handle this)) (set! (-> *setting-control* user-default mh-primary-target) (process->handle this)) @@ -2964,13 +2916,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) @@ -3346,3 +3299,7 @@ ;; failed to figure out what this is: (kmemclose) + + + + diff --git a/test/decompiler/reference/jak3/engine/target/mech/mech-states_REF.gc b/test/decompiler/reference/jak3/engine/target/mech/mech-states_REF.gc index 69a88d75af..7d608a3372 100644 --- a/test/decompiler/reference/jak3/engine/target/mech/mech-states_REF.gc +++ b/test/decompiler/reference/jak3/engine/target/mech/mech-states_REF.gc @@ -339,7 +339,6 @@ ;; definition for function target-mech-punch-pick ;; INFO: Used lq/sq (defbehavior target-mech-punch-pick target ((arg0 symbol)) - (local-vars (sv-144 control-info) (sv-160 float)) (combo-tracker-method-12 (-> self control unknown-combo-tracker00) *null-vector* @@ -361,25 +360,22 @@ ) (when s2-0 (let ((s3-0 (get-trans s2-0 3))) - (set! sv-144 (-> self control)) - (let ((s0-0 s3-0) - (s1-0 deg-diff) - ) - (set! sv-160 (y-angle sv-144)) - (let* ((a1-4 (vector-y-angle (vector-! (new 'stack-no-clear 'vector) s0-0 (-> sv-144 trans)))) - (f0-0 (s1-0 sv-160 a1-4)) + (let* ((sv-144 (-> self control)) + (s0-0 s3-0) + (f0-0 + (deg-diff (y-angle sv-144) (vector-y-angle (vector-! (new 'stack-no-clear 'vector) s0-0 (-> sv-144 trans)))) ) - (cond - ((>= 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 + ((>= 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/jak3/engine/target/mech/target-mech_REF.gc b/test/decompiler/reference/jak3/engine/target/mech/target-mech_REF.gc index 1740198d58..9d170e49f4 100644 --- a/test/decompiler/reference/jak3/engine/target/mech/target-mech_REF.gc +++ b/test/decompiler/reference/jak3/engine/target/mech/target-mech_REF.gc @@ -635,7 +635,7 @@ ;; definition for function target-mech-handler ;; INFO: Used lq/sq (defbehavior target-mech-handler target ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) - (local-vars (v0-0 object) (a0-19 symbol) (sv-96 target) (sv-112 process)) + (local-vars (v0-0 object) (a0-19 symbol)) (cond ((and (= arg2 'query) (= (-> arg3 param 0) 'mode)) 'mech @@ -725,16 +725,14 @@ (let ((s2-0 (the-as pointer s3-0)) (s1-0 (method-of-type attack-info compute-intersect-info)) (s0-0 (-> arg3 param 1)) + (sv-96 self) ) - (set! sv-96 self) - (set! sv-112 arg0) - (let ((a3-2 (if (type? sv-112 process-drawable) - sv-112 - ) - ) - (t0-0 (-> arg3 param 0)) - ) - (s1-0 (the-as attack-info s2-0) s0-0 sv-96 a3-2 (the-as touching-shapes-entry t0-0)) + (s1-0 + (the-as attack-info s2-0) + s0-0 + sv-96 + (as-type arg0 process-drawable) + (the-as touching-shapes-entry (-> arg3 param 0)) ) ) (format 0 "info: ~A~%" (-> (the-as attack-info s3-0) mode)) @@ -986,7 +984,6 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defbehavior mech-update-ik target () - (local-vars (sv-720 vector)) (let ((gp-0 (new 'stack-no-clear 'collide-query)) (s5-0 (-> (the-as process-drawable (-> self parent 0)) root)) ) @@ -1022,11 +1019,9 @@ (-> s3-0 shoulder-matrix-no-ik) (let ((v1-13 (-> s3-0 elbow-matrix-no-ik)) (s0-0 (new 'stack-no-clear 'vector)) + (sv-720 (new 'stack-no-clear 'vector)) ) - (set! sv-720 (new 'stack-no-clear 'vector)) - (let ((a0-5 (-> *y-vector* quad))) - (set! (-> sv-720 quad) a0-5) - ) + (vector-copy! sv-720 *y-vector*) (let ((s2-0 (new 'stack-no-clear 'vector))) (new 'stack-no-clear 'vector) (new 'stack-no-clear 'vector) @@ -1039,11 +1034,7 @@ (seek! (-> s3-0 user-blend) f0-11 (* 4.0 (seconds-per-frame))) ) (vector+*! (-> gp-0 start-pos) s0-0 sv-720 6144.0) - (let ((v1-19 (-> gp-0 move-dist)) - (f0-16 -20480.0) - ) - (vector-float*! v1-19 sv-720 f0-16) - ) + (vector-float*! (-> gp-0 move-dist) sv-720 -20480.0) (let ((v1-21 gp-0)) (set! (-> v1-21 radius) 4.096) (set! (-> v1-21 collide-with) (-> gp-0 collide-with)) @@ -1090,11 +1081,6 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch object vs none. (defbehavior target-mech-init target ((arg0 handle) (arg1 float) (arg2 symbol)) - (local-vars - (sv-160 (function vector entity-actor skeleton-group vector manipy-options none :behavior manipy)) - (sv-176 vector) - (sv-192 entity-actor) - ) (target-gun-end-mode #f) (target-exit) (when (zero? (-> self mech)) @@ -1173,40 +1159,21 @@ (s3-0 (-> self level)) ) (process-entity-set! self (-> self mech entity)) - (let ((s2-0 (get-process *8k-dead-pool* manipy #x20000 1))) - (set! (-> self manipy) - (the-as - (pointer manipy) - (when s2-0 - (let ((t9-13 (method-of-type manipy activate))) - (t9-13 (the-as manipy s2-0) self "manipy" (the-as pointer #x70004000)) - ) - (let ((s1-0 run-function-in-process) - (s0-0 s2-0) - ) - (set! sv-160 manipy-init) - (set! sv-176 (-> self control trans)) - (set! sv-192 (-> self entity)) - (let ((t0-1 (art-group-get-by-name *level* "skel-mech" (the-as (pointer level) #f))) - (t1-0 #f) - (t2-0 0) - ) - ((the-as (function object object object object object object object none) s1-0) - s0-0 - sv-160 - sv-176 - sv-192 - t0-1 - t1-0 - t2-0 - ) - ) - ) - (-> s2-0 ppointer) - ) - ) + (set! (-> self manipy) + (process-spawn + manipy + :init manipy-init + (-> self control trans) + (-> self entity) + (art-group-get-by-name *level* "skel-mech" (the-as (pointer level) #f)) + #f + 0 + :name "manipy" + :from *8k-dead-pool* + :to self + :stack-size #x20000 ) - ) + ) (set! (-> self entity) s4-1) (set! (-> self level) s3-0) ) diff --git a/test/decompiler/reference/jak3/engine/target/pilot-states_REF.gc b/test/decompiler/reference/jak3/engine/target/pilot-states_REF.gc index 607ef6370c..5313b9266c 100644 --- a/test/decompiler/reference/jak3/engine/target/pilot-states_REF.gc +++ b/test/decompiler/reference/jak3/engine/target/pilot-states_REF.gc @@ -317,14 +317,7 @@ (let* ((v1-65 (-> gp-0 accel-array)) (f0-30 (+ (* (-> v1-65 0 x) (-> v1-65 0 x)) (* (-> v1-65 0 z) (-> v1-65 0 z)))) ) - (if (or (and (-> self pilot as-daxter?) (let ((f1-25 1024000.0)) - (< (* f1-25 f1-25) f0-30) - ) - ) - (let ((f1-28 2048000.0)) - (< (* f1-28 f1-28) f0-30) - ) - ) + (if (or (and (-> self pilot as-daxter?) (< (square 1024000.0) f0-30)) (< (square 2048000.0) f0-30)) (go target-pilot-impact) ) ) @@ -945,24 +938,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) (-> *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) (-> *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 ) @@ -1136,3 +1129,7 @@ ) :post target-pilot-post ) + + + + diff --git a/test/decompiler/reference/jak3/engine/target/surface-h_REF.gc b/test/decompiler/reference/jak3/engine/target/surface-h_REF.gc index 5516ae024e..f56527f4d7 100644 --- a/test/decompiler/reference/jak3/engine/target/surface-h_REF.gc +++ b/test/decompiler/reference/jak3/engine/target/surface-h_REF.gc @@ -199,14 +199,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/jak3/engine/target/target-anim_REF.gc b/test/decompiler/reference/jak3/engine/target/target-anim_REF.gc index 8241f59591..aba1829885 100644 --- a/test/decompiler/reference/jak3/engine/target/target-anim_REF.gc +++ b/test/decompiler/reference/jak3/engine/target/target-anim_REF.gc @@ -33,564 +33,565 @@ ;; WARN: Return type mismatch symbol vs none. ;; WARN: new jak 2 until loop case, check carefully (defbehavior target-stance-anim target () - (local-vars (sv-64 int) (sv-72 ground-tween-info)) - (set! sv-64 22) - (set! sv-72 (new 'stack 'ground-tween-info)) - (let ((v1-4 (ja-group))) - (cond - ((and v1-4 (or (= v1-4 jakb-wade-shallow-walk-ja) (= v1-4 jakb-wade-deep-walk-ja))) - (set! sv-64 45) - ) - ((let ((v1-11 (ja-group))) - (and v1-11 (= v1-11 jakb-roll-flip-ja)) + (let ((sv-64 22)) + (let ((sv-72 (new 'stack 'ground-tween-info))) + ) + (let ((v1-4 (ja-group))) + (cond + ((and v1-4 (or (= v1-4 jakb-wade-shallow-walk-ja) (= v1-4 jakb-wade-deep-walk-ja))) + (set! sv-64 45) ) - ((lambda :behavior target - () - (cond - ((using-gun? self) - (set! (-> self gun top-anim-low-high) 0.0) - (case (gun->eco (-> self gun gun-type)) - (((pickup-type eco-blue)) - (push-anim-to-targ - (-> self skel top-anim) - (the-as art-joint-anim jakb-gun-roll-flip-land-ja) - 0.0 - 0 - 30 - 1.0 - 10.0 - #f + ((let ((v1-11 (ja-group))) + (and v1-11 (= v1-11 jakb-roll-flip-ja)) + ) + ((lambda :behavior target + () + (cond + ((using-gun? self) + (set! (-> self gun top-anim-low-high) 0.0) + (case (gun->eco (-> self gun gun-type)) + (((pickup-type eco-blue)) + (push-anim-to-targ + (-> self skel top-anim) + (the-as art-joint-anim jakb-gun-roll-flip-land-ja) + 0.0 + 0 + 30 + 1.0 + 10.0 + #f + ) ) - ) - (else - (push-anim-to-targ - (-> self skel top-anim) - (the-as art-joint-anim jakb-gun-roll-flip-land-ja) - 0.0 - 0 - 30 - 1.0 - 6.0 - #f + (else + (push-anim-to-targ + (-> self skel top-anim) + (the-as art-joint-anim jakb-gun-roll-flip-land-ja) + 0.0 + 0 + 30 + 1.0 + 6.0 + #f + ) ) ) + (ja-no-eval :group! jakb-roll-flip-land-ja :num! (seek! (ja-aframe 48.0 0)) :frame-num 0.0) + (until (ja-done? 0) + (suspend) + (ja :num! (seek! (ja-aframe 48.0 0))) + ) + (ja-channel-push! 1 (seconds 0.05)) + (let ((gp-2 (target-land-anim))) + (ja-no-eval :group! gp-2 :num! (seek!) :frame-num (ja-aframe 64.0 0)) + ) + (until (ja-done? 0) + (ja-blend-eval) + (suspend) + (ja :num! (seek!)) + ) ) - (ja-no-eval :group! jakb-roll-flip-land-ja :num! (seek! (ja-aframe 48.0 0)) :frame-num 0.0) - (until (ja-done? 0) - (suspend) - (ja :num! (seek! (ja-aframe 48.0 0))) - ) - (ja-channel-push! 1 (seconds 0.05)) - (let ((gp-2 (target-land-anim))) - (ja-no-eval :group! gp-2 :num! (seek!) :frame-num (ja-aframe 64.0 0)) - ) - (until (ja-done? 0) - (ja-blend-eval) - (suspend) - (ja :num! (seek!)) - ) - ) - (else - (ja-no-eval :group! jakb-roll-flip-land-ja :num! (seek!) :frame-num 0.0) - (until (ja-done? 0) - (suspend) - (ja :num! (seek!)) - ) - (ja-no-eval :group! jakb-jump-land-ja :num! (seek!) :frame-num (ja-aframe 55.0 0)) - (until (ja-done? 0) - (suspend) - (ja :num! (seek!)) - ) - ) - ) - (none) - ) - ) - ) - ((let ((v1-18 (ja-group))) - (and v1-18 (or (= v1-18 jakb-gun-attack-from-stance-end-ja) - (= v1-18 jakb-gun-attack-from-stance-blue-end-ja) - (= v1-18 jakb-lightjak-shield-end-ja) - (= v1-18 jakb-attack-from-stance-alt-end-ja) - (= v1-18 jakb-attack-from-stance-end-ja) - ) - ) - ) - (ja-no-eval :num! (seek!)) - (while (not (ja-done? 0)) - (suspend) - (ja-eval) - ) - ) - ((let ((v1-33 (ja-group))) - (and v1-33 - (or (= v1-33 jakb-attack-from-stance-ja) - (= v1-33 jakb-gun-attack-from-stance-ja) - (= v1-33 jakb-gun-attack-from-stance-blue-ja) - (= v1-33 jakb-lightjak-shield-ja) + (else + (ja-no-eval :group! jakb-roll-flip-land-ja :num! (seek!) :frame-num 0.0) + (until (ja-done? 0) + (suspend) + (ja :num! (seek!)) ) + (ja-no-eval :group! jakb-jump-land-ja :num! (seek!) :frame-num (ja-aframe 55.0 0)) + (until (ja-done? 0) + (suspend) + (ja :num! (seek!)) + ) + ) ) + (none) + ) + ) ) - ((lambda :behavior target - () - (set! (-> self control mod-surface) *attack-end-mods*) - (let ((gp-0 (not (using-gun? self)))) - (let* ((v1-3 (ja-group)) - (a1-0 (cond - ((and v1-3 (= v1-3 jakb-gun-attack-from-stance-ja)) - jakb-gun-attack-from-stance-end-ja - ) - ((let ((v1-10 (ja-group))) - (and v1-10 (= v1-10 jakb-gun-attack-from-stance-blue-ja)) + ((let ((v1-18 (ja-group))) + (and v1-18 (or (= v1-18 jakb-gun-attack-from-stance-end-ja) + (= v1-18 jakb-gun-attack-from-stance-blue-end-ja) + (= v1-18 jakb-lightjak-shield-end-ja) + (= v1-18 jakb-attack-from-stance-alt-end-ja) + (= v1-18 jakb-attack-from-stance-end-ja) + ) + ) + ) + (ja-no-eval :num! (seek!)) + (while (not (ja-done? 0)) + (suspend) + (ja-eval) + ) + ) + ((let ((v1-33 (ja-group))) + (and v1-33 + (or (= v1-33 jakb-attack-from-stance-ja) + (= v1-33 jakb-gun-attack-from-stance-ja) + (= v1-33 jakb-gun-attack-from-stance-blue-ja) + (= v1-33 jakb-lightjak-shield-ja) + ) + ) + ) + ((lambda :behavior target + () + (set! (-> self control mod-surface) *attack-end-mods*) + (let ((gp-0 (not (using-gun? self)))) + (let* ((v1-3 (ja-group)) + (a1-0 (cond + ((and v1-3 (= v1-3 jakb-gun-attack-from-stance-ja)) + jakb-gun-attack-from-stance-end-ja ) - jakb-gun-attack-from-stance-blue-end-ja - ) - ((and (= (-> self ext-anim) (target-anim light)) (let ((v1-20 (ja-group))) - (and v1-20 (= v1-20 jakb-lightjak-shield-ja)) - ) - ) - jakb-lightjak-shield-end-ja - ) - ((and (rand-vu-percent? 0.3) (zero? (-> self ext-anim))) - jakb-attack-from-stance-alt-end-ja - ) - (else - jakb-attack-from-stance-end-ja + ((let ((v1-10 (ja-group))) + (and v1-10 (= v1-10 jakb-gun-attack-from-stance-blue-ja)) + ) + jakb-gun-attack-from-stance-blue-end-ja + ) + ((and (= (-> self ext-anim) (target-anim light)) (let ((v1-20 (ja-group))) + (and v1-20 (= v1-20 jakb-lightjak-shield-ja)) + ) + ) + jakb-lightjak-shield-end-ja + ) + ((and (rand-vu-percent? 0.3) (zero? (-> self ext-anim))) + jakb-attack-from-stance-alt-end-ja + ) + (else + jakb-attack-from-stance-end-ja + ) ) ) - ) - ) - (ja-no-eval :group! a1-0 :num! (seek!) :frame-num 0.0) - ) - (until (ja-done? 0) - (when (nonzero? (-> self gun track-target-hold-time)) - (forward-up-nopitch->quaternion - (-> self control dir-targ) - (vector-! (new 'stack-no-clear 'vector) (-> self gun track-trans) (-> self control trans)) - (vector-y-quaternion! (new-stack-vector0) (-> self control dir-targ)) - ) - (set-quaternion! (-> self control) (-> self control dir-targ)) - (goto cfg-43) + ) + (ja-no-eval :group! a1-0 :num! (seek!) :frame-num 0.0) ) - (if (and gp-0 (using-gun? self)) + (until (ja-done? 0) + (when (nonzero? (-> self gun track-target-hold-time)) + (forward-up-nopitch->quaternion + (-> self control dir-targ) + (vector-! (new 'stack-no-clear 'vector) (-> self gun track-trans) (-> self control trans)) + (vector-y-quaternion! (new-stack-vector0) (-> self control dir-targ)) + ) + (set-quaternion! (-> self control) (-> self control dir-targ)) (goto cfg-43) ) - (compute-delta-align! (-> self align)) - (align! (-> self align) (align-opts adjust-quat) 1.0 1.0 1.0) - (suspend) - (ja :num! (seek!)) - ) - ) - (quaternion-copy! (-> self control dir-targ) (-> self control unknown-quaternion04)) - (label cfg-43) - (set! (-> self control mod-surface) *walk-mods*) - (let ((v1-73 (ja-group))) - (when (and (and v1-73 (= v1-73 jakb-gun-attack-from-stance-end-ja)) - (and (using-gun? self) (= (gun->eco (-> self gun gun-type)) (pickup-type eco-yellow))) - ) - (ja-channel-push! 1 (seconds 0.1)) - (ja-no-eval :group! jakb-gun-front-to-side-hop-ja :num! (seek!) :frame-num (ja-aframe 5.0 0)) - (until (ja-done? 0) + (if (and gp-0 (using-gun? self)) + (goto cfg-43) + ) + (compute-delta-align! (-> self align)) + (align! (-> self align) (align-opts adjust-quat) 1.0 1.0 1.0) (suspend) (ja :num! (seek!)) ) ) - ) - (none) - ) - ) - ) - ((let ((v1-40 (ja-group))) - (and v1-40 (= v1-40 (-> self draw art-group data 449))) - ) - (ja-no-eval :group! (-> self draw art-group data 450) :num! (seek!) :frame-num 0.0) - (until (ja-done? 0) - (suspend) - (ja :num! (seek!)) - ) - ) - ((let ((v1-70 (ja-group))) - (and v1-70 (= v1-70 jakb-smack-surface-ja)) - ) - (ja-no-eval :group! jakb-smack-surface-end-ja :num! (seek!) :frame-num 0.0) - (until (ja-done? 0) - (suspend) - (ja :num! (seek!)) - ) - ) - ((let ((v1-100 (ja-group))) - (and v1-100 (or (= v1-100 jakb-powerjak-get-on-ja) (= v1-100 jakb-powerjak-get-on-loop-ja))) - ) - (set! sv-64 60) - ) - ((let ((v1-107 (ja-group))) - (and v1-107 (= v1-107 jakb-darkjak-get-on-fast-ja)) - ) - (ja-no-eval :num! (seek!)) - (while (not (ja-done? 0)) - (suspend) - (ja-eval) - ) - ) - ((let ((v1-122 (ja-group))) - (and v1-122 (or (= v1-122 jakb-attack-punch-ja) - (= v1-122 (-> self draw art-group data 452)) - (= v1-122 (-> self draw art-group data 459)) - (= v1-122 (-> self draw art-group data 454)) - (= v1-122 jakb-darkjak-attack-combo3-ja) - (= v1-122 (-> self draw art-group data 463)) - (= v1-122 (-> self draw art-group data 476)) + (quaternion-copy! (-> self control dir-targ) (-> self control unknown-quaternion04)) + (label cfg-43) + (set! (-> self control mod-surface) *walk-mods*) + (let ((v1-73 (ja-group))) + (when (and (and v1-73 (= v1-73 jakb-gun-attack-from-stance-end-ja)) + (and (using-gun? self) (= (gun->eco (-> self gun gun-type)) (pickup-type eco-yellow))) ) + (ja-channel-push! 1 (seconds 0.1)) + (ja-no-eval :group! jakb-gun-front-to-side-hop-ja :num! (seek!) :frame-num (ja-aframe 5.0 0)) + (until (ja-done? 0) + (suspend) + (ja :num! (seek!)) + ) + ) ) + (none) + ) + ) ) - ((lambda :behavior target - () - (set! (-> self control bend-target) (-> self control bend-amount)) - (set! (-> self control mod-surface) *walk-no-turn-mods*) - (let ((gp-0 (not (using-gun? self)))) - (let* ((v1-5 (ja-group)) - (a1-0 (cond - ((and v1-5 (= v1-5 (-> self draw art-group data 452))) - (logior! (-> self target-flags) (target-flags lleg-still)) - (-> self draw art-group data 453) - ) - ((let ((v1-14 (ja-group))) - (and v1-14 (= v1-14 (-> self draw art-group data 459))) + ((let ((v1-40 (ja-group))) + (and v1-40 (= v1-40 (-> self draw art-group data 449))) + ) + (ja-no-eval :group! (-> self draw art-group data 450) :num! (seek!) :frame-num 0.0) + (until (ja-done? 0) + (suspend) + (ja :num! (seek!)) + ) + ) + ((let ((v1-70 (ja-group))) + (and v1-70 (= v1-70 jakb-smack-surface-ja)) + ) + (ja-no-eval :group! jakb-smack-surface-end-ja :num! (seek!) :frame-num 0.0) + (until (ja-done? 0) + (suspend) + (ja :num! (seek!)) + ) + ) + ((let ((v1-100 (ja-group))) + (and v1-100 (or (= v1-100 jakb-powerjak-get-on-ja) (= v1-100 jakb-powerjak-get-on-loop-ja))) + ) + (set! sv-64 60) + ) + ((let ((v1-107 (ja-group))) + (and v1-107 (= v1-107 jakb-darkjak-get-on-fast-ja)) + ) + (ja-no-eval :num! (seek!)) + (while (not (ja-done? 0)) + (suspend) + (ja-eval) + ) + ) + ((let ((v1-122 (ja-group))) + (and v1-122 (or (= v1-122 jakb-attack-punch-ja) + (= v1-122 (-> self draw art-group data 452)) + (= v1-122 (-> self draw art-group data 459)) + (= v1-122 (-> self draw art-group data 454)) + (= v1-122 jakb-darkjak-attack-combo3-ja) + (= v1-122 (-> self draw art-group data 463)) + (= v1-122 (-> self draw art-group data 476)) + ) + ) + ) + ((lambda :behavior target + () + (set! (-> self control bend-target) (-> self control bend-amount)) + (set! (-> self control mod-surface) *walk-no-turn-mods*) + (let ((gp-0 (not (using-gun? self)))) + (let* ((v1-5 (ja-group)) + (a1-0 (cond + ((and v1-5 (= v1-5 (-> self draw art-group data 452))) + (logior! (-> self target-flags) (target-flags lleg-still)) + (-> self draw art-group data 453) ) - (logior! (-> self target-flags) (target-flags lleg-still)) - (-> self draw art-group data 460) - ) - ((let ((v1-23 (ja-group))) - (and v1-23 (= v1-23 (-> self draw art-group data 454))) + ((let ((v1-14 (ja-group))) + (and v1-14 (= v1-14 (-> self draw art-group data 459))) + ) + (logior! (-> self target-flags) (target-flags lleg-still)) + (-> self draw art-group data 460) ) - (logior! (-> self target-flags) (target-flags lleg-still)) - (-> self draw art-group data 455) - ) - ((let ((v1-32 (ja-group))) - (and v1-32 (= v1-32 jakb-darkjak-attack-combo3-ja)) + ((let ((v1-23 (ja-group))) + (and v1-23 (= v1-23 (-> self draw art-group data 454))) + ) + (logior! (-> self target-flags) (target-flags lleg-still)) + (-> self draw art-group data 455) ) - (logior! (-> self target-flags) (target-flags lleg-still)) - jakb-darkjak-attack-combo3-end-ja - ) - ((let ((v1-41 (ja-group))) - (and v1-41 (= v1-41 (-> self draw art-group data 463))) + ((let ((v1-32 (ja-group))) + (and v1-32 (= v1-32 jakb-darkjak-attack-combo3-ja)) + ) + (logior! (-> self target-flags) (target-flags lleg-still)) + jakb-darkjak-attack-combo3-end-ja ) - (logior! (-> self target-flags) (target-flags lleg-still)) - (-> self draw art-group data 464) - ) - (else - (let ((v1-50 (ja-group))) - (cond - ((and v1-50 (= v1-50 (-> self draw art-group data 476))) - (logior! (-> self target-flags) (target-flags lleg-still)) - (-> self draw art-group data 477) - ) - ((and (rand-vu-percent? 0.3) (zero? (-> self ext-anim))) - jakb-attack-punch-alt-end-ja - ) - (else - jakb-attack-punch-end-ja + ((let ((v1-41 (ja-group))) + (and v1-41 (= v1-41 (-> self draw art-group data 463))) + ) + (logior! (-> self target-flags) (target-flags lleg-still)) + (-> self draw art-group data 464) + ) + (else + (let ((v1-50 (ja-group))) + (cond + ((and v1-50 (= v1-50 (-> self draw art-group data 476))) + (logior! (-> self target-flags) (target-flags lleg-still)) + (-> self draw art-group data 477) + ) + ((and (rand-vu-percent? 0.3) (zero? (-> self ext-anim))) + jakb-attack-punch-alt-end-ja + ) + (else + jakb-attack-punch-end-ja + ) ) ) ) ) ) - ) - ) - (ja-no-eval :group! a1-0 :num! (seek!) :frame-num 0.0) - ) - (until (ja-done? 0) - (seek! (-> self control bend-target) 0.0 (seconds-per-frame)) - (if (and gp-0 (using-gun? self)) - (goto cfg-59) - ) - (suspend) - (ja :num! (seek!)) - ) - ) - (label cfg-59) - (set! (-> self control mod-surface) *walk-mods*) - (set! (-> self control bend-target) 0.0) - (rot->dir-targ! (-> self control)) - (logclear! (-> self target-flags) (target-flags lleg-still rleg-still lleg-no-ik rleg-no-ik)) - (none) - ) - ) - ) - ((let ((v1-129 (ja-group))) - (and v1-129 (= v1-129 jakb-gun-attack-butt-ja)) - ) - (set! (-> self control bend-target) (-> self control bend-amount)) - (set! (-> self control mod-surface) *walk-no-turn-mods*) - (let ((a1-22 jakb-gun-attack-butt-end-ja)) - (ja-no-eval :group! a1-22 :num! (seek!) :frame-num 0.0) - ) - (until (ja-done? 0) - (seek! (-> self control bend-target) 0.0 (seconds-per-frame)) - (suspend) - (ja :num! (seek!)) - ) - (set! (-> self control mod-surface) *walk-mods*) - (set! (-> self control bend-target) 0.0) - (rot->dir-targ! (-> self control)) - ) - ((let ((v1-163 (ja-group))) - (and v1-163 (= v1-163 jakb-gun-attack-butt-blue-ja)) - ) - (set! (-> self control bend-target) (-> self control bend-amount)) - (set! (-> self control mod-surface) *walk-no-turn-mods*) - (let ((a1-25 jakb-gun-attack-butt-blue-end-ja)) - (ja-no-eval :group! a1-25 :num! (seek!) :frame-num 0.0) - ) - (until (ja-done? 0) - (seek! (-> self control bend-target) 0.0 (seconds-per-frame)) - (suspend) - (ja :num! (seek!)) - ) - (set! (-> self control mod-surface) *walk-mods*) - (set! (-> self control bend-target) 0.0) - (rot->dir-targ! (-> self control)) - ) - ((let ((v1-197 (ja-group))) - (and (and v1-197 (or (= v1-197 jakb-gun-jump-land-ja) (= v1-197 jakb-gun-jump-land-side-ja))) - (not (using-gun? self)) - ) - ) - (set! sv-64 60) - ) - ((let ((v1-205 (ja-group))) - (and v1-205 (or (= v1-205 jakb-duck-stance-ja) - (= v1-205 jakb-duck-walk-ja) - (= v1-205 jakb-gun-duck-walk-ja) - (= v1-205 jakb-duck-roll-ja) - (= v1-205 jakb-gun-duck-roll-ja) - (= v1-205 (-> self draw art-group data 474)) - ) - ) - ) - (let ((t9-27 - (lambda :behavior target - () - (cond - ((and (and (focus-test? self dark) (nonzero? (-> self darkjak))) (= (-> self ext-anim) (target-anim dark))) - (ja-channel-push! 1 (seconds 0.04)) - (ja-no-eval :group! (-> self draw art-group data 475) :num! (seek!) :frame-num 0.0) - (until (ja-done? 0) - (suspend) - (ja :num! (seek!)) - ) - 12 - ) - ((nonzero? (-> self ext-anim)) - 30 - ) - (else - (ja-channel-push! 1 (seconds 0.04)) - (ja-no-eval :group! jakb-stance-to-duck-ja :num! (seek! 0.0 1.2) :frame-num max) - (until (ja-done? 0) - (suspend) - (ja :num! (seek! 0.0 1.2)) - ) - 12 ) + (ja-no-eval :group! a1-0 :num! (seek!) :frame-num 0.0) + ) + (until (ja-done? 0) + (seek! (-> self control bend-target) 0.0 (seconds-per-frame)) + (if (and gp-0 (using-gun? self)) + (goto cfg-59) + ) + (suspend) + (ja :num! (seek!)) + ) + ) + (label cfg-59) + (set! (-> self control mod-surface) *walk-mods*) + (set! (-> self control bend-target) 0.0) + (rot->dir-targ! (-> self control)) + (logclear! (-> self target-flags) (target-flags lleg-still rleg-still lleg-no-ik rleg-no-ik)) + (none) + ) + ) + ) + ((let ((v1-129 (ja-group))) + (and v1-129 (= v1-129 jakb-gun-attack-butt-ja)) + ) + (set! (-> self control bend-target) (-> self control bend-amount)) + (set! (-> self control mod-surface) *walk-no-turn-mods*) + (let ((a1-22 jakb-gun-attack-butt-end-ja)) + (ja-no-eval :group! a1-22 :num! (seek!) :frame-num 0.0) + ) + (until (ja-done? 0) + (seek! (-> self control bend-target) 0.0 (seconds-per-frame)) + (suspend) + (ja :num! (seek!)) + ) + (set! (-> self control mod-surface) *walk-mods*) + (set! (-> self control bend-target) 0.0) + (rot->dir-targ! (-> self control)) + ) + ((let ((v1-163 (ja-group))) + (and v1-163 (= v1-163 jakb-gun-attack-butt-blue-ja)) + ) + (set! (-> self control bend-target) (-> self control bend-amount)) + (set! (-> self control mod-surface) *walk-no-turn-mods*) + (let ((a1-25 jakb-gun-attack-butt-blue-end-ja)) + (ja-no-eval :group! a1-25 :num! (seek!) :frame-num 0.0) + ) + (until (ja-done? 0) + (seek! (-> self control bend-target) 0.0 (seconds-per-frame)) + (suspend) + (ja :num! (seek!)) + ) + (set! (-> self control mod-surface) *walk-mods*) + (set! (-> self control bend-target) 0.0) + (rot->dir-targ! (-> self control)) + ) + ((let ((v1-197 (ja-group))) + (and (and v1-197 (or (= v1-197 jakb-gun-jump-land-ja) (= v1-197 jakb-gun-jump-land-side-ja))) + (not (using-gun? self)) + ) + ) + (set! sv-64 60) + ) + ((let ((v1-205 (ja-group))) + (and v1-205 (or (= v1-205 jakb-duck-stance-ja) + (= v1-205 jakb-duck-walk-ja) + (= v1-205 jakb-gun-duck-walk-ja) + (= v1-205 jakb-duck-roll-ja) + (= v1-205 jakb-gun-duck-roll-ja) + (= v1-205 (-> self draw art-group data 474)) + ) + ) + ) + (let ((t9-27 + (lambda :behavior target + () + (cond + ((and (and (focus-test? self dark) (nonzero? (-> self darkjak))) (= (-> self ext-anim) (target-anim dark))) + (ja-channel-push! 1 (seconds 0.04)) + (ja-no-eval :group! (-> self draw art-group data 475) :num! (seek!) :frame-num 0.0) + (until (ja-done? 0) + (suspend) + (ja :num! (seek!)) + ) + 12 + ) + ((nonzero? (-> self ext-anim)) + 30 + ) + (else + (ja-channel-push! 1 (seconds 0.04)) + (ja-no-eval :group! jakb-stance-to-duck-ja :num! (seek! 0.0 1.2) :frame-num max) + (until (ja-done? 0) + (suspend) + (ja :num! (seek! 0.0 1.2)) + ) + 12 + ) + ) + (none) ) - (none) ) ) - ) - (new 'stack-no-clear 'array 'time-frame 4) - (t9-27) + (new 'stack-no-clear 'array 'time-frame 4) + (t9-27) + ) ) - ) - ((let ((v1-212 (ja-group))) - (or (and (and v1-212 (or (= v1-212 jakb-walk-ja) (= v1-212 (-> self draw art-group data 442)))) - (begin (set! sv-64 45) (< 0.5 (-> self skel root-channel 6 frame-interp (-> self skel active-frame-interp)))) - (not (using-gun? self)) - ) - (let ((v1-226 (ja-group))) - (and v1-226 (or (= v1-226 jakb-run-squash-ja) - (= v1-226 jakb-run-squash-weak-ja) - (= v1-226 jakb-attack-from-stance-run-end-ja) - (= v1-226 jakb-attack-from-stance-run-alt-end-ja) - ) + ((let ((v1-212 (ja-group))) + (or (and (and v1-212 (or (= v1-212 jakb-walk-ja) (= v1-212 (-> self draw art-group data 442)))) + (begin (set! sv-64 45) (< 0.5 (-> self skel root-channel 6 frame-interp (-> self skel active-frame-interp)))) + (not (using-gun? self)) ) - ) - ) - ) - ((lambda :behavior target - ((arg0 (pointer time-frame))) - (cond - ((and (rand-vu-percent? 0.3) (not (and (focus-test? self dark) (nonzero? (-> self darkjak))))) - (ja-channel-push! 1 (seconds 0.1)) - (ja-no-eval :group! jakb-run-to-stance-fast-ja :num! (seek!) :frame-num 0.0) - (until (ja-done? 0) - (if (using-gun? self) - (return #f) - ) - (suspend) - (ja :num! (seek!)) - ) - ) - (else - (let* ((v1-32 (ja-group)) - (f30-1 (cond - ((and v1-32 (or (= v1-32 jakb-walk-ja) (= v1-32 (-> self draw art-group data 442)))) - (let ((f0-10 (+ 50.0 (* 0.8333333 (+ -25.0 (ja-aframe-num 0)))))) - (- f0-10 (* (the float (the int (/ f0-10 50.0))) 50.0)) + (let ((v1-226 (ja-group))) + (and v1-226 (or (= v1-226 jakb-run-squash-ja) + (= v1-226 jakb-run-squash-weak-ja) + (= v1-226 jakb-attack-from-stance-run-end-ja) + (= v1-226 jakb-attack-from-stance-run-alt-end-ja) ) - ) - (else - 0.0 + ) + ) + ) + ) + ((lambda :behavior target + ((arg0 (pointer time-frame))) + (cond + ((and (rand-vu-percent? 0.3) (not (and (focus-test? self dark) (nonzero? (-> self darkjak))))) + (ja-channel-push! 1 (seconds 0.1)) + (ja-no-eval :group! jakb-run-to-stance-fast-ja :num! (seek!) :frame-num 0.0) + (until (ja-done? 0) + (if (using-gun? self) + (return #f) + ) + (suspend) + (ja :num! (seek!)) + ) + ) + (else + (let* ((v1-32 (ja-group)) + (f30-1 (cond + ((and v1-32 (or (= v1-32 jakb-walk-ja) (= v1-32 (-> self draw art-group data 442)))) + (let ((f0-10 (+ 50.0 (* 0.8333333 (+ -25.0 (ja-aframe-num 0)))))) + (- f0-10 (* (the float (the int (/ f0-10 50.0))) 50.0)) + ) + ) + (else + 0.0 + ) ) ) - ) - ) - (set! (-> arg0 0) (seconds 0.15)) - (ja-channel-push! 1 (-> arg0 0)) - (ja :group! jakb-run-to-stance-loop-ja :num! (identity (ja-aframe f30-1 0))) - ) - (dotimes (gp-2 3) - (until (ja-done? 0) - (if (using-gun? self) - (return #f) - ) - (suspend) - (ja :num! (seek!)) + ) + (set! (-> arg0 0) (seconds 0.15)) + (ja-channel-push! 1 (-> arg0 0)) + (ja :group! jakb-run-to-stance-loop-ja :num! (identity (ja-aframe f30-1 0))) ) - (ja :num-func num-func-identity :frame-num 0.0) - ) - (ja-no-eval :group! jakb-run-to-stance-ja :num! (seek! (ja-aframe 82.0 0)) :frame-num 0.0) - (until (ja-done? 0) - (suspend) - (ja :num! (seek! (ja-aframe 82.0 0))) - ) - (when (not (and (focus-test? self dark) (nonzero? (-> self darkjak)))) - (ja-no-eval :group! jakb-run-to-stance-ja :num! (seek! (ja-aframe 142.0 0)) :frame-num (ja-aframe 82.0 0)) - (until (ja-done? 0) - (suspend) - (ja :num! (seek! (ja-aframe 142.0 0))) + (dotimes (gp-2 3) + (until (ja-done? 0) + (if (using-gun? self) + (return #f) + ) + (suspend) + (ja :num! (seek!)) + ) + (ja :num-func num-func-identity :frame-num 0.0) ) - (logior! (-> self target-flags) (target-flags lleg-still rleg-still)) - (ja-no-eval :group! jakb-run-to-stance-ja :num! (seek!) :frame-num (ja-aframe 142.0 0)) + (ja-no-eval :group! jakb-run-to-stance-ja :num! (seek! (ja-aframe 82.0 0)) :frame-num 0.0) (until (ja-done? 0) (suspend) - (ja :num! (seek!)) + (ja :num! (seek! (ja-aframe 82.0 0))) + ) + (when (not (and (focus-test? self dark) (nonzero? (-> self darkjak)))) + (ja-no-eval :group! jakb-run-to-stance-ja :num! (seek! (ja-aframe 142.0 0)) :frame-num (ja-aframe 82.0 0)) + (until (ja-done? 0) + (suspend) + (ja :num! (seek! (ja-aframe 142.0 0))) + ) + (logior! (-> self target-flags) (target-flags lleg-still rleg-still)) + (ja-no-eval :group! jakb-run-to-stance-ja :num! (seek!) :frame-num (ja-aframe 142.0 0)) + (until (ja-done? 0) + (suspend) + (ja :num! (seek!)) + ) ) ) ) + (none) ) - (none) + (new 'stack-no-clear 'array 'time-frame 4) ) - (new 'stack-no-clear 'array 'time-frame 4) - ) - ) - ((let ((v1-233 (ja-group))) - (and (and v1-233 (= v1-233 jakb-walk-ja)) (>= (-> self control ctrl-xz-vel) 5734.4)) ) - (set! sv-64 45) - ) - ((and (and (focus-test? self light) (nonzero? (-> self lightjak))) - (and (= (-> self ext-anim) (target-anim light)) (let ((v1-250 (ja-group))) - (and v1-250 (= v1-250 jakb-lightjak-get-on-land-ja)) - ) - ) - ) - (set! sv-64 45) - ) - ((and (= (-> self ext-anim) (target-anim light)) (let ((v1-260 (ja-group))) - (and v1-260 (= v1-260 jakb-lightjak-freeze-ja)) - ) - ) - (ja-channel-push! 1 (seconds 0.05)) - (ja-no-eval :group! jakb-lightjak-freeze-land-ja :num! (seek!) :frame-num 0.0) - (until (ja-done? 0) - (suspend) - (ja :num! (seek!)) + ((let ((v1-233 (ja-group))) + (and (and v1-233 (= v1-233 jakb-walk-ja)) (>= (-> self control ctrl-xz-vel) 5734.4)) + ) + (set! sv-64 45) ) - ) - ) - ) - (if (and (using-gun? self) (-> self next-state) (= (-> self next-state name) 'target-stance)) - (go target-gun-stance) - ) - (when (and (and (focus-test? self light) (nonzero? (-> self lightjak))) - (and (= (-> self ext-anim) (target-anim light)) - (zero? (-> self lightjak latch-out-time)) - (let ((v1-306 (ja-group))) - (not (and v1-306 (or (= v1-306 jakb-lightjak-heal-end-ja) - (= v1-306 jakb-lightjak-swoop-land-ja) - (= v1-306 jakb-lightjak-get-on-land-ja) - (= v1-306 jakb-lightjak-shield-end-ja) - (= v1-306 jakb-lightjak-freeze-land-ja) - ) - ) - ) - ) - ) - ) - (ja-channel-push! 1 (seconds 0.05)) - (ja-no-eval :group! jakb-lightjak-stance-to-stance-ja :num! (seek!) :frame-num 0.0) - (until (ja-done? 0) - (if (not (and (focus-test? self light) (nonzero? (-> self lightjak)))) - (goto cfg-316) - ) - (suspend) - (ja :num! (seek!)) - ) - ) - (until #f - (let ((gp-0 (cond - ((and (and (focus-test? self dark) (nonzero? (-> self darkjak))) - (and (= (-> self ext-anim) (target-anim dark)) - (zero? (-> self darkjak latch-out-time)) - (not (using-gun? self)) - ) - ) - (-> self draw art-group data 446) + ((and (and (focus-test? self light) (nonzero? (-> self lightjak))) + (and (= (-> self ext-anim) (target-anim light)) (let ((v1-250 (ja-group))) + (and v1-250 (= v1-250 jakb-lightjak-get-on-land-ja)) + ) ) - ((and (and (focus-test? self light) (nonzero? (-> self lightjak))) - (and (= (-> self ext-anim) (target-anim light)) (zero? (-> self lightjak latch-out-time))) - ) - jakb-lightjak-stance-ja - ) - (else - jakb-stance-loop-ja - ) - ) - ) - ) - (when (not (and (ja-group? gp-0) (= (ja-group-size) 1))) - (ja-channel-push! 1 (the-as time-frame sv-64)) - (set! (-> self skel root-channel 0 frame-group) (the-as art-joint-anim gp-0)) + ) + (set! sv-64 45) + ) + ((and (= (-> self ext-anim) (target-anim light)) (let ((v1-260 (ja-group))) + (and v1-260 (= v1-260 jakb-lightjak-freeze-ja)) + ) + ) + (ja-channel-push! 1 (seconds 0.05)) + (ja-no-eval :group! jakb-lightjak-freeze-land-ja :num! (seek!) :frame-num 0.0) + (until (ja-done? 0) + (suspend) + (ja :num! (seek!)) + ) + ) ) ) - (logior! (-> self target-flags) (target-flags lleg-still rleg-still)) - (while (let ((v1-385 (ja-group))) - (cond - ((and (and v1-385 (= v1-385 (-> self draw art-group data 446))) - (not (and (and (focus-test? self dark) (nonzero? (-> self darkjak))) - (and (= (-> self ext-anim) (target-anim dark)) - (zero? (-> self darkjak latch-out-time)) - (not (using-gun? self)) - ) + (if (and (using-gun? self) (-> self next-state) (= (-> self next-state name) 'target-stance)) + (go target-gun-stance) + ) + (when (and (and (focus-test? self light) (nonzero? (-> self lightjak))) + (and (= (-> self ext-anim) (target-anim light)) + (zero? (-> self lightjak latch-out-time)) + (let ((v1-306 (ja-group))) + (not (and v1-306 (or (= v1-306 jakb-lightjak-heal-end-ja) + (= v1-306 jakb-lightjak-swoop-land-ja) + (= v1-306 jakb-lightjak-get-on-land-ja) + (= v1-306 jakb-lightjak-shield-end-ja) + (= v1-306 jakb-lightjak-freeze-land-ja) + ) + ) + ) + ) + ) + ) + (ja-channel-push! 1 (seconds 0.05)) + (ja-no-eval :group! jakb-lightjak-stance-to-stance-ja :num! (seek!) :frame-num 0.0) + (until (ja-done? 0) + (if (not (and (focus-test? self light) (nonzero? (-> self lightjak)))) + (goto cfg-316) + ) + (suspend) + (ja :num! (seek!)) + ) + ) + (until #f + (let ((gp-0 (cond + ((and (and (focus-test? self dark) (nonzero? (-> self darkjak))) + (and (= (-> self ext-anim) (target-anim dark)) + (zero? (-> self darkjak latch-out-time)) + (not (using-gun? self)) ) ) + (-> self draw art-group data 446) ) - (set! sv-64 60) - #f - ) - (else - #t + ((and (and (focus-test? self light) (nonzero? (-> self lightjak))) + (and (= (-> self ext-anim) (target-anim light)) (zero? (-> self lightjak latch-out-time))) + ) + jakb-lightjak-stance-ja + ) + (else + jakb-stance-loop-ja + ) + ) + ) + ) + (when (not (and (ja-group? gp-0) (= (ja-group-size) 1))) + (ja-channel-push! 1 (the-as time-frame sv-64)) + (set! (-> self skel root-channel 0 frame-group) (the-as art-joint-anim gp-0)) + ) + ) + (logior! (-> self target-flags) (target-flags lleg-still rleg-still)) + (while (let ((v1-385 (ja-group))) + (cond + ((and (and v1-385 (= v1-385 (-> self draw art-group data 446))) + (not (and (and (focus-test? self dark) (nonzero? (-> self darkjak))) + (and (= (-> self ext-anim) (target-anim dark)) + (zero? (-> self darkjak latch-out-time)) + (not (using-gun? self)) + ) + ) + ) + ) + (set! sv-64 60) + #f + ) + (else + #t + ) ) ) - ) - (suspend) - (ja :num! (loop!)) - (if (can-play-stance-amibent?) - (go target-stance-ambient) - ) + (suspend) + (ja :num! (loop!)) + (if (can-play-stance-amibent?) + (go target-stance-ambient) + ) + ) + (label cfg-316) ) - (label cfg-316) ) #f (none) @@ -803,7 +804,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) @@ -1170,18 +1170,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 (and (focus-test? self dark) (nonzero? (-> self darkjak))) (= (-> self ext-anim) (target-anim dark))) + (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 (and (focus-test? self dark) (nonzero? (-> self darkjak))) (= (-> self ext-anim) (target-anim dark))) - (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-211 (-> self skel effect))) diff --git a/test/decompiler/reference/jak3/engine/target/target-darkjak_REF.gc b/test/decompiler/reference/jak3/engine/target/target-darkjak_REF.gc index 162964142c..7d6cd5b117 100644 --- a/test/decompiler/reference/jak3/engine/target/target-darkjak_REF.gc +++ b/test/decompiler/reference/jak3/engine/target/target-darkjak_REF.gc @@ -100,7 +100,6 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch object vs symbol. (defmethod deal-damage! ((this darkjak-ball) (arg0 process) (arg1 event-message-block)) - (local-vars (sv-288 process) (sv-304 vector)) (let ((s4-0 (new 'stack 'attack-info))) (let ((v1-1 s4-0)) (set! (-> v1-1 mode) (-> this attack-mode)) @@ -132,34 +131,25 @@ (the-as uint -1) ) ) + (s0-0 (as-type arg0 process-focusable)) ) - (set! sv-288 arg0) - (let ((s0-0 (if (type? sv-288 process-focusable) - sv-288 - ) - ) - ) - (when s0-0 - (set! sv-304 s2-0) - (let ((v1-27 (-> (get-trans (the-as process-focusable s0-0) 3) quad))) - (set! (-> sv-304 quad) v1-27) - ) - (when (not (focus-test? (the-as process-focusable s0-0) hit)) - (if s1-0 - (get-intersect-point s2-0 s1-0 (-> this root) (the-as touching-shapes-entry arg1)) - ) - (cond - ((logtest? (-> group-darkjak-smack-hit flags) (sp-group-flag sp13)) - (vector-copy! (-> *launch-matrix* trans) s2-0) - (part-tracker-spawn part-tracker-subsampler :to this :group group-darkjak-smack-hit) - ) - (else - (vector-copy! (-> *launch-matrix* trans) s2-0) - (part-tracker-spawn part-tracker :to this :group group-darkjak-smack-hit) - ) + (when s0-0 + (vector-copy! s2-0 (get-trans (the-as process-focusable s0-0) 3)) + (when (not (focus-test? (the-as process-focusable s0-0) hit)) + (if s1-0 + (get-intersect-point s2-0 s1-0 (-> this root) (the-as touching-shapes-entry arg1)) + ) + (cond + ((logtest? (-> group-darkjak-smack-hit flags) (sp-group-flag sp13)) + (vector-copy! (-> *launch-matrix* trans) s2-0) + (part-tracker-spawn part-tracker-subsampler :to this :group group-darkjak-smack-hit) + ) + (else + (vector-copy! (-> *launch-matrix* trans) s2-0) + (part-tracker-spawn part-tracker :to this :group group-darkjak-smack-hit) ) - (sound-play "djak-strike-ko") ) + (sound-play "djak-strike-ko") ) ) ) @@ -1283,16 +1273,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 () @@ -1340,286 +1320,288 @@ ) ) ) - (set! sv-16 (the-as float 0.0)) - (set! sv-20 (the-as float 1.0)) - (set! sv-24 0) - (set! sv-32 0) - (set! sv-40 0) - (set! sv-48 (the-as float 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 target-flags) (target-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 (the-as float 1.0)) + (sv-24 0) + (sv-32 0) + (sv-40 0) + (sv-48 (the-as float 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 int64)) (arg2 (pointer int64))) - (let ((s3-0 (if (and (focus-test? self dark) - (nonzero? (-> self darkjak)) - (logtest? (-> self darkjak stage) (darkjak-stage tracking)) - ) - (combo-tracker-method-13 - (-> self control unknown-combo-tracker00) - (-> self control send-attack-dest) - (-> self control trans) - 24576.0 - (-> self control c-R-w fvec) - 65536.0 - ) - ) - ) - ) - (when #t - (+! (-> arg1 0) 1) - (if s3-0 - (combo-tracker-method-12 - (-> self control unknown-combo-tracker00) - (-> self control trans) - (get-trans s3-0 3) - s3-0 - (current-time) - ) - ) - (target-start-attack) - (target-danger-set! 'punch #f) - (if (not (logtest? (-> self darkjak stage) (darkjak-stage force-on endless-dark))) - (send-event self 'get-pickup (pickup-type eco-pill-dark) (- (-> *FACT-bank* darkjak-punch-inc))) - ) - (let ((v1-34 (ja-group))) - (cond - ((and v1-34 (or (= v1-34 (-> self draw art-group data 452)) (= v1-34 (-> self draw art-group data 459)))) - (ja-channel-push! 1 (seconds 0.1)) - (ja-no-eval :group! (-> self draw art-group data 454) :num! (seek!)) + (until (ja-done? 0) + (if (and (cpad-pressed? (-> self control cpad number) square) + (not (logtest? (-> self target-flags) (target-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! (-> self draw art-group data 463) :num! (seek!)) - ) - ) - ) - (initialize (-> self control impact-ctrl) self 28 3276.8 (-> self control root-prim prim-core collide-with)) - (set! (-> arg0 0) (fmax 0.0 (-> arg0 0))) + (< sv-32 2) ) - ) - (set! (-> arg2 0) 0) - 0 - ) - (& sv-16) - (the-as (pointer int64) (& sv-32)) - (the-as (pointer int64) (& sv-40)) - ) - ) - (compute-delta-align! (-> 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) (-> *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-83 (ja-group))) - (not (and (and v1-83 (= v1-83 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 (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-124 - (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-124 x) (-> v1-124 x)) (* (-> v1-124 z) (-> v1-124 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 (-> self draw art-group data 452)) - (>= f30-2 11.0) - (>= (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 452)) 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 int64)) (arg2 (pointer int64))) + (let ((s3-0 (if (and (focus-test? self dark) + (nonzero? (-> self darkjak)) + (logtest? (-> self darkjak stage) (darkjak-stage tracking)) ) - ) - (and (= gp-2 (-> self draw art-group data 459)) - (>= f30-2 11.0) - (>= (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 459)) frames num-frames) -1)) - (ja-frame-num 0) - ) - ) - (and (= gp-2 (-> self draw art-group data 454)) - (>= f30-2 49.0) - (>= (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 454)) 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 (-> self draw art-group data 463)) - (>= f30-2 62.0) - (>= (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 463)) frames num-frames) -1)) - (ja-frame-num 0) - ) - ) + (combo-tracker-method-13 + (-> self control unknown-combo-tracker00) + (-> self control send-attack-dest) + (-> self control trans) + 24576.0 + (-> self control c-R-w fvec) + 65536.0 + ) + ) ) - #t + ) + (when #t + (+! (-> arg1 0) 1) + (if s3-0 + (combo-tracker-method-12 + (-> self control unknown-combo-tracker00) + (-> self control trans) + (get-trans s3-0 3) + s3-0 + (current-time) + ) ) + (target-start-attack) + (target-danger-set! 'punch #f) + (if (not (logtest? (-> self darkjak stage) (darkjak-stage force-on endless-dark))) + (send-event self 'get-pickup (pickup-type eco-pill-dark) (- (-> *FACT-bank* darkjak-punch-inc))) + ) + (let ((v1-34 (ja-group))) + (cond + ((and v1-34 (or (= v1-34 (-> self draw art-group data 452)) (= v1-34 (-> self draw art-group data 459)))) + (ja-channel-push! 1 (seconds 0.1)) + (ja-no-eval :group! (-> self draw art-group data 454) :num! (seek!)) + ) + (else + (ja-channel-push! 1 (seconds 0.1)) + (ja-no-eval :group! (-> self draw art-group data 463) :num! (seek!)) + ) + ) + ) + (initialize (-> self control impact-ctrl) self 28 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 :board #x1) - ) - 0.0 - ) - (>= 0.0 (vector-dot (-> gp-3 best-other-tri normal) (-> self control impact-ctrl dir))) + (set! (-> arg2 0) 0) + 0 + ) + (& sv-16) + (the-as (pointer int64) (& sv-32)) + (the-as (pointer int64) (& sv-40)) + ) + ) + (compute-delta-align! (-> 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) (-> *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-83 (ja-group))) + (not (and (and v1-83 (= v1-83 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 (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)) ) - (when (= (-> gp-3 best-other-tri pat mode) (pat-mode wall)) - (cond - ((logtest? (-> group-punch-hit flags) (sp-group-flag sp13)) - (vector-copy! (-> *launch-matrix* trans) (-> gp-3 best-other-tri intersect)) - (part-tracker-spawn part-tracker-subsampler :to self :group group-punch-hit) + (let ((v1-124 + (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-124 x) (-> v1-124 x)) (* (-> v1-124 z) (-> v1-124 z)))))) + ) + (set-forward-vel sv-16) + ) ) - (else - (vector-copy! (-> *launch-matrix* trans) (-> gp-3 best-other-tri intersect)) - (part-tracker-spawn part-tracker :to self :group group-punch-hit) + (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)) ) - ) - (let ((name (static-sound-name "djak-punch-hit"))) - (play-effect-sound - (-> self skel effect) - (the-as symbol "punch") - -1.0 - (-> self control impact-ctrl joint) - (the-as basic #f) - (the-as sound-name name) + (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)) ) - ) - (activate! *camera-smush-control* 819.2 15 75 1.0 0.9 (-> *display* camera-clock)) - (set! sv-16 (the-as float -61440.0)) + (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-6 (ja-group)) - (f0-59 (ja-aframe-num 0)) - ) - (if (and (= gp-6 jakb-darkjak-attack-combo3-ja) - (>= f0-59 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 (-> self draw art-group data 452)) + (>= f30-2 11.0) + (>= (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 452)) frames num-frames) -1)) + (ja-frame-num 0) + ) + ) + (and (= gp-2 (-> self draw art-group data 459)) + (>= f30-2 11.0) + (>= (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 459)) frames num-frames) -1)) + (ja-frame-num 0) + ) + ) + (and (= gp-2 (-> self draw art-group data 454)) + (>= f30-2 49.0) + (>= (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 454)) 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 (-> self draw art-group data 463)) + (>= f30-2 62.0) + (>= (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 463)) 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 :board #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)) + (cond + ((logtest? (-> group-punch-hit flags) (sp-group-flag sp13)) + (vector-copy! (-> *launch-matrix* trans) (-> gp-3 best-other-tri intersect)) + (part-tracker-spawn part-tracker-subsampler :to self :group group-punch-hit) + ) + (else + (vector-copy! (-> *launch-matrix* trans) (-> gp-3 best-other-tri intersect)) + (part-tracker-spawn part-tracker :to self :group group-punch-hit) + ) + ) + (let ((name (static-sound-name "djak-punch-hit"))) + (play-effect-sound + (-> self skel effect) + (the-as symbol "punch") + -1.0 + (-> self control impact-ctrl joint) + (the-as basic #f) + (the-as sound-name name) + ) + ) + (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-6 (ja-group)) + (f0-59 (ja-aframe-num 0)) + ) + (if (and (= gp-6 jakb-darkjak-attack-combo3-ja) + (>= f0-59 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) 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) 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) (-> *TARGET-bank* ground-timeout)) @@ -2037,224 +2019,223 @@ (update-clock! (-> self darkjak) 16) ) :code (behavior () - (local-vars - (v1-100 symbol) - (sv-16 float) - (sv-20 float) - (sv-160 vector) - (sv-164 (function object :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*) (vector-copy! (-> self alt-cam-pos) (-> self control trans)) - (set! sv-16 (the-as float 0.0)) - (set! sv-20 (the-as float 1.0)) - (ja-channel-push! 1 (seconds 0.15)) - (when (jump-hit-ground-stuck?) - (ja-no-eval :group! (-> self draw art-group data 451) :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 (the-as float 1.0)) + ) + (ja-channel-push! 1 (seconds 0.15)) + (when (jump-hit-ground-stuck?) + (ja-no-eval :group! (-> self draw art-group data 451) :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! (-> self draw art-group data 466) :num! (seek!) :frame-num 0.0) - (until (ja-done? 0) - (compute-delta-align! (-> 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! (-> self draw art-group data 467) :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! (-> self draw art-group data 466) :num! (seek!) :frame-num 0.0) + (until (ja-done? 0) + (compute-delta-align! (-> 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! (-> self draw art-group data 467) :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 target-flags) (target-flags tf6)) + (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 target-flags) (target-flags tf6)) - (while (not (jump-hit-ground-stuck?)) - (let ((v1-105 (new-stack-vector0)) - (f0-42 (vector-dot (-> self control dynam gravity-normal) (-> self control transv))) + (set-forward-vel 0.0) + (ja-no-eval :group! (-> self draw art-group data 468) :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) + (send-event self 'get-pickup (pickup-type eco-pill-dark) (- (-> *FACT-bank* darkjak-bomb0-inc))) + (let ((sv-160 (vector<-cspace! (new 'stack-no-clear 'vector) (joint-node jakb-lod0-jg sk_lhand)))) + (let ((sv-164 (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) + ) + ) + ) + ) + ) + ) + (set! (-> sv-160 y) (-> self control root-prim prim-core world-sphere y)) + (cond + ((logtest? (-> group-darkjak-bomb flags) (sp-group-flag sp13)) + (vector-copy! (-> *launch-matrix* trans) sv-160) + (part-tracker-spawn part-tracker-subsampler :to *entity-pool* :group group-darkjak-bomb) + ) + (else + (vector-copy! (-> *launch-matrix* trans) sv-160) + (part-tracker-spawn part-tracker :to *entity-pool* :group group-darkjak-bomb) + ) + ) + (let ((gp-6 (process-spawn + manipy + :init manipy-init + sv-160 + (-> self entity) + (art-group-get-by-name *level* "skel-bomb-blast" (the-as (pointer level) #f)) + #f + 0 + :name "manipy" + :to self + :stack-size #x20000 + ) + ) + ) + (when gp-6 + (send-event (ppointer->process gp-6) 'anim-mode 'play1) + (send-event (ppointer->process gp-6) 'anim "idle") + (set-vector! (-> (the-as process-drawable (-> gp-6 0)) root scale) sv-20 1.0 sv-20 1.0) + (send-event (ppointer->process gp-6) 'trans-hook sv-164) + ) ) - 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)) + (let ((gp-8 (process-spawn + manipy + :init manipy-init + sv-160 + (-> self entity) + (art-group-get-by-name *level* "skel-generic-blast" (the-as (pointer level) #f)) + #f + 0 + :name "manipy" + :to self + :stack-size #x20000 + ) + ) + ) + (when gp-8 + (send-event (ppointer->process gp-8) 'anim-mode 'play1) + (send-event (ppointer->process gp-8) 'anim "idle") + (set-vector! (-> (the-as manipy (-> gp-8 0)) root scale) sv-20 1.0 sv-20 1.0) ) ) ) - (ja :num! (seek! (ja-aframe 33.0 0))) - (suspend) - ) - (set-forward-vel 0.0) - (ja-no-eval :group! (-> self draw art-group data 468) :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) - (send-event self 'get-pickup (pickup-type eco-pill-dark) (- (-> *FACT-bank* darkjak-bomb0-inc))) - (set! sv-160 (vector<-cspace! (new 'stack-no-clear 'vector) (joint-node jakb-lod0-jg sk_lhand))) - (set! sv-164 (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) - ) - ) - ) - ) - ) - (set! (-> sv-160 y) (-> self control root-prim prim-core world-sphere y)) - (cond - ((logtest? (-> group-darkjak-bomb flags) (sp-group-flag sp13)) - (vector-copy! (-> *launch-matrix* trans) sv-160) - (part-tracker-spawn part-tracker-subsampler :to *entity-pool* :group group-darkjak-bomb) - ) - (else - (vector-copy! (-> *launch-matrix* trans) sv-160) - (part-tracker-spawn part-tracker :to *entity-pool* :group group-darkjak-bomb) + (ja-no-eval :num! (seek! (ja-aframe 38.0 0))) + (while (not (ja-done? 0)) + (target-darkjak-bomb-collide (& sv-16) sv-20) + (set-forward-vel 0.0) + (suspend) + (ja-eval) ) - ) - (let ((gp-6 (process-spawn - manipy - :init manipy-init - sv-160 - (-> self entity) - (art-group-get-by-name *level* "skel-bomb-blast" (the-as (pointer level) #f)) - #f - 0 - :name "manipy" - :to self - :stack-size #x20000 - ) - ) - ) - (when gp-6 - (send-event (ppointer->process gp-6) 'anim-mode 'play1) - (send-event (ppointer->process gp-6) 'anim "idle") - (set-vector! (-> (the-as process-drawable (-> gp-6 0)) root scale) sv-20 1.0 sv-20 1.0) - (send-event (ppointer->process gp-6) 'trans-hook sv-164) + (ja-no-eval :num! (seek!)) + (while (not (ja-done? 0)) + (target-darkjak-bomb-collide (& sv-16) sv-20) + (set-forward-vel 0.0) + (suspend) + (ja-eval) ) - ) - (let ((gp-8 (process-spawn - manipy - :init manipy-init - sv-160 - (-> self entity) - (art-group-get-by-name *level* "skel-generic-blast" (the-as (pointer level) #f)) - #f - 0 - :name "manipy" - :to self - :stack-size #x20000 - ) - ) - ) - (when gp-8 - (send-event (ppointer->process gp-8) 'anim-mode 'play1) - (send-event (ppointer->process gp-8) 'anim "idle") - (set-vector! (-> (the-as manipy (-> gp-8 0)) root scale) sv-20 1.0 sv-20 1.0) + (remove-setting! 'music-volume) + (remove-setting! 'sfx-volume) + (remove-setting! 'ambient-volume) + (ja-no-eval :group! (-> self draw art-group data 461) :num! (seek! (ja-aframe 90.0 0)) :frame-num 0.0) + (until (ja-done? 0) + (target-darkjak-bomb-collide (& sv-16) sv-20) + (suspend) + (ja :num! (seek! (ja-aframe 90.0 0))) ) ) - (ja-no-eval :num! (seek! (ja-aframe 38.0 0))) - (while (not (ja-done? 0)) - (target-darkjak-bomb-collide (& sv-16) sv-20) - (set-forward-vel 0.0) - (suspend) - (ja-eval) - ) - (ja-no-eval :num! (seek!)) - (while (not (ja-done? 0)) - (target-darkjak-bomb-collide (& 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! (-> self draw art-group data 461) :num! (seek! (ja-aframe 90.0 0)) :frame-num 0.0) - (until (ja-done? 0) - (target-darkjak-bomb-collide (& 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 20) (go target-darkjak-get-off) @@ -2287,7 +2268,6 @@ ;; definition for function target-bomb1-fire-shot ;; INFO: Used lq/sq (defbehavior target-bomb1-fire-shot target ((arg0 (array handle)) (arg1 int) (arg2 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) @@ -2340,19 +2320,21 @@ (s2-0 (-> *lightning-spec-id-table* 11)) (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) @@ -2398,19 +2380,6 @@ (update-clock! (-> self darkjak) 32) ) :code (behavior ((arg0 float) (arg1 float)) - (local-vars - (sv-112 (array collide-shape)) - (sv-120 int) - (sv-128 vector) - (sv-132 (array handle)) - (sv-136 int) - (sv-144 time-frame) - (sv-152 time-frame) - (sv-160 float) - (sv-164 float) - (sv-168 time-frame) - (sv-176 uint) - ) (logior! (-> self target-flags) (target-flags tf4)) (set! (-> self neck flex-blend) 0.0) (set-setting! 'music-volume 'rel 0.0 0) @@ -2443,106 +2412,112 @@ (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-112 (-> self focus-search)) - (set! sv-120 0) - (set! sv-128 (vector<-cspace! (new 'stack-no-clear 'vector) (joint-node jakb-lod0-jg main))) - (set! sv-132 (-> self handle-search)) - (set! (-> sv-132 length) 0) - (set! (-> sv-128 w) 327680.0) - (set! sv-120 (fill-actor-list-for-box *actor-hash* sv-128 (-> sv-112 data) (-> sv-112 allocated-length))) - (set! (-> sv-112 length) sv-120) - (countdown (s5-0 sv-120) - (let ((v1-56 (as-type (-> sv-112 s5-0 process) process-focusable))) - (when (and v1-56 (logtest? (process-mask crate enemy guard vehicle) (-> v1-56 mask))) - (set! (-> sv-132 (-> sv-132 length)) (process->handle v1-56)) - (+! (-> sv-132 length) 1) - (if (< (-> sv-132 allocated-length) (-> sv-132 length)) - (set! (-> sv-132 length) (-> sv-132 allocated-length)) - ) + (let ((sv-112 (-> self focus-search)) + (sv-120 0) + (sv-128 (vector<-cspace! (new 'stack-no-clear 'vector) (joint-node jakb-lod0-jg main))) + (sv-132 (-> self handle-search)) + ) + (set! (-> sv-132 length) 0) + (set! (-> sv-128 w) 327680.0) + (set! sv-120 (fill-actor-list-for-box *actor-hash* sv-128 (-> sv-112 data) (-> sv-112 allocated-length))) + (set! (-> sv-112 length) sv-120) + (countdown (s5-0 sv-120) + (let ((v1-56 (as-type (-> sv-112 s5-0 process) process-focusable))) + (when (and v1-56 (logtest? (process-mask crate enemy guard vehicle) (-> v1-56 mask))) + (set! (-> sv-132 (-> sv-132 length)) (process->handle v1-56)) + (+! (-> sv-132 length) 1) + (if (< (-> sv-132 allocated-length) (-> sv-132 length)) + (set! (-> sv-132 length) (-> sv-132 allocated-length)) + ) + ) ) ) - ) - (set! (-> self control mod-surface) (new 'static 'surface - :name 'uppercut - :turnv 524288.0 - :turnvf 15.0 - :tiltv 32768.0 - :tiltvf 150.0 - :tiltvv 262144.0 - :tiltvvf 15.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 - :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 + :turnvf 15.0 + :tiltv 32768.0 + :tiltvf 150.0 + :tiltvv 262144.0 + :tiltvvf 15.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 + :mode 'air + :flags (surface-flag air attack spin gun-off laser-hide) + ) + ) + (let ((sv-136 0) + (sv-144 (current-time)) + (sv-152 (current-time)) + (sv-160 (the-as float 0.0)) + (sv-164 (the-as float 0.0)) + ) + (let ((sv-168 (current-time))) ) - (set! sv-136 0) - (set! sv-144 (current-time)) - (set! sv-152 (current-time)) - (set! sv-160 (the-as float 0.0)) - (set! sv-164 (the-as float 0.0)) - (set! sv-168 (current-time)) - (let* ((v1-77 (-> self game)) - (a0-34 (+ (-> v1-77 attack-id) 1)) - ) - (set! (-> v1-77 attack-id) a0-34) - (set! sv-176 a0-34) - ) - (ja-channel-push! 2 (seconds 0.05)) - (ja :group! (-> self draw art-group data 469)) - (ja :chan 1 :group! (-> self draw art-group data 470)) - (while (or (< sv-136 (-> sv-132 length)) (not (time-elapsed? sv-152 (seconds 1.5)))) - (let ((v1-84 (new-stack-vector0))) - (let ((f0-10 (vector-dot (-> self control dynam gravity-normal) (-> self control transv)))) - 0.0 - (vector-! v1-84 (-> self control transv) (vector-float*! v1-84 (-> self control dynam gravity-normal) f0-10)) - ) - (let* ((f0-11 (vector-length v1-84)) - (f1-3 f0-11) - (f2-0 0.0) + (let* ((v1-77 (-> self game)) + (a0-34 (+ (-> v1-77 attack-id) 1)) ) - (vector+! - (-> self control transv) - (vector-float*! (-> self control transv) (-> self control dynam gravity-normal) f2-0) - (vector-float*! v1-84 v1-84 (/ f0-11 f1-3)) + (set! (-> v1-77 attack-id) a0-34) + (let ((sv-176 a0-34)) + (ja-channel-push! 2 (seconds 0.05)) + (ja :group! (-> self draw art-group data 469)) + (ja :chan 1 :group! (-> self draw art-group data 470)) + (while (or (< sv-136 (-> sv-132 length)) (not (time-elapsed? sv-152 (seconds 1.5)))) + (let ((v1-84 (new-stack-vector0))) + (let ((f0-10 (vector-dot (-> self control dynam gravity-normal) (-> self control transv)))) + 0.0 + (vector-! v1-84 (-> self control transv) (vector-float*! v1-84 (-> self control dynam gravity-normal) f0-10)) + ) + (let* ((f0-11 (vector-length v1-84)) + (f1-3 f0-11) + (f2-0 0.0) + ) + (vector+! + (-> self control transv) + (vector-float*! (-> self control transv) (-> self control dynam gravity-normal) f2-0) + (vector-float*! v1-84 v1-84 (/ f0-11 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-144 (seconds 0.1)) + (set! sv-144 (current-time)) + (target-bomb1-fire-shot sv-132 sv-136 (the-as int sv-176)) + (+! sv-136 1) + (if (time-elapsed? (-> self state-time) (seconds 1)) + (set! sv-164 (the-as float 1.0)) + ) + ) + (set! sv-160 (seek sv-160 sv-164 (* 6.0 (seconds-per-frame)))) + (ja :num! (loop!)) + (let ((a0-61 (-> self skel root-channel 1))) + (let ((f0-21 sv-160)) + (set! (-> a0-61 frame-interp 1) f0-21) + (set! (-> a0-61 frame-interp 0) f0-21) + ) + (set! (-> a0-61 param 0) 0.0) + (joint-control-channel-group-eval! a0-61 (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-144 (seconds 0.1)) - (set! sv-144 (current-time)) - (target-bomb1-fire-shot sv-132 sv-136 (the-as int sv-176)) - (set! sv-136 (+ sv-136 1)) - (if (time-elapsed? (-> self state-time) (seconds 1)) - (set! sv-164 (the-as float 1.0)) - ) - ) - (set! sv-160 (seek sv-160 sv-164 (* 6.0 (seconds-per-frame)))) - (ja :num! (loop!)) - (let ((a0-61 (-> self skel root-channel 1))) - (let ((f0-21 sv-160)) - (set! (-> a0-61 frame-interp 1) f0-21) - (set! (-> a0-61 frame-interp 0) f0-21) - ) - (set! (-> a0-61 param 0) 0.0) - (joint-control-channel-group-eval! a0-61 (the-as art-joint-anim #f) num-func-chan) - ) - (suspend) ) (set! (-> self post-hook) gp-0) ) diff --git a/test/decompiler/reference/jak3/engine/target/target-death_REF.gc b/test/decompiler/reference/jak3/engine/target/target-death_REF.gc index b493f393ec..bf42a7d7bc 100644 --- a/test/decompiler/reference/jak3/engine/target/target-death_REF.gc +++ b/test/decompiler/reference/jak3/engine/target/target-death_REF.gc @@ -228,7 +228,6 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch object vs none. (defbehavior apply-pos-from-entity target ((arg0 continue-point)) - (local-vars (sv-1328 collide-query)) (let ((s1-0 (entity-by-name (the-as string (-> arg0 on-goto))))) (cond (s1-0 @@ -258,28 +257,29 @@ (set! (-> s2-0 x) (* 4096.0 (the float (-> s0-0 user-int16 0)))) (set! (-> s2-0 y) (-> s1-0 extra trans y)) (set! (-> s2-0 z) (* 4096.0 (the float (-> s0-0 user-int16 1)))) - (set! sv-1328 (new 'stack-no-clear 'collide-query)) - (set-vector! (-> sv-1328 move-dist) 0.0 -204800.0 0.0 1.0) - (vector-copy! (-> sv-1328 start-pos) s2-0) - (+! (-> sv-1328 start-pos y) 102400.0) - (let ((v1-20 sv-1328)) - (set! (-> v1-20 radius) 409.6) - (set! (-> v1-20 collide-with) (collide-spec backgnd)) - (set! (-> v1-20 ignore-process0) #f) - (set! (-> v1-20 ignore-process1) #f) - (set! (-> v1-20 ignore-pat) - (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) + (let ((sv-1328 (new 'stack-no-clear 'collide-query))) + (set-vector! (-> sv-1328 move-dist) 0.0 -204800.0 0.0 1.0) + (vector-copy! (-> sv-1328 start-pos) s2-0) + (+! (-> sv-1328 start-pos y) 102400.0) + (let ((v1-20 sv-1328)) + (set! (-> v1-20 radius) 409.6) + (set! (-> v1-20 collide-with) (collide-spec backgnd)) + (set! (-> v1-20 ignore-process0) #f) + (set! (-> v1-20 ignore-process1) #f) + (set! (-> v1-20 ignore-pat) + (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) + ) + (set! (-> v1-20 action-mask) (collide-action solid)) + ) + (let ((f0-12 (fill-and-probe-using-line-sphere *collide-cache* sv-1328))) + (cond + ((>= f0-12 0.0) + (vector+*! s2-0 (-> sv-1328 start-pos) (-> sv-1328 move-dist) f0-12) + (set! (-> s2-0 y) (+ 4096.0 (-> s2-0 y))) + ) + (else + (format 0 "failed to find gem ground on pos-from-entity~%") ) - (set! (-> v1-20 action-mask) (collide-action solid)) - ) - (let ((f0-12 (fill-and-probe-using-line-sphere *collide-cache* sv-1328))) - (cond - ((>= f0-12 0.0) - (vector+*! s2-0 (-> sv-1328 start-pos) (-> sv-1328 move-dist) f0-12) - (set! (-> s2-0 y) (+ 4096.0 (-> s2-0 y))) - ) - (else - (format 0 "failed to find gem ground on pos-from-entity~%") ) ) ) @@ -1353,336 +1353,337 @@ ) ) :code (behavior ((arg0 symbol) (arg1 attack-info)) - (local-vars (sv-32 attack-info) (sv-36 vector)) (logclear! (-> self water flags) (water-flag 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) (-> *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) - ) - ) - ) - (let ((v1-13 (if (logtest? (-> arg1 mask) (attack-mask mode)) - (-> arg1 mode) - 'generic - ) - ) + (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) (-> *TARGET-bank* hit-invulnerable-timeout)) + (set! (-> v1-7 damage) (-> *FACT-bank* health-default-inc)) ) - (when (or (= v1-13 'lava) (or (= v1-13 'melt) (= v1-13 'fry) (= v1-13 'slime))) - (let ((v1-16 sv-32)) - (set! (-> v1-16 shove-up) 32768.0) - (set! (-> v1-16 angle) 'lava) - (set! (-> v1-16 control) 1.0) - (set! (-> v1-16 damage) 4.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)) - ) - (when (and (focus-test? self dark) (nonzero? (-> self darkjak))) - (set! (-> sv-32 damage) (fmax 1.0 (ceil (/ (-> sv-32 damage) 2)))) - 0 - ) - (vector-copy! sv-36 (-> sv-32 vector)) - (let ((f0-19 (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-19) - '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))) - (vector-copy! gp-1 (-> self control last-trans-on-ground)) - (ja-channel-set! 0) - (suspend-for (seconds 1) - ) - (move-to-point! (-> self control) gp-1) - ) - (vector-copy! (-> self control camera-pos) (-> self control trans)) - (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)) - ) - ) + ) ) - (('fry) - (pickup-collectable! (-> self fact) (pickup-type health) (- (-> sv-32 damage)) (the-as handle #f)) - (cond - ((and (= (-> self game mode) 'play) (>= 0.0 (-> self fact health))) - (go target-death (-> sv-32 mode)) - ) - (else - (sound-play "death-melt") - (cond - ((logtest? (-> group-lava-death flags) (sp-group-flag sp13)) - (vector-copy! (-> *launch-matrix* trans) (-> self control trans)) - (part-tracker-spawn part-tracker-subsampler :to *entity-pool* :group group-lava-death) - ) - (else - (vector-copy! (-> *launch-matrix* trans) (-> self control trans)) - (part-tracker-spawn part-tracker :to *entity-pool* :group group-lava-death) - ) - ) - ) - ) - ) - (('lava 'melt 'slime) - (pickup-collectable! (-> self fact) (pickup-type health) -1000.0 (the-as handle #f)) - (cond - ((and (= (-> self game mode) 'play) (>= 0.0 (-> self fact health))) - (go target-death (-> sv-32 mode)) - ) - (else - (sound-play "death-melt") - (cond - ((logtest? (-> group-lava-death flags) (sp-group-flag sp13)) - (vector-copy! (-> *launch-matrix* trans) (-> self control trans)) - (part-tracker-spawn part-tracker-subsampler :to *entity-pool* :group group-lava-death) - ) - (else - (vector-copy! (-> *launch-matrix* trans) (-> self control trans)) - (part-tracker-spawn part-tracker :to *entity-pool* :group group-lava-death) - ) - ) - ) - ) - ) - (('drown-death - 'sharkey - 'dark-eco-pool - 'instant-death - 'crush - 'death - 'grenade - 'bot - 'turret - 'centipede - 'big-explosion - 'tentacle - ) - (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) - (case (-> sv-32 angle) - (('front) - (forward-up-nopitch->quaternion - (-> self control dir-targ) - (vector-negate! (new 'stack-no-clear 'vector) sv-36) - (-> self control dynam gravity-normal) - ) - ) - (else - (forward-up-nopitch->quaternion (-> self control dir-targ) sv-36 (-> self control dynam gravity-normal)) - ) - ) - (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-211 (-> sv-32 mode)) - (gp-9 (cond - ((= v1-211 'shock-red) - group-lightning-red-glow - ) - ((= v1-211 'shock-green) - group-lightning-green-glow - ) - (else - group-lightning-glow - ) + (let ((v1-13 (if (logtest? (-> arg1 mask) (attack-mask mode)) + (-> arg1 mode) + 'generic ) - ) - ) - (if (logtest? (-> gp-9 flags) (sp-group-flag sp13)) - (part-tracker-spawn - part-tracker-subsampler - :to self - :group gp-9 - :duration (seconds 1) - :target self - :mat-joint 6 - ) - (part-tracker-spawn part-tracker :to self :group gp-9 :duration (seconds 1) :target self :mat-joint 6) - ) - ) - (let ((gp-10 (-> 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-247 (new-stack-vector0))) - (let ((f0-36 (vector-dot (-> self control dynam gravity-normal) (-> self control transv)))) - 0.0 - (vector-! - v1-247 - (-> self control transv) - (vector-float*! v1-247 (-> self control dynam gravity-normal) f0-36) - ) - ) - (let* ((f0-37 (vector-length v1-247)) - (f1-6 f0-37) - (f2-0 0.0) ) - (vector+! - (-> self control transv) - (vector-float*! (-> self control transv) (-> self control dynam gravity-normal) f2-0) - (vector-float*! v1-247 v1-247 (/ f0-37 f1-6)) + ) + (when (or (= v1-13 'lava) (or (= v1-13 'melt) (= v1-13 'fry) (= v1-13 'slime))) + (let ((v1-16 sv-32)) + (set! (-> v1-16 shove-up) 32768.0) + (set! (-> v1-16 angle) 'lava) + (set! (-> v1-16 control) 1.0) + (set! (-> v1-16 damage) 4.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)) + ) + (when (and (focus-test? self dark) (nonzero? (-> self darkjak))) + (set! (-> sv-32 damage) (fmax 1.0 (ceil (/ (-> sv-32 damage) 2)))) + 0 + ) + (vector-copy! sv-36 (-> sv-32 vector)) + (let ((f0-19 (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-19) + '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))) + (vector-copy! gp-1 (-> self control last-trans-on-ground)) + (ja-channel-set! 0) + (suspend-for (seconds 1) + ) + (move-to-point! (-> self control) gp-1) + ) + (vector-copy! (-> self control camera-pos) (-> self control trans)) + (send-event *camera* 'teleport) + (go target-stance) + ) + (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-263 (new-stack-vector0)) - (f0-44 (vector-dot (-> self control dynam gravity-normal) (-> self control transv))) - ) - 0.0 - (vector-! - v1-263 - (-> self control transv) - (vector-float*! v1-263 (-> self control dynam gravity-normal) f0-44) - ) - (let* ((f1-9 (vector-length v1-263)) - (f2-1 f1-9) - (f0-45 (+ f0-44 (* 286720.0 (seconds-per-frame)))) - ) - (vector+! - (-> self control transv) - (vector-float*! (-> self control transv) (-> self control dynam gravity-normal) f0-45) - (vector-float*! v1-263 v1-263 (/ f1-9 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 + (('fry) + (pickup-collectable! (-> self fact) (pickup-type health) (- (-> sv-32 damage)) (the-as handle #f)) + (cond + ((and (= (-> self game mode) 'play) (>= 0.0 (-> self fact health))) + (go target-death (-> sv-32 mode)) + ) + (else + (sound-play "death-melt") + (cond + ((logtest? (-> group-lava-death flags) (sp-group-flag sp13)) + (vector-copy! (-> *launch-matrix* trans) (-> self control trans)) + (part-tracker-spawn part-tracker-subsampler :to *entity-pool* :group group-lava-death) ) - ) - (('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* 160) - 0 - 0 - 40960.0 + (else + (vector-copy! (-> *launch-matrix* trans) (-> self control trans)) + (part-tracker-spawn part-tracker :to *entity-pool* :group group-lava-death) ) ) ) ) - (suspend) - (ja :num! (seek!)) ) - (set! (-> sv-32 angle) 'back) - (set! (-> self post-hook) gp-10) + (('lava 'melt 'slime) + (pickup-collectable! (-> self fact) (pickup-type health) -1000.0 (the-as handle #f)) + (cond + ((and (= (-> self game mode) 'play) (>= 0.0 (-> self fact health))) + (go target-death (-> sv-32 mode)) + ) + (else + (sound-play "death-melt") + (cond + ((logtest? (-> group-lava-death flags) (sp-group-flag sp13)) + (vector-copy! (-> *launch-matrix* trans) (-> self control trans)) + (part-tracker-spawn part-tracker-subsampler :to *entity-pool* :group group-lava-death) + ) + (else + (vector-copy! (-> *launch-matrix* trans) (-> self control trans)) + (part-tracker-spawn part-tracker :to *entity-pool* :group group-lava-death) + ) + ) + ) + ) + ) + (('drown-death + 'sharkey + 'dark-eco-pool + 'instant-death + 'crush + 'death + 'grenade + 'bot + 'turret + 'centipede + 'big-explosion + 'tentacle + ) + (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) + (case (-> sv-32 angle) + (('front) + (forward-up-nopitch->quaternion + (-> self control dir-targ) + (vector-negate! (new 'stack-no-clear 'vector) sv-36) + (-> self control dynam gravity-normal) + ) + ) + (else + (forward-up-nopitch->quaternion (-> self control dir-targ) sv-36 (-> self control dynam gravity-normal)) + ) + ) + (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-211 (-> sv-32 mode)) + (gp-9 (cond + ((= v1-211 'shock-red) + group-lightning-red-glow + ) + ((= v1-211 'shock-green) + group-lightning-green-glow + ) + (else + group-lightning-glow + ) + ) + ) + ) + (if (logtest? (-> gp-9 flags) (sp-group-flag sp13)) + (part-tracker-spawn + part-tracker-subsampler + :to self + :group gp-9 + :duration (seconds 1) + :target self + :mat-joint 6 + ) + (part-tracker-spawn part-tracker :to self :group gp-9 :duration (seconds 1) :target self :mat-joint 6) + ) + ) + (let ((gp-10 (-> 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-247 (new-stack-vector0))) + (let ((f0-36 (vector-dot (-> self control dynam gravity-normal) (-> self control transv)))) + 0.0 + (vector-! + v1-247 + (-> self control transv) + (vector-float*! v1-247 (-> self control dynam gravity-normal) f0-36) + ) + ) + (let* ((f0-37 (vector-length v1-247)) + (f1-6 f0-37) + (f2-0 0.0) + ) + (vector+! + (-> self control transv) + (vector-float*! (-> self control transv) (-> self control dynam gravity-normal) f2-0) + (vector-float*! v1-247 v1-247 (/ f0-37 f1-6)) + ) + ) + ) + (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-263 (new-stack-vector0)) + (f0-44 (vector-dot (-> self control dynam gravity-normal) (-> self control transv))) + ) + 0.0 + (vector-! + v1-263 + (-> self control transv) + (vector-float*! v1-263 (-> self control dynam gravity-normal) f0-44) + ) + (let* ((f1-9 (vector-length v1-263)) + (f2-1 f1-9) + (f0-45 (+ f0-44 (* 286720.0 (seconds-per-frame)))) + ) + (vector+! + (-> self control transv) + (vector-float*! (-> self control transv) (-> self control dynam gravity-normal) f0-45) + (vector-float*! v1-263 v1-263 (/ f1-9 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* 160) + 0 + 0 + 40960.0 + ) + ) + ) + ) + (suspend) + (ja :num! (seek!)) + ) + (set! (-> sv-32 angle) 'back) + (set! (-> self post-hook) gp-10) + ) + ) + (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)) 'notice '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) ) - ) - (when (and (= (-> self game mode) 'play) (and (>= 0.0 (-> self fact health)) (using-gun? self))) - (send-event (ppointer->process (-> self gun gun)) 'notice '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) - (cond - ((and (= (-> self game mode) 'play) (>= 0.0 (-> self fact health))) - (go target-death (-> sv-32 mode)) - ) - ((and (and (focus-test? self dark) (nonzero? (-> self darkjak))) (>= 1.0 (-> self fact health))) - (go target-darkjak-get-off) - ) - ((and (and (focus-test? self light) (nonzero? (-> self lightjak))) (>= 1.0 (-> self fact health))) - (go target-lightjak-get-off) - ) - (else - (go target-hit-ground #f) + (cond + ((and (= (-> self game mode) 'play) (>= 0.0 (-> self fact health))) + (go target-death (-> sv-32 mode)) + ) + ((and (and (focus-test? self dark) (nonzero? (-> self darkjak))) (>= 1.0 (-> self fact health))) + (go target-darkjak-get-off) + ) + ((and (and (focus-test? self light) (nonzero? (-> self lightjak))) (>= 1.0 (-> self fact health))) + (go target-lightjak-get-off) + ) + (else + (go target-hit-ground #f) + ) ) ) ) @@ -1858,7 +1859,6 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defbehavior target-death-main target ((arg0 symbol)) - (local-vars (sv-96 level) (sv-112 vector)) (let ((v1-0 arg0)) (if (= v1-0 'tar) (sound-play "death-drown") @@ -1948,91 +1948,77 @@ (send-event self 'blend-shape #t) (apply-settings *setting-control*) (flag-setup) - (set! sv-96 (the-as level #f)) - (art-group-get-by-name *level* "daxter-highres" (new 'stack-no-clear 'array 'level 1)) - (let ((s4-1 (if (and sv-96 (nonzero? (-> sv-96 entity)) (> (-> sv-96 entity length) 0)) - (-> sv-96 entity data 0 entity) - ) - ) - ) - (when s4-1 - (let ((s5-2 (ppointer->handle (process-spawn - pov-camera - (-> self control trans) - (art-group-get-by-name *level* "skel-scenecamera" (the-as (pointer level) #f)) - gp-2 - 12 - self - '() - :name "pov-camera" - :to *target-pool* - ) - ) - ) - ) - (when (handle->process s5-2) - (let* ((s2-1 (get-process *default-dead-pool* manipy #x20000 1)) - (s3-1 - (when s2-1 - (let ((t9-33 (method-of-type manipy activate))) - (t9-33 (the-as manipy s2-1) (handle->process s5-2) "sidekick-highres" (the-as pointer #x70004000)) - ) - (let ((s3-2 run-function-in-process) - (s1-1 s2-1) - (s0-1 manipy-init) - ) - (set! sv-112 (-> self control trans)) - (let ((t0-6 (art-group-get-by-name *level* "skel-sidekick-highres" (the-as (pointer level) #f))) - (t1-5 #f) - (t2-3 0) - ) - ((the-as (function object object object object object object object none) s3-2) - s1-1 - s0-1 - sv-112 - s4-1 - t0-6 - t1-5 - t2-3 - ) - ) - ) - (-> s2-1 ppointer) - ) - ) - ) - (process-spawn-function - process - (lambda :behavior target ((arg0 handle)) (suspend) (send-event (handle->process arg0) 'light-index 240)) - (ppointer->handle s3-1) - :to self - ) - (send-event (ppointer->process s3-1) 'anim-mode 'clone-anim) - (send-event (ppointer->process s3-1) 'blend-shape #t) - ) - (send-event (handle->process s5-2) 'music-movie-volume 0.0) - (send-event (handle->process s5-2) 'sfx-movie-volume 0.5) - (send-event (handle->process s5-2) 'ambient-movie-volume 0.5) - (set! (-> self post-hook) target-no-ja-move-post) - (ja-channel-set! 0) - (while (handle->process s5-2) - (gui-control-method-12 - *gui-control* - self - (gui-channel art-load) - (gui-action queue) - (-> gp-2 name) - 0 - -99.0 - (new 'static 'sound-id) - ) - (suspend) - ) - (set-blackout-frames (seconds 0.2)) - (let ((a0-83 (handle->process s5-2))) - (if a0-83 - (deactivate a0-83) + (let ((sv-96 (the-as level #f))) + (art-group-get-by-name *level* "daxter-highres" (new 'stack-no-clear 'array 'level 1)) + (let ((s4-1 (if (and sv-96 (nonzero? (-> sv-96 entity)) (> (-> sv-96 entity length) 0)) + (-> sv-96 entity data 0 entity) + ) ) + ) + (when s4-1 + (let ((s5-2 (ppointer->handle (process-spawn + pov-camera + (-> self control trans) + (art-group-get-by-name *level* "skel-scenecamera" (the-as (pointer level) #f)) + gp-2 + 12 + self + '() + :name "pov-camera" + :to *target-pool* + ) + ) + ) + ) + (when (handle->process s5-2) + (let ((s3-1 + (process-spawn + manipy + :init manipy-init + (-> self control trans) + s4-1 + (art-group-get-by-name *level* "skel-sidekick-highres" (the-as (pointer level) #f)) + #f + 0 + :name "sidekick-highres" + :to (handle->process s5-2) + :stack-size #x20000 + ) + ) + ) + (process-spawn-function + process + (lambda :behavior target ((arg0 handle)) (suspend) (send-event (handle->process arg0) 'light-index 240)) + (ppointer->handle s3-1) + :to self + ) + (send-event (ppointer->process s3-1) 'anim-mode 'clone-anim) + (send-event (ppointer->process s3-1) 'blend-shape #t) + ) + (send-event (handle->process s5-2) 'music-movie-volume 0.0) + (send-event (handle->process s5-2) 'sfx-movie-volume 0.5) + (send-event (handle->process s5-2) 'ambient-movie-volume 0.5) + (set! (-> self post-hook) target-no-ja-move-post) + (ja-channel-set! 0) + (while (handle->process s5-2) + (gui-control-method-12 + *gui-control* + self + (gui-channel art-load) + (gui-action queue) + (-> gp-2 name) + 0 + -99.0 + (new 'static 'sound-id) + ) + (suspend) + ) + (set-blackout-frames (seconds 0.2)) + (let ((a0-83 (handle->process s5-2))) + (if a0-83 + (deactivate a0-83) + ) + ) ) ) ) diff --git a/test/decompiler/reference/jak3/engine/target/target-handler_REF.gc b/test/decompiler/reference/jak3/engine/target/target-handler_REF.gc index e7f1bdc7d8..cec247d246 100644 --- a/test/decompiler/reference/jak3/engine/target/target-handler_REF.gc +++ b/test/decompiler/reference/jak3/engine/target/target-handler_REF.gc @@ -276,22 +276,15 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch object vs none. (defbehavior target-darkjak-effect-trans target ((arg0 handle) (arg1 (pointer process-drawable)) (arg2 (pointer time-frame)) (arg3 time-frame)) - (local-vars (sv-112 vector) (sv-128 matrix)) (let ((s2-0 sp-launch-particles-var) (s1-0 *sp-particle-system-2d*) (s0-0 (-> *part-id-table* 173)) + (sv-128 *launch-matrix*) ) - (set! sv-128 *launch-matrix*) - (set! sv-112 (-> sv-128 trans)) - (let ((v1-6 (-> (process-drawable-random-point! (ppointer->process arg1) (new 'stack-no-clear 'vector)) quad))) - (set! (-> sv-112 quad) v1-6) - ) - (let ((a3-1 #f) - (t0-0 #f) - (t1-0 1.0) - ) - (s2-0 s1-0 s0-0 sv-128 (the-as sparticle-launch-state a3-1) (the-as sparticle-launch-control t0-0) t1-0) + (let ((sv-112 (-> sv-128 trans))) + (vector-copy! sv-112 (process-drawable-random-point! (ppointer->process arg1) (new 'stack-no-clear 'vector))) ) + (s2-0 s1-0 s0-0 sv-128 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0) ) (send-event (ppointer->process arg1) 'color-effect 'dark (seconds 0.2)) (when (time-elapsed? (-> arg2 0) (seconds 0.05)) @@ -345,9 +338,8 @@ ;; 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-128 vector) (sv-132 touching-prims-entry) (sv-136 int) (sv-144 int)) - (set! sv-144 arg3) - (let ((s1-0 arg4) + (let ((sv-144 arg3) + (s1-0 arg4) (s0-0 arg5) ) (if (and (= arg1 'bomb) @@ -361,337 +353,341 @@ (let* ((f30-0 (penetrate-using->damage s0-0)) (s5-0 (as-type arg0 process-focusable)) (s2-1 (and s5-0 (focus-test? s5-0 dead hit))) + (a1-2 (new 'stack-no-clear 'event-message-block)) ) - (set! sv-96 - (the-as symbol (send-event - arg0 - 'attack - arg2 - (static-attack-info :mask (vehicle-impulse-factor) ((id (the-as uint sv-144)) - (damage f30-0) - (vehicle-damage-factor 1.0) - (vehicle-impulse-factor 1.0) - (mode arg1) - (count (the-as uint s1-0)) - (penetrate-using s0-0) - ) - ) - ) + (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 uint (static-attack-info :mask (vehicle-impulse-factor) ((id (the-as uint sv-144)) + (damage f30-0) + (vehicle-damage-factor 1.0) + (vehicle-impulse-factor 1.0) + (mode arg1) + (count (the-as uint s1-0)) + (penetrate-using s0-0) + ) + ) ) ) - (when sv-96 - (let ((v1-17 (new 'stack-no-clear 'vector))) - (vector-copy! v1-17 (-> self control trans)) - (set! sv-128 v1-17) - ) - (set! sv-132 (if arg2 - (prims-touching? arg2 (-> self control) (the-as uint 256)) - ) - ) - (set! sv-136 -1) - (cond - ((not arg2) - ) - (sv-132 - (set! sv-136 1) - (get-intersect-point sv-128 sv-132 (-> self control) arg2) - ) - ((let ((v0-6 (prims-touching? arg2 (-> self control) (the-as uint 128)))) - (set! sv-132 v0-6) - v0-6 - ) - (set! sv-136 0) - (get-intersect-point sv-128 sv-132 (-> self control) arg2) - ) - ) - (set! (-> self control send-attack-dest) (process->handle arg0)) - (set-time! (-> self control send-attack-time)) - (send-event self 'hit arg1 arg0 arg2 sv-128) - (set! arg0 (and (and (focus-test? self dark) - (nonzero? (-> self darkjak)) - (logtest? (-> self darkjak stage) (darkjak-stage active)) - ) - arg0 - ) - ) - (when arg0 - (when (and s5-0 (not s2-1) (-> self control danger-mode) (not (logtest? (-> s5-0 mask) (process-mask dark-effect)))) - (logior! (-> s5-0 mask) (process-mask dark-effect)) - (process-spawn-function - process - (lambda :behavior target - ((arg0 handle)) - (local-vars (sv-16 int)) - (let ((gp-0 (-> self parent))) - (let ((s4-0 (current-time))) - (set! sv-16 0) - (+! (-> self clock ref-count) -1) - (+! (-> gp-0 0 clock ref-count) 1) - (set! (-> self clock) (-> gp-0 0 clock)) - (while (let ((v1-10 gp-0)) - (and (or (focus-test? - (the-as process-focusable (if v1-10 - (the-as process-focusable (-> v1-10 0 self)) - ) - ) - dead - hit - ) - (let ((v1-15 gp-0)) - (and (-> (the-as process (if v1-15 - (the-as process (-> v1-15 0 self)) - ) - ) - next-state - ) - (let ((v1-18 gp-0)) - (= (-> (the-as process (if v1-18 - (the-as process (-> v1-18 0 self)) - ) - ) - next-state - name + (let ((sv-96 (the-as symbol (send-event-function arg0 a1-2)))) + (when sv-96 + (let ((v1-17 (new 'stack-no-clear 'vector))) + (vector-copy! v1-17 (-> self control trans)) + (let ((sv-128 v1-17) + (sv-132 (if arg2 + (prims-touching? arg2 (-> self control) (the-as uint 256)) + ) + ) + (sv-136 -1) + ) + (cond + ((not arg2) + ) + (sv-132 + (set! sv-136 1) + (get-intersect-point sv-128 sv-132 (-> self control) arg2) + ) + ((let ((v0-6 (prims-touching? arg2 (-> self control) (the-as uint 128)))) + (set! sv-132 v0-6) + v0-6 + ) + (set! sv-136 0) + (get-intersect-point sv-128 sv-132 (-> self control) arg2) + ) + ) + (set! (-> self control send-attack-dest) (process->handle arg0)) + (set-time! (-> self control send-attack-time)) + (send-event self 'hit arg1 arg0 arg2 sv-128) + (set! arg0 (and (and (focus-test? self dark) + (nonzero? (-> self darkjak)) + (logtest? (-> self darkjak stage) (darkjak-stage active)) + ) + arg0 + ) + ) + (when arg0 + (when (and s5-0 (not s2-1) (-> self control danger-mode) (not (logtest? (-> s5-0 mask) (process-mask dark-effect)))) + (logior! (-> s5-0 mask) (process-mask dark-effect)) + (process-spawn-function + process + (lambda :behavior target + ((arg0 handle)) + (let ((gp-0 (-> self parent))) + (let ((s4-0 (current-time)) + (sv-16 0) + ) + (+! (-> self clock ref-count) -1) + (+! (-> gp-0 0 clock ref-count) 1) + (set! (-> self clock) (-> gp-0 0 clock)) + (while (let ((v1-10 gp-0)) + (and (or (focus-test? + (the-as process-focusable (if v1-10 + (the-as process-focusable (-> v1-10 0 self)) + ) ) - 'knocked - ) - ) + dead + hit + ) + (let ((v1-15 gp-0)) + (and (-> (the-as process (if v1-15 + (the-as process (-> v1-15 0 self)) + ) + ) + next-state + ) + (let ((v1-18 gp-0)) + (= (-> (the-as process (if v1-18 + (the-as process (-> v1-18 0 self)) + ) + ) + next-state + name + ) + 'knocked + ) + ) + ) + ) + ) + (not (time-elapsed? s4-0 (seconds 15))) + (not (logtest? (-> (the-as process-focusable (-> gp-0 0)) draw status) (draw-control-status no-draw no-draw-temp)) ) ) - ) - (not (time-elapsed? s4-0 (seconds 15))) - (not (logtest? (-> (the-as process-focusable (-> gp-0 0)) draw status) (draw-control-status no-draw no-draw-temp)) - ) - ) - ) - (target-darkjak-effect-trans - arg0 - (the-as (pointer process-drawable) gp-0) - (the-as (pointer time-frame) (& sv-16)) - s4-0 + ) + (target-darkjak-effect-trans + arg0 + (the-as (pointer process-drawable) gp-0) + (the-as (pointer time-frame) (& sv-16)) + s4-0 + ) + (suspend) + ) + ) + (logclear! (-> gp-0 0 mask) (process-mask dark-effect)) + (send-event (ppointer->process gp-0) 'color-effect #f 0) ) - (suspend) + (none) ) + (process->handle self) + :to s5-0 ) - (logclear! (-> gp-0 0 mask) (process-mask dark-effect)) - (send-event (ppointer->process gp-0) 'color-effect #f 0) ) - (none) ) - (process->handle self) - :to s5-0 - ) - ) - ) - (let ((v1-57 arg1)) - (cond - ((or (= v1-57 'spin) (= v1-57 'spin-air) (= v1-57 'board-spin) (= v1-57 'board-zap)) - (case sv-136 - ((1) + (let ((v1-57 arg1)) (cond - ((logtest? (-> group-spin-hit flags) (sp-group-flag sp13)) - (vector-copy! (-> *launch-matrix* trans) sv-128) - (part-tracker-spawn part-tracker-subsampler :to self :group group-spin-hit) - ) - (else - (vector-copy! (-> *launch-matrix* trans) sv-128) - (part-tracker-spawn part-tracker :to self :group group-spin-hit) - ) - ) - ) - (else - (do-effect (-> self skel effect) "group-spin-hit" -1.0 49) - ) - ) - (play-effect-sound - (-> self skel effect) - (the-as symbol "sound") - -1.0 - 49 - (the-as basic #f) - (cond - ((= arg1 'board-spin) - (static-sound-name "board-impact") - ) - ((= arg1 'board-zap) - (static-sound-name "board-zap-hit") - ) - ((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-57 'get-on) (= v1-57 'darkjak)) - (let ((v1-105 sv-136)) - (when (or (zero? v1-105) (= v1-105 1)) - (cond - ((logtest? (-> group-punch-hit flags) (sp-group-flag sp13)) - (vector-copy! (-> *launch-matrix* trans) sv-128) - (part-tracker-spawn part-tracker-subsampler :to self :group group-punch-hit) - ) - (else - (vector-copy! (-> *launch-matrix* trans) sv-128) - (part-tracker-spawn part-tracker :to self :group group-punch-hit) - ) - ) - ) - ) - (play-effect-sound - (-> self skel effect) - (the-as symbol "sound") - -1.0 - 3 - (the-as basic #f) - (static-sound-name "get-on-hit") - ) - ) - ((= v1-57 'shield) - (play-effect-sound - (-> self skel effect) - (the-as symbol "sound") - -1.0 - 3 - (the-as basic #f) - (static-sound-name "shield-attack") - ) - ) - ((or (= v1-57 'punch) (= v1-57 'dark-smack) (= v1-57 'mech-punch)) - (let ((v1-147 sv-136)) - (when (or (zero? v1-147) (= v1-147 1)) - (cond - ((logtest? (-> group-punch-hit flags) (sp-group-flag sp13)) - (vector-copy! (-> *launch-matrix* trans) sv-128) - (part-tracker-spawn part-tracker-subsampler :to self :group group-punch-hit) - ) - (else - (vector-copy! (-> *launch-matrix* trans) sv-128) - (part-tracker-spawn part-tracker :to self :group group-punch-hit) - ) - ) - ) - ) - (cond - ((= arg1 'mech-punch) - (play-effect-sound - (-> self skel effect) - (the-as symbol "sound") - -1.0 - 28 - (the-as basic #f) - (static-sound-name "mech-punch-hit") - ) - ) - (else - (let ((name (if (using-gun? self) - (the-as sound-name (static-sound-name "gun-punch-hit")) - (the-as sound-name (static-sound-name "punch-hit")) - ) - ) + ((or (= v1-57 'spin) (= v1-57 'spin-air) (= v1-57 'board-spin) (= v1-57 'board-zap)) + (case sv-136 + ((1) + (cond + ((logtest? (-> group-spin-hit flags) (sp-group-flag sp13)) + (vector-copy! (-> *launch-matrix* trans) sv-128) + (part-tracker-spawn part-tracker-subsampler :to self :group group-spin-hit) + ) + (else + (vector-copy! (-> *launch-matrix* trans) sv-128) + (part-tracker-spawn part-tracker :to self :group group-spin-hit) + ) + ) + ) + (else + (do-effect (-> self skel effect) "group-spin-hit" -1.0 49) ) + ) + (play-effect-sound + (-> self skel effect) + (the-as symbol "sound") + -1.0 + 49 + (the-as basic #f) + (cond + ((= arg1 'board-spin) + (static-sound-name "board-impact") + ) + ((= arg1 'board-zap) + (static-sound-name "board-zap-hit") + ) + ((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-57 'get-on) (= v1-57 'darkjak)) + (let ((v1-105 sv-136)) + (when (or (zero? v1-105) (= v1-105 1)) + (cond + ((logtest? (-> group-punch-hit flags) (sp-group-flag sp13)) + (vector-copy! (-> *launch-matrix* trans) sv-128) + (part-tracker-spawn part-tracker-subsampler :to self :group group-punch-hit) + ) + (else + (vector-copy! (-> *launch-matrix* trans) sv-128) + (part-tracker-spawn part-tracker :to self :group group-punch-hit) + ) + ) + ) + ) + (play-effect-sound + (-> self skel effect) + (the-as symbol "sound") + -1.0 + 3 + (the-as basic #f) + (static-sound-name "get-on-hit") + ) + ) + ((= v1-57 'shield) + (play-effect-sound + (-> self skel effect) + (the-as symbol "sound") + -1.0 + 3 + (the-as basic #f) + (static-sound-name "shield-attack") + ) + ) + ((or (= v1-57 'punch) (= v1-57 'dark-smack) (= v1-57 'mech-punch)) + (let ((v1-147 sv-136)) + (when (or (zero? v1-147) (= v1-147 1)) + (cond + ((logtest? (-> group-punch-hit flags) (sp-group-flag sp13)) + (vector-copy! (-> *launch-matrix* trans) sv-128) + (part-tracker-spawn part-tracker-subsampler :to self :group group-punch-hit) + ) + (else + (vector-copy! (-> *launch-matrix* trans) sv-128) + (part-tracker-spawn part-tracker :to self :group group-punch-hit) + ) + ) + ) + ) + (cond + ((= arg1 'mech-punch) + (play-effect-sound + (-> self skel effect) + (the-as symbol "sound") + -1.0 + 28 + (the-as basic #f) + (static-sound-name "mech-punch-hit") + ) + ) + (else + (let ((name (if (using-gun? self) + (the-as sound-name (static-sound-name "gun-punch-hit")) + (the-as sound-name (static-sound-name "punch-hit")) + ) + ) + ) + (play-effect-sound + (-> self skel effect) + (the-as symbol "sound") + -1.0 + 28 + (the-as basic #f) + (the-as sound-name name) + ) + ) + ) + ) + (cpad-set-buzz! (-> *cpad-list* cpads 0) 1 178 (seconds 0.1)) + ) + ((= v1-57 'flip) + (play-effect-sound + (-> self skel effect) + (the-as symbol "sound") + -1.0 + 49 + (the-as basic #f) + (static-sound-name "punch-hit") + ) + (cpad-set-buzz! (-> *cpad-list* cpads 0) 1 127 (seconds 0.1)) + ) + ((= v1-57 'uppercut) + (let ((v1-199 sv-136)) + (when (or (zero? v1-199) (= v1-199 1)) + (cond + ((logtest? (-> group-punch-hit flags) (sp-group-flag sp13)) + (vector-copy! (-> *launch-matrix* trans) sv-128) + (part-tracker-spawn part-tracker-subsampler :to self :group group-punch-hit) + ) + (else + (vector-copy! (-> *launch-matrix* trans) sv-128) + (part-tracker-spawn part-tracker :to self :group group-punch-hit) + ) + ) + ) + ) + (do-effect (-> self skel effect) "group-uppercut-hit" -1.0 28) (play-effect-sound (-> self skel effect) (the-as symbol "sound") -1.0 28 (the-as basic #f) - (the-as sound-name name) + (static-sound-name "uppercut-hit") + ) + (cpad-set-buzz! (-> *cpad-list* cpads 0) 1 178 (seconds 0.1)) + ) + ((or (= v1-57 'flop) (= v1-57 'flop-down)) + (do-effect (-> self skel effect) "group-flop-hit" -1.0 28) + (do-effect (-> self skel effect) "group-flop-hit" -1.0 19) + (play-effect-sound + (-> self skel effect) + (the-as symbol "sound") + -1.0 + 28 + (the-as basic #f) + (static-sound-name "flop-hit") + ) + (cpad-set-buzz! (-> *cpad-list* cpads 0) 1 178 (seconds 0.1)) + ) + ((= v1-57 'flut-attack) + (play-effect-sound + (-> self skel effect) + (the-as symbol "sound") + -1.0 + 28 + (the-as basic #f) + (static-sound-name "flut-punch-hit") + ) + (cpad-set-buzz! (-> *cpad-list* cpads 0) 1 255 (seconds 0.2)) + ) + ((= v1-57 'darkjak) + (set-time! (-> self darkjak attack-time)) + (let* ((v1-256 *game-info*) + (a0-141 (+ (-> v1-256 attack-id) 1)) + ) + (set! (-> v1-256 attack-id) a0-141) + (set! (-> self darkjak attack-id) a0-141) + a0-141 ) ) - ) - ) - (cpad-set-buzz! (-> *cpad-list* cpads 0) 1 178 (seconds 0.1)) - ) - ((= v1-57 'flip) - (play-effect-sound - (-> self skel effect) - (the-as symbol "sound") - -1.0 - 49 - (the-as basic #f) - (static-sound-name "punch-hit") - ) - (cpad-set-buzz! (-> *cpad-list* cpads 0) 1 127 (seconds 0.1)) - ) - ((= v1-57 'uppercut) - (let ((v1-199 sv-136)) - (when (or (zero? v1-199) (= v1-199 1)) - (cond - ((logtest? (-> group-punch-hit flags) (sp-group-flag sp13)) - (vector-copy! (-> *launch-matrix* trans) sv-128) - (part-tracker-spawn part-tracker-subsampler :to self :group group-punch-hit) - ) - (else - (vector-copy! (-> *launch-matrix* trans) sv-128) - (part-tracker-spawn part-tracker :to self :group group-punch-hit) + ((= v1-57 'lightjak) + (set-time! (-> self darkjak attack-time)) + (let* ((v1-260 *game-info*) + (a0-145 (+ (-> v1-260 attack-id) 1)) + ) + (set! (-> v1-260 attack-id) a0-145) + (set! (-> self darkjak attack-id) a0-145) + a0-145 ) ) - ) - ) - (do-effect (-> self skel effect) "group-uppercut-hit" -1.0 28) - (play-effect-sound - (-> self skel effect) - (the-as symbol "sound") - -1.0 - 28 - (the-as basic #f) - (static-sound-name "uppercut-hit") - ) - (cpad-set-buzz! (-> *cpad-list* cpads 0) 1 178 (seconds 0.1)) - ) - ((or (= v1-57 'flop) (= v1-57 'flop-down)) - (do-effect (-> self skel effect) "group-flop-hit" -1.0 28) - (do-effect (-> self skel effect) "group-flop-hit" -1.0 19) - (play-effect-sound - (-> self skel effect) - (the-as symbol "sound") - -1.0 - 28 - (the-as basic #f) - (static-sound-name "flop-hit") - ) - (cpad-set-buzz! (-> *cpad-list* cpads 0) 1 178 (seconds 0.1)) - ) - ((= v1-57 'flut-attack) - (play-effect-sound - (-> self skel effect) - (the-as symbol "sound") - -1.0 - 28 - (the-as basic #f) - (static-sound-name "flut-punch-hit") - ) - (cpad-set-buzz! (-> *cpad-list* cpads 0) 1 255 (seconds 0.2)) - ) - ((= v1-57 'darkjak) - (set-time! (-> self darkjak attack-time)) - (let* ((v1-256 *game-info*) - (a0-141 (+ (-> v1-256 attack-id) 1)) - ) - (set! (-> v1-256 attack-id) a0-141) - (set! (-> self darkjak attack-id) a0-141) - a0-141 - ) - ) - ((= v1-57 'lightjak) - (set-time! (-> self darkjak attack-time)) - (let* ((v1-260 *game-info*) - (a0-145 (+ (-> v1-260 attack-id) 1)) - ) - (set! (-> v1-260 attack-id) a0-145) - (set! (-> self darkjak attack-id) a0-145) - a0-145 - ) - ) + ) + ) + ) ) ) + sv-96 ) ) ) - sv-96 ) ;; definition for function target-generic-event-handler diff --git a/test/decompiler/reference/jak3/engine/target/target-part_REF.gc b/test/decompiler/reference/jak3/engine/target/target-part_REF.gc index dd1a77dc5c..3e3bb6cd71 100644 --- a/test/decompiler/reference/jak3/engine/target/target-part_REF.gc +++ b/test/decompiler/reference/jak3/engine/target/target-part_REF.gc @@ -122,47 +122,48 @@ ;; definition for function birth-func-target-orient ;; WARN: Return type mismatch int vs none. (defun birth-func-target-orient ((arg0 sparticle-system) (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) ) @@ -3055,27 +3056,25 @@ (arg4 int) (arg5 float) ) - (local-vars - (sv-640 (pointer process)) - (sv-720 float) - (sv-736 int) - (sv-752 matrix) - (sv-768 collide-query) - (sv-784 symbol) - (sv-800 vector) - (sv-816 int) - (sv-832 process) - ) - (set! sv-720 arg5) - (let ((s5-0 *lightning-probe-vars*)) - (if (= arg3 256) - (set! sv-736 arg3) - (set! sv-736 (rand-vu-int-range 3 (/ (+ (-> arg0 node-list length) -1) 2))) + (local-vars (sv-736 int)) + (let ((sv-720 arg5) + (s5-0 *lightning-probe-vars*) ) - (set! sv-752 (new 'stack-no-clear 'matrix)) - (set! sv-768 (new 'stack-no-clear 'collide-query)) - (set! sv-784 (the-as symbol #f)) - (let ((gp-0 (new 'stack-no-clear 'vector))) + (set! sv-736 (cond + ((= arg3 256) + (set! sv-736 arg3) + sv-736 + ) + (else + (rand-vu-int-range 3 (/ (+ (-> arg0 node-list length) -1) 2)) + ) + ) + ) + (let ((sv-752 (new 'stack-no-clear 'matrix)) + (sv-768 (new 'stack-no-clear 'collide-query)) + (sv-784 (the-as symbol #f)) + (gp-0 (new 'stack-no-clear 'vector)) + ) (vector-copy! gp-0 *up-vector*) (when (nonzero? arg3) (set! sv-736 arg3) @@ -3085,35 +3084,37 @@ (vector-copy! (-> sv-768 start-pos) (-> arg0 root trans)) (vector<-cspace! (-> sv-768 start-pos) (-> arg0 node-list data sv-736)) ) - (set! sv-800 (-> sv-768 move-dist)) - (set! (-> sv-800 x) (rand-vu-float-range 0.0 65536.0)) - (set! (-> sv-800 y) (rand-vu-float-range 0.0 65536.0)) - (set! (-> sv-800 z) (rand-vu-float-range 0.0 65536.0)) - (set! (-> sv-800 w) 1.0) + (let ((sv-800 (-> sv-768 move-dist))) + (set! (-> sv-800 x) (rand-vu-float-range 0.0 65536.0)) + (set! (-> sv-800 y) (rand-vu-float-range 0.0 65536.0)) + (set! (-> sv-800 z) (rand-vu-float-range 0.0 65536.0)) + (set! (-> sv-800 w) 1.0) + ) (matrix-rotate-zyx! sv-752 (-> sv-768 move-dist)) - (set! sv-816 6) - (while (nonzero? sv-816) - (set! sv-816 (+ sv-816 -1)) - (vector-rotate*! (-> sv-768 move-dist) (-> s5-0 probe-dirs sv-816) sv-752) - (vector-normalize! (-> sv-768 move-dist) sv-720) - (let ((v1-31 sv-768)) - (set! (-> v1-31 radius) 409.6) - (set! (-> v1-31 collide-with) (collide-spec backgnd crate obstacle hit-by-others-list pusher)) - (set! (-> v1-31 ignore-process0) arg0) - (set! (-> v1-31 ignore-process1) #f) - (set! (-> v1-31 ignore-pat) - (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) - ) - (set! (-> v1-31 action-mask) (collide-action solid)) - ) - (when (>= (fill-and-probe-using-line-sphere *collide-cache* sv-768) 0.0) - (set-time! (-> s5-0 last-valid-time)) - (set! (-> s5-0 src-joint-index) (the-as uint sv-736)) - (vector-copy! (-> s5-0 end-pos) (-> sv-768 best-other-tri intersect)) - (when (< 8192.0 (vector-vector-distance (-> s5-0 end-pos) (-> sv-768 start-pos))) - (vector-copy! gp-0 (-> sv-768 best-other-tri normal)) - (set! sv-784 #t) - (goto cfg-15) + (let ((sv-816 6)) + (while (nonzero? sv-816) + (+! sv-816 -1) + (vector-rotate*! (-> sv-768 move-dist) (-> s5-0 probe-dirs sv-816) sv-752) + (vector-normalize! (-> sv-768 move-dist) sv-720) + (let ((v1-31 sv-768)) + (set! (-> v1-31 radius) 409.6) + (set! (-> v1-31 collide-with) (collide-spec backgnd crate obstacle hit-by-others-list pusher)) + (set! (-> v1-31 ignore-process0) arg0) + (set! (-> v1-31 ignore-process1) #f) + (set! (-> v1-31 ignore-pat) + (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) + ) + (set! (-> v1-31 action-mask) (collide-action solid)) + ) + (when (>= (fill-and-probe-using-line-sphere *collide-cache* sv-768) 0.0) + (set-time! (-> s5-0 last-valid-time)) + (set! (-> s5-0 src-joint-index) (the-as uint sv-736)) + (vector-copy! (-> s5-0 end-pos) (-> sv-768 best-other-tri intersect)) + (when (< 8192.0 (vector-vector-distance (-> s5-0 end-pos) (-> sv-768 start-pos))) + (vector-copy! gp-0 (-> sv-768 best-other-tri normal)) + (set! sv-784 #t) + (goto cfg-15) + ) ) ) ) @@ -3124,31 +3125,33 @@ (a1-14 lightning-tracker) (a2-2 (the-as object #x4000)) (a3-1 0) + (sv-832 (t9-10 a0-24 a1-14 (the-as int a2-2) a3-1)) + (sv-640 (when sv-832 + ((method-of-type lightning-tracker activate) + (the-as lightning-tracker sv-832) + arg0 + "lightning-tracker" + (the-as pointer #x70004000) + ) + (set! a2-2 arg1) + (set! a3-1 arg4) + (run-now-in-process + sv-832 + lightning-tracker-init + (the-as lightning-spec a2-2) + a3-1 + arg2 + arg0 + (if (= arg3 256) + (-> arg0 root trans) + (-> s5-0 src-joint-index) + ) + (-> s5-0 end-pos) + ) + (-> sv-832 ppointer) + ) + ) ) - (set! sv-832 (t9-10 a0-24 a1-14 (the-as int a2-2) a3-1)) - (set! sv-640 - (when sv-832 - (let ((t9-11 (method-of-type lightning-tracker activate))) - (t9-11 (the-as lightning-tracker sv-832) arg0 "lightning-tracker" (the-as pointer #x70004000)) - ) - (set! a2-2 arg1) - (set! a3-1 arg4) - (run-now-in-process - sv-832 - lightning-tracker-init - (the-as lightning-spec a2-2) - a3-1 - arg2 - arg0 - (if (= arg3 256) - (-> arg0 root trans) - (-> s5-0 src-joint-index) - ) - (-> s5-0 end-pos) - ) - (-> sv-832 ppointer) - ) - ) (when sv-640 (set! (-> (the-as lightning-tracker (-> sv-640 0)) user-time 0) 0) (let ((v1-63 (get-field-spec-by-id (-> *part-id-table* 168) (sp-field-id spt-timer)))) @@ -3198,104 +3201,109 @@ (arg5 int) (arg6 float) ) - (local-vars - (sv-624 (pointer process)) - (sv-640 float) - (sv-656 int) - (sv-672 matrix) - (sv-688 collide-query) - (sv-704 symbol) - (sv-720 vector) - (sv-736 int) - (sv-752 process) - ) - (set! sv-640 arg6) - (when (or (= arg4 256) (and (nonzero? (-> arg0 node-list)) (> (-> arg0 node-list length) 0))) - (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))) - ) - (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) - (vector-copy! (-> sv-688 start-pos) (-> arg0 root trans)) - (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-35 sv-688)) - (set! (-> v1-35 radius) 409.6) - (set! (-> v1-35 collide-with) (collide-spec backgnd crate obstacle hit-by-others-list pusher)) - (set! (-> v1-35 ignore-process0) arg0) - (set! (-> v1-35 ignore-process1) #f) - (set! (-> v1-35 ignore-pat) - (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) - ) - (set! (-> v1-35 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)) - (vector-copy! (-> s5-0 end-pos) (-> sv-688 best-other-tri intersect)) - (when (< 8192.0 (vector-vector-distance (-> s5-0 end-pos) (-> sv-688 start-pos))) - (set! sv-704 #t) - (goto cfg-21) + (local-vars (sv-656 int)) + (let ((sv-640 arg6)) + (when (or (= arg4 256) (and (nonzero? (-> arg0 node-list)) (> (-> arg0 node-list length) 0))) + (let ((s5-0 *lightning-probe-vars*)) + (set! sv-656 (cond + ((= arg4 256) + (set! sv-656 arg4) + sv-656 + ) + (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 ) - ) - ) - (label cfg-21) - (when sv-704 - (set! sv-752 (get-process *default-dead-pool* lightning-tracker #x4000 0)) - (set! sv-624 - (when sv-752 - (let ((t9-11 (method-of-type lightning-tracker activate))) - (t9-11 (the-as lightning-tracker sv-752) arg0 "lightning-tracker" (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) + (if (= arg4 256) + (vector-copy! (-> sv-688 start-pos) (-> arg0 root trans)) + (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-35 sv-688)) + (set! (-> v1-35 radius) 409.6) + (set! (-> v1-35 collide-with) (collide-spec backgnd crate obstacle hit-by-others-list pusher)) + (set! (-> v1-35 ignore-process0) arg0) + (set! (-> v1-35 ignore-process1) #f) + (set! (-> v1-35 ignore-pat) + (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) ) - (-> s5-0 end-pos) + (set! (-> v1-35 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)) + (vector-copy! (-> s5-0 end-pos) (-> sv-688 best-other-tri intersect)) + (when (< 8192.0 (vector-vector-distance (-> s5-0 end-pos) (-> sv-688 start-pos))) + (set! sv-704 #t) + (goto cfg-21) ) - (-> sv-752 ppointer) ) ) - (when sv-624 - (set! (-> (the-as lightning-tracker (-> sv-624 0)) user-time 0) 0) - (when arg3 - (let ((v1-66 (get-field-spec-by-id arg3 (sp-field-id spt-timer)))) - (if v1-66 - (set! (-> v1-66 initial-valuef) (the-as float (-> (the-as lightning-tracker (-> sv-624 0)) duration))) + ) + (label cfg-21) + (when sv-704 + (let* ((sv-752 (get-process *default-dead-pool* lightning-tracker #x4000 0)) + (sv-624 (when sv-752 + ((method-of-type lightning-tracker activate) + (the-as lightning-tracker sv-752) + arg0 + "lightning-tracker" + (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! (-> (the-as lightning-tracker (-> sv-624 0)) user-time 0) 0) + (when arg3 + (let ((v1-66 (get-field-spec-by-id arg3 (sp-field-id spt-timer)))) + (if v1-66 + (set! (-> v1-66 initial-valuef) (the-as float (-> (the-as lightning-tracker (-> sv-624 0)) duration))) + ) + ) + (let ((t9-14 sp-launch-particles-var) + (a0-30 *sp-particle-system-2d*) + (a2-5 *launch-matrix*) + ) + (vector-copy! (-> a2-5 trans) (-> s5-0 end-pos)) + (t9-14 a0-30 arg3 a2-5 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0) + ) ) - ) - (let ((t9-14 sp-launch-particles-var) - (a0-30 *sp-particle-system-2d*) - (a2-5 *launch-matrix*) - ) - (vector-copy! (-> a2-5 trans) (-> s5-0 end-pos)) - (t9-14 a0-30 arg3 a2-5 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0) + ) ) ) ) @@ -3317,50 +3325,44 @@ (arg3 (function lightning-tracker none)) (arg4 sparticle-launcher) ) - (local-vars (sv-16 int) (sv-64 vector) (sv-68 vector) (sv-72 (pointer process))) (when (and (nonzero? (-> arg0 skel)) (nonzero? (-> arg1 skel))) (let* ((v1-7 (-> arg0 draw lod-set lod (-> arg0 draw lod-set max-lod) geo length)) (s0-0 (-> arg1 draw lod-set lod (-> arg1 draw lod-set max-lod) geo length)) (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))) - (set! sv-72 (process-spawn - lightning-tracker - :init lightning-tracker-init - arg2 - 0 - arg3 - arg0 - s1-0 - sv-16 - :name "lightning-tracker" - :to arg1 - :unk 0 + (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 (get-process *default-dead-pool* lightning-tracker #x4000 0)) + (sv-72 (when s0-1 + (let ((t9-5 (method-of-type lightning-tracker activate))) + (t9-5 (the-as lightning-tracker s0-1) arg1 "lightning-tracker" (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-19 (get-field-spec-by-id arg4 (sp-field-id spt-timer)))) - (if v1-19 - (set! (-> v1-19 initial-valuef) (the-as float (-> (the-as lightning-tracker (-> sv-72 0)) duration))) - ) - ) - (let ((t9-8 sp-launch-particles-var) - (a0-20 *sp-particle-system-2d*) - (a1-14 arg4) - (a2-4 *launch-matrix*) - ) - (vector-copy! (-> a2-4 trans) sv-64) - (t9-8 a0-20 a1-14 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*) - ) - (vector-copy! (-> a2-5 trans) sv-68) - (t9-9 a0-21 arg4 a2-5 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0) + ) + ) + (when (and arg4 sv-72) + (let ((v1-19 (get-field-spec-by-id arg4 (sp-field-id spt-timer)))) + (if v1-19 + (set! (-> v1-19 initial-valuef) (the-as float (-> (the-as lightning-tracker (-> sv-72 0)) duration))) + ) + ) + (let ((t9-8 sp-launch-particles-var) + (a0-20 *sp-particle-system-2d*) + (a1-14 arg4) + (a2-4 *launch-matrix*) + ) + (vector-copy! (-> a2-4 trans) sv-64) + (t9-8 a0-20 a1-14 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*) + ) + (vector-copy! (-> a2-5 trans) sv-68) + (t9-9 a0-21 arg4 a2-5 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0) + ) ) ) ) @@ -3403,149 +3405,140 @@ (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 ((vf0 :class vf) (vf4 :class vf) (vf5 :class vf) (vf6 :class vf) ) (init-vf0-vector) - (let ((s1-0 (-> arg0 draw lod-set lod (-> arg0 draw cur-lod) geo length))) - (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 length)) + (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 0)) - (let ((a0-35 (when sv-560 - (let ((t9-13 (method-of-type lightning-tracker activate))) - (t9-13 (the-as lightning-tracker sv-560) arg0 "lightning-tracker" (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 0)) + (a0-35 (when sv-560 + ((method-of-type lightning-tracker activate) + (the-as lightning-tracker sv-560) + arg0 + "lightning-tracker" + (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)) + (run-now-in-process sv-560 lightning-tracker-init arg1 0 arg2 arg0 #f #f) + (-> sv-560 ppointer) + ) ) - (set! (-> s4-1 state points-to-draw) 0) - (vector+*! s3-1 sv-432 sv-448 arg4) - (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)) + ) + (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) + (vector+*! s3-1 sv-432 sv-448 arg4) + (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) @@ -3553,12 +3546,7 @@ (vector-orient-by-quat! s1-2 sv-448 sv-480) (vector-copy! s1-2 sv-448) (vector+*! s2-1 sv-640 s1-2 arg4) - (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-34 (vector-average! (new 'stack-no-clear 'vector) s2-1 s3-1))) - (sv-592 sv-608 sv-624 a2-34) - ) + (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) @@ -3566,8 +3554,8 @@ (vector-copy! s0-2 sv-464) (vector-copy! sv-448 s1-2) (vector-copy! sv-432 sv-640) - (set! sv-576 (+ sv-576 1)) ) + (+! sv-576 1) ) ) ) diff --git a/test/decompiler/reference/jak3/engine/target/target-turret_REF.gc b/test/decompiler/reference/jak3/engine/target/target-turret_REF.gc index 09314e35e7..77caf24fb8 100644 --- a/test/decompiler/reference/jak3/engine/target/target-turret_REF.gc +++ b/test/decompiler/reference/jak3/engine/target/target-turret_REF.gc @@ -1375,7 +1375,6 @@ ;; definition for method 48 of type target-turret ;; INFO: Used lq/sq (defmethod target-turret-method-48 ((this target-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)) @@ -1385,27 +1384,28 @@ ) (set! (-> s3-0 y) 0.0) (vector-xz-normalize! s3-0 24576.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) - (vector-copy! (-> s2-0 start-pos) s5-0) - (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) + (vector-copy! (-> s2-0 start-pos) s5-0) + (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))) + (vector-copy! arg0 s5-0) + (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))) - (vector-copy! arg0 s5-0) - (return #t) - ) - (set! sv-592 (+ sv-592 1)) ) ) #f diff --git a/test/decompiler/reference/jak3/engine/target/target-util_REF.gc b/test/decompiler/reference/jak3/engine/target/target-util_REF.gc index 4989878d8d..ff848bbf3c 100644 --- a/test/decompiler/reference/jak3/engine/target/target-util_REF.gc +++ b/test/decompiler/reference/jak3/engine/target/target-util_REF.gc @@ -2377,44 +2377,34 @@ ;; definition for function external-target-spawn ;; INFO: Used lq/sq (defun external-target-spawn ((arg0 vector) (arg1 quaternion) (arg2 process) (arg3 symbol) (arg4 manipy-options)) - (local-vars - (v1-5 symbol) - (sv-96 process) - (sv-112 (function vector entity-actor skeleton-group vector manipy-options none :behavior manipy)) - (sv-128 entity-actor) - ) + (local-vars (v1-5 symbol) (sv-128 entity-actor)) (let* ((s1-0 (get-process *default-dead-pool* manipy #x20000 1)) (s5-0 (when s1-0 (let ((t9-1 (method-of-type manipy activate))) (t9-1 (the-as manipy s1-0) arg2 "manipy" (the-as pointer #x70004000)) ) - (let ((s5-1 run-function-in-process)) - (set! sv-96 s1-0) - (set! sv-112 manipy-init) + (let ((s5-1 run-function-in-process) + (sv-96 s1-0) + (sv-112 manipy-init) + ) (set! v1-5 (when (not (logtest? (-> arg2 mask) (process-mask process-tree))) (set! sv-128 (the-as entity-actor v1-5)) (set! sv-128 (-> arg2 entity)) v1-5 ) ) - (let ((t0-1 (target-skel-group)) - (t1-0 (if (logtest? arg4 (manipy-options mo3)) - (the-as vector #f) - (new 'static 'vector :y 2867.2 :w 3276.8) - ) - ) - (t2-0 2) - ) - ((the-as (function object object object object object object object none) s5-1) - sv-96 - sv-112 - arg0 - sv-128 - t0-1 - t1-0 - t2-0 - ) - ) + ((the-as (function object object object object object object object none) s5-1) + sv-96 + sv-112 + arg0 + sv-128 + (target-skel-group) + (if (logtest? arg4 (manipy-options mo3)) + (the-as vector #f) + (new 'static 'vector :y 2867.2 :w 3276.8) + ) + 2 + ) ) (-> s1-0 ppointer) ) diff --git a/test/decompiler/reference/jak3/engine/target/target2_REF.gc b/test/decompiler/reference/jak3/engine/target/target2_REF.gc index 34f98aa93c..a089cb494e 100644 --- a/test/decompiler/reference/jak3/engine/target/target2_REF.gc +++ b/test/decompiler/reference/jak3/engine/target/target2_REF.gc @@ -1692,63 +1692,65 @@ process (lambda :behavior process ((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)) + ) (vector-copy! v1-2 arg0) - (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 ) #f ) diff --git a/test/decompiler/reference/jak3/engine/ui/bigmap_REF.gc b/test/decompiler/reference/jak3/engine/ui/bigmap_REF.gc index c7a35091dd..c5846f8526 100644 --- a/test/decompiler/reference/jak3/engine/ui/bigmap_REF.gc +++ b/test/decompiler/reference/jak3/engine/ui/bigmap_REF.gc @@ -157,14 +157,14 @@ ;; definition for method 19 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) @@ -196,7 +196,6 @@ ;; definition for method 20 of type bigmap ;; INFO: Used lq/sq (defmethod bigmap-method-20 ((this bigmap) (arg0 dma-buffer)) - (local-vars (sv-16 uint)) (let* ((s4-0 (the-as (pointer uint32) (-> this bigmap-image art-group))) (f0-1 (* 0.001953125 (the float (- (-> this x1) (-> this x0))))) (s3-0 (the int (* 256.0 f0-1))) @@ -208,37 +207,38 @@ (s0-0 (/ (+ v1-5 511) 256)) ) (-> s4-0 2) - (set! sv-16 (* (-> s4-0 3) 256)) - (while (>= s0-0 s1-0) - (texture-upload-dma - this - arg0 - (the-as (pointer uint32) (+ (+ (-> s4-0 0) 16) (the-as uint s4-0))) - 0 - 16 - 16 - (gs-psm ct32) - ) - (dma-buffer-add-gs-set arg0 (texflush 0)) - (let ((v1-18 (+ (-> s4-0 1) (* (the-as uint s1-0) sv-16) (* (the int (-> this scroll y)) 256)))) + (let ((sv-16 (* (-> s4-0 3) 256))) + (while (>= s0-0 s1-0) (texture-upload-dma this arg0 - (the-as (pointer uint32) (+ (+ v1-18 16) (the-as uint s4-0))) - 8 - 256 - 416 - (gs-psm mt8) + (the-as (pointer uint32) (+ (+ (-> s4-0 0) 16) (the-as uint s4-0))) + 0 + 16 + 16 + (gs-psm ct32) ) + (dma-buffer-add-gs-set arg0 (texflush 0)) + (let ((v1-18 (+ (-> s4-0 1) (* (the-as uint s1-0) sv-16) (* (the int (-> this scroll y)) 256)))) + (texture-upload-dma + this + arg0 + (the-as (pointer uint32) (+ (+ v1-18 16) (the-as uint s4-0))) + 8 + 256 + 416 + (gs-psm mt8) + ) + ) + (dma-buffer-add-gs-set arg0 + (tex0-1 (new 'static 'gs-tex0 :tbp0 #x8 :tbw #x4 :psm #x13 :tw #x8 :th #x9 :cld #x1)) + (tex1-1 (new 'static 'gs-tex1)) + (texflush 0) + ) + (sprite-dma this arg0 (+ s2-0 1792) (+ s3-0 1792 s2-0) (-> this y0) (-> this y1) 0 256) + (+! s2-0 s3-0) + (+! s1-0 1) ) - (dma-buffer-add-gs-set arg0 - (tex0-1 (new 'static 'gs-tex0 :tbp0 #x8 :tbw #x4 :psm #x13 :tw #x8 :th #x9 :cld #x1)) - (tex1-1 (new 'static 'gs-tex1)) - (texflush 0) - ) - (sprite-dma this arg0 (+ s2-0 1792) (+ s3-0 1792 s2-0) (-> this y0) (-> this y1) 0 256) - (+! s2-0 s3-0) - (+! s1-0 1) ) ) #f @@ -248,7 +248,6 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defmethod draw-from-minimap ((this bigmap) (arg0 dma-buffer) (arg1 connection-minimap)) - (local-vars (sv-80 vector4w)) (rlet ((vf0 :class vf) (vf1 :class vf) (vf2 :class vf) @@ -286,77 +285,75 @@ ) (let ((f30-0 (-> arg1 class scale)) (s1-0 (-> arg1 class color)) + (sv-80 (new 'stack-no-clear 'vector4w)) + (s0-0 (new-stack-vector0)) + (s2-0 (new-stack-vector0)) + (s3-2 (new-stack-vector0)) ) - (set! sv-80 (new 'stack-no-clear 'vector4w)) - (let ((s0-0 (new-stack-vector0)) - (s2-0 (new-stack-vector0)) - (s3-2 (new-stack-vector0)) + (let ((f26-0 (-> *video-params* relative-x-scale)) + (f28-0 (-> *video-params* relative-x-scale-reciprical)) ) - (let ((f26-0 (-> *video-params* relative-x-scale)) - (f28-0 (-> *video-params* relative-x-scale-reciprical)) + (-> arg1 class) + (.lvf vf1 (&-> arg1 last-world-pos quad)) + (.lvf vf2 (&-> this offset quad)) + (.add.z.vf.y vf1 vf0 vf1) + (.sub.vf vf1 vf1 vf2) + (.mul.w.vf vf1 vf1 vf2) + (.ftoi.vf vf1 vf1) + (.svf (&-> sv-80 quad) vf1) + (if (logtest? (-> arg1 class flags) (minimap-flag goal)) + (set! (-> arg1 class icon-xy x) (the-as uint (mod (the int (-> this goal-time)) 6))) + ) + (bigmap-method-18 this (&-> sv-80 x)) + (cond + ((get-horizontal-flip-flag *blit-displays-work*) + (set! f26-0 (- f26-0)) + (set! (-> s0-0 x) (+ (the float (+ (- 2304 (-> sv-80 x)) (-> this x1))) (-> this scroll x))) + ) + (else + (set! (-> s0-0 x) (- (the float (+ (-> sv-80 x) 1792 (-> this x0))) (-> this scroll x))) + ) + ) + (set! (-> s0-0 y) (+ 1840.0 (* (- (the float (-> sv-80 y)) (-> this scroll y)) f28-0))) + (let ((f0-12 (* 20.0 f26-0 f30-0)) + (f1-8 (* 20.0 f28-0 f30-0)) ) - (-> arg1 class) - (.lvf vf1 (&-> arg1 last-world-pos quad)) - (.lvf vf2 (&-> this offset quad)) - (.add.z.vf.y vf1 vf0 vf1) - (.sub.vf vf1 vf1 vf2) - (.mul.w.vf vf1 vf1 vf2) - (.ftoi.vf vf1 vf1) - (.svf (&-> sv-80 quad) vf1) - (if (logtest? (-> arg1 class flags) (minimap-flag goal)) - (set! (-> arg1 class icon-xy x) (the-as uint (mod (the int (-> this goal-time)) 6))) - ) - (bigmap-method-18 this (&-> sv-80 x)) - (cond - ((get-horizontal-flip-flag *blit-displays-work*) - (set! f26-0 (- f26-0)) - (set! (-> s0-0 x) (+ (the float (+ (- 2304 (-> sv-80 x)) (-> this x1))) (-> this scroll x))) + (set! (-> s2-0 x) (the float (the int (- (-> s0-0 x) (/ f0-12 2))))) + (set! (-> s2-0 y) (the float (the int (- (-> s0-0 y) (/ f1-8 2))))) + (set! (-> s3-2 x) (+ (-> s2-0 x) f0-12)) + (set! (-> s3-2 y) (+ (-> s2-0 y) f1-8)) + ) + ) + (let* ((a2-1 (the-as uint (+ (* (the-as uint 320) (-> arg1 class icon-xy x)) 8))) + (a3-0 (the-as uint (+ (* (the-as uint 320) (-> arg1 class icon-xy y)) 8))) + (v1-55 (+ (the-as int a2-1) 312)) + (a0-35 (+ (the-as int a3-0) 312)) + (a1-6 (the-as object (-> arg0 base))) ) - (else - (set! (-> s0-0 x) (- (the float (+ (-> sv-80 x) 1792 (-> this x0))) (-> this scroll x))) - ) - ) - (set! (-> s0-0 y) (+ 1840.0 (* (- (the float (-> sv-80 y)) (-> this scroll y)) f28-0))) - (let ((f0-12 (* 20.0 f26-0 f30-0)) - (f1-8 (* 20.0 f28-0 f30-0)) - ) - (set! (-> s2-0 x) (the float (the int (- (-> s0-0 x) (/ f0-12 2))))) - (set! (-> s2-0 y) (the float (the int (- (-> s0-0 y) (/ f1-8 2))))) - (set! (-> s3-2 x) (+ (-> s2-0 x) f0-12)) - (set! (-> s3-2 y) (+ (-> s2-0 y) f1-8)) - ) + (set! (-> (the-as (inline-array vector4w) a1-6) 0 quad) (-> this sprite-tmpl dma-vif quad)) + (set! (-> (the-as (inline-array vector4w) a1-6) 1 quad) (-> this sprite-tmpl quad 1)) + (set-vector! + (-> (the-as (inline-array vector4w) a1-6) 2) + (the-as int (-> s1-0 r)) + (the-as int (-> s1-0 g)) + (the-as int (-> s1-0 b)) + 128 ) - (let* ((a2-1 (the-as uint (+ (* (the-as uint 320) (-> arg1 class icon-xy x)) 8))) - (a3-0 (the-as uint (+ (* (the-as uint 320) (-> arg1 class icon-xy y)) 8))) - (v1-55 (+ (the-as int a2-1) 312)) - (a0-35 (+ (the-as int a3-0) 312)) - (a1-6 (the-as object (-> arg0 base))) - ) - (set! (-> (the-as (inline-array vector4w) a1-6) 0 quad) (-> this sprite-tmpl dma-vif quad)) - (set! (-> (the-as (inline-array vector4w) a1-6) 1 quad) (-> this sprite-tmpl quad 1)) - (set-vector! - (-> (the-as (inline-array vector4w) a1-6) 2) - (the-as int (-> s1-0 r)) - (the-as int (-> s1-0 g)) - (the-as int (-> s1-0 b)) - 128 - ) - (set-vector! (-> (the-as (inline-array vector4w) a1-6) 3) (the-as int a2-1) (the-as int a3-0) 0 0) - (set-vector! - (-> (the-as (inline-array vector4w) a1-6) 4) - (the int (* 16.0 (-> s2-0 x))) - (the int (* 16.0 (-> s2-0 y))) - #xffffff - 0 - ) - (set-vector! (-> (the-as (inline-array vector4w) a1-6) 5) v1-55 a0-35 0 0) - (set-vector! - (-> (the-as (inline-array vector4w) a1-6) 6) - (the int (* 16.0 (-> s3-2 x))) - (the int (* 16.0 (-> s3-2 y))) - #xffffff - 0 - ) + (set-vector! (-> (the-as (inline-array vector4w) a1-6) 3) (the-as int a2-1) (the-as int a3-0) 0 0) + (set-vector! + (-> (the-as (inline-array vector4w) a1-6) 4) + (the int (* 16.0 (-> s2-0 x))) + (the int (* 16.0 (-> s2-0 y))) + #xffffff + 0 + ) + (set-vector! (-> (the-as (inline-array vector4w) a1-6) 5) v1-55 a0-35 0 0) + (set-vector! + (-> (the-as (inline-array vector4w) a1-6) 6) + (the int (* 16.0 (-> s3-2 x))) + (the int (* 16.0 (-> s3-2 y))) + #xffffff + 0 ) ) ) @@ -448,14 +445,6 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defmethod draw! ((this bigmap) (arg0 int) (arg1 int) (arg2 int) (arg3 int)) - (local-vars - (sv-96 (inline-array vector4w)) - (sv-100 texture) - (sv-104 matrix) - (sv-112 int) - (sv-120 float) - (sv-240 (function bigmap vector none)) - ) (when (and (= (file-status (-> this bigmap-image) "world-map" (the-as int (-> this load-index))) 'active) (not (-> this loading-flag)) ) @@ -540,115 +529,106 @@ (vector-xz-normalize! s1-3 -1.0) (set! (-> s1-3 y) 0.0) (set! (-> s1-3 w) 0.0) - (set! sv-96 (the-as (inline-array vector4w) (-> s2-0 base))) - (set! sv-100 (get-texture map-target-marker progress-minimap)) - (set! sv-104 (new 'stack-no-clear 'matrix)) - (set! sv-112 (the int (* 56.0 f30-0))) - (set! sv-120 (-> *video-params* relative-x-scale-reciprical)) - (when sv-100 - (let ((s0-2 this)) - (set! sv-240 (method-of-object s0-2 set-pos!)) - (let ((a1-29 (target-pos 0))) - (sv-240 s0-2 a1-29) + (let ((sv-96 (the-as (inline-array vector4w) (-> s2-0 base))) + (sv-100 (get-texture map-target-marker progress-minimap)) + (sv-104 (new 'stack-no-clear 'matrix)) ) + (let ((sv-112 (the int (* 56.0 f30-0)))) ) - (let ((s0-3 (new 'stack 'vector4w))) - 0.0 - (set! (-> s0-3 quad) (-> this pos quad)) - (bigmap-method-18 this (&-> s0-3 x)) - (let ((f0-15 (cond - ((get-horizontal-flip-flag *blit-displays-work*) - (set! f30-0 (- f30-0)) - (+ (the float (+ (- 2304 (-> s0-3 x)) (-> this x1))) (-> this scroll x)) - ) - (else - (- (the float (+ (-> s0-3 x) 1792 (-> this x0))) (-> this scroll x)) - ) - ) - ) - ) - (set-vector! (-> sv-104 rvec) (* (-> s1-3 z) f30-0) 0.0 (- (-> s1-3 x)) 0.0) - (set-vector! (-> sv-104 uvec) 0.0 1.0 0.0 0.0) - (set-vector! (-> sv-104 fvec) (* (-> s1-3 x) f30-0) 0.0 (-> s1-3 z) 1.0) - (set-vector! - (-> sv-104 trans) - f0-15 + (let ((sv-120 (-> *video-params* relative-x-scale-reciprical))) + (when sv-100 + (set-pos! this (target-pos 0)) + (let ((s0-3 (new 'stack 'vector4w))) 0.0 - (+ 1840.0 (* (- (the float (-> s0-3 y)) (-> this scroll y)) sv-120)) - 1.0 + (set! (-> s0-3 quad) (-> this pos quad)) + (bigmap-method-18 this (&-> s0-3 x)) + (let ((f0-15 (cond + ((get-horizontal-flip-flag *blit-displays-work*) + (set! f30-0 (- f30-0)) + (+ (the float (+ (- 2304 (-> s0-3 x)) (-> this x1))) (-> this scroll x)) + ) + (else + (- (the float (+ (-> s0-3 x) 1792 (-> this x0))) (-> this scroll x)) + ) + ) + ) + ) + (set-vector! (-> sv-104 rvec) (* (-> s1-3 z) f30-0) 0.0 (- (-> s1-3 x)) 0.0) + (set-vector! (-> sv-104 uvec) 0.0 1.0 0.0 0.0) + (set-vector! (-> sv-104 fvec) (* (-> s1-3 x) f30-0) 0.0 (-> s1-3 z) 1.0) + (set-vector! + (-> sv-104 trans) + f0-15 + 0.0 + (+ 1840.0 (* (- (the float (-> s0-3 y)) (-> this scroll y)) sv-120)) + 1.0 + ) + ) ) + (let* ((v1-83 (mod (-> *display* real-clock frame-counter) 360)) + (f0-26 (+ 1.5 (* 0.25 (cos (* 182.04445 (the float v1-83)))))) + (f0-27 (* 7.0 f0-26)) + ) + (cond + ((or (= (-> this load-index) (bigmap-id sewer-met-hum)) (= (-> this load-index) (bigmap-id sewer-hum-kg))) + (set-vector! (-> this corner 0) (- f0-27) 0.0 0.0 1.0) + (set-vector! (-> this corner 1) 0.0 0.0 f0-27 1.0) + (set-vector! (-> this corner 2) 0.0 0.0 (- f0-27) 1.0) + (set-vector! (-> this corner 3) f0-27 0.0 0.0 1.0) + ) + (else + (set-vector! (-> this corner 0) 0.0 0.0 (- f0-27) 1.0) + (set-vector! (-> this corner 1) f0-27 0.0 0.0 1.0) + (set-vector! (-> this corner 2) (- f0-27) 0.0 0.0 1.0) + (set-vector! (-> this corner 3) 0.0 0.0 f0-27 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! (-> sv-96 0 quad) (-> this adgif-tmpl dma-vif quad)) + (set! (-> sv-96 1 quad) (-> this adgif-tmpl quad 1)) + (adgif-shader<-texture-simple! (the-as adgif-shader (-> sv-96 2)) sv-100) + (set! (-> sv-96 7 quad) (-> this draw-tmpl dma-vif quad)) + (set! (-> sv-96 8 quad) (-> this draw-tmpl quad 1)) + (set-vector! (-> sv-96 9) 0 255 255 128) + (set-vector! (-> sv-96 10) 0 0 0 0) + (set-vector! + (-> sv-96 11) + (the int (* 16.0 (-> this corner 0 x))) + (the int (* 16.0 (-> this corner 0 z))) + #xffffff + 0 + ) + (set-vector! (-> sv-96 12) 256 0 0 0) + (set-vector! + (-> sv-96 13) + (the int (* 16.0 (-> this corner 1 x))) + (the int (* 16.0 (-> this corner 1 z))) + #xffffff + 0 + ) + (set-vector! (-> sv-96 14) 0 256 0 0) + (set-vector! + (-> sv-96 15) + (the int (* 16.0 (-> this corner 2 x))) + (the int (* 16.0 (-> this corner 2 z))) + #xffffff + 0 + ) + (set-vector! (-> sv-96 16) 256 256 0 0) + (set-vector! + (-> sv-96 17) + (the int (* 16.0 (-> this corner 3 x))) + (the int (* 16.0 (-> this corner 3 z))) + #xffffff + 0 + ) + (&+! (-> s2-0 base) 288) ) ) - (let* ((v1-83 (mod (-> *display* real-clock frame-counter) 360)) - (f0-26 (+ 1.5 (* 0.25 (cos (* 182.04445 (the float v1-83)))))) - (f0-27 (* 7.0 f0-26)) - ) - (cond - ((or (= (-> this load-index) (bigmap-id sewer-met-hum)) (= (-> this load-index) (bigmap-id sewer-hum-kg))) - (set-vector! (-> this corner 0) (- f0-27) 0.0 0.0 1.0) - (set-vector! (-> this corner 1) 0.0 0.0 f0-27 1.0) - (set-vector! (-> this corner 2) 0.0 0.0 (- f0-27) 1.0) - (set-vector! (-> this corner 3) f0-27 0.0 0.0 1.0) - ) - (else - (set-vector! (-> this corner 0) 0.0 0.0 (- f0-27) 1.0) - (set-vector! (-> this corner 1) f0-27 0.0 0.0 1.0) - (set-vector! (-> this corner 2) (- f0-27) 0.0 0.0 1.0) - (set-vector! (-> this corner 3) 0.0 0.0 f0-27 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-97 (-> this adgif-tmpl dma-vif quad))) - (set! (-> sv-96 0 quad) v1-97) - ) - (let ((v1-98 (-> this adgif-tmpl quad 1))) - (set! (-> sv-96 1 quad) v1-98) - ) - (adgif-shader<-texture-simple! (the-as adgif-shader (-> sv-96 2)) sv-100) - (let ((v1-100 (-> this draw-tmpl dma-vif quad))) - (set! (-> sv-96 7 quad) v1-100) - ) - (let ((v1-101 (-> this draw-tmpl quad 1))) - (set! (-> sv-96 8 quad) v1-101) - ) - (set-vector! (-> sv-96 9) 0 255 255 128) - (set-vector! (-> sv-96 10) 0 0 0 0) - (set-vector! - (-> sv-96 11) - (the int (* 16.0 (-> this corner 0 x))) - (the int (* 16.0 (-> this corner 0 z))) - #xffffff - 0 - ) - (set-vector! (-> sv-96 12) 256 0 0 0) - (set-vector! - (-> sv-96 13) - (the int (* 16.0 (-> this corner 1 x))) - (the int (* 16.0 (-> this corner 1 z))) - #xffffff - 0 - ) - (set-vector! (-> sv-96 14) 0 256 0 0) - (set-vector! - (-> sv-96 15) - (the int (* 16.0 (-> this corner 2 x))) - (the int (* 16.0 (-> this corner 2 z))) - #xffffff - 0 - ) - (set-vector! (-> sv-96 16) 256 256 0 0) - (set-vector! - (-> sv-96 17) - (the int (* 16.0 (-> this corner 3 x))) - (the int (* 16.0 (-> this corner 3 z))) - #xffffff - 0 - ) - (&+! (-> s2-0 base) 288) ) ) ) diff --git a/test/decompiler/reference/jak3/engine/ui/hud-classes_REF.gc b/test/decompiler/reference/jak3/engine/ui/hud-classes_REF.gc index b3b11ea951..26f769f74a 100644 --- a/test/decompiler/reference/jak3/engine/ui/hud-classes_REF.gc +++ b/test/decompiler/reference/jak3/engine/ui/hud-classes_REF.gc @@ -998,434 +998,432 @@ ;; definition for method 15 of type hud-gun ;; WARN: Return type mismatch int vs none. (defmethod draw ((this hud-gun)) - (local-vars - (sv-32 int) - (sv-40 int) - (sv-48 int) - (sv-56 int) - (sv-64 hud-sprite) - (sv-72 int) - (sv-80 int) - (sv-88 int) - (sv-96 int) - (sv-104 int) - (sv-112 int) - ) - (set! sv-32 0) - (set! sv-40 0) - (set! sv-48 0) - (set! sv-56 0) - (set! sv-64 (new 'stack-no-clear 'hud-sprite)) - (set! sv-72 (the int (get-max-ammo-for-gun *game-info* (the-as pickup-type (-> this values 0 current))))) - (set! sv-80 20) - (set! sv-88 -1) - (set! sv-96 -1) - (set! sv-104 -1) - (set! sv-112 -1) - (case (gun->eco (the-as pickup-type (-> this values 0 current))) - (((pickup-type eco-yellow)) - (let ((v1-10 (-> this sprites 15 color-ptr))) - (set! (-> v1-10 0) 128) - (set! (-> v1-10 1) 128) - (set! (-> v1-10 2) 96) - (set! (-> v1-10 3) 128) - ) - (set! sv-96 (+ (-> this values 0 current) -29)) - (set! (-> this sprites 0 tid) (the-as texture-id (get-texture hud-gunyellow-common-01 level-default-minimap))) - (set! (-> this sprites 14 tid) - (the-as texture-id (get-texture hud-gun-yellow-shell-01 level-default-minimap)) - ) - (set! (-> this sprites 0 scale-x) 1.8) - (set! (-> this sprites 0 scale-y) 1.8) - (set! (-> this sprites 1 scale-x) 1.8) - (set! (-> this sprites 1 scale-y) 1.8) - (set! sv-32 10) - (set! sv-40 7) - ) - (((pickup-type eco-dark)) - (let ((v1-19 (-> this sprites 15 color-ptr))) - (set! (-> v1-19 0) 128) - (set! (-> v1-19 1) 96) - (set! (-> v1-19 2) 128) - (set! (-> v1-19 3) 128) - ) - (set! sv-112 (+ (-> this values 0 current) -35)) - (set! (-> this sprites 0 tid) (the-as texture-id (get-texture hud-gunpurple-common-01 level-default-minimap))) - (set! (-> this sprites 14 tid) - (the-as texture-id (get-texture hud-gun-purple-shell-01 level-default-minimap)) - ) - (set! (-> this sprites 0 scale-x) 1.6) - (set! (-> this sprites 0 scale-y) 1.6) - (set! (-> this sprites 1 scale-x) 1.6) - (set! (-> this sprites 1 scale-y) 1.6) - (set! sv-32 23) - (set! sv-80 10) - ) - (((pickup-type eco-blue)) - (let ((v1-28 (-> this sprites 15 color-ptr))) - (set! (-> v1-28 0) 96) - (set! (-> v1-28 1) 128) - (set! (-> v1-28 2) 128) - (set! (-> v1-28 3) 128) - ) - (set! sv-104 (+ (-> this values 0 current) -32)) - (set! (-> this sprites 0 tid) (the-as texture-id (get-texture hud-gunblue-common-01 level-default-minimap))) - (set! (-> this sprites 14 tid) (the-as texture-id (get-texture hud-gun-blue-shell-01 level-default-minimap))) - (set! (-> this sprites 0 scale-x) 1.7) - (set! (-> this sprites 0 scale-y) 1.7) - (set! (-> this sprites 1 scale-x) 1.7) - (set! (-> this sprites 1 scale-y) 1.7) - (set! sv-32 6) - (set! sv-40 13) - ) - (else - (let ((v1-37 (-> this sprites 15 color-ptr))) - (set! (-> v1-37 0) 128) - (set! (-> v1-37 1) 64) - (set! (-> v1-37 2) 64) - (set! (-> v1-37 3) 128) + (let ((sv-32 0) + (sv-40 0) + (sv-48 0) + (sv-56 0) + (sv-64 (new 'stack-no-clear 'hud-sprite)) + (sv-72 (the int (get-max-ammo-for-gun *game-info* (the-as pickup-type (-> this values 0 current))))) ) - (set! sv-88 (+ (-> this values 0 current) -26)) - (set! (-> this sprites 0 tid) (the-as texture-id (get-texture hud-gunred-common-01 level-default-minimap))) - (set! (-> this sprites 14 tid) (the-as texture-id (get-texture hud-gun-red-shell-01 level-default-minimap))) - (set! (-> this sprites 0 scale-x) 1.6) - (set! (-> this sprites 0 scale-y) 1.6) - (set! (-> this sprites 1 scale-x) 1.6) - (set! (-> this sprites 1 scale-y) 1.6) - (set! sv-32 23) - (set! sv-40 -2) - (set! sv-80 20) - ) - ) - (case (-> this values 0 current) - ((26) - (set! (-> this sprites 1 tid) (the-as texture-id (get-texture hud-gunred-01a level-default-minimap))) - (set! sv-48 -102) - ) - ((27) - (set! (-> this sprites 1 tid) (the-as texture-id (get-texture hud-gunred-02a level-default-minimap))) - (set! sv-48 -153) - ) - ((28) - (set! (-> this sprites 1 tid) (the-as texture-id (get-texture hud-gunred-03a level-default-minimap))) - (set! sv-48 -153) - ) - ((29) - (set! (-> this sprites 1 tid) (the-as texture-id (get-texture hud-gunyellow-01a level-default-minimap))) - (set! sv-48 -172) - ) - ((30) - (set! (-> this sprites 1 tid) (the-as texture-id (get-texture hud-gunyellow-02a level-default-minimap))) - (set! sv-48 -172) - ) - ((31) - (set! (-> this sprites 0 tid) (the-as texture-id (get-texture hud-gunyellow-03b level-default-minimap))) - (set! (-> this sprites 1 tid) (the-as texture-id (get-texture hud-gunyellow-03a level-default-minimap))) - (set! sv-48 -172) - ) - ((32) - (set! (-> this sprites 1 tid) (the-as texture-id (get-texture hud-gunblue-01a level-default-minimap))) - (set! sv-48 -135) - ) - ((33) - (set! (-> this sprites 1 tid) (the-as texture-id (get-texture hud-gunblue-02a level-default-minimap))) - (set! sv-48 -162) - (set! sv-56 -49) - ) - ((34) - (set! (-> this sprites 1 tid) (the-as texture-id (get-texture hud-gunblue-03a level-default-minimap))) - (set! sv-48 -162) - (set! sv-56 -49) - ) - ((35) - (set! (-> this sprites 1 tid) (the-as texture-id (get-texture hud-gunpurple-01a level-default-minimap))) - (set! sv-48 -153) - ) - ((36) - (set! (-> this sprites 1 tid) (the-as texture-id (get-texture hud-gunpurple-02a level-default-minimap))) - (set! sv-48 -153) - ) - ((37) - (set! (-> this sprites 1 tid) (the-as texture-id (get-texture hud-gunpurple-03a level-default-minimap))) - (set! sv-48 -153) - ) - ) - (set-hud-piece-position! - sv-64 - (- (the int (+ 507.0 (* 130.0 (-> this offset)))) (the int (* 80.0 (-> *video-params* relative-x-scale)))) - (the int (+ 40.0 (* -100.0 (-> this offset)))) - ) - (set-hud-piece-position! - (-> this sprites 0) - (- (the int (+ 507.0 (* 130.0 (-> this offset)))) - (the int (* (the float sv-32) (-> *video-params* relative-x-scale))) - ) - (the int (+ (- 25.0 (the float sv-40)) (* -100.0 (-> this offset)))) - ) - (let ((f30-0 1.0)) - (cond - ((zero? (-> this values 0 current)) - (set! f30-0 0.0) - (set! (-> this strings 0 pos x) 0) - (set-as-offset-from! (-> this sprites 1) (-> this sprites 0 pos) -3 0) - ) - (else - (set-as-offset-from! (-> this sprites 1) (-> this sprites 0 pos) sv-48 sv-56) - (set-as-offset-from! - (the-as hud-sprite (-> this strings 0 pos)) - (-> this sprites 0 pos) - (+ sv-32 -70) - (+ sv-40 61) + (let ((sv-80 20) + (sv-88 -1) + (sv-96 -1) + (sv-104 -1) + (sv-112 -1) ) - (set-as-offset-from! (-> this sprites 14) (-> this sprites 0 pos) (+ sv-32 -68) (+ (if (= sv-80 20) - 122 - 97 + (let ((v1-9 (gun->eco (the-as pickup-type (-> this values 0 current))))) + (set! sv-80 + (cond + ((= v1-9 (pickup-type eco-yellow)) + (let ((v1-10 (-> this sprites 15 color-ptr))) + (set! (-> v1-10 0) 128) + (set! (-> v1-10 1) 128) + (set! (-> v1-10 2) 96) + (set! (-> v1-10 3) 128) + ) + (set! sv-96 (+ (-> this values 0 current) -29)) + (set! (-> this sprites 0 tid) (the-as texture-id (get-texture hud-gunyellow-common-01 level-default-minimap))) + (set! (-> this sprites 14 tid) + (the-as texture-id (get-texture hud-gun-yellow-shell-01 level-default-minimap)) + ) + (set! (-> this sprites 0 scale-x) 1.8) + (set! (-> this sprites 0 scale-y) 1.8) + (set! (-> this sprites 1 scale-x) 1.8) + (set! (-> this sprites 1 scale-y) 1.8) + (set! sv-32 10) + (set! sv-40 7) + sv-80 + ) + ((= v1-9 (pickup-type eco-dark)) + (let ((v1-19 (-> this sprites 15 color-ptr))) + (set! (-> v1-19 0) 128) + (set! (-> v1-19 1) 96) + (set! (-> v1-19 2) 128) + (set! (-> v1-19 3) 128) + ) + (set! sv-112 (+ (-> this values 0 current) -35)) + (set! (-> this sprites 0 tid) (the-as texture-id (get-texture hud-gunpurple-common-01 level-default-minimap))) + (set! (-> this sprites 14 tid) + (the-as texture-id (get-texture hud-gun-purple-shell-01 level-default-minimap)) + ) + (set! (-> this sprites 0 scale-x) 1.6) + (set! (-> this sprites 0 scale-y) 1.6) + (set! (-> this sprites 1 scale-x) 1.6) + (set! (-> this sprites 1 scale-y) 1.6) + (set! sv-32 23) + (set! sv-80 10) + sv-80 + ) + ((= v1-9 (pickup-type eco-blue)) + (let ((v1-28 (-> this sprites 15 color-ptr))) + (set! (-> v1-28 0) 96) + (set! (-> v1-28 1) 128) + (set! (-> v1-28 2) 128) + (set! (-> v1-28 3) 128) + ) + (set! sv-104 (+ (-> this values 0 current) -32)) + (set! (-> this sprites 0 tid) (the-as texture-id (get-texture hud-gunblue-common-01 level-default-minimap))) + (set! (-> this sprites 14 tid) (the-as texture-id (get-texture hud-gun-blue-shell-01 level-default-minimap))) + (set! (-> this sprites 0 scale-x) 1.7) + (set! (-> this sprites 0 scale-y) 1.7) + (set! (-> this sprites 1 scale-x) 1.7) + (set! (-> this sprites 1 scale-y) 1.7) + (set! sv-32 6) + (set! sv-40 13) + sv-80 + ) + (else + (let ((v1-37 (-> this sprites 15 color-ptr))) + (set! (-> v1-37 0) 128) + (set! (-> v1-37 1) 64) + (set! (-> v1-37 2) 64) + (set! (-> v1-37 3) 128) + ) + (set! sv-88 (+ (-> this values 0 current) -26)) + (set! (-> this sprites 0 tid) (the-as texture-id (get-texture hud-gunred-common-01 level-default-minimap))) + (set! (-> this sprites 14 tid) (the-as texture-id (get-texture hud-gun-red-shell-01 level-default-minimap))) + (set! (-> this sprites 0 scale-x) 1.6) + (set! (-> this sprites 0 scale-y) 1.6) + (set! (-> this sprites 1 scale-x) 1.6) + (set! (-> this sprites 1 scale-y) 1.6) + (set! sv-32 23) + (set! sv-40 -2) + 20 + ) + ) + ) + ) + (case (-> this values 0 current) + ((26) + (set! (-> this sprites 1 tid) (the-as texture-id (get-texture hud-gunred-01a level-default-minimap))) + (set! sv-48 -102) + ) + ((27) + (set! (-> this sprites 1 tid) (the-as texture-id (get-texture hud-gunred-02a level-default-minimap))) + (set! sv-48 -153) + ) + ((28) + (set! (-> this sprites 1 tid) (the-as texture-id (get-texture hud-gunred-03a level-default-minimap))) + (set! sv-48 -153) + ) + ((29) + (set! (-> this sprites 1 tid) (the-as texture-id (get-texture hud-gunyellow-01a level-default-minimap))) + (set! sv-48 -172) + ) + ((30) + (set! (-> this sprites 1 tid) (the-as texture-id (get-texture hud-gunyellow-02a level-default-minimap))) + (set! sv-48 -172) + ) + ((31) + (set! (-> this sprites 0 tid) (the-as texture-id (get-texture hud-gunyellow-03b level-default-minimap))) + (set! (-> this sprites 1 tid) (the-as texture-id (get-texture hud-gunyellow-03a level-default-minimap))) + (set! sv-48 -172) + ) + ((32) + (set! (-> this sprites 1 tid) (the-as texture-id (get-texture hud-gunblue-01a level-default-minimap))) + (set! sv-48 -135) + ) + ((33) + (set! (-> this sprites 1 tid) (the-as texture-id (get-texture hud-gunblue-02a level-default-minimap))) + (set! sv-48 -162) + (set! sv-56 -49) + ) + ((34) + (set! (-> this sprites 1 tid) (the-as texture-id (get-texture hud-gunblue-03a level-default-minimap))) + (set! sv-48 -162) + (set! sv-56 -49) + ) + ((35) + (set! (-> this sprites 1 tid) (the-as texture-id (get-texture hud-gunpurple-01a level-default-minimap))) + (set! sv-48 -153) + ) + ((36) + (set! (-> this sprites 1 tid) (the-as texture-id (get-texture hud-gunpurple-02a level-default-minimap))) + (set! sv-48 -153) + ) + ((37) + (set! (-> this sprites 1 tid) (the-as texture-id (get-texture hud-gunpurple-03a level-default-minimap))) + (set! sv-48 -153) + ) + ) + (set-hud-piece-position! + sv-64 + (- (the int (+ 507.0 (* 130.0 (-> this offset)))) (the int (* 80.0 (-> *video-params* relative-x-scale)))) + (the int (+ 40.0 (* -100.0 (-> this offset)))) + ) + (set-hud-piece-position! + (-> this sprites 0) + (- (the int (+ 507.0 (* 130.0 (-> this offset)))) + (the int (* (the float sv-32) (-> *video-params* relative-x-scale))) + ) + (the int (+ (- 25.0 (the float sv-40)) (* -100.0 (-> this offset)))) + ) + (let ((f30-0 1.0)) + (cond + ((zero? (-> this values 0 current)) + (set! f30-0 0.0) + (set! (-> this strings 0 pos x) 0) + (set-as-offset-from! (-> this sprites 1) (-> this sprites 0 pos) -3 0) + ) + (else + (set-as-offset-from! (-> this sprites 1) (-> this sprites 0 pos) sv-48 sv-56) + (set-as-offset-from! + (the-as hud-sprite (-> this strings 0 pos)) + (-> this sprites 0 pos) + (+ sv-32 -70) + (+ sv-40 61) + ) + (set-as-offset-from! (-> this sprites 14) (-> this sprites 0 pos) (+ sv-32 -68) (+ (if (= sv-80 20) + 122 + 97 + ) + sv-40 ) - sv-40 - ) - ) - (set! (-> this sprites 14 scale-x) 1.0) - (let ((s5-0 (the int (+ 0.1 (* (the float sv-80) (/ (the float (-> this values 1 current)) (the float sv-72))))))) - (if (and (zero? s5-0) (nonzero? (-> this values 1 current))) - (set! s5-0 1) - ) - (when (not (-> *setting-control* user-current gun-special-mode)) - (with-dma-buffer-add-bucket ((s3-0 (-> *display* frames (-> *display* on-screen) global-buf)) - (bucket-id hud-draw-hud-alpha) - ) - (dotimes (s2-0 sv-80) - (if (= s2-0 s5-0) - (set! (-> this sprites 14 tid) (the-as texture-id (get-texture hud-gun-empty-shell-01 level-default-minimap))) - ) - (draw (-> this sprites 14) s3-0 (-> this level) #f) - (+! (-> this sprites 14 pos y) -5) - (if (= s2-0 (+ (/ sv-80 2) -1)) - (set-as-offset-from! (-> this sprites 14) (-> this sprites 0 pos) (+ sv-32 -83) (+ (if (= sv-80 20) - 122 - 97 + ) + (set! (-> this sprites 14 scale-x) 1.0) + (let ((s5-0 (the int (+ 0.1 (* (the float sv-80) (/ (the float (-> this values 1 current)) (the float sv-72))))))) + (if (and (zero? s5-0) (nonzero? (-> this values 1 current))) + (set! s5-0 1) + ) + (when (not (-> *setting-control* user-current gun-special-mode)) + (with-dma-buffer-add-bucket ((s3-0 (-> *display* frames (-> *display* on-screen) global-buf)) + (bucket-id hud-draw-hud-alpha) + ) + (dotimes (s2-0 sv-80) + (if (= s2-0 s5-0) + (set! (-> this sprites 14 tid) (the-as texture-id (get-texture hud-gun-empty-shell-01 level-default-minimap))) + ) + (draw (-> this sprites 14) s3-0 (-> this level) #f) + (+! (-> this sprites 14 pos y) -5) + (if (= s2-0 (+ (/ sv-80 2) -1)) + (set-as-offset-from! (-> this sprites 14) (-> this sprites 0 pos) (+ sv-32 -83) (+ (if (= sv-80 20) + 122 + 97 + ) + sv-40 ) - sv-40 - ) - ) + ) + ) ) + ) ) ) ) ) + (set! (-> this sprites 14 scale-x) 0.0) + (set-as-offset-from! (-> this sprites 15) (-> sv-64 pos) -4 -4) + (dotimes (v1-125 12) + (set! (-> this sprites (+ v1-125 2) scale-x) 0.0) + ) + (let ((s5-1 + (+ (if (and (logtest? (-> *target* game features) (game-feature gun)) + (and (-> *setting-control* user-current gun) + (logtest? (logand (-> *setting-control* user-current features) (game-feature gun-red-1)) + (-> *target* game features) + ) + ) + ) + 1 + 0 + ) + (if (and (logtest? (-> *target* game features) (game-feature gun)) + (and (-> *setting-control* user-current gun) + (logtest? (logand (-> *setting-control* user-current features) (game-feature gun-red-2)) + (-> *target* game features) + ) + ) + ) + 1 + 0 + ) + (if (and (logtest? (-> *target* game features) (game-feature gun)) + (and (-> *setting-control* user-current gun) + (logtest? (logand (-> *setting-control* user-current features) (game-feature gun-red-3)) + (-> *target* game features) + ) + ) + ) + 1 + 0 + ) + ) + ) + ) + (dotimes (s4-1 s5-1) + (let ((s3-1 (- 10 s4-1))) + (hud-sprite-method-11 + (-> this sprites s3-1) + (if (>= sv-88 s4-1) + (-> *gun-arrow-table* (+ (* s4-1 2) 1)) + (-> *gun-arrow-table* (* s4-1 2)) + ) + (-> sv-64 pos) + 0 + 0 + ) + (if (= f30-0 0.0) + (set! (-> this sprites s3-1 scale-x) f30-0) + ) + ) + ) + ) + (let ((s5-2 + (+ (if (and (logtest? (-> *target* game features) (game-feature gun)) + (-> *setting-control* user-current gun) + (logtest? (logand (-> *setting-control* user-current features) (game-feature gun-yellow-1)) + (-> *target* game features) + ) + ) + 1 + 0 + ) + (if (and (logtest? (-> *target* game features) (game-feature gun)) + (and (-> *setting-control* user-current gun) + (logtest? (logand (-> *setting-control* user-current features) (game-feature gun-yellow-2)) + (-> *target* game features) + ) + ) + ) + 1 + 0 + ) + (if (and (logtest? (-> *target* game features) (game-feature gun)) + (and (-> *setting-control* user-current gun) + (logtest? (logand (-> *setting-control* user-current features) (game-feature gun-yellow-3)) + (-> *target* game features) + ) + ) + ) + 1 + 0 + ) + ) + ) + ) + (dotimes (s4-2 s5-2) + (let ((s3-2 (- 13 s4-2))) + (hud-sprite-method-11 + (-> this sprites s3-2) + (if (>= sv-96 s4-2) + (-> *gun-arrow-table* (+ (* s4-2 2) 7)) + (-> *gun-arrow-table* (+ (* s4-2 2) 6)) + ) + (-> sv-64 pos) + 0 + 0 + ) + (if (= f30-0 0.0) + (set! (-> this sprites s3-2 scale-x) f30-0) + ) + ) + ) + ) + (let ((s5-3 + (+ (if (and (logtest? (-> *target* game features) (game-feature gun)) + (-> *setting-control* user-current gun) + (logtest? (logand (-> *setting-control* user-current features) (game-feature gun-blue-1)) + (-> *target* game features) + ) + ) + 1 + 0 + ) + (if (and (logtest? (-> *target* game features) (game-feature gun)) + (and (-> *setting-control* user-current gun) + (logtest? (logand (-> *setting-control* user-current features) (game-feature gun-blue-2)) + (-> *target* game features) + ) + ) + ) + 1 + 0 + ) + (if (and (logtest? (-> *target* game features) (game-feature gun)) + (and (-> *setting-control* user-current gun) + (logtest? (logand (-> *setting-control* user-current features) (game-feature gun-blue-3)) + (-> *target* game features) + ) + ) + ) + 1 + 0 + ) + ) + ) + ) + (dotimes (s4-3 s5-3) + (let ((s3-3 (- 4 s4-3))) + (hud-sprite-method-11 + (-> this sprites s3-3) + (if (>= sv-104 s4-3) + (-> *gun-arrow-table* (+ (* s4-3 2) 13)) + (-> *gun-arrow-table* (+ (* s4-3 2) 12)) + ) + (-> sv-64 pos) + 0 + 0 + ) + (if (= f30-0 0.0) + (set! (-> this sprites s3-3 scale-x) f30-0) + ) + ) + ) + ) + (let ((s5-4 + (+ (if (and (logtest? (-> *target* game features) (game-feature gun)) + (-> *setting-control* user-current gun) + (logtest? (logand (-> *setting-control* user-current features) (game-feature gun-dark-1)) + (-> *target* game features) + ) + ) + 1 + 0 + ) + (if (and (logtest? (-> *target* game features) (game-feature gun)) + (and (-> *setting-control* user-current gun) + (logtest? (logand (game-feature gun-dark-2) (-> *setting-control* user-current features)) + (-> *target* game features) + ) + ) + ) + 1 + 0 + ) + (if (and (logtest? (-> *target* game features) (game-feature gun)) + (and (-> *setting-control* user-current gun) + (logtest? (logand (game-feature gun-dark-3) (-> *setting-control* user-current features)) + (-> *target* game features) + ) + ) + ) + 1 + 0 + ) + ) + ) + ) + (dotimes (s4-4 s5-4) + (let ((s3-4 (- 7 s4-4))) + (hud-sprite-method-11 + (-> this sprites s3-4) + (if (>= sv-112 s4-4) + (-> *gun-arrow-table* (+ (* s4-4 2) 19)) + (-> *gun-arrow-table* (+ (* s4-4 2) 18)) + ) + (-> sv-64 pos) + 0 + 0 + ) + (if (= f30-0 0.0) + (set! (-> this sprites s3-4 scale-x) f30-0) + ) + ) + ) + ) ) ) - (set! (-> this sprites 14 scale-x) 0.0) - (set-as-offset-from! (-> this sprites 15) (-> sv-64 pos) -4 -4) - (dotimes (v1-125 12) - (set! (-> this sprites (+ v1-125 2) scale-x) 0.0) - ) - (let ((s5-1 - (+ (if (and (logtest? (-> *target* game features) (game-feature gun)) - (and (-> *setting-control* user-current gun) - (logtest? (logand (-> *setting-control* user-current features) (game-feature gun-red-1)) - (-> *target* game features) - ) - ) - ) - 1 - 0 - ) - (if (and (logtest? (-> *target* game features) (game-feature gun)) - (and (-> *setting-control* user-current gun) - (logtest? (logand (-> *setting-control* user-current features) (game-feature gun-red-2)) - (-> *target* game features) - ) - ) - ) - 1 - 0 - ) - (if (and (logtest? (-> *target* game features) (game-feature gun)) - (and (-> *setting-control* user-current gun) - (logtest? (logand (-> *setting-control* user-current features) (game-feature gun-red-3)) - (-> *target* game features) - ) - ) - ) - 1 - 0 - ) - ) - ) - ) - (dotimes (s4-1 s5-1) - (let ((s3-1 (- 10 s4-1))) - (hud-sprite-method-11 - (-> this sprites s3-1) - (if (>= sv-88 s4-1) - (-> *gun-arrow-table* (+ (* s4-1 2) 1)) - (-> *gun-arrow-table* (* s4-1 2)) - ) - (-> sv-64 pos) - 0 - 0 - ) - (if (= f30-0 0.0) - (set! (-> this sprites s3-1 scale-x) f30-0) - ) - ) - ) - ) - (let ((s5-2 - (+ (if (and (logtest? (-> *target* game features) (game-feature gun)) - (-> *setting-control* user-current gun) - (logtest? (logand (-> *setting-control* user-current features) (game-feature gun-yellow-1)) - (-> *target* game features) - ) - ) - 1 - 0 - ) - (if (and (logtest? (-> *target* game features) (game-feature gun)) - (and (-> *setting-control* user-current gun) - (logtest? (logand (-> *setting-control* user-current features) (game-feature gun-yellow-2)) - (-> *target* game features) - ) - ) - ) - 1 - 0 - ) - (if (and (logtest? (-> *target* game features) (game-feature gun)) - (and (-> *setting-control* user-current gun) - (logtest? (logand (-> *setting-control* user-current features) (game-feature gun-yellow-3)) - (-> *target* game features) - ) - ) - ) - 1 - 0 - ) - ) - ) - ) - (dotimes (s4-2 s5-2) - (let ((s3-2 (- 13 s4-2))) - (hud-sprite-method-11 - (-> this sprites s3-2) - (if (>= sv-96 s4-2) - (-> *gun-arrow-table* (+ (* s4-2 2) 7)) - (-> *gun-arrow-table* (+ (* s4-2 2) 6)) - ) - (-> sv-64 pos) - 0 - 0 - ) - (if (= f30-0 0.0) - (set! (-> this sprites s3-2 scale-x) f30-0) - ) - ) - ) - ) - (let ((s5-3 - (+ (if (and (logtest? (-> *target* game features) (game-feature gun)) - (-> *setting-control* user-current gun) - (logtest? (logand (-> *setting-control* user-current features) (game-feature gun-blue-1)) - (-> *target* game features) - ) - ) - 1 - 0 - ) - (if (and (logtest? (-> *target* game features) (game-feature gun)) - (and (-> *setting-control* user-current gun) - (logtest? (logand (-> *setting-control* user-current features) (game-feature gun-blue-2)) - (-> *target* game features) - ) - ) - ) - 1 - 0 - ) - (if (and (logtest? (-> *target* game features) (game-feature gun)) - (and (-> *setting-control* user-current gun) - (logtest? (logand (-> *setting-control* user-current features) (game-feature gun-blue-3)) - (-> *target* game features) - ) - ) - ) - 1 - 0 - ) - ) - ) - ) - (dotimes (s4-3 s5-3) - (let ((s3-3 (- 4 s4-3))) - (hud-sprite-method-11 - (-> this sprites s3-3) - (if (>= sv-104 s4-3) - (-> *gun-arrow-table* (+ (* s4-3 2) 13)) - (-> *gun-arrow-table* (+ (* s4-3 2) 12)) - ) - (-> sv-64 pos) - 0 - 0 - ) - (if (= f30-0 0.0) - (set! (-> this sprites s3-3 scale-x) f30-0) - ) - ) - ) - ) - (let ((s5-4 - (+ (if (and (logtest? (-> *target* game features) (game-feature gun)) - (-> *setting-control* user-current gun) - (logtest? (logand (-> *setting-control* user-current features) (game-feature gun-dark-1)) - (-> *target* game features) - ) - ) - 1 - 0 - ) - (if (and (logtest? (-> *target* game features) (game-feature gun)) - (and (-> *setting-control* user-current gun) - (logtest? (logand (game-feature gun-dark-2) (-> *setting-control* user-current features)) - (-> *target* game features) - ) - ) - ) - 1 - 0 - ) - (if (and (logtest? (-> *target* game features) (game-feature gun)) - (and (-> *setting-control* user-current gun) - (logtest? (logand (game-feature gun-dark-3) (-> *setting-control* user-current features)) - (-> *target* game features) - ) - ) - ) - 1 - 0 - ) - ) - ) - ) - (dotimes (s4-4 s5-4) - (let ((s3-4 (- 7 s4-4))) - (hud-sprite-method-11 - (-> this sprites s3-4) - (if (>= sv-112 s4-4) - (-> *gun-arrow-table* (+ (* s4-4 2) 19)) - (-> *gun-arrow-table* (+ (* s4-4 2) 18)) - ) - (-> sv-64 pos) - 0 - 0 - ) - (if (= f30-0 0.0) - (set! (-> this sprites s3-4 scale-x) f30-0) - ) - ) - ) - ) + (format (clear (-> this strings 0 text)) "~D/~D" (-> this values 1 current) sv-72) ) - (format (clear (-> this strings 0 text)) "~D/~D" (-> this values 1 current) sv-72) (if (and *target* (nonzero? (-> *target* gun)) (< (-> this values 1 current) (the int (-> *target* gun ammo-required))) diff --git a/test/decompiler/reference/jak3/engine/ui/hud_REF.gc b/test/decompiler/reference/jak3/engine/ui/hud_REF.gc index c479cabebe..3ea4bcdb65 100644 --- a/test/decompiler/reference/jak3/engine/ui/hud_REF.gc +++ b/test/decompiler/reference/jak3/engine/ui/hud_REF.gc @@ -436,154 +436,150 @@ (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 (the-as object (-> this tid))) + (f28-0 0.0) + (f30-0 1.0) ) - (set! sv-32 *hud-sprite-work*) - (let ((s0-0 (the-as object (-> this tid))) - (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 (the-as texture-id s0-0) + (when sv-16 + (let ((v1-8 (-> sv-16 texture-mask 8 mask quad)) + (a0-3 (-> (the-as texture s0-0) masks data 0 mask quad)) + ) + (.por a0-4 v1-8 a0-3) ) - (when (!= (-> this angle) 0.0) - (set! f28-0 (sin (-> this angle))) - (set! f30-0 (cos (-> this angle))) + (set! (-> sv-16 texture-mask 8 mask quad) a0-4) ) - (when (the-as texture-id s0-0) - (when sv-16 - (let ((v1-8 (-> sv-16 texture-mask 8 mask quad)) - (a0-3 (-> (the-as texture s0-0) masks data 0 mask quad)) - ) - (.por a0-4 v1-8 a0-3) - ) - (set! (-> sv-16 texture-mask 8 mask quad) a0-4) + (let ((v1-10 (the-as object (-> arg0 base)))) + (set! (-> (the-as (inline-array vector4w) v1-10) 0 quad) (-> sv-32 adgif-tmpl dma-vif quad)) + (set! (-> (the-as (inline-array vector4w) v1-10) 1 quad) (-> sv-32 adgif-tmpl quad 1)) + (adgif-shader<-texture-simple! + (the-as adgif-shader (-> (the-as (inline-array vector4w) v1-10) 2)) + (the-as texture s0-0) ) - (let ((v1-10 (the-as object (-> arg0 base)))) - (set! (-> (the-as (inline-array vector4w) v1-10) 0 quad) (-> sv-32 adgif-tmpl dma-vif quad)) - (set! (-> (the-as (inline-array vector4w) v1-10) 1 quad) (-> sv-32 adgif-tmpl quad 1)) - (adgif-shader<-texture-simple! - (the-as adgif-shader (-> (the-as (inline-array vector4w) v1-10) 2)) - (the-as texture s0-0) - ) - ) - (&+! (-> arg0 base) 112) - (let ((v1-13 (the-as object (-> 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) (hud-sprite-flags hsf2)) - (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) (hud-sprite-flags hsf3)) - (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 (inline-array vector4w) v1-13) 0 quad) (-> sv-32 draw-tmpl dma-vif quad)) - (set! (-> (the-as (inline-array vector4w) v1-13) 1 quad) (-> sv-32 draw-tmpl quad 1)) - (set! (-> (the-as (inline-array vector4w) v1-13) 2 quad) (-> this color quad)) - (set! (-> (the-as (inline-array vector4w) v1-13) 5 quad) (-> this color quad)) - (set! (-> (the-as (inline-array vector4w) v1-13) 8 quad) (-> this color quad)) - (set! (-> (the-as (inline-array vector4w) v1-13) 11 quad) (-> this color quad)) - (let* ((t5-3 (-> (the-as texture s0-0) w)) - (t4-13 (-> (the-as texture 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) (hud-sprite-flags hsf0)) - (let ((f4-0 f0-55)) - (set! f0-55 f1-28) - (set! f1-28 f4-0) - ) - ) - (when (logtest? (-> this flags) (hud-sprite-flags hsf1)) - (set! f2-3 (the-as float f3-2)) - (set! f3-2 (gpr->fpr t5-3)) - ) - (set-vector! (-> (the-as (inline-array vector) v1-13) 3) f0-55 (the-as float f3-2) 1.0 0.0) - (set-vector! (-> (the-as (inline-array vector) v1-13) 6) f1-28 (the-as float f3-2) 1.0 0.0) - (set-vector! (-> (the-as (inline-array vector) v1-13) 9) f0-55 f2-3 1.0 0.0) - (set-vector! (-> (the-as (inline-array vector) v1-13) 12) f1-28 f2-3 1.0 0.0) - ) - (set-vector! - (-> (the-as (inline-array vector) v1-13) 4) - (the-as float (* a1-14 16)) - (the-as float (* a2-1 16)) - (the-as float a0-14) - (the-as float #x10000) - ) - (set-vector! - (-> (the-as (inline-array vector) v1-13) 7) - (the-as float (* a3-1 16)) - (the-as float (* t2-1 16)) - (the-as float a0-14) - (the-as float #x10000) - ) - (set-vector! - (-> (the-as (inline-array vector) v1-13) 10) - (the-as float (* t3-0 16)) - (the-as float (* t6-0 16)) - (the-as float a0-14) - (the-as float #x10000) - ) - (set-vector! - (-> (the-as (inline-array vector) v1-13) 13) - (the-as float (* t1-3 16)) - (the-as float (* t0-3 16)) - (the-as float a0-14) - (the-as float #x10000) - ) - ) - (&+! (-> arg0 base) 224) ) + (&+! (-> arg0 base) 112) + (let ((v1-13 (the-as object (-> 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) (hud-sprite-flags hsf2)) + (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) (hud-sprite-flags hsf3)) + (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 (inline-array vector4w) v1-13) 0 quad) (-> sv-32 draw-tmpl dma-vif quad)) + (set! (-> (the-as (inline-array vector4w) v1-13) 1 quad) (-> sv-32 draw-tmpl quad 1)) + (set! (-> (the-as (inline-array vector4w) v1-13) 2 quad) (-> this color quad)) + (set! (-> (the-as (inline-array vector4w) v1-13) 5 quad) (-> this color quad)) + (set! (-> (the-as (inline-array vector4w) v1-13) 8 quad) (-> this color quad)) + (set! (-> (the-as (inline-array vector4w) v1-13) 11 quad) (-> this color quad)) + (let* ((t5-3 (-> (the-as texture s0-0) w)) + (t4-13 (-> (the-as texture 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) (hud-sprite-flags hsf0)) + (let ((f4-0 f0-55)) + (set! f0-55 f1-28) + (set! f1-28 f4-0) + ) + ) + (when (logtest? (-> this flags) (hud-sprite-flags hsf1)) + (set! f2-3 (the-as float f3-2)) + (set! f3-2 (gpr->fpr t5-3)) + ) + (set-vector! (-> (the-as (inline-array vector) v1-13) 3) f0-55 (the-as float f3-2) 1.0 0.0) + (set-vector! (-> (the-as (inline-array vector) v1-13) 6) f1-28 (the-as float f3-2) 1.0 0.0) + (set-vector! (-> (the-as (inline-array vector) v1-13) 9) f0-55 f2-3 1.0 0.0) + (set-vector! (-> (the-as (inline-array vector) v1-13) 12) f1-28 f2-3 1.0 0.0) + ) + (set-vector! + (-> (the-as (inline-array vector) v1-13) 4) + (the-as float (* a1-14 16)) + (the-as float (* a2-1 16)) + (the-as float a0-14) + (the-as float #x10000) + ) + (set-vector! + (-> (the-as (inline-array vector) v1-13) 7) + (the-as float (* a3-1 16)) + (the-as float (* t2-1 16)) + (the-as float a0-14) + (the-as float #x10000) + ) + (set-vector! + (-> (the-as (inline-array vector) v1-13) 10) + (the-as float (* t3-0 16)) + (the-as float (* t6-0 16)) + (the-as float a0-14) + (the-as float #x10000) + ) + (set-vector! + (-> (the-as (inline-array vector) v1-13) 13) + (the-as float (* t1-3 16)) + (the-as float (* t0-3 16)) + (the-as float a0-14) + (the-as float #x10000) + ) + ) + (&+! (-> arg0 base) 224) ) ) 0 diff --git a/test/decompiler/reference/jak3/engine/ui/minimap_REF.gc b/test/decompiler/reference/jak3/engine/ui/minimap_REF.gc index 4e4b214547..0ef77aa452 100644 --- a/test/decompiler/reference/jak3/engine/ui/minimap_REF.gc +++ b/test/decompiler/reference/jak3/engine/ui/minimap_REF.gc @@ -1903,6 +1903,7 @@ ) ;; definition for method 3 of type engine-minimap +;; INFO: this function exists in multiple non-identical object files (defmethod inspect ((this engine-minimap)) (call-parent-method this) (let ((s5-0 0) @@ -2051,20 +2052,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 11) (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) + ) ) ) ) @@ -2347,132 +2348,122 @@ ;; 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 vector) - (sv-224 matrix) - (sv-228 matrix) - ) - (set! sv-16 (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 'vector)) - (set! sv-224 (new 'stack-no-clear 'matrix)) - (set! sv-228 (new 'stack-no-clear 'matrix)) - (vector-copy! sv-216 (-> (matrix-world->local #f #f) fvec)) - (set! (-> sv-216 y) 0.0) - (vector-normalize! sv-216 1.0) - (vector-z-quaternion! sv-220 (-> (the-as process-drawable sv-16) root quat)) - (vector-xz-normalize! sv-220 1.0) - (set! (-> sv-220 y) 0.0) - (set! (-> sv-220 w) 0.0) - (vector-! sv-212 (target-pos 0) (-> (the-as process-drawable sv-16) root trans)) - (let ((f0-4 (/ (-> sv-212 x) (* (-> this meters-per-texel) (-> this icon-inv-scale)))) - (f1-3 (/ (-> sv-212 z) (* (-> this meters-per-texel) (-> this icon-inv-scale)))) + (let ((sv-16 (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 (new 'stack-no-clear 'vector)) + (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)) + ) + (vector-copy! sv-216 (-> (matrix-world->local #f #f) fvec)) + (set! (-> sv-216 y) 0.0) + (vector-normalize! sv-216 1.0) + (vector-z-quaternion! sv-220 (-> (the-as process-drawable sv-16) root quat)) + (vector-xz-normalize! sv-220 1.0) + (set! (-> sv-220 y) 0.0) + (set! (-> sv-220 w) 0.0) + (vector-! sv-212 (target-pos 0) (-> (the-as process-drawable sv-16) root trans)) + (let ((f0-4 (/ (-> sv-212 x) (* (-> this meters-per-texel) (-> this icon-inv-scale)))) + (f1-3 (/ (-> sv-212 z) (* (-> this meters-per-texel) (-> this icon-inv-scale)))) + ) + (set-vector! (-> sv-224 rvec) (-> sv-216 z) 0.0 (- (-> sv-216 x)) 0.0) + (set-vector! (-> sv-224 uvec) 0.0 1.0 0.0 0.0) + (set-vector! (-> sv-224 fvec) (-> 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 rvec) (-> sv-220 z) 0.0 (- (-> sv-220 x)) 0.0) + (set-vector! (-> sv-228 uvec) 0.0 1.0 0.0 0.0) + (set-vector! (-> sv-228 fvec) (-> sv-220 x) 0.0 (-> sv-220 z) 0.0) + (set-vector! (-> sv-228 trans) f0-4 0.0 f1-3 1.0) ) - (set-vector! (-> sv-224 rvec) (-> sv-216 z) 0.0 (- (-> sv-216 x)) 0.0) - (set-vector! (-> sv-224 uvec) 0.0 1.0 0.0 0.0) - (set-vector! (-> sv-224 fvec) (-> 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 rvec) (-> sv-220 z) 0.0 (- (-> sv-220 x)) 0.0) - (set-vector! (-> sv-228 uvec) 0.0 1.0 0.0 0.0) - (set-vector! (-> sv-228 fvec) (-> sv-220 x) 0.0 (-> sv-220 z) 0.0) - (set-vector! (-> sv-228 trans) f0-4 0.0 f1-3 1.0) - ) - (let ((v1-42 (-> sv-228 trans))) - (when (< (sqrtf (+ (* (-> v1-42 x) (-> v1-42 x)) (* (-> v1-42 z) (-> v1-42 z)))) 50.0) - (matrix*! sv-228 sv-228 sv-224) - (let ((f0-12 7.0)) - (set-vector! (-> arg0 corner 0) 0.0 0.0 (- f0-12) 1.0) - (set-vector! (-> arg0 corner 1) f0-12 0.0 0.0 1.0) - (set-vector! (-> arg0 corner 2) (- f0-12) 0.0 0.0 1.0) - (set-vector! (-> arg0 corner 3) 0.0 0.0 f0-12 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-59 - (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 ((v1-42 (-> sv-228 trans))) + (when (< (sqrtf (+ (* (-> v1-42 x) (-> v1-42 x)) (* (-> v1-42 z) (-> v1-42 z)))) 50.0) + (matrix*! sv-228 sv-228 sv-224) + (let ((f0-12 7.0)) + (set-vector! (-> arg0 corner 0) 0.0 0.0 (- f0-12) 1.0) + (set-vector! (-> arg0 corner 1) f0-12 0.0 0.0 1.0) + (set-vector! (-> arg0 corner 2) (- f0-12) 0.0 0.0 1.0) + (set-vector! (-> arg0 corner 3) 0.0 0.0 f0-12 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-59 + (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-65 (-> this draw4-tmpl dma-vif quad))) - (set! (-> (the-as (pointer uint128) sv-208)) a0-65) - ) - (let ((a0-66 (-> this draw4-tmpl quad 1))) - (set! (-> (the-as (pointer uint128) sv-208) 1) a0-66) - ) - (set-vector! - (-> (the-as (inline-array vector4w) sv-208) 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! (-> (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-59 r)) + (the-as int (-> v1-59 g)) + (the-as int (-> v1-59 b)) + (the-as int (-> v1-59 a)) + ) + ) + (let ((v1-62 (the-as object (&+ sv-208 48)))) + (set! (-> (the-as (inline-array vector) v1-62) 0 x) 0.0) + (set! (-> (the-as (inline-array vector) v1-62) 0 y) 0.0) + (set! (-> (the-as (inline-array vector) v1-62) 0 z) 1.0) + (set! (-> (the-as (inline-array vector) v1-62) 0 w) 0.0) + ) + (let ((v1-64 (the-as object (&+ sv-208 64)))) + (set! (-> (the-as (inline-array vector4w) v1-64) 0 x) (the int (* 16.0 (-> arg0 corner 0 x)))) + (set! (-> (the-as (inline-array vector4w) v1-64) 0 y) (the int (* 16.0 (-> arg0 corner 0 z)))) + (set! (-> (the-as (inline-array vector4w) v1-64) 0 z) #xffffff) + (set! (-> (the-as (inline-array vector4w) v1-64) 0 w) 0) + ) + (let ((v1-66 (the-as object (&+ sv-208 80)))) + (set! (-> (the-as (inline-array vector) v1-66) 0 x) 1.0) + (set! (-> (the-as (inline-array vector) v1-66) 0 y) 0.0) + (set! (-> (the-as (inline-array vector) v1-66) 0 z) 1.0) + (set! (-> (the-as (inline-array vector) v1-66) 0 w) 0.0) + ) + (let ((v1-68 (the-as object (&+ sv-208 96)))) + (set! (-> (the-as (inline-array vector4w) v1-68) 0 x) (the int (* 16.0 (-> arg0 corner 1 x)))) + (set! (-> (the-as (inline-array vector4w) v1-68) 0 y) (the int (* 16.0 (-> arg0 corner 1 z)))) + (set! (-> (the-as (inline-array vector4w) v1-68) 0 z) #xffffff) + (set! (-> (the-as (inline-array vector4w) v1-68) 0 w) 0) + ) + (let ((v1-70 (the-as object (&+ sv-208 112)))) + (set! (-> (the-as (inline-array vector) v1-70) 0 x) 0.0) + (set! (-> (the-as (inline-array vector) v1-70) 0 y) 1.0) + (set! (-> (the-as (inline-array vector) v1-70) 0 z) 1.0) + (set! (-> (the-as (inline-array vector) v1-70) 0 w) 0.0) + ) + (let ((v1-72 (the-as object (&+ sv-208 128)))) + (set! (-> (the-as (inline-array vector4w) v1-72) 0 x) (the int (* 16.0 (-> arg0 corner 2 x)))) + (set! (-> (the-as (inline-array vector4w) v1-72) 0 y) (the int (* 16.0 (-> arg0 corner 2 z)))) + (set! (-> (the-as (inline-array vector4w) v1-72) 0 z) #xffffff) + (set! (-> (the-as (inline-array vector4w) v1-72) 0 w) 0) + ) + (let ((v1-74 (the-as object (&+ sv-208 144)))) + (set! (-> (the-as (inline-array vector) v1-74) 0 x) 1.0) + (set! (-> (the-as (inline-array vector) v1-74) 0 y) 1.0) + (set! (-> (the-as (inline-array vector) v1-74) 0 z) 1.0) + (set! (-> (the-as (inline-array vector) v1-74) 0 w) 0.0) + ) + (let ((v1-76 (the-as object (&+ sv-208 160)))) + (set! (-> (the-as (inline-array vector4w) v1-76) 0 x) (the int (* 16.0 (-> arg0 corner 3 x)))) + (set! (-> (the-as (inline-array vector4w) v1-76) 0 y) (the int (* 16.0 (-> arg0 corner 3 z)))) + (set! (-> (the-as (inline-array vector4w) v1-76) 0 z) #xffffff) + (set! (-> (the-as (inline-array vector4w) v1-76) 0 w) 0) + ) + (&+! (-> sv-20 base) 176) ) ) - (let ((v1-62 (the-as object (&+ sv-208 48)))) - (set! (-> (the-as (inline-array vector) v1-62) 0 x) 0.0) - (set! (-> (the-as (inline-array vector) v1-62) 0 y) 0.0) - (set! (-> (the-as (inline-array vector) v1-62) 0 z) 1.0) - (set! (-> (the-as (inline-array vector) v1-62) 0 w) 0.0) - ) - (let ((v1-64 (the-as object (&+ sv-208 64)))) - (set! (-> (the-as (inline-array vector4w) v1-64) 0 x) (the int (* 16.0 (-> arg0 corner 0 x)))) - (set! (-> (the-as (inline-array vector4w) v1-64) 0 y) (the int (* 16.0 (-> arg0 corner 0 z)))) - (set! (-> (the-as (inline-array vector4w) v1-64) 0 z) #xffffff) - (set! (-> (the-as (inline-array vector4w) v1-64) 0 w) 0) - ) - (let ((v1-66 (the-as object (&+ sv-208 80)))) - (set! (-> (the-as (inline-array vector) v1-66) 0 x) 1.0) - (set! (-> (the-as (inline-array vector) v1-66) 0 y) 0.0) - (set! (-> (the-as (inline-array vector) v1-66) 0 z) 1.0) - (set! (-> (the-as (inline-array vector) v1-66) 0 w) 0.0) - ) - (let ((v1-68 (the-as object (&+ sv-208 96)))) - (set! (-> (the-as (inline-array vector4w) v1-68) 0 x) (the int (* 16.0 (-> arg0 corner 1 x)))) - (set! (-> (the-as (inline-array vector4w) v1-68) 0 y) (the int (* 16.0 (-> arg0 corner 1 z)))) - (set! (-> (the-as (inline-array vector4w) v1-68) 0 z) #xffffff) - (set! (-> (the-as (inline-array vector4w) v1-68) 0 w) 0) - ) - (let ((v1-70 (the-as object (&+ sv-208 112)))) - (set! (-> (the-as (inline-array vector) v1-70) 0 x) 0.0) - (set! (-> (the-as (inline-array vector) v1-70) 0 y) 1.0) - (set! (-> (the-as (inline-array vector) v1-70) 0 z) 1.0) - (set! (-> (the-as (inline-array vector) v1-70) 0 w) 0.0) - ) - (let ((v1-72 (the-as object (&+ sv-208 128)))) - (set! (-> (the-as (inline-array vector4w) v1-72) 0 x) (the int (* 16.0 (-> arg0 corner 2 x)))) - (set! (-> (the-as (inline-array vector4w) v1-72) 0 y) (the int (* 16.0 (-> arg0 corner 2 z)))) - (set! (-> (the-as (inline-array vector4w) v1-72) 0 z) #xffffff) - (set! (-> (the-as (inline-array vector4w) v1-72) 0 w) 0) - ) - (let ((v1-74 (the-as object (&+ sv-208 144)))) - (set! (-> (the-as (inline-array vector) v1-74) 0 x) 1.0) - (set! (-> (the-as (inline-array vector) v1-74) 0 y) 1.0) - (set! (-> (the-as (inline-array vector) v1-74) 0 z) 1.0) - (set! (-> (the-as (inline-array vector) v1-74) 0 w) 0.0) - ) - (let ((v1-76 (the-as object (&+ sv-208 160)))) - (set! (-> (the-as (inline-array vector4w) v1-76) 0 x) (the int (* 16.0 (-> arg0 corner 3 x)))) - (set! (-> (the-as (inline-array vector4w) v1-76) 0 y) (the int (* 16.0 (-> arg0 corner 3 z)))) - (set! (-> (the-as (inline-array vector4w) v1-76) 0 z) #xffffff) - (set! (-> (the-as (inline-array vector4w) v1-76) 0 w) 0) - ) - (&+! (-> sv-20 base) 176) ) ) ) @@ -2483,132 +2474,124 @@ ;; INFO: Used lq/sq ;; 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 (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 - ((get-horizontal-flip-flag *blit-displays-work*) - (let ((f0-4 (+ arg3 (* (- 128.0 (/ (-> sv-132 x) arg2)) sv-20))) - (f1-4 (+ arg4 (/ (-> sv-132 z) arg2))) - ) - (set-vector! (-> sv-140 rvec) (-> sv-136 z) 0.0 (-> sv-136 x) 0.0) - (set-vector! (-> sv-140 uvec) 0.0 1.0 0.0 0.0) - (set-vector! (-> sv-140 fvec) (- (-> 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))) + (let ((sv-16 (as-type (handle->process (-> arg1 handle)) process-drawable)) + (sv-20 (-> *video-params* relative-x-scale)) + (sv-24 (-> arg0 buf)) + ) + (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)) ) - (set-vector! (-> sv-140 rvec) (-> sv-136 z) 0.0 (- (-> sv-136 x)) 0.0) - (set-vector! (-> sv-140 uvec) 0.0 1.0 0.0 0.0) - (set-vector! (-> sv-140 fvec) (-> sv-136 x) 0.0 (-> sv-136 z) 0.0) - (set-vector! (-> sv-140 trans) f0-8 0.0 f1-9 1.0) + (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 + ((get-horizontal-flip-flag *blit-displays-work*) + (let ((f0-4 (+ arg3 (* (- 128.0 (/ (-> sv-132 x) arg2)) sv-20))) + (f1-4 (+ arg4 (/ (-> sv-132 z) arg2))) + ) + (set-vector! (-> sv-140 rvec) (-> sv-136 z) 0.0 (-> sv-136 x) 0.0) + (set-vector! (-> sv-140 uvec) 0.0 1.0 0.0 0.0) + (set-vector! (-> sv-140 fvec) (- (-> 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 rvec) (-> sv-136 z) 0.0 (- (-> sv-136 x)) 0.0) + (set-vector! (-> sv-140 uvec) 0.0 1.0 0.0 0.0) + (set-vector! (-> sv-140 fvec) (-> 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-33 (-> arg1 class color)) + (a0-40 (copy-and-set-field a0-33 r (shr (* (-> a0-33 r) (the-as uint (-> this color x))) 7))) + (a0-47 (copy-and-set-field a0-40 g (shr (* (-> a0-40 g) (the-as uint (-> this color y))) 7))) + (v1-57 (copy-and-set-field + (copy-and-set-field a0-47 b (shr (* (-> a0-47 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)) + (let ((a0-63 (the-as object (&+ sv-128 32)))) + (set! (-> (the-as (inline-array vector4w) a0-63) 0 x) (the-as int (-> v1-57 r))) + (set! (-> (the-as (inline-array vector4w) a0-63) 0 y) (the-as int (-> v1-57 g))) + (set! (-> (the-as (inline-array vector4w) a0-63) 0 z) (the-as int (-> v1-57 b))) + (set! (-> (the-as (inline-array vector4w) a0-63) 0 w) (the-as int (-> v1-57 a))) + ) + ) + (let ((v1-60 (the-as object (&+ sv-128 48)))) + (set! (-> (the-as (inline-array vector) v1-60) 0 x) 0.0) + (set! (-> (the-as (inline-array vector) v1-60) 0 y) 0.0) + (set! (-> (the-as (inline-array vector) v1-60) 0 z) 1.0) + (set! (-> (the-as (inline-array vector) v1-60) 0 w) 0.0) + ) + (let ((v1-62 (the-as object (&+ sv-128 64)))) + (set! (-> (the-as (inline-array vector4w) v1-62) 0 x) (the int (* 16.0 (-> arg0 corner 0 x)))) + (set! (-> (the-as (inline-array vector4w) v1-62) 0 y) (the int (* 16.0 (-> arg0 corner 0 z)))) + (set! (-> (the-as (inline-array vector4w) v1-62) 0 z) #xffffff) + (set! (-> (the-as (inline-array vector4w) v1-62) 0 w) 0) + ) + (let ((v1-64 (the-as object (&+ sv-128 80)))) + (set! (-> (the-as (inline-array vector) v1-64) 0 x) 1.0) + (set! (-> (the-as (inline-array vector) v1-64) 0 y) 0.0) + (set! (-> (the-as (inline-array vector) v1-64) 0 z) 1.0) + (set! (-> (the-as (inline-array vector) v1-64) 0 w) 0.0) + ) + (let ((v1-66 (the-as object (&+ sv-128 96)))) + (set! (-> (the-as (inline-array vector4w) v1-66) 0 x) (the int (* 16.0 (-> arg0 corner 1 x)))) + (set! (-> (the-as (inline-array vector4w) v1-66) 0 y) (the int (* 16.0 (-> arg0 corner 1 z)))) + (set! (-> (the-as (inline-array vector4w) v1-66) 0 z) #xffffff) + (set! (-> (the-as (inline-array vector4w) v1-66) 0 w) 0) + ) + (let ((v1-68 (the-as object (&+ sv-128 112)))) + (set! (-> (the-as (inline-array vector) v1-68) 0 x) 0.0) + (set! (-> (the-as (inline-array vector) v1-68) 0 y) 1.0) + (set! (-> (the-as (inline-array vector) v1-68) 0 z) 1.0) + (set! (-> (the-as (inline-array vector) v1-68) 0 w) 0.0) + ) + (let ((v1-70 (the-as object (&+ sv-128 128)))) + (set! (-> (the-as (inline-array vector4w) v1-70) 0 x) (the int (* 16.0 (-> arg0 corner 2 x)))) + (set! (-> (the-as (inline-array vector4w) v1-70) 0 y) (the int (* 16.0 (-> arg0 corner 2 z)))) + (set! (-> (the-as (inline-array vector4w) v1-70) 0 z) #xffffff) + (set! (-> (the-as (inline-array vector4w) v1-70) 0 w) 0) + ) + (let ((v1-72 (the-as object (&+ sv-128 144)))) + (set! (-> (the-as (inline-array vector) v1-72) 0 x) 1.0) + (set! (-> (the-as (inline-array vector) v1-72) 0 y) 1.0) + (set! (-> (the-as (inline-array vector) v1-72) 0 z) 1.0) + (set! (-> (the-as (inline-array vector) v1-72) 0 w) 0.0) + ) + (let ((v1-74 (the-as object (&+ sv-128 160)))) + (set! (-> (the-as (inline-array vector4w) v1-74) 0 x) (the int (* 16.0 (-> arg0 corner 3 x)))) + (set! (-> (the-as (inline-array vector4w) v1-74) 0 y) (the int (* 16.0 (-> arg0 corner 3 z)))) + (set! (-> (the-as (inline-array vector4w) v1-74) 0 z) #xffffff) + (set! (-> (the-as (inline-array vector4w) v1-74) 0 w) 0) ) ) + (&+! (-> sv-24 base) 176) ) - (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-33 (-> arg1 class color)) - (a0-40 (copy-and-set-field a0-33 r (shr (* (-> a0-33 r) (the-as uint (-> this color x))) 7))) - (a0-47 (copy-and-set-field a0-40 g (shr (* (-> a0-40 g) (the-as uint (-> this color y))) 7))) - (v1-57 (copy-and-set-field - (copy-and-set-field a0-47 b (shr (* (-> a0-47 b) (the-as uint (-> this color z))) 7)) - a - (the int (* 128.0 (-> arg1 alpha))) - ) - ) - ) - (let ((a0-60 (-> this draw4-tmpl dma-vif quad))) - (set! (-> (the-as (pointer uint128) sv-128)) a0-60) - ) - (let ((a0-61 (-> this draw4-tmpl quad 1))) - (set! (-> (the-as (pointer uint128) sv-128) 1) a0-61) - ) - (let ((a0-63 (the-as object (&+ sv-128 32)))) - (set! (-> (the-as (inline-array vector4w) a0-63) 0 x) (the-as int (-> v1-57 r))) - (set! (-> (the-as (inline-array vector4w) a0-63) 0 y) (the-as int (-> v1-57 g))) - (set! (-> (the-as (inline-array vector4w) a0-63) 0 z) (the-as int (-> v1-57 b))) - (set! (-> (the-as (inline-array vector4w) a0-63) 0 w) (the-as int (-> v1-57 a))) - ) - ) - (let ((v1-60 (the-as object (&+ sv-128 48)))) - (set! (-> (the-as (inline-array vector) v1-60) 0 x) 0.0) - (set! (-> (the-as (inline-array vector) v1-60) 0 y) 0.0) - (set! (-> (the-as (inline-array vector) v1-60) 0 z) 1.0) - (set! (-> (the-as (inline-array vector) v1-60) 0 w) 0.0) - ) - (let ((v1-62 (the-as object (&+ sv-128 64)))) - (set! (-> (the-as (inline-array vector4w) v1-62) 0 x) (the int (* 16.0 (-> arg0 corner 0 x)))) - (set! (-> (the-as (inline-array vector4w) v1-62) 0 y) (the int (* 16.0 (-> arg0 corner 0 z)))) - (set! (-> (the-as (inline-array vector4w) v1-62) 0 z) #xffffff) - (set! (-> (the-as (inline-array vector4w) v1-62) 0 w) 0) - ) - (let ((v1-64 (the-as object (&+ sv-128 80)))) - (set! (-> (the-as (inline-array vector) v1-64) 0 x) 1.0) - (set! (-> (the-as (inline-array vector) v1-64) 0 y) 0.0) - (set! (-> (the-as (inline-array vector) v1-64) 0 z) 1.0) - (set! (-> (the-as (inline-array vector) v1-64) 0 w) 0.0) - ) - (let ((v1-66 (the-as object (&+ sv-128 96)))) - (set! (-> (the-as (inline-array vector4w) v1-66) 0 x) (the int (* 16.0 (-> arg0 corner 1 x)))) - (set! (-> (the-as (inline-array vector4w) v1-66) 0 y) (the int (* 16.0 (-> arg0 corner 1 z)))) - (set! (-> (the-as (inline-array vector4w) v1-66) 0 z) #xffffff) - (set! (-> (the-as (inline-array vector4w) v1-66) 0 w) 0) - ) - (let ((v1-68 (the-as object (&+ sv-128 112)))) - (set! (-> (the-as (inline-array vector) v1-68) 0 x) 0.0) - (set! (-> (the-as (inline-array vector) v1-68) 0 y) 1.0) - (set! (-> (the-as (inline-array vector) v1-68) 0 z) 1.0) - (set! (-> (the-as (inline-array vector) v1-68) 0 w) 0.0) - ) - (let ((v1-70 (the-as object (&+ sv-128 128)))) - (set! (-> (the-as (inline-array vector4w) v1-70) 0 x) (the int (* 16.0 (-> arg0 corner 2 x)))) - (set! (-> (the-as (inline-array vector4w) v1-70) 0 y) (the int (* 16.0 (-> arg0 corner 2 z)))) - (set! (-> (the-as (inline-array vector4w) v1-70) 0 z) #xffffff) - (set! (-> (the-as (inline-array vector4w) v1-70) 0 w) 0) - ) - (let ((v1-72 (the-as object (&+ sv-128 144)))) - (set! (-> (the-as (inline-array vector) v1-72) 0 x) 1.0) - (set! (-> (the-as (inline-array vector) v1-72) 0 y) 1.0) - (set! (-> (the-as (inline-array vector) v1-72) 0 z) 1.0) - (set! (-> (the-as (inline-array vector) v1-72) 0 w) 0.0) - ) - (let ((v1-74 (the-as object (&+ sv-128 160)))) - (set! (-> (the-as (inline-array vector4w) v1-74) 0 x) (the int (* 16.0 (-> arg0 corner 3 x)))) - (set! (-> (the-as (inline-array vector4w) v1-74) 0 y) (the int (* 16.0 (-> arg0 corner 3 z)))) - (set! (-> (the-as (inline-array vector4w) v1-74) 0 z) #xffffff) - (set! (-> (the-as (inline-array vector4w) v1-74) 0 w) 0) - ) - (&+! (-> sv-24 base) 176) ) (none) ) @@ -2617,17 +2600,6 @@ ;; 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 vector) - (sv-228 matrix) - (sv-232 matrix) - ) (rlet ((vf1 :class vf) (vf2 :class vf) (vf3 :class vf) @@ -2635,143 +2607,139 @@ (vf5 :class vf) (vf6 :class vf) ) - (set! sv-16 (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 level-default-minimap)) - (set! sv-216 (new 'stack-no-clear 'vector)) - (set! sv-220 (new 'stack-no-clear 'vector)) - (set! sv-224 (new 'stack-no-clear 'vector)) - (set! sv-228 (new 'stack-no-clear 'matrix)) - (set! sv-232 (new 'stack-no-clear 'matrix)) - (when sv-212 - (vector-copy! sv-220 (-> (matrix-world->local #f #f) fvec)) - (set! (-> sv-220 y) 0.0) - (vector-normalize! sv-220 1.0) - (vector-z-quaternion! sv-224 (-> (the-as process-drawable sv-16) root quat)) - (vector-xz-normalize! sv-224 1.0) - (set! (-> sv-224 y) 0.0) - (set! (-> sv-224 w) 0.0) - (vector-! sv-216 (target-pos 0) (-> (the-as process-drawable sv-16) root trans)) - (let ((f0-4 (/ (-> sv-216 x) (* (-> this meters-per-texel) (-> this map-inv-scale)))) - (f1-3 (/ (-> sv-216 z) (* (-> this meters-per-texel) (-> this map-inv-scale)))) - ) - (set-vector! (-> sv-228 rvec) (-> sv-220 z) 0.0 (- (-> sv-220 x)) 0.0) - (set-vector! (-> sv-228 uvec) 0.0 1.0 0.0 0.0) - (set-vector! (-> sv-228 fvec) (-> 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 rvec) (-> sv-224 z) 0.0 (- (-> sv-224 x)) 0.0) - (set-vector! (-> sv-232 uvec) 0.0 1.0 0.0 0.0) - (set-vector! (-> sv-232 fvec) (-> sv-224 x) 0.0 (-> sv-224 z) 0.0) - (set-vector! (-> sv-232 trans) f0-4 0.0 f1-3 1.0) + (let ((sv-16 (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 map-inv-scale)))) - (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 ((v1-47 (new 'stack-no-clear 'vector)) - (a0-40 (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 level-default-minimap)) + (sv-216 (new 'stack-no-clear 'vector)) + (sv-220 (new 'stack-no-clear 'vector)) + (sv-224 (new 'stack-no-clear 'vector)) + (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 vf6 vf1 vf2) - (.max.vf vf6 vf6 vf3) - (.max.vf vf6 vf6 vf4) - (.svf (&-> v1-47 quad) vf5) - (.svf (&-> a0-40 quad) vf6) - (when (and (< (-> a0-40 x) 228.0) (< (-> a0-40 z) 228.0) (< 100.0 (-> v1-47 x)) (< 100.0 (-> v1-47 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-58 (-> this adgif-tmpl dma-vif quad))) - (set! (-> (the-as (pointer uint128) sv-208) 0) v1-58) - ) - (let ((v1-59 (-> this adgif-tmpl quad 1))) - (set! (-> (the-as (pointer uint128) sv-208) 1) v1-59) - ) - (adgif-shader<-texture-simple! (the-as adgif-shader (&+ sv-208 32)) sv-212) - (let ((v1-61 (-> this draw4-tmpl dma-vif quad))) - (set! (-> (the-as (pointer uint128) sv-208) 7) v1-61) - ) - (let ((v1-62 (-> this draw4-tmpl quad 1))) - (set! (-> (the-as (pointer uint128) sv-208) 8) v1-62) - ) - (let ((v1-64 (the-as object (&+ sv-208 144)))) - (set! (-> (the-as (inline-array vector4w) v1-64) 0 x) (the-as int (-> s4-1 r))) - (set! (-> (the-as (inline-array vector4w) v1-64) 0 y) (the-as int (-> s4-1 g))) - (set! (-> (the-as (inline-array vector4w) v1-64) 0 z) (the-as int (-> s4-1 b))) - (set! (-> (the-as (inline-array vector4w) v1-64) 0 w) (the-as int (-> s4-1 a))) + (when sv-212 + (vector-copy! sv-220 (-> (matrix-world->local #f #f) fvec)) + (set! (-> sv-220 y) 0.0) + (vector-normalize! sv-220 1.0) + (vector-z-quaternion! sv-224 (-> (the-as process-drawable sv-16) root quat)) + (vector-xz-normalize! sv-224 1.0) + (set! (-> sv-224 y) 0.0) + (set! (-> sv-224 w) 0.0) + (vector-! sv-216 (target-pos 0) (-> (the-as process-drawable sv-16) root trans)) + (let ((f0-4 (/ (-> sv-216 x) (* (-> this meters-per-texel) (-> this map-inv-scale)))) + (f1-3 (/ (-> sv-216 z) (* (-> this meters-per-texel) (-> this map-inv-scale)))) + ) + (set-vector! (-> sv-228 rvec) (-> sv-220 z) 0.0 (- (-> sv-220 x)) 0.0) + (set-vector! (-> sv-228 uvec) 0.0 1.0 0.0 0.0) + (set-vector! (-> sv-228 fvec) (-> 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 rvec) (-> sv-224 z) 0.0 (- (-> sv-224 x)) 0.0) + (set-vector! (-> sv-232 uvec) 0.0 1.0 0.0 0.0) + (set-vector! (-> sv-232 fvec) (-> sv-224 x) 0.0 (-> sv-224 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 map-inv-scale)))) + (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 ((v1-47 (new 'stack-no-clear 'vector)) + (a0-40 (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 vf6 vf1 vf2) + (.max.vf vf6 vf6 vf3) + (.max.vf vf6 vf6 vf4) + (.svf (&-> v1-47 quad) vf5) + (.svf (&-> a0-40 quad) vf6) + (when (and (< (-> a0-40 x) 228.0) (< (-> a0-40 z) 228.0) (< 100.0 (-> v1-47 x)) (< 100.0 (-> v1-47 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))) + ) + ) + ) + (set! (-> (the-as (pointer uint128) sv-208) 0) (-> 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)) + (let ((v1-64 (the-as object (&+ sv-208 144)))) + (set! (-> (the-as (inline-array vector4w) v1-64) 0 x) (the-as int (-> s4-1 r))) + (set! (-> (the-as (inline-array vector4w) v1-64) 0 y) (the-as int (-> s4-1 g))) + (set! (-> (the-as (inline-array vector4w) v1-64) 0 z) (the-as int (-> s4-1 b))) + (set! (-> (the-as (inline-array vector4w) v1-64) 0 w) (the-as int (-> s4-1 a))) + ) + ) + (let ((v1-66 (the-as object (&+ sv-208 160)))) + (set! (-> (the-as (inline-array vector) v1-66) 0 x) 0.0) + (set! (-> (the-as (inline-array vector) v1-66) 0 y) 0.0) + (set! (-> (the-as (inline-array vector) v1-66) 0 z) 1.0) + (set! (-> (the-as (inline-array vector) v1-66) 0 w) 0.0) + ) + (let ((v1-68 (the-as object (&+ sv-208 176)))) + (set! (-> (the-as (inline-array vector4w) v1-68) 0 x) (the int (* 16.0 (-> arg0 corner 0 x)))) + (set! (-> (the-as (inline-array vector4w) v1-68) 0 y) (the int (* 16.0 (-> arg0 corner 0 z)))) + (set! (-> (the-as (inline-array vector4w) v1-68) 0 z) 0) + (set! (-> (the-as (inline-array vector4w) v1-68) 0 w) 0) + ) + (let ((v1-70 (the-as object (&+ sv-208 192)))) + (set! (-> (the-as (inline-array vector) v1-70) 0 x) 1.0) + (set! (-> (the-as (inline-array vector) v1-70) 0 y) 0.0) + (set! (-> (the-as (inline-array vector) v1-70) 0 z) 1.0) + (set! (-> (the-as (inline-array vector) v1-70) 0 w) 0.0) + ) + (let ((v1-72 (the-as object (&+ sv-208 208)))) + (set! (-> (the-as (inline-array vector4w) v1-72) 0 x) (the int (* 16.0 (-> arg0 corner 1 x)))) + (set! (-> (the-as (inline-array vector4w) v1-72) 0 y) (the int (* 16.0 (-> arg0 corner 1 z)))) + (set! (-> (the-as (inline-array vector4w) v1-72) 0 z) 0) + (set! (-> (the-as (inline-array vector4w) v1-72) 0 w) 0) + ) + (let ((v1-74 (the-as object (&+ sv-208 224)))) + (set! (-> (the-as (inline-array vector) v1-74) 0 x) 0.0) + (set! (-> (the-as (inline-array vector) v1-74) 0 y) 1.0) + (set! (-> (the-as (inline-array vector) v1-74) 0 z) 1.0) + (set! (-> (the-as (inline-array vector) v1-74) 0 w) 0.0) + ) + (let ((v1-76 (the-as object (&+ sv-208 240)))) + (set! (-> (the-as (inline-array vector4w) v1-76) 0 x) (the int (* 16.0 (-> arg0 corner 2 x)))) + (set! (-> (the-as (inline-array vector4w) v1-76) 0 y) (the int (* 16.0 (-> arg0 corner 2 z)))) + (set! (-> (the-as (inline-array vector4w) v1-76) 0 z) 0) + (set! (-> (the-as (inline-array vector4w) v1-76) 0 w) 0) + ) + (let ((v1-78 (the-as object (&+ sv-208 256)))) + (set! (-> (the-as (inline-array vector) v1-78) 0 x) 1.0) + (set! (-> (the-as (inline-array vector) v1-78) 0 y) 1.0) + (set! (-> (the-as (inline-array vector) v1-78) 0 z) 1.0) + (set! (-> (the-as (inline-array vector) v1-78) 0 w) 0.0) + ) + (let ((v1-80 (the-as object (&+ sv-208 272)))) + (set! (-> (the-as (inline-array vector4w) v1-80) 0 x) (the int (* 16.0 (-> arg0 corner 3 x)))) + (set! (-> (the-as (inline-array vector4w) v1-80) 0 y) (the int (* 16.0 (-> arg0 corner 3 z)))) + (set! (-> (the-as (inline-array vector4w) v1-80) 0 z) 0) + (set! (-> (the-as (inline-array vector4w) v1-80) 0 w) 0) + ) + (&+! (-> sv-20 base) 288) ) ) - (let ((v1-66 (the-as object (&+ sv-208 160)))) - (set! (-> (the-as (inline-array vector) v1-66) 0 x) 0.0) - (set! (-> (the-as (inline-array vector) v1-66) 0 y) 0.0) - (set! (-> (the-as (inline-array vector) v1-66) 0 z) 1.0) - (set! (-> (the-as (inline-array vector) v1-66) 0 w) 0.0) - ) - (let ((v1-68 (the-as object (&+ sv-208 176)))) - (set! (-> (the-as (inline-array vector4w) v1-68) 0 x) (the int (* 16.0 (-> arg0 corner 0 x)))) - (set! (-> (the-as (inline-array vector4w) v1-68) 0 y) (the int (* 16.0 (-> arg0 corner 0 z)))) - (set! (-> (the-as (inline-array vector4w) v1-68) 0 z) 0) - (set! (-> (the-as (inline-array vector4w) v1-68) 0 w) 0) - ) - (let ((v1-70 (the-as object (&+ sv-208 192)))) - (set! (-> (the-as (inline-array vector) v1-70) 0 x) 1.0) - (set! (-> (the-as (inline-array vector) v1-70) 0 y) 0.0) - (set! (-> (the-as (inline-array vector) v1-70) 0 z) 1.0) - (set! (-> (the-as (inline-array vector) v1-70) 0 w) 0.0) - ) - (let ((v1-72 (the-as object (&+ sv-208 208)))) - (set! (-> (the-as (inline-array vector4w) v1-72) 0 x) (the int (* 16.0 (-> arg0 corner 1 x)))) - (set! (-> (the-as (inline-array vector4w) v1-72) 0 y) (the int (* 16.0 (-> arg0 corner 1 z)))) - (set! (-> (the-as (inline-array vector4w) v1-72) 0 z) 0) - (set! (-> (the-as (inline-array vector4w) v1-72) 0 w) 0) - ) - (let ((v1-74 (the-as object (&+ sv-208 224)))) - (set! (-> (the-as (inline-array vector) v1-74) 0 x) 0.0) - (set! (-> (the-as (inline-array vector) v1-74) 0 y) 1.0) - (set! (-> (the-as (inline-array vector) v1-74) 0 z) 1.0) - (set! (-> (the-as (inline-array vector) v1-74) 0 w) 0.0) - ) - (let ((v1-76 (the-as object (&+ sv-208 240)))) - (set! (-> (the-as (inline-array vector4w) v1-76) 0 x) (the int (* 16.0 (-> arg0 corner 2 x)))) - (set! (-> (the-as (inline-array vector4w) v1-76) 0 y) (the int (* 16.0 (-> arg0 corner 2 z)))) - (set! (-> (the-as (inline-array vector4w) v1-76) 0 z) 0) - (set! (-> (the-as (inline-array vector4w) v1-76) 0 w) 0) - ) - (let ((v1-78 (the-as object (&+ sv-208 256)))) - (set! (-> (the-as (inline-array vector) v1-78) 0 x) 1.0) - (set! (-> (the-as (inline-array vector) v1-78) 0 y) 1.0) - (set! (-> (the-as (inline-array vector) v1-78) 0 z) 1.0) - (set! (-> (the-as (inline-array vector) v1-78) 0 w) 0.0) - ) - (let ((v1-80 (the-as object (&+ sv-208 272)))) - (set! (-> (the-as (inline-array vector4w) v1-80) 0 x) (the int (* 16.0 (-> arg0 corner 3 x)))) - (set! (-> (the-as (inline-array vector4w) v1-80) 0 y) (the int (* 16.0 (-> arg0 corner 3 z)))) - (set! (-> (the-as (inline-array vector4w) v1-80) 0 z) 0) - (set! (-> (the-as (inline-array vector4w) v1-80) 0 w) 0) - ) - (&+! (-> sv-20 base) 288) ) ) ) @@ -2784,17 +2752,6 @@ ;; 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 vector) - (sv-228 matrix) - (sv-232 matrix) - ) (rlet ((vf1 :class vf) (vf2 :class vf) (vf3 :class vf) @@ -2802,142 +2759,142 @@ (vf5 :class vf) (vf6 :class vf) ) - (set! sv-16 (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 level-default-minimap)) - (set! sv-216 (new 'stack-no-clear 'vector)) - (set! sv-220 (new 'stack-no-clear 'vector)) - (set! sv-224 (new 'stack-no-clear 'vector)) - (set! sv-228 (new 'stack-no-clear 'matrix)) - (set! sv-232 (new 'stack-no-clear 'matrix)) - (when sv-212 - (vector-copy! sv-220 (-> (matrix-world->local #f #f) fvec)) - (set! (-> sv-220 y) 0.0) - (vector-normalize! sv-220 1.0) - (vector-z-quaternion! sv-224 (-> (the-as process-drawable sv-16) root quat)) - (vector-xz-normalize! sv-224 1.0) - (set! (-> sv-224 y) 0.0) - (set! (-> sv-224 w) 0.0) - (vector-! sv-216 (target-pos 0) (-> (the-as process-drawable sv-16) root trans)) - (let ((f0-4 (/ (-> sv-216 x) (* (-> this meters-per-texel) (-> this map-inv-scale)))) - (f1-3 (/ (-> sv-216 z) (* (-> this meters-per-texel) (-> this map-inv-scale)))) - ) - (set-vector! (-> sv-228 rvec) (-> sv-220 z) 0.0 (- (-> sv-220 x)) 0.0) - (set-vector! (-> sv-228 uvec) 0.0 1.0 0.0 0.0) - (set-vector! (-> sv-228 fvec) (-> 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 rvec) (-> sv-224 z) 0.0 (- (-> sv-224 x)) 0.0) - (set-vector! (-> sv-232 uvec) 0.0 1.0 0.0 0.0) - (set-vector! (-> sv-232 fvec) (-> sv-224 x) 0.0 (-> sv-224 z) 0.0) - (set-vector! (-> sv-232 trans) f0-4 0.0 f1-3 1.0) + (let ((sv-16 (as-type (handle->process (-> arg1 handle)) process-drawable)) + (sv-20 (-> arg0 buf)) ) - (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 ((v1-47 (new 'stack-no-clear 'vector)) - (a0-39 (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 level-default-minimap)) + (sv-216 (new 'stack-no-clear 'vector)) + (sv-220 (new 'stack-no-clear 'vector)) + (sv-224 (new 'stack-no-clear 'vector)) + (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 vf6 vf1 vf2) - (.max.vf vf6 vf6 vf3) - (.max.vf vf6 vf6 vf4) - (.svf (&-> v1-47 quad) vf5) - (.svf (&-> a0-39 quad) vf6) - (when (and (< (-> a0-39 x) 228.0) (< (-> a0-39 z) 228.0) (< 100.0 (-> v1-47 x)) (< 100.0 (-> v1-47 z))) - (let* ((a3-0 (-> arg1 class color)) - (a2-6 (+ (* (the-as uint 320) (-> arg1 class icon-xy x)) 8)) - (a1-14 (+ (* (the-as uint 320) (-> arg1 class icon-xy y)) 8)) - (v1-54 (+ a2-6 304)) - (a0-49 (+ a1-14 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))) - ) - ) - ) - (let ((t0-22 (-> this draw3-tmpl dma-vif quad))) - (set! (-> (the-as (pointer uint128) sv-208) 0) t0-22) + (when sv-212 + (vector-copy! sv-220 (-> (matrix-world->local #f #f) fvec)) + (set! (-> sv-220 y) 0.0) + (vector-normalize! sv-220 1.0) + (vector-z-quaternion! sv-224 (-> (the-as process-drawable sv-16) root quat)) + (vector-xz-normalize! sv-224 1.0) + (set! (-> sv-224 y) 0.0) + (set! (-> sv-224 w) 0.0) + (vector-! sv-216 (target-pos 0) (-> (the-as process-drawable sv-16) root trans)) + (let ((f0-4 (/ (-> sv-216 x) (* (-> this meters-per-texel) (-> this map-inv-scale)))) + (f1-3 (/ (-> sv-216 z) (* (-> this meters-per-texel) (-> this map-inv-scale)))) ) - (let ((t0-23 (-> this draw3-tmpl quad 1))) - (set! (-> (the-as (pointer uint128) sv-208) 1) t0-23) + (set-vector! (-> sv-228 rvec) (-> sv-220 z) 0.0 (- (-> sv-220 x)) 0.0) + (set-vector! (-> sv-228 uvec) 0.0 1.0 0.0 0.0) + (set-vector! (-> sv-228 fvec) (-> 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 rvec) (-> sv-224 z) 0.0 (- (-> sv-224 x)) 0.0) + (set-vector! (-> sv-232 uvec) 0.0 1.0 0.0 0.0) + (set-vector! (-> sv-232 fvec) (-> sv-224 x) 0.0 (-> sv-224 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 ((v1-47 (new 'stack-no-clear 'vector)) + (a0-39 (new 'stack-no-clear 'vector)) ) - (let ((t0-25 (the-as (object object) (&-> (the-as (pointer uint128) sv-208) 2)))) - (set! (-> (the-as (inline-array vector4w) t0-25) 0 x) (the-as int (-> a3-13 r))) - (set! (-> (the-as (inline-array vector4w) t0-25) 0 y) (the-as int (-> a3-13 g))) - (set! (-> (the-as (inline-array vector4w) t0-25) 0 z) (the-as int (-> a3-13 b))) - (set! (-> (the-as (inline-array vector4w) t0-25) 0 w) (the-as int (-> a3-13 a))) + (.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 vf6 vf1 vf2) + (.max.vf vf6 vf6 vf3) + (.max.vf vf6 vf6 vf4) + (.svf (&-> v1-47 quad) vf5) + (.svf (&-> a0-39 quad) vf6) + (when (and (< (-> a0-39 x) 228.0) (< (-> a0-39 z) 228.0) (< 100.0 (-> v1-47 x)) (< 100.0 (-> v1-47 z))) + (let* ((a3-0 (-> arg1 class color)) + (a2-6 (+ (* (the-as uint 320) (-> arg1 class icon-xy x)) 8)) + (a1-14 (+ (* (the-as uint 320) (-> arg1 class icon-xy y)) 8)) + (v1-54 (+ a2-6 304)) + (a0-49 (+ a1-14 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))) + ) + ) + ) + (set! (-> (the-as (pointer uint128) sv-208) 0) (-> this draw3-tmpl dma-vif quad)) + (set! (-> (the-as (pointer uint128) sv-208) 1) (-> this draw3-tmpl quad 1)) + (let ((t0-25 (the-as (object object) (&-> (the-as (pointer uint128) sv-208) 2)))) + (set! (-> (the-as (inline-array vector4w) t0-25) 0 x) (the-as int (-> a3-13 r))) + (set! (-> (the-as (inline-array vector4w) t0-25) 0 y) (the-as int (-> a3-13 g))) + (set! (-> (the-as (inline-array vector4w) t0-25) 0 z) (the-as int (-> a3-13 b))) + (set! (-> (the-as (inline-array vector4w) t0-25) 0 w) (the-as int (-> a3-13 a))) + ) + ) + (let ((a3-16 (the-as (inline-array vector4w) (&+ sv-208 48)))) + (set! (-> a3-16 0 x) a2-6) + (set! (-> a3-16 0 y) a1-14) + (set! (-> a3-16 0 z) 0) + (set! (-> a3-16 0 w) 0) + ) + (let ((a3-18 (the-as object (&+ sv-208 64)))) + (set! (-> (the-as (inline-array vector4w) a3-18) 0 x) (the int (* 16.0 (-> arg0 corner 0 x)))) + (set! (-> (the-as (inline-array vector4w) a3-18) 0 y) (the int (* 16.0 (-> arg0 corner 0 z)))) + (set! (-> (the-as (inline-array vector4w) a3-18) 0 z) 0) + (set! (-> (the-as (inline-array vector4w) a3-18) 0 w) 0) + ) + (let ((a3-20 (the-as (inline-array vector4w) (&+ sv-208 80)))) + (set! (-> a3-20 0 x) a2-6) + (set! (-> a3-20 0 y) a0-49) + (set! (-> a3-20 0 z) 0) + (set! (-> a3-20 0 w) 0) + ) + (let ((a2-8 (the-as object (&+ sv-208 96)))) + (set! (-> (the-as (inline-array vector4w) a2-8) 0 x) (the int (* 16.0 (-> arg0 corner 1 x)))) + (set! (-> (the-as (inline-array vector4w) a2-8) 0 y) (the int (* 16.0 (-> arg0 corner 1 z)))) + (set! (-> (the-as (inline-array vector4w) a2-8) 0 z) 0) + (set! (-> (the-as (inline-array vector4w) a2-8) 0 w) 0) + ) + (let ((a2-10 (the-as (inline-array vector4w) (&+ sv-208 112)))) + (set! (-> a2-10 0 x) v1-54) + (set! (-> a2-10 0 y) a1-14) + (set! (-> a2-10 0 z) 0) + (set! (-> a2-10 0 w) 0) + ) + (let ((a1-16 (the-as object (&+ sv-208 128)))) + (set! (-> (the-as (inline-array vector4w) a1-16) 0 x) (the int (* 16.0 (-> arg0 corner 2 x)))) + (set! (-> (the-as (inline-array vector4w) a1-16) 0 y) (the int (* 16.0 (-> arg0 corner 2 z)))) + (set! (-> (the-as (inline-array vector4w) a1-16) 0 z) 0) + (set! (-> (the-as (inline-array vector4w) a1-16) 0 w) 0) + ) + (let ((a1-18 (the-as (inline-array vector4w) (&+ sv-208 144)))) + (set! (-> a1-18 0 x) v1-54) + (set! (-> a1-18 0 y) a0-49) + (set! (-> a1-18 0 z) 0) + (set! (-> a1-18 0 w) 0) + ) ) - ) - (let ((a3-16 (the-as (inline-array vector4w) (&+ sv-208 48)))) - (set! (-> a3-16 0 x) a2-6) - (set! (-> a3-16 0 y) a1-14) - (set! (-> a3-16 0 z) 0) - (set! (-> a3-16 0 w) 0) - ) - (let ((a3-18 (the-as object (&+ sv-208 64)))) - (set! (-> (the-as (inline-array vector4w) a3-18) 0 x) (the int (* 16.0 (-> arg0 corner 0 x)))) - (set! (-> (the-as (inline-array vector4w) a3-18) 0 y) (the int (* 16.0 (-> arg0 corner 0 z)))) - (set! (-> (the-as (inline-array vector4w) a3-18) 0 z) 0) - (set! (-> (the-as (inline-array vector4w) a3-18) 0 w) 0) - ) - (let ((a3-20 (the-as (inline-array vector4w) (&+ sv-208 80)))) - (set! (-> a3-20 0 x) a2-6) - (set! (-> a3-20 0 y) a0-49) - (set! (-> a3-20 0 z) 0) - (set! (-> a3-20 0 w) 0) - ) - (let ((a2-8 (the-as object (&+ sv-208 96)))) - (set! (-> (the-as (inline-array vector4w) a2-8) 0 x) (the int (* 16.0 (-> arg0 corner 1 x)))) - (set! (-> (the-as (inline-array vector4w) a2-8) 0 y) (the int (* 16.0 (-> arg0 corner 1 z)))) - (set! (-> (the-as (inline-array vector4w) a2-8) 0 z) 0) - (set! (-> (the-as (inline-array vector4w) a2-8) 0 w) 0) - ) - (let ((a2-10 (the-as (inline-array vector4w) (&+ sv-208 112)))) - (set! (-> a2-10 0 x) v1-54) - (set! (-> a2-10 0 y) a1-14) - (set! (-> a2-10 0 z) 0) - (set! (-> a2-10 0 w) 0) - ) - (let ((a1-16 (the-as object (&+ sv-208 128)))) - (set! (-> (the-as (inline-array vector4w) a1-16) 0 x) (the int (* 16.0 (-> arg0 corner 2 x)))) - (set! (-> (the-as (inline-array vector4w) a1-16) 0 y) (the int (* 16.0 (-> arg0 corner 2 z)))) - (set! (-> (the-as (inline-array vector4w) a1-16) 0 z) 0) - (set! (-> (the-as (inline-array vector4w) a1-16) 0 w) 0) - ) - (let ((a1-18 (the-as (inline-array vector4w) (&+ sv-208 144)))) - (set! (-> a1-18 0 x) v1-54) - (set! (-> a1-18 0 y) a0-49) - (set! (-> a1-18 0 z) 0) - (set! (-> a1-18 0 w) 0) + (let ((v1-56 (the-as object (&+ sv-208 160)))) + (set! (-> (the-as (inline-array vector4w) v1-56) 0 x) (the int (* 16.0 (-> arg0 corner 3 x)))) + (set! (-> (the-as (inline-array vector4w) v1-56) 0 y) (the int (* 16.0 (-> arg0 corner 3 z)))) + (set! (-> (the-as (inline-array vector4w) v1-56) 0 z) 0) + (set! (-> (the-as (inline-array vector4w) v1-56) 0 w) 0) + ) + (&+! (-> sv-20 base) 176) ) ) - (let ((v1-56 (the-as object (&+ sv-208 160)))) - (set! (-> (the-as (inline-array vector4w) v1-56) 0 x) (the int (* 16.0 (-> arg0 corner 3 x)))) - (set! (-> (the-as (inline-array vector4w) v1-56) 0 y) (the int (* 16.0 (-> arg0 corner 3 z)))) - (set! (-> (the-as (inline-array vector4w) v1-56) 0 z) 0) - (set! (-> (the-as (inline-array vector4w) v1-56) 0 w) 0) - ) - (&+! (-> sv-20 base) 176) ) ) ) @@ -3185,7 +3142,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 (sv-48 vector) (sv-52 vector) (sv-56 vector) (sv-64 int) (sv-80 int)) + (local-vars (sv-64 int) (sv-80 int)) (let ((s5-0 (-> arg0 buf))) (reset-display-gs-state *display* s5-0) (dma-buffer-add-gs-set s5-0 @@ -3270,34 +3227,37 @@ (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)) - (set! sv-52 (new-stack-vector0)) - (set! sv-56 (target-pos 0)) - (vector-copy! sv-52 (-> (matrix-world->local #f #f) fvec)) - (set! (-> sv-52 y) 0.0) - (vector-normalize! sv-52 1.0) - (cond - ((get-horizontal-flip-flag *blit-displays-work*) - (let ((v1-57 (-> arg0 mat))) - (set! (-> v1-57 rvec x) (* (-> sv-52 z) (- f30-0))) - (set! (-> v1-57 rvec y) 0.0) - (set! (-> v1-57 rvec z) (- (-> sv-52 x))) - (set! (-> v1-57 rvec w) 0.0) + (let ((sv-48 (new-stack-vector0))) + ) + (let ((sv-52 (new-stack-vector0))) + (let ((sv-56 (target-pos 0))) + ) + (vector-copy! sv-52 (-> (matrix-world->local #f #f) fvec)) + (set! (-> sv-52 y) 0.0) + (vector-normalize! sv-52 1.0) + (cond + ((get-horizontal-flip-flag *blit-displays-work*) + (let ((v1-57 (-> arg0 mat))) + (set! (-> v1-57 rvec x) (* (-> sv-52 z) (- f30-0))) + (set! (-> v1-57 rvec y) 0.0) + (set! (-> v1-57 rvec z) (- (-> sv-52 x))) + (set! (-> v1-57 rvec w) 0.0) + ) + (set-vector! (-> arg0 mat uvec) 0.0 1.0 0.0 0.0) + (set-vector! (-> arg0 mat fvec) (* (-> sv-52 x) (- f30-0)) 0.0 (-> sv-52 z) 0.0) + (set-vector! (-> arg0 mat trans) 0.0 0.0 (the float (+ (-> arg0 draw-pos y) 1896)) 1.0) ) - (set-vector! (-> arg0 mat uvec) 0.0 1.0 0.0 0.0) - (set-vector! (-> arg0 mat fvec) (* (-> sv-52 x) (- f30-0)) 0.0 (-> sv-52 z) 0.0) - (set-vector! (-> arg0 mat trans) 0.0 0.0 (the float (+ (-> arg0 draw-pos y) 1896)) 1.0) - ) - (else - (let ((v1-61 (-> arg0 mat))) - (set! (-> v1-61 rvec x) (* (-> sv-52 z) f30-0)) - (set! (-> v1-61 rvec y) 0.0) - (set! (-> v1-61 rvec z) (- (-> sv-52 x))) - (set! (-> v1-61 rvec w) 0.0) + (else + (let ((v1-61 (-> arg0 mat))) + (set! (-> v1-61 rvec x) (* (-> sv-52 z) f30-0)) + (set! (-> v1-61 rvec y) 0.0) + (set! (-> v1-61 rvec z) (- (-> sv-52 x))) + (set! (-> v1-61 rvec w) 0.0) + ) + (set-vector! (-> arg0 mat uvec) 0.0 1.0 0.0 0.0) + (set-vector! (-> arg0 mat fvec) (* (-> sv-52 x) f30-0) 0.0 (-> sv-52 z) 0.0) + (set-vector! (-> arg0 mat trans) 0.0 0.0 (the float (+ (-> arg0 draw-pos y) 1896)) 1.0) ) - (set-vector! (-> arg0 mat uvec) 0.0 1.0 0.0 0.0) - (set-vector! (-> arg0 mat fvec) (* (-> sv-52 x) f30-0) 0.0 (-> sv-52 z) 0.0) - (set-vector! (-> arg0 mat trans) 0.0 0.0 (the float (+ (-> arg0 draw-pos y) 1896)) 1.0) ) ) (let ((v1-66 (the int (* 56.0 f30-0)))) diff --git a/test/decompiler/reference/jak3/engine/ui/progress/progress-draw_REF.gc b/test/decompiler/reference/jak3/engine/ui/progress/progress-draw_REF.gc index dfde34a5db..5310e7bfa4 100644 --- a/test/decompiler/reference/jak3/engine/ui/progress/progress-draw_REF.gc +++ b/test/decompiler/reference/jak3/engine/ui/progress/progress-draw_REF.gc @@ -196,35 +196,26 @@ (arg5 float) (arg6 int) ) - (local-vars (sv-16 (function string font-context draw-string-result)) (sv-32 (function _varargs_ object))) (let ((v1-0 arg0)) (set! (-> v1-0 width) 10000.0) ) (set-scale! arg0 arg4) - (set! sv-16 get-string-length) - (set! sv-32 format) - (let ((a0-3 (clear *temp-string*)) - (a1-1 "~S") - (a2-1 arg3) + (let ((sv-16 get-string-length)) + (format (clear *temp-string*) "~S" arg3) + (let ((f0-2 (-> (sv-16 *temp-string* arg0) length))) + (let ((v1-5 arg0)) + (set! (-> v1-5 width) arg1) ) - (sv-32 a0-3 a1-1 a2-1) - ) - (let* ((a0-4 *temp-string*) - (a1-2 arg0) - (f0-2 (-> (sv-16 a0-4 a1-2) length)) + (cond + ((< arg1 f0-2) + (if (< (/ arg1 f0-2) arg5) + (set-scale! arg0 arg4) + (set-scale! arg0 (/ (* arg1 arg4) f0-2)) + ) ) - (let ((v1-5 arg0)) - (set! (-> v1-5 width) arg1) - ) - (cond - ((< arg1 f0-2) - (if (< (/ arg1 f0-2) arg5) - (set-scale! arg0 arg4) - (set-scale! arg0 (/ (* arg1 arg4) f0-2)) - ) - ) - (else - (set-scale! arg0 arg4) + (else + (set-scale! arg0 arg4) + ) ) ) ) @@ -415,7 +406,6 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs object. (defmethod draw-prev-next-footer ((this progress) (arg0 font-context) (arg1 float)) - (local-vars (sv-16 string)) (let ((s3-0 *progress-work*)) (progress-method-33 this (-> s3-0 footer)) (draw-bg-box-alpha-2 this (-> s3-0 footer) (* 64.0 arg1)) @@ -440,14 +430,11 @@ (set! (-> a0-11 flags) (font-flags kerning large)) ) (let ((s3-1 print-game-text)) - (let ((s2-0 format) - (s1-0 (clear *temp-string*)) - (s0-0 "~S~S") - ) - (set! sv-16 (lookup-text! *common-text* (text-id progress-footer-prev-l1) #f)) - (let ((a3-0 (lookup-text! *common-text* (text-id progress-prev) #f))) - (s2-0 s1-0 s0-0 sv-16 a3-0) - ) + (format + (clear *temp-string*) + "~S~S" + (lookup-text! *common-text* (text-id progress-footer-prev-l1) #f) + (lookup-text! *common-text* (text-id progress-prev) #f) ) (s3-1 *temp-string* arg0 #f 44 (bucket-id hud-draw-hud-alpha)) ) @@ -531,139 +518,125 @@ (arg5 symbol) (arg6 float) ) - (local-vars - (sv-16 float) - (sv-20 string) - (sv-24 vector) - (sv-32 symbol) - (sv-48 (function progress font-context float float string float float int float)) - (sv-64 font-context) - (sv-80 float) - (sv-96 float) - (sv-112 (function progress font-context float float string float float int float)) - (sv-128 progress) - (sv-144 font-context) - (sv-160 float) - (sv-176 float) - ) - (set! sv-32 arg5) - (let ((s1-0 arg6)) - (set! sv-16 (fmax 0.0 (* 2.0 (- 0.5 (-> this menu-transition))))) - (set! sv-20 (the-as string #f)) - (set! sv-24 (get-scissor-stack-top this)) + (let ((sv-32 arg5) + (s1-0 arg6) + (sv-16 (fmax 0.0 (* 2.0 (- 0.5 (-> this menu-transition))))) + (sv-20 (the-as string #f)) + (sv-24 (get-scissor-stack-top this)) + ) (set! (-> arg0 alpha) sv-16) (let ((a0-2 arg0)) (set! (-> a0-2 flags) (font-flags kerning middle large)) ) (let ((f30-0 0.0)) - (cond - (sv-32 - (let ((a0-3 arg0)) - (set! (-> a0-3 color) (font-color font-color-32)) - ) - (set! (-> arg0 origin x) (+ 10.0 (-> sv-24 x))) - (let ((s0-1 this)) - (set! sv-48 (method-of-object s0-1 progress-method-45)) - (set! sv-64 arg0) - (set! sv-80 (+ (- -20.0 (-> sv-24 x)) (-> sv-24 z))) - (set! sv-96 (the-as float 24.5)) - (let* ((t0-1 (lookup-text! *common-text* arg1 #f)) - (t2-1 0.75) - (t3-1 35) - (f28-0 (sv-48 s0-1 sv-64 sv-80 sv-96 t0-1 s1-0 t2-1 t3-1)) - ) - (set! f30-0 (/ f28-0 2)) - (set-scale! arg0 (/ (-> arg0 scale) 2)) - (draw-highlight-bar this arg0 (the int (+ -1.0 (-> arg0 origin y))) (the int (+ 2.0 f28-0)) sv-16) - (+! (-> arg0 origin y) f28-0) - ) - ) - (set! sv-20 (cond - ((-> this yes-no-choice) - (format - (clear *temp-string*) - "~33L~S ~44L~S" - (lookup-text! *common-text* arg2 #f) - (lookup-text! *common-text* arg3 #f) - ) - *temp-string* - ) - (else - (format - (clear *temp-string*) - "~44L~S~33L ~S" - (lookup-text! *common-text* arg2 #f) - (lookup-text! *common-text* arg3 #f) - ) - *temp-string* - ) - ) - ) - ) - (else - (cond - (arg4 - (let ((a0-16 arg0)) - (set! (-> a0-16 color) (font-color font-color-33)) - ) - ) - (else - (let ((a0-17 arg0)) - (set! (-> a0-17 color) (font-color font-color-32)) - ) - ) - ) - (set! (-> arg0 origin x) (+ 10.0 (-> sv-24 x))) - (set! sv-128 this) - (set! sv-112 (method-of-object sv-128 progress-method-45)) - (set! sv-144 arg0) - (set! sv-160 (+ (- -20.0 (-> sv-24 x)) (-> sv-24 z))) - (set! sv-176 (the-as float 24.5)) - (let ((t0-3 (the-as object (lookup-text! *common-text* arg1 #f)))) - (let* ((t1-2 s1-0) - (t2-2 0.75) - (t3-2 35) - (f28-1 (sv-112 sv-128 sv-144 sv-160 sv-176 (the-as string t0-3) t1-2 t2-2 t3-2)) - ) - (when arg4 - (let* ((a0-20 this) - (t9-14 (method-of-object a0-20 draw-highlight-bar)) - (a1-12 arg0) - (a2-12 (the int (+ -1.0 (-> arg0 origin y)))) - (a3-6 (the int (+ 1.0 f28-1))) - ) - (set! t0-3 sv-16) - (t9-14 a0-20 a1-12 a2-12 a3-6 (the-as float t0-3)) + (set! sv-20 + (cond + (sv-32 + (let ((a0-3 arg0)) + (set! (-> a0-3 color) (font-color font-color-32)) ) - ) - (+! (-> arg0 origin y) f28-1) - ) - (set! sv-20 (cond - ((-> this yes-no-choice) - (format - (clear *temp-string*) - "~1L~S~44L ~S" - (lookup-text! *common-text* arg2 #f) - (lookup-text! *common-text* arg3 #f) - (the-as none t0-3) + (set! (-> arg0 origin x) (+ 10.0 (-> sv-24 x))) + (let ((f28-0 (progress-method-45 + this + arg0 + (+ (- -20.0 (-> sv-24 x)) (-> sv-24 z)) + (the-as float 24.5) + (lookup-text! *common-text* arg1 #f) + s1-0 + 0.75 + 35 + ) ) - *temp-string* - ) - (else - (format - (clear *temp-string*) - "~44L~S ~1L~S~1L" - (lookup-text! *common-text* arg2 #f) - (lookup-text! *common-text* arg3 #f) - (the-as none t0-3) - ) - *temp-string* - ) - ) + ) + (set! f30-0 (/ f28-0 2)) + (set-scale! arg0 (/ (-> arg0 scale) 2)) + (draw-highlight-bar this arg0 (the int (+ -1.0 (-> arg0 origin y))) (the int (+ 2.0 f28-0)) sv-16) + (+! (-> arg0 origin y) f28-0) ) + (set! sv-20 (cond + ((-> this yes-no-choice) + (format + (clear *temp-string*) + "~33L~S ~44L~S" + (lookup-text! *common-text* arg2 #f) + (lookup-text! *common-text* arg3 #f) + ) + *temp-string* + ) + (else + (format + (clear *temp-string*) + "~44L~S~33L ~S" + (lookup-text! *common-text* arg2 #f) + (lookup-text! *common-text* arg3 #f) + ) + *temp-string* + ) + ) + ) + sv-20 + ) + (else + (cond + (arg4 + (let ((a0-16 arg0)) + (set! (-> a0-16 color) (font-color font-color-33)) + ) + ) + (else + (let ((a0-17 arg0)) + (set! (-> a0-17 color) (font-color font-color-32)) + ) + ) + ) + (set! (-> arg0 origin x) (+ 10.0 (-> sv-24 x))) + (let* ((sv-128 this) + (sv-112 (method-of-object sv-128 progress-method-45)) + (sv-144 arg0) + (sv-160 (+ (- -20.0 (-> sv-24 x)) (-> sv-24 z))) + (sv-176 (the-as float 24.5)) + (t0-3 (the-as object (lookup-text! *common-text* arg1 #f))) + ) + (let ((f28-1 (sv-112 sv-128 sv-144 sv-160 sv-176 (the-as string t0-3) s1-0 0.75 35))) + (when arg4 + (let* ((a0-20 this) + (t9-14 (method-of-object a0-20 draw-highlight-bar)) + (a1-12 arg0) + (a2-12 (the int (+ -1.0 (-> arg0 origin y)))) + (a3-6 (the int (+ 1.0 f28-1))) + ) + (set! t0-3 sv-16) + (t9-14 a0-20 a1-12 a2-12 a3-6 (the-as float t0-3)) + ) + ) + (+! (-> arg0 origin y) f28-1) + ) + (cond + ((-> this yes-no-choice) + (format + (clear *temp-string*) + "~1L~S~44L ~S" + (lookup-text! *common-text* arg2 #f) + (lookup-text! *common-text* arg3 #f) + (the-as none t0-3) + ) + *temp-string* + ) + (else + (format + (clear *temp-string*) + "~44L~S ~1L~S~1L" + (lookup-text! *common-text* arg2 #f) + (lookup-text! *common-text* arg3 #f) + (the-as none t0-3) + ) + *temp-string* + ) + ) + ) + ) + ) ) - ) - ) (progress-method-44 this arg0 sv-20) (+! (-> arg0 origin y) f30-0) ) @@ -718,24 +691,15 @@ (arg5 float) (arg6 float) ) - (local-vars - (sv-80 float) - (sv-96 float) - (sv-112 vector) - (sv-128 int) - (sv-144 rgba) - (sv-160 dma-buffer) - (sv-176 pointer) - ) - (set! sv-80 arg3) - (let ((s1-0 arg4) + (let ((sv-80 arg3) + (s1-0 arg4) (s5-0 arg5) ) - (set! sv-96 arg6) - (set! sv-112 (get-scissor-stack-top this)) - (let ((s0-0 (new 'stack 'hud-sprite)) - (f30-0 (* (- (-> sv-112 z) (-> sv-112 x)) s1-0)) - ) + (let* ((sv-96 arg6) + (sv-112 (get-scissor-stack-top this)) + (s0-0 (new 'stack 'hud-sprite)) + (f30-0 (* (- (-> sv-112 z) (-> sv-112 x)) s1-0)) + ) (let ((s1-1 (- (- 256 (if sv-96 10 0 @@ -744,79 +708,79 @@ (the int (/ f30-0 2)) ) ) + (sv-128 (the int (+ (-> sv-112 y) (* (- (-> sv-112 w) (-> sv-112 y)) sv-80)))) ) - (set! sv-128 (the int (+ (-> sv-112 y) (* (- (-> sv-112 w) (-> sv-112 y)) sv-80)))) 1.0 - (let ((f28-0 f30-0)) - (let ((f24-0 (-> *video-params* relative-x-scale-reciprical)) - (f26-0 (-> *video-params* relative-x-scale)) - ) - (set! sv-160 (-> *display* frames (-> *display* on-screen) global-buf)) - (set! sv-176 (-> sv-160 base)) - (set! (-> s0-0 tid) (the-as texture-id (get-texture hud-sliderbackground progress-minimap))) + (let* ((f28-0 f30-0) + (f24-0 (-> *video-params* relative-x-scale-reciprical)) + (f26-0 (-> *video-params* relative-x-scale)) + (sv-160 (-> *display* frames (-> *display* on-screen) global-buf)) + (sv-176 (-> sv-160 base)) + ) + (set! (-> s0-0 tid) (the-as texture-id (get-texture hud-sliderbackground progress-minimap))) + (if (-> s0-0 tid) + (set! (-> s0-0 scale-x) (/ (* f30-0 f24-0) (the float (-> (the-as texture (-> s0-0 tid)) w)))) + ) + (set! (-> s0-0 scale-y) 0.7) + (let ((v1-28 (-> s0-0 color-ptr))) + (set! (-> v1-28 0) 128) + (set! (-> v1-28 1) 128) + (set! (-> v1-28 2) 128) + (set! (-> v1-28 3) (the int (* 128.0 arg2))) + ) + (set-vector! (-> s0-0 pos) s1-1 sv-128 #x3fffff 0) + (draw s0-0 sv-160 (-> *level* level-default) #t) + (let ((f24-1 0.2)) + (set! (-> s0-0 tid) (the-as texture-id (get-texture hud-sliderframe progress-minimap))) + (set! (-> s0-0 scale-x) f24-1) + (set! (-> s0-0 scale-y) 1.33) (if (-> s0-0 tid) - (set! (-> s0-0 scale-x) (/ (* f30-0 f24-0) (the float (-> (the-as texture (-> s0-0 tid)) w)))) + (set! f28-0 (- f30-0 (* f24-1 f26-0 (the float (-> (the-as texture (-> s0-0 tid)) w))))) ) - (set! (-> s0-0 scale-y) 0.7) - (let ((v1-28 (-> s0-0 color-ptr))) - (set! (-> v1-28 0) 128) - (set! (-> v1-28 1) 128) - (set! (-> v1-28 2) 128) - (set! (-> v1-28 3) (the int (* 128.0 arg2))) - ) - (set-vector! (-> s0-0 pos) s1-1 sv-128 #x3fffff 0) - (draw s0-0 sv-160 (-> *level* level-default) #t) - (let ((f24-1 0.2)) - (set! (-> s0-0 tid) (the-as texture-id (get-texture hud-sliderframe progress-minimap))) - (set! (-> s0-0 scale-x) f24-1) - (set! (-> s0-0 scale-y) 1.33) - (if (-> s0-0 tid) - (set! f28-0 (- f30-0 (* f24-1 f26-0 (the float (-> (the-as texture (-> s0-0 tid)) w))))) - ) - ) - (let* ((v1-39 (the int (* f28-0 s5-0))) - (a1-3 (+ s1-1 (the int (* 18.0 f26-0)) v1-39)) - (a3-2 (the int (- f28-0 (the float v1-39)))) - (t1-1 (shr (shl (the int (* 128.0 arg2)) 56) 32)) - ) - (draw-sprite2d-xy sv-160 a1-3 (+ sv-128 7) a3-2 9 (the-as rgba t1-1) #x3fffff) - ) + ) + (let* ((v1-39 (the int (* f28-0 s5-0))) + (a1-3 (+ s1-1 (the int (* 18.0 f26-0)) v1-39)) + (a3-2 (the int (- f28-0 (the float v1-39)))) + (t1-1 (shr (shl (the int (* 128.0 arg2)) 56) 32)) + ) + (draw-sprite2d-xy sv-160 a1-3 (+ sv-128 7) a3-2 9 (the-as rgba t1-1) #x3fffff) ) (set-vector! (-> s0-0 pos) (+ s1-1 (the int (* f28-0 s5-0))) (+ sv-128 -4) #x3fffff 0) - ) - (draw s0-0 sv-160 (-> *level* level-default) #t) - (when sv-96 - (set! sv-144 (-> *font-work* color-table 32 color 0)) - (set! (-> s0-0 tid) (the-as texture-id (get-texture hud-speaker-empty progress-minimap))) - (set! (-> s0-0 scale-x) 1.0) - (set! (-> s0-0 scale-y) 1.0) - (let ((v1-55 (-> s0-0 color-ptr))) - (set! (-> v1-55 0) (the-as int (-> sv-144 r))) - (set! (-> v1-55 1) (the-as int (-> sv-144 g))) - (set! (-> v1-55 2) (the-as int (-> sv-144 b))) - (set! (-> v1-55 3) (the int (* 128.0 arg2))) - ) - (set-vector! (-> s0-0 pos) (+ s1-1 -20) (+ sv-128 -5) #x3fffff 0) (draw s0-0 sv-160 (-> *level* level-default) #t) - (set! (-> s0-0 tid) (the-as texture-id (get-texture hud-speaker-full progress-minimap))) - (set! (-> s0-0 scale-x) 1.0) - (set! (-> s0-0 scale-y) 1.0) - (set-vector! (-> s0-0 pos) (+ (the int f30-0) 8 s1-1) (+ sv-128 -5) #x3fffff 0) - (draw s0-0 sv-160 (-> *level* level-default) #t) - ) - (let ((a3-6 (-> sv-160 base))) - (when (!= sv-176 a3-6) - (let ((v1-68 (the-as object (-> sv-160 base)))) - (set! (-> (the-as dma-packet v1-68) dma) (new 'static 'dma-tag :id (dma-tag-id next))) - (set! (-> (the-as dma-packet v1-68) vif0) (new 'static 'vif-tag)) - (set! (-> (the-as dma-packet v1-68) vif1) (new 'static 'vif-tag)) - (set! (-> sv-160 base) (&+ (the-as pointer v1-68) 16)) + (when sv-96 + (let ((sv-144 (-> *font-work* color-table 32 color 0))) + (set! (-> s0-0 tid) (the-as texture-id (get-texture hud-speaker-empty progress-minimap))) + (set! (-> s0-0 scale-x) 1.0) + (set! (-> s0-0 scale-y) 1.0) + (let ((v1-55 (-> s0-0 color-ptr))) + (set! (-> v1-55 0) (the-as int (-> sv-144 r))) + (set! (-> v1-55 1) (the-as int (-> sv-144 g))) + (set! (-> v1-55 2) (the-as int (-> sv-144 b))) + (set! (-> v1-55 3) (the int (* 128.0 arg2))) + ) ) - (dma-bucket-insert-tag - (-> *display* frames (-> *display* on-screen) bucket-group) - (bucket-id hud-draw-hud-alpha) - sv-176 - (the-as (pointer dma-tag) a3-6) + (set-vector! (-> s0-0 pos) (+ s1-1 -20) (+ sv-128 -5) #x3fffff 0) + (draw s0-0 sv-160 (-> *level* level-default) #t) + (set! (-> s0-0 tid) (the-as texture-id (get-texture hud-speaker-full progress-minimap))) + (set! (-> s0-0 scale-x) 1.0) + (set! (-> s0-0 scale-y) 1.0) + (set-vector! (-> s0-0 pos) (+ (the int f30-0) 8 s1-1) (+ sv-128 -5) #x3fffff 0) + (draw s0-0 sv-160 (-> *level* level-default) #t) + ) + (let ((a3-6 (-> sv-160 base))) + (when (!= sv-176 a3-6) + (let ((v1-68 (the-as object (-> sv-160 base)))) + (set! (-> (the-as dma-packet v1-68) dma) (new 'static 'dma-tag :id (dma-tag-id next))) + (set! (-> (the-as dma-packet v1-68) vif0) (new 'static 'vif-tag)) + (set! (-> (the-as dma-packet v1-68) vif1) (new 'static 'vif-tag)) + (set! (-> sv-160 base) (&+ (the-as pointer v1-68) 16)) + ) + (dma-bucket-insert-tag + (-> *display* frames (-> *display* on-screen) bucket-group) + (bucket-id hud-draw-hud-alpha) + sv-176 + (the-as (pointer dma-tag) a3-6) + ) ) ) ) @@ -857,10 +821,9 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defmethod draw-icon-array! ((this progress-icon-array) (arg0 int) (arg1 int) (arg2 float) (arg3 float) (arg4 rgba) (arg5 float)) - (local-vars (sv-96 int) (sv-112 int) (sv-128 dma-buffer) (sv-144 pointer)) - (set! sv-96 arg0) - (set! sv-112 arg1) - (let ((s5-0 arg2) + (let ((sv-96 arg0) + (sv-112 arg1) + (s5-0 arg2) (s4-0 arg3) (s1-0 arg4) (s0-0 arg5) @@ -888,22 +851,24 @@ (the int (* (the float (-> s0-1 offset x)) s5-0)) (the int (* (the float (-> s0-1 offset y)) s4-0)) ) - (set! sv-128 (-> *display* frames (-> *display* on-screen) global-buf)) - (set! sv-144 (-> sv-128 base)) - (draw s3-0 sv-128 (-> *level* level-default) #t) - (let ((a3-3 (-> sv-128 base))) - (when (!= sv-144 a3-3) - (let ((v1-24 (the-as object (-> sv-128 base)))) - (set! (-> (the-as dma-packet v1-24) dma) (new 'static 'dma-tag :id (dma-tag-id next))) - (set! (-> (the-as dma-packet v1-24) vif0) (new 'static 'vif-tag)) - (set! (-> (the-as dma-packet v1-24) vif1) (new 'static 'vif-tag)) - (set! (-> sv-128 base) (&+ (the-as pointer v1-24) 16)) - ) - (dma-bucket-insert-tag - (-> *display* frames (-> *display* on-screen) bucket-group) - (-> s0-1 bucket) - sv-144 - (the-as (pointer dma-tag) a3-3) + (let* ((sv-128 (-> *display* frames (-> *display* on-screen) global-buf)) + (sv-144 (-> sv-128 base)) + ) + (draw s3-0 sv-128 (-> *level* level-default) #t) + (let ((a3-3 (-> sv-128 base))) + (when (!= sv-144 a3-3) + (let ((v1-24 (the-as object (-> sv-128 base)))) + (set! (-> (the-as dma-packet v1-24) dma) (new 'static 'dma-tag :id (dma-tag-id next))) + (set! (-> (the-as dma-packet v1-24) vif0) (new 'static 'vif-tag)) + (set! (-> (the-as dma-packet v1-24) vif1) (new 'static 'vif-tag)) + (set! (-> sv-128 base) (&+ (the-as pointer v1-24) 16)) + ) + (dma-bucket-insert-tag + (-> *display* frames (-> *display* on-screen) bucket-group) + (-> s0-1 bucket) + sv-144 + (the-as (pointer dma-tag) a3-3) + ) ) ) ) @@ -1067,197 +1032,157 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defmethod draw-option ((this menu-missions-option) (arg0 progress) (arg1 font-context) (arg2 int) (arg3 symbol)) - (local-vars - (sv-176 float) - (sv-180 game-task-node-info) - (sv-184 game-task-node-info) - (sv-188 float) - (sv-192 int) - (sv-200 symbol) - (sv-208 int) - (sv-216 (array game-task-node-info)) - (sv-224 string) - (sv-240 (function _varargs_ object)) - (sv-256 string) - (sv-272 game-task-node-info) - (sv-288 text-id) - (sv-304 (function string font-context symbol int bucket-id float)) - (sv-320 (function _varargs_ object)) - (sv-336 string) - (sv-352 string) - (sv-368 (function string font-context symbol int bucket-id float)) - (sv-384 (function _varargs_ object)) - ) - (set! sv-176 (fmax 0.0 (* 2.0 (- 0.5 (-> arg0 menu-transition))))) - (set! sv-180 (new 'stack 'game-task-node-info)) - (set! sv-184 (new 'stack 'game-task-node-info)) - (set! (-> arg0 current-task-index) (length (-> *game-info* sub-task-list))) - (set! (-> arg0 current-line-index) -1) - (set! (-> arg0 current-task) (game-task unknown)) - (set! (-> arg0 first-closed-line-index) -1) - (set! (-> arg0 extra-text-state) -1) - (set! (-> arg0 num-open-tasks-found) 0) - (set! (-> arg0 num-closed-tasks-found) 0) - (set! (-> arg1 alpha) sv-176) - (set! (-> *game-info* mission-list 0) sv-180) - (set! (-> sv-180 description) (text-id progress-missions-todo)) - (set! (-> sv-184 description) (text-id progress-missions-completed)) - (progress-method-33 arg0 (-> *progress-work* body-footer)) - (let ((s3-0 (get-scissor-stack-top arg0))) - (set! sv-188 (- (-> s3-0 w) (-> s3-0 y))) - (set! sv-192 1) - (set! sv-200 #t) - (set! sv-208 (length (-> *game-info* sub-task-list))) - (set! sv-216 (-> *game-info* mission-list)) - (dotimes (s2-0 sv-208) - (let ((v0-6 (find-mission-text-at-index arg0 s2-0))) - (when v0-6 - (when (and (logtest? (-> v0-6 flags) (game-task-node-flag closed)) sv-200) - (set! sv-200 (the-as symbol #f)) - (set! (-> sv-216 sv-192) sv-184) - (set! sv-192 (+ sv-192 1)) - ) - (set! (-> sv-216 sv-192) v0-6) - (set! sv-192 (+ sv-192 1)) + (local-vars (sv-288 text-id)) + (let ((sv-176 (fmax 0.0 (* 2.0 (- 0.5 (-> arg0 menu-transition)))))) + (let ((sv-180 (new 'stack 'game-task-node-info)) + (sv-184 (new 'stack 'game-task-node-info)) ) - ) - ) - (set! (-> arg0 total-num-tasks) sv-192) - (sort-task-node-result (-> arg0 total-num-tasks)) - (let ((a0-17 arg1)) - (set! (-> a0-17 flags) (font-flags kerning large)) - ) - (set-scale! arg1 0.5) - (let ((f30-0 14.0) - (s2-1 get-string-length) - ) - (let ((s1-0 format) - (s0-0 (clear *temp-string*)) - ) - (set! sv-224 "~S") - (let ((a2-2 (lookup-text! *common-text* (text-id progress-missions-complete-icon) #f))) - (s1-0 s0-0 sv-224 a2-2) - ) - ) - (let ((f30-1 (+ f30-0 (-> (s2-1 *temp-string* arg1) length)))) - (let ((v1-45 arg1)) - (set! (-> v1-45 width) (+ (- (- -10.0 f30-1) (-> s3-0 x)) (-> s3-0 z))) - ) - (let ((s2-2 (-> *game-info* mission-list)) - (s1-2 (max 0 (the int (-> this current-index)))) + (set! (-> arg0 current-task-index) (length (-> *game-info* sub-task-list))) + (set! (-> arg0 current-line-index) -1) + (set! (-> arg0 current-task) (game-task unknown)) + (set! (-> arg0 first-closed-line-index) -1) + (set! (-> arg0 extra-text-state) -1) + (set! (-> arg0 num-open-tasks-found) 0) + (set! (-> arg0 num-closed-tasks-found) 0) + (set! (-> arg1 alpha) sv-176) + (set! (-> *game-info* mission-list 0) sv-180) + (set! (-> sv-180 description) (text-id progress-missions-todo)) + (set! (-> sv-184 description) (text-id progress-missions-completed)) + (progress-method-33 arg0 (-> *progress-work* body-footer)) + (let* ((s3-0 (get-scissor-stack-top arg0)) + (sv-188 (- (-> s3-0 w) (-> s3-0 y))) + ) + (let ((sv-192 1)) + (let ((sv-200 #t) + (sv-208 (length (-> *game-info* sub-task-list))) + (sv-216 (-> *game-info* mission-list)) + ) + (dotimes (s2-0 sv-208) + (let ((v0-6 (find-mission-text-at-index arg0 s2-0))) + (when v0-6 + (when (and (logtest? (-> v0-6 flags) (game-task-node-flag closed)) sv-200) + (set! sv-200 (the-as symbol #f)) + (set! (-> sv-216 sv-192) sv-184) + (+! sv-192 1) + ) + (set! (-> sv-216 sv-192) v0-6) + (+! sv-192 1) + ) + ) ) - (let* ((s0-1 (-> s2-2 s1-2)) - (a1-10 - (if (and (logtest? (-> s0-1 flags) (game-task-node-flag closed)) (task-complete? *game-info* (-> s0-1 task))) - (-> *game-info* play-list (-> s0-1 task) text-name) - (-> s0-1 description) - ) + ) + (set! (-> arg0 total-num-tasks) sv-192) + ) + (sort-task-node-result (-> arg0 total-num-tasks)) + (let ((a0-17 arg1)) + (set! (-> a0-17 flags) (font-flags kerning large)) + ) + (set-scale! arg1 0.5) + (let ((f30-0 14.0) + (s2-1 get-string-length) + ) + (format (clear *temp-string*) "~S" (lookup-text! *common-text* (text-id progress-missions-complete-icon) #f)) + (let ((f30-1 (+ f30-0 (-> (s2-1 *temp-string* arg1) length)))) + (let ((v1-45 arg1)) + (set! (-> v1-45 width) (+ (- (- -10.0 f30-1) (-> s3-0 x)) (-> s3-0 z))) + ) + (let* ((s2-2 (-> *game-info* mission-list)) + (s1-2 (max 0 (the int (-> this current-index)))) + (s0-1 (-> s2-2 s1-2)) + (a1-10 + (if (and (logtest? (-> s0-1 flags) (game-task-node-flag closed)) (task-complete? *game-info* (-> s0-1 task))) + (-> *game-info* play-list (-> s0-1 task) text-name) + (-> s0-1 description) + ) + ) + (sv-256 (lookup-text! *common-text* a1-10 #f)) + (s0-2 print-game-text) ) - ) - (set! sv-256 (lookup-text! *common-text* a1-10 #f)) - ) - (let ((s0-2 print-game-text)) - (set! sv-240 format) - (let ((a0-29 (clear *temp-string*)) - (a1-11 "~S") - ) - (sv-240 a0-29 a1-11 sv-256) - ) - (let ((f28-0 (s0-2 *temp-string* arg1 #t 44 (bucket-id hud-draw-hud-alpha)))) - (let* ((v1-60 arg1) - (f0-14 (+ 10.0 (-> s3-0 x))) - (f1-6 4.0) - (f2-2 (-> this current-index)) - (f1-8 (+ (- f1-6 (* f28-0 (- f2-2 (* (the float (the int (/ f2-2 1.0))) 1.0)))) (-> s3-0 y))) - ) - (set! (-> v1-60 origin x) f0-14) - (set! (-> v1-60 origin y) f1-8) - ) - (let ((v1-61 arg1)) - (set! (-> v1-61 height) sv-188) - ) - (while (and (< (-> arg1 origin y) (-> s3-0 w)) (< s1-2 (-> arg0 total-num-tasks))) - (set! sv-272 (-> s2-2 s1-2)) - (if (and (logtest? (-> sv-272 flags) (game-task-node-flag closed)) (task-complete? *game-info* (-> sv-272 task))) - (set! sv-288 (-> *game-info* play-list (-> sv-272 task) text-name)) - (set! sv-288 (-> sv-272 description)) - ) - (let ((s0-3 (lookup-text! *common-text* sv-288 #f))) - (set! (-> arg1 origin x) (+ 10.0 (-> s3-0 x))) - (cond - ((or (= sv-288 (text-id progress-missions-todo)) (= sv-288 (text-id progress-missions-completed))) - (let ((a0-41 arg1)) - (set! (-> a0-41 color) (font-color font-color-34)) + (format (clear *temp-string*) "~S" sv-256) + (let ((f28-0 (s0-2 *temp-string* arg1 #t 44 (bucket-id hud-draw-hud-alpha)))) + (let* ((v1-60 arg1) + (f0-14 (+ 10.0 (-> s3-0 x))) + (f1-6 4.0) + (f2-2 (-> this current-index)) + (f1-8 (+ (- f1-6 (* f28-0 (- f2-2 (* (the float (the int (/ f2-2 1.0))) 1.0)))) (-> s3-0 y))) ) - ) - (else - (set! sv-304 print-game-text) - (set! sv-320 format) - (set! sv-336 (clear *temp-string*)) - (set! sv-352 "~S") - (let ((a2-8 (lookup-text! - *common-text* - (if (logtest? (-> sv-272 flags) (game-task-node-flag closed)) - (text-id progress-missions-complete-icon) - (text-id progress-missions-todo-icon) - ) - #f - ) - ) - ) - (sv-320 sv-336 sv-352 a2-8) - ) - (let ((a0-45 *temp-string*) - (a1-17 arg1) - (a2-9 #f) - (a3-2 44) - (t0-2 579) - ) - (sv-304 a0-45 a1-17 a2-9 a3-2 (the-as bucket-id t0-2)) - ) - (let ((a0-46 arg1)) - (set! (-> a0-46 color) (font-color font-color-32)) - ) - (set! (-> arg1 origin x) (+ (-> s3-0 x) f30-1)) - ) - ) - (let ((f26-0 (-> arg1 origin y))) - (set! sv-368 print-game-text) - (set! sv-384 format) - (let ((a0-48 (clear *temp-string*)) - (a1-18 "~S") - ) - (sv-384 a0-48 a1-18 s0-3) - ) - (let ((a0-49 *temp-string*) - (a1-19 arg1) - (a2-11 #f) - (a3-3 44) - (t0-3 579) - ) - (set! (-> arg1 origin y) (+ f26-0 (sv-368 a0-49 a1-19 a2-11 a3-3 (the-as bucket-id t0-3)))) - ) - ) + (set! (-> v1-60 origin x) f0-14) + (set! (-> v1-60 origin y) f1-8) + ) + (set! (-> arg1 height) sv-188) + (while (and (< (-> arg1 origin y) (-> s3-0 w)) (< s1-2 (-> arg0 total-num-tasks))) + (let ((sv-272 (-> s2-2 s1-2))) + (set! sv-288 + (cond + ((and (logtest? (-> sv-272 flags) (game-task-node-flag closed)) (task-complete? *game-info* (-> sv-272 task))) + (set! sv-288 (-> *game-info* play-list (-> sv-272 task) text-name)) + sv-288 + ) + (else + (-> sv-272 description) + ) + ) + ) + (let ((s0-3 (lookup-text! *common-text* sv-288 #f))) + (set! (-> arg1 origin x) (+ 10.0 (-> s3-0 x))) + (cond + ((or (= sv-288 (text-id progress-missions-todo)) (= sv-288 (text-id progress-missions-completed))) + (let ((a0-41 arg1)) + (set! (-> a0-41 color) (font-color font-color-34)) + ) + ) + (else + (let ((sv-304 print-game-text)) + (let ((sv-320 format) + (sv-336 (clear *temp-string*)) + (sv-352 "~S") + ) + (sv-320 sv-336 sv-352 (lookup-text! + *common-text* + (if (logtest? (-> sv-272 flags) (game-task-node-flag closed)) + (text-id progress-missions-complete-icon) + (text-id progress-missions-todo-icon) + ) + #f + ) + ) + ) + (sv-304 *temp-string* arg1 #f 44 (bucket-id hud-draw-hud-alpha)) + ) + (let ((a0-46 arg1)) + (set! (-> a0-46 color) (font-color font-color-32)) + ) + (set! (-> arg1 origin x) (+ (-> s3-0 x) f30-1)) + ) + ) + (let ((f26-0 (-> arg1 origin y)) + (sv-368 print-game-text) + ) + (format (clear *temp-string*) "~S" s0-3) + (set! (-> arg1 origin y) (+ f26-0 (sv-368 *temp-string* arg1 #f 44 (bucket-id hud-draw-hud-alpha)))) + ) + ) + ) + (+! s1-2 1) + ) + (set! (-> this on-screen) (< (-> arg1 origin y) (-> s3-0 w))) + (seek! + (-> this current-index) + (-> this target-index) + (* (/ (-> this scroll-speed) f28-0) (seconds-per-frame)) ) - (+! s1-2 1) - ) - (set! (-> this on-screen) (< (-> arg1 origin y) (-> s3-0 w))) - (seek! - (-> this current-index) - (-> this target-index) - (* (/ (-> this scroll-speed) f28-0) (seconds-per-frame)) ) ) ) ) ) ) - ) - (progress-method-34 arg0) - (let ((s3-1 *progress-work*)) - (draw-header arg0 arg1 sv-176 (text-id progress-missions)) - (draw-bg-box-alpha-2 arg0 (-> s3-1 footer) (* 64.0 sv-176)) - (draw-bg-box-outline arg0 (-> s3-1 footer) (* 128.0 sv-176)) + (progress-method-34 arg0) + (let ((s3-1 *progress-work*)) + (draw-header arg0 arg1 sv-176 (text-id progress-missions)) + (draw-bg-box-alpha-2 arg0 (-> s3-1 footer) (* 64.0 sv-176)) + (draw-bg-box-outline arg0 (-> s3-1 footer) (* 128.0 sv-176)) + ) ) (progress-method-47 arg0 @@ -1322,19 +1247,12 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defmethod highscore-page-info-method-11 ((this highscore-page-info) (arg0 font-context) (arg1 int) (arg2 float) (arg3 float) (arg4 float)) - (local-vars (sv-16 string) (sv-32 string)) (set! (-> arg0 origin x) arg3) (let ((a0-1 arg0)) (set! (-> a0-1 flags) (font-flags kerning large)) ) (let ((s1-0 print-game-text)) - (let ((s0-0 format)) - (set! sv-16 (clear *temp-string*)) - (set! sv-32 "~S") - (let ((a2-2 (lookup-text! *common-text* (the-as text-id arg1) #f))) - (s0-0 sv-16 sv-32 a2-2) - ) - ) + (format (clear *temp-string*) "~S" (lookup-text! *common-text* (the-as text-id arg1) #f)) (s1-0 *temp-string* arg0 #f 44 (bucket-id hud-draw-hud-alpha)) ) (let ((a0-6 arg0)) @@ -1349,95 +1267,64 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defmethod highscore-page-info-method-9 ((this highscore-page-info) (arg0 progress) (arg1 font-context) (arg2 float) (arg3 float)) - (local-vars - (sv-16 highscore-info) - (sv-32 (function string font-context symbol int bucket-id float)) - (sv-48 (function _varargs_ object)) - (sv-64 string) - (sv-80 string) - (sv-96 int) - (sv-112 int) - ) (let ((s3-0 (get-scissor-stack-top arg0))) - (let ((f28-0 (-> *video-params* relative-x-scale))) - (set! sv-16 (-> *highscore-info-array* (-> this game-score))) - (let ((f30-0 (- (-> s3-0 z) (-> s3-0 x))) - (s0-0 *progress-work*) - ) - (let ((a0-3 arg1)) - (set! (-> a0-3 flags) (font-flags kerning large)) + (let ((f28-0 (-> *video-params* relative-x-scale)) + (sv-16 (-> *highscore-info-array* (-> this game-score))) + (f30-0 (- (-> s3-0 z) (-> s3-0 x))) + (s0-0 *progress-work*) ) - (set-scale! arg1 0.675) - (let ((a0-5 arg1)) - (set! (-> a0-5 color) (font-color font-color-32)) - ) - (set! (-> arg1 origin x) (+ 10.0 arg2 (-> s3-0 x))) - (adjust-font-origin-y arg0 arg1 0.01) - (let ((v1-11 arg1)) - (set! (-> v1-11 width) (* 0.75 f30-0)) - ) - (set! sv-32 print-game-text) - (set! sv-48 format) - (set! sv-64 (clear *temp-string*)) - (set! sv-80 "~S") - (let ((a2-3 (lookup-text! *common-text* (-> this text) #f))) - (sv-48 sv-64 sv-80 a2-3) - ) - (let ((a0-11 *temp-string*) - (a1-4 arg1) - (a2-4 #f) - (a3-1 32) - (t0-1 579) - ) - (sv-32 a0-11 a1-4 a2-4 a3-1 (the-as bucket-id t0-1)) - ) - (draw-icon-array! - (-> *progress-icon-arrays* (-> this icon)) - (the int (+ (- (-> s3-0 z) (* (-> this icon-offsetx) f28-0)) arg2)) - (the int (+ (-> s3-0 y) (-> this icon-offsety))) - (-> this icon-scalex) - (-> this icon-scaley) - (new 'static 'rgba :r #x80 :g #x80 :b #x80 :a (the int (* 128.0 arg3))) - arg3 - ) - (when (not (logtest? (-> sv-16 flags) (highscore-flags hf1))) - (let ((f28-1 (* 20.0 f28-0)) - (f26-0 (+ 50.0 (-> s3-0 y))) - ) - (set! sv-96 (the int (+ 48.0 (-> s3-0 y)))) - (set! sv-112 (logior #x808080 (shr (shl (the int (* 128.0 arg3)) 56) 32))) - (let ((f24-0 0.25) - (f22-0 (+ 10.0 arg2 (-> s3-0 x))) - ) - (set-scale! arg1 0.45) - (let ((f20-0 f22-0)) - (draw-icon-array! (-> *progress-icon-arrays* 63) (the int f20-0) sv-96 f24-0 f24-0 (the-as rgba sv-112) arg3) - (highscore-page-info-method-10 this arg1 (-> sv-16 gold-score) (+ f20-0 f28-1) f26-0) - ) - (let ((f20-1 (+ f22-0 (* 0.333 f30-0)))) - (draw-icon-array! (-> *progress-icon-arrays* 64) (the int f20-1) sv-96 f24-0 f24-0 (the-as rgba sv-112) arg3) - (highscore-page-info-method-10 this arg1 (-> sv-16 silver-score) (+ f20-1 f28-1) f26-0) - ) - (let ((f30-1 (+ f22-0 (* 0.667 f30-0)))) - (let* ((a0-23 (-> *progress-icon-arrays* 65)) - (t9-11 (method-of-object a0-23 draw-icon-array!)) - (a1-10 (the int f30-1)) - (a3-7 f24-0) - (t0-7 f24-0) - (t2-3 arg3) - ) - (t9-11 a0-23 a1-10 sv-96 a3-7 t0-7 (the-as rgba sv-112) t2-3) - ) - (highscore-page-info-method-10 this arg1 (-> sv-16 bronze-score) (+ f30-1 f28-1) f26-0) - ) - ) - ) - ) - (draw-bg-box-alpha-2 arg0 (-> s0-0 highscore-1) (* 16.0 arg3)) - (draw-bg-box-outline arg0 (-> s0-0 highscore-1) (* 128.0 arg3)) - (draw-bg-box-outline arg0 (-> s0-0 highscore-0) (* 128.0 arg3)) - (progress-method-33 arg0 (-> s0-0 highscore-body)) + (let ((a0-3 arg1)) + (set! (-> a0-3 flags) (font-flags kerning large)) ) + (set-scale! arg1 0.675) + (let ((a0-5 arg1)) + (set! (-> a0-5 color) (font-color font-color-32)) + ) + (set! (-> arg1 origin x) (+ 10.0 arg2 (-> s3-0 x))) + (adjust-font-origin-y arg0 arg1 0.01) + (let ((v1-11 arg1)) + (set! (-> v1-11 width) (* 0.75 f30-0)) + ) + (let ((sv-32 print-game-text)) + (format (clear *temp-string*) "~S" (lookup-text! *common-text* (-> this text) #f)) + (sv-32 *temp-string* arg1 #f 32 (bucket-id hud-draw-hud-alpha)) + ) + (draw-icon-array! + (-> *progress-icon-arrays* (-> this icon)) + (the int (+ (- (-> s3-0 z) (* (-> this icon-offsetx) f28-0)) arg2)) + (the int (+ (-> s3-0 y) (-> this icon-offsety))) + (-> this icon-scalex) + (-> this icon-scaley) + (new 'static 'rgba :r #x80 :g #x80 :b #x80 :a (the int (* 128.0 arg3))) + arg3 + ) + (when (not (logtest? (-> sv-16 flags) (highscore-flags hf1))) + (let ((f28-1 (* 20.0 f28-0)) + (f26-0 (+ 50.0 (-> s3-0 y))) + (sv-96 (the int (+ 48.0 (-> s3-0 y)))) + (sv-112 (logior #x808080 (shr (shl (the int (* 128.0 arg3)) 56) 32))) + (f24-0 0.25) + (f22-0 (+ 10.0 arg2 (-> s3-0 x))) + ) + (set-scale! arg1 0.45) + (let ((f20-0 f22-0)) + (draw-icon-array! (-> *progress-icon-arrays* 63) (the int f20-0) sv-96 f24-0 f24-0 (the-as rgba sv-112) arg3) + (highscore-page-info-method-10 this arg1 (-> sv-16 gold-score) (+ f20-0 f28-1) f26-0) + ) + (let ((f20-1 (+ f22-0 (* 0.333 f30-0)))) + (draw-icon-array! (-> *progress-icon-arrays* 64) (the int f20-1) sv-96 f24-0 f24-0 (the-as rgba sv-112) arg3) + (highscore-page-info-method-10 this arg1 (-> sv-16 silver-score) (+ f20-1 f28-1) f26-0) + ) + (let ((f30-1 (+ f22-0 (* 0.667 f30-0)))) + (draw-icon-array! (-> *progress-icon-arrays* 65) (the int f30-1) sv-96 f24-0 f24-0 (the-as rgba sv-112) arg3) + (highscore-page-info-method-10 this arg1 (-> sv-16 bronze-score) (+ f30-1 f28-1) f26-0) + ) + ) + ) + (draw-bg-box-alpha-2 arg0 (-> s0-0 highscore-1) (* 16.0 arg3)) + (draw-bg-box-outline arg0 (-> s0-0 highscore-1) (* 128.0 arg3)) + (draw-bg-box-outline arg0 (-> s0-0 highscore-0) (* 128.0 arg3)) + (progress-method-33 arg0 (-> s0-0 highscore-body)) ) (let ((f30-2 (+ 10.0 arg2 (-> s3-0 x))) (f28-2 (+ -10.0 arg2 (-> s3-0 z))) @@ -1567,30 +1454,13 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defmethod inventory-item-group-method-10 ((this inventory-item-group) (arg0 progress) (arg1 font-context) (arg2 float) (arg3 float) (arg4 int)) - (local-vars - (sv-16 (function string font-context symbol int bucket-id float)) - (sv-32 (function _varargs_ object)) - (sv-48 string) - (sv-64 string) - ) (dotimes (s0-0 (-> this items length)) (when (and arg4 (have-items? this)) (set-scale! arg1 0.45) (adjust-font-origin-y arg0 arg1 0.9) - (set! sv-16 print-game-text) - (set! sv-32 format) - (set! sv-48 (clear *temp-string*)) - (set! sv-64 "~S") - (let ((a2-3 (lookup-text! *common-text* (-> this name) #f))) - (sv-32 sv-48 sv-64 a2-3) - ) - (let ((a0-7 *temp-string*) - (a1-4 arg1) - (a2-4 #f) - (a3-1 44) - (t0-1 579) - ) - (sv-16 a0-7 a1-4 a2-4 a3-1 (the-as bucket-id t0-1)) + (let ((sv-16 print-game-text)) + (format (clear *temp-string*) "~S" (lookup-text! *common-text* (-> this name) #f)) + (sv-16 *temp-string* arg1 #f 44 (bucket-id hud-draw-hud-alpha)) ) ) (inventory-item-method-10 (-> this items s0-0) arg0 arg1 arg2 arg3 (the-as symbol arg4)) @@ -1603,20 +1473,13 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defmethod inventory-screen-method-9 ((this inventory-screen) (arg0 progress) (arg1 font-context) (arg2 float) (arg3 float)) - (local-vars (sv-16 string) (sv-32 string)) (set-scale! arg1 0.45) (let ((a0-2 arg1)) (set! (-> a0-2 color) (font-color font-color-32)) ) (adjust-font-origin-y arg0 arg1 0.01) (let ((s1-0 print-game-text)) - (let ((s0-0 format)) - (set! sv-16 (clear *temp-string*)) - (set! sv-32 "~S") - (let ((a2-3 (lookup-text! *common-text* (-> this name) #f))) - (s0-0 sv-16 sv-32 a2-3) - ) - ) + (format (clear *temp-string*) "~S" (lookup-text! *common-text* (-> this name) #f)) (s1-0 *temp-string* arg1 #f 44 (bucket-id hud-draw-hud-alpha)) ) (dotimes (s1-1 (-> this groups length)) @@ -1681,18 +1544,8 @@ (arg5 float) (arg6 float) ) - (local-vars - (sv-48 float) - (sv-64 (function string font-context symbol int bucket-id float)) - (sv-80 (function _varargs_ object)) - (sv-96 string) - (sv-112 string) - (sv-128 (function _varargs_ object)) - (sv-144 string) - (sv-160 string) - ) - (set! sv-48 arg4) - (let ((s0-0 arg5) + (let ((sv-48 arg4) + (s0-0 arg5) (s3-0 arg6) (s2-0 (get-scissor-stack-top arg0)) ) @@ -1702,52 +1555,37 @@ (let ((v1-2 arg1)) (set! (-> v1-2 width) (+ -20.0 sv-48)) ) - (set! sv-64 print-game-text) - (set! sv-80 format) - (set! sv-96 (clear *temp-string*)) - (set! sv-112 "~S") - (let ((a2-2 (lookup-text! *common-text* (-> this action) #f))) - (sv-80 sv-96 sv-112 a2-2) - ) - (let* ((a0-7 *temp-string*) - (a1-3 arg1) - (a2-3 #f) - (a3-1 40) - (t0-1 579) - (f30-0 (sv-64 a0-7 a1-3 a2-3 a3-1 (the-as bucket-id t0-1))) - ) - (set! (-> arg1 origin x) (+ 10.0 arg3)) - (let ((v1-8 arg1)) - (set! (-> v1-8 width) (+ -20.0 s0-0)) - ) - (let ((s0-1 print-game-text)) - (set! sv-128 format) - (set! sv-144 (clear *temp-string*)) - (set! sv-160 "~S") - (let ((a2-5 (lookup-text! *common-text* (-> this button) #f))) - (sv-128 sv-144 sv-160 a2-5) + (let ((sv-64 print-game-text)) + (format (clear *temp-string*) "~S" (lookup-text! *common-text* (-> this action) #f)) + (let ((f30-0 (sv-64 *temp-string* arg1 #f 40 (bucket-id hud-draw-hud-alpha)))) + (set! (-> arg1 origin x) (+ 10.0 arg3)) + (let ((v1-8 arg1)) + (set! (-> v1-8 width) (+ -20.0 s0-0)) ) - (let* ((f0-11 (s0-1 *temp-string* arg1 #f 40 (bucket-id hud-draw-hud-alpha))) - (f30-1 (+ 8.0 (fmax f30-0 f0-11))) - ) - (let ((s1-1 (new 'stack 'hud-box)) - (f28-0 (+ arg3 (* 0.5 (- (-> s2-0 z) (-> s2-0 x))))) + (let ((s0-1 print-game-text)) + (format (clear *temp-string*) "~S" (lookup-text! *common-text* (-> this button) #f)) + (let* ((f0-11 (s0-1 *temp-string* arg1 #f 40 (bucket-id hud-draw-hud-alpha))) + (f30-1 (+ 8.0 (fmax f30-0 f0-11))) + ) + (let ((s1-1 (new 'stack 'hud-box)) + (f28-0 (+ arg3 (* 0.5 (- (-> s2-0 z) (-> s2-0 x))))) + ) + (set! (-> s1-1 box min y) (+ -6.0 (-> arg1 origin y))) + (set! (-> s1-1 box max y) (+ (-> s1-1 box min y) f30-1)) + (set-vector! (-> s1-1 color) 192 192 96 (the int (* 128.0 s3-0))) + (with-dma-buffer-add-bucket ((s2-1 (-> *display* frames (-> *display* on-screen) global-buf)) + (bucket-id particles) + ) + (set! (-> s1-1 box min x) arg2) + (set! (-> s1-1 box max x) arg3) + (draw-box-prim-only s1-1 s2-1) + (set! (-> s1-1 box min x) arg3) + (set! (-> s1-1 box max x) f28-0) + (draw-box-prim-only s1-1 s2-1) ) - (set! (-> s1-1 box min y) (+ -6.0 (-> arg1 origin y))) - (set! (-> s1-1 box max y) (+ (-> s1-1 box min y) f30-1)) - (set-vector! (-> s1-1 color) 192 192 96 (the int (* 128.0 s3-0))) - (with-dma-buffer-add-bucket ((s2-1 (-> *display* frames (-> *display* on-screen) global-buf)) - (bucket-id particles) - ) - (set! (-> s1-1 box min x) arg2) - (set! (-> s1-1 box max x) arg3) - (draw-box-prim-only s1-1 s2-1) - (set! (-> s1-1 box min x) arg3) - (set! (-> s1-1 box max x) f28-0) - (draw-box-prim-only s1-1 s2-1) ) + (+! (-> arg1 origin y) f30-1) ) - (+! (-> arg1 origin y) f30-1) ) ) ) @@ -1772,25 +1610,9 @@ ;; WARN: Stack slot offset 16 signed mismatch ;; WARN: Return type mismatch int vs none. (defmethod controls-page-info-method-11 ((this controls-page-info) (arg0 progress) (arg1 font-context) (arg2 float) (arg3 float)) - (local-vars - (v1-28 int) - (v1-29 int) - (sv-16 float) - (sv-32 (function progress font-context float float string float float int float)) - (sv-48 font-context) - (sv-64 float) - (sv-80 int) - (sv-96 (function string font-context symbol int bucket-id float)) - (sv-112 (function _varargs_ object)) - (sv-128 string) - (sv-144 string) - (sv-160 (function string font-context symbol int bucket-id float)) - (sv-176 (function _varargs_ object)) - (sv-192 string) - (sv-208 string) - ) - (set! sv-16 arg2) - (let ((s2-0 arg3) + (local-vars (v1-28 int) (v1-29 int)) + (let ((sv-16 arg2) + (s2-0 arg3) (s3-0 *progress-work*) ) (let ((s1-0 (get-scissor-stack-top arg0))) @@ -1810,19 +1632,15 @@ (let ((a0-7 arg1)) (set! (-> a0-7 color) (font-color font-color-34)) ) - (let ((s0-0 arg0)) - (set! sv-32 (method-of-object s0-0 progress-method-45)) - (set! sv-48 arg1) - (let ((s1-1 (+ (- -20.0 (-> s1-0 x)) (-> s1-0 z)))) - (set! sv-64 (the-as float 28.0)) - (let ((t0-1 (lookup-text! *common-text* (-> this title) #f)) - (t1-0 0.7) - (t2-0 0.5) - (t3-0 32) - ) - (sv-32 s0-0 sv-48 s1-1 sv-64 t0-1 t1-0 t2-0 t3-0) - ) - ) + (progress-method-45 + arg0 + arg1 + (+ (- -20.0 (-> s1-0 x)) (-> s1-0 z)) + (the-as float 28.0) + (lookup-text! *common-text* (-> this title) #f) + 0.7 + 0.5 + 32 ) ) (progress-method-34 arg0) @@ -1847,72 +1665,54 @@ (let ((v1-25 arg1)) (set! (-> v1-25 width) (+ -20.0 f30-0)) ) - (set! sv-80 0) - (let ((v1-27 sv-80) - (a0-20 (min (the int (-> this current-index)) s1-2)) - ) - (set-on-less-than v1-28 v1-27 a0-20) - (move-if-not-zero v1-29 a0-20 v1-28 v1-28) - ) - (set! sv-80 v1-29) - (set! sv-96 print-game-text) - (set! sv-112 format) - (set! sv-128 (clear *temp-string*)) - (set! sv-144 "~S") - (let ((a2-5 (lookup-text! *common-text* (the-as text-id (-> this text sv-80 text)) #f))) - (sv-112 sv-128 sv-144 a2-5) - ) - (let* ((a0-24 *temp-string*) - (a1-10 arg1) - (a2-6 #t) - (a3-2 40) - (t0-2 579) - (f22-0 (sv-96 a0-24 a1-10 a2-6 a3-2 (the-as bucket-id t0-2))) - ) - (set! sv-160 print-game-text) - (set! sv-176 format) - (set! sv-192 (clear *temp-string*)) - (set! sv-208 "~S") - (let ((a2-8 (lookup-text! *common-text* (-> this text sv-80 id) #f))) - (sv-176 sv-192 sv-208 a2-8) - ) - (let* ((a0-28 *temp-string*) - (a1-13 arg1) - (a2-9 #t) - (a3-3 40) - (t0-3 579) - (f0-23 (sv-160 a0-28 a1-13 a2-9 a3-3 (the-as bucket-id t0-3))) - (f22-1 (+ 8.0 (fmax f22-0 f0-23))) - ) - (let* ((v1-47 arg1) - (f0-26 (+ 10.0 (-> s0-1 x))) - (f1-12 4.0) - (f2-0 (-> this current-index)) - (f1-14 (+ (- f1-12 (* f22-1 (- f2-0 (* (the float (the int (/ f2-0 1.0))) 1.0)))) (-> s0-1 y))) - ) - (set! (-> v1-47 origin x) f0-26) - (set! (-> v1-47 origin y) f1-14) - ) - (while (and (< (-> arg1 origin y) (-> s0-1 w)) (< sv-80 s1-2)) - (when (= sv-80 3) - (nop!) - (nop!) - 0 + (let ((sv-80 0)) + (let ((v1-27 sv-80) + (a0-20 (min (the int (-> this current-index)) s1-2)) + ) + (set-on-less-than v1-28 v1-27 a0-20) + (move-if-not-zero v1-29 a0-20 v1-28 v1-28) + ) + (set! sv-80 v1-29) + (let ((sv-96 print-game-text)) + (format (clear *temp-string*) "~S" (lookup-text! *common-text* (the-as text-id (-> this text sv-80 text)) #f)) + (let ((f22-0 (sv-96 *temp-string* arg1 #t 40 (bucket-id hud-draw-hud-alpha))) + (sv-160 print-game-text) + ) + (format (clear *temp-string*) "~S" (lookup-text! *common-text* (-> this text sv-80 id) #f)) + (let* ((f0-23 (sv-160 *temp-string* arg1 #t 40 (bucket-id hud-draw-hud-alpha))) + (f22-1 (+ 8.0 (fmax f22-0 f0-23))) + ) + (let* ((v1-47 arg1) + (f0-26 (+ 10.0 (-> s0-1 x))) + (f1-12 4.0) + (f2-0 (-> this current-index)) + (f1-14 (+ (- f1-12 (* f22-1 (- f2-0 (* (the float (the int (/ f2-0 1.0))) 1.0)))) (-> s0-1 y))) + ) + (set! (-> v1-47 origin x) f0-26) + (set! (-> v1-47 origin y) f1-14) + ) + (while (and (< (-> arg1 origin y) (-> s0-1 w)) (< sv-80 s1-2)) + (when (= sv-80 3) + (nop!) + (nop!) + 0 + ) + ((method-of-type controls-string-info controls-string-info-method-9) + (the-as controls-string-info (-> this text sv-80)) + arg0 + arg1 + f26-0 + f24-0 + f30-0 + f28-1 + s2-0 + ) + (+! sv-80 1) + ) + (set! (-> this on-screen) (< (-> arg1 origin y) (-> s0-1 w))) + (seek! (-> this current-index) (-> this target-index) (* (/ 300.0 f22-1) (seconds-per-frame))) ) - ((method-of-type controls-string-info controls-string-info-method-9) - (the-as controls-string-info (-> this text sv-80)) - arg0 - arg1 - f26-0 - f24-0 - f30-0 - f28-1 - s2-0 - ) - (set! sv-80 (+ sv-80 1)) ) - (set! (-> this on-screen) (< (-> arg1 origin y) (-> s0-1 w))) - (seek! (-> this current-index) (-> this target-index) (* (/ 300.0 f22-1) (seconds-per-frame))) ) ) ) @@ -2094,7 +1894,6 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defmethod draw-option ((this menu-language-game-option) (arg0 progress) (arg1 font-context) (arg2 int) (arg3 symbol)) - (local-vars (sv-16 string) (sv-32 string)) (let ((f30-0 (fmax 0.0 (* 2.0 (- 0.5 (-> arg0 menu-transition)))))) (set-scale! arg1 0.65) (adjust-font-origin-y arg0 arg1 (-> this offset-y)) @@ -2122,14 +1921,7 @@ ) (draw-highlight-bar arg0 arg1 (the int (-> arg1 origin y)) 42 f30-0) (let ((s2-1 print-game-text)) - (let ((s1-1 format) - (s0-1 (clear *temp-string*)) - ) - (set! sv-16 "~S") - (let ((a2-4 (lookup-text! *common-text* (-> this name) #f))) - (s1-1 s0-1 sv-16 a2-4) - ) - ) + (format (clear *temp-string*) "~S" (lookup-text! *common-text* (-> this name) #f)) (s2-1 *temp-string* arg1 #f 44 (bucket-id hud-draw-hud-alpha)) ) (+! (-> arg1 origin y) 24.0) @@ -2173,14 +1965,7 @@ ) (set-scale! arg1 0.65) (let ((s2-4 print-game-text)) - (let ((s1-2 format) - (s0-2 (clear *temp-string*)) - ) - (set! sv-32 "~S") - (let ((a2-14 (lookup-text! *common-text* (-> this name) #f))) - (s1-2 s0-2 sv-32 a2-14) - ) - ) + (format (clear *temp-string*) "~S" (lookup-text! *common-text* (-> this name) #f)) (s2-4 *temp-string* arg1 #f 44 (bucket-id hud-draw-hud-alpha)) ) (set-scale! arg1 0.5) @@ -2215,7 +2000,6 @@ ;; ERROR: Stack slot load at 48 mismatch: defined as size 4, got size 16 ;; WARN: Return type mismatch int vs none. (defmethod draw-option ((this menu-center-screen-graphic-option) (arg0 progress) (arg1 font-context) (arg2 int) (arg3 symbol)) - (local-vars (sv-16 float) (sv-32 font-context) (sv-48 float)) (let ((f30-0 (fmax 0.0 (* 2.0 (- 0.5 (-> arg0 menu-transition))))) (s4-0 (get-scissor-stack-top arg0)) ) @@ -2230,63 +2014,63 @@ ) (adjust-font-origin-y arg0 arg1 0.45) (set! (-> arg1 origin x) (+ 30.0 (-> s4-0 x))) - (let* ((s3-1 arg0) - (s2-1 (method-of-object s3-1 progress-method-45)) - (s1-1 arg1) - (s0-0 (+ (- -60.0 (-> s4-0 x)) (-> s4-0 z))) - ) - (set! sv-16 (the-as float 16.0)) - (let* ((t0-1 (lookup-text! *common-text* (text-id progress-graphics-center-screen-dpad) #f)) - (t1-0 0.5) - (t2-0 0.95) - (t3-0 32) - (f0-7 (s2-1 s3-1 s1-1 s0-0 sv-16 t0-1 t1-0 t2-0 t3-0)) - (f1-6 (* 0.4 (-> arg1 max-x))) - (f2-4 (+ (-> s4-0 x) (* 0.5 (- (-> s4-0 z) (-> s4-0 x))))) - (f30-1 (+ f2-4 f1-6)) - (f28-0 (- f2-4 f1-6)) - (f26-0 (+ -8.0 (/ f0-7 2) (-> arg1 origin y))) + (let* ((f0-7 + (progress-method-45 + arg0 + arg1 + (+ (- -60.0 (-> s4-0 x)) (-> s4-0 z)) + (the-as float 16.0) + (lookup-text! *common-text* (text-id progress-graphics-center-screen-dpad) #f) + 0.5 + 0.95 + 32 + ) ) - (let ((f1-10 (+ -15.0 (-> arg1 origin y))) - (f24-0 (+ 3.0 f0-7 (-> arg1 origin y))) - ) - (let ((v1-17 arg1)) - (set! (-> v1-17 origin x) (-> s4-0 x)) - (set! (-> v1-17 origin y) f1-10) + (f1-6 (* 0.4 (-> arg1 max-x))) + (f2-4 (+ (-> s4-0 x) (* 0.5 (- (-> s4-0 z) (-> s4-0 x))))) + (f30-1 (+ f2-4 f1-6)) + (f28-0 (- f2-4 f1-6)) + (f26-0 (+ -8.0 (/ f0-7 2) (-> arg1 origin y))) + ) + (let ((f1-10 (+ -15.0 (-> arg1 origin y))) + (f24-0 (+ 3.0 f0-7 (-> arg1 origin y))) ) - (let ((v1-18 arg1)) - (set! (-> v1-18 width) (- (-> s4-0 z) (-> s4-0 x))) + (let ((v1-17 arg1)) + (set! (-> v1-17 origin x) (-> s4-0 x)) + (set! (-> v1-17 origin y) f1-10) + ) + (let ((v1-18 arg1)) + (set! (-> v1-18 width) (- (-> s4-0 z) (-> s4-0 x))) + ) + (let ((s3-2 print-game-text)) + (format (clear *temp-string*) "~33L~C" 160) + (s3-2 *temp-string* arg1 #f 44 (bucket-id hud-draw-hud-alpha)) + ) + (set! (-> arg1 origin y) f24-0) + ) + (let ((s3-3 print-game-text)) + (format (clear *temp-string*) "~33L~C" 162) + (s3-3 *temp-string* arg1 #f 44 (bucket-id hud-draw-hud-alpha)) + ) + (let ((a0-13 arg1)) + (set! (-> a0-13 flags) (font-flags kerning right large)) + ) + (let ((v1-20 arg1) + (f0-12 f26-0) ) - (let ((s3-2 print-game-text)) - (format (clear *temp-string*) "~33L~C" 160) - (s3-2 *temp-string* arg1 #f 44 (bucket-id hud-draw-hud-alpha)) - ) - (set! (-> arg1 origin y) f24-0) - ) - (let ((s3-3 print-game-text)) - (format (clear *temp-string*) "~33L~C" 162) - (s3-3 *temp-string* arg1 #f 44 (bucket-id hud-draw-hud-alpha)) - ) - (let ((a0-13 arg1)) - (set! (-> a0-13 flags) (font-flags kerning right large)) - ) - (let ((v1-20 arg1) - (f0-12 f26-0) - ) - (set! (-> v1-20 origin x) f28-0) - (set! (-> v1-20 origin y) f0-12) - ) - (let ((s3-4 print-game-text)) - (format (clear *temp-string*) "~33L~C" 163) - (s3-4 *temp-string* arg1 #f 44 (bucket-id hud-draw-hud-alpha)) - ) - (let ((a0-17 arg1)) - (set! (-> a0-17 flags) (font-flags kerning large)) - ) - (let ((v1-22 arg1)) - (set! (-> v1-22 origin x) f30-1) - (set! (-> v1-22 origin y) f26-0) - ) + (set! (-> v1-20 origin x) f28-0) + (set! (-> v1-20 origin y) f0-12) + ) + (let ((s3-4 print-game-text)) + (format (clear *temp-string*) "~33L~C" 163) + (s3-4 *temp-string* arg1 #f 44 (bucket-id hud-draw-hud-alpha)) + ) + (let ((a0-17 arg1)) + (set! (-> a0-17 flags) (font-flags kerning large)) + ) + (let ((v1-22 arg1)) + (set! (-> v1-22 origin x) f30-1) + (set! (-> v1-22 origin y) f26-0) ) ) (let ((s3-5 print-game-text)) @@ -2326,23 +2110,21 @@ ) ) (set! (-> arg1 origin x) (+ 10.0 (-> s4-0 x))) - (let* ((s1-2 arg0) - (s0-1 (method-of-object s1-2 progress-method-45)) - ) - (set! sv-32 arg1) - (let ((s4-1 (+ (- -20.0 (-> s4-0 x)) (-> s4-0 z)))) - (set! sv-48 (* 32.0 f28-1)) - (let* ((t0-7 (lookup-text! *common-text* (-> this name) #f)) - (t1-1 f28-1) - (t2-1 0.75) - (t3-1 32) - (f0-26 (s0-1 s1-2 sv-32 s4-1 sv-48 t0-7 t1-1 t2-1 t3-1)) - ) - (if (= (-> arg0 option-index) arg2) - (draw-highlight-bar arg0 arg1 (the int (+ -1.0 (-> arg1 origin y))) (the int (+ 4.0 f0-26)) f30-0) - ) + (let ((f0-26 (progress-method-45 + arg0 + arg1 + (+ (- -20.0 (-> s4-0 x)) (-> s4-0 z)) + (* 32.0 f28-1) + (lookup-text! *common-text* (-> this name) #f) + f28-1 + 0.75 + 32 + ) + ) + ) + (if (= (-> arg0 option-index) arg2) + (draw-highlight-bar arg0 arg1 (the int (+ -1.0 (-> arg1 origin y))) (the int (+ 4.0 f0-26)) f30-0) ) - ) ) ) ) @@ -2742,18 +2524,6 @@ ;; INFO: Used lq/sq ;; 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 - (sv-48 (function string font-context symbol int bucket-id float)) - (sv-64 (function _varargs_ object)) - (sv-80 string) - (sv-96 string) - (sv-112 (function string font-context symbol int bucket-id float)) - (sv-128 dma-buffer) - (sv-144 pointer) - (sv-160 int) - (sv-176 (function string font-context symbol int bucket-id float)) - (sv-192 (function _varargs_ object)) - ) (let ((f30-0 (fmax 0.0 (* 2.0 (- 0.5 (-> arg0 menu-transition))))) (f28-0 (if (= (-> arg0 current) 'select-save-title) 0.2 @@ -2777,57 +2547,43 @@ (f26-0 (+ (-> s3-1 y) (* f0-4 (the float arg2)))) (f28-1 (+ f26-0 f0-4)) (s1-0 (the int (+ (-> s3-1 x) (* 0.7 (- (-> s3-1 z) (-> s3-1 x))) (* -48.0 f24-0)))) + (sv-160 (the int (+ 32.0 (-> s3-1 y)))) + (s2-0 *progress-save-info*) ) - (set! sv-160 (the int (+ 32.0 (-> s3-1 y)))) - (let ((s2-0 *progress-save-info*)) - (let ((v1-16 arg1) - (f1-12 (+ 10.0 (-> s3-1 x))) - (f2-13 (+ f26-0 (* 0.5 (- f0-4 (* 32.0 (-> arg1 scale)))))) - ) - (set! (-> v1-16 origin x) f1-12) - (set! (-> v1-16 origin y) f2-13) - ) - (set! (-> arg1 height) f0-4) - (let ((a0-11 arg1)) - (set! (-> a0-11 flags) (font-flags kerning large)) - ) - (when (and s2-0 (= (-> s2-0 formatted) 1) (= (-> s2-0 inited) 1)) - (cond - ((= (-> s2-0 file arg2 present) 1) - (set! sv-48 print-game-text) - (set! sv-64 format) - (set! sv-80 (clear *temp-string*)) - (set! sv-96 "~S ~D") - (let ((a2-2 (lookup-text! *common-text* (text-id text-0073) #f)) - (a3-1 (+ arg2 1)) - ) - (sv-64 sv-80 sv-96 a2-2 a3-1) - ) - (let ((a0-21 *temp-string*) - (a1-6 arg1) - (a2-3 #f) - (a3-2 44) - (t0-1 579) - ) - (sv-48 a0-21 a1-6 a2-3 a3-2 (the-as bucket-id t0-1)) - ) - ) - ((zero? (-> s2-0 file arg2 present)) - (set! sv-112 print-game-text) - (let ((a0-23 (lookup-text! *common-text* (text-id progress-empty) #f)) - (a1-8 arg1) - (a2-5 #f) - (a3-3 44) - (t0-2 579) - ) - (sv-112 a0-23 a1-8 a2-5 a3-3 (the-as bucket-id t0-2)) - ) - ) + (let ((v1-16 arg1) + (f1-12 (+ 10.0 (-> s3-1 x))) + (f2-13 (+ f26-0 (* 0.5 (- f0-4 (* 32.0 (-> arg1 scale)))))) ) - (when (= arg2 (-> arg0 option-index)) - (set-scale! arg1 0.8) - (set! sv-128 (-> *display* frames (-> *display* on-screen) global-buf)) - (set! sv-144 (-> sv-128 base)) + (set! (-> v1-16 origin x) f1-12) + (set! (-> v1-16 origin y) f2-13) + ) + (set! (-> arg1 height) f0-4) + (let ((a0-11 arg1)) + (set! (-> a0-11 flags) (font-flags kerning large)) + ) + (when (and s2-0 (= (-> s2-0 formatted) 1) (= (-> s2-0 inited) 1)) + (cond + ((= (-> s2-0 file arg2 present) 1) + (let ((sv-48 print-game-text)) + (format (clear *temp-string*) "~S ~D" (lookup-text! *common-text* (text-id text-0073) #f) (+ arg2 1)) + (sv-48 *temp-string* arg1 #f 44 (bucket-id hud-draw-hud-alpha)) + ) + ) + ((zero? (-> s2-0 file arg2 present)) + (print-game-text + (lookup-text! *common-text* (text-id progress-empty) #f) + arg1 + #f + 44 + (bucket-id hud-draw-hud-alpha) + ) + ) + ) + (when (= arg2 (-> arg0 option-index)) + (set-scale! arg1 0.8) + (let* ((sv-128 (-> *display* frames (-> *display* on-screen) global-buf)) + (sv-144 (-> sv-128 base)) + ) (let ((f24-1 (+ (-> s3-1 x) (* 0.4 (- (-> s3-1 z) (-> s3-1 x)))))) (set-vector! (-> s0-0 color) 128 128 128 (the int (* 16.0 f30-0))) (set! (-> (the-as vector (-> s0-0 box)) quad) (-> s3-1 quad)) @@ -2867,112 +2623,101 @@ ) ) ) - (when (= (-> s2-0 file arg2 present) 1) - (when (= arg2 (-> arg0 option-index)) - (let* ((a0-49 (-> *progress-icon-arrays* (-> s2-0 file arg2 level-index))) - (t9-16 (method-of-object a0-49 draw-icon-array!)) - (a3-5 1.0) - (t0-3 1.0) - (t1-0 (the-as uint #x80808080)) - (t2-0 f30-0) - ) - (t9-16 a0-49 s1-0 sv-160 a3-5 t0-3 (the-as rgba t1-0) t2-0) - ) - (set-scale! arg1 0.6) - (let ((a0-51 arg1)) - (set! (-> a0-51 color) (font-color font-color-32)) - ) - (adjust-font-origin-y arg0 arg1 0.675) - (let ((a0-53 arg1)) - (set! (-> a0-53 flags) (font-flags kerning right large)) - ) - (let* ((v1-91 (-> s2-0 file arg2 game-time0)) - (v1-92 (logior (shl (-> s2-0 file arg2 game-time1) 32) v1-91)) - (s1-1 (/ (the-as int v1-92) #x107ac0)) - (s0-1 (/ (mod (the-as int v1-92) #x107ac0) #x4650)) - ) - (set! (-> arg1 origin x) (+ (-> s3-1 x) (* 0.675 (- (-> s3-1 z) (-> s3-1 x))))) - (set! sv-176 print-game-text) - (set! sv-192 format) - (let ((a0-63 (clear *temp-string*)) - (a1-16 "~2,'0D:~2,'0D") - ) - (sv-192 a0-63 a1-16 s1-1 s0-1) - ) - ) - (let ((a0-64 *temp-string*) - (a1-17 arg1) - (a2-10 #f) - (a3-7 44) - (t0-4 579) - ) - (sv-176 a0-64 a1-17 a2-10 a3-7 (the-as bucket-id t0-4)) - ) - (draw-icon-array! - (-> *progress-icon-arrays* 66) - (the int (+ 10.0 (* 0.4 (- (-> s3-1 z) (-> s3-1 x))) (-> s3-1 x))) - (the int (-> arg1 origin y)) - 0.65 - 0.65 - (new 'static 'rgba :r #x80 :g #x80 :b #x80 :a #x80) - f30-0 - ) - (set! (-> arg1 origin x) (+ (- (+ -10.0 (-> s3-1 z)) (-> s3-1 x)) (-> s3-1 x))) - (let ((s1-2 print-game-text)) - (format (clear *temp-string*) "~D%" (the int (-> s2-0 file arg2 completion-percentage))) - (s1-2 *temp-string* arg1 #f 44 (bucket-id hud-draw-hud-alpha)) - ) - (draw-icon-array! - (-> *progress-icon-arrays* 67) - (the int (+ -8.0 (* 0.75 (- (-> s3-1 z) (-> s3-1 x))) (-> s3-1 x))) - (the int (-> arg1 origin y)) - 0.7 - 0.7 - (new 'static 'rgba :r #x80 :g #x80 :b #x80 :a #x80) - f30-0 - ) - (adjust-font-origin-y arg0 arg1 0.83) + ) + (when (= (-> s2-0 file arg2 present) 1) + (when (= arg2 (-> arg0 option-index)) + (draw-icon-array! + (-> *progress-icon-arrays* (-> s2-0 file arg2 level-index)) + s1-0 + sv-160 + 1.0 + 1.0 + (new 'static 'rgba :r #x80 :g #x80 :b #x80 :a #x80) + f30-0 + ) + (set-scale! arg1 0.6) + (let ((a0-51 arg1)) + (set! (-> a0-51 color) (font-color font-color-32)) + ) + (adjust-font-origin-y arg0 arg1 0.675) + (let ((a0-53 arg1)) + (set! (-> a0-53 flags) (font-flags kerning right large)) + ) + (let* ((v1-91 (-> s2-0 file arg2 game-time0)) + (v1-92 (logior (shl (-> s2-0 file arg2 game-time1) 32) v1-91)) + (s1-1 (/ (the-as int v1-92) #x107ac0)) + (s0-1 (/ (mod (the-as int v1-92) #x107ac0) #x4650)) + ) (set! (-> arg1 origin x) (+ (-> s3-1 x) (* 0.675 (- (-> s3-1 z) (-> s3-1 x))))) - (let ((s1-3 print-game-text)) - (format (clear *temp-string*) "~D" (the int (-> s2-0 file arg2 skill-count))) - (s1-3 *temp-string* arg1 #f 44 (bucket-id hud-draw-hud-alpha)) + (let ((sv-176 print-game-text)) + (format (clear *temp-string*) "~2,'0D:~2,'0D" s1-1 s0-1) + (sv-176 *temp-string* arg1 #f 44 (bucket-id hud-draw-hud-alpha)) ) - (draw-icon-array! - (-> *progress-icon-arrays* 68) - (the int (+ 10.0 (* 0.4 (- (-> s3-1 z) (-> s3-1 x))) (-> s3-1 x))) - (the int (+ -2.0 (-> arg1 origin y))) - 0.7 - 0.7 - (new 'static 'rgba :r #x80 :g #x80 :b #x80 :a #x80) - f30-0 + ) + (draw-icon-array! + (-> *progress-icon-arrays* 66) + (the int (+ 10.0 (* 0.4 (- (-> s3-1 z) (-> s3-1 x))) (-> s3-1 x))) + (the int (-> arg1 origin y)) + 0.65 + 0.65 + (new 'static 'rgba :r #x80 :g #x80 :b #x80 :a #x80) + f30-0 + ) + (set! (-> arg1 origin x) (+ (- (+ -10.0 (-> s3-1 z)) (-> s3-1 x)) (-> s3-1 x))) + (let ((s1-2 print-game-text)) + (format (clear *temp-string*) "~D%" (the int (-> s2-0 file arg2 completion-percentage))) + (s1-2 *temp-string* arg1 #f 44 (bucket-id hud-draw-hud-alpha)) + ) + (draw-icon-array! + (-> *progress-icon-arrays* 67) + (the int (+ -8.0 (* 0.75 (- (-> s3-1 z) (-> s3-1 x))) (-> s3-1 x))) + (the int (-> arg1 origin y)) + 0.7 + 0.7 + (new 'static 'rgba :r #x80 :g #x80 :b #x80 :a #x80) + f30-0 + ) + (adjust-font-origin-y arg0 arg1 0.83) + (set! (-> arg1 origin x) (+ (-> s3-1 x) (* 0.675 (- (-> s3-1 z) (-> s3-1 x))))) + (let ((s1-3 print-game-text)) + (format (clear *temp-string*) "~D" (the int (-> s2-0 file arg2 skill-count))) + (s1-3 *temp-string* arg1 #f 44 (bucket-id hud-draw-hud-alpha)) + ) + (draw-icon-array! + (-> *progress-icon-arrays* 68) + (the int (+ 10.0 (* 0.4 (- (-> s3-1 z) (-> s3-1 x))) (-> s3-1 x))) + (the int (+ -2.0 (-> arg1 origin y))) + 0.7 + 0.7 + (new 'static 'rgba :r #x80 :g #x80 :b #x80 :a #x80) + f30-0 + ) + (set! (-> arg1 origin x) (+ (- (+ -10.0 (-> s3-1 z)) (-> s3-1 x)) (-> s3-1 x))) + (let ((s1-4 print-game-text)) + (format (clear *temp-string*) "~D" (the int (-> s2-0 file arg2 gem-count))) + (s1-4 *temp-string* arg1 #f 44 (bucket-id hud-draw-hud-alpha)) + ) + (draw-icon-array! + (-> *progress-icon-arrays* 69) + (the int (+ -14.0 (* 0.75 (- (-> s3-1 z) (-> s3-1 x))) (-> s3-1 x))) + (the int (-> arg1 origin y)) + 0.5 + 0.5 + (new 'static 'rgba :r #x80 :g #x80 :b #x80 :a #x80) + f30-0 + ) + (when (logtest? (-> s2-0 file arg2 secrets) 1) + (let ((a0-79 arg1)) + (set! (-> a0-79 flags) (font-flags kerning middle large)) ) - (set! (-> arg1 origin x) (+ (- (+ -10.0 (-> s3-1 z)) (-> s3-1 x)) (-> s3-1 x))) - (let ((s1-4 print-game-text)) - (format (clear *temp-string*) "~D" (the int (-> s2-0 file arg2 gem-count))) - (s1-4 *temp-string* arg1 #f 44 (bucket-id hud-draw-hud-alpha)) + (set! (-> arg1 origin x) (+ (-> s3-1 x) (* 0.4 (- (-> s3-1 z) (-> s3-1 x))))) + (set! (-> arg1 origin y) (+ 8.0 (-> s3-1 y))) + (let ((v1-140 arg1)) + (set! (-> v1-140 width) (* 0.6 (- (-> s3-1 z) (-> s3-1 x)))) ) - (draw-icon-array! - (-> *progress-icon-arrays* 69) - (the int (+ -14.0 (* 0.75 (- (-> s3-1 z) (-> s3-1 x))) (-> s3-1 x))) - (the int (-> arg1 origin y)) - 0.5 - 0.5 - (new 'static 'rgba :r #x80 :g #x80 :b #x80 :a #x80) - f30-0 - ) - (when (logtest? (-> s2-0 file arg2 secrets) 1) - (let ((a0-79 arg1)) - (set! (-> a0-79 flags) (font-flags kerning middle large)) - ) - (set! (-> arg1 origin x) (+ (-> s3-1 x) (* 0.4 (- (-> s3-1 z) (-> s3-1 x))))) - (set! (-> arg1 origin y) (+ 8.0 (-> s3-1 y))) - (let ((v1-140 arg1)) - (set! (-> v1-140 width) (* 0.6 (- (-> s3-1 z) (-> s3-1 x)))) - ) - (let ((s3-2 print-game-text)) - (format (clear *temp-string*) "~S" (lookup-text! *common-text* (text-id progress-secrets-hero-mode) #f)) - (s3-2 *temp-string* arg1 #f 44 (bucket-id hud-draw-hud-alpha)) - ) + (let ((s3-2 print-game-text)) + (format (clear *temp-string*) "~S" (lookup-text! *common-text* (text-id progress-secrets-hero-mode) #f)) + (s3-2 *temp-string* arg1 #f 44 (bucket-id hud-draw-hud-alpha)) ) ) ) @@ -3975,17 +3720,6 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defmethod draw-option ((this menu-select-start-option) (arg0 progress) (arg1 font-context) (arg2 int) (arg3 symbol)) - (local-vars - (sv-16 string) - (sv-32 string) - (sv-48 (function game-text-info text-id symbol string)) - (sv-64 game-text-info) - (sv-80 (function _varargs_ object)) - (sv-96 string) - (sv-112 string) - (sv-128 (function game-text-info text-id symbol string)) - (sv-144 game-text-info) - ) (set! (-> *progress-list-level* mode) (-> arg0 current)) (set! (-> *progress-list-level* act) (-> *progress-work* selected-num)) (let ((f30-0 (fmax 0.0 (* 2.0 (- 0.5 (-> arg0 menu-transition)))))) @@ -3999,17 +3733,10 @@ (let ((s2-1 (max 0 (the int (-> this current-index)))) (s1-0 print-game-text) ) - (let ((s0-0 format)) - (set! sv-16 (clear *temp-string*)) - (set! sv-32 "~S") - (set! sv-64 *common-text*) - (set! sv-48 (method-of-object sv-64 lookup-text!)) - (let* ((a1-3 (-> (progress-list-method-9 *progress-list-level* s2-1) text-name)) - (a2-1 #f) - (a2-2 (sv-48 sv-64 a1-3 a2-1)) - ) - (s0-0 sv-16 sv-32 a2-2) - ) + (format + (clear *temp-string*) + "~S" + (lookup-text! *common-text* (-> (progress-list-method-9 *progress-list-level* s2-1) text-name) #f) ) (let ((f28-0 (s1-0 *temp-string* arg1 #t 44 (bucket-id hud-draw-hud-alpha)))) (let ((s1-1 (get-scissor-stack-top arg0))) @@ -4042,16 +3769,10 @@ ) ) (let ((s0-1 print-game-text)) - (set! sv-80 format) - (set! sv-96 (clear *temp-string*)) - (set! sv-112 "~S") - (set! sv-144 *common-text*) - (set! sv-128 (method-of-object sv-144 lookup-text!)) - (let* ((a1-7 (-> (progress-list-method-9 *progress-list-level* s2-1) text-name)) - (a2-4 #f) - (a2-5 (sv-128 sv-144 a1-7 a2-4)) - ) - (sv-80 sv-96 sv-112 a2-5) + (format + (clear *temp-string*) + "~S" + (lookup-text! *common-text* (-> (progress-list-method-9 *progress-list-level* s2-1) text-name) #f) ) (let ((f26-0 (s0-1 *temp-string* arg1 #f 40 (bucket-id hud-draw-hud-alpha)))) (if (= s2-1 (-> this selected-index)) @@ -4113,15 +3834,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-16 (function _varargs_ object)) - (sv-32 string) - (sv-48 string) - (sv-64 (function string font-context symbol int bucket-id float)) - (sv-80 (function _varargs_ object)) - (sv-96 string) - (sv-112 string) - ) (let ((f30-0 (fmax 0.0 (* 2.0 (- 0.5 (-> arg0 menu-transition)))))) (let* ((v1-3 (-> *progress-work* selected-num)) (s3-0 (cond @@ -4150,12 +3862,7 @@ (let ((s1-1 (max 0 (the int (-> this current-index)))) (s0-0 print-game-text) ) - (set! sv-16 format) - (set! sv-32 (clear *temp-string*)) - (set! sv-48 "~S") - (let ((a2-2 (lookup-text! *common-text* (-> s3-0 s1-1 text) #f))) - (sv-16 sv-32 sv-48 a2-2) - ) + (format (clear *temp-string*) "~S" (lookup-text! *common-text* (-> s3-0 s1-1 text) #f)) (let ((f28-0 (s0-0 *temp-string* arg1 #t 44 (bucket-id hud-draw-hud-alpha)))) (let ((s0-1 (get-scissor-stack-top arg0))) (let ((f0-5 (- (-> s0-1 w) (-> s0-1 y)))) @@ -4186,24 +3893,14 @@ ) ) ) - (set! sv-64 print-game-text) - (set! sv-80 format) - (set! sv-96 (clear *temp-string*)) - (set! sv-112 "~S") - (let ((a2-5 (lookup-text! *common-text* (-> s3-0 s1-1 text) #f))) - (sv-80 sv-96 sv-112 a2-5) - ) - (let* ((a0-21 *temp-string*) - (a1-7 arg1) - (a2-6 #f) - (a3-2 40) - (t0-2 579) - (f26-0 (sv-64 a0-21 a1-7 a2-6 a3-2 (the-as bucket-id t0-2))) - ) - (if (= s1-1 (-> this selected-index)) - (draw-highlight-bar arg0 arg1 (the int (+ -2.0 (-> arg1 origin y))) (the int (+ 2.0 f26-0)) f30-0) - ) - (+! (-> arg1 origin y) f26-0) + (let ((sv-64 print-game-text)) + (format (clear *temp-string*) "~S" (lookup-text! *common-text* (-> s3-0 s1-1 text) #f)) + (let ((f26-0 (sv-64 *temp-string* arg1 #f 40 (bucket-id hud-draw-hud-alpha)))) + (if (= s1-1 (-> this selected-index)) + (draw-highlight-bar arg0 arg1 (the int (+ -2.0 (-> arg1 origin y))) (the int (+ 2.0 f26-0)) f30-0) + ) + (+! (-> arg1 origin y) f26-0) + ) ) (+! s1-1 1) ) @@ -4479,452 +4176,365 @@ ;; INFO: Used lq/sq ;; 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 - (a0-19 string) - (sv-16 float) - (sv-24 int) - (sv-96 int) - (sv-112 int) - (sv-128 int) - (sv-144 string) - (sv-160 string) - (sv-176 (function _varargs_ object)) - (sv-192 string) - (sv-208 text-id) - (sv-224 (function _varargs_ object)) - (sv-240 string) - (sv-256 (function string font-context symbol int bucket-id float)) - (sv-272 (function _varargs_ object)) - (sv-288 int) - (sv-304 (function string font-context symbol int bucket-id float)) - (sv-320 (function _varargs_ object)) - (sv-336 (function _varargs_ object)) - (sv-352 string) - (sv-368 string) - (sv-384 (function _varargs_ object)) - (sv-400 (function _varargs_ object)) - (sv-416 (function _varargs_ object)) - ) - (set! sv-16 (fmax 0.0 (* 2.0 (- 0.5 (-> arg0 menu-transition))))) - (set! sv-24 (the int (-> *game-info* skill))) - (set! (-> arg1 alpha) sv-16) - (cond - ((not (loaded? *bigmap*)) - (progress-method-51 arg0 arg1) - ) - (else - (new 'stack 'hud-sprite) - (let ((s2-0 (get-texture hud-orb progress-minimap))) - (when (and s2-0 (not (-> this available-title))) - (progress-method-33 arg0 (-> *progress-work* sub-header)) - (let ((s3-0 (get-scissor-stack-top arg0))) - (let* ((f0-5 0.64) - (f30-0 (+ 10.0 (* (the float (-> s2-0 w)) f0-5 (-> *video-params* relative-x-scale)))) - ) - (let ((f1-5 (* (the float (-> s2-0 h)) f0-5))) - (+ (- (- -20.0 f30-0) (-> s3-0 x)) (-> s3-0 z)) - (let ((t1-0 (logior #x808080 (shr (shl (the int (* 128.0 sv-16)) 56) 32)))) - (draw-icon-array! - (-> *progress-icon-arrays* 68) - (the int (+ 10.0 (-> s3-0 x))) - (the int (+ (-> s3-0 y) (* 0.5 (- 28.0 f1-5)))) - f0-5 - f0-5 - (the-as rgba t1-0) - sv-16 - ) - ) - ) - (let ((v1-26 arg1)) - (set! (-> v1-26 height) 28.0) - ) - (let ((a0-13 arg1)) - (set! (-> a0-13 flags) (font-flags kerning large)) - ) - (let ((f28-0 0.45)) - (let ((a0-14 arg1)) - (set! (-> a0-14 color) (font-color font-color-34)) - ) - (cond - ((-> this buy-menu) - (let ((s2-1 format) - (s1-0 (clear *temp-string*)) - (s0-0 "x~D ~S") - ) - (set! sv-96 (-> *menu-secrets-array* (-> this selected-index) cost)) - (let ((a3-2 (lookup-text! *common-text* (text-id progress-secrets-price) #f))) - (s2-1 s1-0 s0-0 sv-96 a3-2) - ) - ) - (set! a0-19 *temp-string*) - ) - (else - (let ((s2-2 format) - (s1-1 (clear *temp-string*)) - (s0-1 "x~D ~S") - ) - (set! sv-112 sv-24) - (let ((a3-3 (lookup-text! *common-text* (text-id progress-secrets-orbs-available) #f))) - (s2-2 s1-1 s0-1 sv-112 a3-3) - ) - ) - (set! a0-19 *temp-string*) - ) - ) - (set-scale! arg1 f28-0) - (let ((v1-43 arg1) - (f0-10 (+ (-> s3-0 x) f30-0)) - (f1-11 (+ (-> s3-0 y) (* 0.5 (- 28.0 (* 32.0 f28-0))))) - ) - (set! (-> v1-43 origin x) f0-10) - (set! (-> v1-43 origin y) f1-11) - ) - ) - ) - (print-game-text a0-19 arg1 #f 44 (bucket-id hud-draw-hud-alpha)) - (let ((a0-23 arg1)) - (set! (-> a0-23 flags) (font-flags kerning right large)) - ) - (set! (-> arg1 origin x) (+ -10.0 (-> s3-0 z))) - ) - (let ((s3-1 print-game-text)) - (let ((s2-3 format) - (s1-2 (clear *temp-string*)) - (s0-2 "~D/600 ~S") - ) - (set! sv-128 (the int (-> *game-info* skill-total))) - (let ((a3-5 (lookup-text! *common-text* (text-id progress-secrets-orbs-collected) #f))) - (s2-3 s1-2 s0-2 sv-128 a3-5) - ) - ) - (s3-1 *temp-string* arg1 #f 44 (bucket-id hud-draw-hud-alpha)) - ) - (progress-method-34 arg0) - ) + (local-vars (a0-19 string) (sv-192 string) (sv-240 string)) + (let ((sv-16 (fmax 0.0 (* 2.0 (- 0.5 (-> arg0 menu-transition))))) + (sv-24 (the int (-> *game-info* skill))) ) - (set-scale! arg1 0.42) - (cond - ((-> this available-title) - (progress-method-33 arg0 (-> *progress-work* body-footer)) - (progress-method-53 arg0 arg1) - (let ((a0-32 arg1)) - (set! (-> a0-32 color) (font-color font-color-32)) - ) - (let ((a0-33 arg1)) - (set! (-> a0-33 flags) (font-flags kerning middle middle-vert large)) - ) - (let ((s4-1 print-game-text)) - (format (clear *temp-string*) (lookup-text! *common-text* (text-id text-0080) #f)) - (s4-1 *temp-string* arg1 #f 44 (bucket-id hud-draw-hud-alpha)) - ) - (progress-method-34 arg0) - (progress-method-33 arg0 (-> *progress-work* footer)) - (let ((a0-40 arg1)) - (set! (-> a0-40 flags) (font-flags kerning middle large)) - ) - (adjust-font-origin-y arg0 arg1 0.1) - (let ((a0-42 arg1)) - (set! (-> a0-42 color) (font-color font-color-33)) - ) - (let ((f0-16 (print-game-text - (lookup-text! *common-text* (text-id progress-continue) #f) - arg1 - #f - 32 - (bucket-id hud-draw-hud-alpha) - ) + (set! (-> arg1 alpha) sv-16) + (cond + ((not (loaded? *bigmap*)) + (progress-method-51 arg0 arg1) + ) + (else + (new 'stack 'hud-sprite) + (let ((s2-0 (get-texture hud-orb progress-minimap))) + (when (and s2-0 (not (-> this available-title))) + (progress-method-33 arg0 (-> *progress-work* sub-header)) + (let ((s3-0 (get-scissor-stack-top arg0))) + (let* ((f0-5 0.64) + (f30-0 (+ 10.0 (* (the float (-> s2-0 w)) f0-5 (-> *video-params* relative-x-scale)))) + ) + (let ((f1-5 (* (the float (-> s2-0 h)) f0-5))) + (+ (- (- -20.0 f30-0) (-> s3-0 x)) (-> s3-0 z)) + (let ((t1-0 (logior #x808080 (shr (shl (the int (* 128.0 sv-16)) 56) 32)))) + (draw-icon-array! + (-> *progress-icon-arrays* 68) + (the int (+ 10.0 (-> s3-0 x))) + (the int (+ (-> s3-0 y) (* 0.5 (- 28.0 f1-5)))) + f0-5 + f0-5 + (the-as rgba t1-0) + sv-16 ) - ) - (draw-highlight-bar arg0 arg1 (the int (+ -2.0 (-> arg1 origin y))) (the int (+ 4.0 f0-16)) (-> arg1 alpha)) - ) - (progress-method-34 arg0) - ) - ((-> this buy-menu) - (progress-method-33 arg0 (-> *progress-work* body)) - (adjust-font-origin-y arg0 arg1 0.45) - (progress-method-50 - arg0 - arg1 - (-> *menu-secrets-array* (-> this selected-index) name) - (text-id progress-secrets-buy) - (text-id progress-secrets-cancel) - #t - #t - 0.65 - ) - (let ((s4-3 *progress-work*)) - (draw-header arg0 arg1 sv-16 (text-id progress-secrets)) - (draw-bg-box-outline arg0 (-> s4-3 sub-header) (* 128.0 sv-16)) - ) - (progress-method-34 arg0) - ) - (else - (progress-method-33 arg0 (-> *progress-work* sub-body-footer)) - (let* ((s3-3 (get-scissor-stack-top arg0)) - (f22-0 (- (-> s3-3 w) (-> s3-3 y))) - (f30-1 (+ 10.0 (* 24.0 (-> *video-params* relative-x-scale) (-> arg1 scale)))) - (f28-1 (+ (- -10.0 (-> s3-3 x)) (-> s3-3 z))) - (s2-5 get-string-length) - ) - (let ((s1-3 format) - (s0-3 (clear *temp-string*)) - ) - (set! sv-144 "~32L~S~44L ~S") - (set! sv-160 (lookup-text! *common-text* (text-id progress-on) #f)) - (let ((a3-12 (lookup-text! *common-text* (text-id progress-off) #f))) - (s1-3 s0-3 sv-144 sv-160 a3-12) - ) - ) - (let* ((f0-27 (-> (s2-5 *temp-string* arg1) length)) - (f26-0 (- (- (- f28-1 f30-1) f0-27) f30-1)) - ) - (- f28-1 f26-0) - (let ((a0-60 arg1)) - (set! (-> a0-60 flags) (font-flags kerning large)) - ) - (let ((v1-100 arg1)) - (set! (-> v1-100 width) f26-0) - ) - (let ((s2-6 *menu-secrets-array*) - (s1-5 (max 0 (the int (-> this current-index)))) ) - (let* ((a0-61 (-> s2-6 s1-5)) - (s0-4 (-> a0-61 name)) + ) + (let ((v1-26 arg1)) + (set! (-> v1-26 height) 28.0) + ) + (let ((a0-13 arg1)) + (set! (-> a0-13 flags) (font-flags kerning large)) + ) + (let ((f28-0 0.45)) + (let ((a0-14 arg1)) + (set! (-> a0-14 color) (font-color font-color-34)) + ) + (cond + ((-> this buy-menu) + (format + (clear *temp-string*) + "x~D ~S" + (-> *menu-secrets-array* (-> this selected-index) cost) + (lookup-text! *common-text* (text-id progress-secrets-price) #f) ) - (case (secret-item-option-method-12 a0-61) - ((4) - (set! sv-192 "?????????") + (set! a0-19 *temp-string*) ) (else - (set! sv-192 (lookup-text! *common-text* s0-4 #f)) + (format + (clear *temp-string*) + "x~D ~S" + sv-24 + (lookup-text! *common-text* (text-id progress-secrets-orbs-available) #f) + ) + (set! a0-19 *temp-string*) ) ) + (set-scale! arg1 f28-0) + (let ((v1-43 arg1) + (f0-10 (+ (-> s3-0 x) f30-0)) + (f1-11 (+ (-> s3-0 y) (* 0.5 (- 28.0 (* 32.0 f28-0))))) + ) + (set! (-> v1-43 origin x) f0-10) + (set! (-> v1-43 origin y) f1-11) + ) ) - (let ((s0-5 print-game-text)) - (set! sv-176 format) - (let ((a0-65 (clear *temp-string*)) - (a1-37 "~S") + ) + (print-game-text a0-19 arg1 #f 44 (bucket-id hud-draw-hud-alpha)) + (let ((a0-23 arg1)) + (set! (-> a0-23 flags) (font-flags kerning right large)) + ) + (set! (-> arg1 origin x) (+ -10.0 (-> s3-0 z))) + ) + (let ((s3-1 print-game-text)) + (format + (clear *temp-string*) + "~D/600 ~S" + (the int (-> *game-info* skill-total)) + (lookup-text! *common-text* (text-id progress-secrets-orbs-collected) #f) + ) + (s3-1 *temp-string* arg1 #f 44 (bucket-id hud-draw-hud-alpha)) + ) + (progress-method-34 arg0) + ) + ) + (set-scale! arg1 0.42) + (cond + ((-> this available-title) + (progress-method-33 arg0 (-> *progress-work* body-footer)) + (progress-method-53 arg0 arg1) + (let ((a0-32 arg1)) + (set! (-> a0-32 color) (font-color font-color-32)) + ) + (let ((a0-33 arg1)) + (set! (-> a0-33 flags) (font-flags kerning middle middle-vert large)) + ) + (let ((s4-1 print-game-text)) + (format (clear *temp-string*) (lookup-text! *common-text* (text-id text-0080) #f)) + (s4-1 *temp-string* arg1 #f 44 (bucket-id hud-draw-hud-alpha)) + ) + (progress-method-34 arg0) + (progress-method-33 arg0 (-> *progress-work* footer)) + (let ((a0-40 arg1)) + (set! (-> a0-40 flags) (font-flags kerning middle large)) + ) + (adjust-font-origin-y arg0 arg1 0.1) + (let ((a0-42 arg1)) + (set! (-> a0-42 color) (font-color font-color-33)) + ) + (let ((f0-16 (print-game-text + (lookup-text! *common-text* (text-id progress-continue) #f) + arg1 + #f + 32 + (bucket-id hud-draw-hud-alpha) + ) ) - (sv-176 a0-65 a1-37 sv-192) - ) - (let ((f24-0 (s0-5 *temp-string* arg1 #t 40 (bucket-id hud-draw-hud-alpha)))) - (let ((f0-33 4.0) - (f1-25 (-> this current-index)) - ) - (set! (-> arg1 origin y) - (+ (- f0-33 (* f24-0 (- f1-25 (* (the float (the int (/ f1-25 1.0))) 1.0)))) (-> s3-3 y)) - ) + ) + (draw-highlight-bar arg0 arg1 (the int (+ -2.0 (-> arg1 origin y))) (the int (+ 4.0 f0-16)) (-> arg1 alpha)) + ) + (progress-method-34 arg0) + ) + ((-> this buy-menu) + (progress-method-33 arg0 (-> *progress-work* body)) + (adjust-font-origin-y arg0 arg1 0.45) + (progress-method-50 + arg0 + arg1 + (-> *menu-secrets-array* (-> this selected-index) name) + (text-id progress-secrets-buy) + (text-id progress-secrets-cancel) + #t + #t + 0.65 + ) + (let ((s4-3 *progress-work*)) + (draw-header arg0 arg1 sv-16 (text-id progress-secrets)) + (draw-bg-box-outline arg0 (-> s4-3 sub-header) (* 128.0 sv-16)) + ) + (progress-method-34 arg0) + ) + (else + (progress-method-33 arg0 (-> *progress-work* sub-body-footer)) + (let* ((s3-3 (get-scissor-stack-top arg0)) + (f22-0 (- (-> s3-3 w) (-> s3-3 y))) + (f30-1 (+ 10.0 (* 24.0 (-> *video-params* relative-x-scale) (-> arg1 scale)))) + (f28-1 (+ (- -10.0 (-> s3-3 x)) (-> s3-3 z))) + (s2-5 get-string-length) + ) + (format + (clear *temp-string*) + "~32L~S~44L ~S" + (lookup-text! *common-text* (text-id progress-on) #f) + (lookup-text! *common-text* (text-id progress-off) #f) + ) + (let* ((f0-27 (-> (s2-5 *temp-string* arg1) length)) + (f26-0 (- (- (- f28-1 f30-1) f0-27) f30-1)) + ) + (- f28-1 f26-0) + (let ((a0-60 arg1)) + (set! (-> a0-60 flags) (font-flags kerning large)) + ) + (let ((v1-100 arg1)) + (set! (-> v1-100 width) f26-0) + ) + (let ((s2-6 *menu-secrets-array*) + (s1-5 (max 0 (the int (-> this current-index)))) ) - (set! (-> arg1 height) f22-0) - (while (and (< (-> arg1 origin y) (-> s3-3 w)) (< s1-5 (-> *menu-secrets-array* length))) - (let ((s0-6 (-> s2-6 s1-5))) - (set! sv-208 (-> s2-6 s1-5 name)) - (set! sv-288 (secret-item-option-method-12 s0-6)) - (case sv-288 - ((4) - (set! sv-240 "?????????") - ) - (else - (let* ((a0-69 *common-text*) - (t9-51 (method-of-object a0-69 lookup-text!)) - (a2-27 #f) - ) - (set! sv-240 (t9-51 a0-69 sv-208 a2-27)) - ) - ) - ) - (cond - ((logtest? (-> s2-6 s1-5 flags) (secret-item-option-flags sf0)) - (set! (-> arg1 origin x) (+ 10.0 (-> s3-3 x))) - (let ((v1-130 arg1)) - (set! (-> v1-130 width) f28-1) - ) - (let ((a0-70 arg1)) - (set! (-> a0-70 color) (font-color font-color-34)) - ) - (let ((a0-71 arg1)) - (set! (-> a0-71 flags) (font-flags kerning large)) - ) - (let ((f22-1 (-> arg1 origin y)) - (s0-7 print-game-text) - ) - (set! sv-224 format) - (let ((a0-73 (clear *temp-string*)) - (a1-40 "~S") - ) - (sv-224 a0-73 a1-40 sv-240) - ) - (set! (-> arg1 origin y) (+ f22-1 (s0-7 *temp-string* arg1 #f 40 (bucket-id hud-draw-hud-alpha)))) - ) - ) - ((not (and (logtest? (-> s2-6 s1-5 flags) (secret-item-option-flags sf4)) - (or (nonzero? (-> *setting-control* user-current subtitle-language)) - (nonzero? (-> *setting-control* user-current language)) - (nonzero? (-> *setting-control* user-current audio-language)) - ) + (let* ((a0-61 (-> s2-6 s1-5)) + (s0-4 (-> a0-61 name)) + (v1-105 (secret-item-option-method-12 a0-61)) + ) + (set! sv-192 (cond + ((= v1-105 4) + (set! sv-192 "?????????") + sv-192 + ) + (else + (lookup-text! *common-text* s0-4 #f) ) - ) - (set! (-> arg1 origin x) (+ (-> s3-3 x) f30-1)) - (let ((v1-147 arg1)) - (set! (-> v1-147 width) f26-0) - ) - (let ((v1-148 sv-288)) - (cond - ((or (= v1-148 4) (= v1-148 3)) - (let ((a0-79 arg1)) - (set! (-> a0-79 flags) (font-flags kerning large ff7)) - ) - (let ((v1-150 arg1)) - (set! (-> v1-150 color) (font-color font-color-44)) - ) - ) - ((zero? v1-148) - (let ((a0-81 arg1)) - (set! (-> a0-81 flags) (font-flags kerning large)) - ) - (let ((v1-152 arg1)) - (set! (-> v1-152 color) (font-color font-color-34)) - ) - ) - (else - (let ((a0-83 arg1)) - (set! (-> a0-83 flags) (font-flags kerning large)) ) - (let ((v1-154 arg1)) - (set! (-> v1-154 color) (font-color font-color-32)) - ) - ) - ) - ) - (let ((f22-2 (-> arg1 origin y))) - (set! sv-256 print-game-text) - (set! sv-272 format) - (let ((a0-86 (clear *temp-string*)) - (a1-44 "~S") - (a2-30 sv-240) - ) - (sv-272 a0-86 a1-44 a2-30) - ) - (let* ((a0-87 *temp-string*) - (a1-45 arg1) - (a2-31 #f) - (a3-15 40) - (t0-10 579) - (f20-0 (sv-256 a0-87 a1-45 a2-31 a3-15 (the-as bucket-id t0-10))) - ) - (when (not (logtest? (-> s2-6 s1-5 flags) (secret-item-option-flags sf0))) - (set! (-> arg1 origin x) (+ (-> s3-3 x) f28-1)) - (let ((a0-88 arg1)) - (set! (-> a0-88 flags) (font-flags kerning right large)) - ) - (set! sv-352 (lookup-text! *common-text* (text-id progress-on) #f)) - (set! sv-368 (lookup-text! *common-text* (text-id progress-off) #f)) - (cond - ((or (zero? sv-288) (= sv-288 3)) - (set! sv-304 print-game-text) - (set! sv-320 format) - (let ((a0-93 (clear *temp-string*)) - (a1-48 "~d") - (a2-34 (-> s0-6 cost)) - ) - (sv-320 a0-93 a1-48 a2-34) - ) - (let ((a0-94 *temp-string*) - (a1-49 arg1) - (a2-35 #f) - (a3-16 40) - (t0-11 579) - ) - (sv-304 a0-94 a1-49 a2-35 a3-16 (the-as bucket-id t0-11)) - ) - ) - ((= sv-288 1) - (cond - ((logtest? (-> s2-6 s1-5 flags) (secret-item-option-flags sf1)) - (let ((s0-8 print-game-text)) - (set! sv-336 format) - (let ((a0-97 (clear *temp-string*)) - (a1-50 "~32L~S~44L ~S") - ) - (sv-336 a0-97 a1-50 sv-352 sv-368) - ) - (s0-8 *temp-string* arg1 #f 40 (bucket-id hud-draw-hud-alpha)) - ) - ) - (else - (let ((s0-9 print-game-text)) - (set! sv-384 format) - (let ((a0-100 (clear *temp-string*)) - (a1-52 "~S") - (a2-38 sv-352) - ) - (sv-384 a0-100 a1-52 a2-38) - ) - (s0-9 *temp-string* arg1 #f 40 (bucket-id hud-draw-hud-alpha)) - ) - ) - ) - ) - ((= sv-288 2) - (cond - ((logtest? (-> s2-6 s1-5 flags) (secret-item-option-flags sf1)) - (let ((s0-10 print-game-text)) - (set! sv-400 format) - (let ((a0-104 (clear *temp-string*)) - (a1-54 "~44L~S ~32L~S~1L") - (a2-40 sv-352) - (a3-20 sv-368) - ) - (sv-400 a0-104 a1-54 a2-40 a3-20) - ) - (s0-10 *temp-string* arg1 #f 40 (bucket-id hud-draw-hud-alpha)) - ) - ) - (else - (let ((s0-11 print-game-text)) - (set! sv-416 format) - (let ((a0-107 (clear *temp-string*)) - (a1-56 "~S") - (a2-42 sv-368) - ) - (sv-416 a0-107 a1-56 a2-42) - ) - (s0-11 *temp-string* arg1 #f 40 (bucket-id hud-draw-hud-alpha)) - ) - ) - ) - ) - ) - ) - (+! (-> arg1 origin y) f20-0) - (if (= s1-5 (-> this selected-index)) - (draw-highlight-bar arg0 arg1 (the int (+ -2.0 f22-2)) (the int (+ 3.0 f20-0)) sv-16) - ) - ) - ) - ) ) + ) + (let ((s0-5 print-game-text)) + (format (clear *temp-string*) "~S" sv-192) + (let ((f24-0 (s0-5 *temp-string* arg1 #t 40 (bucket-id hud-draw-hud-alpha)))) + (let ((f0-33 4.0) + (f1-25 (-> this current-index)) + ) + (set! (-> arg1 origin y) + (+ (- f0-33 (* f24-0 (- f1-25 (* (the float (the int (/ f1-25 1.0))) 1.0)))) (-> s3-3 y)) + ) ) - (+! s1-5 1) + (set! (-> arg1 height) f22-0) + (while (and (< (-> arg1 origin y) (-> s3-3 w)) (< s1-5 (-> *menu-secrets-array* length))) + (let* ((s0-6 (-> s2-6 s1-5)) + (sv-208 (-> s2-6 s1-5 name)) + (sv-288 (secret-item-option-method-12 s0-6)) + ) + (let ((v1-120 sv-288)) + (set! sv-240 (cond + ((= v1-120 4) + (set! sv-240 "?????????") + sv-240 + ) + (else + (lookup-text! *common-text* sv-208 #f) + ) + ) + ) + ) + (cond + ((logtest? (-> s2-6 s1-5 flags) (secret-item-option-flags sf0)) + (set! (-> arg1 origin x) (+ 10.0 (-> s3-3 x))) + (let ((v1-130 arg1)) + (set! (-> v1-130 width) f28-1) + ) + (let ((a0-70 arg1)) + (set! (-> a0-70 color) (font-color font-color-34)) + ) + (let ((a0-71 arg1)) + (set! (-> a0-71 flags) (font-flags kerning large)) + ) + (let ((f22-1 (-> arg1 origin y)) + (s0-7 print-game-text) + ) + (format (clear *temp-string*) "~S" sv-240) + (set! (-> arg1 origin y) (+ f22-1 (s0-7 *temp-string* arg1 #f 40 (bucket-id hud-draw-hud-alpha)))) + ) + ) + ((not (and (logtest? (-> s2-6 s1-5 flags) (secret-item-option-flags sf4)) + (or (nonzero? (-> *setting-control* user-current subtitle-language)) + (nonzero? (-> *setting-control* user-current language)) + (nonzero? (-> *setting-control* user-current audio-language)) + ) + ) + ) + (set! (-> arg1 origin x) (+ (-> s3-3 x) f30-1)) + (let ((v1-147 arg1)) + (set! (-> v1-147 width) f26-0) + ) + (let ((v1-148 sv-288)) + (cond + ((or (= v1-148 4) (= v1-148 3)) + (let ((a0-79 arg1)) + (set! (-> a0-79 flags) (font-flags kerning large ff7)) + ) + (let ((v1-150 arg1)) + (set! (-> v1-150 color) (font-color font-color-44)) + ) + ) + ((zero? v1-148) + (let ((a0-81 arg1)) + (set! (-> a0-81 flags) (font-flags kerning large)) + ) + (let ((v1-152 arg1)) + (set! (-> v1-152 color) (font-color font-color-34)) + ) + ) + (else + (let ((a0-83 arg1)) + (set! (-> a0-83 flags) (font-flags kerning large)) + ) + (let ((v1-154 arg1)) + (set! (-> v1-154 color) (font-color font-color-32)) + ) + ) + ) + ) + (let ((f22-2 (-> arg1 origin y)) + (sv-256 print-game-text) + ) + (format (clear *temp-string*) "~S" sv-240) + (let ((f20-0 (sv-256 *temp-string* arg1 #f 40 (bucket-id hud-draw-hud-alpha)))) + (when (not (logtest? (-> s2-6 s1-5 flags) (secret-item-option-flags sf0))) + (set! (-> arg1 origin x) (+ (-> s3-3 x) f28-1)) + (let ((a0-88 arg1)) + (set! (-> a0-88 flags) (font-flags kerning right large)) + ) + (let ((sv-352 (lookup-text! *common-text* (text-id progress-on) #f)) + (sv-368 (lookup-text! *common-text* (text-id progress-off) #f)) + ) + (cond + ((or (zero? sv-288) (= sv-288 3)) + (let ((sv-304 print-game-text)) + (format (clear *temp-string*) "~d" (-> s0-6 cost)) + (sv-304 *temp-string* arg1 #f 40 (bucket-id hud-draw-hud-alpha)) + ) + ) + ((= sv-288 1) + (cond + ((logtest? (-> s2-6 s1-5 flags) (secret-item-option-flags sf1)) + (let ((s0-8 print-game-text)) + (format (clear *temp-string*) "~32L~S~44L ~S" sv-352 sv-368) + (s0-8 *temp-string* arg1 #f 40 (bucket-id hud-draw-hud-alpha)) + ) + ) + (else + (let ((s0-9 print-game-text)) + (format (clear *temp-string*) "~S" sv-352) + (s0-9 *temp-string* arg1 #f 40 (bucket-id hud-draw-hud-alpha)) + ) + ) + ) + ) + ((= sv-288 2) + (cond + ((logtest? (-> s2-6 s1-5 flags) (secret-item-option-flags sf1)) + (let ((s0-10 print-game-text)) + (format (clear *temp-string*) "~44L~S ~32L~S~1L" sv-352 sv-368) + (s0-10 *temp-string* arg1 #f 40 (bucket-id hud-draw-hud-alpha)) + ) + ) + (else + (let ((s0-11 print-game-text)) + (format (clear *temp-string*) "~S" sv-368) + (s0-11 *temp-string* arg1 #f 40 (bucket-id hud-draw-hud-alpha)) + ) + ) + ) + ) + ) + ) + ) + (+! (-> arg1 origin y) f20-0) + (if (= s1-5 (-> this selected-index)) + (draw-highlight-bar arg0 arg1 (the int (+ -2.0 f22-2)) (the int (+ 3.0 f20-0)) sv-16) + ) + ) + ) + ) + ) + ) + (+! s1-5 1) + ) + (seek! (-> this current-index) (-> this target-index) (* (/ 600.0 f24-0) (seconds-per-frame))) ) - (seek! (-> this current-index) (-> this target-index) (* (/ 600.0 f24-0) (seconds-per-frame))) ) ) ) ) - ) - (progress-method-34 arg0) - (let ((s3-4 *progress-work*)) - (draw-header arg0 arg1 sv-16 (text-id progress-secrets)) - (draw-bg-box-outline arg0 (-> s3-4 sub-header) (* 128.0 sv-16)) - (draw-bg-box-alpha-2 arg0 (-> s3-4 footer) (* 64.0 sv-16)) - (draw-bg-box-outline arg0 (-> s3-4 footer) (* 128.0 sv-16)) - ) - (progress-method-47 - arg0 - arg1 - (!= (-> this current-index) 0.0) - (!= (-> this current-index) (the float (+ (-> *menu-secrets-array* length) -1))) + (progress-method-34 arg0) + (let ((s3-4 *progress-work*)) + (draw-header arg0 arg1 sv-16 (text-id progress-secrets)) + (draw-bg-box-outline arg0 (-> s3-4 sub-header) (* 128.0 sv-16)) + (draw-bg-box-alpha-2 arg0 (-> s3-4 footer) (* 64.0 sv-16)) + (draw-bg-box-outline arg0 (-> s3-4 footer) (* 128.0 sv-16)) + ) + (progress-method-47 + arg0 + arg1 + (!= (-> this current-index) 0.0) + (!= (-> this current-index) (the float (+ (-> *menu-secrets-array* length) -1))) + ) ) ) ) @@ -4933,7 +4543,3 @@ 0 (none) ) - - - - diff --git a/test/decompiler/reference/jak3/engine/ui/progress/progress_REF.gc b/test/decompiler/reference/jak3/engine/ui/progress/progress_REF.gc index 0062369b38..c3c3e67921 100644 --- a/test/decompiler/reference/jak3/engine/ui/progress/progress_REF.gc +++ b/test/decompiler/reference/jak3/engine/ui/progress/progress_REF.gc @@ -1484,23 +1484,22 @@ ;; WARN: Stack slot offset 212 signed mismatch ;; WARN: Return type mismatch int vs none. (defbehavior progress-post progress () - (local-vars (sv-208 font-context) (sv-212 int) (sv-216 hud-box) (sv-220 symbol)) (when (-> self current-options) (set-selected-color self) (set! (-> self scissor-count) -1) (progress-method-33 self (-> *progress-work* full-screen)) - (let ((gp-0 (-> self current-options options))) - (let ((s3-0 (-> self current-options y-center)) - (s5-0 (-> self current-options y-space)) + (let ((gp-0 (-> self current-options options)) + (s3-0 (-> self current-options y-center)) + (s5-0 (-> self current-options y-space)) + (s2-0 (new-stack-matrix0)) + (s4-0 *progress-work*) + ) + (mem-copy! (the-as pointer s2-0) (the-as pointer *font-default-matrix*) 64) + (let ((sv-208 (new 'stack 'font-context s2-0 0 0 0.0 (font-color default) (font-flags shadow kerning))) + (sv-212 (- s3-0 (/ (* s5-0 (length gp-0)) 2))) + (sv-216 (new 'stack-no-clear 'hud-box)) ) - (let ((s2-0 (new-stack-matrix0)) - (s4-0 *progress-work*) - ) - (mem-copy! (the-as pointer s2-0) (the-as pointer *font-default-matrix*) 64) - (set! sv-208 (new 'stack 'font-context s2-0 0 0 0.0 (font-color default) (font-flags shadow kerning))) - (set! sv-212 (- s3-0 (/ (* s5-0 (length gp-0)) 2))) - (set! sv-216 (new 'stack-no-clear 'hud-box)) - (set! sv-220 (and (!= (-> self current) 'main) (or (= (-> self next) 'none) (> (-> self state-pos) 0)))) + (let ((sv-220 (and (!= (-> self current) 'main) (or (= (-> self next) 'none) (> (-> self state-pos) 0))))) (progress-method-33 self (-> s4-0 small-screen)) (when sv-220 (begin-scan sv-216 self) @@ -1511,47 +1510,47 @@ ) ) ) - ) - (if (or (= (-> self current-options) *title*) (= (-> self current-options) *options-options*)) - (+ s5-0 20) + (if (or (= (-> self current-options) *title*) (= (-> self current-options) *options-options*)) + (+ s5-0 20) + ) + (dotimes (s5-1 (length gp-0)) + (set! (-> self current-index) s5-1) + (set-scale! sv-208 0.5) + (set! (-> sv-208 origin x) 70.0) + (set! (-> sv-208 origin y) (the float sv-212)) + (set-width! sv-208 375) + (set-height! sv-208 30) + (set! (-> sv-208 flags) (font-flags kerning middle middle-vert large)) + (let ((v1-51 sv-208)) + (set! (-> v1-51 color) (if (and (= s5-1 (-> self option-index)) (= (-> self menu-transition) 0.0)) + (font-color font-color-33) + (font-color font-color-32) + ) + ) + ) + (draw-option + (-> gp-0 s5-1) + self + sv-208 + s5-1 + (and (= (-> self menu-transition) 0.0) (-> self selected-option) (= s5-1 (-> self option-index))) + ) ) - ) - (dotimes (s5-1 (length gp-0)) - (set! (-> self current-index) s5-1) - (set-scale! sv-208 0.5) - (set! (-> sv-208 origin x) 70.0) - (set! (-> sv-208 origin y) (the float sv-212)) - (set-width! sv-208 375) - (set-height! sv-208 30) - (set! (-> sv-208 flags) (font-flags kerning middle middle-vert large)) - (let ((v1-51 sv-208)) - (set! (-> v1-51 color) (if (and (= s5-1 (-> self option-index)) (= (-> self menu-transition) 0.0)) - (font-color font-color-33) - (font-color font-color-32) - ) - ) - ) - (draw-option - (-> gp-0 s5-1) - self - sv-208 - s5-1 - (and (= (-> self menu-transition) 0.0) (-> self selected-option) (= s5-1 (-> self option-index))) + (if sv-220 + (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) + ) + ) + ) ) + (progress-method-34 self) + (end-scan sv-216 (-> self scanlines-alpha)) ) ) - (if sv-220 - (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) - ) - ) - ) - (progress-method-34 self) - (end-scan sv-216 (-> self scanlines-alpha)) ) (when (and (< 0.8 (-> self anim-frame)) (or (= (-> self current) 'bigmap) (= (-> self next) 'bigmap))) (progress-method-33 self (-> *progress-work* full-screen)) diff --git a/test/decompiler/reference/jak3/engine/ui/text_REF.gc b/test/decompiler/reference/jak3/engine/ui/text_REF.gc index 19af44fb58..0f1d200f88 100644 --- a/test/decompiler/reference/jak3/engine/ui/text_REF.gc +++ b/test/decompiler/reference/jak3/engine/ui/text_REF.gc @@ -250,74 +250,76 @@ ;; definition for function load-game-text-info ;; WARN: Found some very strange gotos. Check result carefully, this is not well tested. (defun load-game-text-info ((arg0 string) (arg1 (pointer object)) (arg2 kheap)) - (local-vars (v0-4 int) (sv-16 object) (sv-20 int) (sv-24 int) (sv-32 int)) - (set! sv-16 (-> arg1 0)) - (set! sv-20 (the-as int (-> *setting-control* user-current language))) - (set! sv-24 0) - (set! sv-32 (&- (-> arg2 top) (the-as uint (-> arg2 base)))) - (if (and (= (scf-get-territory) 1) (= sv-20 (language-enum english)) (not (demo?))) - (set! sv-20 11) - ) - (when (and (or (= sv-16 #f) - (!= (-> (the-as game-text-info sv-16) language-id) sv-20) - (not (string= (-> (the-as game-text-info sv-16) group-name) arg0)) - ) - (not (load-in-progress? *level*)) - ) - (let ((v1-19 arg2)) - (set! (-> v1-19 current) (-> v1-19 base)) - ) - (b! #t cfg-21 :delay (nop!)) - (label cfg-20) - (set! v0-4 0) - (b! #t cfg-34 :delay (nop!)) - (label cfg-21) - (let ((s3-0 str-load)) - (format (clear *temp-string*) "~D~S.TXT" sv-20 arg0) - (b! - (not (s3-0 - *temp-string* - -1 - (logand -64 (&+ (-> arg2 current) 63)) - (&- (-> arg2 top) (the-as uint (-> arg2 current))) + (local-vars (v0-4 int)) + (let ((sv-16 (-> arg1 0)) + (sv-20 (the-as int (-> *setting-control* user-current language))) + (sv-24 0) + (sv-32 (&- (-> arg2 top) (the-as uint (-> arg2 base)))) + ) + (if (and (= (scf-get-territory) 1) (= (the-as language-enum sv-20) (language-enum english)) (not (demo?))) + (set! sv-20 11) + ) + (when (and (or (= sv-16 #f) + (!= (-> (the-as game-text-info sv-16) language-id) sv-20) + (not (string= (-> (the-as game-text-info sv-16) group-name) arg0)) + ) + (not (load-in-progress? *level*)) ) - ) - cfg-20 - :delay (nop!) + (let ((v1-19 arg2)) + (set! (-> v1-19 current) (-> v1-19 base)) ) - ) - (label cfg-23) - (let ((v1-23 (str-load-status (the-as (pointer int32) (& sv-24))))) - (cond - ((= v1-23 'error) - (format 0 "Error loading text~%") - (return 0) - ) - ((>= sv-24 (+ sv-32 -300)) - (format 0 "Game text heap overrun!~%") - (return 0) - ) - ((= v1-23 'busy) - (nop!) - (nop!) - (nop!) - (nop!) - (nop!) - (nop!) - (goto cfg-23) - ) - ) - ) - (let ((s2-1 (logand -64 (&+ (-> arg2 current) 63)))) - (flush-cache 0) - (let ((s3-1 link)) + (b! #t cfg-21 :delay (nop!)) + (label cfg-20) + (set! v0-4 0) + (b! #t cfg-34 :delay (nop!)) + (label cfg-21) + (let ((s3-0 str-load)) (format (clear *temp-string*) "~D~S.TXT" sv-20 arg0) - (set! (-> arg1 0) (s3-1 s2-1 (-> *temp-string* data) sv-24 arg2 0)) + (b! + (not (s3-0 + *temp-string* + -1 + (logand -64 (&+ (-> arg2 current) 63)) + (&- (-> arg2 top) (the-as uint (-> arg2 current))) + ) + ) + cfg-20 + :delay (nop!) + ) ) + (label cfg-23) + (let ((v1-23 (str-load-status (the-as (pointer int32) (& sv-24))))) + (cond + ((= v1-23 'error) + (format 0 "Error loading text~%") + (return 0) + ) + ((>= sv-24 (+ sv-32 -300)) + (format 0 "Game text heap overrun!~%") + (return 0) + ) + ((= v1-23 'busy) + (nop!) + (nop!) + (nop!) + (nop!) + (nop!) + (nop!) + (goto cfg-23) + ) + ) + ) + (let ((s2-1 (logand -64 (&+ (-> arg2 current) 63)))) + (flush-cache 0) + (let ((s3-1 link)) + (format (clear *temp-string*) "~D~S.TXT" sv-20 arg0) + (set! (-> arg1 0) (s3-1 s2-1 (-> *temp-string* data) sv-24 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-4 0) (label cfg-34) @@ -416,182 +418,173 @@ ;; definition for function print-game-text (defun print-game-text ((arg0 string) (arg1 font-context) (arg2 symbol) (arg3 int) (arg4 bucket-id)) - (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)) - (set-context! *font-work* arg1) - (set! (-> arg1 max-x) sv-16) - (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 hud-draw-hud-alpha))))) - ) + (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) + (set-context! *font-work* arg1) + (set! (-> arg1 max-x) sv-16) + (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 hud-draw-hud-alpha))))) + ) + ) + ) + (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)) - ) - ((or (= sv-72 32) (= sv-72 47) (and (= sv-72 45) (!= (-> sv-32 -1) 126))) - (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 (-> (get-string-length *game-text-word* arg1) length))) - (let ((f0-27 (+ f30-1 (the float sv-120)))) - (if (= (-> *game-text-word* data (+ sv-80 -1)) 32) - (set! f0-27 (- f0-27 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 + ) + ((or (= sv-72 32) (= sv-72 47) (and (= sv-72 45) (!= (-> sv-32 -1) 126))) + (set! (-> *game-text-word* data sv-80) sv-72) + (+! sv-80 1) + #t + ) + (else + (cond + ((zero? sv-72) + (if (nonzero? sv-80) + (set! sv-108 #t) + ) + (+! sv-112 1) + ) + ((and (= sv-72 92) (= sv-104 92)) + (set! sv-32 (&-> sv-32 1)) + (if (nonzero? sv-80) + (set! sv-108 #t) + ) + (+! 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)) + (+! 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 (-> (get-string-length *game-text-word* arg1) length))) + (let ((f0-27 (+ f30-1 (the float sv-120)))) + (if (= (-> *game-text-word* data (+ sv-80 -1)) 32) + (set! f0-27 (- f0-27 sv-52)) + ) + (cond + ((< sv-44 f0-27) + (set! (-> arg1 max-x) (fmax (-> arg1 max-x) sv-36)) + (+! 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! (-> arg1 max-x) (fmax (-> arg1 max-x) sv-36)) + (set! sv-108 (the-as symbol #f)) + ) + ) + ) ) - (cond - ((< sv-44 f0-27) - (set! (-> arg1 max-x) (fmax (-> arg1 max-x) sv-36)) - (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 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! (-> arg1 max-x) (fmax (-> arg1 max-x) sv-36)) (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 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/jak3/engine/util/profile_REF.gc b/test/decompiler/reference/jak3/engine/util/profile_REF.gc index dba2927624..6ebd910727 100644 --- a/test/decompiler/reference/jak3/engine/util/profile_REF.gc +++ b/test/decompiler/reference/jak3/engine/util/profile_REF.gc @@ -815,7 +815,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)) @@ -893,12 +892,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 @@ -944,12 +938,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/jak3/engine/util/sync-info_REF.gc b/test/decompiler/reference/jak3/engine/util/sync-info_REF.gc index 9eb672d17e..e58ce5ea66 100644 --- a/test/decompiler/reference/jak3/engine/util/sync-info_REF.gc +++ b/test/decompiler/reference/jak3/engine/util/sync-info_REF.gc @@ -67,7 +67,6 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch float vs none. (defmethod initialize! ((this sync-linear) (arg0 sync-info-params)) - (local-vars (sv-16 res-tag)) (if (!= (-> arg0 sync-type) 'sync-linear) (format 0 @@ -81,8 +80,9 @@ ) (let ((a0-3 (-> arg0 entity))) (when a0-3 - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-6 (res-lump-data a0-3 'sync (pointer float) :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-6 (res-lump-data a0-3 'sync (pointer float) :tag-ptr (& sv-16))) + ) (when v1-6 (set! s4-0 (the int (* 300.0 (-> v1-6 0)))) (set! f30-0 (-> v1-6 1)) @@ -138,7 +138,6 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch float vs none. (defmethod initialize! ((this sync-eased) (arg0 sync-info-params)) - (local-vars (sv-16 res-tag)) (if (!= (-> arg0 sync-type) 'sync-eased) (format 0 @@ -156,8 +155,9 @@ ) (let ((a0-3 (-> arg0 entity))) (when a0-3 - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-6 (res-lump-data a0-3 'sync (pointer float) :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-6 (res-lump-data 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)) @@ -219,7 +219,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)) @@ -271,14 +271,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))) ) ) ) @@ -310,7 +310,6 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch float vs none. (defmethod initialize! ((this sync-paused) (arg0 sync-info-params)) - (local-vars (sv-16 res-tag)) (if (!= (-> arg0 sync-type) 'sync-paused) (format 0 @@ -326,8 +325,9 @@ ) (let ((a0-3 (-> arg0 entity))) (when a0-3 - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-6 (res-lump-data a0-3 'sync (pointer float) :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-6 (res-lump-data 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/jak3/levels/city/blow-tower/blow-tower-obs2_REF.gc b/test/decompiler/reference/jak3/levels/city/blow-tower/blow-tower-obs2_REF.gc index b3b9697452..59bf4cda5d 100644 --- a/test/decompiler/reference/jak3/levels/city/blow-tower/blow-tower-obs2_REF.gc +++ b/test/decompiler/reference/jak3/levels/city/blow-tower/blow-tower-obs2_REF.gc @@ -283,20 +283,23 @@ ;; definition for method 34 of type bt-roboguard ;; WARN: Return type mismatch int vs none. (defmethod blow-tower-enemy-method-34 ((this bt-roboguard)) - (local-vars (sv-16 int) (sv-24 time-frame)) (bt-roboguard-method-46 this) - (set! sv-16 (the-as int (- (-> this path-clock-time) (-> this active-clock-time)))) - (set! sv-24 (- (-> *blow-tower-targets* mission-time) (-> this active-clock-time))) - (cond - ((= (-> this focus) (-> *blow-tower-targets* pickup)) - (set! sv-16 (max 750 sv-16)) - ) - (else - (set! sv-16 (max 450 sv-16)) - (set! sv-16 (the int (* 0.75 (the float sv-16)))) - ) + (let ((sv-16 (the-as int (- (-> this path-clock-time) (-> this active-clock-time)))) + (sv-24 (- (-> *blow-tower-targets* mission-time) (-> this active-clock-time))) + ) + (set! sv-16 (cond + ((= (-> this focus) (-> *blow-tower-targets* pickup)) + (set! sv-16 (max 750 (the-as time-frame sv-16))) + sv-16 + ) + (else + (set! sv-16 (max 450 (the-as time-frame sv-16))) + (the int (* 0.75 (the float sv-16))) + ) + ) + ) + (set! (-> this difficulty) (fmax 0.0 (fmin 1.0 (/ (the float sv-24) (the float sv-16))))) ) - (set! (-> this difficulty) (fmax 0.0 (fmin 1.0 (/ (the float sv-24) (the float sv-16))))) (cond ((= (-> this focus) (-> *blow-tower-targets* pickup)) (set! (-> this difficulty) (* (-> this difficulty) (-> this difficulty))) @@ -1509,10 +1512,9 @@ ) (let ((f0-15 f30-0)) 0.0 - (let* ((f0-16 (evaluate *grunt-jump-curve* f0-15 (loop-behavior use-default))) - (f0-17 (* f0-16 f0-16)) + (let* ((f0-17 (square (evaluate *grunt-jump-curve* f0-15 (loop-behavior use-default)))) (f0-18 (lerp (-> this jump-height-percentage-start) (-> this jump-height-percentage-end) f0-17)) - (f0-20 (- (* 2.0 f0-18) (* f0-18 f0-18))) + (f0-20 (- (* 2.0 f0-18) (square f0-18))) (f0-21 (* (-> this apex-height) f0-20)) ) (set! (-> this root trans y) (+ (-> this jump-start-pos y) f0-21)) @@ -1625,7 +1627,7 @@ ((< 0.0 f1-1) (set! (-> this jump-height-percentage-start) 0.0) (set! (-> this jump-height-percentage-end) - (/ (- (- f3-2) (sqrtf (- (* f3-2 f3-2) (* 4.0 f2-4 f0-5)))) (* 2.0 f0-5)) + (/ (- (- f3-2) (sqrtf (- (square f3-2) (* 4.0 f2-4 f0-5)))) (* 2.0 f0-5)) ) ) (else @@ -1634,7 +1636,7 @@ (set! (-> this jump-start-pos y) f1-5) ) (set! (-> this jump-height-percentage-start) - (/ (+ (- f3-2) (sqrtf (- (* f3-2 f3-2) (* 4.0 f2-4 f0-5)))) (* 2.0 f0-5)) + (/ (+ (- f3-2) (sqrtf (- (square f3-2) (* 4.0 f2-4 f0-5)))) (* 2.0 f0-5)) ) (set! (-> this jump-height-percentage-end) 2.0) ) @@ -2607,7 +2609,7 @@ (set! (-> this bob-xform root trans quad) (-> v1-42 quad)) ) (when (= (-> this target) (-> *blow-tower-targets* hellcat)) - (let ((f0-26 (- 1.0 (* f30-0 f30-0)))) + (let ((f0-26 (- 1.0 (square f30-0)))) (vector-float*! (the-as vector (-> this bob-xform)) (the-as vector (-> this bob-xform)) 2.0) (vector-float*! (the-as vector (-> this bob-xform)) (the-as vector (-> this bob-xform)) f0-26) ) @@ -2872,70 +2874,64 @@ (s5-0 (-> this main-joint-movement 2)) (s3-0 (lambda ((arg0 bt-mh-flyer) (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))) - 0.75 - (quaternion-rotate-local-z! sv-208 a1-3 sv-192) - (quaternion->matrix s5-0 sv-208) - (vector-copy! s2-1 (-> arg0 root scale)) - (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 (* 1638400.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))) + (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)) + ) + 0.75 + (quaternion-rotate-local-z! sv-208 a1-3 sv-192) + (quaternion->matrix s5-0 sv-208) + (vector-copy! s2-1 (-> arg0 root scale)) + (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 (* 1638400.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) ) - (set! (-> *part-id-table* 4817 init-specs 4 initial-valuef) (* f20-0 f2-6)) - (set! (-> *part-id-table* 4817 init-specs 5 initial-valuef) (* f26-0 f0-15)) - (set! (-> *part-id-table* 4821 init-specs 3 initial-valuef) (* f22-0 f2-6)) - (set! (-> *part-id-table* 4818 init-specs 1 initial-valuef) (* f24-0 f0-15)) - (set! (-> *part-id-table* 4819 init-specs 1 initial-valuef) (* f1-10 f0-15)) - (set! (-> *part-id-table* 4820 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 uvec) (* 0.3 f0-16)) ) + ) + (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* 4817 init-specs 4 initial-valuef) (* f20-0 f2-6)) + (set! (-> *part-id-table* 4817 init-specs 5 initial-valuef) (* f26-0 f0-15)) + (set! (-> *part-id-table* 4821 init-specs 3 initial-valuef) (* f22-0 f2-6)) + (set! (-> *part-id-table* 4818 init-specs 1 initial-valuef) (* f24-0 f0-15)) + (set! (-> *part-id-table* 4819 init-specs 1 initial-valuef) (* f1-10 f0-15)) + (set! (-> *part-id-table* 4820 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 uvec) (* 0.3 f0-16)) ) ) - (vector-copy! (-> s5-0 trans) s4-0) - (spawn-from-mat (-> arg0 engine-part) s5-0) - (lerp-scale 0.75 1.0 f28-0 1638.4 f30-0) ) ) + (vector-copy! (-> s5-0 trans) s4-0) + (spawn-from-mat (-> arg0 engine-part) s5-0) + (lerp-scale 0.75 1.0 f28-0 1638.4 f30-0) ) ) 0 @@ -3054,30 +3050,29 @@ ;; definition for function kg-bombbot-find-nearest-nav-mesh (defun kg-bombbot-find-nearest-nav-mesh ((arg0 kg-bombbot) (arg1 float)) - (local-vars (sv-64 nav-poly) (sv-68 nav-mesh) (sv-72 float) (sv-76 kg-bombbot)) - (set! sv-64 (new 'stack-no-clear 'nav-poly)) - (set! sv-68 (the-as nav-mesh #f)) - (set! sv-72 arg1) - (set! sv-76 arg0) - (set! (-> sv-64 data 20) (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 vertex 0) (the-as vector sv-76) (the-as vector (-> s3-0 bounds))) - (let ((f0-1 (vector-length-squared (-> sv-64 vertex 0))) - (f1-0 (-> s3-0 bounds r)) - ) - (when (< f0-1 (* f1-0 f1-0)) - (set! (-> sv-64 vertex1 x) 4096.0) - (nav-mesh-method-46 s3-0 sv-64) - (when (>= sv-72 (-> sv-64 vertex1 w)) - (set! sv-72 (-> sv-64 vertex1 w)) - (set! sv-68 s3-0) + (let ((sv-64 (new 'stack-no-clear 'nav-poly)) + (sv-68 (the-as nav-mesh #f)) + ) + (let ((sv-72 arg1) + (sv-76 arg0) + ) + (set! (-> sv-64 data 20) (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 vertex 0) (the-as vector sv-76) (the-as vector (-> s3-0 bounds))) + (when (< (vector-length-squared (-> sv-64 vertex 0)) (square (-> s3-0 bounds r))) + (set! (-> sv-64 vertex1 x) 4096.0) + (nav-mesh-method-46 s3-0 sv-64) + (when (>= sv-72 (-> sv-64 vertex1 w)) + (set! sv-72 (-> sv-64 vertex1 w)) + (set! sv-68 s3-0) + ) ) ) ) @@ -3088,8 +3083,8 @@ ) ) ) + sv-68 ) - sv-68 ) ;; definition for method 205 of type kg-bombbot diff --git a/test/decompiler/reference/jak3/levels/city/blow-tower/blow-tower-obs_REF.gc b/test/decompiler/reference/jak3/levels/city/blow-tower/blow-tower-obs_REF.gc index ed834a2064..3d7e5f1e60 100644 --- a/test/decompiler/reference/jak3/levels/city/blow-tower/blow-tower-obs_REF.gc +++ b/test/decompiler/reference/jak3/levels/city/blow-tower/blow-tower-obs_REF.gc @@ -743,7 +743,7 @@ ;; ERROR: Unsupported inline assembly instruction kind - [madda.s f1, f4] ;; ERROR: Unsupported inline assembly instruction kind - [madd.s f0, f2, f5] (defmethod tower-flyer-method-47 ((this tower-flyer) (arg0 vector) (arg1 quaternion) (arg2 vector)) - (local-vars (f0-10 float) (sv-208 vector)) + (local-vars (f0-10 float)) (with-pp (rlet ((vf0 :class vf) (vf4 :class vf) @@ -776,41 +776,33 @@ ) (let ((s1-2 (vector-! (new 'stack-no-clear 'vector) arg0 s2-0))) 0.0 - (set! sv-208 (new 'stack-no-clear 'vector)) - (let ((v1-19 s2-0) - (a0-11 (-> this basetrans)) - ) - (.lvf vf4 (&-> v1-19 quad)) - (.lvf vf5 (&-> a0-11 quad)) - ) - (.mov.vf.w vf6 vf0) - (.sub.vf.xyz vf6 vf4 vf5) - (.svf (&-> sv-208 quad) vf6) - 0.0 - (let ((s2-1 (new 'stack-no-clear 'vector))) - (let ((s0-0 (new 'stack-no-clear 'vector))) - (vector-normalize-ret-len! s1-2 1.0) - (let* ((v1-21 s1-2) - (f0-9 (-> sv-208 x)) - (f1-2 (-> sv-208 y)) - (f2-0 (-> sv-208 z)) - (f3-0 (-> v1-21 x)) - (f4-0 (-> v1-21 y)) - (f5-0 (-> v1-21 z)) - ) - (.mula.s f0-9 f3-0) - (.madda.s f1-2 f4-0) - (.madd.s f0-10 f2-0 f5-0) - ) - (let ((f0-11 f0-10)) - (vector+float*! s2-1 (-> this basetrans) s1-2 f0-11) - ) - (compute-tower-flyer-lerp-point this s0-0 arg0 s2-1 (* f30-0 (seconds-per-frame))) + (let ((sv-208 (new 'stack-no-clear 'vector))) + (let ((v1-19 s2-0) + (a0-11 (-> this basetrans)) + ) + (.lvf vf4 (&-> v1-19 quad)) + (.lvf vf5 (&-> a0-11 quad)) ) - (set! *current-color* *color-white*) - (when (= (tower-fly-quick-raycast (-> this basetrans) s3-1 (new 'stack-no-clear 'vector) 2048.0) -100000000.0) - (vector-copy! arg2 s2-1) - (return #t) + (.mov.vf.w vf6 vf0) + (.sub.vf.xyz vf6 vf4 vf5) + (.svf (&-> sv-208 quad) vf6) + 0.0 + (let ((s2-1 (new 'stack-no-clear 'vector))) + (let ((s0-0 (new 'stack-no-clear 'vector))) + (vector-normalize-ret-len! s1-2 1.0) + (let* ((v1-21 s1-2)) + (set! f0-10 (vector-dot sv-208 v1-21)) + ) + (let ((f0-11 f0-10)) + (vector+float*! s2-1 (-> this basetrans) s1-2 f0-11) + ) + (compute-tower-flyer-lerp-point this s0-0 arg0 s2-1 (* f30-0 (seconds-per-frame))) + ) + (set! *current-color* *color-white*) + (when (= (tower-fly-quick-raycast (-> this basetrans) s3-1 (new 'stack-no-clear 'vector) 2048.0) -100000000.0) + (vector-copy! arg2 s2-1) + (return #t) + ) ) ) ) @@ -855,73 +847,74 @@ ;; definition for method 49 of type tower-flyer ;; INFO: Used lq/sq (defmethod tower-flyer-method-49 ((this tower-flyer) (arg0 vector) (arg1 quaternion)) - (local-vars (sv-608 collide-query) (sv-612 vector) (sv-616 symbol)) (let ((s4-0 (new 'stack-no-clear 'vector))) (let ((s2-0 (new 'stack-no-clear 'vector))) - (set! sv-608 (new 'stack-no-clear 'collide-query)) - (set! sv-612 (vector-z-quaternion! (new 'stack-no-clear 'vector) arg1)) - (set! sv-616 #t) - (vector-copy! (-> sv-608 start-pos) arg0) - (vector-float*! (-> sv-608 move-dist) sv-612 (+ 16384.0 (-> this desired-z-dist))) - (let ((v1-7 sv-608)) - (set! (-> v1-7 radius) 4096.0) - (set! (-> v1-7 collide-with) (collide-spec backgnd)) - (set! (-> v1-7 ignore-process0) #f) - (set! (-> v1-7 ignore-process1) #f) - (set! (-> v1-7 ignore-pat) - (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) - ) - (set! (-> v1-7 action-mask) (collide-action solid)) - ) - (let ((f0-3 (fill-and-probe-using-line-sphere *collide-cache* sv-608))) - (cond - ((>= f0-3 0.0) - (vector-float*! (-> sv-608 move-dist) (-> sv-608 move-dist) f0-3) - (let ((v1-15 (vector-! (new 'stack-no-clear 'vector) (-> this basetrans) arg0)) - (a1-5 (new 'stack-no-clear 'collide-query)) - ) - 0.0 - (let ((f30-0 (vector-length (-> sv-608 move-dist))) - (f28-0 (vector-dot v1-15 sv-612)) + (let ((sv-608 (new 'stack-no-clear 'collide-query)) + (sv-612 (vector-z-quaternion! (new 'stack-no-clear 'vector) arg1)) + (sv-616 #t) + ) + (vector-copy! (-> sv-608 start-pos) arg0) + (vector-float*! (-> sv-608 move-dist) sv-612 (+ 16384.0 (-> this desired-z-dist))) + (let ((v1-7 sv-608)) + (set! (-> v1-7 radius) 4096.0) + (set! (-> v1-7 collide-with) (collide-spec backgnd)) + (set! (-> v1-7 ignore-process0) #f) + (set! (-> v1-7 ignore-process1) #f) + (set! (-> v1-7 ignore-pat) + (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) + ) + (set! (-> v1-7 action-mask) (collide-action solid)) + ) + (let ((f0-3 (fill-and-probe-using-line-sphere *collide-cache* sv-608))) + (cond + ((>= f0-3 0.0) + (vector-float*! (-> sv-608 move-dist) (-> sv-608 move-dist) f0-3) + (let ((v1-15 (vector-! (new 'stack-no-clear 'vector) (-> this basetrans) arg0)) + (a1-5 (new 'stack-no-clear 'collide-query)) ) - (vector+float*! s4-0 arg0 sv-612 f28-0) - (vector-copy! (-> a1-5 start-pos) (-> this basetrans)) - (vector-! (-> a1-5 move-dist) s4-0 (-> a1-5 start-pos)) - (let ((v1-21 a1-5)) - (set! (-> v1-21 radius) 40.96) - (set! (-> v1-21 collide-with) (collide-spec backgnd)) - (set! (-> v1-21 ignore-process0) #f) - (set! (-> v1-21 ignore-process1) #f) - (set! (-> v1-21 ignore-pat) - (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) - ) - (set! (-> v1-21 action-mask) (collide-action solid)) - ) - (cond - ((or (>= (fill-and-probe-using-line-sphere *collide-cache* a1-5) 0.0) (>= (+ 6144.0 f30-0) f28-0)) - (set! (-> this use-z-dist) (fmin (+ -8192.0 f30-0) (-> this desired-z-dist))) - (set! (-> this current-z-dist) (fmin (-> this current-z-dist) f30-0)) - (seek! (-> this current-z-dist) (-> this use-z-dist) (* 61440.0 (seconds-per-frame))) - (set-time! (-> this last-wall-clip-time)) - ) - (else - (set! (-> this current-z-dist) f28-0) - (set-time! (-> this last-wall-clip-time)) - (set! sv-616 (the-as symbol #f)) + 0.0 + (let ((f30-0 (vector-length (-> sv-608 move-dist))) + (f28-0 (vector-dot v1-15 sv-612)) + ) + (vector+float*! s4-0 arg0 sv-612 f28-0) + (vector-copy! (-> a1-5 start-pos) (-> this basetrans)) + (vector-! (-> a1-5 move-dist) s4-0 (-> a1-5 start-pos)) + (let ((v1-21 a1-5)) + (set! (-> v1-21 radius) 40.96) + (set! (-> v1-21 collide-with) (collide-spec backgnd)) + (set! (-> v1-21 ignore-process0) #f) + (set! (-> v1-21 ignore-process1) #f) + (set! (-> v1-21 ignore-pat) + (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) + ) + (set! (-> v1-21 action-mask) (collide-action solid)) + ) + (cond + ((or (>= (fill-and-probe-using-line-sphere *collide-cache* a1-5) 0.0) (>= (+ 6144.0 f30-0) f28-0)) + (set! (-> this use-z-dist) (fmin (+ -8192.0 f30-0) (-> this desired-z-dist))) + (set! (-> this current-z-dist) (fmin (-> this current-z-dist) f30-0)) + (seek! (-> this current-z-dist) (-> this use-z-dist) (* 61440.0 (seconds-per-frame))) + (set-time! (-> this last-wall-clip-time)) + ) + (else + (set! (-> this current-z-dist) f28-0) + (set-time! (-> this last-wall-clip-time)) + (set! sv-616 (the-as symbol #f)) + ) ) ) ) ) - ) - ((time-elapsed? (-> this last-wall-clip-time) (seconds 1)) - (seek! (-> this current-z-dist) (-> this use-z-dist) (* 20480.0 (seconds-per-frame))) - (seek! (-> this use-z-dist) (-> this desired-z-dist) (* 8192.0 (seconds-per-frame))) - ) + ((time-elapsed? (-> this last-wall-clip-time) (seconds 1)) + (seek! (-> this current-z-dist) (-> this use-z-dist) (* 20480.0 (seconds-per-frame))) + (seek! (-> this use-z-dist) (-> this desired-z-dist) (* 8192.0 (seconds-per-frame))) + ) + ) + ) + (when sv-616 + (vector-normalize! (-> sv-608 move-dist) (-> this current-z-dist)) + (vector+! s4-0 arg0 (-> sv-608 move-dist)) ) - ) - (when sv-616 - (vector-normalize! (-> sv-608 move-dist) (-> this current-z-dist)) - (vector+! s4-0 arg0 (-> sv-608 move-dist)) ) (vector-! s2-0 s4-0 arg0) (let ((a0-36 (vector-! (new 'stack-no-clear 'vector) s2-0 (-> this local-offset)))) @@ -1913,26 +1906,27 @@ ;; definition for function bt-barrel-ground-probe ;; INFO: Used lq/sq (defun bt-barrel-ground-probe ((arg0 vector)) - (local-vars (sv-560 collide-query) (sv-564 vector)) - (set! sv-560 (new 'stack-no-clear 'collide-query)) - (set! sv-564 arg0) - (vector+float*! (-> sv-560 start-pos) sv-564 *up-vector* 24576.0) - (set! (-> sv-560 move-dist quad) (the-as uint128 0)) - (set! (-> sv-560 move-dist y) -81920.0) - (let ((v1-8 sv-560)) - (set! (-> v1-8 radius) 409.6) - (set! (-> v1-8 collide-with) (collide-spec backgnd)) - (set! (-> v1-8 ignore-process0) #f) - (set! (-> v1-8 ignore-process1) #f) - (set! (-> v1-8 ignore-pat) - (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) - ) - (set! (-> v1-8 action-mask) (collide-action solid)) - ) - (when (>= (fill-and-probe-using-line-sphere *collide-cache* sv-560) 0.0) - (if (< (fabs (- (-> sv-560 best-other-tri intersect y) (-> arg0 y))) 24576.0) - (set! (-> sv-564 y) (fmax 0.0 (+ 12697.6 (-> sv-560 best-other-tri intersect y)))) + (let ((sv-560 (new 'stack-no-clear 'collide-query)) + (sv-564 arg0) ) + (vector+float*! (-> sv-560 start-pos) sv-564 *up-vector* 24576.0) + (set! (-> sv-560 move-dist quad) (the-as uint128 0)) + (set! (-> sv-560 move-dist y) -81920.0) + (let ((v1-8 sv-560)) + (set! (-> v1-8 radius) 409.6) + (set! (-> v1-8 collide-with) (collide-spec backgnd)) + (set! (-> v1-8 ignore-process0) #f) + (set! (-> v1-8 ignore-process1) #f) + (set! (-> v1-8 ignore-pat) + (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) + ) + (set! (-> v1-8 action-mask) (collide-action solid)) + ) + (when (>= (fill-and-probe-using-line-sphere *collide-cache* sv-560) 0.0) + (if (< (fabs (- (-> sv-560 best-other-tri intersect y) (-> arg0 y))) 24576.0) + (set! (-> sv-564 y) (fmax 0.0 (+ 12697.6 (-> sv-560 best-other-tri intersect y)))) + ) + ) ) ) @@ -1940,56 +1934,59 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch symbol vs none. (defbehavior setup-bt-barrels bt-barrel-stack ((arg0 int) (arg1 int) (arg2 float) (arg3 float)) - (local-vars (sv-48 vector) (sv-52 vector) (sv-80 vector) (sv-84 float) (sv-112 process) (sv-128 vector)) - (set! sv-48 (vector-z-quaternion! (new 'stack-no-clear 'vector) (-> self root quat))) - (let ((v1-1 (new 'stack-no-clear 'vector))) - (vector-copy! v1-1 (-> self root trans)) - (set! sv-52 v1-1) - ) - (let ((a0-5 sv-48)) - (vector-copy! a0-5 sv-48) - (set! (-> a0-5 y) 0.0) - (vector-normalize! a0-5 1.0) - ) - (dotimes (s2-0 arg0) - (let ((v1-4 (new 'stack-no-clear 'vector))) - (vector-copy! v1-4 sv-52) - (set! sv-80 v1-4) - ) - (let* ((f30-0 (- (/ arg2 2))) - (v1-6 (/ (the-as int (rand-uint31-gen *random-generator*)) 256)) - (v1-7 (the-as number (logior #x3f800000 v1-6))) - ) - (set! sv-84 (+ f30-0 (* (+ -1.0 (the-as float v1-7)) (+ (/ arg2 2) (/ arg2 2))))) - ) - (vector+float*! sv-80 sv-80 (vector-cross! (new 'stack-no-clear 'vector) sv-48 *up-vector*) (* sv-84 arg3)) - (bt-barrel-ground-probe sv-80) - (dotimes (s1-0 arg1) - (let ((s0-0 (handle->process (-> *blow-tower-targets* hellcat)))) - (set! sv-112 (get-process *default-dead-pool* bt-barrel #x4000 1)) - (when sv-112 - (let ((t9-5 (method-of-type bt-barrel activate))) - (t9-5 (the-as bt-barrel sv-112) s0-0 "bt-barrel" (the-as pointer #x70004000)) - ) - (run-now-in-process sv-112 bt-barrel-init-by-other sv-80) - (-> sv-112 ppointer) - ) + (let ((sv-48 (vector-z-quaternion! (new 'stack-no-clear 'vector) (-> self root quat))) + (v1-1 (new 'stack-no-clear 'vector)) ) - ) - (suspend) - 0 - (vector+float*! sv-52 sv-52 sv-48 arg2) - (let ((s1-1 sv-52) - (s0-1 sv-52) + (vector-copy! v1-1 (-> self root trans)) + (let ((sv-52 v1-1)) + (let ((a0-5 sv-48)) + (vector-copy! a0-5 sv-48) + (set! (-> a0-5 y) 0.0) + (vector-normalize! a0-5 1.0) + ) + (dotimes (s2-0 arg0) + (let ((v1-4 (new 'stack-no-clear 'vector))) + (vector-copy! v1-4 sv-52) + (let ((sv-80 v1-4)) + (let* ((f30-0 (- (/ arg2 2))) + (v1-6 (/ (the-as int (rand-uint31-gen *random-generator*)) 256)) + (v1-7 (the-as number (logior #x3f800000 v1-6))) + (sv-84 (+ f30-0 (* (+ -1.0 (the-as float v1-7)) (+ (/ arg2 2) (/ arg2 2))))) + ) + (vector+float*! sv-80 sv-80 (vector-cross! (new 'stack-no-clear 'vector) sv-48 *up-vector*) (* sv-84 arg3)) + ) + (bt-barrel-ground-probe sv-80) + (dotimes (s1-0 arg1) + (let ((s0-0 (handle->process (-> *blow-tower-targets* hellcat))) + (sv-112 (get-process *default-dead-pool* bt-barrel #x4000 1)) + ) + (when sv-112 + ((method-of-type bt-barrel activate) (the-as bt-barrel sv-112) s0-0 "bt-barrel" (the-as pointer #x70004000)) + (run-now-in-process sv-112 bt-barrel-init-by-other sv-80) + (-> sv-112 ppointer) + ) + ) + ) + ) + ) + (suspend) + 0 + (vector+float*! sv-52 sv-52 sv-48 arg2) + (let* ((s1-1 sv-52) + (s0-1 sv-52) + (sv-128 sv-48) + (f30-1 arg3) + (f28-0 (- (/ arg2 4))) + (v1-30 (/ (the-as int (rand-uint31-gen *random-generator*)) 256)) + (v1-31 (the-as number (logior #x3f800000 v1-30))) + ) + (vector+float*! + s1-1 + s0-1 + sv-128 + (* f30-1 (+ f28-0 (* (+ -1.0 (the-as float v1-31)) (+ (/ arg2 4) (/ arg2 4))))) + ) ) - (set! sv-128 sv-48) - (let* ((f30-1 arg3) - (f28-0 (- (/ arg2 4))) - (v1-30 (/ (the-as int (rand-uint31-gen *random-generator*)) 256)) - (v1-31 (the-as number (logior #x3f800000 v1-30))) - (f0-18 (* f30-1 (+ f28-0 (* (+ -1.0 (the-as float v1-31)) (+ (/ arg2 4) (/ arg2 4)))))) - ) - (vector+float*! s1-1 s0-1 sv-128 f0-18) ) ) ) diff --git a/test/decompiler/reference/jak3/levels/city/blow-tower/blow-tower-shared_REF.gc b/test/decompiler/reference/jak3/levels/city/blow-tower/blow-tower-shared_REF.gc index 9fc7f7347a..d4af422568 100644 --- a/test/decompiler/reference/jak3/levels/city/blow-tower/blow-tower-shared_REF.gc +++ b/test/decompiler/reference/jak3/levels/city/blow-tower/blow-tower-shared_REF.gc @@ -226,63 +226,63 @@ ;; definition for method 11 of type blow-tower-path-cursor ;; WARN: Return type mismatch int vs none. (defmethod blow-tower-path-cursor-method-11 ((this blow-tower-path-cursor) (arg0 vector)) - (local-vars (f1-5 number) (f2-4 float) (sv-32 number) (sv-40 int) (sv-48 vector) (sv-52 number)) - (set! sv-32 40960000.0) - (set! sv-40 -1) - (set! sv-48 (new 'stack-no-clear 'vector)) - (set! sv-52 0.0) - (dotimes (s4-0 (+ (-> this path num-nodes) -1)) - (let ((s2-1 (vector-! (new 'stack-no-clear 'vector) arg0 (-> this path pts s4-0))) - (s3-1 (vector-! (new 'stack-no-clear 'vector) (-> this path pts (+ s4-0 1)) (-> this path pts s4-0))) + (local-vars (f1-5 number) (f2-4 float)) + (let ((sv-32 40960000.0) + (sv-40 -1) + ) + (let ((sv-48 (new 'stack-no-clear 'vector)) + (sv-52 (the-as float 0.0)) ) - 0.0 - 0.0 - 0.0 - 0.0 - 0.0 - (set! (-> s2-1 y) 0.0) - (set! (-> s3-1 y) 0.0) - (let ((f1-0 (vector-normalize-ret-len! s3-1 1.0)) - (f0-10 (vector-dot s2-1 s3-1)) - ) - (cond - ((< f0-10 0.0) - (set! f2-4 (sqrtf (+ (* (-> s2-1 x) (-> s2-1 x)) (* (-> s2-1 z) (-> s2-1 z))))) - (set! f1-5 0.0) - ) - ((< f1-0 f0-10) - (let ((v1-11 s2-1)) - (set! f2-4 (sqrtf (+ (* (-> v1-11 x) (-> v1-11 x)) (* (-> v1-11 z) (-> v1-11 z))))) - ) - (set! f1-5 1.0) - ) - (else - (let ((f2-9 (vector-dot s2-1 s2-1)) - (f3-2 f0-10) - ) - (set! f2-4 (sqrtf (- f2-9 (* f3-2 f3-2)))) + (dotimes (s4-0 (+ (-> this path num-nodes) -1)) + (let ((s2-1 (vector-! (new 'stack-no-clear 'vector) arg0 (-> this path pts s4-0))) + (s3-1 (vector-! (new 'stack-no-clear 'vector) (-> this path pts (+ s4-0 1)) (-> this path pts s4-0))) + ) + 0.0 + 0.0 + 0.0 + 0.0 + 0.0 + (set! (-> s2-1 y) 0.0) + (set! (-> s3-1 y) 0.0) + (let ((f1-0 (vector-normalize-ret-len! s3-1 1.0)) + (f0-10 (vector-dot s2-1 s3-1)) + ) + (cond + ((< f0-10 0.0) + (set! f2-4 (sqrtf (+ (* (-> s2-1 x) (-> s2-1 x)) (* (-> s2-1 z) (-> s2-1 z))))) + (set! f1-5 0.0) + ) + ((< f1-0 f0-10) + (let ((v1-11 s2-1)) + (set! f2-4 (sqrtf (+ (* (-> v1-11 x) (-> v1-11 x)) (* (-> v1-11 z) (-> v1-11 z))))) + ) + (set! f1-5 1.0) + ) + (else + (set! f2-4 (sqrtf (- (vector-dot s2-1 s2-1) (square f0-10)))) + (set! f1-5 (/ f0-10 f1-0)) + ) + ) + (when (< f2-4 (the-as float sv-32)) + (set! sv-32 f2-4) + (set! sv-40 s4-0) + (set! sv-52 (the-as float f1-5)) + (vector+float*! sv-48 (-> this path pts s4-0) s3-1 f0-10) ) - (set! f1-5 (/ f0-10 f1-0)) ) ) - (when (< f2-4 (the-as float sv-32)) - (set! sv-32 f2-4) - (set! sv-40 s4-0) - (set! sv-52 f1-5) - (vector+float*! sv-48 (-> this path pts s4-0) s3-1 f0-10) - ) ) + (set! (-> this interp-tt) sv-52) ) - ) - (set! (-> this interp-tt) (the-as float sv-52)) - (set! (-> this current-tt) - (lerp - (-> this path node-info sv-40 accum-time-percentage) - (-> this path node-info (+ sv-40 1) accum-time-percentage) - (-> this interp-tt) + (set! (-> this current-tt) + (lerp + (-> this path node-info sv-40 accum-time-percentage) + (-> this path node-info (+ sv-40 1) accum-time-percentage) + (-> this interp-tt) + ) ) - ) - (blow-tower-path-cursor-method-12 this sv-40) + (blow-tower-path-cursor-method-12 this sv-40) + ) (set! (-> this current-time) (the-as time-frame (the int (* (-> this current-tt) (the float (-> this path total-time))))) ) diff --git a/test/decompiler/reference/jak3/levels/city/blow-tower/cty-blow-tower_REF.gc b/test/decompiler/reference/jak3/levels/city/blow-tower/cty-blow-tower_REF.gc index c312b155c8..d8f91545dc 100644 --- a/test/decompiler/reference/jak3/levels/city/blow-tower/cty-blow-tower_REF.gc +++ b/test/decompiler/reference/jak3/levels/city/blow-tower/cty-blow-tower_REF.gc @@ -747,59 +747,56 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defmethod on-attacked ((this bt-vehicle) (arg0 float) (arg1 attack-info) (arg2 process-focusable)) - (local-vars - (sv-64 vector) - (sv-68 vector) - (sv-72 vector) - (sv-76 float) - (sv-80 (pointer float)) - (sv-88 int) - (sv-96 vector) - (sv-100 float) - ) - (set! sv-64 (new 'stack-no-clear 'vector)) - (set! sv-68 (-> this root trans)) - (set! sv-72 (new 'stack-no-clear 'vector)) - (set! sv-76 (the-as float 0.0)) - (set! sv-80 (new 'static 'array float 4 0.0 0.0 0.0 0.0)) - (set! sv-88 0) - (set! sv-96 (vector-z-quaternion! (new 'stack-no-clear 'vector) (-> this root quat))) - (set! sv-100 (the-as float 0.0)) - (let ((s2-0 (new 'stack-no-clear 'attack-info))) - (attack-info-method-9 arg1 s2-0 arg2 this) - (vector-copy! sv-64 (-> s2-0 intersection)) - ) - (let ((a0-6 (as-type arg2 process-focusable))) - (if a0-6 - (vector-copy! sv-64 (get-trans a0-6 3)) + (let ((sv-64 (new 'stack-no-clear 'vector)) + (sv-68 (-> this root trans)) + (sv-72 (new 'stack-no-clear 'vector)) ) - ) - (vector-! sv-72 sv-64 sv-68) - (set! (-> sv-72 y) 0.0) - (let ((a0-8 sv-96)) - (vector-copy! a0-8 sv-96) - (set! (-> a0-8 y) 0.0) - (vector-normalize! a0-8 1.0) - ) - (set! sv-100 (* 0.6 (-> this root root-prim local-sphere w))) - (vector-float*! sv-96 sv-96 sv-100) - (let ((s4-3 (vector-rotate-around-y! (new 'stack-no-clear 'vector) sv-96 8192.0)) - (f30-0 0.0) - ) - (dotimes (s3-1 4) - (set! (-> sv-80 s3-1) (/ (vector-vector-distance s4-3 sv-72) sv-100)) - (set! (-> sv-80 s3-1) (fmax 0.0 (fmin 1.0 (-> sv-80 s3-1)))) - (set! (-> sv-80 s3-1) (- 1.0 (-> sv-80 s3-1))) - (set! (-> sv-80 s3-1) (* (-> sv-80 s3-1) (-> sv-80 s3-1))) - (+! f30-0 (-> sv-80 s3-1)) - (vector-rotate-around-y! s4-3 s4-3 -16384.0) + (let ((sv-76 (the-as float 0.0))) ) - (when (< 0.1 f30-0) - (dotimes (v1-46 4) - (set! (-> sv-80 v1-46) (/ (-> sv-80 v1-46) f30-0)) + (let ((sv-80 (new 'static 'array float 4 0.0 0.0 0.0 0.0))) + (let ((sv-88 0)) ) - (dotimes (v1-49 4) - (+! (-> this damage-state v1-49) (* (-> sv-80 v1-49) arg0)) + (let ((sv-96 (vector-z-quaternion! (new 'stack-no-clear 'vector) (-> this root quat))) + (sv-100 (the-as float 0.0)) + ) + (let ((s2-0 (new 'stack-no-clear 'attack-info))) + (attack-info-method-9 arg1 s2-0 arg2 this) + (vector-copy! sv-64 (-> s2-0 intersection)) + ) + (let ((a0-6 (as-type arg2 process-focusable))) + (if a0-6 + (vector-copy! sv-64 (get-trans a0-6 3)) + ) + ) + (vector-! sv-72 sv-64 sv-68) + (set! (-> sv-72 y) 0.0) + (let ((a0-8 sv-96)) + (vector-copy! a0-8 sv-96) + (set! (-> a0-8 y) 0.0) + (vector-normalize! a0-8 1.0) + ) + (set! sv-100 (* 0.6 (-> this root root-prim local-sphere w))) + (vector-float*! sv-96 sv-96 sv-100) + (let ((s4-3 (vector-rotate-around-y! (new 'stack-no-clear 'vector) sv-96 8192.0)) + (f30-0 0.0) + ) + (dotimes (s3-1 4) + (set! (-> sv-80 s3-1) (/ (vector-vector-distance s4-3 sv-72) sv-100)) + (set! (-> sv-80 s3-1) (fmax 0.0 (fmin 1.0 (-> sv-80 s3-1)))) + (set! (-> sv-80 s3-1) (- 1.0 (-> sv-80 s3-1))) + (set! (-> sv-80 s3-1) (* (-> sv-80 s3-1) (-> sv-80 s3-1))) + (+! f30-0 (-> sv-80 s3-1)) + (vector-rotate-around-y! s4-3 s4-3 -16384.0) + ) + (when (< 0.1 f30-0) + (dotimes (v1-46 4) + (set! (-> sv-80 v1-46) (/ (-> sv-80 v1-46) f30-0)) + ) + (dotimes (v1-49 4) + (+! (-> this damage-state v1-49) (* (-> sv-80 v1-49) arg0)) + ) + ) + ) ) ) ) @@ -854,7 +851,7 @@ ((< (-> this start-path-height-offset) (-> this dest-path-height-offset)) ) (else - (set! f0-7 (* f0-7 f0-7)) + (set! f0-7 (square f0-7)) ) ) (let* ((f0-8 (evaluate *bt-height-adjust* f0-7 (loop-behavior use-default))) @@ -1332,7 +1329,6 @@ ;; ERROR: Stack slot load at 176 mismatch: defined as size 4, got size 16 ;; WARN: Return type mismatch quaternion vs object. (defmethod bt-vehicle-method-36 ((this bt-hellcat) (arg0 int) (arg1 vector) (arg2 quaternion)) - (local-vars (sv-176 float)) (let ((s3-0 (quaternion->matrix (new 'stack-no-clear 'matrix) arg2))) (quaternion-rotate-local-y! arg2 arg2 32768.0) (let ((f30-0 0.7) @@ -1370,15 +1366,7 @@ (vector-! s2-0 s0-0 s1-0) ) (let ((f30-1 (-> this land-grunt-offset))) - (let ((s4-1 vector-rotate-around-axis!) - (s3-1 s2-0) - (s0-1 s2-0) - ) - (set! sv-176 f30-1) - (let ((a3-1 (vector-y-quaternion! (new 'stack-no-clear 'vector) arg2))) - (s4-1 s3-1 s0-1 sv-176 a3-1) - ) - ) + (vector-rotate-around-axis! s2-0 s2-0 f30-1 (vector-y-quaternion! (new 'stack-no-clear 'vector) arg2)) (vector+! s2-0 s2-0 s1-0) (vector+! arg1 arg1 s2-0) (quaternion-rotate-local-y! arg2 arg2 f30-1) @@ -1421,45 +1409,48 @@ ;; definition for method 50 of type bt-hellcat ;; INFO: Used lq/sq (defmethod bt-hellcat-method-50 ((this bt-hellcat) (arg0 int) (arg1 quaternion) (arg2 vector) (arg3 vector)) - (local-vars (sv-48 vector) (sv-56 int) (sv-64 number) (sv-68 quaternion)) - (set! sv-48 (new 'stack-no-clear 'vector)) - (set! sv-56 -1) - (set! sv-64 -1.0) - (set! sv-68 (new 'stack-no-clear 'quaternion)) - (quaternion-copy! sv-68 arg1) - (let ((v1-5 (the-as bt-gun-manager (handle->process (-> this child-turret))))) - (quaternion-copy! sv-68 (-> v1-5 cam-quat)) - ) - (vector-z-quaternion! sv-48 sv-68) - (let ((a0-8 sv-48)) - (vector-copy! a0-8 sv-48) - (set! (-> a0-8 y) 0.0) - (vector-normalize! a0-8 1.0) - ) - (dotimes (s2-0 12) - (when (= (-> this spots s2-0 rider-index) arg0) - (let ((a0-9 (new 'stack-no-clear 'vector))) - (vector-copy! a0-9 (-> this spots s2-0 offset-dir)) - (set! (-> a0-9 y) 0.0) - (let ((v1-18 (vector-normalize! a0-9 1.0))) - 0.0 - (let ((f0-5 (vector-dot v1-18 sv-48))) - (when (< (the-as float sv-64) f0-5) - (set! sv-64 f0-5) - (set! sv-56 s2-0) - (if arg3 - (vector-copy! arg3 v1-18) + (let ((sv-48 (new 'stack-no-clear 'vector)) + (sv-56 -1) + ) + (let ((sv-64 -1.0)) + (let ((sv-68 (new 'stack-no-clear 'quaternion))) + (quaternion-copy! sv-68 arg1) + (let ((v1-5 (the-as bt-gun-manager (handle->process (-> this child-turret))))) + (quaternion-copy! sv-68 (-> v1-5 cam-quat)) + ) + (vector-z-quaternion! sv-48 sv-68) + ) + (let ((a0-8 sv-48)) + (vector-copy! a0-8 sv-48) + (set! (-> a0-8 y) 0.0) + (vector-normalize! a0-8 1.0) + ) + (dotimes (s2-0 12) + (when (= (-> this spots s2-0 rider-index) arg0) + (let ((a0-9 (new 'stack-no-clear 'vector))) + (vector-copy! a0-9 (-> this spots s2-0 offset-dir)) + (set! (-> a0-9 y) 0.0) + (let ((v1-18 (vector-normalize! a0-9 1.0))) + 0.0 + (let ((f0-5 (vector-dot v1-18 sv-48))) + (when (< (the-as float sv-64) f0-5) + (set! sv-64 f0-5) + (set! sv-56 s2-0) + (if arg3 + (vector-copy! arg3 v1-18) + ) ) + ) ) ) ) ) ) + (if arg2 + (vector-copy! arg2 sv-48) + ) + sv-56 ) - (if arg2 - (vector-copy! arg2 sv-48) - ) - sv-56 ) ;; definition for method 49 of type bt-hellcat @@ -1498,36 +1489,42 @@ ;; definition for method 48 of type bt-hellcat ;; WARN: Return type mismatch int vs none. (defmethod bt-hellcat-method-48 ((this bt-hellcat) (arg0 handle) (arg1 quaternion)) - (local-vars (s3-0 int) (sv-16 int) (sv-24 int) (sv-64 number) (sv-72 int) (sv-80 vector) (sv-84 vector)) - (set! sv-16 0) - (set! sv-24 2) - (dotimes (v1-1 2) - (when (handle->process (-> this assigned-spots v1-1)) - (set! sv-16 (logior sv-16 (ash 1 v1-1))) - (set! sv-24 (+ sv-24 -1)) - ) - ) - (when (zero? sv-24) - (set! s3-0 -1) - (goto cfg-26) - ) - (set! sv-64 -1.0) - (set! sv-72 -1) - (set! sv-80 (new 'stack-no-clear 'vector)) - (set! sv-84 (new 'stack-no-clear 'vector)) - (dotimes (s3-1 2) - (when (not (logtest? sv-16 (ash 1 s3-1))) - (bt-hellcat-method-50 this s3-1 arg1 sv-80 sv-84) - 0.0 - (let ((f0-3 (vector-dot sv-80 sv-84))) - (when (< (the-as float sv-64) f0-3) - (set! sv-72 s3-1) - (set! sv-64 f0-3) + (local-vars (s3-0 int)) + (let ((sv-16 0)) + (let ((sv-24 2)) + (dotimes (v1-1 2) + (when (handle->process (-> this assigned-spots v1-1)) + (logior! sv-16 (ash 1 v1-1)) + (+! sv-24 -1) ) ) + (when (zero? sv-24) + (set! s3-0 -1) + (goto cfg-26) + ) + ) + (let ((sv-64 -1.0) + (sv-72 -1) + ) + (let ((sv-80 (new 'stack-no-clear 'vector)) + (sv-84 (new 'stack-no-clear 'vector)) + ) + (dotimes (s3-1 2) + (when (not (logtest? sv-16 (ash 1 s3-1))) + (bt-hellcat-method-50 this s3-1 arg1 sv-80 sv-84) + 0.0 + (let ((f0-3 (vector-dot sv-80 sv-84))) + (when (< (the-as float sv-64) f0-3) + (set! sv-72 s3-1) + (set! sv-64 f0-3) + ) + ) + ) + ) + ) + (set! s3-0 sv-72) ) ) - (set! s3-0 sv-72) (set! (-> this assigned-spots s3-0) arg0) (set! (-> this spots (bt-hellcat-method-50 this s3-0 arg1 (the-as vector #f) (the-as vector #f)) owner) arg0) (label cfg-26) @@ -1540,73 +1537,60 @@ ;; ERROR: Unsupported inline assembly instruction kind - [madda.s f1, f4] ;; ERROR: Unsupported inline assembly instruction kind - [madd.s f0, f2, f5] (defmethod bt-hellcat-method-47 ((this bt-hellcat) (arg0 int) (arg1 vector) (arg2 quaternion) (arg3 symbol)) - (local-vars - (f0-4 float) - (sv-176 symbol) - (sv-192 int) - (sv-208 vector) - (sv-224 quaternion) - (sv-240 vector) - (sv-256 matrix) - ) - (set! sv-176 arg3) - (set! sv-192 0) - (while (< sv-192 12) - (when (and (= arg0 (-> this spots sv-192 rider-index)) (handle->process (-> this spots sv-192 owner))) - (let ((s0-0 (-> this spots sv-192))) - (let ((s2-0 (new 'stack-no-clear 'vector))) - (set! sv-208 (new 'stack-no-clear 'vector)) - (let ((s1-0 (new 'stack-no-clear 'vector))) + (local-vars (f0-4 float)) + (let ((sv-176 arg3) + (sv-192 0) + ) + (while (< sv-192 12) + (when (and (= arg0 (-> this spots sv-192 rider-index)) (handle->process (-> this spots sv-192 owner))) + (let ((s0-0 (-> this spots sv-192))) + (let ((s2-0 (new 'stack-no-clear 'vector)) + (sv-208 (new 'stack-no-clear 'vector)) + (s1-0 (new 'stack-no-clear 'vector)) + ) (bt-hellcat-method-46 this s2-0 (the-as quaternion sv-208)) (when sv-176 - (set! sv-224 (quaternion-copy! (new 'stack-no-clear 'quaternion) (the-as quaternion sv-208))) - (set! sv-240 (new 'stack-no-clear 'vector)) - (let ((v1-21 (the-as bt-gun-manager (handle->process (-> this child-turret))))) - (quaternion-copy! sv-224 (-> v1-21 cam-quat)) - ) - (vector-z-quaternion! sv-240 sv-224) - (let ((a0-14 sv-240)) - (vector-copy! a0-14 sv-240) - (set! (-> a0-14 y) 0.0) - (vector-normalize! a0-14 1.0) - ) - (acos (vector-dot sv-240 (the-as vector (+ (the-as uint (-> this spots 0 offset-dir)) (* sv-192 64))))) - (let ((f30-0 4551.1113) - (t9-6 acos) + (let ((sv-224 (quaternion-copy! (new 'stack-no-clear 'quaternion) (the-as quaternion sv-208))) + (sv-240 (new 'stack-no-clear 'vector)) ) - (let* ((v1-29 (the-as object (+ (the-as uint (-> this spots 0 offset-dir)) (* sv-192 64)))) - (f0-3 (-> sv-240 x)) - (f1-0 (-> sv-240 y)) - (f2-0 (-> sv-240 z)) - (f3-0 (-> (the-as vector v1-29) x)) - (f4-0 (-> (the-as vector v1-29) y)) - (f5-0 (-> (the-as vector v1-29) z)) - ) - (.mula.s f0-3 f3-0) - (.madda.s f1-0 f4-0) - (.madd.s f0-4 f2-0 f5-0) + (let ((v1-21 (the-as bt-gun-manager (handle->process (-> this child-turret))))) + (quaternion-copy! sv-224 (-> v1-21 cam-quat)) ) - (when (< f30-0 (t9-6 f0-4)) - (let ((v1-33 (bt-hellcat-method-50 this arg0 (-> this root quat) (the-as vector #f) (the-as vector #f)))) - (let ((a0-25 (-> s0-0 owner))) - (set! (-> s0-0 owner) (the-as handle #f)) - (set! (-> this spots v1-33 owner) a0-25) + (vector-z-quaternion! sv-240 sv-224) + (let ((a0-14 sv-240)) + (vector-copy! a0-14 sv-240) + (set! (-> a0-14 y) 0.0) + (vector-normalize! a0-14 1.0) + ) + (acos (vector-dot sv-240 (the-as vector (+ (the-as uint (-> this spots 0 offset-dir)) (* sv-192 64))))) + (let ((f30-0 4551.1113) + (t9-6 acos) + ) + (let* ((v1-29 (the-as object (+ (the-as uint (-> this spots 0 offset-dir)) (* sv-192 64))))) + (set! f0-4 (vector-dot sv-240 (the-as vector v1-29))) + ) + (when (< f30-0 (t9-6 f0-4)) + (let ((v1-33 (bt-hellcat-method-50 this arg0 (-> this root quat) (the-as vector #f) (the-as vector #f)))) + (let ((a0-25 (-> s0-0 owner))) + (set! (-> s0-0 owner) (the-as handle #f)) + (set! (-> this spots v1-33 owner) a0-25) + ) + (set! s0-0 (-> this spots v1-33)) ) - (set! s0-0 (-> this spots v1-33)) ) ) ) ) (let ((v1-38 (handle->process (-> this child-turret)))) (when v1-38 - (let ((s3-1 matrix-u-f-compose)) - (set! sv-256 (new 'stack-no-clear 'matrix)) - (let* ((a1-15 (vector-y-quaternion! (new 'stack-no-clear 'vector) (the-as quaternion (&-> v1-38 stack 4064)))) - (a2-3 (-> s0-0 offset-dir)) - (a1-16 (s3-1 sv-256 a1-15 a2-3)) - ) - (matrix->quaternion arg2 a1-16) - ) + (let ((a1-16 (matrix-u-f-compose + (new 'stack-no-clear 'matrix) + (vector-y-quaternion! (new 'stack-no-clear 'vector) (the-as quaternion (&-> v1-38 stack 4064))) + (-> s0-0 offset-dir) + ) + ) + ) + (matrix->quaternion arg2 a1-16) ) (quaternion-rotate-local-x! arg2 arg2 (/ (-> this roll-amount) 2)) ) @@ -1614,12 +1598,12 @@ (vector-! s1-0 s2-0 (-> this root trans)) (vector+! arg1 arg1 s1-0) ) + (quaternion-rotate-local-x! arg2 arg2 (-> s0-0 y-rot)) ) - (quaternion-rotate-local-x! arg2 arg2 (-> s0-0 y-rot)) + (return 0) ) - (return 0) + (+! sv-192 1) ) - (set! sv-192 (+ sv-192 1)) ) 0 ) @@ -1939,19 +1923,7 @@ ;; WARN: Return type mismatch symbol vs none. ;; ERROR: Function may read a register that is not set: s4 (defmethod bt-gun-manager-method-19 ((this bt-gun-manager)) - (local-vars - (v1-17 symbol) - (s4-0 symbol) - (f28-0 float) - (f30-0 float) - (sv-64 vector) - (sv-68 bt-hud-target-pers) - (sv-96 vector) - (sv-100 vector) - (sv-112 process) - (sv-128 vector) - (sv-144 vector) - ) + (local-vars (v1-17 symbol) (s4-0 symbol) (f28-0 float) (f30-0 float) (sv-112 process)) (bt-gun-manager-method-23 this) (set! (-> this hud-target tid) (the-as @@ -1981,42 +1953,32 @@ (s1-1 (+ (-> this num-onscreen-targets) -1)) ) (while (>= s1-1 s2-1) - (set! sv-128 (new 'stack-no-clear 'vector)) - (let ((s0-1 transform-point-vector!)) - (set! sv-144 sv-128) - (let ((v1-15 (-> this onscreen-targets s2-1 hand))) - (set! s4-0 (and (nonzero? (l32-false-check v1-15)) (begin - (set! sv-112 (the-as process s4-0)) - (let ((a0-15 (-> v1-15 process 0))) - (set! v1-17 (when (= (-> v1-15 pid) (-> a0-15 pid)) - (set! sv-112 (the-as process v1-17)) - (set! sv-112 a0-15) - v1-17 - ) - ) - ) - sv-112 - s4-0 - ) - ) - ) - ) - (let ((a1-9 (get-trans - (the-as process-focusable (if (type? sv-112 process-focusable) - (the-as process-focusable sv-112) - ) - ) - 3 - ) - ) + (let ((sv-128 (new 'stack-no-clear 'vector))) + (let ((s0-1 transform-point-vector!) + (sv-144 sv-128) ) - (s0-1 sv-144 a1-9) - ) - ) - (let ((t9-9 vector-vector-distance) - (a1-10 s3-0) + (let ((v1-15 (-> this onscreen-targets s2-1 hand))) + (set! s4-0 (and (nonzero? (l32-false-check v1-15)) (begin + (set! sv-112 (the-as process s4-0)) + (let ((a0-15 (-> v1-15 process 0))) + (set! v1-17 (when (= (-> v1-15 pid) (-> a0-15 pid)) + (set! sv-112 (the-as process v1-17)) + (set! sv-112 a0-15) + v1-17 + ) + ) + ) + sv-112 + s4-0 + ) + ) + ) ) - (when (< (t9-9 sv-128 a1-10) (+ (-> this onscreen-targets s5-0 size) (-> this onscreen-targets s2-1 size))) + (s0-1 sv-144 (get-trans (the-as process-focusable (as-type sv-112 process-focusable)) 3)) + ) + (when (< (vector-vector-distance sv-128 s3-0) + (+ (-> this onscreen-targets s5-0 size) (-> this onscreen-targets s2-1 size)) + ) (+! (-> this onscreen-targets s5-0 num-overlap) 1) (+! (-> this onscreen-targets s2-1 num-overlap) 1) ) @@ -2027,107 +1989,111 @@ ) ) (dotimes (s5-1 (-> this num-onscreen-targets)) - (set! sv-64 (new 'stack-no-clear 'vector)) - (set! sv-68 (-> this hud-pers (-> this onscreen-targets s5-1 target-pers-index))) - (when (and (< (-> this onscreen-targets s5-1 size) 256.0) - (!= (-> (handle->process (-> this onscreen-targets s5-1 hand)) type) bt-barrel) - ) - (set! sv-96 (new 'stack-no-clear 'vector)) - (set! sv-100 - (get-trans - (the-as process-focusable (as-type (handle->process (-> this onscreen-targets s5-1 hand)) process-focusable)) - 3 - ) - ) - (transform-point-vector! sv-96 sv-100) - (+! (-> sv-96 x) -1792.0) - (+! (-> sv-96 y) -1840.0) - (when (and (>= (-> sv-96 x) 0.0) (>= 2048.0 (-> sv-96 x)) (>= (-> sv-96 y) 0.0) (>= 2048.0 (-> sv-96 y))) - (cond - ((-> this onscreen-targets s5-1 hit?) - (seek! (-> sv-68 rotate) 16384.0 (* 65536.0 (seconds-per-frame))) - (seek! (-> sv-68 size-scalar) 1.0 (* 16.0 (seconds-per-frame))) - (set! (-> sv-68 alpha) 1.0) - ) - (else - (seek! (-> sv-68 size-scalar) 4.0 (* 8.0 (seconds-per-frame))) - (seek! (-> sv-68 rotate) 0.0 (* 65536.0 (seconds-per-frame))) - (seek! (-> sv-68 alpha) 0.0 (* 3.0 (seconds-per-frame))) - (set! (-> sv-68 outer-rotate) (- (-> sv-68 outer-rotate) (* 32768.0 (seconds-per-frame)))) - ) - ) - 0.0 - 0.0 - (set! f28-0 (cond - ((-> this onscreen-targets s5-1 hit?) - (set! (-> this hud-target color x) 127) - (set! (-> this hud-target color y) 75) - (set! (-> this hud-target color z) 0) - (set! f30-0 (* 80.0 (-> this onscreen-targets s5-1 alpha))) - (set! (-> this hud-target-inner color x) 127) - (set! (-> this hud-target-inner color y) 40) - (set! (-> this hud-target-inner color z) 0) - (set! f28-0 (* 80.0 (-> this onscreen-targets s5-1 alpha))) - (when (= (current-time) (-> sv-68 hold-start-time)) - (set! (-> this hud-target color x) 128) - (set! (-> this hud-target color y) 128) - (set! (-> this hud-target color z) 128) - (set! f30-0 64.0) - (set! (-> this hud-target-inner color x) 255) - (set! (-> this hud-target-inner color y) 0) - (set! (-> this hud-target-inner color z) 0) - (set! f28-0 64.0) - ) - f28-0 - ) - (else - (set! (-> this hud-target color x) 127) - (set! (-> this hud-target color y) 40) - (set! (-> this hud-target color z) 0) - (set! f30-0 (* 45.0 (-> this onscreen-targets s5-1 alpha))) - (* 80.0 (-> sv-68 alpha) (-> this onscreen-targets s5-1 alpha)) - ) - ) - ) - (let ((f0-40 (vector-vector-distance sv-100 (camera-pos)))) - 0.0 - (let* ((f0-41 (lerp-scale-clamp 1.0 0.1 f0-40 327680.0 819200.0)) - (f1-22 (* f30-0 f0-41)) - (f0-42 (* f28-0 f0-41)) + (let ((sv-64 (new 'stack-no-clear 'vector))) + ) + (let ((sv-68 (-> this hud-pers (-> this onscreen-targets s5-1 target-pers-index)))) + (when (and (< (-> this onscreen-targets s5-1 size) 256.0) + (!= (-> (handle->process (-> this onscreen-targets s5-1 hand)) type) bt-barrel) ) - (set! (-> this hud-target color w) (the int f1-22)) - (set! (-> this hud-target-inner color w) (the int f0-42)) - ) - ) - (set! (-> this hud-target angle) 0.0) - (set! (-> this hud-target flags) (hud-sprite-flags hsf3)) - (set! (-> this hud-target-inner flags) (hud-sprite-flags hsf3)) - (let* ((f0-46 (/ (-> this onscreen-targets s5-1 size) 32)) - (f0-48 (fmax 0.4 (fmin 2.0 f0-46))) - (f0-49 (* 2.0 f0-48)) + (let ((sv-96 (new 'stack-no-clear 'vector)) + (sv-100 + (get-trans + (the-as process-focusable (as-type (handle->process (-> this onscreen-targets s5-1 hand)) process-focusable)) + 3 + ) + ) + ) + (transform-point-vector! sv-96 sv-100) + (+! (-> sv-96 x) -1792.0) + (+! (-> sv-96 y) -1840.0) + (when (and (>= (-> sv-96 x) 0.0) (>= 2048.0 (-> sv-96 x)) (>= (-> sv-96 y) 0.0) (>= 2048.0 (-> sv-96 y))) + (cond + ((-> this onscreen-targets s5-1 hit?) + (seek! (-> sv-68 rotate) 16384.0 (* 65536.0 (seconds-per-frame))) + (seek! (-> sv-68 size-scalar) 1.0 (* 16.0 (seconds-per-frame))) + (set! (-> sv-68 alpha) 1.0) ) - (set! (-> this hud-target scale-x) f0-49) - (set! (-> this hud-target scale-y) f0-49) - (set! (-> this hud-target-inner scale-x) (* (-> sv-68 size-scalar) f0-49)) - (set! (-> this hud-target-inner scale-y) (* (-> sv-68 size-scalar) f0-49)) - ) - (set! (-> this hud-target pos x) (the int (the float (the int (-> sv-96 x))))) - (set! (-> this hud-target pos y) (the int (the float (the int (-> sv-96 y))))) - (set! (-> this hud-target pos z) 0) - (set! (-> this hud-target-inner pos x) (the int (the float (the int (-> sv-96 x))))) - (set! (-> this hud-target-inner pos y) (the int (the float (the int (-> sv-96 y))))) - (set! (-> this hud-target-inner pos z) 0) - (set! (-> this hud-target-inner angle) (-> sv-68 rotate)) - (set! (-> this hud-target angle) (-> sv-68 outer-rotate)) - (with-dma-buffer-add-bucket ((s3-2 (-> *display* frames (-> *display* on-screen) global-buf)) - (bucket-id hud-draw-hud-alpha) - ) - (draw (-> this hud-target) s3-2 (-> *level* level-default) #f) - ) - (with-dma-buffer-add-bucket ((s3-3 (-> *display* frames (-> *display* on-screen) global-buf)) - (bucket-id hud-draw-hud-alpha) - ) - (draw (-> this hud-target-inner) s3-3 (-> *level* level-default) #f) + (else + (seek! (-> sv-68 size-scalar) 4.0 (* 8.0 (seconds-per-frame))) + (seek! (-> sv-68 rotate) 0.0 (* 65536.0 (seconds-per-frame))) + (seek! (-> sv-68 alpha) 0.0 (* 3.0 (seconds-per-frame))) + (set! (-> sv-68 outer-rotate) (- (-> sv-68 outer-rotate) (* 32768.0 (seconds-per-frame)))) + ) + ) + 0.0 + 0.0 + (set! f28-0 (cond + ((-> this onscreen-targets s5-1 hit?) + (set! (-> this hud-target color x) 127) + (set! (-> this hud-target color y) 75) + (set! (-> this hud-target color z) 0) + (set! f30-0 (* 80.0 (-> this onscreen-targets s5-1 alpha))) + (set! (-> this hud-target-inner color x) 127) + (set! (-> this hud-target-inner color y) 40) + (set! (-> this hud-target-inner color z) 0) + (set! f28-0 (* 80.0 (-> this onscreen-targets s5-1 alpha))) + (when (= (current-time) (-> sv-68 hold-start-time)) + (set! (-> this hud-target color x) 128) + (set! (-> this hud-target color y) 128) + (set! (-> this hud-target color z) 128) + (set! f30-0 64.0) + (set! (-> this hud-target-inner color x) 255) + (set! (-> this hud-target-inner color y) 0) + (set! (-> this hud-target-inner color z) 0) + (set! f28-0 64.0) + ) + f28-0 + ) + (else + (set! (-> this hud-target color x) 127) + (set! (-> this hud-target color y) 40) + (set! (-> this hud-target color z) 0) + (set! f30-0 (* 45.0 (-> this onscreen-targets s5-1 alpha))) + (* 80.0 (-> sv-68 alpha) (-> this onscreen-targets s5-1 alpha)) + ) + ) + ) + (let ((f0-40 (vector-vector-distance sv-100 (camera-pos)))) + 0.0 + (let* ((f0-41 (lerp-scale-clamp 1.0 0.1 f0-40 327680.0 819200.0)) + (f1-22 (* f30-0 f0-41)) + (f0-42 (* f28-0 f0-41)) + ) + (set! (-> this hud-target color w) (the int f1-22)) + (set! (-> this hud-target-inner color w) (the int f0-42)) + ) + ) + (set! (-> this hud-target angle) 0.0) + (set! (-> this hud-target flags) (hud-sprite-flags hsf3)) + (set! (-> this hud-target-inner flags) (hud-sprite-flags hsf3)) + (let* ((f0-46 (/ (-> this onscreen-targets s5-1 size) 32)) + (f0-48 (fmax 0.4 (fmin 2.0 f0-46))) + (f0-49 (* 2.0 f0-48)) + ) + (set! (-> this hud-target scale-x) f0-49) + (set! (-> this hud-target scale-y) f0-49) + (set! (-> this hud-target-inner scale-x) (* (-> sv-68 size-scalar) f0-49)) + (set! (-> this hud-target-inner scale-y) (* (-> sv-68 size-scalar) f0-49)) + ) + (set! (-> this hud-target pos x) (the int (the float (the int (-> sv-96 x))))) + (set! (-> this hud-target pos y) (the int (the float (the int (-> sv-96 y))))) + (set! (-> this hud-target pos z) 0) + (set! (-> this hud-target-inner pos x) (the int (the float (the int (-> sv-96 x))))) + (set! (-> this hud-target-inner pos y) (the int (the float (the int (-> sv-96 y))))) + (set! (-> this hud-target-inner pos z) 0) + (set! (-> this hud-target-inner angle) (-> sv-68 rotate)) + (set! (-> this hud-target angle) (-> sv-68 outer-rotate)) + (with-dma-buffer-add-bucket ((s3-2 (-> *display* frames (-> *display* on-screen) global-buf)) + (bucket-id hud-draw-hud-alpha) + ) + (draw (-> this hud-target) s3-2 (-> *level* level-default) #f) + ) + (with-dma-buffer-add-bucket ((s3-3 (-> *display* frames (-> *display* on-screen) global-buf)) + (bucket-id hud-draw-hud-alpha) + ) + (draw (-> this hud-target-inner) s3-3 (-> *level* level-default) #f) + ) + ) ) ) ) @@ -2248,12 +2214,9 @@ 0.0 (let* ((f1-10 (/ (fabs f1-8) f0-4)) (f2-3 (/ (fabs f2-1) (* 1.2307693 f0-4))) - (f0-6 (* f1-10 f1-10)) - (f28-0 (* f2-3 f2-3)) - (f1-11 f28-0) - (f1-13 (* f1-11 f1-11)) - (f2-4 f0-6) - (f30-1 (sqrtf (+ f1-13 (* f2-4 f2-4)))) + (f0-6 (square f1-10)) + (f28-0 (square f2-3)) + (f30-1 (sqrtf (+ (square f28-0) (square f0-6)))) ) (let ((f26-0 0.0) (f24-0 0.0) @@ -2405,52 +2368,53 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defmethod bt-gun-manager-method-18 ((this bt-gun-manager) (arg0 float)) - (local-vars (sv-80 vector) (sv-84 vector) (sv-88 vector) (sv-92 vector)) (let ((s5-0 (new 'stack-no-clear 'vector))) (set! (-> s5-0 x) (lerp 0.0 512.0 (-> this roty))) (set! (-> s5-0 y) (lerp 0.0 416.0 (-> this rotx))) (set! (-> s5-0 z) 0.0) (set! (-> s5-0 w) 1.0) - (set! sv-80 s5-0) - ) - (set! sv-84 (new 'stack-no-clear 'vector)) - (set! sv-88 (new 'stack-no-clear 'vector)) - (set! sv-92 (new 'stack-no-clear 'vector)) - (set! (-> this hud-aim pos x) (the int (-> sv-80 x))) - (set! (-> this hud-aim pos y) (the int (-> sv-80 y))) - (set! (-> this hud-aim pos z) 0) - (set! (-> this hud-aim flags) (hud-sprite-flags hsf3)) - (set! (-> this hud-aim scale-x) 1.0) - (set! (-> this hud-aim scale-y) 1.0) - (let ((v1-9 (-> this hud-aim color-ptr))) - (set! (-> v1-9 0) 231) - (set! (-> v1-9 1) 168) - (set! (-> v1-9 2) 0) - (set! (-> v1-9 3) 128) - ) - (set! (-> this hud-aim tid) - (the-as - texture-id - (lookup-texture-by-name "hud-target-reticle" (the-as string #f) (the-as (pointer texture-page) #f)) + (let ((sv-80 s5-0) + (sv-84 (new 'stack-no-clear 'vector)) + (sv-88 (new 'stack-no-clear 'vector)) + (sv-92 (new 'stack-no-clear 'vector)) ) + (set! (-> this hud-aim pos x) (the int (-> sv-80 x))) + (set! (-> this hud-aim pos y) (the int (-> sv-80 y))) + (set! (-> this hud-aim pos z) 0) + (set! (-> this hud-aim flags) (hud-sprite-flags hsf3)) + (set! (-> this hud-aim scale-x) 1.0) + (set! (-> this hud-aim scale-y) 1.0) + (let ((v1-9 (-> this hud-aim color-ptr))) + (set! (-> v1-9 0) 231) + (set! (-> v1-9 1) 168) + (set! (-> v1-9 2) 0) + (set! (-> v1-9 3) 128) ) - (with-dma-buffer-add-bucket ((s4-0 (-> *display* frames (-> *display* on-screen) global-buf)) - (bucket-id hud-draw-hud-alpha) - ) - (draw (-> this hud-aim) s4-0 (-> *level* level-default) #f) + (set! (-> this hud-aim tid) + (the-as + texture-id + (lookup-texture-by-name "hud-target-reticle" (the-as string #f) (the-as (pointer texture-page) #f)) + ) + ) + (with-dma-buffer-add-bucket ((s4-0 (-> *display* frames (-> *display* on-screen) global-buf)) + (bucket-id hud-draw-hud-alpha) + ) + (draw (-> this hud-aim) s4-0 (-> *level* level-default) #f) + ) + (send-event (handle->process (-> this parent-vehicle)) 'get-turret-pos sv-88 sv-84) + (vector+float*! sv-88 (camera-pos) (-> (camera-matrix) fvec) 40960.0) + (+! (-> sv-80 x) -256.0) + (+! (-> sv-80 y) -208.0) + (reverse-transform-point! + sv-92 + sv-88 + (vector-float*! (new 'stack-no-clear 'vector) (-> (camera-matrix) fvec) 1.0) + sv-80 + ) + (vector-copy! (-> this aim-pos) sv-92) + (vector-! (-> this aim-dir) sv-92 (-> this root trans)) + ) ) - (send-event (handle->process (-> this parent-vehicle)) 'get-turret-pos sv-88 sv-84) - (vector+float*! sv-88 (camera-pos) (-> (camera-matrix) fvec) 40960.0) - (+! (-> sv-80 x) -256.0) - (+! (-> sv-80 y) -208.0) - (reverse-transform-point! - sv-92 - sv-88 - (vector-float*! (new 'stack-no-clear 'vector) (-> (camera-matrix) fvec) 1.0) - sv-80 - ) - (vector-copy! (-> this aim-pos) sv-92) - (vector-! (-> this aim-dir) sv-92 (-> this root trans)) (vector-normalize! (-> this aim-dir) 1.0) (quaternion-look-at! (-> this root quat) (-> this aim-dir) *up-vector*) (blow-tower-path-cursor-method-9 @@ -2521,8 +2485,7 @@ ) (let* ((f0-24 (vector-dot s4-12 s2-2)) (f0-25 (+ 1.0 f0-24)) - (f0-26 (/ f0-25 2)) - (f0-27 (* f0-26 f0-26)) + (f0-27 (square (/ f0-25 2))) (f0-28 (lerp 0.0 2.0 f0-27)) (f30-0 (fmax 0.3 (fmin 2.0 f0-28))) ) @@ -2887,344 +2850,326 @@ ;; definition for method 20 of type bt-gun-manager ;; INFO: Used lq/sq (defmethod find-target ((this bt-gun-manager)) - (local-vars - (sv-16 float) - (sv-20 process-drawable) - (sv-24 int) - (sv-32 process-drawable) - (sv-80 vector) - (sv-84 vector) - (sv-88 float) - (sv-128 vector) - (sv-132 vector) - (sv-136 float) - (sv-208 vector) - (sv-212 vector) - (sv-216 vector) - (sv-220 vector) - (sv-224 float) - (sv-228 bt-gun-manager-target) - (sv-784 process-drawable) - (sv-832 vector) - (sv-836 vector) - (sv-840 float) - (sv-880 vector) - (sv-884 vector) - (sv-888 float) - (sv-960 vector) - (sv-964 vector) - (sv-968 vector) - (sv-972 vector) - (sv-976 float) - (sv-980 bt-gun-manager-target) - (sv-1536 process-drawable) - (sv-1584 vector) - (sv-1588 vector) - (sv-1592 float) - (sv-1632 vector) - (sv-1636 vector) - (sv-1640 float) - (sv-1712 vector) - (sv-1716 vector) - (sv-1720 vector) - (sv-1724 vector) - (sv-1728 float) - (sv-1732 bt-gun-manager-target) - ) (set! (-> this num-onscreen-targets) 0) - (set! sv-16 (the-as float 18.0)) - (set! sv-20 (the-as process-drawable #f)) - (set! sv-24 -1) - (when #f - (let ((v1-4 (-> *collide-player-list* alive-list next0))) - *collide-player-list* - (let ((s5-0 (-> v1-4 next0))) - (while (!= v1-4 (-> *collide-player-list* alive-list-end)) - (let* ((v1-5 (the-as collide-shape (-> (the-as connection v1-4) param1))) - (s4-0 (-> v1-5 root-prim)) - ) - (when (logtest? (-> s4-0 prim-core collide-as) (collide-spec enemy obstacle hit-by-others-list)) - (set! sv-32 (as-type (-> v1-5 process) process-focusable)) - (when (and sv-32 - (< (-> this num-onscreen-targets) 32) - (not (logtest? (-> (the-as process-focusable sv-32) focus-status) (focus-status disable dead ignore inactive)) - ) - ) - (let ((s3-1 (new 'stack-no-clear 'vector))) - (vector-copy! s3-1 (get-trans (the-as process-focusable sv-32) 3)) - (set! sv-80 s3-1) - ) - (set! sv-84 (new 'stack-no-clear 'vector)) - (set! sv-88 (the-as float 0.0)) - (set! sv-88 (vector-vector-distance (-> this root trans) sv-80)) - (vector-! sv-84 sv-80 (camera-pos)) - (when (and (< 1.0 (vector-dot sv-84 (-> (camera-matrix) fvec))) (< sv-88 819200.0)) - (set! sv-128 (new 'stack-no-clear 'vector)) - (set! sv-132 (vector+float*! (new 'stack-no-clear 'vector) (-> this root trans) (-> this aim-dir) 40960.0)) - (set! sv-136 (the-as float 0.0)) - (set-vector! sv-132 (lerp 0.0 512.0 (-> this roty)) (lerp 0.0 416.0 (-> this rotx)) 0.0 1.0) - (+! (-> sv-132 x) -256.0) - (+! (-> sv-132 y) -208.0) - (+! (-> sv-132 x) 2048.0) - (+! (-> sv-132 y) 2048.0) - (transform-point-vector! sv-128 sv-80) - (set! (-> sv-128 z) 0.0) - (set! sv-208 (new 'stack-no-clear 'vector)) - (set! sv-212 (new 'stack-no-clear 'vector)) - (set! sv-216 (new 'stack-no-clear 'vector)) - (set! sv-220 (new 'stack-no-clear 'vector)) - (vector+float*! sv-208 sv-80 (-> (camera-matrix) rvec) (* 0.6 (-> s4-0 prim-core world-sphere w))) - (vector+float*! sv-212 sv-80 (-> (camera-matrix) rvec) (* 0.6 (- (-> s4-0 prim-core world-sphere w)))) - (transform-point-vector! sv-216 sv-208) - (transform-point-vector! sv-220 sv-212) - (set! (-> sv-216 z) 0.0) - (set! (-> sv-220 z) 0.0) - (set! sv-224 (* 0.5 (vector-vector-distance sv-216 sv-220))) - (set! sv-228 (-> this onscreen-targets (-> this num-onscreen-targets))) - (set! sv-136 (vector-vector-distance sv-132 sv-128)) - (set! sv-136 (- sv-136 sv-224)) - (let ((a1-11 (new 'stack-no-clear 'collide-query))) - (vector-copy! (-> a1-11 start-pos) (-> this root trans)) - (vector-! (-> a1-11 move-dist) sv-80 (-> a1-11 start-pos)) - (let ((v1-57 a1-11)) - (set! (-> v1-57 radius) 40.96) - (set! (-> v1-57 collide-with) (collide-spec backgnd)) - (set! (-> v1-57 ignore-process0) #f) - (set! (-> v1-57 ignore-process1) #f) - (set! (-> v1-57 ignore-pat) - (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) - ) - (set! (-> v1-57 action-mask) (collide-action solid)) - ) - (when (< (fill-and-probe-using-line-sphere *collide-cache* a1-11) 0.0) - (when (< sv-136 sv-16) - (set! sv-20 sv-32) - (set! sv-16 sv-136) - (vector-copy! (-> this hit-pos) sv-80) - (set! sv-24 (-> this num-onscreen-targets)) - ) - (transform-point-qword! (-> sv-228 transformed-pos) sv-80) - (set! (-> sv-228 hit?) #f) - (set! (-> sv-228 hand) (process->handle sv-32)) - (set! (-> sv-228 size) sv-224) - (set! (-> sv-228 alpha) (lerp-scale-clamp 0.0 1.0 sv-88 20480.0 61440.0)) - (+! (-> this num-onscreen-targets) 1) - ) - ) - ) - ) - ) - ) - (set! v1-4 s5-0) - *collide-player-list* - (set! s5-0 (-> s5-0 next0)) - ) + (let ((sv-16 (the-as float 18.0)) + (sv-20 (the-as process-drawable #f)) + (sv-24 -1) ) - ) - ) - (when #t (when #f - (let ((v1-80 (-> *collide-hit-by-player-list* alive-list next0))) - *collide-hit-by-player-list* - (let ((s5-1 (-> v1-80 next0))) - (while (!= v1-80 (-> *collide-hit-by-player-list* alive-list-end)) - (let* ((v1-81 (the-as collide-shape (-> (the-as connection v1-80) param1))) - (s4-1 (-> v1-81 root-prim)) + (let ((v1-4 (-> *collide-player-list* alive-list next0))) + *collide-player-list* + (let ((s5-0 (-> v1-4 next0))) + (while (!= v1-4 (-> *collide-player-list* alive-list-end)) + (let* ((v1-5 (the-as collide-shape (-> (the-as connection v1-4) param1))) + (s4-0 (-> v1-5 root-prim)) ) - (when (logtest? (-> s4-1 prim-core collide-as) (collide-spec enemy obstacle hit-by-others-list)) - (set! sv-784 (as-type (-> v1-81 process) process-focusable)) - (when (and sv-784 - (< (-> this num-onscreen-targets) 32) - (not (logtest? (-> (the-as process-focusable sv-784) focus-status) (focus-status disable dead ignore inactive)) + (when (logtest? (-> s4-0 prim-core collide-as) (collide-spec enemy obstacle hit-by-others-list)) + (let ((sv-32 (as-type (-> v1-5 process) process-focusable))) + (when (and sv-32 + (< (-> this num-onscreen-targets) 32) + (not (logtest? (-> (the-as process-focusable sv-32) focus-status) (focus-status disable dead ignore inactive)) + ) + ) + (let ((s3-1 (new 'stack-no-clear 'vector))) + (vector-copy! s3-1 (get-trans (the-as process-focusable sv-32) 3)) + (let ((sv-80 s3-1) + (sv-84 (new 'stack-no-clear 'vector)) + (sv-88 (the-as float 0.0)) + ) + (set! sv-88 (vector-vector-distance (-> this root trans) sv-80)) + (vector-! sv-84 sv-80 (camera-pos)) + (when (and (< 1.0 (vector-dot sv-84 (-> (camera-matrix) fvec))) (< sv-88 819200.0)) + (let ((sv-128 (new 'stack-no-clear 'vector)) + (sv-132 (vector+float*! (new 'stack-no-clear 'vector) (-> this root trans) (-> this aim-dir) 40960.0)) + (sv-136 (the-as float 0.0)) + ) + (set-vector! sv-132 (lerp 0.0 512.0 (-> this roty)) (lerp 0.0 416.0 (-> this rotx)) 0.0 1.0) + (+! (-> sv-132 x) -256.0) + (+! (-> sv-132 y) -208.0) + (+! (-> sv-132 x) 2048.0) + (+! (-> sv-132 y) 2048.0) + (transform-point-vector! sv-128 sv-80) + (set! (-> sv-128 z) 0.0) + (let ((sv-208 (new 'stack-no-clear 'vector)) + (sv-212 (new 'stack-no-clear 'vector)) + (sv-216 (new 'stack-no-clear 'vector)) + (sv-220 (new 'stack-no-clear 'vector)) + ) + (vector+float*! sv-208 sv-80 (-> (camera-matrix) rvec) (* 0.6 (-> s4-0 prim-core world-sphere w))) + (vector+float*! sv-212 sv-80 (-> (camera-matrix) rvec) (* 0.6 (- (-> s4-0 prim-core world-sphere w)))) + (transform-point-vector! sv-216 sv-208) + (transform-point-vector! sv-220 sv-212) + (set! (-> sv-216 z) 0.0) + (set! (-> sv-220 z) 0.0) + (let ((sv-224 (* 0.5 (vector-vector-distance sv-216 sv-220))) + (sv-228 (-> this onscreen-targets (-> this num-onscreen-targets))) + ) + (set! sv-136 (- (vector-vector-distance sv-132 sv-128) sv-224)) + (let ((a1-11 (new 'stack-no-clear 'collide-query))) + (vector-copy! (-> a1-11 start-pos) (-> this root trans)) + (vector-! (-> a1-11 move-dist) sv-80 (-> a1-11 start-pos)) + (let ((v1-57 a1-11)) + (set! (-> v1-57 radius) 40.96) + (set! (-> v1-57 collide-with) (collide-spec backgnd)) + (set! (-> v1-57 ignore-process0) #f) + (set! (-> v1-57 ignore-process1) #f) + (set! (-> v1-57 ignore-pat) + (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) + ) + (set! (-> v1-57 action-mask) (collide-action solid)) + ) + (when (< (fill-and-probe-using-line-sphere *collide-cache* a1-11) 0.0) + (when (< sv-136 sv-16) + (set! sv-20 sv-32) + (set! sv-16 sv-136) + (vector-copy! (-> this hit-pos) sv-80) + (set! sv-24 (-> this num-onscreen-targets)) + ) + (transform-point-qword! (-> sv-228 transformed-pos) sv-80) + (set! (-> sv-228 hit?) #f) + (set! (-> sv-228 hand) (process->handle sv-32)) + (set! (-> sv-228 size) sv-224) + (set! (-> sv-228 alpha) (lerp-scale-clamp 0.0 1.0 sv-88 20480.0 61440.0)) + (+! (-> this num-onscreen-targets) 1) + ) + ) ) - ) - (let ((s3-10 (new 'stack-no-clear 'vector))) - (vector-copy! s3-10 (get-trans (the-as process-focusable sv-784) 3)) - (set! sv-832 s3-10) - ) - (set! sv-836 (new 'stack-no-clear 'vector)) - (set! sv-840 (the-as float 0.0)) - (set! sv-840 (vector-vector-distance (-> this root trans) sv-832)) - (vector-! sv-836 sv-832 (camera-pos)) - (when (and (< 1.0 (vector-dot sv-836 (-> (camera-matrix) fvec))) (< sv-840 819200.0)) - (set! sv-880 (new 'stack-no-clear 'vector)) - (set! sv-884 (vector+float*! (new 'stack-no-clear 'vector) (-> this root trans) (-> this aim-dir) 40960.0)) - (set! sv-888 (the-as float 0.0)) - (set-vector! sv-884 (lerp 0.0 512.0 (-> this roty)) (lerp 0.0 416.0 (-> this rotx)) 0.0 1.0) - (+! (-> sv-884 x) -256.0) - (+! (-> sv-884 y) -208.0) - (+! (-> sv-884 x) 2048.0) - (+! (-> sv-884 y) 2048.0) - (transform-point-vector! sv-880 sv-832) - (set! (-> sv-880 z) 0.0) - (set! sv-960 (new 'stack-no-clear 'vector)) - (set! sv-964 (new 'stack-no-clear 'vector)) - (set! sv-968 (new 'stack-no-clear 'vector)) - (set! sv-972 (new 'stack-no-clear 'vector)) - (vector+float*! sv-960 sv-832 (-> (camera-matrix) rvec) (* 0.6 (-> s4-1 prim-core world-sphere w))) - (vector+float*! sv-964 sv-832 (-> (camera-matrix) rvec) (* 0.6 (- (-> s4-1 prim-core world-sphere w)))) - (transform-point-vector! sv-968 sv-960) - (transform-point-vector! sv-972 sv-964) - (set! (-> sv-968 z) 0.0) - (set! (-> sv-972 z) 0.0) - (set! sv-976 (* 0.5 (vector-vector-distance sv-968 sv-972))) - (set! sv-980 (-> this onscreen-targets (-> this num-onscreen-targets))) - (set! sv-888 (vector-vector-distance sv-884 sv-880)) - (set! sv-888 (- sv-888 sv-976)) - (let ((a1-25 (new 'stack-no-clear 'collide-query))) - (vector-copy! (-> a1-25 start-pos) (-> this root trans)) - (vector-! (-> a1-25 move-dist) sv-832 (-> a1-25 start-pos)) - (let ((v1-133 a1-25)) - (set! (-> v1-133 radius) 40.96) - (set! (-> v1-133 collide-with) (collide-spec backgnd)) - (set! (-> v1-133 ignore-process0) #f) - (set! (-> v1-133 ignore-process1) #f) - (set! (-> v1-133 ignore-pat) - (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) ) - (set! (-> v1-133 action-mask) (collide-action solid)) - ) - (when (< (fill-and-probe-using-line-sphere *collide-cache* a1-25) 0.0) - (when (< sv-888 sv-16) - (set! sv-20 sv-784) - (set! sv-16 sv-888) - (vector-copy! (-> this hit-pos) sv-832) - (set! sv-24 (-> this num-onscreen-targets)) + ) ) - (transform-point-qword! (-> sv-980 transformed-pos) sv-832) - (set! (-> sv-980 hit?) #f) - (set! (-> sv-980 hand) (process->handle sv-784)) - (set! (-> sv-980 size) sv-976) - (set! (-> sv-980 alpha) (lerp-scale-clamp 0.0 1.0 sv-840 20480.0 61440.0)) - (+! (-> this num-onscreen-targets) 1) ) ) ) ) ) ) - (set! v1-80 s5-1) - *collide-hit-by-player-list* - (set! s5-1 (-> s5-1 next0)) + (set! v1-4 s5-0) + *collide-player-list* + (set! s5-0 (-> s5-0 next0)) ) ) ) ) (when #t - (let ((v1-155 (-> *collide-hit-by-others-list* alive-list next0))) - *collide-hit-by-others-list* - (let ((s5-2 (-> v1-155 next0))) - (while (!= v1-155 (-> *collide-hit-by-others-list* alive-list-end)) - (let* ((v1-156 (the-as collide-shape (-> (the-as connection v1-155) param1))) - (s4-2 (-> v1-156 root-prim)) - ) - (when (logtest? (-> s4-2 prim-core collide-as) (collide-spec enemy obstacle hit-by-others-list)) - (set! sv-1536 (as-type (-> v1-156 process) process-focusable)) - (when (and sv-1536 - (< (-> this num-onscreen-targets) 32) - (not (logtest? (-> (the-as process-focusable sv-1536) focus-status) (focus-status disable dead ignore inactive)) - ) - ) - (let ((s3-19 (new 'stack-no-clear 'vector))) - (vector-copy! s3-19 (get-trans (the-as process-focusable sv-1536) 3)) - (set! sv-1584 s3-19) - ) - (set! sv-1588 (new 'stack-no-clear 'vector)) - (set! sv-1592 (the-as float 0.0)) - (set! sv-1592 (vector-vector-distance (-> this root trans) sv-1584)) - (vector-! sv-1588 sv-1584 (camera-pos)) - (when (and (< 1.0 (vector-dot sv-1588 (-> (camera-matrix) fvec))) (< sv-1592 819200.0)) - (set! sv-1632 (new 'stack-no-clear 'vector)) - (set! sv-1636 (vector+float*! (new 'stack-no-clear 'vector) (-> this root trans) (-> this aim-dir) 40960.0)) - (set! sv-1640 (the-as float 0.0)) - (set-vector! sv-1636 (lerp 0.0 512.0 (-> this roty)) (lerp 0.0 416.0 (-> this rotx)) 0.0 1.0) - (+! (-> sv-1636 x) -256.0) - (+! (-> sv-1636 y) -208.0) - (+! (-> sv-1636 x) 2048.0) - (+! (-> sv-1636 y) 2048.0) - (transform-point-vector! sv-1632 sv-1584) - (set! (-> sv-1632 z) 0.0) - (set! sv-1712 (new 'stack-no-clear 'vector)) - (set! sv-1716 (new 'stack-no-clear 'vector)) - (set! sv-1720 (new 'stack-no-clear 'vector)) - (set! sv-1724 (new 'stack-no-clear 'vector)) - (vector+float*! sv-1712 sv-1584 (-> (camera-matrix) rvec) (* 0.6 (-> s4-2 prim-core world-sphere w))) - (vector+float*! sv-1716 sv-1584 (-> (camera-matrix) rvec) (* 0.6 (- (-> s4-2 prim-core world-sphere w)))) - (transform-point-vector! sv-1720 sv-1712) - (transform-point-vector! sv-1724 sv-1716) - (set! (-> sv-1720 z) 0.0) - (set! (-> sv-1724 z) 0.0) - (set! sv-1728 (* 0.5 (vector-vector-distance sv-1720 sv-1724))) - (set! sv-1732 (-> this onscreen-targets (-> this num-onscreen-targets))) - (set! sv-1640 (vector-vector-distance sv-1636 sv-1632)) - (set! sv-1640 (- sv-1640 sv-1728)) - (let ((a1-39 (new 'stack-no-clear 'collide-query))) - (vector-copy! (-> a1-39 start-pos) (-> this root trans)) - (vector-! (-> a1-39 move-dist) sv-1584 (-> a1-39 start-pos)) - (let ((v1-208 a1-39)) - (set! (-> v1-208 radius) 40.96) - (set! (-> v1-208 collide-with) (collide-spec backgnd)) - (set! (-> v1-208 ignore-process0) #f) - (set! (-> v1-208 ignore-process1) #f) - (set! (-> v1-208 ignore-pat) - (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) + (when #f + (let ((v1-80 (-> *collide-hit-by-player-list* alive-list next0))) + *collide-hit-by-player-list* + (let ((s5-1 (-> v1-80 next0))) + (while (!= v1-80 (-> *collide-hit-by-player-list* alive-list-end)) + (let* ((v1-81 (the-as collide-shape (-> (the-as connection v1-80) param1))) + (s4-1 (-> v1-81 root-prim)) + ) + (when (logtest? (-> s4-1 prim-core collide-as) (collide-spec enemy obstacle hit-by-others-list)) + (let ((sv-784 (as-type (-> v1-81 process) process-focusable))) + (when (and sv-784 + (< (-> this num-onscreen-targets) 32) + (not (logtest? (-> (the-as process-focusable sv-784) focus-status) (focus-status disable dead ignore inactive)) + ) + ) + (let ((s3-10 (new 'stack-no-clear 'vector))) + (vector-copy! s3-10 (get-trans (the-as process-focusable sv-784) 3)) + (let ((sv-832 s3-10) + (sv-836 (new 'stack-no-clear 'vector)) + (sv-840 (the-as float 0.0)) ) - (set! (-> v1-208 action-mask) (collide-action solid)) - ) - (when (< (fill-and-probe-using-line-sphere *collide-cache* a1-39) 0.0) - (when (< sv-1640 sv-16) - (set! sv-20 sv-1536) - (set! sv-16 sv-1640) - (vector-copy! (-> this hit-pos) sv-1584) - (set! sv-24 (-> this num-onscreen-targets)) + (set! sv-840 (vector-vector-distance (-> this root trans) sv-832)) + (vector-! sv-836 sv-832 (camera-pos)) + (when (and (< 1.0 (vector-dot sv-836 (-> (camera-matrix) fvec))) (< sv-840 819200.0)) + (let ((sv-880 (new 'stack-no-clear 'vector)) + (sv-884 (vector+float*! (new 'stack-no-clear 'vector) (-> this root trans) (-> this aim-dir) 40960.0)) + (sv-888 (the-as float 0.0)) + ) + (set-vector! sv-884 (lerp 0.0 512.0 (-> this roty)) (lerp 0.0 416.0 (-> this rotx)) 0.0 1.0) + (+! (-> sv-884 x) -256.0) + (+! (-> sv-884 y) -208.0) + (+! (-> sv-884 x) 2048.0) + (+! (-> sv-884 y) 2048.0) + (transform-point-vector! sv-880 sv-832) + (set! (-> sv-880 z) 0.0) + (let ((sv-960 (new 'stack-no-clear 'vector)) + (sv-964 (new 'stack-no-clear 'vector)) + (sv-968 (new 'stack-no-clear 'vector)) + (sv-972 (new 'stack-no-clear 'vector)) + ) + (vector+float*! sv-960 sv-832 (-> (camera-matrix) rvec) (* 0.6 (-> s4-1 prim-core world-sphere w))) + (vector+float*! sv-964 sv-832 (-> (camera-matrix) rvec) (* 0.6 (- (-> s4-1 prim-core world-sphere w)))) + (transform-point-vector! sv-968 sv-960) + (transform-point-vector! sv-972 sv-964) + (set! (-> sv-968 z) 0.0) + (set! (-> sv-972 z) 0.0) + (let ((sv-976 (* 0.5 (vector-vector-distance sv-968 sv-972))) + (sv-980 (-> this onscreen-targets (-> this num-onscreen-targets))) + ) + (set! sv-888 (- (vector-vector-distance sv-884 sv-880) sv-976)) + (let ((a1-25 (new 'stack-no-clear 'collide-query))) + (vector-copy! (-> a1-25 start-pos) (-> this root trans)) + (vector-! (-> a1-25 move-dist) sv-832 (-> a1-25 start-pos)) + (let ((v1-133 a1-25)) + (set! (-> v1-133 radius) 40.96) + (set! (-> v1-133 collide-with) (collide-spec backgnd)) + (set! (-> v1-133 ignore-process0) #f) + (set! (-> v1-133 ignore-process1) #f) + (set! (-> v1-133 ignore-pat) + (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) + ) + (set! (-> v1-133 action-mask) (collide-action solid)) + ) + (when (< (fill-and-probe-using-line-sphere *collide-cache* a1-25) 0.0) + (when (< sv-888 sv-16) + (set! sv-20 sv-784) + (set! sv-16 sv-888) + (vector-copy! (-> this hit-pos) sv-832) + (set! sv-24 (-> this num-onscreen-targets)) + ) + (transform-point-qword! (-> sv-980 transformed-pos) sv-832) + (set! (-> sv-980 hit?) #f) + (set! (-> sv-980 hand) (process->handle sv-784)) + (set! (-> sv-980 size) sv-976) + (set! (-> sv-980 alpha) (lerp-scale-clamp 0.0 1.0 sv-840 20480.0 61440.0)) + (+! (-> this num-onscreen-targets) 1) + ) + ) + ) + ) + ) + ) ) - (transform-point-qword! (-> sv-1732 transformed-pos) sv-1584) - (set! (-> sv-1732 hit?) #f) - (set! (-> sv-1732 hand) (process->handle sv-1536)) - (set! (-> sv-1732 size) sv-1728) - (set! (-> sv-1732 alpha) (lerp-scale-clamp 0.0 1.0 sv-1592 20480.0 61440.0)) - (+! (-> this num-onscreen-targets) 1) ) ) ) ) ) + (set! v1-80 s5-1) + *collide-hit-by-player-list* + (set! s5-1 (-> s5-1 next0)) + ) + ) + ) + ) + (when #t + (let ((v1-155 (-> *collide-hit-by-others-list* alive-list next0))) + *collide-hit-by-others-list* + (let ((s5-2 (-> v1-155 next0))) + (while (!= v1-155 (-> *collide-hit-by-others-list* alive-list-end)) + (let* ((v1-156 (the-as collide-shape (-> (the-as connection v1-155) param1))) + (s4-2 (-> v1-156 root-prim)) + ) + (when (logtest? (-> s4-2 prim-core collide-as) (collide-spec enemy obstacle hit-by-others-list)) + (let ((sv-1536 (as-type (-> v1-156 process) process-focusable))) + (when (and sv-1536 + (< (-> this num-onscreen-targets) 32) + (not (logtest? (-> (the-as process-focusable sv-1536) focus-status) (focus-status disable dead ignore inactive)) + ) + ) + (let ((s3-19 (new 'stack-no-clear 'vector))) + (vector-copy! s3-19 (get-trans (the-as process-focusable sv-1536) 3)) + (let ((sv-1584 s3-19) + (sv-1588 (new 'stack-no-clear 'vector)) + (sv-1592 (the-as float 0.0)) + ) + (set! sv-1592 (vector-vector-distance (-> this root trans) sv-1584)) + (vector-! sv-1588 sv-1584 (camera-pos)) + (when (and (< 1.0 (vector-dot sv-1588 (-> (camera-matrix) fvec))) (< sv-1592 819200.0)) + (let ((sv-1632 (new 'stack-no-clear 'vector)) + (sv-1636 (vector+float*! (new 'stack-no-clear 'vector) (-> this root trans) (-> this aim-dir) 40960.0)) + (sv-1640 (the-as float 0.0)) + ) + (set-vector! sv-1636 (lerp 0.0 512.0 (-> this roty)) (lerp 0.0 416.0 (-> this rotx)) 0.0 1.0) + (+! (-> sv-1636 x) -256.0) + (+! (-> sv-1636 y) -208.0) + (+! (-> sv-1636 x) 2048.0) + (+! (-> sv-1636 y) 2048.0) + (transform-point-vector! sv-1632 sv-1584) + (set! (-> sv-1632 z) 0.0) + (let ((sv-1712 (new 'stack-no-clear 'vector)) + (sv-1716 (new 'stack-no-clear 'vector)) + (sv-1720 (new 'stack-no-clear 'vector)) + (sv-1724 (new 'stack-no-clear 'vector)) + ) + (vector+float*! sv-1712 sv-1584 (-> (camera-matrix) rvec) (* 0.6 (-> s4-2 prim-core world-sphere w))) + (vector+float*! sv-1716 sv-1584 (-> (camera-matrix) rvec) (* 0.6 (- (-> s4-2 prim-core world-sphere w)))) + (transform-point-vector! sv-1720 sv-1712) + (transform-point-vector! sv-1724 sv-1716) + (set! (-> sv-1720 z) 0.0) + (set! (-> sv-1724 z) 0.0) + (let ((sv-1728 (* 0.5 (vector-vector-distance sv-1720 sv-1724))) + (sv-1732 (-> this onscreen-targets (-> this num-onscreen-targets))) + ) + (set! sv-1640 (- (vector-vector-distance sv-1636 sv-1632) sv-1728)) + (let ((a1-39 (new 'stack-no-clear 'collide-query))) + (vector-copy! (-> a1-39 start-pos) (-> this root trans)) + (vector-! (-> a1-39 move-dist) sv-1584 (-> a1-39 start-pos)) + (let ((v1-208 a1-39)) + (set! (-> v1-208 radius) 40.96) + (set! (-> v1-208 collide-with) (collide-spec backgnd)) + (set! (-> v1-208 ignore-process0) #f) + (set! (-> v1-208 ignore-process1) #f) + (set! (-> v1-208 ignore-pat) + (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) + ) + (set! (-> v1-208 action-mask) (collide-action solid)) + ) + (when (< (fill-and-probe-using-line-sphere *collide-cache* a1-39) 0.0) + (when (< sv-1640 sv-16) + (set! sv-20 sv-1536) + (set! sv-16 sv-1640) + (vector-copy! (-> this hit-pos) sv-1584) + (set! sv-24 (-> this num-onscreen-targets)) + ) + (transform-point-qword! (-> sv-1732 transformed-pos) sv-1584) + (set! (-> sv-1732 hit?) #f) + (set! (-> sv-1732 hand) (process->handle sv-1536)) + (set! (-> sv-1732 size) sv-1728) + (set! (-> sv-1732 alpha) (lerp-scale-clamp 0.0 1.0 sv-1592 20480.0 61440.0)) + (+! (-> this num-onscreen-targets) 1) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + (set! v1-155 s5-2) + *collide-hit-by-others-list* + (set! s5-2 (-> s5-2 next0)) ) - (set! v1-155 s5-2) - *collide-hit-by-others-list* - (set! s5-2 (-> s5-2 next0)) ) ) ) ) - ) - (cond - (sv-20 - (let ((s5-3 (process->handle sv-20))) - (when (or (!= (-> this target-hand) s5-3) (not (-> this found-target?))) - (let ((s4-3 (-> this hud-pers (-> this onscreen-targets sv-24 target-pers-index)))) - (set! (-> s4-3 alpha) 0.0) - (set! (-> s4-3 rotate) 0.0) - (when (time-elapsed? (-> this last-beep-time) (seconds 0.1)) - (sound-play "tracking-beep1" :vol 90) - (set-time! (-> this last-beep-time)) + (cond + (sv-20 + (let ((s5-3 (process->handle sv-20))) + (when (or (!= (-> this target-hand) s5-3) (not (-> this found-target?))) + (let ((s4-3 (-> this hud-pers (-> this onscreen-targets sv-24 target-pers-index)))) + (set! (-> s4-3 alpha) 0.0) + (set! (-> s4-3 rotate) 0.0) + (when (time-elapsed? (-> this last-beep-time) (seconds 0.1)) + (sound-play "tracking-beep1" :vol 90) + (set-time! (-> this last-beep-time)) + ) + (set! (-> s4-3 size-scalar) 4.0) + (set-time! (-> s4-3 hold-start-time)) ) - (set! (-> s4-3 size-scalar) 4.0) - (set-time! (-> s4-3 hold-start-time)) ) + (set! (-> this target-hand) (the-as handle s5-3)) + ) + (set! (-> this found-target?) #t) + (let ((v0-53 (the-as object #t))) + (set! (-> this onscreen-targets sv-24 hit?) (the-as symbol v0-53)) + v0-53 ) - (set! (-> this target-hand) (the-as handle s5-3)) ) - (set! (-> this found-target?) #t) - (let ((v0-53 (the-as object #t))) - (set! (-> this onscreen-targets sv-24 hit?) (the-as symbol v0-53)) - v0-53 + (else + (set! (-> this found-target?) #f) + (vector+float*! (-> this hit-pos) (-> this root trans) (-> this aim-dir) 327680.0) ) ) - (else - (set! (-> this found-target?) #f) - (vector+float*! (-> this hit-pos) (-> this root trans) (-> this aim-dir) 327680.0) - ) ) ) @@ -3370,7 +3315,7 @@ ;; definition for method 31 of type bt-hellcat ;; INFO: Used lq/sq (defmethod bt-vehicle-method-31 ((this bt-hellcat)) - (local-vars (f30-2 float) (sv-256 vector) (sv-260 vector) (sv-264 vector) (sv-268 vector)) + (local-vars (f30-2 float)) (set-vector! (-> this rider-spots data 0 offset-pos) 0.0 0.0 0.0 1.0) (set-vector! (-> this rider-spots data 1 offset-pos) 0.0 0.0 0.0 1.0) (let ((s5-0 (new 'stack 'blow-tower-clock))) @@ -3437,73 +3382,75 @@ ) (let ((v1-58 (new 'stack-no-clear 'vector))) (vector-copy! v1-58 (-> this path-cursor norm)) - (set! sv-256 v1-58) - ) - (set! sv-260 (vector-x-quaternion! (new 'stack-no-clear 'vector) (-> this root quat))) - (set! sv-264 (vector-z-quaternion! (new 'stack-no-clear 'vector) (-> this root quat))) - (set! sv-268 (new 'stack-no-clear 'vector)) - (set! (-> sv-260 y) 0.0) - (vector-normalize! sv-260 1.0) - (set! (-> sv-264 y) 0.0) - (vector-normalize! sv-264 1.0) - (set! (-> sv-256 y) 0.0) - (vector-normalize! sv-256 1.0) - (seek! - (-> this roll-amount) - (-> this dest-roll-amount) - (* (-> this roll-amount-seek-rate) (seconds-per-frame)) - ) - (let ((s4-2 (quaternion-look-at! (new 'stack-no-clear 'quaternion) sv-256 *up-vector*)) - (f30-1 (seconds-per-frame)) - ) - 0.0 - (let ((v1-68 (the-as bt-gun-manager (handle->process (-> this child-turret)))) - (s3-3 (-> this pitch-quat)) + (let ((sv-256 v1-58) + (sv-260 (vector-x-quaternion! (new 'stack-no-clear 'vector) (-> this root quat))) + (sv-264 (vector-z-quaternion! (new 'stack-no-clear 'vector) (-> this root quat))) + (sv-268 (new 'stack-no-clear 'vector)) ) - (let ((f28-1 (-> this roll-amount))) - (vector-rotate-around-axis! sv-268 sv-260 (-> v1-68 rot-y-shift) *up-vector*) - (quaternion-vector-angle! s3-3 sv-268 f28-1) + (set! (-> sv-260 y) 0.0) + (vector-normalize! sv-260 1.0) + (set! (-> sv-264 y) 0.0) + (vector-normalize! sv-264 1.0) + (set! (-> sv-256 y) 0.0) + (vector-normalize! sv-256 1.0) + (seek! + (-> this roll-amount) + (-> this dest-roll-amount) + (* (-> this roll-amount-seek-rate) (seconds-per-frame)) ) - (quaternion*! s4-2 s3-3 s4-2) - ) - (let* ((f0-33 (vector-dot sv-256 sv-264)) - (f1-5 (* 2.5 (- 1.0 f0-33))) - (f0-36 (- 1.0 (* (- 1.0 f1-5) (- 1.0 f1-5)))) - ) - (if (< 0.0 (vector-dot sv-256 sv-260)) - (set! f0-36 (* -1.0 f0-36)) + (let ((s4-2 (quaternion-look-at! (new 'stack-no-clear 'quaternion) sv-256 *up-vector*)) + (f30-1 (seconds-per-frame)) + ) + 0.0 + (let ((v1-68 (the-as bt-gun-manager (handle->process (-> this child-turret)))) + (s3-3 (-> this pitch-quat)) + ) + (let ((f28-1 (-> this roll-amount))) + (vector-rotate-around-axis! sv-268 sv-260 (-> v1-68 rot-y-shift) *up-vector*) + (quaternion-vector-angle! s3-3 sv-268 f28-1) + ) + (quaternion*! s4-2 s3-3 s4-2) ) - (quaternion-rotate-local-z! s4-2 s4-2 (* 8192.0 f0-36)) - ) - (if (-> s5-0 debug?) - (set! f30-1 1.0) + (let* ((f0-33 (vector-dot sv-256 sv-264)) + (f1-5 (* 2.5 (- 1.0 f0-33))) + (f0-36 (- 1.0 (* (- 1.0 f1-5) (- 1.0 f1-5)))) + ) + (if (< 0.0 (vector-dot sv-256 sv-260)) + (set! f0-36 (* -1.0 f0-36)) + ) + (quaternion-rotate-local-z! s4-2 s4-2 (* 8192.0 f0-36)) + ) + (if (-> s5-0 debug?) + (set! f30-1 1.0) + ) + (let ((f0-38 (-> this path-height-vel))) + 0.0 + (let ((f0-41 (fmax -1.0 (fmin 1.0 (/ f0-38 (meters 10)))))) + (quaternion-rotate-local-x! s4-2 s4-2 (* -4551.1113 f0-41)) + ) + ) + (quaternion-slerp! (-> this quat-before-bounce) (-> this quat-before-bounce) s4-2 f30-1) ) - (let ((f0-38 (-> this path-height-vel))) - 0.0 - (let ((f0-41 (fmax -1.0 (fmin 1.0 (/ f0-38 (meters 10)))))) - (quaternion-rotate-local-x! s4-2 s4-2 (* -4551.1113 f0-41)) + (quaternion-copy! (-> this root quat) (-> this quat-before-bounce)) + (let ((s5-1 (new 'stack-no-clear 'quaternion))) + 1.0 + (set! f30-2 (cond + ((handle->process (-> this grunt-rider-boarded?)) + (quaternion-vector-angle! s5-1 sv-268 1820.4445) + 5.0 + ) + (else + (set! f30-2 1.0) + (quaternion-identity! s5-1) + f30-2 + ) + ) + ) + (quaternion-slerp! (-> this quat-grunt-tilt) (-> this quat-grunt-tilt) s5-1 (* f30-2 (seconds-per-frame))) ) ) - (quaternion-slerp! (-> this quat-before-bounce) (-> this quat-before-bounce) s4-2 f30-1) ) ) - (quaternion-copy! (-> this root quat) (-> this quat-before-bounce)) - (let ((s5-1 (new 'stack-no-clear 'quaternion))) - 1.0 - (set! f30-2 (cond - ((handle->process (-> this grunt-rider-boarded?)) - (quaternion-vector-angle! s5-1 sv-268 1820.4445) - 5.0 - ) - (else - (set! f30-2 1.0) - (quaternion-identity! s5-1) - f30-2 - ) - ) - ) - (quaternion-slerp! (-> this quat-grunt-tilt) (-> this quat-grunt-tilt) s5-1 (* f30-2 (seconds-per-frame))) - ) (quaternion*! (-> this root quat) (-> this quat-grunt-tilt) (-> this quat-before-bounce)) (when (time-elapsed? (-> this state-time) (seconds 0.2)) (let ((s5-2 (new 'stack-no-clear 'quaternion)) diff --git a/test/decompiler/reference/jak3/levels/city/bombbot/bombbot_REF.gc b/test/decompiler/reference/jak3/levels/city/bombbot/bombbot_REF.gc index e195f9a257..efd6f02816 100644 --- a/test/decompiler/reference/jak3/levels/city/bombbot/bombbot_REF.gc +++ b/test/decompiler/reference/jak3/levels/city/bombbot/bombbot_REF.gc @@ -1396,16 +1396,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-194 ((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) - (sv-960 uint) - ) + (local-vars (at-0 int)) (with-pp (rlet ((acc :class vf) (vf0 :class vf) @@ -1462,19 +1453,21 @@ (toggle-cspec-deadly this #t (+ s4-0 1)) (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-40 s3-0)) - (.lvf vf1 (&-> sv-864 quad)) - (.lvf vf2 (&-> v1-40 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-40 s3-0)) + (.lvf vf1 (&-> sv-864 quad)) + (.lvf vf2 (&-> v1-40 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-6 s0-0) (v1-42 s0-0) (a0-12 (new 'stack-no-clear 'vector)) @@ -1563,66 +1556,37 @@ (when (-> s1-0 moving) (vector-copy! (-> s1-0 position) (-> s1-0 next-position)) (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-36 (camera-pos)) - (a1-23 (-> s1-0 position)) - (a2-20 (sv-928 a0-36 a1-23)) - (a3-2 40960.0) - (t0-1 409600.0) - (f30-1 (s0-1 sv-896 sv-912 a2-20 a3-2 t0-1)) - ) - (when (and (!= f30-1 0.0) (< 16384.0 (vector-length (-> s1-0 speed)))) - (if (bombbot-method-207 this) - (activate! *camera-smush-control* f30-1 37 600 1.0 0.1 (-> pp clock)) - ) - (cond - ((logtest? (-> group-land-poof-stn flags) (sp-group-flag sp13)) - (vector-copy! (-> *launch-matrix* trans) (-> s1-0 position)) - (part-tracker-spawn part-tracker-subsampler :to this :group group-land-poof-stn) - ) - (else - (vector-copy! (-> *launch-matrix* trans) (-> s1-0 position)) - (part-tracker-spawn part-tracker :to this :group group-land-poof-stn) - ) - ) - (when (or (zero? s4-0) (= s4-0 1)) - (cond - ((and *target* (focus-test? *target* grabbed)) - (let ((s0-4 sound-play-by-name)) - (set! sv-944 (make-u128 #x6d6163 (the-as uint #x2d6b6c61772d6262))) - (let ((a1-32 (new-sound-id)) - (a2-32 1024) - (a3-8 0) - (t0-3 0) - (t1-2 0) - (t2-1 (-> s1-0 position)) - ) - (s0-4 (the-as sound-name sv-944) a1-32 a2-32 a3-8 t0-3 (the-as sound-group t1-2) t2-1) + (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 ) ) - ) - (else - (let ((s0-5 sound-play-by-name)) - (set! sv-960 (make-u128 0 (the-as uint #x6b6c61772d6262))) - (let ((a1-33 (new-sound-id)) - (a2-33 1024) - (a3-9 0) - (t0-4 0) - (t1-3 0) - (t2-2 (-> s1-0 position)) - ) - (s0-5 (the-as sound-name sv-960) a1-33 a2-33 a3-9 t0-4 (the-as sound-group t1-3) t2-2) - ) - ) - ) - ) - (if (bombbot-method-207 this) - (cpad-set-buzz! (-> *cpad-list* cpads 0) 1 (the int (* 255.0 (* 0.00061035156 f30-1))) (seconds 0.2)) - ) + ) + (when (and (!= f30-1 0.0) (< 16384.0 (vector-length (-> s1-0 speed)))) + (if (bombbot-method-207 this) + (activate! *camera-smush-control* f30-1 37 600 1.0 0.1 (-> pp clock)) ) + (cond + ((logtest? (-> group-land-poof-stn flags) (sp-group-flag sp13)) + (vector-copy! (-> *launch-matrix* trans) (-> s1-0 position)) + (part-tracker-spawn part-tracker-subsampler :to this :group group-land-poof-stn) + ) + (else + (vector-copy! (-> *launch-matrix* trans) (-> s1-0 position)) + (part-tracker-spawn part-tracker :to this :group group-land-poof-stn) + ) + ) + (when (or (zero? s4-0) (= s4-0 1)) + (if (and *target* (focus-test? *target* grabbed)) + (sound-play "bb-walk-cam" :position (-> s1-0 position)) + (sound-play "bb-walk" :position (-> s1-0 position)) + ) + (if (bombbot-method-207 this) + (cpad-set-buzz! (-> *cpad-list* cpads 0) 1 (the int (* 255.0 (* 0.00061035156 f30-1))) (seconds 0.2)) + ) ) ) ) @@ -1674,7 +1638,6 @@ ;; WARN: Return type mismatch int vs none. (defmethod enemy-common-post ((this bombbot)) "Common implementation of post. Runs ja-post." - (local-vars (sv-48 sparticle-launcher) (sv-52 sparticle-launcher)) (let ((t9-0 (method-of-type nav-enemy enemy-common-post))) (t9-0 this) ) @@ -1709,56 +1672,61 @@ (the-as (function rigid-body-object float none) (method-of-object this bombbot-method-198)) ) (bombbot-method-199 this) - (set! sv-48 (the-as sparticle-launcher #f)) - (set! sv-52 (the-as sparticle-launcher #f)) - (cond - ((< (-> this hit-points) (* 0.33 (-> this max-hit-points))) - (set! sv-48 (-> *part-id-table* 925)) - (set! sv-52 (-> *part-id-table* 921)) - ) - ((< (-> this hit-points) (* 0.66 (-> this max-hit-points))) - (set! sv-48 (-> *part-id-table* 928)) - ) - (else - (if (< (rand-vu) 0.05) - (set! sv-48 (-> *part-id-table* 930)) + (let ((sv-48 (the-as sparticle-launcher #f)) + (sv-52 (the-as sparticle-launcher #f)) + ) + (set! sv-48 (cond + ((< (-> this hit-points) (* 0.33 (-> this max-hit-points))) + (set! sv-48 (-> *part-id-table* 925)) + (set! sv-52 (-> *part-id-table* 921)) + sv-48 + ) + ((< (-> this hit-points) (* 0.66 (-> this max-hit-points))) + (-> *part-id-table* 928) + ) + (else + (if (< (rand-vu) 0.05) + (set! sv-48 (-> *part-id-table* 930)) + ) + sv-48 + ) + ) ) - ) - ) - (when sv-48 - (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-52 (< (rand-vu) 0.005)) - (let ((t9-15 sp-launch-particles-var) - (a0-23 *sp-particle-system-2d*) - (a1-10 sv-48) - (a2-2 *launch-matrix*) - ) - (vector-copy! (-> a2-2 trans) s5-3) - (t9-15 a0-23 a1-10 a2-2 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0) + (when sv-48 + (let ((gp-1 (-> this node-list data 4 bone transform)) + (s5-3 (new 'stack-no-clear 'vector)) ) - ) - (let ((t9-16 sp-launch-particles-var) - (a0-24 *sp-particle-system-2d*) - (a1-11 sv-48) - (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-52 (< (rand-vu) 0.005)) + (let ((t9-15 sp-launch-particles-var) + (a0-23 *sp-particle-system-2d*) + (a1-10 sv-48) + (a2-2 *launch-matrix*) + ) + (vector-copy! (-> a2-2 trans) s5-3) + (t9-15 a0-23 a1-10 a2-2 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0) ) - (vector-copy! (-> a2-3 trans) s5-3) - (t9-16 a0-24 a1-11 a2-3 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0) + ) + (let ((t9-16 sp-launch-particles-var) + (a0-24 *sp-particle-system-2d*) + (a1-11 sv-48) + (a2-3 *launch-matrix*) + ) + (vector-copy! (-> a2-3 trans) s5-3) + (t9-16 a0-24 a1-11 a2-3 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0) + ) ) ) ) @@ -3037,13 +3005,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) (vf1 :class vf) (vf2 :class vf) @@ -3065,25 +3026,24 @@ (vector-copy! s1-0 (-> v1-3 pos-offset)) (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-9 (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-9 quad) vf3) - (let ((a2-5 (t9-4 a0-14 a1-9 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-9 (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-9 quad) vf3) + (sv-176 sv-192 sv-208 (t9-4 a0-14 a1-9 f0-8)) ) ) ) @@ -3159,7 +3119,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) @@ -3167,34 +3126,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 fvec)) - (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) - (vector-copy! (-> arg0 bone transform trans) s5-0) ) + (rot-zxy-from-vector! s0-0 (-> arg0 bone transform fvec)) + (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) + (vector-copy! (-> arg0 bone transform trans) s5-0) ) 0 (none) @@ -3205,7 +3165,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) @@ -3220,15 +3179,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 fvec)) (rot-zxy-from-vector! s1-0 s0-0) (set! (-> s3-0 x) (fmax -4551.1113 (fmin 4551.1113 (deg- (-> s1-0 x) (-> s2-0 x))))) @@ -3291,7 +3252,7 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defmethod bombbot-method-198 ((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) @@ -3315,13 +3276,11 @@ (-> this rigidbody matrix) ) ) + (sv-160 (new 'stack-no-clear 'vector)) ) - (set! sv-160 (new 'stack-no-clear 'vector)) - (let ((v1-19 (-> *bombbot-spring-setup* s5-0 wpos2 quad))) - (set! (-> sv-160 quad) v1-19) - ) - (set! sv-176 (new 'stack-no-clear 'vector)) - (let ((s0-0 (new 'stack-no-clear 'vector)) + (vector-copy! sv-160 (-> *bombbot-spring-setup* s5-0 wpos2)) + (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)) @@ -3339,11 +3298,7 @@ (.sub.vf.xyz vf6 vf4 vf5) (.svf (&-> v1-31 quad) vf6) ) - (let ((a1-4 s1-0) - (v1-32 *null-vector*) - ) - (vector-! a1-4 sv-176 v1-32) - ) + (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))) @@ -3945,91 +3900,84 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defmethod bombbot-method-196 ((this bombbot-player) (arg0 vector)) - (local-vars - (sv-864 process-drawable) - (sv-868 number) - (sv-872 vector) - (sv-876 vector) - (sv-880 collide-query) - (sv-884 (pointer collide-shape)) - (sv-888 vector) - (sv-896 int) - ) - (set! sv-864 (the-as process-drawable #f)) - (set! sv-868 (gpr->fpr #x7f800000)) - (set! sv-872 (new 'stack-no-clear 'vector)) - (set! sv-876 (new 'stack-no-clear 'vector)) - (set! sv-880 (new 'stack-no-clear 'collide-query)) - (set! sv-884 (new 'stack-no-clear 'array 'collide-shape 64)) - (let ((s5-0 (new 'stack-no-clear 'vector))) - (vector-copy! s5-0 (-> (camera-matrix) fvec)) - (set! sv-888 s5-0) - ) - (set! sv-896 0) - (set! (-> sv-888 y) 0.0) - (vector-normalize! sv-888 1.0) - (vector+*! sv-876 (camera-pos) sv-888 40960.0) - (vector-copy! sv-876 (get-trans this 4)) - (matrix->trans (-> this node-list data 6 bone transform) sv-872) - (set! (-> sv-876 y) (-> sv-872 y)) - (vector-normalize-copy! sv-872 sv-888 204800.0) - (vector-copy! (-> sv-880 start-pos) sv-876) - (vector-copy! (-> sv-880 move-dist) sv-872) - (let ((v1-20 sv-880)) - (set! (-> v1-20 radius) 40.96) - (set! (-> v1-20 collide-with) (collide-spec backgnd)) - (set! (-> v1-20 ignore-process0) this) - (set! (-> v1-20 ignore-process1) #f) - (set! (-> v1-20 ignore-pat) - (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) - ) - (set! (-> v1-20 action-mask) (collide-action solid)) - ) - (let ((f0-5 (fill-and-probe-using-line-sphere *collide-cache* sv-880))) - (if (>= f0-5 0.0) - (vector-float*! sv-872 sv-872 f0-5) + (let ((sv-864 (the-as process-drawable #f)) + (sv-868 (gpr->fpr #x7f800000)) + (sv-872 (new 'stack-no-clear 'vector)) + (sv-876 (new 'stack-no-clear 'vector)) + (sv-880 (new 'stack-no-clear 'collide-query)) + (sv-884 (new 'stack-no-clear 'array 'collide-shape 64)) + (s5-0 (new 'stack-no-clear 'vector)) ) - ) - (set! sv-896 (fill-actor-list-for-sphere *actor-hash* sv-876 sv-872 40960.0 sv-884 64 -1)) - (countdown (s5-4 sv-896) - (let ((a0-19 (as-type (-> sv-884 s5-4) collide-shape))) - (when a0-19 - (let ((s4-1 (as-type (-> a0-19 process) process-focusable)) - (s3-1 (new 'stack-no-clear 'vector)) + (vector-copy! s5-0 (-> (camera-matrix) fvec)) + (let ((sv-888 s5-0) + (sv-896 0) + ) + (set! (-> sv-888 y) 0.0) + (vector-normalize! sv-888 1.0) + (vector+*! sv-876 (camera-pos) sv-888 40960.0) + (vector-copy! sv-876 (get-trans this 4)) + (matrix->trans (-> this node-list data 6 bone transform) sv-872) + (set! (-> sv-876 y) (-> sv-872 y)) + (vector-normalize-copy! sv-872 sv-888 204800.0) + (vector-copy! (-> sv-880 start-pos) sv-876) + (vector-copy! (-> sv-880 move-dist) sv-872) + (let ((v1-20 sv-880)) + (set! (-> v1-20 radius) 40.96) + (set! (-> v1-20 collide-with) (collide-spec backgnd)) + (set! (-> v1-20 ignore-process0) this) + (set! (-> v1-20 ignore-process1) #f) + (set! (-> v1-20 ignore-pat) + (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) ) - (when (and s4-1 - (valid-target? this (the-as process-focusable s4-1)) - (not (logtest? (process-mask guard) (-> s4-1 mask))) - (not (logtest? (process-mask civilian) (-> s4-1 mask))) - (not (logtest? (process-mask vehicle) (-> s4-1 mask))) - ) - (vector-! s3-1 (-> s4-1 root trans) (-> this root trans)) - (set! (-> s3-1 y) 0.0) - (vector-normalize! s3-1 1.0) - (when (< (cos 2730.6667) (vector-dot s3-1 sv-888)) - (let ((f0-8 (vector-vector-xz-distance (-> this root trans) (-> s4-1 root trans)))) - (when (and (or (not sv-864) (< f0-8 (the-as float sv-868))) - (< (-> s4-1 root trans y) (+ 61440.0 (-> this root trans y))) - ) - (set! sv-864 s4-1) - (set! sv-868 f0-8) + (set! (-> v1-20 action-mask) (collide-action solid)) + ) + (let ((f0-5 (fill-and-probe-using-line-sphere *collide-cache* sv-880))) + (if (>= f0-5 0.0) + (vector-float*! sv-872 sv-872 f0-5) + ) + ) + (set! sv-896 (fill-actor-list-for-sphere *actor-hash* sv-876 sv-872 40960.0 sv-884 64 -1)) + (countdown (s5-4 sv-896) + (let ((a0-19 (as-type (-> sv-884 s5-4) collide-shape))) + (when a0-19 + (let ((s4-1 (as-type (-> a0-19 process) process-focusable)) + (s3-1 (new 'stack-no-clear 'vector)) + ) + (when (and s4-1 + (valid-target? this (the-as process-focusable s4-1)) + (not (logtest? (process-mask guard) (-> s4-1 mask))) + (not (logtest? (process-mask civilian) (-> s4-1 mask))) + (not (logtest? (process-mask vehicle) (-> s4-1 mask))) + ) + (vector-! s3-1 (-> s4-1 root trans) (-> this root trans)) + (set! (-> s3-1 y) 0.0) + (vector-normalize! s3-1 1.0) + (when (< (cos 2730.6667) (vector-dot s3-1 sv-888)) + (let ((f0-8 (vector-vector-xz-distance (-> this root trans) (-> s4-1 root trans)))) + (when (and (or (not sv-864) (< f0-8 (the-as float sv-868))) + (< (-> s4-1 root trans y) (+ 61440.0 (-> this root trans y))) + ) + (set! sv-864 s4-1) + (set! sv-868 f0-8) + ) + ) ) ) ) ) ) - ) - ) - (cond - (sv-864 - (vector-copy! (-> this target-pos) (get-trans (the-as process-focusable sv-864) 3)) - (vector-copy! (-> this start-target-pos) (-> sv-864 root trans)) - (vector-copy! (-> this start-target-vel) (-> sv-864 root transv)) - (focus-on! (-> this focus) (the-as process-focusable sv-864) this) - ) - (else - (vector+! (-> this target-pos) sv-876 sv-872) - (clear-focused (-> this focus)) + (cond + (sv-864 + (vector-copy! (-> this target-pos) (get-trans (the-as process-focusable sv-864) 3)) + (vector-copy! (-> this start-target-pos) (-> sv-864 root trans)) + (vector-copy! (-> this start-target-vel) (-> sv-864 root transv)) + (focus-on! (-> this focus) (the-as process-focusable sv-864) this) + ) + (else + (vector+! (-> this target-pos) sv-876 sv-872) + (clear-focused (-> this focus)) + ) + ) ) ) ) diff --git a/test/decompiler/reference/jak3/levels/city/common/cty-borrow-manager_REF.gc b/test/decompiler/reference/jak3/levels/city/common/cty-borrow-manager_REF.gc index 021bbbe9df..e23d014ca9 100644 --- a/test/decompiler/reference/jak3/levels/city/common/cty-borrow-manager_REF.gc +++ b/test/decompiler/reference/jak3/levels/city/common/cty-borrow-manager_REF.gc @@ -97,276 +97,271 @@ ;; definition for method 12 of type cty-borrow-manager ;; WARN: new jak 2 until loop case, check carefully (defmethod cty-borrow-manager-method-12 ((this cty-borrow-manager) (arg0 load-state)) - (local-vars - (sv-16 int) - (sv-24 int) - (sv-32 int) - (sv-40 int) - (sv-48 (array uint16)) - (sv-52 (array uint16)) - (sv-56 (array uint16)) - (sv-60 (array uint16)) - ) - (set! sv-16 0) - (set! sv-24 0) - (set! sv-32 0) - (set! sv-40 0) - (when (zero? (-> *setting-control* user-current level-trans-time)) - (dotimes (v1-3 10) - (set! (-> arg0 target v1-3 name) (-> arg0 want-exp v1-3 name)) - (set! (-> arg0 target v1-3 display?) (-> arg0 want-exp v1-3 display?)) - (set! (-> arg0 target v1-3 force-vis?) (-> arg0 want-exp v1-3 force-vis?)) - (set! (-> arg0 target v1-3 force-inside?) (-> arg0 want-exp v1-3 force-inside?)) - ) - (return 0) - ) - (dotimes (v1-7 10) - (let ((a1-9 (-> arg0 target v1-7 name)) - (a0-15 #f) - ) - (when a1-9 - (dotimes (a2-1 10) - (when (= a1-9 (-> arg0 want-exp a2-1 name)) - (set! a0-15 #t) - 0 - (goto cfg-15) - ) - ) - (label cfg-15) - (if (not a0-15) - (set! sv-16 (logior sv-16 (ash 1 v1-7))) - ) + (let ((sv-16 0) + (sv-24 0) + (sv-32 0) ) - ) - ) - (dotimes (v1-10 10) - (let ((a1-15 (-> arg0 want-exp v1-10 name)) - (a0-19 #f) + (let ((sv-40 0)) + (when (zero? (-> *setting-control* user-current level-trans-time)) + (dotimes (v1-3 10) + (set! (-> arg0 target v1-3 name) (-> arg0 want-exp v1-3 name)) + (set! (-> arg0 target v1-3 display?) (-> arg0 want-exp v1-3 display?)) + (set! (-> arg0 target v1-3 force-vis?) (-> arg0 want-exp v1-3 force-vis?)) + (set! (-> arg0 target v1-3 force-inside?) (-> arg0 want-exp v1-3 force-inside?)) ) - (when a1-15 - (dotimes (a2-6 10) - (when (= a1-15 (-> arg0 target a2-6 name)) - (set! a0-19 #t) - 0 - (goto cfg-31) - ) - ) - (label cfg-31) - (if (not a0-19) - (set! sv-24 (logior sv-24 (ash 1 v1-10))) - ) + (return 0) ) - ) - ) - (set! sv-48 (new 'static 'boxed-array :type uint16 :length 0 :allocated-length 6)) - (set! sv-52 (new 'static 'boxed-array :type uint16 :length 0 :allocated-length 6)) - (set! sv-56 (new 'static 'boxed-array :type uint16 :length 0 :allocated-length 6)) - (set! sv-60 (new 'static 'boxed-array :type uint16 :length 0 :allocated-length 6)) - (dotimes (v1-17 5) - (set! (-> sv-48 v1-17) (the-as uint 0)) - (set! (-> sv-52 v1-17) (the-as uint 0)) - (set! (-> sv-60 v1-17) (the-as uint 0)) - ) - (set! (-> sv-56 0) (the-as uint 3)) - (set! (-> sv-56 1) (the-as uint 0)) - (set! (-> sv-56 2) (the-as uint 0)) - (set! (-> sv-56 3) (the-as uint 1)) - (set! (-> sv-56 4) (the-as uint 1)) - (set! (-> sv-56 5) (the-as uint 10)) - (dotimes (s4-0 10) - (when (logtest? sv-16 (ash 1 s4-0)) - (let ((v1-29 #f) - (s3-0 (-> arg0 target s4-0 name)) - ) - (dotimes (a0-35 (-> this borrow-holds length)) - (when (= (-> this borrow-holds data a0-35 name) s3-0) - (set! v1-29 (parent-also-loaded? arg0 s3-0)) - 0 - (goto cfg-53) + (dotimes (v1-7 10) + (let ((a1-9 (-> arg0 target v1-7 name)) + (a0-15 #f) + ) + (when a1-9 + (dotimes (a2-1 10) + (when (= a1-9 (-> arg0 want-exp a2-1 name)) + (set! a0-15 #t) + 0 + (goto cfg-15) + ) + ) + (label cfg-15) + (if (not a0-15) + (logior! sv-16 (ash 1 v1-7)) + ) ) ) - (label cfg-53) - (when v1-29 - (set! sv-16 (logclear sv-16 (ash 1 s4-0))) - (set! sv-32 (logior sv-32 (ash 1 s4-0))) - (let ((v1-34 (-> (lookup-level-info s3-0) memory-mode))) - -1 - (let ((v1-35 - (cond - ((= v1-34 (level-memory-mode borrow3)) - 3 - ) - ((= v1-34 (level-memory-mode borrow4)) - 4 - ) - ((= v1-34 (level-memory-mode borrow-city-small)) - 0 - ) - ((or (= v1-34 (level-memory-mode borrow0)) - (= v1-34 (level-memory-mode borrow1)) - (= v1-34 (level-memory-mode borrow2)) - ) - (break!) - 0 - ) - (else - 5 + ) + (dotimes (v1-10 10) + (let ((a1-15 (-> arg0 want-exp v1-10 name)) + (a0-19 #f) + ) + (when a1-15 + (dotimes (a2-6 10) + (when (= a1-15 (-> arg0 target a2-6 name)) + (set! a0-19 #t) + 0 + (goto cfg-31) + ) + ) + (label cfg-31) + (if (not a0-19) + (logior! sv-24 (ash 1 v1-10)) + ) + ) + ) + ) + (let ((sv-48 (new 'static 'boxed-array :type uint16 :length 0 :allocated-length 6)) + (sv-52 (new 'static 'boxed-array :type uint16 :length 0 :allocated-length 6)) + (sv-56 (new 'static 'boxed-array :type uint16 :length 0 :allocated-length 6)) + (sv-60 (new 'static 'boxed-array :type uint16 :length 0 :allocated-length 6)) + ) + (dotimes (v1-17 5) + (set! (-> sv-48 v1-17) (the-as uint 0)) + (set! (-> sv-52 v1-17) (the-as uint 0)) + (set! (-> sv-60 v1-17) (the-as uint 0)) + ) + (set! (-> sv-56 0) (the-as uint 3)) + (set! (-> sv-56 1) (the-as uint 0)) + (set! (-> sv-56 2) (the-as uint 0)) + (set! (-> sv-56 3) (the-as uint 1)) + (set! (-> sv-56 4) (the-as uint 1)) + (set! (-> sv-56 5) (the-as uint 10)) + (dotimes (s4-0 10) + (when (logtest? sv-16 (ash 1 s4-0)) + (let ((v1-29 #f) + (s3-0 (-> arg0 target s4-0 name)) + ) + (dotimes (a0-35 (-> this borrow-holds length)) + (when (= (-> this borrow-holds data a0-35 name) s3-0) + (set! v1-29 (parent-also-loaded? arg0 s3-0)) + 0 + (goto cfg-53) + ) + ) + (label cfg-53) + (when v1-29 + (logclear! sv-16 (ash 1 s4-0)) + (logior! sv-32 (ash 1 s4-0)) + (let ((v1-34 (-> (lookup-level-info s3-0) memory-mode))) + -1 + (let ((v1-35 + (cond + ((= v1-34 (level-memory-mode borrow3)) + 3 + ) + ((= v1-34 (level-memory-mode borrow4)) + 4 + ) + ((= v1-34 (level-memory-mode borrow-city-small)) + 0 + ) + ((or (= v1-34 (level-memory-mode borrow0)) + (= v1-34 (level-memory-mode borrow1)) + (= v1-34 (level-memory-mode borrow2)) + ) + (break!) + 0 + ) + (else + 5 + ) + ) + ) ) - ) + (+! (-> sv-48 v1-35) 1) ) ) - (+! (-> sv-48 v1-35) 1) + ) ) ) ) - ) - ) - ) - (dotimes (s4-1 10) - (let* ((a0-58 (-> arg0 want-exp s4-1 name)) - (v1-44 (-> (lookup-level-info a0-58) memory-mode)) - (v1-45 - (cond - ((= v1-44 (level-memory-mode borrow3)) - 3 - ) - ((= v1-44 (level-memory-mode borrow4)) - 4 - ) - ((= v1-44 (level-memory-mode borrow-city-small)) - 0 - ) - ((or (= v1-44 (level-memory-mode borrow0)) - (= v1-44 (level-memory-mode borrow1)) - (= v1-44 (level-memory-mode borrow2)) - ) - (break!) - 0 - ) - (else - 5 - ) - ) - ) - ) - (when (not (logtest? (-> sv-60 v1-45) (ash 1 s4-1))) - (+! (-> sv-52 v1-45) 1) - (logior! (-> sv-60 v1-45) (ash 1 s4-1)) - ) - ) - ) - (until #f - (let ((s4-2 0)) - (dotimes (s3-1 5) - (cond - ((< (-> sv-56 s3-1) (+ (-> sv-48 s3-1) (-> sv-52 s3-1))) - (let ((f30-0 1000.0) - (s2-0 -1) - ) - (dotimes (s1-0 10) - (when (logtest? (-> sv-60 s3-1) (ash 1 s1-0)) - (let* ((a0-86 (-> arg0 want-exp s1-0 name)) - (a1-55 (lookup-level-info a0-86)) - (f0-0 (cty-borrow-manager-method-18 this a1-55)) - ) - (if (not (logtest? sv-24 (ash 1 s1-0))) - (set! f0-0 (* 10.0 f0-0)) + (dotimes (s4-1 10) + (let* ((a0-58 (-> arg0 want-exp s4-1 name)) + (v1-44 (-> (lookup-level-info a0-58) memory-mode)) + (v1-45 + (cond + ((= v1-44 (level-memory-mode borrow3)) + 3 + ) + ((= v1-44 (level-memory-mode borrow4)) + 4 + ) + ((= v1-44 (level-memory-mode borrow-city-small)) + 0 + ) + ((or (= v1-44 (level-memory-mode borrow0)) + (= v1-44 (level-memory-mode borrow1)) + (= v1-44 (level-memory-mode borrow2)) + ) + (break!) + 0 + ) + (else + 5 ) - (when (< f0-0 f30-0) - (set! f30-0 f0-0) - (set! s2-0 s1-0) ) ) ) - ) + (when (not (logtest? (-> sv-60 v1-45) (ash 1 s4-1))) + (+! (-> sv-52 v1-45) 1) + (logior! (-> sv-60 v1-45) (ash 1 s4-1)) + ) + ) + ) + (until #f + (let ((s4-2 0)) + (dotimes (s3-1 5) + (cond + ((< (-> sv-56 s3-1) (+ (-> sv-48 s3-1) (-> sv-52 s3-1))) + (let ((f30-0 1000.0) + (s2-0 -1) + ) + (dotimes (s1-0 10) + (when (logtest? (-> sv-60 s3-1) (ash 1 s1-0)) + (let* ((a0-86 (-> arg0 want-exp s1-0 name)) + (a1-55 (lookup-level-info a0-86)) + (f0-0 (cty-borrow-manager-method-18 this a1-55)) + ) + (if (not (logtest? sv-24 (ash 1 s1-0))) + (set! f0-0 (* 10.0 f0-0)) + ) + (when (< f0-0 f30-0) + (set! f30-0 f0-0) + (set! s2-0 s1-0) + ) + ) + ) + ) + (cond + ((>= s2-0 0) + (logclear! sv-24 (ash 1 s2-0)) + (logior! sv-40 (ash 1 s2-0)) + (logclear! (-> sv-60 s3-1) (ash 1 s2-0)) + (+! (-> sv-52 s3-1) -1) + ) + (else + (return 0) + ) + ) + ) + ) + (else + (+! s4-2 1) + ) + ) + ) + (when (= s4-2 5) + 0 + (goto cfg-140) + ) + ) + ) + ) + #f + (label cfg-140) + (set! sv-16 (lognot sv-32)) + (set! sv-24 (lognot sv-40)) + (logior! sv-40 -1024) + (let ((s4-3 0) + (s3-2 0) + ) + (while (and (< s4-3 10) (< s3-2 10)) + (cond + ((not (logtest? sv-40 (ash 1 s4-3))) (cond - ((>= s2-0 0) - (set! sv-24 (logclear sv-24 (ash 1 s2-0))) - (set! sv-40 (logior sv-40 (ash 1 s2-0))) - (logclear! (-> sv-60 s3-1) (ash 1 s2-0)) - (+! (-> sv-52 s3-1) -1) + ((not (logtest? sv-32 (ash 1 s3-2))) + (set! (-> arg0 target s3-2 name) (-> arg0 want-exp s4-3 name)) + (set! (-> arg0 target s3-2 display?) (-> arg0 want-exp s4-3 display?)) + (set! (-> arg0 target s3-2 force-vis?) (-> arg0 want-exp s4-3 force-vis?)) + (set! (-> arg0 target s3-2 force-inside?) (-> arg0 want-exp s4-3 force-inside?)) + (send-event *traffic-manager* 'borrow-notify-shutdown-end (-> arg0 target s3-2 name)) + (+! s4-3 1) + (+! s3-2 1) ) (else - (return 0) + (+! s3-2 1) ) ) ) - ) - (else - (+! s4-2 1) - ) - ) - ) - (when (= s4-2 5) - 0 - (goto cfg-140) - ) - ) - ) - #f - (label cfg-140) - (set! sv-16 (lognot sv-32)) - (set! sv-24 (lognot sv-40)) - (set! sv-40 (logior -1024 sv-40)) - (let ((s4-3 0) - (s3-2 0) - ) - (while (and (< s4-3 10) (< s3-2 10)) - (cond - ((not (logtest? sv-40 (ash 1 s4-3))) - (cond - ((not (logtest? sv-32 (ash 1 s3-2))) - (set! (-> arg0 target s3-2 name) (-> arg0 want-exp s4-3 name)) - (set! (-> arg0 target s3-2 display?) (-> arg0 want-exp s4-3 display?)) - (set! (-> arg0 target s3-2 force-vis?) (-> arg0 want-exp s4-3 force-vis?)) - (set! (-> arg0 target s3-2 force-inside?) (-> arg0 want-exp s4-3 force-inside?)) - (send-event *traffic-manager* 'borrow-notify-shutdown-end (-> arg0 target s3-2 name)) - (+! s4-3 1) - (+! s3-2 1) - ) - (else - (+! s3-2 1) - ) - ) - ) - (else - (+! s4-3 1) - ) - ) - ) - ) - (let ((s4-4 0)) - (dotimes (s3-3 10) - (set! (car (ref& *cty-borrow-manager-list* s4-4)) #f) - (when (not (logtest? sv-32 (ash 1 s3-3))) - (let ((s2-1 (-> arg0 target s3-3 name))) - (case (-> (lookup-level-info s2-1) memory-mode) - (((level-memory-mode borrow0) - (level-memory-mode borrow1) - (level-memory-mode borrow2) - (level-memory-mode borrow3) - (level-memory-mode borrow4) - (level-memory-mode borrow-city-small) + (else + (+! s4-3 1) ) - (set! (car (ref& *cty-borrow-manager-list* s4-4)) s2-1) - (+! s4-4 1) - ) ) ) ) ) + (let ((s4-4 0)) + (dotimes (s3-3 10) + (set! (car (ref& *cty-borrow-manager-list* s4-4)) #f) + (when (not (logtest? sv-32 (ash 1 s3-3))) + (let ((s2-1 (-> arg0 target s3-3 name))) + (case (-> (lookup-level-info s2-1) memory-mode) + (((level-memory-mode borrow0) + (level-memory-mode borrow1) + (level-memory-mode borrow2) + (level-memory-mode borrow3) + (level-memory-mode borrow4) + (level-memory-mode borrow-city-small) + ) + (set! (car (ref& *cty-borrow-manager-list* s4-4)) s2-1) + (+! s4-4 1) + ) + ) + ) + ) + ) + ) + (persist-with-delay + *setting-control* + (the-as symbol *city-borrow-manager*) + (seconds 1000) + 'borrow-hold + (the-as symbol *cty-borrow-manager-list*) + 0.0 + 0 + ) + (cty-borrow-manager-method-16 this) + (cty-borrow-manager-method-17 this arg0 sv-32) ) - (persist-with-delay - *setting-control* - (the-as symbol *city-borrow-manager*) - (seconds 1000) - 'borrow-hold - (the-as symbol *cty-borrow-manager-list*) - 0.0 - 0 - ) - (cty-borrow-manager-method-16 this) - (cty-borrow-manager-method-17 this arg0 sv-32) (update-sound-info arg0) ) diff --git a/test/decompiler/reference/jak3/levels/city/common/ff-squad-control_REF.gc b/test/decompiler/reference/jak3/levels/city/common/ff-squad-control_REF.gc index d1ecb35609..f923f86c0b 100644 --- a/test/decompiler/reference/jak3/levels/city/common/ff-squad-control_REF.gc +++ b/test/decompiler/reference/jak3/levels/city/common/ff-squad-control_REF.gc @@ -163,14 +163,14 @@ ;; definition for method 16 of type ff-squad-control ;; WARN: Return type mismatch int vs none. (defmethod squad-control-method-16 ((this ff-squad-control) (arg0 vector) (arg1 process-focusable) (arg2 squad-target-status)) - (local-vars (sv-176 (array crimson-guard)) (sv-180 (array float)) (sv-184 int)) (let ((t9-0 (method-of-type squad-control squad-control-method-16))) (t9-0 this arg0 arg1 arg2) ) - (let ((s4-0 (get-idx-in-status-arr this (-> arg2 handle)))) - (set! sv-176 (the-as (array crimson-guard) (new 'stack 'boxed-array crimson-guard 16))) - (set! sv-180 (the-as (array float) (new 'stack 'boxed-array float 16))) - (set! sv-184 0) + (let ((s4-0 (get-idx-in-status-arr this (-> arg2 handle))) + (sv-176 (the-as (array crimson-guard) (new 'stack 'boxed-array crimson-guard 16))) + (sv-180 (the-as (array float) (new 'stack 'boxed-array float 16))) + (sv-184 0) + ) (dotimes (s3-0 (the-as int (-> this traffic tracker1 active-object-count))) (case (-> this traffic tracker1 active-object-type-list s3-0) (((traffic-type guard-a)) @@ -178,7 +178,7 @@ (when (and s2-0 (not (focus-test? s2-0 dead inactive)) (= (-> s2-0 target-status handle) (-> arg2 handle))) (set! (-> sv-176 sv-184) s2-0) (set! (-> sv-180 sv-184) (vector-vector-distance (-> s2-0 root trans) (-> arg2 position))) - (set! sv-184 (+ sv-184 1)) + (+! sv-184 1) (set! (-> s2-0 move-index) -1) ) ) diff --git a/test/decompiler/reference/jak3/levels/city/common/guard-states_REF.gc b/test/decompiler/reference/jak3/levels/city/common/guard-states_REF.gc index 8b937065f2..30a7dd96b4 100644 --- a/test/decompiler/reference/jak3/levels/city/common/guard-states_REF.gc +++ b/test/decompiler/reference/jak3/levels/city/common/guard-states_REF.gc @@ -249,16 +249,14 @@ ) ) (when (logtest? (-> self draw status) (draw-control-status on-screen)) - (let ((f0-0 61440.0)) - (cond - ((< (* f0-0 f0-0) (vector-vector-xz-distance-squared (target-pos 0) (-> self root trans))) - (speech-control-method-13 *speech-control* self (speech-type guard-chatter) (-> self traffic-id)) - (speech-control-method-17 *speech-control* (speech-type guard-chatter-jak) 0.2) - ) - (else - (speech-control-method-13 *speech-control* self (speech-type guard-chatter-jak) (-> self traffic-id)) - (speech-control-method-17 *speech-control* (speech-type guard-chatter) 0.2) - ) + (cond + ((< (square 61440.0) (vector-vector-xz-distance-squared (target-pos 0) (-> self root trans))) + (speech-control-method-13 *speech-control* self (speech-type guard-chatter) (-> self traffic-id)) + (speech-control-method-17 *speech-control* (speech-type guard-chatter-jak) 0.2) + ) + (else + (speech-control-method-13 *speech-control* self (speech-type guard-chatter-jak) (-> self traffic-id)) + (speech-control-method-17 *speech-control* (speech-type guard-chatter) 0.2) ) ) ) @@ -387,11 +385,7 @@ ) :post (behavior () (if (and (nonzero? (-> self controller branch)) - (let ((f0-0 (vector-vector-xz-distance-squared (-> self root trans) (-> self dest-point))) - (f1-0 16384.0) - ) - (< f0-0 (* f1-0 f1-0)) - ) + (< (vector-vector-xz-distance-squared (-> self root trans) (-> self dest-point)) (square 16384.0)) ) (vehicle-controller-method-14 (-> self controller) (the-as vehicle self)) ) @@ -481,7 +475,7 @@ ) (let ((f0-7 (* 2.0 (crimson-guard-method-283 this)))) (when (and (time-elapsed? (-> this state-time) (seconds 1)) - (< (* f0-7 f0-7) (vector-vector-xz-distance-squared (-> this root trans) (get-trans s5-0 0))) + (< (square f0-7) (vector-vector-xz-distance-squared (-> this root trans) (get-trans s5-0 0))) ) (set-time! (-> this state-time)) (crimson-guard-method-289 this 0.0) @@ -503,7 +497,6 @@ ;; definition for method 254 of type crimson-guard ;; INFO: Used lq/sq (defmethod crimson-guard-method-254 ((this crimson-guard)) - (local-vars (sv-112 vector) (sv-128 vector) (sv-144 int)) (handle->process (-> this focus handle)) (let ((s5-0 (new 'stack-no-clear 'vector))) (vector-copy! s5-0 (-> this move-position)) @@ -514,27 +507,30 @@ (s0-0 (new 'stack-no-clear 'vector)) (s4-0 (new 'stack-no-clear 'vector)) ) - (set! sv-112 (new 'stack-no-clear 'vector)) - (vector-copy! s1-0 s5-0) - (vector-z-quaternion! s2-0 (-> this root quat)) - (let ((f30-0 (* 182.04445 (* 60.0 (the float (- (-> this traffic-id) *guard-min-id-hack*)))))) - (set! sv-128 s0-0) - (set! (-> sv-128 x) (cos f30-0)) - (set! (-> sv-128 y) 0.0) - (set! (-> sv-128 z) (sin f30-0)) - ) - (set! (-> sv-128 w) 1.0) - (vector+*! s1-0 s1-0 s0-0 12288.0) - (let ((f30-2 (* 0.5 (vector-vector-xz-distance s3-0 s1-0)))) - (vector-normalize! s2-0 (/ f30-2 2)) - (vector-normalize! s0-0 (* 2.0 f30-2)) - ) - (set! sv-144 0) - (while (< sv-144 10) - (do-spline s4-0 s3-0 s2-0 s1-0 s0-0 (* 0.1 (the float sv-144))) - (do-spline sv-112 s3-0 s2-0 s1-0 s0-0 (* 0.1 (the float (+ sv-144 1)))) - (add-debug-line #t (bucket-id debug-no-zbuf1) s4-0 sv-112 *color-red* #f (the-as rgba -1)) - (set! sv-144 (+ sv-144 1)) + (let ((sv-112 (new 'stack-no-clear 'vector))) + (vector-copy! s1-0 s5-0) + (vector-z-quaternion! s2-0 (-> this root quat)) + (let ((f30-0 (* 182.04445 (* 60.0 (the float (- (-> this traffic-id) *guard-min-id-hack*))))) + (sv-128 s0-0) + ) + (set! (-> sv-128 x) (cos f30-0)) + (set! (-> sv-128 y) 0.0) + (set! (-> sv-128 z) (sin f30-0)) + (set! (-> sv-128 w) 1.0) + ) + (vector+*! s1-0 s1-0 s0-0 12288.0) + (let ((f30-2 (* 0.5 (vector-vector-xz-distance s3-0 s1-0)))) + (vector-normalize! s2-0 (/ f30-2 2)) + (vector-normalize! s0-0 (* 2.0 f30-2)) + ) + (let ((sv-144 0)) + (while (< sv-144 10) + (do-spline s4-0 s3-0 s2-0 s1-0 s0-0 (* 0.1 (the float sv-144))) + (do-spline sv-112 s3-0 s2-0 s1-0 s0-0 (* 0.1 (the float (+ sv-144 1)))) + (add-debug-line #t (bucket-id debug-no-zbuf1) s4-0 sv-112 *color-red* #f (the-as rgba -1)) + (+! sv-144 1) + ) + ) ) (do-spline s4-0 s3-0 s2-0 s1-0 s0-0 0.9) (vector-copy! s4-0 s5-0) diff --git a/test/decompiler/reference/jak3/levels/city/common/guard-tazer_REF.gc b/test/decompiler/reference/jak3/levels/city/common/guard-tazer_REF.gc index 2706f089d7..e7c2c5512c 100644 --- a/test/decompiler/reference/jak3/levels/city/common/guard-tazer_REF.gc +++ b/test/decompiler/reference/jak3/levels/city/common/guard-tazer_REF.gc @@ -4,7 +4,6 @@ ;; definition for function spread-lightning-lazer ;; INFO: Used lq/sq (defun spread-lightning-lazer ((arg0 lightning-control) (arg1 vector) (arg2 vector) (arg3 vector)) - (local-vars (sv-640 int) (sv-656 vector)) (let ((s5-0 (new 'stack-no-clear 'vector))) (vector-copy! s5-0 arg1) (let ((s4-0 (new 'stack-no-clear 'vector))) @@ -15,8 +14,9 @@ (vector-length arg2) (let ((s1-0 (new 'stack-no-clear 'vector))) (vector-copy! s1-0 arg3) - (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) @@ -60,11 +60,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) - (vector-copy! s1-0 sv-656) - (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) + (vector-copy! s1-0 sv-656) + (vector-flatten! s4-0 s4-0 sv-656) + ) ) (else (vector+! s5-0 s5-0 s4-0) @@ -75,7 +76,7 @@ ) ) ) - (set! sv-640 (+ sv-640 1)) + (+! sv-640 1) ) ) ) @@ -89,7 +90,6 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch object vs none. (defmethod crimson-guard-method-263 ((this crimson-guard)) - (local-vars (sv-832 vector)) (let* ((s4-0 (vector<-cspace! (new 'stack-no-clear 'vector) (-> this node-list data 14))) (v0-1 (vector<-cspace! (new 'stack-no-clear 'vector) (-> this node-list data 15))) (s2-0 (vector-normalize! (vector-! (new 'stack-no-clear 'vector) s4-0 v0-1) 16384.0)) @@ -132,15 +132,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-832 (-> s3-0 best-other-tri normal)) - (let* ((a2-3 (rand-vu-float-range 0.0 65536.0)) - (a2-4 (s1-1 s0-0 sv-832 a2-3)) - ) - (vector-orient-by-quat! s2-1 s2-1 a2-4) - ) + (vector-orient-by-quat! s2-1 s2-1 a2-4) ) (cond ((logtest? (-> part-crimson-lightning-glow flags) (sp-group-flag sp13)) diff --git a/test/decompiler/reference/jak3/levels/city/common/height-map_REF.gc b/test/decompiler/reference/jak3/levels/city/common/height-map_REF.gc index 7d25495ec4..facf93ddce 100644 --- a/test/decompiler/reference/jak3/levels/city/common/height-map_REF.gc +++ b/test/decompiler/reference/jak3/levels/city/common/height-map_REF.gc @@ -125,7 +125,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 'inline-array 'bounding-box 2))) @@ -142,16 +141,17 @@ (let ((s0-0 s2-0)) (set! (-> s5-0 0 min x) (-> this x-offset)) (set! (-> s5-0 0 min 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)) - (vector-copy! (-> s5-0 0 max) (-> s5-0 0 min)) - (+! (-> s5-0 0 min x) f28-0) - (set! s0-0 (&-> s0-0 1)) - (set! (-> s5-0 0 min y) (+ (-> this y-offset) (* (the float (-> s0-0 0)) (-> this y-scale)))) - (if (and (point-in-bbox? (-> s5-0 1) (-> s5-0 0 min)) (point-in-bbox? (-> s5-0 1) (-> s5-0 0 max))) - (add-debug-line #t (bucket-id debug) (-> s5-0 0 min) (-> s5-0 0 max) *color-red* #f (the-as rgba -1)) - ) + (let ((sv-80 (+ s4-0 -1))) + (while (nonzero? sv-80) + (+! sv-80 -1) + (vector-copy! (-> s5-0 0 max) (-> s5-0 0 min)) + (+! (-> s5-0 0 min x) f28-0) + (set! s0-0 (&-> s0-0 1)) + (set! (-> s5-0 0 min y) (+ (-> this y-offset) (* (the float (-> s0-0 0)) (-> this y-scale)))) + (if (and (point-in-bbox? (-> s5-0 1) (-> s5-0 0 min)) (point-in-bbox? (-> s5-0 1) (-> s5-0 0 max))) + (add-debug-line #t (bucket-id debug) (-> s5-0 0 min) (-> s5-0 0 max) *color-red* #f (the-as rgba -1)) + ) + ) ) ) (+! (-> s5-0 0 min z) f30-0) @@ -166,18 +166,19 @@ (set! (-> s5-0 0 min 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)) - (vector-copy! (-> s5-0 0 max) (-> s5-0 0 min)) - (+! (-> s5-0 0 min z) f30-0) - (&+! s0-1 s4-0) - (set! (-> s5-0 0 min 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) + (vector-copy! (-> s5-0 0 max) (-> s5-0 0 min)) + (+! (-> s5-0 0 min z) f30-0) + (&+! s0-1 s4-0) + (set! (-> s5-0 0 min y) + (+ (-> this y-offset) (* (the float (-> (the-as (pointer int8) s0-1))) (-> this y-scale))) + ) + (if (and (point-in-bbox? (-> s5-0 1) (-> s5-0 0 min)) (point-in-bbox? (-> s5-0 1) (-> s5-0 0 max))) + (add-debug-line #t (bucket-id debug) (-> s5-0 0 min) (-> s5-0 0 max) *color-blue* #f (the-as rgba -1)) ) - (if (and (point-in-bbox? (-> s5-0 1) (-> s5-0 0 min)) (point-in-bbox? (-> s5-0 1) (-> s5-0 0 max))) - (add-debug-line #t (bucket-id debug) (-> s5-0 0 min) (-> s5-0 0 max) *color-blue* #f (the-as rgba -1)) - ) + ) ) ) (+! (-> s5-0 0 min x) f28-0) diff --git a/test/decompiler/reference/jak3/levels/city/common/kg-squad-member_REF.gc b/test/decompiler/reference/jak3/levels/city/common/kg-squad-member_REF.gc index 5aac7ea3be..d826c3d802 100644 --- a/test/decompiler/reference/jak3/levels/city/common/kg-squad-member_REF.gc +++ b/test/decompiler/reference/jak3/levels/city/common/kg-squad-member_REF.gc @@ -126,11 +126,10 @@ ;; definition for method 219 of type kg-squad-member (defmethod kg-squad-member-method-219 ((this kg-squad-member) (arg0 process-focusable)) - (let* ((s4-0 (get-trans arg0 0)) - (f0-0 (vector-vector-xz-distance-squared (-> this root trans) s4-0)) - (f1-0 409600.0) - ) - (or (and (< f0-0 (* f1-0 f1-0)) (< (fabs (- (-> s4-0 y) (-> this root trans y))) 61440.0)) + (let ((s4-0 (get-trans arg0 0))) + (or (and (< (vector-vector-xz-distance-squared (-> this root trans) s4-0) (square 409600.0)) + (< (fabs (- (-> s4-0 y) (-> this root trans y))) 61440.0) + ) (< 0.0 (get-hatred-val-for-target this (process->handle arg0))) ) ) @@ -234,13 +233,9 @@ (if (or (not (-> this draw)) (not (logtest? (-> this draw status) (draw-control-status on-screen)))) (return #f) ) - (let ((f0-0 (vector-vector-xz-distance-squared (-> this root trans) (math-camera-pos))) - (f1-0 122880.0) - ) - (if (< f0-0 (* f1-0 f1-0)) - (return #t) - ) - ) + (if (< (vector-vector-xz-distance-squared (-> this root trans) (math-camera-pos)) (square 122880.0)) + (return #t) + ) #f ) diff --git a/test/decompiler/reference/jak3/levels/city/common/krimson-wall_REF.gc b/test/decompiler/reference/jak3/levels/city/common/krimson-wall_REF.gc index c29c826507..16cf6200fa 100644 --- a/test/decompiler/reference/jak3/levels/city/common/krimson-wall_REF.gc +++ b/test/decompiler/reference/jak3/levels/city/common/krimson-wall_REF.gc @@ -208,7 +208,6 @@ ;; INFO: Used lq/sq (defmethod init-from-entity! ((this krimson-wall-break) (arg0 entity-actor)) "Set up a newly created process from the entity that created it." - (local-vars (sv-96 entity)) (set! (-> this level) (level-get *level* (-> this level-name))) (stack-size-set! (-> this main-thread) 512) (set! (-> this root) (new 'process 'trsqv)) @@ -235,39 +234,20 @@ (set! s5-1 (-> v0-8 extra trans)) ) ) - (let ((s3-1 (get-process *default-dead-pool* manipy #x20000 1))) - (set! (-> this pillar 0) - (the-as - (pointer manipy) - (when s3-1 - (let ((t9-10 (method-of-type manipy activate))) - (t9-10 (the-as manipy s3-1) this "krimson-wall-break" (the-as pointer #x70004000)) - ) - (let ((s2-1 run-function-in-process) - (s1-0 s3-1) - (s0-0 manipy-init) - ) - (set! sv-96 (-> this level entity data 0 entity)) - (let ((t0-1 (art-group-get-by-name *level* "skel-krimson-wall-break" (the-as (pointer level) #f))) - (t1-1 #f) - (t2-1 0) - ) - ((the-as (function object object object object object object object none) s2-1) - s1-0 - s0-0 - s4-1 - sv-96 - t0-1 - t1-1 - t2-1 - ) - ) - ) - (-> s3-1 ppointer) - ) - ) + (set! (-> this pillar 0) + (process-spawn + manipy + :init manipy-init + s4-1 + (-> this level entity data 0 entity) + (art-group-get-by-name *level* "skel-krimson-wall-break" (the-as (pointer level) #f)) + #f + 0 + :name "krimson-wall-break" + :to this + :stack-size #x20000 ) - ) + ) (send-event (ppointer->process (-> this pillar 0)) 'anim-mode 'clone-anim) (send-event (ppointer->process (-> this pillar 0)) 'prefix "a-") (set! (-> this pillar 1) diff --git a/test/decompiler/reference/jak3/levels/city/common/mh-squad-member_REF.gc b/test/decompiler/reference/jak3/levels/city/common/mh-squad-member_REF.gc index dbdf726507..a36c783c8d 100644 --- a/test/decompiler/reference/jak3/levels/city/common/mh-squad-member_REF.gc +++ b/test/decompiler/reference/jak3/levels/city/common/mh-squad-member_REF.gc @@ -86,11 +86,10 @@ ;; definition for method 219 of type mh-squad-member (defmethod pfoc-in-range? ((this mh-squad-member) (arg0 process-focusable)) - (let* ((s5-0 (get-trans arg0 0)) - (f0-0 (vector-vector-xz-distance-squared (-> this root trans) s5-0)) - (f1-0 245760.0) + (let ((s5-0 (get-trans arg0 0))) + (and (< (vector-vector-xz-distance-squared (-> this root trans) s5-0) (square 245760.0)) + (< (fabs (- (-> s5-0 y) (-> this root trans y))) 61440.0) ) - (and (< f0-0 (* f1-0 f1-0)) (< (fabs (- (-> s5-0 y) (-> this root trans y))) 61440.0)) ) ) @@ -226,22 +225,18 @@ (the-as enemy-aware #f) ) (update-focus this) - (let ((f0-0 (vector-vector-xz-distance-squared (-> this root trans) (-> this focus-pos))) - (f1-0 266240.0) - ) - (cond - ((< f0-0 (* f1-0 f1-0)) - (when (not (logtest? (-> this squad alert-state flags) (squad-alert-flag war))) - (set! v0-6 (logior (-> this flags) (citizen-flag persistent))) - (set! (-> this flags) (the-as citizen-flag v0-6)) - v0-6 - ) + (cond + ((< (vector-vector-xz-distance-squared (-> this root trans) (-> this focus-pos)) (square 266240.0)) + (when (not (logtest? (-> this squad alert-state flags) (squad-alert-flag war))) + (set! v0-6 (logior (-> this flags) (citizen-flag persistent))) + (set! (-> this flags) (the-as citizen-flag v0-6)) + v0-6 ) - (else - (set! v0-6 (logclear (-> this flags) (citizen-flag persistent))) - (set! (-> this flags) (the-as citizen-flag v0-6)) - v0-6 - ) + ) + (else + (set! v0-6 (logclear (-> this flags) (citizen-flag persistent))) + (set! (-> this flags) (the-as citizen-flag v0-6)) + v0-6 ) ) ) diff --git a/test/decompiler/reference/jak3/levels/city/common/nav-graph_REF.gc b/test/decompiler/reference/jak3/levels/city/common/nav-graph_REF.gc index ab4dc05775..9edac08ce8 100644 --- a/test/decompiler/reference/jak3/levels/city/common/nav-graph_REF.gc +++ b/test/decompiler/reference/jak3/levels/city/common/nav-graph_REF.gc @@ -102,11 +102,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 debug) gp-0 *color-red*) (let ((s4-1 add-debug-text-3d) @@ -1007,9 +1003,7 @@ ;; INFO: Used lq/sq (defmethod find-nearest-nav-node ((this nav-graph) (arg0 vector) (arg1 symbol)) (let ((gp-0 (the-as nav-node #f))) - (let* ((f0-0 409600000.0) - (f30-0 (* f0-0 f0-0)) - ) + (let ((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)) @@ -1070,7 +1064,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)) @@ -1088,24 +1081,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-poly)) - ) - (vector-! (-> a1-5 vertex 0) s3-0 (the-as vector (-> a0-10 bounds))) - (set! (-> a1-5 vertex1 x) 40960.0) - (set! (-> a1-5 data 20) (the-as uint 2)) - (if (nav-mesh-method-45 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-poly)) + ) + (vector-! (-> a1-5 vertex 0) s3-0 (the-as vector (-> a0-10 bounds))) + (set! (-> a1-5 vertex1 x) 40960.0) + (set! (-> a1-5 data 20) (the-as uint 2)) + (if (nav-mesh-method-45 a0-10 a1-5) + (set! (-> s4-0 nav-mesh-id) (-> sv-80 aid)) + ) + ) ) ) ) @@ -1305,15 +1294,6 @@ ;; 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 - (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) - ) (set! (-> this node-count) 0) (set! (-> this branch-count) 0) (set! (-> this link-count) 0) @@ -1331,8 +1311,9 @@ cfg-27 :delay (nop!) ) - (set! sv-16 (temp-edge-size s0-0)) - (let ((s1-0 (add-node this sv-16))) + (let* ((sv-16 (temp-edge-size s0-0)) + (s1-0 (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) @@ -1351,50 +1332,52 @@ (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) + ) (while (nonzero? sv-32) - (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))) - (cond - ((or (= arg1 #f) (= arg1 (-> sv-48 level_name))) - (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) - ) - ) - ) - ) - (t9-11 sv-64 a1-11) - ) - ) - (else - (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) + (+! 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)))) + (cond + ((or (= arg1 #f) (= arg1 (-> sv-48 level_name))) + (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) + ) + ) + ) + ) + (else + (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) + ) + (+! (-> this link-count) 1) + ) + ) ) ) (+! s5-0 1) diff --git a/test/decompiler/reference/jak3/levels/city/common/trail_REF.gc b/test/decompiler/reference/jak3/levels/city/common/trail_REF.gc index 45492806d1..d9b7cf84f1 100644 --- a/test/decompiler/reference/jak3/levels/city/common/trail_REF.gc +++ b/test/decompiler/reference/jak3/levels/city/common/trail_REF.gc @@ -25,21 +25,10 @@ 1.0 ) (vector-lerp! s5-0 s4-0 s3-0 0.5) - (let* ((s2-0 (math-camera-pos)) - (f0-14 (vector-vector-distance-squared s4-0 s2-0)) - (f1-12 819200.0) - ) - (when (or (< f0-14 (* f1-12 f1-12)) - (let ((f0-15 (vector-vector-distance-squared s3-0 s2-0)) - (f1-15 819200.0) - ) - (< f0-15 (* f1-15 f1-15)) - ) - (let ((f0-16 (vector-vector-distance-squared s5-0 s2-0)) - (f1-18 819200.0) - ) - (< f0-16 (* f1-18 f1-18)) - ) + (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 debug) s4-0 s3-0 *color-orange* #f (the-as rgba -1)) (let ((s4-1 add-debug-text-3d) @@ -70,18 +59,16 @@ ) (set! (-> s4-0 quad) (-> s5-0 quad)) (set! (-> s4-0 r) 4096.0) - (let ((f0-8 (vector-vector-distance-squared s5-0 (math-camera-pos))) - (f1-6 819200.0) - ) - (when (and (< f0-8 (* f1-6 f1-6)) (sphere-in-view-frustum? s4-0)) - (add-debug-x #t (bucket-id debug) s5-0 *color-red*) - (let ((s4-1 add-debug-text-3d) - (s3-1 #t) - (s2-1 583) - ) - (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 debug) s5-0 *color-red*) + (let ((s4-1 add-debug-text-3d) + (s3-1 #t) + (s2-1 583) + ) + (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)) ) ) ) @@ -90,7 +77,6 @@ ;; definition for method 15 of type trail-graph ;; INFO: Used lq/sq (defmethod trail-graph-method-15 ((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 4)) @@ -121,24 +107,10 @@ ) (let ((s1-0 add-debug-text-3d) (s0-0 #t) + (sv-80 583) ) - (set! sv-80 583) - (set! sv-96 format) - (let ((a0-21 (clear *temp-string*)) - (a1-5 "cell ~D (~D,~D)") - (a2-4 arg0) - (a3-4 (logand arg0 15)) - (t0-4 (/ arg0 16)) - ) - (sv-96 a0-21 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)))))) @@ -159,33 +131,33 @@ ;; INFO: Used lq/sq ;; WARN: new jak 2 until loop case, check carefully (defmethod trail-graph-method-16 ((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) (+ (-> arg2 y) arg5) (+ (-> arg2 z) arg5) 1.0) - (set! sv-48 0) - (until #f - (vector-copy! (-> s0-0 0) (-> s0-0 1)) - (cond - ((< sv-48 arg0) - (let ((a0-6 (-> this node (-> arg1 sv-48)))) - (set-vector! - (-> s0-0 1) - (+ (* 4096.0 (the float (-> a0-6 x))) arg5) - (+ (* 4096.0 (the float (-> a0-6 y))) arg5) - (+ (* 4096.0 (the float (-> a0-6 z))) arg5) - 1.0 + (let ((sv-48 0)) + (until #f + (vector-copy! (-> s0-0 0) (-> s0-0 1)) + (cond + ((< sv-48 arg0) + (let ((a0-6 (-> this node (-> arg1 sv-48)))) + (set-vector! + (-> s0-0 1) + (+ (* 4096.0 (the float (-> a0-6 x))) arg5) + (+ (* 4096.0 (the float (-> a0-6 y))) arg5) + (+ (* 4096.0 (the float (-> a0-6 z))) arg5) + 1.0 + ) ) ) - ) - ((= sv-48 arg0) - (set-vector! (-> s0-0 1) (+ (-> arg3 x) arg5) (+ (-> arg3 y) arg5) (+ (-> arg3 z) arg5) 1.0) - ) - (else - (return #f) + ((= sv-48 arg0) + (set-vector! (-> s0-0 1) (+ (-> arg3 x) arg5) (+ (-> arg3 y) arg5) (+ (-> arg3 z) arg5) 1.0) + ) + (else + (return #f) + ) ) + (add-debug-line #t (bucket-id debug) (-> s0-0 0) (-> s0-0 1) arg4 #f (the-as rgba -1)) + (+! sv-48 1) ) - (add-debug-line #t (bucket-id debug) (-> s0-0 0) (-> s0-0 1) arg4 #f (the-as rgba -1)) - (set! sv-48 (+ sv-48 1)) ) ) #f @@ -895,7 +867,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/jak3/levels/city/ctyport-obs_REF.gc b/test/decompiler/reference/jak3/levels/city/ctyport-obs_REF.gc index 6e14605a15..f92e1f6ad6 100644 --- a/test/decompiler/reference/jak3/levels/city/ctyport-obs_REF.gc +++ b/test/decompiler/reference/jak3/levels/city/ctyport-obs_REF.gc @@ -312,10 +312,7 @@ ;; WARN: Return type mismatch int vs none. (defmethod vehicle-method-103 ((this boat-base)) (when (time-elapsed? (-> this disturbed-time) (seconds 2)) - (let* ((f0-0 (-> this camera-dist2)) - (f1-0 0.000024414063) - (f0-1 (* f0-0 (* f1-0 f1-0))) - ) + (let ((f0-1 (* (-> this camera-dist2) (square 0.000024414063)))) (when (< (vector-length-squared (-> this rbody ang-velocity)) f0-1) (logclear! (-> this v-flags) (vehicle-flag disturbed)) (vehicle-method-142 this) @@ -327,7 +324,121 @@ ) ;; definition for method 30 of type boat-base -;; ERROR: function was not converted to expressions. Cannot decompile. +;; INFO: Used lq/sq +;; WARN: Return type mismatch none vs object. +(defmethod rigid-body-object-method-30 ((this boat-base)) + (rider-trans) + (let ((t9-1 (method-of-type vehicle rigid-body-object-method-30))) + (t9-1 this) + ) + (let ((s5-0 (-> this root))) + (pull-riders! s5-0) + (cond + ((logtest? (do-push-aways s5-0) (collide-spec jak)) + (+! (-> this overlap-player-counter) 1) + (when (< (the-as uint 60) (-> this overlap-player-counter)) + (send-event + *target* + 'attack-invinc + #f + (static-attack-info + :mask (vehicle-impulse-factor) + ((id (new-attack-id)) (damage 1000.0) (vehicle-damage-factor 1.0) (vehicle-impulse-factor 1.0) (mode 'smush)) + ) + ) + (set! (-> this overlap-player-counter) (the-as uint 0)) + 0 + ) + ) + (else + (set! (-> this overlap-player-counter) (the-as uint 0)) + 0 + ) + ) + ) + (when (not (logtest? (-> this rbody flags) (rigid-body-flag enable-physics))) + (let ((s5-1 (new 'stack-no-clear 'inline-array 'vector 6))) + (let ((a1-1 (-> this nav state))) + (vector-copy! (-> s5-1 0) (-> a1-1 velocity)) + ) + (let ((s4-0 (new 'stack 'clamp-travel-vector-to-mesh-return-info))) + (let ((s3-0 (-> this nav state current-poly))) + (vector-xz-normalize-copy! (-> s5-1 3) (-> s5-1 0) 163840.0) + (vector-copy! (-> s5-1 4) (-> s5-1 3)) + (clamp-vector-to-mesh-no-gaps (-> this nav) (-> this root trans) s3-0 (-> s5-1 4) s4-0) + ) + (when (-> s4-0 found-boundary) + (let ((f30-0 (vector-length (-> s5-1 0)))) + (vector-flatten! (-> s5-1 0) (-> s5-1 0) (-> s4-0 boundary-normal)) + (vector-rotate90-around-y! (-> s5-1 0) (-> s4-0 boundary-normal)) + (vector-normalize! (-> s5-1 0) f30-0) + ) + (when (= this *debug-actor*) + (add-debug-vector #t (bucket-id debug-no-zbuf1) (-> this root trans) (-> s5-1 0) (meters 10) *color-blue*) + (format *stdebug* "avoid border~%") + ) + ) + ) + (when (< (square 4.096) (vector-length-squared (-> s5-1 0))) + (vector-copy! (-> s5-1 5) (-> s5-1 0)) + (vector-normalize! (-> s5-1 5) 1.0) + (let ((s4-1 (-> this root quat))) + (quaternion-set! (the-as quaternion (-> s5-1 2)) 0.0 (-> s5-1 5 x) 0.0 (+ 1.0 (-> s5-1 5 z))) + (quaternion-normalize! (the-as quaternion (-> s5-1 2))) + (quaternion-smooth-seek! s4-1 s4-1 (the-as quaternion (-> s5-1 2)) (* 1.2 (seconds-per-frame))) + ) + (vector-z-quaternion! (-> s5-1 1) (-> this root quat)) + (vector-v*float+! (-> this root trans) (-> this root trans) (-> s5-1 1) 8954.266) + (seek! (-> this root trans y) 4096.0 (* 4096.0 (seconds-per-frame))) + ) + ) + (when (= this *debug-actor*) + (format *stdebug* "no physics~%") + (format *stdebug* "~M~%" (-> this root trans y)) + ) + ) + (if (= this *debug-actor*) + (format *stdebug* "speed ~M~%" (vector-length (-> this root transv))) + ) + (let ((s4-2 (handle->process (-> this manager))) + (s5-2 (new 'stack-no-clear 'vector)) + ) + (when s4-2 + (let ((a1-22 (-> this nav state))) + (vector-copy! s5-2 (-> a1-22 target-pos)) + ) + (if (or (= (-> this path-num) 2) (-> *setting-control* user-current stop-boats?)) + (get-point-at-percent-along-path! + (-> (the-as boat-manager (+ (* (-> this path-num) 4) (the-as uint s4-2))) paths 0) + (-> this root trans) + (-> this path-index) + 'interp + ) + ) + (when (and (not (or (= (-> this path-num) 2) (-> *setting-control* user-current stop-boats?))) + (< (vector-vector-xz-distance (-> this root trans) s5-2) 163840.0) + ) + (+! (-> this path-index) 0.01) + (let ((f0-20 (-> this path-index))) + (set! (-> this path-index) (- f0-20 (* (the float (the int (/ f0-20 1.0))) 1.0))) + ) + ) + (get-point-at-percent-along-path! + (-> (the-as boat-manager (+ (* (-> this path-num) 4) (the-as uint s4-2))) paths 0) + s5-2 + (-> this path-index) + 'interp + ) + (let ((v1-102 (-> this nav state))) + (logclear! (-> v1-102 flags) (nav-state-flag directional-mode)) + (logior! (-> v1-102 flags) (nav-state-flag target-poly-dirty)) + (vector-copy! (-> v1-102 target-pos) s5-2) + ) + 0 + ) + ) + (vehicle-method-78 this) + ) ;; definition for method 55 of type boat-base (defmethod clear-impulse-force-flag! ((this boat-base)) @@ -807,3 +918,7 @@ ) (go (method-of-object this idle)) ) + + + + diff --git a/test/decompiler/reference/jak3/levels/city/ctywide-obs_REF.gc b/test/decompiler/reference/jak3/levels/city/ctywide-obs_REF.gc index 5dc1502041..e082ee51a2 100644 --- a/test/decompiler/reference/jak3/levels/city/ctywide-obs_REF.gc +++ b/test/decompiler/reference/jak3/levels/city/ctywide-obs_REF.gc @@ -211,14 +211,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))) (vector-copy! (-> s5-0 0) (-> s4-0 control trans)) - (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)))) ) @@ -489,12 +488,7 @@ (set! (-> v0-6 x) 0.0) (set! (-> v0-6 y) (* 0.00024414062 (/ arg2 2))) (set! (-> v0-6 z) 0.0) - (let ((f0-20 0.5) - (f1-7 (* f30-1 f30-1)) - (f2-2 arg2) - ) - (set! (-> v0-6 w) (* f0-20 (sqrtf (+ f1-7 (* f2-2 f2-2))))) - ) + (set! (-> v0-6 w) (* 0.5 (sqrtf (+ (square f30-1) (square arg2))))) v0-6 ) ) @@ -775,9 +769,9 @@ ((or (-> *setting-control* user-current disable-parking-spots?) (focus-test? s5-0 dead inactive) (not (logtest? (vehicle-flag waiting-for-player) (-> s5-0 v-flags))) - (let ((f0-0 (-> this test-sphere r))) - (< (* f0-0 f0-0) (vector-vector-distance-squared (-> s5-0 root trans) (-> this test-sphere))) - ) + (< (square (-> this test-sphere r)) + (vector-vector-distance-squared (-> s5-0 root trans) (-> this test-sphere)) + ) ) (logclear! (-> s5-0 v-flags) (vehicle-flag persistent)) (cond @@ -785,11 +779,11 @@ (when (or (< (-> *display* base-clock frame-counter) (-> *game-info* blackout-time)) (>= (-> *setting-control* user-current bg-a) 1.0) (>= (-> *setting-control* user-current bg-a-force) 1.0) - (let ((f0-5 (-> this test-sphere r))) - (and (>= (* f0-5 f0-5) (vector-vector-distance-squared (-> s5-0 root trans) (-> this test-sphere))) - (not (sphere-in-view-frustum? (-> this test-sphere))) - ) - ) + (and (>= (square (-> this test-sphere r)) + (vector-vector-distance-squared (-> s5-0 root trans) (-> this test-sphere)) + ) + (not (sphere-in-view-frustum? (-> this test-sphere))) + ) ) (send-event (handle->process (-> this vehicle)) 'traffic-off-force) (set! (-> this vehicle) (the-as handle #f)) @@ -1631,34 +1625,20 @@ (remove-setting! 'mode-name) ) :trans (behavior () - (local-vars - (sv-272 vector) - (sv-288 quaternion) - (sv-304 (function float float float float float float)) - (sv-320 float) - (sv-336 float) - ) (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!) + (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) + (lerp-scale (-> self rotmin) (-> self rotmax) (sin (* 7281.778 (-> self time))) -1.0 1.0) ) - (set! sv-272 (new 'stack-no-clear 'vector)) - (set! sv-288 (-> self root quat)) - (set! sv-304 lerp-scale) - (set! sv-320 (-> self rotmin)) - (set! sv-336 (-> self rotmax)) - (let* ((a2-0 (sin (* 7281.778 (-> self time)))) - (a3-0 -1.0) - (t0-0 1.0) - (a2-1 (sv-304 sv-320 sv-336 a2-0 a3-0 t0-0)) - ) - (vector+! s5-0 s4-0 (s3-0 s2-0 s1-0 (s0-0 (the-as quaternion sv-272) sv-288 a2-1))) ) ) (vector-copy! (-> *camera* slave 0 trans) gp-0) @@ -2779,12 +2759,12 @@ ;; INFO: Used lq/sq (defmethod init-from-entity! ((this flitter-spawner) (arg0 entity-actor)) "Set up a newly created process from the entity that created it." - (local-vars (sv-16 res-tag)) (set! (-> this root) (new 'process 'trsqv)) (process-drawable-from-entity! this arg0) (set! (-> this entity) arg0) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-2 (res-lump-data (-> this entity) 'actor-groups (pointer actor-group) :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-2 (res-lump-data (-> this entity) 'actor-groups (pointer actor-group) :tag-ptr (& sv-16))) + ) (cond ((and v1-2 (nonzero? (-> sv-16 elt-count))) (set! (-> this actor-group) v1-2) diff --git a/test/decompiler/reference/jak3/levels/city/ctywide-part_REF.gc b/test/decompiler/reference/jak3/levels/city/ctywide-part_REF.gc index 690db65400..6edada129e 100644 --- a/test/decompiler/reference/jak3/levels/city/ctywide-part_REF.gc +++ b/test/decompiler/reference/jak3/levels/city/ctywide-part_REF.gc @@ -145,7 +145,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/jak3/levels/city/destroy-grid/cty-destroy-grid_REF.gc b/test/decompiler/reference/jak3/levels/city/destroy-grid/cty-destroy-grid_REF.gc index 7aee567f9f..2cbd3fe416 100644 --- a/test/decompiler/reference/jak3/levels/city/destroy-grid/cty-destroy-grid_REF.gc +++ b/test/decompiler/reference/jak3/levels/city/destroy-grid/cty-destroy-grid_REF.gc @@ -401,9 +401,8 @@ (when *target* (let ((a1-0 (-> *target* control trans)) (v1-4 (-> this root)) - (f0-0 14336.0) ) - (when (>= (* f0-0 f0-0) (vector-vector-distance-squared (-> v1-4 trans) a1-0)) + (when (>= (square 14336.0) (vector-vector-distance-squared (-> v1-4 trans) a1-0)) (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)) @@ -1865,11 +1864,7 @@ (send-event this 'complete) ) (if (and (< (vector-vector-distance (-> this goal-pos) (-> s5-0 root trans)) 163840.0) - (let ((f0-4 (vector-length-squared (-> (the-as vehicle s4-4) root transv))) - (f1-2 12288.0) - ) - (< f0-4 (* f1-2 f1-2)) - ) + (< (vector-length-squared (-> (the-as vehicle s4-4) root transv)) (square 12288.0)) ) (send-event s5-0 'exit-vehicle (-> this goal-pos-front)) ) @@ -1884,38 +1879,32 @@ ) ) (when (!= v1-197 -1) - (let ((f0-5 (vector-length-squared (-> (the-as vehicle s4-4) root transv))) - (f1-5 32768.0) - ) - (when (and (< f0-5 (* f1-5 f1-5)) - (let ((f0-6 (vector-vector-distance-squared (-> (the-as vehicle s4-4) root trans) (-> s5-0 root trans))) - (f1-8 204800.0) - ) - (< f0-6 (* f1-8 f1-8)) - ) - ) - (send-event s5-0 'board-vehicle (the-as vehicle s4-4)) - (when (and (nonzero? (-> this next-box)) (!= (the-as jinx (-> this next-box)) (length (-> this actor-group 0)))) - (let ((a1-50 (new 'stack-no-clear 'event-message-block))) - (set! (-> a1-50 from) (process->ppointer pp)) - (set! (-> a1-50 num-params) 0) - (set! (-> a1-50 message) 'explode) - (let ((t9-38 send-event-function) - (v1-228 (-> this actor-group 0 data (+ (-> this next-box) -1) actor)) + (when (and (< (vector-length-squared (-> (the-as vehicle s4-4) root transv)) (square 32768.0)) + (< (vector-vector-distance-squared (-> (the-as vehicle s4-4) root trans) (-> s5-0 root trans)) + (square 204800.0) ) - (t9-38 - (if v1-228 - (-> v1-228 extra process) - ) - a1-50 + ) + (send-event s5-0 'board-vehicle (the-as vehicle s4-4)) + (when (and (nonzero? (-> this next-box)) (!= (the-as jinx (-> this next-box)) (length (-> this actor-group 0)))) + (let ((a1-50 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-50 from) (process->ppointer pp)) + (set! (-> a1-50 num-params) 0) + (set! (-> a1-50 message) 'explode) + (let ((t9-38 send-event-function) + (v1-228 (-> this actor-group 0 data (+ (-> this next-box) -1) actor)) ) + (t9-38 + (if v1-228 + (-> v1-228 extra process) + ) + a1-50 ) ) - (set-speech-name this (-> *jinx-board-vehicle-speech* *jinx-board-vehicle-speech-index*) 300 600) - (set! *jinx-board-vehicle-speech-index* - (mod (+ *jinx-board-vehicle-speech-index* 1) (-> *jinx-board-vehicle-speech* length)) - ) ) + (set-speech-name this (-> *jinx-board-vehicle-speech* *jinx-board-vehicle-speech-index*) 300 600) + (set! *jinx-board-vehicle-speech-index* + (mod (+ *jinx-board-vehicle-speech-index* 1) (-> *jinx-board-vehicle-speech* length)) + ) ) ) ) @@ -1968,7 +1957,6 @@ (defstate active (task-manager-city-destroy-grid) :virtual #t :enter (behavior () - (local-vars (sv-272 res-tag)) (set-time! (-> self state-time)) (let ((s5-0 *traffic-manager*) (gp-0 (new 'stack 'traffic-object-spawn-params)) @@ -2010,12 +1998,13 @@ (set-setting! 'mh-primary-target v1-40 1.0 (-> v1-40 0 pid)) ) (set! (-> self entity) (the-as entity-actor gp-1)) - (set! sv-272 (new 'static 'res-tag)) - (let ((v1-44 (res-lump-data gp-1 'actor-groups pointer :tag-ptr (& sv-272)))) + (let* ((sv-272 (new 'static 'res-tag)) + (v1-44 (res-lump-data gp-1 'actor-groups (pointer actor-group) :tag-ptr (& sv-272))) + ) (cond ((and v1-44 (nonzero? (-> sv-272 elt-count))) (set! (-> self actor-group-count) (the-as int (-> sv-272 elt-count))) - (set! (-> self actor-group) (the-as (pointer actor-group) v1-44)) + (set! (-> self actor-group) v1-44) ) (else (format 0 "ERROR: ~s: entity missing actor-group!~%" (game-task->string (-> self node-info task))) @@ -2246,7 +2235,6 @@ ;; INFO: Used lq/sq (defmethod init-from-entity! ((this com-power-box) (arg0 entity-actor)) "Set up a newly created process from the entity that created it." - (local-vars (sv-80 vector) (sv-96 vector)) (rlet ((acc :class vf) (vf0 :class vf) (vf4 :class vf) @@ -2304,14 +2292,15 @@ (s1-0 #x46333333) (s0-0 (new 'stack-no-clear 'vector)) ) - (set! sv-80 (-> this root trans)) - (let ((v0-10 (vector-x-quaternion! (new 'stack-no-clear 'vector) (-> this root quat)))) - (let ((v1-36 8192.0)) - (.mov vf7 v1-36) + (let ((sv-80 (-> this root trans))) + (let ((v0-10 (vector-x-quaternion! (new 'stack-no-clear 'vector) (-> this root quat)))) + (let ((v1-36 8192.0)) + (.mov vf7 v1-36) + ) + (.lvf vf5 (&-> v0-10 quad)) ) - (.lvf vf5 (&-> v0-10 quad)) + (.lvf vf4 (&-> sv-80 quad)) ) - (.lvf vf4 (&-> sv-80 quad)) (.add.x.vf.w vf6 vf0 vf0) (.mul.x.vf.xyz acc vf5 vf7) (.add.mul.w.vf.xyz vf6 vf4 vf0 acc) @@ -2332,14 +2321,15 @@ (s1-1 #x46333333) (s0-1 (new 'stack-no-clear 'vector)) ) - (set! sv-96 (-> this root trans)) - (let ((v0-14 (vector-x-quaternion! (new 'stack-no-clear 'vector) (-> this root quat)))) - (let ((v1-46 -8192.0)) - (.mov vf7 v1-46) + (let ((sv-96 (-> this root trans))) + (let ((v0-14 (vector-x-quaternion! (new 'stack-no-clear 'vector) (-> this root quat)))) + (let ((v1-46 -8192.0)) + (.mov vf7 v1-46) + ) + (.lvf vf5 (&-> v0-14 quad)) ) - (.lvf vf5 (&-> v0-14 quad)) + (.lvf vf4 (&-> sv-96 quad)) ) - (.lvf vf4 (&-> sv-96 quad)) (.add.x.vf.w vf6 vf0 vf0) (.mul.x.vf.xyz acc vf5 vf7) (.add.mul.w.vf.xyz vf6 vf4 vf0 acc) @@ -2354,3 +2344,7 @@ (go (method-of-object this idle)) ) ) + + + + diff --git a/test/decompiler/reference/jak3/levels/city/freehq/freehq-part_REF.gc b/test/decompiler/reference/jak3/levels/city/freehq/freehq-part_REF.gc index 39ac9447de..3e2062d3a4 100644 --- a/test/decompiler/reference/jak3/levels/city/freehq/freehq-part_REF.gc +++ b/test/decompiler/reference/jak3/levels/city/freehq/freehq-part_REF.gc @@ -221,7 +221,7 @@ (let ((v1-1 (-> arg4 sprite key))) (when (nonzero? v1-1) (let ((f0-2 (+ (- 5120.0 (-> arg2 launchrot 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)))) ) ) ) @@ -2830,7 +2830,3 @@ (:rotate-y (degrees 0)) ) ) - - - - diff --git a/test/decompiler/reference/jak3/levels/city/hijack/billiards_REF.gc b/test/decompiler/reference/jak3/levels/city/hijack/billiards_REF.gc index ee2681c6bb..ef817a2963 100644 --- a/test/decompiler/reference/jak3/levels/city/hijack/billiards_REF.gc +++ b/test/decompiler/reference/jak3/levels/city/hijack/billiards_REF.gc @@ -283,9 +283,7 @@ (vector+float*! (-> s3-1 pos) v1-38 s1-2 (- 1.0 f30-1)) (let ((v1-39 (vector-normalize-copy! (new 'stack-no-clear 'vector) s1-2 1.0))) 0.0 - (let* ((f0-18 (fabs (-> v1-39 data s2-1))) - (f1-10 (* f0-18 f0-18)) - ) + (let ((f1-10 (square (fabs (-> v1-39 data s2-1))))) (vector-float*! s1-2 s1-2 (* -1.0 (- 1.0 (* f1-10 (-> this bounce-wall-friction))))) ) ) diff --git a/test/decompiler/reference/jak3/levels/city/hijack/cty-hijack-missile_REF.gc b/test/decompiler/reference/jak3/levels/city/hijack/cty-hijack-missile_REF.gc index 4b3c593b23..81b7ba44a4 100644 --- a/test/decompiler/reference/jak3/levels/city/hijack/cty-hijack-missile_REF.gc +++ b/test/decompiler/reference/jak3/levels/city/hijack/cty-hijack-missile_REF.gc @@ -967,7 +967,6 @@ ;; WARN: Return type mismatch object vs none. ;; WARN: Function (method 51 cty-hijack-missile) has a return type of none, but the expression builder found a return statement. (defmethod cty-hijack-missile-method-51 ((this cty-hijack-missile)) - (local-vars (sv-64 float) (sv-68 float) (sv-72 float) (sv-76 vector) (sv-80 float)) (let ((s5-0 (as-type (handle->process (-> this track-obj)) process-focusable)) (s4-1 (new 'stack-no-clear 'vector)) (a0-5 (new 'stack-no-clear 'vector)) @@ -986,165 +985,167 @@ (set! (-> this vel-factor) *k1*) ) ) - (set! sv-64 (-> this offset-dist)) - (set! sv-68 (-> this current-speed)) - (set! sv-72 (the-as float 0.0)) - (set! sv-76 (vector-! (new 'stack-no-clear 'vector) s4-1 (-> this basetrans))) - (set! sv-80 (the-as float 0.0)) - (set! sv-72 (vector-normalize-ret-len! sv-76 1.0)) - (if (and (-> this is-leader?) (< (vector-vector-xz-distance (-> this basetrans) s4-1) 18432.0)) - (go (method-of-object this explode)) - ) - (cond - ((< 409.6 sv-72) - (set! sv-80 (+ (* (- sv-72 sv-64) *k0*) (* (- f30-0 sv-68) (-> this vel-factor)))) - (set! sv-80 (* sv-80 *accel-scalar*)) - (+! (-> this current-speed) (* sv-80 (seconds-per-frame))) - (when (-> this is-leader?) - ) - (seek! (-> this min-chase-speed) (-> this min-targ-chase-speed) (* 6144.0 (seconds-per-frame))) - (set! (-> this current-speed) (fmax (-> this current-speed) (-> this target-speed))) - (cond - ((>= 0.0 (-> this max-chase-speed)) - (when (< (vector-vector-xz-distance (-> this basetrans) (get-trans s5-0 0)) 32768.0) - ) + (let ((sv-64 (-> this offset-dist)) + (sv-68 (-> this current-speed)) + (sv-72 (the-as float 0.0)) + (sv-76 (vector-! (new 'stack-no-clear 'vector) s4-1 (-> this basetrans))) ) - ((< (vector-vector-xz-distance (-> this basetrans) (get-trans s5-0 0)) 81920.0) - (set! (-> this current-speed) - (fmax (fmin (-> this current-speed) (-> this max-chase-speed)) (-> this min-chase-speed)) + (let ((sv-80 (the-as float 0.0))) + (set! sv-72 (vector-normalize-ret-len! sv-76 1.0)) + (if (and (-> this is-leader?) (< (vector-vector-xz-distance (-> this basetrans) s4-1) 18432.0)) + (go (method-of-object this explode)) + ) + (cond + ((< 409.6 sv-72) + (set! sv-80 (* (+ (* (- sv-72 sv-64) *k0*) (* (- f30-0 sv-68) (-> this vel-factor))) *accel-scalar*)) + (+! (-> this current-speed) (* sv-80 (seconds-per-frame))) + (when (-> this is-leader?) + ) + (seek! (-> this min-chase-speed) (-> this min-targ-chase-speed) (* 6144.0 (seconds-per-frame))) + (set! (-> this current-speed) (fmax (-> this current-speed) (-> this target-speed))) + (cond + ((>= 0.0 (-> this max-chase-speed)) + (when (< (vector-vector-xz-distance (-> this basetrans) (get-trans s5-0 0)) 32768.0) ) - ) - ) - (when (-> this is-leader?) - ) - (quaternion-look-at! (-> this root quat) sv-76 *up-vector*) - (vector+float*! (-> this basetrans) (-> this basetrans) sv-76 (* (-> this current-speed) (seconds-per-frame))) - ) - (else - (vector+float*! - (-> this basetrans) - (-> this basetrans) - (vector-z-quaternion! (new 'stack-no-clear 'vector) (-> this root quat)) - (* (-> this current-speed) (seconds-per-frame)) + ) + ((< (vector-vector-xz-distance (-> this basetrans) (get-trans s5-0 0)) 81920.0) + (set! (-> this current-speed) + (fmax (fmin (-> this current-speed) (-> this max-chase-speed)) (-> this min-chase-speed)) + ) + ) + ) + (when (-> this is-leader?) + ) + (quaternion-look-at! (-> this root quat) sv-76 *up-vector*) + (vector+float*! (-> this basetrans) (-> this basetrans) sv-76 (* (-> this current-speed) (seconds-per-frame))) + ) + (else + (vector+float*! + (-> this basetrans) + (-> this basetrans) + (vector-z-quaternion! (new 'stack-no-clear 'vector) (-> this root quat)) + (* (-> this current-speed) (seconds-per-frame)) + ) + ) ) ) - ) - ) - ) - (when (< (-> this next-lisa-time) (current-time)) - (let* ((f30-1 30720.0) - (f28-0 6144.0) - (v1-57 (/ (the-as int (rand-uint31-gen *random-generator*)) 256)) - (v1-58 (the-as number (logior #x3f800000 v1-57))) - ) - (set! (-> this circle-mag) (+ f30-1 (* f28-0 (+ -1.0 (the-as float v1-58))))) - ) - (cond - ((!= (-> this stage) 1) - (let* ((f30-2 43690.668) - (f28-1 10922.664) - (v1-64 (/ (the-as int (rand-uint31-gen *random-generator*)) 256)) - (v1-65 (the-as number (logior #x3f800000 v1-64))) - ) - (set! (-> this lisa rate theta) (* (+ f30-2 (* f28-1 (+ -1.0 (the-as float v1-65)))) (seconds-per-frame))) - ) - (let* ((f30-3 9216.0) - (f28-2 7987.199) - (v1-71 (/ (the-as int (rand-uint31-gen *random-generator*)) 256)) - (v1-72 (the-as number (logior #x3f800000 v1-71))) - ) - (set! (-> this lisa dest x-mag) (+ f30-3 (* f28-2 (+ -1.0 (the-as float v1-72))))) - ) - (let* ((f30-4 9216.0) - (f28-3 7987.199) - (v1-77 (/ (the-as int (rand-uint31-gen *random-generator*)) 256)) - (v1-78 (the-as number (logior #x3f800000 v1-77))) - ) - (set! (-> this lisa dest y-mag) (+ f30-4 (* f28-3 (+ -1.0 (the-as float v1-78))))) - ) - (let* ((f30-5 0.5) - (f28-4 0.75) - (v1-83 (/ (the-as int (rand-uint31-gen *random-generator*)) 256)) - (v1-84 (the-as number (logior #x3f800000 v1-83))) - ) - (set! (-> this lisa dest theta-rate) (+ f30-5 (* f28-4 (+ -1.0 (the-as float v1-84))))) - ) - ) - (else - (let* ((f30-6 32768.0) - (f28-5 10922.668) - (v1-90 (/ (the-as int (rand-uint31-gen *random-generator*)) 256)) - (v1-91 (the-as number (logior #x3f800000 v1-90))) + (when (< (-> this next-lisa-time) (current-time)) + (let* ((f30-1 30720.0) + (f28-0 6144.0) + (v1-57 (/ (the-as int (rand-uint31-gen *random-generator*)) 256)) + (v1-58 (the-as number (logior #x3f800000 v1-57))) + ) + (set! (-> this circle-mag) (+ f30-1 (* f28-0 (+ -1.0 (the-as float v1-58))))) + ) + (cond + ((!= (-> this stage) 1) + (let* ((f30-2 43690.668) + (f28-1 10922.664) + (v1-64 (/ (the-as int (rand-uint31-gen *random-generator*)) 256)) + (v1-65 (the-as number (logior #x3f800000 v1-64))) + ) + (set! (-> this lisa rate theta) (* (+ f30-2 (* f28-1 (+ -1.0 (the-as float v1-65)))) (seconds-per-frame))) ) - (set! (-> this lisa rate theta) (* (+ f30-6 (* f28-5 (+ -1.0 (the-as float v1-91)))) (seconds-per-frame))) + (let* ((f30-3 9216.0) + (f28-2 7987.199) + (v1-71 (/ (the-as int (rand-uint31-gen *random-generator*)) 256)) + (v1-72 (the-as number (logior #x3f800000 v1-71))) + ) + (set! (-> this lisa dest x-mag) (+ f30-3 (* f28-2 (+ -1.0 (the-as float v1-72))))) + ) + (let* ((f30-4 9216.0) + (f28-3 7987.199) + (v1-77 (/ (the-as int (rand-uint31-gen *random-generator*)) 256)) + (v1-78 (the-as number (logior #x3f800000 v1-77))) + ) + (set! (-> this lisa dest y-mag) (+ f30-4 (* f28-3 (+ -1.0 (the-as float v1-78))))) + ) + (let* ((f30-5 0.5) + (f28-4 0.75) + (v1-83 (/ (the-as int (rand-uint31-gen *random-generator*)) 256)) + (v1-84 (the-as number (logior #x3f800000 v1-83))) + ) + (set! (-> this lisa dest theta-rate) (+ f30-5 (* f28-4 (+ -1.0 (the-as float v1-84))))) + ) + ) + (else + (let* ((f30-6 32768.0) + (f28-5 10922.668) + (v1-90 (/ (the-as int (rand-uint31-gen *random-generator*)) 256)) + (v1-91 (the-as number (logior #x3f800000 v1-90))) + ) + (set! (-> this lisa rate theta) (* (+ f30-6 (* f28-5 (+ -1.0 (the-as float v1-91)))) (seconds-per-frame))) + ) + (let* ((f30-7 5120.0) + (f28-6 5120.0) + (v1-97 (/ (the-as int (rand-uint31-gen *random-generator*)) 256)) + (v1-98 (the-as number (logior #x3f800000 v1-97))) + ) + (set! (-> this lisa dest x-mag) (+ f30-7 (* f28-6 (+ -1.0 (the-as float v1-98))))) + ) + (let* ((f30-8 9216.0) + (f28-7 1024.0) + (v1-103 (/ (the-as int (rand-uint31-gen *random-generator*)) 256)) + (v1-104 (the-as number (logior #x3f800000 v1-103))) + ) + (set! (-> this lisa dest y-mag) (+ f30-8 (* f28-7 (+ -1.0 (the-as float v1-104))))) + ) + (let* ((f30-9 0.5) + (f28-8 0.75) + (v1-109 (/ (the-as int (rand-uint31-gen *random-generator*)) 256)) + (v1-110 (the-as number (logior #x3f800000 v1-109))) + ) + (set! (-> this lisa dest theta-rate) (+ f30-9 (* f28-8 (+ -1.0 (the-as float v1-110))))) + ) + ) + ) + (set! (-> this next-lisa-time) + (the-as time-frame (+ (mod (the-as int (rand-uint31-gen *random-generator*)) 601) 150 (current-time))) + ) ) - (let* ((f30-7 5120.0) - (f28-6 5120.0) - (v1-97 (/ (the-as int (rand-uint31-gen *random-generator*)) 256)) - (v1-98 (the-as number (logior #x3f800000 v1-97))) - ) - (set! (-> this lisa dest x-mag) (+ f30-7 (* f28-6 (+ -1.0 (the-as float v1-98))))) + (let ((v1-118 (the-as vehicle (handle->process (-> this track-obj))))) + (when v1-118 + (when (and (< 0.75 (fabs (-> v1-118 controls steering))) (!= (-> this stage) 1)) + (seek! (-> this lisa dest x-mag) (-> this circle-mag) (* 18432.0 (seconds-per-frame))) + (seek! (-> this lisa dest y-mag) (-> this circle-mag) (* 18432.0 (seconds-per-frame))) + ) + ) ) - (let* ((f30-8 9216.0) - (f28-7 1024.0) - (v1-103 (/ (the-as int (rand-uint31-gen *random-generator*)) 256)) - (v1-104 (the-as number (logior #x3f800000 v1-103))) - ) - (set! (-> this lisa dest y-mag) (+ f30-8 (* f28-7 (+ -1.0 (the-as float v1-104))))) + (set! (-> this lisa dest wx) 1.0) + (set! (-> this lisa dest wy) 1.2) + (set! (-> this lisa rate wx) 10.0) + (set! (-> this lisa rate wy) 10.0) + (set! (-> this lisa rate x-mag) (* 10240.0 (seconds-per-frame))) + (set! (-> this lisa rate y-mag) (* 10240.0 (seconds-per-frame))) + (set! (-> this lisa rate period-shift) (* 16384.0 (seconds-per-frame))) + (set! (-> this lisa dest period-shift) 16384.0) + (update! (-> this lisa)) + (let ((s5-3 (evaluate! (-> this lisa) (new 'stack-no-clear 'vector)))) + (vector-float*! s5-3 s5-3 0.5) + (vector-lerp! (-> this lisa-pt) (-> this lisa-pt) s5-3 1.0) + (let ((a2-9 (matrix-f-u-compose (matrix-identity! (new 'stack-no-clear 'matrix)) sv-76 *up-vector*))) + (vector-matrix*! s5-3 (-> this lisa-pt) a2-9) + ) + (vector+! (-> this root trans) (-> this basetrans) s5-3) ) - (let* ((f30-9 0.5) - (f28-8 0.75) - (v1-109 (/ (the-as int (rand-uint31-gen *random-generator*)) 256)) - (v1-110 (the-as number (logior #x3f800000 v1-109))) - ) - (set! (-> this lisa dest theta-rate) (+ f30-9 (* f28-8 (+ -1.0 (the-as float v1-110))))) + (let ((v1-147 (the-as vehicle (handle->process (-> this track-obj))))) + (when v1-147 + (if (< 0.75 (fabs (-> v1-147 controls steering))) + (set! (-> this bobber turning?) #t) + (set! (-> this bobber turning?) #f) + ) + ) + ) + (if (= (-> this stage) 1) + (set! (-> this bobber output-scale) 4096.0) + (set! (-> this bobber output-scale) 16384.0) + ) + (hijack-missile-bobber-method-10 (-> this bobber)) + (let ((f0-118 (- (-> this bobber output-val) (* 0.8 (-> this bobber output-scale))))) + (vector+float*! (-> this root trans) (-> this root trans) sv-76 f0-118) ) ) ) - (set! (-> this next-lisa-time) - (the-as time-frame (+ (mod (the-as int (rand-uint31-gen *random-generator*)) 601) 150 (current-time))) - ) - ) - (let ((v1-118 (the-as vehicle (handle->process (-> this track-obj))))) - (when v1-118 - (when (and (< 0.75 (fabs (-> v1-118 controls steering))) (!= (-> this stage) 1)) - (seek! (-> this lisa dest x-mag) (-> this circle-mag) (* 18432.0 (seconds-per-frame))) - (seek! (-> this lisa dest y-mag) (-> this circle-mag) (* 18432.0 (seconds-per-frame))) - ) - ) - ) - (set! (-> this lisa dest wx) 1.0) - (set! (-> this lisa dest wy) 1.2) - (set! (-> this lisa rate wx) 10.0) - (set! (-> this lisa rate wy) 10.0) - (set! (-> this lisa rate x-mag) (* 10240.0 (seconds-per-frame))) - (set! (-> this lisa rate y-mag) (* 10240.0 (seconds-per-frame))) - (set! (-> this lisa rate period-shift) (* 16384.0 (seconds-per-frame))) - (set! (-> this lisa dest period-shift) 16384.0) - (update! (-> this lisa)) - (let ((s5-3 (evaluate! (-> this lisa) (new 'stack-no-clear 'vector)))) - (vector-float*! s5-3 s5-3 0.5) - (vector-lerp! (-> this lisa-pt) (-> this lisa-pt) s5-3 1.0) - (let ((a2-9 (matrix-f-u-compose (matrix-identity! (new 'stack-no-clear 'matrix)) sv-76 *up-vector*))) - (vector-matrix*! s5-3 (-> this lisa-pt) a2-9) - ) - (vector+! (-> this root trans) (-> this basetrans) s5-3) - ) - (let ((v1-147 (the-as vehicle (handle->process (-> this track-obj))))) - (when v1-147 - (if (< 0.75 (fabs (-> v1-147 controls steering))) - (set! (-> this bobber turning?) #t) - (set! (-> this bobber turning?) #f) - ) - ) - ) - (if (= (-> this stage) 1) - (set! (-> this bobber output-scale) 4096.0) - (set! (-> this bobber output-scale) 16384.0) - ) - (hijack-missile-bobber-method-10 (-> this bobber)) - (let ((f0-118 (- (-> this bobber output-val) (* 0.8 (-> this bobber output-scale))))) - (vector+float*! (-> this root trans) (-> this root trans) sv-76 f0-118) ) (let ((s5-5 (vector-! (new 'stack-no-clear 'vector) (-> this root trans) (-> this last-trans)))) (vector-normalize! s5-5 1.0) @@ -1391,11 +1392,8 @@ ) (go-virtual explode) ) - (let* ((a1-3 (-> self tracked-player-positions data (-> self current-track-index))) - (f0-6 (vector-vector-distance-squared (-> self root trans) a1-3)) - (f1-2 819.2) - ) - (when (< f0-6 (* f1-2 f1-2)) + (let ((a1-3 (-> self tracked-player-positions data (-> self current-track-index)))) + (when (< (vector-vector-distance-squared (-> self root trans) a1-3) (square 819.2)) (if (< (-> self current-track-index) (the-as uint (+ (-> self tracked-player-positions length) -1))) (+! (-> self current-track-index) 1) ) diff --git a/test/decompiler/reference/jak3/levels/city/port/attack/ctyport-attack-bbush_REF.gc b/test/decompiler/reference/jak3/levels/city/port/attack/ctyport-attack-bbush_REF.gc index d3b0345f67..7ac3df4e57 100644 --- a/test/decompiler/reference/jak3/levels/city/port/attack/ctyport-attack-bbush_REF.gc +++ b/test/decompiler/reference/jak3/levels/city/port/attack/ctyport-attack-bbush_REF.gc @@ -344,7 +344,6 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch symbol vs none. (defmethod init! ((this ctyport-attack-manager-bbush)) - (local-vars (sv-96 res-tag)) (let ((t9-0 (method-of-type task-manager init!))) (t9-0 this) ) @@ -376,11 +375,14 @@ ) ) (set! (-> this mine-layout) *ctyport-bbush-mine-positions*) - (set! sv-96 (new 'static 'res-tag)) - (let ((v1-40 (res-lump-data (entity-by-name "port-attack-bbush-1") 'actor-groups pointer :tag-ptr (& sv-96)))) + (let* ((sv-96 (new 'static 'res-tag)) + (v1-40 + (res-lump-data (entity-by-name "port-attack-bbush-1") 'actor-groups (pointer actor-group) :tag-ptr (& sv-96)) + ) + ) (cond ((and v1-40 (nonzero? (-> sv-96 elt-count))) - (set! (-> this actor-group) (the-as (pointer actor-group) v1-40)) + (set! (-> this actor-group) v1-40) (set! (-> this actor-group-count) (the-as int (-> sv-96 elt-count))) ) (else @@ -626,3 +628,7 @@ (sleep-code) ) ) + + + + diff --git a/test/decompiler/reference/jak3/levels/city/port/attack/ctyport-attack_REF.gc b/test/decompiler/reference/jak3/levels/city/port/attack/ctyport-attack_REF.gc index e6435659ff..17112bc82e 100644 --- a/test/decompiler/reference/jak3/levels/city/port/attack/ctyport-attack_REF.gc +++ b/test/decompiler/reference/jak3/levels/city/port/attack/ctyport-attack_REF.gc @@ -1804,13 +1804,9 @@ ;; definition for method 23 of type ctyport-mine (defmethod update ((this ctyport-mine) (arg0 float)) (when (>= (+ (current-time) (seconds -0.5)) (-> this last-play-time)) - (let ((f0-0 (vector-vector-xz-distance-squared (-> this root trans) (target-pos 0))) - (f1-0 491520.0) - ) - (if (< f0-0 (* f1-0 f1-0)) - (sound-play "port-mine-flash" :position (-> this root trans)) - ) - ) + (if (< (vector-vector-xz-distance-squared (-> this root trans) (target-pos 0)) (square 491520.0)) + (sound-play "port-mine-flash" :position (-> this root trans)) + ) (set-time! (-> this last-play-time)) ) (let* ((f0-1 (vector-length (-> this root trans))) @@ -2817,7 +2813,6 @@ ;; definition for method 44 of type ctyport-attack-manager ;; INFO: Used lq/sq (defmethod ctyport-attack-manager-method-44 ((this ctyport-attack-manager) (arg0 ctyport-mine-layout)) - (local-vars (sv-208 vector) (sv-224 vector)) (let ((s5-0 (new 'stack-no-clear 'vector))) 0.0 (new 'stack-no-clear 'vector) @@ -2853,31 +2848,25 @@ (let ((v1-28 (-> arg0 stored-handles s2-0))) (send-event (handle->process v1-28) 'activate s5-0) ) - (let ((s1-0 s5-0) - (s0-0 s5-0) - ) - (set! sv-208 s4-0) - (let* ((f30-1 1.0) - (f28-0 0.29999995) - (v1-33 (/ (the-as int (rand-uint31-gen *random-generator*)) 256)) - (v1-34 (the-as number (logior #x3f800000 v1-33))) - (f0-16 (* (+ f30-1 (* f28-0 (+ -1.0 (the-as float v1-34)))) (-> arg0 spacing))) - ) - (vector+float*! s1-0 s0-0 sv-208 f0-16) - ) + (let* ((s1-0 s5-0) + (s0-0 s5-0) + (sv-208 s4-0) + (f30-1 1.0) + (f28-0 0.29999995) + (v1-33 (/ (the-as int (rand-uint31-gen *random-generator*)) 256)) + (v1-34 (the-as number (logior #x3f800000 v1-33))) + ) + (vector+float*! s1-0 s0-0 sv-208 (* (+ f30-1 (* f28-0 (+ -1.0 (the-as float v1-34)))) (-> arg0 spacing))) ) - (let ((s1-2 s5-0) - (s0-1 s5-0) - ) - (set! sv-224 (-> s3-1 rvec)) - (let* ((f30-2 -10240.0) - (f28-1 20480.0) - (v1-40 (/ (the-as int (rand-uint31-gen *random-generator*)) 256)) - (v1-41 (the-as number (logior #x3f800000 v1-40))) - (f0-21 (+ f30-2 (* f28-1 (+ -1.0 (the-as float v1-41))))) - ) - (vector+float*! s1-2 s0-1 sv-224 f0-21) - ) + (let* ((s1-2 s5-0) + (s0-1 s5-0) + (sv-224 (-> s3-1 rvec)) + (f30-2 -10240.0) + (f28-1 20480.0) + (v1-40 (/ (the-as int (rand-uint31-gen *random-generator*)) 256)) + (v1-41 (the-as number (logior #x3f800000 v1-40))) + ) + (vector+float*! s1-2 s0-1 sv-224 (+ f30-2 (* f28-1 (+ -1.0 (the-as float v1-41))))) ) ) ) @@ -3185,7 +3174,7 @@ (v1-40 (/ (the-as int (rand-uint31-gen *random-generator*)) 256)) (v1-41 (the-as number (logior #x3f800000 v1-40))) ) - (+! f30-0 (* (+ f28-0 (* f26-0 (+ -1.0 (the-as float v1-41)))) (lerp 0.01 0.06 (* f30-0 f30-0)))) + (+! f30-0 (* (+ f28-0 (* f26-0 (+ -1.0 (the-as float v1-41)))) (lerp 0.01 0.06 (square f30-0)))) ) ) (let ((f30-1 (fmax 0.0 (fmin 1.15 f30-0)))) diff --git a/test/decompiler/reference/jak3/levels/city/protect/assault-task_REF.gc b/test/decompiler/reference/jak3/levels/city/protect/assault-task_REF.gc index 81db5d401f..535b5a8b36 100644 --- a/test/decompiler/reference/jak3/levels/city/protect/assault-task_REF.gc +++ b/test/decompiler/reference/jak3/levels/city/protect/assault-task_REF.gc @@ -279,9 +279,7 @@ (quaternion-slerp! s4-1 (-> this original-cam-quat) s3-0 (/ f30-0 f0-9)) ) ((< (- 1.0 f0-9) f30-0) - (let* ((f0-12 (/ (- f30-0 f0-9) (- 1.0 f0-9))) - (f0-13 (* f0-12 f0-12)) - ) + (let ((f0-13 (square (/ (- f30-0 f0-9) (- 1.0 f0-9))))) (quaternion-slerp! s4-1 s3-0 s4-1 f0-13) ) ) @@ -1059,7 +1057,6 @@ ;; definition for method 47 of type task-manager-city-port-assault ;; INFO: Used lq/sq (defmethod spawn-guards ((this task-manager-city-port-assault) (arg0 int)) - (local-vars (sv-848 vector) (sv-864 vector) (sv-880 assault-object-spawn-params)) (rlet ((acc :class vf) (vf0 :class vf) (vf1 :class vf) @@ -1076,9 +1073,9 @@ ) (dotimes (s1-0 arg0) (let ((s0-0 s3-0)) - (set! sv-848 (-> this current-room center-pos)) - (set! sv-864 s4-0) - (let* ((f28-0 24576.0) + (let* ((sv-848 (-> this current-room center-pos)) + (sv-864 s4-0) + (f28-0 24576.0) (f26-0 0.0) (v1-6 (/ (the-as int (rand-uint31-gen *random-generator*)) 256)) (v1-7 (the-as number (logior #x3f800000 v1-6))) @@ -1121,21 +1118,22 @@ (vector-normalize! s2-0 1.0) (let ((s0-2 (get-last-unused-handle! (-> *assault-squad* spawn-records 3)))) (when (handle->process s0-2) - (set! sv-880 (new 'stack 'assault-object-spawn-params)) - (set! (-> sv-880 flags) (traffic-spawn-flags)) - (vector-copy! (-> sv-880 position) s3-0) - (set! (-> sv-880 behavior) (the-as uint 2)) - (set! (-> sv-880 flags) (traffic-spawn-flags)) - (set! (-> sv-880 suck-level) (get-suck-level this)) - (set! (-> sv-880 user-data) (the-as uint (-> this current-room center-pos))) - (logior! (-> sv-880 flags) (traffic-spawn-flags tsf7)) - (set! (-> sv-880 velocity quad) (the-as uint128 0)) - (quaternion-identity! (-> sv-880 rotation)) - (quaternion-look-at! (-> sv-880 rotation) s2-0 *up-vector*) - (set! (-> sv-880 nav-mesh) (find-nearest-nav-mesh (-> sv-880 position) (the-as float #x7f800000))) - (set! (-> sv-880 nav-branch) #f) - (set! (-> sv-880 guard-type) (the-as uint 1)) - (send-event (handle->process s0-2) 'traffic-activate sv-880 *traffic-engine*) + (let ((sv-880 (new 'stack 'assault-object-spawn-params))) + (set! (-> sv-880 flags) (traffic-spawn-flags)) + (vector-copy! (-> sv-880 position) s3-0) + (set! (-> sv-880 behavior) (the-as uint 2)) + (set! (-> sv-880 flags) (traffic-spawn-flags)) + (set! (-> sv-880 suck-level) (get-suck-level this)) + (set! (-> sv-880 user-data) (the-as uint (-> this current-room center-pos))) + (logior! (-> sv-880 flags) (traffic-spawn-flags tsf7)) + (set! (-> sv-880 velocity quad) (the-as uint128 0)) + (quaternion-identity! (-> sv-880 rotation)) + (quaternion-look-at! (-> sv-880 rotation) s2-0 *up-vector*) + (set! (-> sv-880 nav-mesh) (find-nearest-nav-mesh (-> sv-880 position) (the-as float #x7f800000))) + (set! (-> sv-880 nav-branch) #f) + (set! (-> sv-880 guard-type) (the-as uint 1)) + (send-event (handle->process s0-2) 'traffic-activate sv-880 *traffic-engine*) + ) ) ) (vector-rotate-around-y! s4-0 s4-0 f30-0) @@ -1150,15 +1148,7 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defmethod spawn-citizens ((this task-manager-city-port-assault) (arg0 int)) - (local-vars - (v1-65 int) - (sv-848 vector) - (sv-864 vector) - (sv-880 assault-object-spawn-params) - (sv-896 (function quaternion quaternion float quaternion)) - (sv-912 quaternion) - (sv-928 quaternion) - ) + (local-vars (v1-65 int)) (rlet ((acc :class vf) (vf0 :class vf) (vf1 :class vf) @@ -1175,9 +1165,9 @@ ) (dotimes (s1-0 arg0) (let ((s0-0 s3-0)) - (set! sv-848 (-> this current-room center-pos)) - (set! sv-864 s4-0) - (let* ((f28-0 10240.0) + (let* ((sv-848 (-> this current-room center-pos)) + (sv-864 s4-0) + (f28-0 10240.0) (f26-0 47104.0) (v1-7 (/ (the-as int (rand-uint31-gen *random-generator*)) 256)) (v1-8 (the-as number (logior #x3f800000 v1-7))) @@ -1220,42 +1210,42 @@ (vector-normalize! s2-0 1.0) (let ((s0-2 (get-last-unused-handle! (-> *assault-squad* spawn-records 1)))) (when (handle->process s0-2) - (set! sv-880 (new 'stack 'assault-object-spawn-params)) - (set! (-> sv-880 flags) (traffic-spawn-flags)) - (vector-copy! (-> sv-880 position) s3-0) - (set! (-> sv-880 behavior) (the-as uint 2)) - (set! (-> sv-880 flags) (traffic-spawn-flags)) - (set! (-> sv-880 suck-level) (get-suck-level this)) - (set! (-> sv-880 user-data) (the-as uint (-> this current-room center-pos))) - (logior! (-> sv-880 flags) (traffic-spawn-flags tsf7)) - (set! (-> sv-880 velocity quad) (the-as uint128 0)) - (quaternion-identity! (-> sv-880 rotation)) - (quaternion-look-at! (-> sv-880 rotation) s2-0 *up-vector*) - (set! (-> sv-880 nav-mesh) (find-nearest-nav-mesh (-> sv-880 position) (the-as float #x7f800000))) - (set! (-> sv-880 nav-branch) #f) - (set! sv-896 quaternion-rotate-y!) - (set! sv-912 (-> sv-880 rotation)) - (set! sv-928 (-> sv-880 rotation)) - (let* ((f28-1 65536.0) - (v1-56 (/ (the-as int (rand-uint31-gen *random-generator*)) 256)) - (v1-57 (the-as number (logior #x3f800000 v1-56))) - (a2-2 (* f28-1 (+ -1.0 (the-as float v1-57)))) - ) - (sv-896 sv-912 sv-928 a2-2) - ) - (+! (-> sv-880 position y) 409.6) - (cond - ((= (-> this current-room-index) (-> (task-perm-by-index *game-info* 46) user-uint64)) - (set! v1-65 600) - (set! (-> sv-880 flee-time) (the-as time-frame v1-65)) - ) - (else - (set! v1-65 2100) - (set! (-> sv-880 flee-time) (the-as time-frame v1-65)) + (let ((sv-880 (new 'stack 'assault-object-spawn-params))) + (set! (-> sv-880 flags) (traffic-spawn-flags)) + (vector-copy! (-> sv-880 position) s3-0) + (set! (-> sv-880 behavior) (the-as uint 2)) + (set! (-> sv-880 flags) (traffic-spawn-flags)) + (set! (-> sv-880 suck-level) (get-suck-level this)) + (set! (-> sv-880 user-data) (the-as uint (-> this current-room center-pos))) + (logior! (-> sv-880 flags) (traffic-spawn-flags tsf7)) + (set! (-> sv-880 velocity quad) (the-as uint128 0)) + (quaternion-identity! (-> sv-880 rotation)) + (quaternion-look-at! (-> sv-880 rotation) s2-0 *up-vector*) + (set! (-> sv-880 nav-mesh) (find-nearest-nav-mesh (-> sv-880 position) (the-as float #x7f800000))) + (set! (-> sv-880 nav-branch) #f) + (let* ((sv-896 quaternion-rotate-y!) + (sv-912 (-> sv-880 rotation)) + (sv-928 (-> sv-880 rotation)) + (f28-1 65536.0) + (v1-56 (/ (the-as int (rand-uint31-gen *random-generator*)) 256)) + (v1-57 (the-as number (logior #x3f800000 v1-56))) + ) + (sv-896 sv-912 sv-928 (* f28-1 (+ -1.0 (the-as float v1-57)))) ) + (+! (-> sv-880 position y) 409.6) + (cond + ((= (-> this current-room-index) (-> (task-perm-by-index *game-info* 46) user-uint64)) + (set! v1-65 600) + (set! (-> sv-880 flee-time) (the-as time-frame v1-65)) + ) + (else + (set! v1-65 2100) + (set! (-> sv-880 flee-time) (the-as time-frame v1-65)) + ) + ) + (set! (-> sv-880 flee-time) (the-as time-frame v1-65)) + (send-event (handle->process s0-2) 'traffic-activate sv-880 *traffic-engine*) ) - (set! (-> sv-880 flee-time) (the-as time-frame v1-65)) - (send-event (handle->process s0-2) 'traffic-activate sv-880 *traffic-engine*) ) ) (vector-rotate-around-y! s4-0 s4-0 f30-0) @@ -1688,8 +1678,7 @@ ((20) (let ((f0-1 (/ (-> *target* fact health) (-> *target* fact health-max)))) 0.0 - (let* ((f0-2 (- 1.0 f0-1)) - (f0-3 (* f0-2 f0-2)) + (let* ((f0-3 (square (- 1.0 f0-1))) (f0-4 (lerp 0.0 7.0 f0-3)) ) (* (-> arg0 percentages arg1) f0-4) diff --git a/test/decompiler/reference/jak3/levels/city/protect/cty-protect_REF.gc b/test/decompiler/reference/jak3/levels/city/protect/cty-protect_REF.gc index 88d2d39237..e1e44d4b7e 100644 --- a/test/decompiler/reference/jak3/levels/city/protect/cty-protect_REF.gc +++ b/test/decompiler/reference/jak3/levels/city/protect/cty-protect_REF.gc @@ -547,8 +547,7 @@ (let ((f28-0 (/ (-> *target* fact health) (-> *target* fact health-max)))) 0.0 (let* ((f0-9 (lerp 0.3 0.5 f30-0)) - (f1-2 (- 1.0 f28-0)) - (f1-3 (* f1-2 f1-2)) + (f1-3 (square (- 1.0 f28-0))) (f30-1 (lerp 0.0 f0-9 f1-3)) (v1-13 (/ (the-as int (rand-uint31-gen *random-generator*)) 256)) (v1-14 (the-as number (logior #x3f800000 v1-13))) diff --git a/test/decompiler/reference/jak3/levels/city/protect/flying-turret_REF.gc b/test/decompiler/reference/jak3/levels/city/protect/flying-turret_REF.gc index ee46a3383a..3353586374 100644 --- a/test/decompiler/reference/jak3/levels/city/protect/flying-turret_REF.gc +++ b/test/decompiler/reference/jak3/levels/city/protect/flying-turret_REF.gc @@ -377,13 +377,9 @@ (the-as enemy-aware #f) ) (update-focus this) - (let ((f0-0 (vector-vector-xz-distance-squared (-> this root trans) (-> this focus-pos))) - (f1-0 204800.0) - ) - (when (< f0-0 (* f1-0 f1-0)) - (set-time! (-> this pursuit-start-time)) - (logior! (-> this flags) (citizen-flag persistent in-pursuit)) - ) + (when (< (vector-vector-xz-distance-squared (-> this root trans) (-> this focus-pos)) (square 204800.0)) + (set-time! (-> this pursuit-start-time)) + (logior! (-> this flags) (citizen-flag persistent in-pursuit)) ) ) (else @@ -403,11 +399,8 @@ ;; definition for method 219 of type flying-turret (defmethod kg-squad-member-method-219 ((this flying-turret) (arg0 process-focusable)) - (let* ((s4-0 (get-trans arg0 0)) - (f0-0 (vector-vector-xz-distance-squared (-> this root trans) s4-0)) - (f1-0 245760.0) - ) - (or (and (< f0-0 (* f1-0 f1-0)) + (let ((s4-0 (get-trans arg0 0))) + (or (and (< (vector-vector-xz-distance-squared (-> this root trans) s4-0) (square 245760.0)) (< (fabs (- (-> s4-0 y) (-> this root trans y))) 61440.0) (< (-> s4-0 y) (-> this root trans y)) ) @@ -437,9 +430,7 @@ (vector-length (-> this root transv)) (set! f30-0 (vector-length s5-1)) (let* ((f1-3 (/ f30-0 (-> this enemy-info run-travel-speed))) - (f0-10 (fmax 0.0 (fmin 1.0 f1-3))) - (f0-11 (* f0-10 f0-10)) - (f0-12 (* f0-11 f0-11)) + (f0-12 (square (square (fmax 0.0 (fmin 1.0 f1-3))))) ) (when (!= (-> this chase-mode) 3) (let ((f1-5 (vector-length (-> this root transv)))) @@ -580,7 +571,7 @@ 0.0 (let ((f0-6 (-> this thruster-intensity))) (if (< f0-6 1.0) - (set! f0-6 (* f0-6 f0-6)) + (set! f0-6 (square f0-6)) ) (let ((f0-8 (* (lerp 3072.0 8601.6 f0-6) (-> this thruster-intensity-scalar)))) (set! (-> *part-id-table* 4709 init-specs 4 initial-valuef) f0-8) @@ -1126,62 +1117,51 @@ (go-virtual active) ) ) - (let ((f0-0 (vector-vector-xz-distance-squared (-> self root trans) (-> self focus-pos))) - (f1-0 245760.0) - ) + (let ((f0-0 (vector-vector-xz-distance-squared (-> self root trans) (-> self focus-pos)))) (cond - ((< (* f1-0 f1-0) f0-0) + ((< (square 245760.0) f0-0) (vector-copy! (-> self move-dest) (-> self focus-pos)) (set! (-> self chase-mode) (the-as uint 0)) 0 ) - ((and (= (-> self chase-mode) 0) (let ((f1-3 163840.0)) - (< f0-0 (* f1-3 f1-3)) - ) - ) + ((and (= (-> self chase-mode) 0) (< f0-0 (square 163840.0))) (set! (-> self chase-mode) (the-as uint 1)) (vector-copy! (-> self move-dest) (-> self root trans)) ) ) ) (when (= (-> self chase-mode) 1) - (let ((f0-1 (vector-vector-xz-distance-squared (-> self root trans) (-> self move-dest))) - (f1-6 20480.0) - ) - (cond - ((or (< f0-1 (* f1-6 f1-6)) (= (-> self thrust-mode) 2)) - (set-time! (-> self last-check-chase-pos-time)) - (let ((a1-5 (get-handle-pos (-> self squad) (-> self focus handle) (new 'stack-no-clear 'vector))) - (f0-2 245760.0) - ) - (cond - ((or (< (* f0-2 f0-2) (vector-vector-xz-distance-squared (-> self move-dest) a1-5)) (-> self hit-player?)) - (set! (-> self hit-player?) #f) - (squad-control-method-31 (-> self squad) (-> self move-dest) self (-> self current-enemy) 81920.0 0.0) - (flying-turret-method-230 self (the-as uint 0)) - ) - (else - (when (!= (-> self thrust-mode) 2) - (flying-turret-method-230 self (the-as uint 2)) - (set! (-> self num-shots-fired) 0) - (set! (-> self hit-player?) #f) - ) - (vector-copy! (-> self move-dest) (-> self root trans)) + (cond + ((or (< (vector-vector-xz-distance-squared (-> self root trans) (-> self move-dest)) (square 20480.0)) + (= (-> self thrust-mode) 2) + ) + (set-time! (-> self last-check-chase-pos-time)) + (let ((a1-5 (get-handle-pos (-> self squad) (-> self focus handle) (new 'stack-no-clear 'vector)))) + (cond + ((or (< (square 245760.0) (vector-vector-xz-distance-squared (-> self move-dest) a1-5)) (-> self hit-player?)) + (set! (-> self hit-player?) #f) + (squad-control-method-31 (-> self squad) (-> self move-dest) self (-> self current-enemy) 81920.0 0.0) + (flying-turret-method-230 self (the-as uint 0)) + ) + (else + (when (!= (-> self thrust-mode) 2) + (flying-turret-method-230 self (the-as uint 2)) + (set! (-> self num-shots-fired) 0) + (set! (-> self hit-player?) #f) ) + (vector-copy! (-> self move-dest) (-> self root trans)) ) ) ) - ((time-elapsed? (-> self last-check-chase-pos-time) (seconds 1)) - (set-time! (-> self last-check-chase-pos-time)) - (let ((a1-10 (get-handle-pos (-> self squad) (-> self focus handle) (new 'stack-no-clear 'vector))) - (f0-5 204800.0) - ) - (if (< (* f0-5 f0-5) (vector-vector-xz-distance-squared (-> self move-dest) a1-10)) - (squad-control-method-31 (-> self squad) (-> self move-dest) self (-> self current-enemy) 81920.0 0.0) - ) - ) + ) + ((time-elapsed? (-> self last-check-chase-pos-time) (seconds 1)) + (set-time! (-> self last-check-chase-pos-time)) + (let ((a1-10 (get-handle-pos (-> self squad) (-> self focus handle) (new 'stack-no-clear 'vector)))) + (if (< (square 204800.0) (vector-vector-xz-distance-squared (-> self move-dest) a1-10)) + (squad-control-method-31 (-> self squad) (-> self move-dest) self (-> self current-enemy) 81920.0 0.0) + ) ) - ) + ) ) ) (when (and (= (-> self thrust-mode) 2) diff --git a/test/decompiler/reference/jak3/levels/city/protect/protect-gunship_REF.gc b/test/decompiler/reference/jak3/levels/city/protect/protect-gunship_REF.gc index 0759797bc9..c4218cb151 100644 --- a/test/decompiler/reference/jak3/levels/city/protect/protect-gunship_REF.gc +++ b/test/decompiler/reference/jak3/levels/city/protect/protect-gunship_REF.gc @@ -1356,9 +1356,7 @@ (set! (-> s5-0 spans-internal data 0 num-inner-points) 5) (set! (-> s5-0 spans data 0 inner-random-offset-size) 1228.8) (when (not (time-elapsed? (-> this last-hit-time) (seconds 0.3))) - (let* ((f0-16 (* 0.011111111 (the float (- (current-time) (-> this last-hit-time))))) - (f0-17 (* f0-16 f0-16)) - ) + (let ((f0-17 (square (* 0.011111111 (the float (- (current-time) (-> this last-hit-time))))))) (set! (-> s5-0 spans data 0 inner-random-offset-size) (* (-> s5-0 spans data 0 inner-random-offset-size) (lerp 5.0 1.0 f0-17)) ) @@ -1523,31 +1521,30 @@ ;; definition for function find-nearest-nav-mesh-protect (defun find-nearest-nav-mesh-protect ((arg0 vector) (arg1 float)) - (local-vars (sv-64 nav-poly) (sv-68 nav-mesh) (sv-72 float) (sv-76 vector)) - (set! sv-64 (new 'stack-no-clear 'nav-poly)) - (set! sv-68 (the-as nav-mesh #f)) - (set! sv-72 arg1) - (set! sv-76 arg0) - (set! (-> sv-64 data 20) (the-as uint 7)) - (dotimes (gp-0 (-> *level* length)) - (let ((v1-5 (-> *level* level gp-0))) - (when (= (-> v1-5 status) 'active) - (when (!= (-> v1-5 name) 'lctyprot) - (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 vertex 0) sv-76 (the-as vector (-> s3-0 bounds))) - (let ((f0-1 (vector-length-squared (-> sv-64 vertex 0))) - (f1-0 (-> s3-0 bounds r)) - ) - (when (< f0-1 (* f1-0 f1-0)) - (set! (-> sv-64 vertex1 x) (-> s3-0 nearest-y-threshold)) - (nav-mesh-method-46 s3-0 sv-64) - (when (>= sv-72 (-> sv-64 vertex1 w)) - (set! sv-72 (-> sv-64 vertex1 w)) - (set! sv-68 s3-0) + (let ((sv-64 (new 'stack-no-clear 'nav-poly)) + (sv-68 (the-as nav-mesh #f)) + ) + (let ((sv-72 arg1) + (sv-76 arg0) + ) + (set! (-> sv-64 data 20) (the-as uint 7)) + (dotimes (gp-0 (-> *level* length)) + (let ((v1-5 (-> *level* level gp-0))) + (when (= (-> v1-5 status) 'active) + (when (!= (-> v1-5 name) 'lctyprot) + (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 vertex 0) sv-76 (the-as vector (-> s3-0 bounds))) + (when (< (vector-length-squared (-> sv-64 vertex 0)) (square (-> s3-0 bounds r))) + (set! (-> sv-64 vertex1 x) (-> s3-0 nearest-y-threshold)) + (nav-mesh-method-46 s3-0 sv-64) + (when (>= sv-72 (-> sv-64 vertex1 w)) + (set! sv-72 (-> sv-64 vertex1 w)) + (set! sv-68 s3-0) + ) ) ) ) @@ -1559,8 +1556,8 @@ ) ) ) + sv-68 ) - sv-68 ) ;; definition for function gunship-event-handler @@ -2234,16 +2231,12 @@ (if (and (logtest? (process-mask target crate enemy guard vehicle civilian) (-> s3-1 mask)) (not (focus-test? (the-as process-focusable s3-1) disable dead inactive)) (-> (the-as process-focusable s3-1) root root-prim) - (let ((f0-7 - (vector-vector-distance-squared - (-> self dest-pos) - (-> (the-as process-focusable s3-1) root root-prim prim-core world-sphere) - ) - ) - (f1-4 f30-0) - ) - (< f0-7 (* f1-4 f1-4)) - ) + (< (vector-vector-distance-squared + (-> self dest-pos) + (-> (the-as process-focusable s3-1) root root-prim prim-core world-sphere) + ) + (square f30-0) + ) ) (send-event s3-1 @@ -2273,7 +2266,7 @@ (not (focus-test? s5-1 disable dead inactive)) (-> s5-1 control root-prim) (< (vector-vector-distance-squared (-> self dest-pos) (-> s5-1 control root-prim prim-core world-sphere)) - (* f30-0 f30-0) + (square f30-0) ) ) (send-event @@ -2514,8 +2507,7 @@ (f24-1 (/ f0-35 4)) (f0-38 (floor (the float (/ s5-5 3)))) (f2-0 (/ f30-3 (meters 15))) - (f1-15 (fmax 0.0 (fmin 1.0 f2-0))) - (f1-16 (* f1-15 f1-15)) + (f1-16 (square (fmax 0.0 (fmin 1.0 f2-0)))) (f0-39 (* f0-38 (- 1.0 f1-16))) (f0-41 (* f26-2 (+ 0.75 f0-39))) (f30-4 (fmin 40960.0 f0-41)) @@ -2721,8 +2713,7 @@ (set! (-> s5-0 y) 0.0) (let* ((f0-11 (vector-normalize-ret-len! s5-0 1.0)) (f1-6 (/ f0-11 (meters 25))) - (f0-13 (fmax 0.0 (fmin 1.0 f1-6))) - (f0-14 (* f0-13 f0-13)) + (f0-14 (square (fmax 0.0 (fmin 1.0 f1-6)))) ) (vector-cross! (new 'stack-no-clear 'vector) *up-vector* s5-0) (let ((f0-15 (* 2730.6667 f0-14)) @@ -3273,159 +3264,106 @@ ;; ERROR: Unsupported inline assembly instruction kind - [madda.s f1, f4] ;; ERROR: Unsupported inline assembly instruction kind - [madd.s f0, f2, f5] (defun find-reposition-pt ((arg0 vector) (arg1 vector) (arg2 vector) (arg3 int) (arg4 int) (arg5 float) (arg6 float)) - (local-vars - (f0-16 float) - (sv-32 int) - (sv-40 float) - (sv-44 float) - (sv-48 vector) - (sv-52 symbol) - (sv-56 float) - (sv-60 vector) - (sv-64 float) - (sv-68 float) - (sv-72 float) - (sv-76 float) - (sv-80 float) - (sv-144 (function vector vector float)) - (sv-160 vector) - (sv-176 vector) - (sv-192 vector) - ) + (local-vars (f0-16 float)) (rlet ((vf0 :class vf) (vf4 :class vf) (vf5 :class vf) (vf6 :class vf) ) (init-vf0-vector) - (set! sv-32 -1) - (let ((f0-0 409600000.0)) - (set! sv-40 (* f0-0 f0-0)) - ) - (set! sv-44 (the-as float 409600000.0)) - (set! sv-48 (new 'stack-no-clear 'vector)) - (set! sv-52 #t) - (set! sv-56 (the-as float 0.0)) - (let ((v1-9 (the-as protect-gunship (handle->process (-> *active-gunships* arg4 proc))))) - (when v1-9 - (vector-! sv-48 (-> v1-9 root trans) arg1) - (set! (-> sv-48 y) 0.0) - (set! sv-56 (vector-normalize-ret-len! sv-48 1.0)) - ) - ) - (dotimes (s0-0 (-> *protect-path* length)) - (set! sv-60 (-> *protect-path* s0-0)) - (set! sv-64 (vector-vector-xz-distance-squared arg2 (-> *protect-path* s0-0))) - (set! sv-68 (vector-vector-xz-distance-squared arg1 (-> *protect-path* s0-0))) - (set! sv-144 vector-vector-xz-distance-squared) - (set! sv-160 (-> *protect-path* s0-0)) - (let ((a1-8 (target-pos 0))) - (set! sv-72 (sv-144 sv-160 a1-8)) - ) - (set! sv-76 (the-as float 0.0)) - (set! sv-80 (the-as float 1.0)) - (set! sv-52 #t) - (let ((v1-30 (the-as protect-gunship (handle->process (-> *active-gunships* arg4 proc))))) - (when v1-30 - (set! sv-44 (vector-vector-xz-distance sv-60 (-> v1-30 root trans))) - (set! sv-176 (new 'stack-no-clear 'vector)) - (let ((v1-34 sv-60) - (a0-24 arg1) - ) - (.lvf vf4 (&-> v1-34 quad)) - (.lvf vf5 (&-> a0-24 quad)) + (let ((sv-32 -1)) + (let ((sv-40 (square 409600000.0)) + (sv-44 (the-as float 409600000.0)) + (sv-48 (new 'stack-no-clear 'vector)) + (sv-52 #t) + (sv-56 (the-as float 0.0)) ) - (.mov.vf.w vf6 vf0) - (.sub.vf.xyz vf6 vf4 vf5) - (.svf (&-> sv-176 quad) vf6) - 0.0 - (let ((a0-25 sv-176)) - (vector-copy! a0-25 sv-176) - (set! (-> a0-25 y) 0.0) - (vector-normalize! a0-25 1.0) - ) - (let* ((v1-38 sv-48) - (f0-15 (-> sv-176 x)) - (f1-0 (-> sv-176 y)) - (f2-0 (-> sv-176 z)) - (f3-0 (-> v1-38 x)) - (f4-0 (-> v1-38 y)) - (f5-0 (-> v1-38 z)) - ) - (.mula.s f0-15 f3-0) - (.madda.s f1-0 f4-0) - (.madd.s f0-16 f2-0 f5-0) - ) - (let ((f0-17 f0-16)) - (if (and (< 0.8 f0-17) (< sv-44 sv-56)) - (set! sv-52 (the-as symbol #f)) - ) + (let ((v1-9 (the-as protect-gunship (handle->process (-> *active-gunships* arg4 proc))))) + (when v1-9 + (vector-! sv-48 (-> v1-9 root trans) arg1) + (set! (-> sv-48 y) 0.0) + (set! sv-56 (vector-normalize-ret-len! sv-48 1.0)) ) ) - ) - (let ((f0-19 143360.0)) - (when (and (< (* f0-19 f0-19) sv-72) - (let ((f0-22 sv-72) - (f1-4 319488.0) - ) - (< f0-22 (* f1-4 f1-4)) - ) - (and (< 102400.0 sv-44) sv-52) - ) - (when (or (not (logtest? arg3 2)) (let ((a0-32 (find-nearest-nav-mesh-protect sv-60 (the-as float #x7f800000)))) - (when a0-32 - (set! sv-192 (new 'stack-no-clear 'vector)) - (nav-mesh-method-10 a0-32 sv-192 sv-60 (the-as nav-poly #f)) - (let ((t9-9 vector-vector-xz-distance) - (a1-14 sv-60) - ) - (< (t9-9 sv-192 a1-14) 4096.0) - ) - ) - ) + (dotimes (s0-0 (-> *protect-path* length)) + (let ((sv-60 (-> *protect-path* s0-0)) + (sv-64 (vector-vector-xz-distance-squared arg2 (-> *protect-path* s0-0))) + (sv-68 (vector-vector-xz-distance-squared arg1 (-> *protect-path* s0-0))) + (sv-72 (vector-vector-xz-distance-squared (-> *protect-path* s0-0) (target-pos 0))) + (sv-76 (the-as float 0.0)) + ) + (let ((sv-80 (the-as float 1.0))) + ) + (set! sv-52 #t) + (let ((v1-30 (the-as protect-gunship (handle->process (-> *active-gunships* arg4 proc))))) + (when v1-30 + (set! sv-44 (vector-vector-xz-distance sv-60 (-> v1-30 root trans))) + (let ((sv-176 (new 'stack-no-clear 'vector))) + (let ((v1-34 sv-60) + (a0-24 arg1) + ) + (.lvf vf4 (&-> v1-34 quad)) + (.lvf vf5 (&-> a0-24 quad)) ) - (when (or (not (logtest? arg3 6)) (let ((f0-25 arg5)) - (< (* f0-25 f0-25) sv-64) - ) + (.mov.vf.w vf6 vf0) + (.sub.vf.xyz vf6 vf4 vf5) + (.svf (&-> sv-176 quad) vf6) + 0.0 + (let ((a0-25 sv-176)) + (vector-copy! a0-25 sv-176) + (set! (-> a0-25 y) 0.0) + (vector-normalize! a0-25 1.0) + ) + (let* ((v1-38 sv-48)) + (set! f0-16 (vector-dot sv-176 v1-38)) + ) + ) + (let ((f0-17 f0-16)) + (if (and (< 0.8 f0-17) (< sv-44 sv-56)) + (set! sv-52 (the-as symbol #f)) ) - (when (or (not (logtest? arg3 1)) (let ((f0-28 sv-72) - (f1-10 286720.0) + ) + ) + ) + (when (and (< (square 143360.0) sv-72) (< sv-72 (square 319488.0)) (and (< 102400.0 sv-44) sv-52)) + (when (or (not (logtest? arg3 2)) (let ((a0-32 (find-nearest-nav-mesh-protect sv-60 (the-as float #x7f800000)))) + (when a0-32 + (let ((sv-192 (new 'stack-no-clear 'vector))) + (nav-mesh-method-10 a0-32 sv-192 sv-60 (the-as nav-poly #f)) + (< (vector-vector-xz-distance sv-192 sv-60) 4096.0) ) - (and (< f0-28 (* f1-10 f1-10)) (let ((f0-29 163840.0)) - (< (* f0-29 f0-29) sv-72) - ) - ) + ) ) ) - (let ((f0-32 sv-68) - (f1-14 arg6) + (when (or (not (logtest? arg3 6)) (< (square arg5) sv-64)) + (when (or (not (logtest? arg3 1)) (and (< sv-72 (square 286720.0)) (< (square 163840.0) sv-72))) + (set! sv-76 (fabs (- sv-68 (square arg6)))) + (let ((a0-35 (new 'stack 'sphere))) + (set! (-> a0-35 quad) (-> sv-60 quad)) + (set! (-> a0-35 r) 20480.0) + (if (not (sphere-in-view-frustum? a0-35)) + (set! sv-76 (* 100.0 sv-76)) + ) ) - (set! sv-76 (fabs (- f0-32 (* f1-14 f1-14)))) - ) - (let ((a0-35 (new 'stack 'sphere))) - (set! (-> a0-35 quad) (-> sv-60 quad)) - (set! (-> a0-35 r) 20480.0) - (if (not (sphere-in-view-frustum? a0-35)) - (set! sv-76 (* 100.0 sv-76)) + (when (< sv-76 sv-40) + (set! sv-40 sv-76) + (set! sv-32 s0-0) ) - ) - (when (< sv-76 sv-40) - (set! sv-40 sv-76) - (set! sv-32 s0-0) + ) ) ) ) ) ) ) - ) - (cond - ((< -1 sv-32) - (-> *protect-path* sv-32) - ) - (else - (empty) - arg1 + (cond + ((< -1 sv-32) + (-> *protect-path* sv-32) + ) + (else + (empty) + arg1 + ) ) ) ) @@ -3750,8 +3688,7 @@ 0.0 0.0 (let* ((f0-6 (vector-length v1-8)) - (f0-7 (/ f0-6 (meters 25))) - (f1-3 (* f0-7 f0-7 (seconds-per-frame))) + (f1-3 (* (square (/ f0-6 (meters 25))) (seconds-per-frame))) (f0-10 (fmax 0.0 (fmin 1.0 f1-3))) ) (vector+float*! (-> this root transv) (-> this root transv) v1-8 f0-10) @@ -3777,8 +3714,7 @@ (let ((f1-6 (vector-normalize-ret-len! s5-3 1.0))) (when (< f1-6 122880.0) (let* ((f0-21 (/ f1-6 (meters 30))) - (f0-22 (- 1.0 f0-21)) - (f0-23 (* f0-22 f0-22)) + (f0-23 (square (- 1.0 f0-21))) ) (vector-float*! s5-3 s5-3 (- 122880.0 f1-6)) (vector+float*! (-> this root transv) (-> this root transv) s5-3 (* 4.0 (seconds-per-frame) f0-23)) diff --git a/test/decompiler/reference/jak3/levels/city/protect/roboguard-city_REF.gc b/test/decompiler/reference/jak3/levels/city/protect/roboguard-city_REF.gc index c2b8c55584..53c18435c6 100644 --- a/test/decompiler/reference/jak3/levels/city/protect/roboguard-city_REF.gc +++ b/test/decompiler/reference/jak3/levels/city/protect/roboguard-city_REF.gc @@ -1359,11 +1359,7 @@ (!= self s3-1) (not (focus-test? (the-as process-focusable s3-1) disable dead inactive)) (logtest? (process-mask crate guard vehicle civilian metalhead) (-> s3-1 mask)) - (let ((f0-0 (vector-vector-xz-distance-squared gp-0 (get-trans (the-as process-focusable s3-1) 3))) - (f1-0 10240.0) - ) - (< f0-0 (* f1-0 f1-0)) - ) + (< (vector-vector-xz-distance-squared gp-0 (get-trans (the-as process-focusable s3-1) 3)) (square 10240.0)) ) (send-attack-from-tshape self s3-1 (the-as touching-shapes-entry #f) (-> self persistent-attack-id)) ) @@ -1379,11 +1375,7 @@ (!= self s5-2) (not (focus-test? s5-2 disable dead inactive)) (logtest? (process-mask crate guard vehicle civilian metalhead) (-> s5-2 mask)) - (let ((f0-2 (vector-vector-xz-distance-squared gp-0 (get-trans s5-2 3))) - (f1-4 10240.0) - ) - (< f0-2 (* f1-4 f1-4)) - ) + (< (vector-vector-xz-distance-squared gp-0 (get-trans s5-2 3)) (square 10240.0)) ) (send-attack-from-tshape self s5-2 (the-as touching-shapes-entry #f) (-> self persistent-attack-id)) ) @@ -2325,17 +2317,13 @@ (the-as enemy-aware #f) ) (update-focus this) - (let ((f0-2 (vector-vector-xz-distance-squared (-> this root trans) (-> this focus-pos))) - (f1-1 204800.0) - ) - (when (< f0-2 (* f1-1 f1-1)) - (set-time! (-> this pursuit-start-time)) - (logior! (-> this flags) (citizen-flag in-pursuit)) - (when (not (logtest? (-> this squad alert-state flags) (squad-alert-flag war))) - (let ((v0-6 (the-as object (logior (-> this flags) (citizen-flag persistent))))) - (set! (-> this flags) (the-as citizen-flag v0-6)) - v0-6 - ) + (when (< (vector-vector-xz-distance-squared (-> this root trans) (-> this focus-pos)) (square 204800.0)) + (set-time! (-> this pursuit-start-time)) + (logior! (-> this flags) (citizen-flag in-pursuit)) + (when (not (logtest? (-> this squad alert-state flags) (squad-alert-flag war))) + (let ((v0-6 (the-as object (logior (-> this flags) (citizen-flag persistent))))) + (set! (-> this flags) (the-as citizen-flag v0-6)) + v0-6 ) ) ) diff --git a/test/decompiler/reference/jak3/levels/city/sniper/cty-sniper-battery_REF.gc b/test/decompiler/reference/jak3/levels/city/sniper/cty-sniper-battery_REF.gc index c692d1377c..d113cab8d4 100644 --- a/test/decompiler/reference/jak3/levels/city/sniper/cty-sniper-battery_REF.gc +++ b/test/decompiler/reference/jak3/levels/city/sniper/cty-sniper-battery_REF.gc @@ -946,7 +946,6 @@ ;; INFO: Used lq/sq (defmethod init-from-entity! ((this cty-sniper-battery) (arg0 entity-actor)) "Set up a newly created process from the entity that created it." - (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) @@ -989,12 +988,13 @@ ) (process-drawable-from-entity! this arg0) (logclear! (-> this mask) (process-mask actor-pause)) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-25 (res-lump-data arg0 'actor-groups pointer :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-25 (res-lump-data arg0 'actor-groups (pointer actor-group) :tag-ptr (& sv-16))) + ) (cond ((and v1-25 (nonzero? (-> sv-16 elt-count))) (set! (-> this actor-group-count) (the-as int (-> sv-16 elt-count))) - (set! (-> this actor-group) (the-as (pointer actor-group) v1-25)) + (set! (-> this actor-group) v1-25) ) (else (set! (-> this actor-group-count) 0) @@ -1051,3 +1051,7 @@ (set! (-> self during-movement-sound) (new-sound-id)) (go-virtual idle) ) + + + + diff --git a/test/decompiler/reference/jak3/levels/city/sniper/cty-sniper-turret_REF.gc b/test/decompiler/reference/jak3/levels/city/sniper/cty-sniper-turret_REF.gc index 87abe016be..ed8764013e 100644 --- a/test/decompiler/reference/jak3/levels/city/sniper/cty-sniper-turret_REF.gc +++ b/test/decompiler/reference/jak3/levels/city/sniper/cty-sniper-turret_REF.gc @@ -246,14 +246,15 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defmethod task-manager-method-26 ((this task-manager-city-sniper-fight)) - (local-vars (v1-10 object) (sv-16 res-tag)) + (local-vars (v1-10 object)) (when (not (-> this sniper-turrets-marker-entity)) (let ((s5-0 (entity-by-name "cty-sniper-fight-turret-manager-1"))) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-3 (res-lump-data s5-0 'actor-groups pointer :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-3 (res-lump-data s5-0 'actor-groups (pointer actor-group) :tag-ptr (& sv-16))) + ) (cond ((and v1-3 (nonzero? (-> sv-16 elt-count))) - (set! (-> this actor-group) (the-as (pointer actor-group) v1-3)) + (set! (-> this actor-group) v1-3) (set! (-> this actor-group-count) (the-as int (-> sv-16 elt-count))) ) (else @@ -3585,10 +3586,10 @@ ;; INFO: Used lq/sq (defmethod init-from-entity! ((this cty-sniper-turret) (arg0 entity-actor)) "Set up a newly created process from the entity that created it." - (local-vars (sv-16 res-tag)) (set! (-> this entity) arg0) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-1 (res-lump-data arg0 'actor-groups (pointer actor-group) :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-1 (res-lump-data arg0 'actor-groups (pointer actor-group) :tag-ptr (& sv-16))) + ) (when (and v1-1 (nonzero? (-> sv-16 elt-count))) (set! (-> this actor-group-count) (the-as int (-> sv-16 elt-count))) (set! (-> this actor-group) v1-1) @@ -3607,3 +3608,7 @@ (t9-1 this a1-6 a2-1 a3-1 0.0) ) ) + + + + diff --git a/test/decompiler/reference/jak3/levels/city/traffic/citizen/citizen_REF.gc b/test/decompiler/reference/jak3/levels/city/traffic/citizen/citizen_REF.gc index 2dd2a5bbf8..cc5f8fbf6f 100644 --- a/test/decompiler/reference/jak3/levels/city/traffic/citizen/citizen_REF.gc +++ b/test/decompiler/reference/jak3/levels/city/traffic/citizen/citizen_REF.gc @@ -520,9 +520,7 @@ *cty-faction-manager* (and (or (not (-> this draw)) (not (logtest? (-> this draw status) (draw-control-status on-screen))) - (let ((f0-0 450560.0)) - (< (* f0-0 f0-0) (vector-vector-xz-distance-squared (-> this root trans) (math-camera-pos))) - ) + (< (square 450560.0) (vector-vector-xz-distance-squared (-> this root trans) (math-camera-pos))) ) (nonzero? (-> this controller branch)) (or (not (cty-faction-manager-method-23 *cty-faction-manager* (the-as uint (-> this controller branch clock-mask))) @@ -1091,7 +1089,6 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defmethod citizen-method-203 ((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)) @@ -1108,54 +1105,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) - (vector-copy! s1-0 s0-0) - (vector-copy! s1-0 sv-320) - ) - ) - ((< 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) + (vector-copy! s1-0 s0-0) (vector-copy! s1-0 sv-320) ) - (else - (vector-copy! s1-0 s0-0) - ) - ) + ) + ((< 4096.0 f1-10) + (vector-copy! s1-0 sv-320) + ) + (else + (vector-copy! s1-0 s0-0) ) - (vector-copy! arg0 s1-0) - (let ((a1-11 (new 'stack-no-clear 'vector))) - (vector-copy! a1-11 (-> this root trans)) - (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)) + ) + ) + (vector-copy! arg0 s1-0) + (let ((a1-11 (new 'stack-no-clear 'vector))) + (vector-copy! a1-11 (-> this root trans)) + (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)) ) ) ) @@ -1748,11 +1738,9 @@ (cond ((not (logtest? (-> self flags) (citizen-flag in-formation))) (when (and (nonzero? (-> self controller branch)) - (let ((f0-0 (vector-vector-xz-distance-squared (-> self root trans) (-> self dest-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 dest-point)) (square 16384.0)) + (logtest? (-> self nav state flags) (nav-state-flag at-target)) + ) ) (let ((gp-0 (-> self controller branch))) (vehicle-controller-method-14 (-> self controller) (the-as vehicle self)) @@ -1786,11 +1774,7 @@ (a1-12 (new 'stack-no-clear 'vector)) ) (vector-copy! a1-12 (-> a2-2 target-pos)) - (let ((f0-2 (t9-4 a0-16 a1-12)) - (f1-3 4096.0) - ) - (< f0-2 (* f1-3 f1-3)) - ) + (< (t9-4 a0-16 a1-12) (square 4096.0)) ) ) (-> self nav state speed) diff --git a/test/decompiler/reference/jak3/levels/city/traffic/citizen/civilian_REF.gc b/test/decompiler/reference/jak3/levels/city/traffic/citizen/civilian_REF.gc index 1edd5490c2..ae2b7edc0f 100644 --- a/test/decompiler/reference/jak3/levels/city/traffic/citizen/civilian_REF.gc +++ b/test/decompiler/reference/jak3/levels/city/traffic/citizen/civilian_REF.gc @@ -602,7 +602,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 dest-point) (-> self root trans)))) (vector-! (new 'stack-no-clear 'vector) (-> self dest-point) (the-as vector (-> self danger-pos))) @@ -615,67 +614,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-poly)) ) - (let ((v1-6 (-> self nav)) - (a0-8 (-> self danger-pos)) - (a1-5 (new 'stack-no-clear 'nav-poly)) - ) - (vector-! (-> a1-5 vertex 0) (the-as vector a0-8) (the-as vector (-> v1-6 state mesh bounds))) - (set! (-> a1-5 vertex1 x) (-> v1-6 nearest-y-threshold)) - (set! (-> a1-5 data 20) (the-as uint 2)) - (set! sv-352 (nav-mesh-method-45 (-> 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) - (vector-copy! s4-0 s3-0) - (vector-copy! s4-0 s2-0) + (vector-! (-> a1-5 vertex 0) (the-as vector a0-8) (the-as vector (-> v1-6 state mesh bounds))) + (set! (-> a1-5 vertex1 x) (-> v1-6 nearest-y-threshold)) + (set! (-> a1-5 data 20) (the-as uint 2)) + (let ((sv-352 (nav-mesh-method-45 (-> 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) - (vector-copy! s4-0 s2-0) - ) - (else - (vector-copy! s4-0 s3-0) + (cond + ((< 0.0 (vector-dot s1-1 gp-1)) + (if (< 8192.0 f0-7) + (vector-copy! s4-0 s3-0) + (vector-copy! s4-0 s2-0) + ) + ) + ((< 8192.0 f1-7) + (vector-copy! s4-0 s2-0) + ) + (else + (vector-copy! s4-0 s3-0) + ) ) ) - ) - (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) - ) - (vector-copy! gp-1 s4-0) - (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) + ) + (vector-copy! gp-1 s4-0) + (vector-xz-normalize! gp-1 (* 16384.0 f0-15)) + ) ) + (vector-xz-normalize! s5-1 16384.0) ) - (vector-xz-normalize! s5-1 16384.0) ) ) ) @@ -802,7 +794,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)) @@ -819,41 +810,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) + (vector-copy! s4-0 s3-0) + (vector-copy! s4-0 s2-0) ) - (cond - ((< 0.0 (vector-dot gp-0 s5-1)) - (if (< 4096.0 f0-9) - (vector-copy! s4-0 s3-0) - (vector-copy! s4-0 s2-0) - ) - ) - ((< 4096.0 f1-8) - (vector-copy! s4-0 s2-0) - ) - (else - (vector-copy! s4-0 s3-0) - ) + ) + ((< 4096.0 f1-8) + (vector-copy! s4-0 s2-0) + ) + (else + (vector-copy! s4-0 s3-0) ) ) - (vector-copy! gp-0 s4-0) ) + (vector-copy! gp-0 s4-0) ) ) (if *citizen-debug* @@ -1830,7 +1815,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)) @@ -1861,24 +1845,15 @@ (quaternion-copy! s3-0 (-> s2-0 root quat)) (vehicle-method-66 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) @@ -2050,7 +2025,6 @@ ) ) :code (behavior () - (local-vars (sv-128 float) (sv-144 float)) (ja-channel-push! 1 (seconds 0.1)) (remove-riders (the-as vehicle (handle->process (-> self vehicle))) (the-as handle self)) (logclear! (-> self focus-status) (focus-status pilot-riding pilot)) @@ -2108,24 +2082,16 @@ ) (vehicle-method-66 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/jak3/levels/city/traffic/citizen/guard_REF.gc b/test/decompiler/reference/jak3/levels/city/traffic/citizen/guard_REF.gc index 0887b229c6..b99432cd67 100644 --- a/test/decompiler/reference/jak3/levels/city/traffic/citizen/guard_REF.gc +++ b/test/decompiler/reference/jak3/levels/city/traffic/citizen/guard_REF.gc @@ -231,60 +231,48 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defmethod crimson-guard-method-259 ((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) - ) - (set! sv-240 arg0) - (let ((s0-1 (vector+*! (new 'stack-no-clear 'vector) (-> this root trans) *y-vector* 8192.0))) - (set! sv-320 (new 'stack-no-clear 'vector)) - (set! sv-304 (new 'stack-no-clear 'vector)) - (let ((s1-0 (new 'stack-no-clear 'vector)) - (s2-0 (new 'stack-no-clear 'vector)) - (s5-0 (new 'stack-no-clear 'vector)) + (let ((sv-240 arg0) + (s0-1 (vector+*! (new 'stack-no-clear 'vector) (-> this root trans) *y-vector* 8192.0)) + (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)) + ) + (-> this node-list data 4 bone transform) + (let ((s4-0 (vector-x-quaternion! (new 'stack-no-clear 'vector) (-> this root quat))) + (s3-0 (vector-y-quaternion! (new 'stack-no-clear 'vector) (-> this root quat))) ) - (-> this node-list data 4 bone transform) - (let ((s4-0 (vector-x-quaternion! (new 'stack-no-clear 'vector) (-> this root quat))) - (s3-0 (vector-y-quaternion! (new 'stack-no-clear 'vector) (-> this root quat))) - ) - (vector-z-quaternion! (new 'stack-no-clear 'vector) (-> this root quat)) - (vector-copy! s0-1 (-> this root trans)) - (if (logtest? (enemy-flag drawn-mirrored) (-> this enemy-flags)) - (vector+*! s0-1 s0-1 s4-0 4096.0) - (vector+*! s0-1 s0-1 s4-0 2048.0) - ) - (vector+*! s0-1 s0-1 s3-0 8540.16) - (vector-normalize! (vector-! sv-320 sv-240 s0-1) 1.0) - (set! sv-288 (new 'stack-no-clear 'vector)) - (let ((v1-19 (-> sv-240 quad))) - (set! (-> sv-288 quad) v1-19) - ) - (set! sv-256 vector-rotate90-around-y!) - (set! sv-272 (new 'stack-no-clear 'vector)) - (let* ((a1-15 (vector-normalize! (vector-! (new 'stack-no-clear 'vector) sv-288 s0-1) -2998.272)) - (v0-5 (sv-256 sv-272 a1-15)) - ) - (vector+! sv-288 sv-288 v0-5) + (vector-z-quaternion! (new 'stack-no-clear 'vector) (-> this root quat)) + (vector-copy! s0-1 (-> this root trans)) + (if (logtest? (enemy-flag drawn-mirrored) (-> this enemy-flags)) + (vector+*! s0-1 s0-1 s4-0 4096.0) + (vector+*! s0-1 s0-1 s4-0 2048.0) ) + (vector+*! s0-1 s0-1 s3-0 8540.16) + (vector-normalize! (vector-! sv-320 sv-240 s0-1) 1.0) + (let ((sv-288 (new 'stack-no-clear 'vector))) + (vector-copy! sv-288 sv-240) + (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-1) -2998.272) + ) + ) (vector-normalize! (vector-! sv-320 sv-288 s0-1) 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) - (set! (-> s5-0 x) (fmax -14563.556 (fmin 14563.556 (deg- (-> s1-0 x) (-> s2-0 x))))) - (set! (-> s5-0 y) (fmax -14563.556 (fmin 14563.556 (deg- (-> s1-0 y) (-> s2-0 y))))) - (set! (-> s5-0 z) 0.0) - (let ((s2-1 (new 'stack-no-clear 'quaternion))) - (let ((s1-1 (new 'stack-no-clear 'quaternion))) - (quaternion-vector-angle! s2-1 s4-0 (-> s5-0 x)) - (quaternion-vector-angle! s1-1 s3-0 (-> s5-0 y)) - (quaternion*! s2-1 s1-1 s2-1) - ) - (quaternion-slerp! (-> this joint quat) (-> this joint quat) s2-1 (* 5.0 (seconds-per-frame))) + ) + (vector-z-quaternion! sv-304 (-> this root quat)) + (rot-zxy-from-vector! s2-0 sv-304) + (rot-zxy-from-vector! s1-0 sv-320) + (set! (-> s5-0 x) (fmax -14563.556 (fmin 14563.556 (deg- (-> s1-0 x) (-> s2-0 x))))) + (set! (-> s5-0 y) (fmax -14563.556 (fmin 14563.556 (deg- (-> s1-0 y) (-> s2-0 y))))) + (set! (-> s5-0 z) 0.0) + (let ((s2-1 (new 'stack-no-clear 'quaternion))) + (let ((s1-1 (new 'stack-no-clear 'quaternion))) + (quaternion-vector-angle! s2-1 s4-0 (-> s5-0 x)) + (quaternion-vector-angle! s1-1 s3-0 (-> s5-0 y)) + (quaternion*! s2-1 s1-1 s2-1) ) + (quaternion-slerp! (-> this joint quat) (-> this joint quat) s2-1 (* 5.0 (seconds-per-frame))) ) ) ) @@ -1117,54 +1105,57 @@ ;; definition for method 282 of type crimson-guard ;; INFO: Used lq/sq (defmethod crimson-guard-method-282 ((this crimson-guard) (arg0 vector) (arg1 traffic-target-formation) (arg2 (pointer float)) (arg3 int)) - (local-vars (sv-16 int) (sv-24 float) (sv-28 float) (sv-32 float)) - (set! sv-16 -1) - (set! sv-24 (the-as float (gpr->fpr #x7f800000))) - (set! sv-28 (crimson-guard-method-283 this)) - (let ((v1-4 (-> this guard-type))) - (set! sv-32 (the-as float (if (or (= v1-4 (guard-type rifle)) (= v1-4 (guard-type grenade))) - #x47200000 - #x46000000 - ) - ) + (let ((sv-16 -1)) + (let ((sv-24 (the-as float (gpr->fpr #x7f800000))) + (sv-28 (crimson-guard-method-283 this)) ) - ) - (dotimes (s1-0 arg3) - (when (>= (-> arg1 circle-range s1-0) sv-32) - (let* ((a1-3 (vector-rotate-around-y! - (new 'stack-no-clear 'vector) - *x-vector* - (* 182.04445 (/ (* 360.0 (the float s1-0)) (the float arg3))) - ) - ) - (a0-6 (vector+float*! (new 'stack-no-clear 'vector) arg0 a1-3 (fmin sv-28 (-> arg1 circle-range s1-0)))) - (f0-8 (vector-vector-distance a0-6 (-> this root trans))) + (let* ((v1-4 (-> this guard-type)) + (sv-32 (the-as float (if (or (= v1-4 (guard-type rifle)) (= v1-4 (guard-type grenade))) + #x47200000 + #x46000000 + ) + ) + ) ) - (when (and (< f0-8 sv-24) (= (-> arg2 s1-0) 0.0)) - (set! sv-16 s1-0) - (set! sv-24 f0-8) + (dotimes (s1-0 arg3) + (when (>= (-> arg1 circle-range s1-0) sv-32) + (let* ((a1-3 (vector-rotate-around-y! + (new 'stack-no-clear 'vector) + *x-vector* + (* 182.04445 (/ (* 360.0 (the float s1-0)) (the float arg3))) + ) + ) + (a0-6 (vector+float*! (new 'stack-no-clear 'vector) arg0 a1-3 (fmin sv-28 (-> arg1 circle-range s1-0)))) + (f0-8 (vector-vector-distance a0-6 (-> this root trans))) + ) + (when (and (< f0-8 sv-24) (= (-> arg2 s1-0) 0.0)) + (set! sv-16 s1-0) + (set! sv-24 f0-8) + ) + ) + ) + ) + ) + (cond + ((!= sv-16 -1) + (let ((v1-26 (vector-rotate-around-y! + (new 'stack-no-clear 'vector) + *x-vector* + (* 182.04445 (/ (* 360.0 (the float sv-16)) (the float arg3))) + ) + ) + ) + (vector+float*! (-> this move-position) arg0 v1-26 (fmin sv-28 (-> arg1 circle-range sv-16))) + ) + (set! (-> arg2 sv-16) (fmin sv-28 (-> arg1 circle-range sv-16))) + ) + (else + (vector-copy! (-> this move-position) (-> this root trans)) ) ) ) + (!= sv-16 -1) ) - (cond - ((!= sv-16 -1) - (let ((v1-26 (vector-rotate-around-y! - (new 'stack-no-clear 'vector) - *x-vector* - (* 182.04445 (/ (* 360.0 (the float sv-16)) (the float arg3))) - ) - ) - ) - (vector+float*! (-> this move-position) arg0 v1-26 (fmin sv-28 (-> arg1 circle-range sv-16))) - ) - (set! (-> arg2 sv-16) (fmin sv-28 (-> arg1 circle-range sv-16))) - ) - (else - (vector-copy! (-> this move-position) (-> this root trans)) - ) - ) - (!= sv-16 -1) ) ;; definition for method 262 of type crimson-guard @@ -1314,14 +1305,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-266 ((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 ((vf0 :class vf) (vf4 :class vf) (vf5 :class vf) @@ -1334,8 +1318,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)))) @@ -1350,57 +1334,52 @@ (vector-! (-> a1-7 vertex 0) a0-8 (the-as vector (-> v1-15 state mesh bounds))) (set! (-> a1-7 vertex1 x) (-> v1-15 nearest-y-threshold)) (set! (-> a1-7 data 20) (the-as uint 2)) - (set! sv-816 (nav-mesh-method-45 (-> v1-15 state mesh) a1-7)) - ) - (when sv-816 - (let* ((v1-19 s4-0) - (f0-7 (-> sv-768 x)) - (f1-4 (-> sv-768 y)) - (f2-2 (-> sv-768 z)) - (f3-2 (-> v1-19 x)) - (f4-0 (-> v1-19 y)) - (f5-0 (-> v1-19 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))) - (vector-copy! a1-8 s1-0) - (set! (-> a1-8 w) 8192.0) - (when (not (check-sphere-blocked! (-> 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-6 sv-832) - (t0-2 (vector-! (new 'stack-no-clear 'vector) v1-30 (the-as vector (-> sv-800 state mesh bounds)))) - ) - (t9-7 a0-18 sv-816 a2-6 a3-3 t0-2) + (let ((sv-816 (nav-mesh-method-45 (-> v1-15 state mesh) a1-7))) + (when sv-816 + (let* ((v1-19 s4-0)) + (set! f0-8 (vector-dot sv-768 v1-19)) + ) + (let ((f28-0 f0-8)) + (new 'stack-no-clear 'vector) + (let ((a1-8 (new 'stack-no-clear 'vector))) + (vector-copy! a1-8 s1-0) + (set! (-> a1-8 w) 8192.0) + (when (not (check-sphere-blocked! (-> 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 (the-as vector (-> 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)) + ) + (vector-copy! arg0 s1-0) ) ) - (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)) - ) - (vector-copy! arg0 s1-0) ) ) ) diff --git a/test/decompiler/reference/jak3/levels/city/traffic/citizen/metalhead-grunt_REF.gc b/test/decompiler/reference/jak3/levels/city/traffic/citizen/metalhead-grunt_REF.gc index f39c6abc72..3e37680c67 100644 --- a/test/decompiler/reference/jak3/levels/city/traffic/citizen/metalhead-grunt_REF.gc +++ b/test/decompiler/reference/jak3/levels/city/traffic/citizen/metalhead-grunt_REF.gc @@ -749,11 +749,7 @@ ) ) (zero? (rnd-int this 3)) - (let ((f0-2 (vector-vector-distance-squared (-> this root trans) (target-pos 0))) - (f1-2 32768.0) - ) - (>= f0-2 (* f1-2 f1-2)) - ) + (>= (vector-vector-distance-squared (-> this root trans) (target-pos 0)) (square 32768.0)) ) (go-die this) ) @@ -1043,23 +1039,18 @@ (s4-0 (new 'stack-no-clear 'vector)) ) (vector-! s4-0 v1-3 (-> this root trans)) - (let* ((f30-0 (vector-length-squared s4-0)) - (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 (vector-length-squared s4-0)) + (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)) ) ) @@ -1087,10 +1078,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-time-frame self (seconds 1) (seconds 1.2)))) ) diff --git a/test/decompiler/reference/jak3/levels/city/traffic/citizen/metalhead-predator_REF.gc b/test/decompiler/reference/jak3/levels/city/traffic/citizen/metalhead-predator_REF.gc index 1f833c45f4..da0fe68e58 100644 --- a/test/decompiler/reference/jak3/levels/city/traffic/citizen/metalhead-predator_REF.gc +++ b/test/decompiler/reference/jak3/levels/city/traffic/citizen/metalhead-predator_REF.gc @@ -721,7 +721,6 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defmethod metalhead-predator-method-225 ((this metalhead-predator) (arg0 int) (arg1 float)) - (local-vars (sv-272 vector) (sv-288 vector)) (rlet ((acc :class vf) (vf0 :class vf) (vf4 :class vf) @@ -756,23 +755,22 @@ (when s3-0 (seek! (-> this miss-amount) (* 0.2 (vector-length (-> s3-0 root transv))) 4096.0) (vector-copy! s2-0 (get-trans s3-0 3)) - (set! sv-272 (new 'stack-no-clear 'vector)) - (let ((v1-28 (-> s5-0 pos)) - (a0-19 s2-0) - ) - (.lvf vf4 (&-> v1-28 quad)) - (.lvf vf5 (&-> a0-19 quad)) - ) - (.mov.vf.w vf6 vf0) - (.sub.vf.xyz vf6 vf4 vf5) - (.svf (&-> sv-272 quad) vf6) - (let* ((f0-5 (vector-length sv-272)) - (f0-6 (/ f0-5 (meters 130))) - ) - (set! sv-288 (new 'stack-no-clear 'vector)) - (let ((s0-0 (new 'stack-no-clear 'vector)) - (s1-1 (new 'stack-no-clear 'vector)) + (let ((sv-272 (new 'stack-no-clear 'vector))) + (let ((v1-28 (-> s5-0 pos)) + (a0-19 s2-0) ) + (.lvf vf4 (&-> v1-28 quad)) + (.lvf vf5 (&-> a0-19 quad)) + ) + (.mov.vf.w vf6 vf0) + (.sub.vf.xyz vf6 vf4 vf5) + (.svf (&-> sv-272 quad) vf6) + (let* ((f0-5 (vector-length sv-272)) + (f0-6 (/ f0-5 (meters 130))) + (sv-288 (new 'stack-no-clear 'vector)) + (s0-0 (new 'stack-no-clear 'vector)) + (s1-1 (new 'stack-no-clear 'vector)) + ) (vector+*! s2-0 s2-0 (-> s3-0 root transv) f0-6) (vector-normalize! sv-272 1.0) (vector-flatten! sv-288 *up-vector* sv-272) @@ -782,11 +780,7 @@ (let ((a2-4 (quaternion-vector-angle! (new 'stack-no-clear 'quaternion) sv-272 (-> this shoot-angle)))) (vector-orient-by-quat! sv-288 sv-288 a2-4) ) - (let* ((t9-9 quaternion-vector-angle!) - (a0-29 (new 'stack-no-clear 'quaternion)) - (a2-5 (-> this shoot-angle)) - (a2-6 (t9-9 a0-29 sv-272 a2-5)) - ) + (let ((a2-6 (quaternion-vector-angle! (new 'stack-no-clear 'quaternion) sv-272 (-> this shoot-angle)))) (vector-orient-by-quat! s0-0 s0-0 a2-6) ) (let ((a0-31 s1-1)) diff --git a/test/decompiler/reference/jak3/levels/city/traffic/traffic-engine_REF.gc b/test/decompiler/reference/jak3/levels/city/traffic/traffic-engine_REF.gc index 0892074668..c2bbf36b9a 100644 --- a/test/decompiler/reference/jak3/levels/city/traffic/traffic-engine_REF.gc +++ b/test/decompiler/reference/jak3/levels/city/traffic/traffic-engine_REF.gc @@ -259,14 +259,14 @@ ;; WARN: Return type mismatch int vs none. ;; WARN: Function (method 21 traffic-tracker) has a return type of none, but the expression builder found a return statement. (defmethod activate-from-params ((this traffic-tracker) (arg0 traffic-object-spawn-params)) - (local-vars (sv-16 handle)) (let ((gp-0 (-> arg0 object-type))) (b! (logtest? (process-mask enemy guard) (-> *kernel-context* prevent-from-run)) cfg-21 :delay (nop!)) (set! (-> arg0 proc) #f) (let ((v1-5 (-> this traffic object-type-info-array gp-0))) (when (and (> (-> v1-5 inactive-count) 0) (> (-> v1-5 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 (when (= gp-0 (traffic-type formation)) (when (not (rigid-body-object-method-30 (the-as vehicle s3-0))) @@ -362,12 +362,12 @@ ;; definition for method 23 of type traffic-tracker ;; WARN: Return type mismatch int vs none. (defmethod activate-by-handle ((this traffic-tracker) (arg0 traffic-object-spawn-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)) @@ -1040,10 +1040,8 @@ 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-6 f0-6) (vector-length-squared v1-19)) + (not (and (logtest? (focus-status pilot) s3-0) (let ((v1-19 (-> s4-0 0 bbox max))) + (< (square 40960.0) (vector-length-squared v1-19)) ) ) ) @@ -1054,10 +1052,8 @@ ) ((logtest? (focus-status dangerous flut 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) - ) - (if (< (* f0-11 f0-11) (vector-length-squared (the-as vector v1-31))) + (let ((v1-31 (-> s4-0 0))) + (if (< (square 20480.0) (vector-length-squared (the-as vector v1-31))) (set! f30-0 20480.0) ) ) @@ -1225,7 +1221,6 @@ ;; WARN: Return type mismatch int vs none. ;; WARN: Function (method 52 traffic-engine) has a return type of none, but the expression builder found a return statement. (defmethod update-traffic-amount ((this traffic-engine)) - (local-vars (sv-48 int) (sv-64 nav-segment)) (if (not (-> this allow-spawning?)) (return 0) ) @@ -1328,22 +1323,24 @@ (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 (and (not (logtest? (-> s4-2 city-info cell-array (-> sv-64 from-cell-id) flags) (ash 1 s3-3))) - (< (-> sv-64 branch density) (the-as uint 128)) - ) - (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 (and (not (logtest? (-> s4-2 city-info cell-array (-> sv-64 from-cell-id) flags) (ash 1 s3-3))) + (< (-> sv-64 branch density) (the-as uint 128)) + ) + (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)) ) ) ) diff --git a/test/decompiler/reference/jak3/levels/city/traffic/vehicle/vehicle-control_REF.gc b/test/decompiler/reference/jak3/levels/city/traffic/vehicle/vehicle-control_REF.gc index 989fd19c48..a9a9523c45 100644 --- a/test/decompiler/reference/jak3/levels/city/traffic/vehicle/vehicle-control_REF.gc +++ b/test/decompiler/reference/jak3/levels/city/traffic/vehicle/vehicle-control_REF.gc @@ -303,13 +303,10 @@ (if (logtest? (-> this flags) (vehicle-controller-flag left-turn)) (vector-float*! (-> s4-0 1) (-> s4-0 1) -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))) (vector-copy! arg1 arg0) (vector+*! arg1 arg1 (-> s4-0 0) f1-9) ) diff --git a/test/decompiler/reference/jak3/levels/city/traffic/vehicle/vehicle-effects_REF.gc b/test/decompiler/reference/jak3/levels/city/traffic/vehicle/vehicle-effects_REF.gc index 492199a7e9..f81405cf34 100644 --- a/test/decompiler/reference/jak3/levels/city/traffic/vehicle/vehicle-effects_REF.gc +++ b/test/decompiler/reference/jak3/levels/city/traffic/vehicle/vehicle-effects_REF.gc @@ -111,7 +111,6 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defmethod vehicle-method-78 ((this vehicle)) - (local-vars (sv-224 sparticle-launcher) (sv-228 sparticle-launcher)) (let ((a1-0 (-> this clock)) (a0-1 (-> this traffic-priority-id)) ) @@ -175,20 +174,16 @@ (set! (-> s5-0 glow color y) (rand-vu-float-range 192.0 255.0)) (set! (-> s5-0 glow color w) (* (-> s5-0 float1) (rand-vu-float-range 16.0 18.0))) (add! *simple-sprite-system* (-> s5-0 glow)) - (let ((f0-22 (-> this camera-dist2)) - (f1-7 245760.0) - ) - (when (< f0-22 (* f1-7 f1-7)) - (let ((f0-23 3276.8)) - (set! (-> s5-0 glow position w) f0-23) - (set! (-> s5-0 glow size-y) f0-23) - ) - (set! (-> s5-0 glow fade-a) -0.00001356) - (set! (-> s5-0 glow fade-b) 2.3332994) - (set! (-> s5-0 glow color z) (rand-vu-float-range 128.0 160.0)) - (set! (-> s5-0 glow color w) (* (-> s5-0 float1) (rand-vu-float-range 32.0 36.0))) - (add! *simple-sprite-system* (-> s5-0 glow)) + (when (< (-> this camera-dist2) (square 245760.0)) + (let ((f0-23 3276.8)) + (set! (-> s5-0 glow position w) f0-23) + (set! (-> s5-0 glow size-y) f0-23) ) + (set! (-> s5-0 glow fade-a) -0.00001356) + (set! (-> s5-0 glow fade-b) 2.3332994) + (set! (-> s5-0 glow color z) (rand-vu-float-range 128.0 160.0)) + (set! (-> s5-0 glow color w) (* (-> s5-0 float1) (rand-vu-float-range 32.0 36.0))) + (add! *simple-sprite-system* (-> s5-0 glow)) ) ) (quad-copy! @@ -217,10 +212,7 @@ (set! (-> *part-id-table* 923 init-specs 2 initial-valuef) (* 6.0 (+ 0.25 (-> this engine-power-factor)) (rand-vu)) ) - (let* ((f0-39 1.0) - (f1-12 (-> this engine-power-factor)) - (f0-40 (- f0-39 (* f1-12 f1-12))) - ) + (let ((f0-40 (- 1.0 (square (-> this engine-power-factor))))) (set! (-> *part-id-table* 923 init-specs 9 initial-valuef) (* 16.0 f0-40)) (set! (-> *part-id-table* 923 init-specs 9 random-rangef) (* 48.0 f0-40)) ) @@ -262,60 +254,65 @@ (set! (-> s5-0 vec3 y) f28-2) (set! (-> s5-0 vec3 z) (* f30-10 f26-0)) ) - (set! sv-224 (the-as sparticle-launcher #f)) - (set! sv-228 (the-as sparticle-launcher #f)) - (cond - ((< (-> this hit-points) 0.25) - (set! sv-224 (-> *part-id-table* 925)) - (set! sv-228 (-> *part-id-table* 921)) - ) - ((< (-> this hit-points) 0.5) - (set! sv-224 (-> *part-id-table* 928)) - ) - (else - (if (< (rand-vu) 0.05) - (set! sv-224 (-> *part-id-table* 930)) - ) - ) - ) - (when sv-224 - (set! (-> s5-0 byte0) 0) - (dotimes (s4-3 2) - (vector-matrix*! (-> s5-0 vec0) (-> this info particles smoke-local-pos s4-3) (-> s5-0 mat0)) - (vector-rotate*! (-> s5-0 vec2) (-> this info particles smoke-local-vel s4-3) (-> s5-0 mat0)) - (vector+! (-> s5-0 vec2) (-> s5-0 vec2) (-> this rbody lin-velocity)) - (vector+float*! (-> s5-0 vec2) (-> s5-0 vec2) (-> s5-0 vec3) (* 24576.0 (rand-vu))) - (let ((v1-155 (-> this info particle-common part-vel)) - (a0-50 (-> s5-0 vec2)) - (f0-63 300.0) - ) - (vector-float*! v1-155 a0-50 (/ 1.0 f0-63)) + (let ((sv-224 (the-as sparticle-launcher #f)) + (sv-228 (the-as sparticle-launcher #f)) ) - (when (and sv-228 (< (rand-vu) 0.005)) - (let ((t9-35 sp-launch-particles-var) - (a0-51 (-> this info particle-common sp-system2d)) - (a1-43 sv-228) - (a2-12 *launch-matrix*) + (set! sv-224 (cond + ((< (-> this hit-points) 0.25) + (set! sv-224 (-> *part-id-table* 925)) + (set! sv-228 (-> *part-id-table* 921)) + sv-224 + ) + ((< (-> this hit-points) 0.5) + (-> *part-id-table* 928) + ) + (else + (if (< (rand-vu) 0.05) + (set! sv-224 (-> *part-id-table* 930)) + ) + sv-224 + ) + ) + ) + (when sv-224 + (set! (-> s5-0 byte0) 0) + (dotimes (s4-3 2) + (vector-matrix*! (-> s5-0 vec0) (-> this info particles smoke-local-pos s4-3) (-> s5-0 mat0)) + (vector-rotate*! (-> s5-0 vec2) (-> this info particles smoke-local-vel s4-3) (-> s5-0 mat0)) + (vector+! (-> s5-0 vec2) (-> s5-0 vec2) (-> this rbody lin-velocity)) + (vector+float*! (-> s5-0 vec2) (-> s5-0 vec2) (-> s5-0 vec3) (* 24576.0 (rand-vu))) + (let ((v1-155 (-> this info particle-common part-vel)) + (a0-50 (-> s5-0 vec2)) + (f0-63 300.0) ) - (vector-copy! (-> a2-12 trans) (-> s5-0 vec0)) - (t9-35 a0-51 a1-43 a2-12 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0) + (vector-float*! v1-155 a0-50 (/ 1.0 f0-63)) ) - (+! (-> s5-0 byte0) 1) - ) - (set! (-> sv-224 birthaccum) (the-as float (-> this smoke-part-accum s4-3))) - (let ((t9-36 sp-launch-particles-var) - (a0-52 (-> this info particle-common sp-system2d)) - (a1-44 sv-224) - (a2-13 *launch-matrix*) + (when (and sv-228 (< (rand-vu) 0.005)) + (let ((t9-35 sp-launch-particles-var) + (a0-51 (-> this info particle-common sp-system2d)) + (a1-43 sv-228) + (a2-12 *launch-matrix*) + ) + (vector-copy! (-> a2-12 trans) (-> s5-0 vec0)) + (t9-35 a0-51 a1-43 a2-12 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0) ) - (vector-copy! (-> a2-13 trans) (-> s5-0 vec0)) - (t9-36 a0-52 a1-44 a2-13 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0) + (+! (-> s5-0 byte0) 1) + ) + (set! (-> sv-224 birthaccum) (the-as float (-> this smoke-part-accum s4-3))) + (let ((t9-36 sp-launch-particles-var) + (a0-52 (-> this info particle-common sp-system2d)) + (a1-44 sv-224) + (a2-13 *launch-matrix*) + ) + (vector-copy! (-> a2-13 trans) (-> s5-0 vec0)) + (t9-36 a0-52 a1-44 a2-13 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0) + ) + (set! (-> this smoke-part-accum s4-3) (the-as sparticle-launch-control (-> sv-224 birthaccum))) ) - (set! (-> this smoke-part-accum s4-3) (the-as sparticle-launch-control (-> sv-224 birthaccum))) + (if (> (-> s5-0 byte0) 0) + (sound-play "damage-zaps" :id (-> this damage-zap-sound-id)) + ) ) - (if (> (-> s5-0 byte0) 0) - (sound-play "damage-zaps" :id (-> this damage-zap-sound-id)) - ) ) ) (when (>= (-> this scrape-sound-envelope) 0.75) diff --git a/test/decompiler/reference/jak3/levels/city/traffic/vehicle/vehicle-physics_REF.gc b/test/decompiler/reference/jak3/levels/city/traffic/vehicle/vehicle-physics_REF.gc index 8145a8c80e..ad571bf220 100644 --- a/test/decompiler/reference/jak3/levels/city/traffic/vehicle/vehicle-physics_REF.gc +++ b/test/decompiler/reference/jak3/levels/city/traffic/vehicle/vehicle-physics_REF.gc @@ -18,11 +18,14 @@ ) (set! (-> s5-0 rvec y) (* 0.5 (+ f0-1 f1-3))) (rigid-body-control-method-23 (-> this rbody) (-> s5-0 rvec) (-> s5-0 fvec)) - (let* ((f0-8 - (* 0.025132721 (vector-length (-> s5-0 fvec)) (-> s3-0 handling water-drag-factor) (-> s3-0 info mass) f30-0) - ) - (f1-7 (-> arg0 w)) - (f0-9 (* f0-8 (* f1-7 f1-7))) + (let* ((f0-9 (* 0.025132721 + (vector-length (-> s5-0 fvec)) + (-> s3-0 handling water-drag-factor) + (-> s3-0 info mass) + f30-0 + (square (-> arg0 w)) + ) + ) (f1-10 68719480000.0) (f0-11 (fmin (* f0-9 (/ 1.0 f1-10)) (* 0.125 (/ 1.0 arg1) (-> s3-0 info mass)))) ) diff --git a/test/decompiler/reference/jak3/levels/city/traffic/vehicle/vehicle-states_REF.gc b/test/decompiler/reference/jak3/levels/city/traffic/vehicle/vehicle-states_REF.gc index 193287a3e5..26394a154d 100644 --- a/test/decompiler/reference/jak3/levels/city/traffic/vehicle/vehicle-states_REF.gc +++ b/test/decompiler/reference/jak3/levels/city/traffic/vehicle/vehicle-states_REF.gc @@ -260,35 +260,28 @@ (let ((v1-7 (new 'stack-no-clear 'array 'uint32 1))) (set! (-> v1-7 0) (the-as uint (current-time))) (if (or (>= (- (-> v1-7 0) (-> self offscreen-time)) (the-as uint 1500)) - (let ((f0-2 409600.0)) - (< (* f0-2 f0-2) (-> self camera-dist2)) - ) + (< (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 flags) (rigid-body-flag enable-physics)) (vehicle-method-117 self) (when (and (logtest? (-> self v-flags) (vehicle-flag disturbed)) (logtest? (-> self v-flags) (vehicle-flag impact))) - (let* ((f0-9 (* 0.0033333334 (the float (- (current-time) (-> self disturbed-time))))) - (f0-12 (* f0-9 f0-9 (-> self camera-dist2))) - (f1-5 0.000016276043) - (f0-13 (* f0-12 (* f1-5 f1-5))) - ) - (if (and (< (vector-length-squared (-> self rbody ang-velocity)) f0-13) - (let ((f1-9 (vector-length-squared (-> self rbody lin-velocity))) - (f2-0 614.4) - ) - (< f1-9 (* f0-13 (* f2-0 f2-0))) + (let ((f0-13 (* (square (* 0.0033333334 (the float (- (current-time) (-> self disturbed-time))))) + (-> self camera-dist2) + (square 0.000016276043) + ) ) + ) + (if (and (< (vector-length-squared (-> self rbody ang-velocity)) f0-13) + (< (vector-length-squared (-> self rbody lin-velocity)) (* f0-13 (square 614.4))) ) (logclear! (-> self v-flags) (vehicle-flag disturbed)) ) diff --git a/test/decompiler/reference/jak3/levels/city/traffic/vehicle/vehicle-util_REF.gc b/test/decompiler/reference/jak3/levels/city/traffic/vehicle/vehicle-util_REF.gc index 10e3185721..84766d2d06 100644 --- a/test/decompiler/reference/jak3/levels/city/traffic/vehicle/vehicle-util_REF.gc +++ b/test/decompiler/reference/jak3/levels/city/traffic/vehicle/vehicle-util_REF.gc @@ -238,146 +238,134 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defmethod vehicle-method-129 ((this vehicle)) - (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-type0))) - (set! (-> s5-0 floats 4) (+ 8192.0 (-> this root root-prim local-sphere w))) - (if (logtest? (vehicle-flag ai-driving) (-> this v-flags)) - (set! (-> s5-0 floats 4) (* 1.5 (-> s5-0 floats 4))) - ) - (vector-copy! (-> s5-0 mat 0 uvec) (target-pos 0)) - (+! (-> s5-0 mat 0 uvec y) 8192.0) - (matrix-copy! (-> s5-0 mat 1) (-> this node-list data 0 bone transform)) - (vector-copy! (-> s5-0 mat 0 fvec) (-> s5-0 mat 1 trans)) - (set! (-> s5-0 floats 2) (- (-> s5-0 mat 0 uvec y) (-> s5-0 mat 0 fvec y))) - (let ((f0-9 (vector-vector-xz-distance-squared (-> s5-0 mat 0 uvec) (-> s5-0 mat 0 fvec))) - (f1-7 (-> s5-0 floats 4)) + (when (< (-> this player-dist2) (square 102400.0)) + (let ((s5-0 (new 'stack-no-clear 'mystery-vehicle-type0))) + (set! (-> s5-0 floats 4) (+ 8192.0 (-> this root root-prim local-sphere w))) + (if (logtest? (vehicle-flag ai-driving) (-> this v-flags)) + (set! (-> s5-0 floats 4) (* 1.5 (-> s5-0 floats 4))) + ) + (vector-copy! (-> s5-0 mat 0 uvec) (target-pos 0)) + (+! (-> s5-0 mat 0 uvec y) 8192.0) + (matrix-copy! (-> s5-0 mat 1) (-> this node-list data 0 bone transform)) + (vector-copy! (-> s5-0 mat 0 fvec) (-> s5-0 mat 1 trans)) + (set! (-> s5-0 floats 2) (- (-> s5-0 mat 0 uvec y) (-> s5-0 mat 0 fvec y))) + (when (and (< (vector-vector-xz-distance-squared (-> s5-0 mat 0 uvec) (-> s5-0 mat 0 fvec)) (square (-> s5-0 floats 4))) + (< -81920.0 (-> s5-0 floats 2)) + (and (< (-> s5-0 floats 2) 20480.0) *target* (check-player-get-on this *target*)) + ) + (let ((s2-0 #f) + (s4-1 #f) + (s3-0 #f) ) - (when (and (< f0-9 (* f1-7 f1-7)) - (< -81920.0 (-> s5-0 floats 2)) - (and (< (-> s5-0 floats 2) 20480.0) *target* (check-player-get-on this *target*)) - ) - (let ((s2-0 #f) - (s4-1 #f) - (s3-0 #f) - ) - (let ((a2-2 (get-best-seat this (-> s5-0 mat 0 uvec) (vehicle-seat-flag vsf0) 0))) - (when (!= a2-2 -1) - (vehicle-method-66 this (-> s5-0 mat 0 fvec) a2-2) - (vector+float*! (-> s5-0 mat 0 fvec) (-> s5-0 mat 0 fvec) (-> s5-0 mat 1 uvec) 4096.0) - ) - ) - (set! (-> s5-0 floats 1) (vector-vector-distance-squared (-> s5-0 mat 0 fvec) (-> s5-0 mat 0 uvec))) - (let ((f0-14 (-> s5-0 floats 1)) - (f1-12 81920.0) + (let ((a2-2 (get-best-seat this (-> s5-0 mat 0 uvec) (vehicle-seat-flag vsf0) 0))) + (when (!= a2-2 -1) + (vehicle-method-66 this (-> s5-0 mat 0 fvec) a2-2) + (vector+float*! (-> s5-0 mat 0 fvec) (-> s5-0 mat 0 fvec) (-> s5-0 mat 1 uvec) 4096.0) + ) + ) + (set! (-> s5-0 floats 1) (vector-vector-distance-squared (-> s5-0 mat 0 fvec) (-> s5-0 mat 0 uvec))) + (when (< (-> s5-0 floats 1) (square 81920.0)) + (vector-copy! (-> s5-0 cquery start-pos) (-> s5-0 mat 0 uvec)) + (vector-! (-> s5-0 cquery move-dist) (-> s5-0 mat 0 fvec) (-> s5-0 mat 0 uvec)) + (let ((v1-38 (-> s5-0 cquery))) + (set! (-> v1-38 radius) 4096.0) + (set! (-> v1-38 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 + shield + ) ) - (when (< f0-14 (* f1-12 f1-12)) - (vector-copy! (-> s5-0 cquery start-pos) (-> s5-0 mat 0 uvec)) - (vector-! (-> s5-0 cquery move-dist) (-> s5-0 mat 0 fvec) (-> s5-0 mat 0 uvec)) - (let ((v1-38 (-> s5-0 cquery))) - (set! (-> v1-38 radius) 4096.0) - (set! (-> v1-38 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 - shield - ) - ) - (set! (-> v1-38 ignore-process0) this) - (set! (-> v1-38 ignore-process1) #f) - (set! (-> v1-38 ignore-pat) - (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) - ) - (set! (-> v1-38 action-mask) (collide-action solid)) + (set! (-> v1-38 ignore-process0) this) + (set! (-> v1-38 ignore-process1) #f) + (set! (-> v1-38 ignore-pat) + (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) ) - (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 v-flags) (vehicle-flag player-edge-grabbing))) - (not (logtest? (vehicle-flag no-hijack gun-dark-2-zero-g) (-> this v-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 mat 2) (-> s5-0 mat 1)) - (vector-matrix*! (-> s5-0 mat 0 rvec) (-> s5-0 mat 0 uvec) (-> s5-0 mat 2)) - (set! (-> s5-0 floats 0) 81920.0) - (dotimes (s2-1 (-> this info rider grab-rail-count)) - (let ((s1-0 (-> this info rider grab-rail-array s2-1))) - (vector-! (-> s5-0 mat 0 trans) (-> s5-0 mat 0 rvec) (-> s1-0 local-pos 0)) - (when #t - (let ((f30-0 (vector-segment-distance-point! - (-> s5-0 mat 0 rvec) - (-> s1-0 local-pos 0) - (-> s1-0 local-pos 1) - (-> s5-0 mat 0 trans) - ) - ) - ) - (when (< f30-0 (-> s5-0 floats 0)) - (set! (-> s5-0 floats 0) f30-0) - (set! (-> s5-0 vec 0 quad) (-> s5-0 mat 0 trans quad)) - (vector-! (-> s5-0 vec 1) (-> s1-0 local-pos 1) (-> s1-0 local-pos 0)) - (vector-normalize! (-> s5-0 vec 1) 1.0) - (set! s3-0 #t) - (set! (-> s5-0 floats 3) (* (-> this hit-points) (/ 40960.0 f30-0))) - ) + (set! (-> v1-38 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 v-flags) (vehicle-flag player-edge-grabbing))) + (not (logtest? (vehicle-flag no-hijack gun-dark-2-zero-g) (-> this v-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 mat 2) (-> s5-0 mat 1)) + (vector-matrix*! (-> s5-0 mat 0 rvec) (-> s5-0 mat 0 uvec) (-> s5-0 mat 2)) + (set! (-> s5-0 floats 0) 81920.0) + (dotimes (s2-1 (-> this info rider grab-rail-count)) + (let ((s1-0 (-> this info rider grab-rail-array s2-1))) + (vector-! (-> s5-0 mat 0 trans) (-> s5-0 mat 0 rvec) (-> s1-0 local-pos 0)) + (when #t + (let ((f30-0 (vector-segment-distance-point! + (-> s5-0 mat 0 rvec) + (-> s1-0 local-pos 0) + (-> s1-0 local-pos 1) + (-> s5-0 mat 0 trans) + ) + ) ) + (when (< f30-0 (-> s5-0 floats 0)) + (set! (-> s5-0 floats 0) f30-0) + (set! (-> s5-0 vec 0 quad) (-> s5-0 mat 0 trans quad)) + (vector-! (-> s5-0 vec 1) (-> s1-0 local-pos 1) (-> s1-0 local-pos 0)) + (vector-normalize! (-> s5-0 vec 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 "vehicle" (/ 1.0 (-> s5-0 floats 3))) - ) - ) - (cond - ((vehicle-method-128 this) - (vehicle-method-144 this) - (when (cpad-pressed? 0 triangle) - (cond - (s4-1 - (when (send-event *target* 'change-mode 'pilot this 0 #f) - (logior! (-> this v-flags) (vehicle-flag player-driving)) - (logclear! (-> this v-flags) (vehicle-flag ai-driving)) - (vehicle-method-80 this) - ) - ) - (else - (set! (-> s5-0 proc 0) (process->handle this)) - (mem-copy! (the-as pointer *pilot-edge-grab-info*) (the-as pointer (-> s5-0 vec)) 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)~%") - ) - ) + 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 "vehicle" (/ 1.0 (-> s5-0 floats 3))) + ) + ) + (cond + ((vehicle-method-128 this) + (vehicle-method-144 this) + (when (cpad-pressed? 0 triangle) + (cond + (s4-1 + (when (send-event *target* 'change-mode 'pilot this 0 #f) + (logior! (-> this v-flags) (vehicle-flag player-driving)) + (logclear! (-> this v-flags) (vehicle-flag ai-driving)) + (vehicle-method-80 this) ) ) + (else + (set! (-> s5-0 proc 0) (process->handle this)) + (mem-copy! (the-as pointer *pilot-edge-grab-info*) (the-as pointer (-> s5-0 vec)) 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)~%") + ) + ) ) - (else - (vehicle-method-145 this) - ) - ) + ) + ) + (else + (vehicle-method-145 this) ) ) ) @@ -1291,16 +1279,9 @@ ;; WARN: Return type mismatch int vs none. (defmethod vehicle-method-103 ((this vehicle)) (when (time-elapsed? (-> this disturbed-time) (seconds 2)) - (let* ((f0-0 (-> this camera-dist2)) - (f1-0 0.000024414063) - (f0-1 (* f0-0 (* f1-0 f1-0))) - ) + (let ((f0-1 (* (-> this camera-dist2) (square 0.000024414063)))) (when (and (< (vector-length-squared (-> this rbody ang-velocity)) f0-1) - (let ((f1-4 (vector-length-squared (-> this rbody lin-velocity))) - (f2-0 614.4) - ) - (< f1-4 (* f0-1 (* f2-0 f2-0))) - ) + (< (vector-length-squared (-> this rbody lin-velocity)) (* f0-1 (square 614.4))) ) (logclear! (-> this v-flags) (vehicle-flag disturbed)) (vehicle-method-142 this) diff --git a/test/decompiler/reference/jak3/levels/city/traffic/vehicle/vehicle_REF.gc b/test/decompiler/reference/jak3/levels/city/traffic/vehicle/vehicle_REF.gc index 10d87a1fce..dc53517be9 100644 --- a/test/decompiler/reference/jak3/levels/city/traffic/vehicle/vehicle_REF.gc +++ b/test/decompiler/reference/jak3/levels/city/traffic/vehicle/vehicle_REF.gc @@ -156,10 +156,8 @@ (-> arg0 normal) (- (vector-dot (-> arg0 velocity) (-> arg0 normal))) ) - (let ((f0-30 (vector-length-squared a0-39)) - (f1-18 12288.0) - ) - (when (< (* f1-18 f1-18) f0-30) + (let ((f0-30 (vector-length-squared a0-39))) + (when (< (square 12288.0) f0-30) (set! (-> this scrape-sound-envelope) 1.0) (if (logtest? (vehicle-flag player-driving) (-> this v-flags)) (cpad-set-buzz! (-> *cpad-list* cpads 0) 0 255 (seconds 0.05)) @@ -285,9 +283,7 @@ ) (let ((f1-6 0.0)) (when (logtest? (vehicle-flag ignition) (-> this v-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 v-flags) (vehicle-flag riding))) (set! f1-6 (/ f1-6 2)) ) @@ -816,27 +812,18 @@ :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-109 this) - ) - ) + (b! (>= (square 819200.0) f0-3) cfg-8) + (if (< (square 819200.0) f0-3) + (vehicle-method-109 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-109 this) ) ) diff --git a/test/decompiler/reference/jak3/levels/city/vinroom/power-game_REF.gc b/test/decompiler/reference/jak3/levels/city/vinroom/power-game_REF.gc index 9ec6a3ba47..4519b98844 100644 --- a/test/decompiler/reference/jak3/levels/city/vinroom/power-game_REF.gc +++ b/test/decompiler/reference/jak3/levels/city/vinroom/power-game_REF.gc @@ -1702,7 +1702,6 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defmethod power-game-method-44 ((this power-game) (arg0 float) (arg1 float) (arg2 int) (arg3 int)) - (local-vars (sv-128 int) (sv-144 vector)) (the int arg0) (the int arg1) (let ((s3-0 (new 'stack-no-clear 'vector))) @@ -1729,18 +1728,14 @@ (vector+! s3-0 s3-0 (power-game-method-38 this (new 'stack-no-clear 'vector) arg2)) ) ) - (let ((s1-3 add-debug-line) - (s0-6 #t) - ) - (set! sv-128 577) - (set! sv-144 (get-center-pos! this (new 'stack-no-clear 'vector) (-> s2-0 x) (-> s2-0 z))) - (let ((a3-6 (get-center-pos! this (new 'stack-no-clear 'vector) (-> s3-0 x) (-> s3-0 z))) - (t0-1 (the-as uint #x800000ff)) - (t1-0 #f) - (t2-0 -1) - ) - (s1-3 s0-6 (the-as bucket-id sv-128) sv-144 a3-6 (the-as rgba t0-1) t1-0 (the-as rgba t2-0)) - ) + (add-debug-line + #t + (bucket-id debug-no-zbuf1) + (get-center-pos! this (new 'stack-no-clear 'vector) (-> s2-0 x) (-> s2-0 z)) + (get-center-pos! this (new 'stack-no-clear 'vector) (-> s3-0 x) (-> s3-0 z)) + (new 'static 'rgba :r #xff :a #x80) + #f + (the-as rgba -1) ) (vector-copy! s2-0 s3-0) (+! arg3 -1) @@ -1767,15 +1762,14 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defmethod update-cam ((this power-game)) - (local-vars (sv-48 vector) (sv-52 vector) (sv-56 power-game-cam-info)) (let ((s4-0 (the-as power-game-player (handle->process (-> this player))))) (when s4-0 - (let ((s5-0 (get-trans s4-0 9)) - (s4-1 (the int (-> (get-trans s4-0 2) x))) - ) - (set! sv-48 (vector-! (new 'stack-no-clear 'vector) s5-0 (new 'static 'vector :x 8.0 :z 7.0 :w 1.0))) - (set! sv-52 (get-center-pos! this (new 'stack-no-clear 'vector) (-> s5-0 x) (-> s5-0 z))) - (set! sv-56 (-> this cam-targ)) + (let* ((s5-0 (get-trans s4-0 9)) + (s4-1 (the int (-> (get-trans s4-0 2) x))) + (sv-48 (vector-! (new 'stack-no-clear 'vector) s5-0 (new 'static 'vector :x 8.0 :z 7.0 :w 1.0))) + (sv-52 (get-center-pos! this (new 'stack-no-clear 'vector) (-> s5-0 x) (-> s5-0 z))) + (sv-56 (-> this cam-targ)) + ) (* 16384.0 (the float (logand (- 6 (power-game-method-34 this (-> s5-0 x) (-> s5-0 z))) 3))) (let ((f30-1 (if (cpad-hold? 0 x) 131072.0 diff --git a/test/decompiler/reference/jak3/levels/city/vinroom/vinroom-part_REF.gc b/test/decompiler/reference/jak3/levels/city/vinroom/vinroom-part_REF.gc index 026165037b..e0ba226792 100644 --- a/test/decompiler/reference/jak3/levels/city/vinroom/vinroom-part_REF.gc +++ b/test/decompiler/reference/jak3/levels/city/vinroom/vinroom-part_REF.gc @@ -2165,7 +2165,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)))) ) ) ) @@ -2729,7 +2729,3 @@ (:rotate-y (degrees 0)) ) ) - - - - diff --git a/test/decompiler/reference/jak3/levels/comb/comb-field_REF.gc b/test/decompiler/reference/jak3/levels/comb/comb-field_REF.gc index 03d3d3085a..fb89772adc 100644 --- a/test/decompiler/reference/jak3/levels/comb/comb-field_REF.gc +++ b/test/decompiler/reference/jak3/levels/comb/comb-field_REF.gc @@ -74,21 +74,17 @@ (defmethod play-hum ((this comb-field)) (let ((v1-0 *target*)) (when v1-0 - (let ((f0-0 (vector-vector-distance-squared (-> this root trans) (-> v1-0 control trans))) - (f1-0 655360.0) - ) - (cond - ((< f0-0 (* f1-0 f1-0)) - (if (zero? (-> this hum-sound-id)) - (set! (-> this hum-sound-id) (new-sound-id)) - ) - (sound-play "barrier-loop" :id (-> this hum-sound-id)) - ) - (else - (sound-stop (-> this hum-sound-id)) - (set! (-> this hum-sound-id) (new 'static 'sound-id)) - 0 - ) + (cond + ((< (vector-vector-distance-squared (-> this root trans) (-> v1-0 control trans)) (square 655360.0)) + (if (zero? (-> this hum-sound-id)) + (set! (-> this hum-sound-id) (new-sound-id)) + ) + (sound-play "barrier-loop" :id (-> this hum-sound-id)) + ) + (else + (sound-stop (-> this hum-sound-id)) + (set! (-> this hum-sound-id) (new 'static 'sound-id)) + 0 ) ) ) @@ -278,16 +274,12 @@ (matrix->quaternion (-> s1-0 quat) s2-2) (set! (-> this plane quad) (-> s2-2 fvec quad)) (set! (-> this plane w) (- (vector-dot (-> s2-2 fvec) (-> this root trans)))) - (let ((v0-8 (-> this root root-prim local-sphere))) - (set! (-> v0-8 x) 0.0) - (set! (-> v0-8 y) (* 0.00024414062 (/ arg1 2))) - (set! (-> v0-8 z) 0.0) - (let ((f0-18 0.5) - (f1-5 (* f30-1 f30-1)) - (f2-1 arg1) - ) - (set! (-> v0-8 w) (* f0-18 (sqrtf (+ f1-5 (* f2-1 f2-1))))) - ) + (set-vector! + (-> this root root-prim local-sphere) + 0.0 + (* 0.00024414062 (/ arg1 2)) + 0.0 + (* 0.5 (sqrtf (+ (square f30-1) (square arg1)))) ) ) ) diff --git a/test/decompiler/reference/jak3/levels/comb/comb-sentry_REF.gc b/test/decompiler/reference/jak3/levels/comb/comb-sentry_REF.gc index 0e591f56e9..493f25f0cf 100644 --- a/test/decompiler/reference/jak3/levels/comb/comb-sentry_REF.gc +++ b/test/decompiler/reference/jak3/levels/comb/comb-sentry_REF.gc @@ -480,11 +480,7 @@ (when s5-0 (if (and (not (focus-test? s5-0 dead)) (not (focus-test? s5-0 ignore)) - (let ((f0-0 (vector-vector-distance-squared (-> s5-0 root trans) (-> this root trans))) - (f1-0 409600.0) - ) - (< f0-0 (* f1-0 f1-0)) - ) + (< (vector-vector-distance-squared (-> s5-0 root trans) (-> this root trans)) (square 409600.0)) ) (set! (-> this should-attack) #t) ) @@ -495,10 +491,8 @@ (vector-copy! (-> v1-23 fvec) (-> s5-0 node-list data 0 bone transform fvec)) (vector-! (-> v1-23 trans) (-> this root trans) (-> v1-23 rvec)) (set! (-> this target-dist) (vector-dot (-> v1-23 fvec) (-> v1-23 trans))) - (let ((v1-24 (-> v1-23 trans)) - (f0-4 409600.0) - ) - (if (< (* f0-4 f0-4) (vector-length-squared v1-24)) + (let ((v1-24 (-> v1-23 trans))) + (if (< (square 409600.0) (vector-length-squared v1-24)) (set! (-> this target-dist) 4096000.0) ) ) diff --git a/test/decompiler/reference/jak3/levels/comb/h-sled_REF.gc b/test/decompiler/reference/jak3/levels/comb/h-sled_REF.gc index 547ce05867..68081bae96 100644 --- a/test/decompiler/reference/jak3/levels/comb/h-sled_REF.gc +++ b/test/decompiler/reference/jak3/levels/comb/h-sled_REF.gc @@ -1438,7 +1438,7 @@ (let ((v1-9 (-> v1-3 ang-velocity)) (f1-2 4.0) ) - (< (vector-length-squared v1-9) (* f1-2 f1-2)) + (< (vector-length-squared v1-9) (square f1-2)) ) ) (set! (-> this v-flags) (the-as vehicle-flag (logior (vehicle-flag overturned) (-> this v-flags)))) diff --git a/test/decompiler/reference/jak3/levels/common/ai/ashelin/ash-shot_REF.gc b/test/decompiler/reference/jak3/levels/common/ai/ashelin/ash-shot_REF.gc index 83f1175ba6..5ce4464adf 100644 --- a/test/decompiler/reference/jak3/levels/common/ai/ashelin/ash-shot_REF.gc +++ b/test/decompiler/reference/jak3/levels/common/ai/ashelin/ash-shot_REF.gc @@ -301,7 +301,7 @@ (launch-particles (-> *part-id-table* 901) gp-1) (let ((f0-4 (vector-dot s5-1 (-> (camera-matrix) fvec)))) (when (< 0.0 f0-4) - (let ((f0-5 (* f0-4 f0-4)) + (let ((f0-5 (square f0-4)) (f30-1 (-> *part-id-table* 902 init-specs 8 initial-valuef)) (f28-0 (-> *part-id-table* 902 init-specs 8 random-rangef)) ) diff --git a/test/decompiler/reference/jak3/levels/common/ai/ashelin/ash_REF.gc b/test/decompiler/reference/jak3/levels/common/ai/ashelin/ash_REF.gc index 31b04e0deb..03c2415949 100644 --- a/test/decompiler/reference/jak3/levels/common/ai/ashelin/ash_REF.gc +++ b/test/decompiler/reference/jak3/levels/common/ai/ashelin/ash_REF.gc @@ -1290,7 +1290,6 @@ ;; definition for method 248 of type ashelin ;; INFO: Used lq/sq (defmethod ashelin-method-248 ((this ashelin) (arg0 vector) (arg1 float) (arg2 float) (arg3 float) (arg4 float)) - (local-vars (sv-272 vector)) (let* ((v1-0 (-> this nav)) (a0-3 (-> v1-0 state mesh sphere-hash sphere-array)) (a1-1 (-> v1-0 sphere-id-array)) @@ -1310,11 +1309,12 @@ 0 (let ((s0-0 (new 'stack-no-clear 'nav-avoid-spheres-params))) (vector-! (-> s0-0 current-pos) (-> this root trans) (the-as vector (-> 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) (vector-copy! (-> s0-0 pref-dir) (-> s0-0 travel)) (avoid-spheres-1! (-> this nav) s0-0) @@ -1325,11 +1325,7 @@ (let ((t0-2 (new 'stack-no-clear 'clamp-travel-vector-to-mesh-return-info))) (clamp-vector-to-mesh-no-gaps (-> this nav) (-> this root trans) (-> this nav state current-poly) arg0 t0-2) ) - (let ((f0-11 (vector-length-squared arg0)) - (f1-1 arg4) - ) - (>= f0-11 (* f1-1 f1-1)) - ) + (>= (vector-length-squared arg0) (square arg4)) ) ) diff --git a/test/decompiler/reference/jak3/levels/common/ai/bot-h_REF.gc b/test/decompiler/reference/jak3/levels/common/ai/bot-h_REF.gc index 7cebba0b57..6bef7604ad 100644 --- a/test/decompiler/reference/jak3/levels/common/ai/bot-h_REF.gc +++ b/test/decompiler/reference/jak3/levels/common/ai/bot-h_REF.gc @@ -808,50 +808,50 @@ ;; WARN: Stack slot offset 16 signed mismatch ;; WARN: new jak 2 until loop case, check carefully (defmethod get-next-speech-idx ((this bot-speech-list-shuffle) (arg0 bot) (arg1 (inline-array bot-speech-info)) (arg2 bot-speech-info-flag)) - (local-vars (sv-16 int)) (let ((v1-1 (-> arg0 course retry-cookie))) (when (!= v1-1 (-> this retry-cookie)) (set! (-> this retry-cookie) (-> arg0 course retry-cookie)) (reset-index this #t) ) ) - (set! sv-16 (-> this last-local-index)) - (when (< sv-16 0) - (when (not (logtest? (-> this flags) (bot-speech-list-flag bsl0))) - (logior! (-> this flags) (bot-speech-list-flag bsl0)) - (set! arg2 (logior arg2 (bot-speech-info-flag sf02))) + (let ((sv-16 (-> this last-local-index))) + (when (< sv-16 0) + (when (not (logtest? (-> this flags) (bot-speech-list-flag bsl0))) + (logior! (-> this flags) (bot-speech-list-flag bsl0)) + (set! arg2 (logior arg2 (bot-speech-info-flag sf02))) + ) + (reset-index this #f) ) - (reset-index this #f) - ) - (let ((s2-0 0)) - (if (>= sv-16 0) - (set! s2-0 (ash 1 sv-16)) - ) - (if (logtest? (-> this flags) (bot-speech-list-flag bsl3)) - (set! s2-0 (logior s2-0 (-> this history-mask))) - ) - (until #f - (when (and (= s2-0 (-> this history-mask-full)) (logtest? (-> this flags) (bot-speech-list-flag bsl3))) - (if (not (logtest? (-> this flags) (bot-speech-list-flag bsl1))) - (return -1) + (let ((s2-0 0)) + (if (>= sv-16 0) + (set! s2-0 (ash 1 sv-16)) + ) + (if (logtest? (-> this flags) (bot-speech-list-flag bsl3)) + (set! s2-0 (logior s2-0 (-> this history-mask))) + ) + (until #f + (when (and (= s2-0 (-> this history-mask-full)) (logtest? (-> this flags) (bot-speech-list-flag bsl3))) + (if (not (logtest? (-> this flags) (bot-speech-list-flag bsl1))) + (return -1) + ) + (reset-index this #f) + (if (>= sv-16 0) + (set! s2-0 (ash 1 sv-16)) + (set! s2-0 0) + ) + ) + (let* ((s1-0 (rnd-int-excluding-masked arg0 (-> this speech-indexes length) s2-0)) + (s0-0 (-> this speech-indexes s1-0)) + (v1-47 (-> arg1 s0-0 flags)) + ) + (set! s2-0 (logior s2-0 (ash 1 s1-0))) + (when (and (not (logtest? arg2 v1-47)) + (or (not (logtest? v1-47 (bot-speech-info-flag sf11))) (not (course-speech-playing? arg0 s0-0))) + ) + (set! (-> this last-local-index) s1-0) + (logior! (-> this history-mask) (ash 1 s1-0)) + (return s0-0) ) - (reset-index this #f) - (if (>= sv-16 0) - (set! s2-0 (ash 1 sv-16)) - (set! s2-0 0) - ) - ) - (let* ((s1-0 (rnd-int-excluding-masked arg0 (-> this speech-indexes length) s2-0)) - (s0-0 (-> this speech-indexes s1-0)) - (v1-47 (-> arg1 s0-0 flags)) - ) - (set! s2-0 (logior s2-0 (ash 1 s1-0))) - (when (and (not (logtest? arg2 v1-47)) - (or (not (logtest? v1-47 (bot-speech-info-flag sf11))) (not (course-speech-playing? arg0 s0-0))) - ) - (set! (-> this last-local-index) s1-0) - (logior! (-> this history-mask) (ash 1 s1-0)) - (return s0-0) ) ) ) diff --git a/test/decompiler/reference/jak3/levels/common/ai/bot_REF.gc b/test/decompiler/reference/jak3/levels/common/ai/bot_REF.gc index f102553426..55455d8c1f 100644 --- a/test/decompiler/reference/jak3/levels/common/ai/bot_REF.gc +++ b/test/decompiler/reference/jak3/levels/common/ai/bot_REF.gc @@ -81,7 +81,7 @@ ;; definition for method 231 of type bot (defmethod player-blocking-spot? ((this bot) (arg0 bot-spot)) (let ((f0-0 (-> arg0 blocked-xz-dist))) - (and (!= f0-0 0.0) (>= (* f0-0 f0-0) (vector-vector-xz-distance-squared (target-pos 0) (-> arg0 center)))) + (and (!= f0-0 0.0) (>= (square f0-0) (vector-vector-xz-distance-squared (target-pos 0) (-> arg0 center)))) ) ) @@ -205,14 +205,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)) ) ) ) @@ -246,14 +242,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)) ) ) ) @@ -584,14 +576,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 (+ (-> a1-2 world-sphere w) (-> s3-0 w))) - ) - (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 (+ (-> a1-2 world-sphere w) (-> s3-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)) ) ) ) @@ -625,14 +613,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) (-> s3-0 w))) - ) - (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) (-> s3-0 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)) ) ) ) @@ -1587,9 +1571,8 @@ (when *target* (let ((a1-0 (-> *target* control trans)) (v1-4 (-> this root)) - (f0-0 14336.0) ) - (when (>= (* f0-0 f0-0) (vector-vector-distance-squared (-> v1-4 trans) a1-0)) + (when (>= (square 14336.0) (vector-vector-distance-squared (-> v1-4 trans) a1-0)) (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/jak3/levels/common/battle_REF.gc b/test/decompiler/reference/jak3/levels/common/battle_REF.gc index 136acabff8..cbe4d4822e 100644 --- a/test/decompiler/reference/jak3/levels/common/battle_REF.gc +++ b/test/decompiler/reference/jak3/levels/common/battle_REF.gc @@ -697,7 +697,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))) ) @@ -739,13 +738,7 @@ (s2-1 #t) (s1-1 577) ) - (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) @@ -776,7 +769,7 @@ (vector-copy! gp-0 (-> arg0 attack-pos)) (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)) @@ -803,14 +796,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)) ) ) ) @@ -844,14 +833,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)) ) ) ) @@ -883,7 +868,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) ) ) @@ -1515,13 +1500,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 :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (s1-0 (res-lump-data arg1 'spawn-types pointer :tag-ptr (& sv-16))) + ) (dotimes (s0-0 2) (set! s2-0 0) (when s1-0 @@ -1554,8 +1539,9 @@ ) ) (else - (set! sv-32 (new 'static 'res-tag)) - (let ((v1-18 (res-lump-data arg1 'spawn-percs pointer :tag-ptr (& sv-32)))) + (let* ((sv-32 (new 'static 'res-tag)) + (v1-18 (res-lump-data arg1 'spawn-percs pointer :tag-ptr (& sv-32))) + ) (when v1-18 (let ((a0-16 (min (the-as int (-> sv-32 elt-count)) s4-0)) (a1-14 0) @@ -1657,9 +1643,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-actor)) - (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)) @@ -1669,33 +1656,34 @@ (s2-0 0) ) (dotimes (s0-0 s4-0) - (set! sv-32 (-> s5-0 data s0-0 actor)) - (when sv-32 - (let ((v0-1 (res-lump-value sv-32 'enemy-options uint128 :time -1000000000.0))) - (cond - ((logtest? #x80000 v0-1) - (+! s1-0 1) - (cond - ((zero? s3-0) - 0 - ) - (else - (let ((a1-2 (-> this spawners data (+ s1-0 -1)))) - (initialize-spawner this a1-2 sv-32) + (let ((sv-32 (-> s5-0 data s0-0 actor))) + (when sv-32 + (let ((v0-1 (res-lump-value sv-32 'enemy-options uint128 :time -1000000000.0))) + (cond + ((logtest? #x80000 v0-1) + (+! s1-0 1) + (cond + ((zero? s3-0) + 0 + ) + (else + (let ((a1-2 (-> this spawners data (+ s1-0 -1)))) + (initialize-spawner this a1-2 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 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 sv-32) + ) ) ) ) diff --git a/test/decompiler/reference/jak3/levels/common/elec-gate_REF.gc b/test/decompiler/reference/jak3/levels/common/elec-gate_REF.gc index 26a690e19d..a345098e73 100644 --- a/test/decompiler/reference/jak3/levels/common/elec-gate_REF.gc +++ b/test/decompiler/reference/jak3/levels/common/elec-gate_REF.gc @@ -201,7 +201,6 @@ ;; definition for function elec-gate-post ;; INFO: Used lq/sq (defbehavior elec-gate-post elec-gate () - (local-vars (sv-96 lightning-control) (sv-112 vector)) (let ((gp-0 (-> self params))) (dotimes (s5-0 5) (let* ((s2-0 (-> self l-bolt s5-0)) @@ -221,9 +220,9 @@ (when (-> gp-0 ring-spec) (let ((s1-0 (-> gp-0 ring-spec num-points)) (s0-0 (-> s2-0 ring 0)) + (sv-96 (-> s2-0 ring 1)) + (sv-112 (new 'stack-no-clear 'vector)) ) - (set! sv-96 (-> s2-0 ring 1)) - (set! sv-112 (new 'stack-no-clear 'vector)) (set! (-> sv-112 x) 0.0) (set! (-> sv-112 y) 0.0) (set! (-> sv-112 z) (-> s2-0 ring-radius)) @@ -441,15 +440,6 @@ ) ) :trans (behavior () - (local-vars - (sv-176 lightning-spec) - (sv-192 int) - (sv-208 symbol) - (sv-224 symbol) - (sv-240 int) - (sv-256 symbol) - (sv-272 symbol) - ) (let ((gp-0 *target*)) (when gp-0 (when (not (focus-test? gp-0 disable dead ignore grabbed pilot-riding pilot mech teleporting invulnerable)) @@ -494,63 +484,31 @@ (get-point-at-percent-along-path! (-> self path-r) (new 'stack-no-clear 'vector) (-> s5-1 0 pos) 'interp) ) ) - (let ((s3-0 (get-process *default-dead-pool* lightning-tracker #x4000 0))) - (when s3-0 - (let ((t9-6 (method-of-type lightning-tracker activate))) - (t9-6 (the-as lightning-tracker s3-0) *entity-pool* "lightning-tracker" (the-as pointer #x70004000)) - ) - (let ((s2-0 run-function-in-process) - (s1-0 s3-0) - (s0-0 lightning-tracker-init) - ) - (set! sv-176 (-> self params bolt-spec)) - (set! sv-192 15) - (set! sv-208 (the-as symbol #f)) - (set! sv-224 (the-as symbol #f)) - (let ((t3-0 (get-trans gp-0 3))) - ((the-as (function object object object object object object object object none) s2-0) - s1-0 - s0-0 - sv-176 - sv-192 - sv-208 - sv-224 - s4-2 - t3-0 - ) - ) - ) - (-> s3-0 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 gp-0 3) + :name "lightning-tracker" + :to *entity-pool* + :unk 0 ) - (let ((s4-3 (get-process *default-dead-pool* lightning-tracker #x4000 0))) - (when s4-3 - (let ((t9-10 (method-of-type lightning-tracker activate))) - (t9-10 (the-as lightning-tracker s4-3) *entity-pool* "lightning-tracker" (the-as pointer #x70004000)) - ) - (let ((s3-1 run-function-in-process) - (s2-1 s4-3) - (s1-1 lightning-tracker-init) - (s0-1 (-> self params bolt-spec)) - ) - (set! sv-240 15) - (set! sv-256 (the-as symbol #f)) - (set! sv-272 (the-as symbol #f)) - (let ((t3-1 (get-trans gp-0 3))) - ((the-as (function object object object object object object object object none) s3-1) - s2-1 - s1-1 - s0-1 - sv-240 - sv-256 - sv-272 - s5-2 - t3-1 - ) - ) - ) - (-> s4-3 ppointer) - ) + (process-spawn + lightning-tracker + :init lightning-tracker-init + (-> self params bolt-spec) + 15 + (the-as symbol #f) + (the-as symbol #f) + s5-2 + (get-trans gp-0 3) + :name "lightning-tracker" + :to *entity-pool* + :unk 0 ) ) ) diff --git a/test/decompiler/reference/jak3/levels/common/enemy/darkprec/dp-bipedal_REF.gc b/test/decompiler/reference/jak3/levels/common/enemy/darkprec/dp-bipedal_REF.gc index b8e721c4e7..faed4a5ff9 100644 --- a/test/decompiler/reference/jak3/levels/common/enemy/darkprec/dp-bipedal_REF.gc +++ b/test/decompiler/reference/jak3/levels/common/enemy/darkprec/dp-bipedal_REF.gc @@ -1166,43 +1166,46 @@ ;; definition for function region-check-has-los (defun region-check-has-los ((arg0 vector) (arg1 vector) (arg2 float)) - (local-vars (sv-80 vector) (sv-84 vector) (sv-88 vector) (sv-92 vector)) - (set! sv-80 (new 'stack-no-clear 'vector)) - (set! sv-84 (new 'stack-no-clear 'vector)) - (set! sv-88 (new 'stack-no-clear 'vector)) - (set! sv-92 (new 'stack-no-clear 'vector)) - (vector-! sv-92 arg1 arg0) - (vector-normalize! sv-92 1.0) - (let ((f0-1 (+ 2048.0 arg2))) - (vector+float*! sv-84 arg0 sv-92 f0-1) - (vector+float*! sv-88 arg1 sv-92 (- f0-1)) - ) - (vector-average! sv-80 sv-84 sv-88) - (set! (-> sv-80 w) (+ (* 0.5 (vector-vector-distance sv-84 sv-88)) 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 (-> (the-as region-prim-area #x70000000) pos)) sv-84 0.0) - (sphere<-vector+r! (the-as sphere (-> (the-as region-prim-area #x70000000) exit-pos)) sv-88 0.0) - (vector-! (-> (the-as region-prim-area #x70000000) ray) sv-88 sv-84) - (vector-! (-> (the-as region-prim-area #x70000000) exit-ray) sv-84 sv-88) - (dotimes (s5-1 (-> *level* length)) - (let ((v1-26 (-> *level* level s5-1))) - (when (= (-> v1-26 status) 'active) - (let ((s4-1 (-> v1-26 bsp region-trees))) - (when (nonzero? s4-1) - (let* ((s3-0 (-> s4-1 length)) - (s2-0 0) - (a0-19 (-> s4-1 s2-0)) - ) - (while (< s2-0 s3-0) - (if (= (-> a0-19 name) 'data) - (collect-regions a0-19 (the-as sphere sv-80) 0 (the-as region-prim-list (+ #x70000000 0))) - ) - (+! s2-0 1) - (set! a0-19 (-> s4-1 s2-0)) + (let ((sv-80 (new 'stack-no-clear 'vector))) + (let ((sv-84 (new 'stack-no-clear 'vector)) + (sv-88 (new 'stack-no-clear 'vector)) + ) + (let ((sv-92 (new 'stack-no-clear 'vector))) + (vector-! sv-92 arg1 arg0) + (vector-normalize! sv-92 1.0) + (let ((f0-1 (+ 2048.0 arg2))) + (vector+float*! sv-84 arg0 sv-92 f0-1) + (vector+float*! sv-88 arg1 sv-92 (- f0-1)) + ) + ) + (vector-average! sv-80 sv-84 sv-88) + (set! (-> sv-80 w) (+ (* 0.5 (vector-vector-distance sv-84 sv-88)) 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 (-> (the-as region-prim-area #x70000000) pos)) sv-84 0.0) + (sphere<-vector+r! (the-as sphere (-> (the-as region-prim-area #x70000000) exit-pos)) sv-88 0.0) + (vector-! (-> (the-as region-prim-area #x70000000) ray) sv-88 sv-84) + (vector-! (-> (the-as region-prim-area #x70000000) exit-ray) sv-84 sv-88) + ) + (dotimes (s5-1 (-> *level* length)) + (let ((v1-26 (-> *level* level s5-1))) + (when (= (-> v1-26 status) 'active) + (let ((s4-1 (-> v1-26 bsp region-trees))) + (when (nonzero? s4-1) + (let* ((s3-0 (-> s4-1 length)) + (s2-0 0) + (a0-19 (-> s4-1 s2-0)) + ) + (while (< s2-0 s3-0) + (if (= (-> a0-19 name) 'data) + (collect-regions a0-19 (the-as sphere sv-80) 0 (the-as region-prim-list (+ #x70000000 0))) + ) + (+! s2-0 1) + (set! a0-19 (-> s4-1 s2-0)) + ) ) ) ) @@ -2640,18 +2643,10 @@ (vector-normalize-copy! (new 'stack-no-clear 'vector) (-> s2-0 1) 1.0) ) ) - (let ((f0-6 1.0) - (f1-1 (-> s2-0 2 y)) - ) - (set! (-> s2-0 2 w) (- f0-6 (* f1-1 f1-1))) - ) + (set! (-> s2-0 2 w) (- 1.0 (square (-> s2-0 2 y)))) (set! (-> s2-0 3 x) (* 2.0 (-> s2-0 2 z) (-> s2-0 2 y) (-> s2-0 2 x))) - (let ((f0-12 (-> s2-0 2 x))) - (set! (-> s2-0 3 y) (- (* f0-12 f0-12))) - ) - (let ((f0-16 (-> s2-0 3 x))) - (set! (-> s2-0 3 z) (- (* f0-16 f0-16) (* 4.0 (-> s2-0 3 y) (-> s2-0 2 w)))) - ) + (set! (-> s2-0 3 y) (- (square (-> s2-0 2 x)))) + (set! (-> s2-0 3 z) (- (square (-> s2-0 3 x)) (* 4.0 (-> s2-0 3 y) (-> s2-0 2 w)))) (cond ((>= (-> s2-0 3 z) 0.0) (let ((f0-22 (- (-> s2-0 3 x))) @@ -2664,7 +2659,7 @@ (set! (-> s2-0 4 x) (/ (-> s2-0 3 w) (+ (fmax 0.0 (vector-dot arg2 (-> s2-0 5))) arg5))) (vector+float*! arg0 (-> s2-0 0) (-> s2-0 1) (-> s2-0 4 x)) (let ((f1-19 (/ (-> s2-0 2 x) arg5))) - (set! (-> arg0 y) (+ 10240.0 (* (/ arg6 4) (* f1-19 f1-19)) (-> arg3 y))) + (set! (-> arg0 y) (+ 10240.0 (* (/ arg6 4) (square f1-19)) (-> arg3 y))) ) #t ) @@ -3221,7 +3216,6 @@ ;; WARN: Return type mismatch int vs none. (defmethod init-enemy! ((this dp-bipedal)) "Typical place for shared init code. Runs from entity or process style init." - (local-vars (sv-16 res-tag)) (initialize-skeleton this (the-as skeleton-group (art-group-get-by-name *level* "skel-dp-bipedal" (the-as (pointer level) #f))) @@ -3247,12 +3241,13 @@ (set! (-> this shield-handle) (the-as handle #f)) (vector-reset! (-> this focus-formation-source)) (set! (-> this turret-entity) #f) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-23 (res-lump-data (-> this entity) 'actor-groups pointer :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-23 (res-lump-data (-> this entity) 'actor-groups (pointer actor-group) :tag-ptr (& sv-16))) + ) (cond ((and v1-23 (nonzero? (-> sv-16 elt-count))) (set! (-> this actor-group-count) (the-as int (-> sv-16 elt-count))) - (set! (-> this actor-group) (the-as (pointer actor-group) v1-23)) + (set! (-> this actor-group) v1-23) ) (else (set! (-> this actor-group-count) 0) @@ -3395,3 +3390,7 @@ ) (go (method-of-object this idle)) ) + + + + diff --git a/test/decompiler/reference/jak3/levels/common/enemy/darkprec/neo-wasp_REF.gc b/test/decompiler/reference/jak3/levels/common/enemy/darkprec/neo-wasp_REF.gc index 96ec660512..59f4217300 100644 --- a/test/decompiler/reference/jak3/levels/common/enemy/darkprec/neo-wasp_REF.gc +++ b/test/decompiler/reference/jak3/levels/common/enemy/darkprec/neo-wasp_REF.gc @@ -953,21 +953,24 @@ ) (let ((s5-1 (lambda ((arg0 neo-wasp) (arg1 cspace) (arg2 transformq) (arg3 float) (arg4 float)) - (local-vars (sv-144 vector) (sv-148 matrix) (sv-152 quaternion) (sv-156 quaternion) (sv-160 vector)) - (set! sv-144 (vector<-cspace! (new 'stack-no-clear 'vector) arg1)) - (set! sv-148 (new 'stack-no-clear 'matrix)) - (set! sv-152 (matrix-with-scale->quaternion (new 'stack-no-clear 'quaternion) (-> arg1 bone transform))) - (set! sv-156 (new 'stack-no-clear 'quaternion)) - (let ((v1-3 (new 'stack-no-clear 'vector))) - (vector-copy! v1-3 (-> arg0 root scale)) - (set! sv-160 v1-3) + (let ((sv-144 (vector<-cspace! (new 'stack-no-clear 'vector) arg1)) + (sv-148 (new 'stack-no-clear 'matrix)) + ) + (let ((sv-152 (matrix-with-scale->quaternion (new 'stack-no-clear 'quaternion) (-> arg1 bone transform))) + (sv-156 (new 'stack-no-clear 'quaternion)) + (v1-3 (new 'stack-no-clear 'vector)) + ) + (vector-copy! v1-3 (-> arg0 root scale)) + (let ((sv-160 v1-3)) + (vector-float*! sv-160 sv-160 arg4) + (quaternion-rotate-local-x! sv-156 sv-152 (the-as float arg2)) + (quaternion->matrix sv-148 sv-156) + (scale-matrix! sv-148 sv-160 sv-148) + ) + ) + (vector-copy! (-> sv-148 trans) sv-144) + (spawn-from-mat (-> arg0 engine-part) sv-148) ) - (vector-float*! sv-160 sv-160 arg4) - (quaternion-rotate-local-x! sv-156 sv-152 (the-as float arg2)) - (quaternion->matrix sv-148 sv-156) - (scale-matrix! sv-148 sv-160 sv-148) - (vector-copy! (-> sv-148 trans) sv-144) - (spawn-from-mat (-> arg0 engine-part) sv-148) (none) ) ) @@ -1172,7 +1175,6 @@ ;; WARN: Return type mismatch int vs none. (defmethod init-enemy! ((this neo-wasp)) "Typical place for shared init code. Runs from entity or process style init." - (local-vars (sv-16 res-tag) (sv-32 res-tag) (sv-48 res-tag) (sv-64 res-tag)) (when (= (level-status? *level* 'precura #f) 'active) (let ((v1-4 (level-get *level* 'lprenme))) (if (and v1-4 (= (-> v1-4 status) 'active)) @@ -1206,15 +1208,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-38 (res-lump-data (-> this entity) 'actor-groups (pointer actor-group) :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-38 (res-lump-data (-> this entity) 'actor-groups (pointer actor-group) :tag-ptr (& sv-16))) + ) (if (and v1-38 (= (-> sv-16 elt-count) 1)) (set! (-> this entity-group) (-> v1-38 0)) (set! (-> this entity-group) #f) ) ) - (set! sv-32 (new 'static 'res-tag)) - (let ((v1-42 (res-lump-data (-> this entity) 'timeout (pointer float) :tag-ptr (& sv-32)))) + (let* ((sv-32 (new 'static 'res-tag)) + (v1-42 (res-lump-data (-> this entity) 'timeout (pointer float) :tag-ptr (& sv-32))) + ) (cond ((and v1-42 (= (-> sv-32 elt-count) 2)) (set! (-> this attack-wait-min) (-> v1-42 0)) @@ -1231,27 +1235,27 @@ ) (set! (-> this draw force-lod) 1) ) - (let ((f30-0 4096.0)) - (set! sv-48 (new 'static 'res-tag)) - (let ((v1-52 (res-lump-data (-> this entity) 'min-max (pointer float) :tag-ptr (& sv-48)))) - (set! (-> this attack-miss-dist-min) (* f30-0 (if (and v1-52 (> (the-as int (-> sv-48 elt-count)) 0)) - (-> v1-52 0) - -10.0 - ) - ) - ) - ) + (let* ((f30-0 4096.0) + (sv-48 (new 'static 'res-tag)) + (v1-52 (res-lump-data (-> this entity) 'min-max (pointer float) :tag-ptr (& sv-48))) + ) + (set! (-> this attack-miss-dist-min) (* f30-0 (if (and v1-52 (> (the-as int (-> sv-48 elt-count)) 0)) + (-> v1-52 0) + -10.0 + ) + ) + ) ) - (let ((f30-1 4096.0)) - (set! sv-64 (new 'static 'res-tag)) - (let ((v1-56 (res-lump-data (-> this entity) 'min-max (pointer float) :tag-ptr (& sv-64)))) - (set! (-> this attack-miss-dist-max) (* f30-1 (if (and v1-56 (< 1 (the-as int (-> sv-64 elt-count)))) - (-> v1-56 1) - 8.0 - ) - ) - ) - ) + (let* ((f30-1 4096.0) + (sv-64 (new 'static 'res-tag)) + (v1-56 (res-lump-data (-> this entity) 'min-max (pointer float) :tag-ptr (& sv-64))) + ) + (set! (-> this attack-miss-dist-max) (* f30-1 (if (and v1-56 (< 1 (the-as int (-> sv-64 elt-count)))) + (-> v1-56 1) + 8.0 + ) + ) + ) ) (set! (-> this path) (new 'process 'curve-control this 'intro -1000000000.0)) (set! (-> this path-u) 0.0) diff --git a/test/decompiler/reference/jak3/levels/common/enemy/grunt_REF.gc b/test/decompiler/reference/jak3/levels/common/enemy/grunt_REF.gc index 6b16f2f213..df4a7ed098 100644 --- a/test/decompiler/reference/jak3/levels/common/enemy/grunt_REF.gc +++ b/test/decompiler/reference/jak3/levels/common/enemy/grunt_REF.gc @@ -935,11 +935,7 @@ ) ) (zero? (rnd-int this 3)) - (let ((f0-2 (vector-vector-distance-squared (-> this root trans) (target-pos 0))) - (f1-2 32768.0) - ) - (>= f0-2 (* f1-2 f1-2)) - ) + (>= (vector-vector-distance-squared (-> this root trans) (target-pos 0)) (square 32768.0)) ) (go-die this) ) @@ -1252,23 +1248,18 @@ (s4-0 (new 'stack-no-clear 'vector)) ) (vector-! s4-0 v1-3 (-> this root trans)) - (let* ((f30-0 (vector-length-squared s4-0)) - (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 (vector-length-squared s4-0)) + (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)) ) ) @@ -1296,10 +1287,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-time-frame self (seconds 1) (seconds 1.2)))) ) diff --git a/test/decompiler/reference/jak3/levels/common/enemy/hover/hover-enemy_REF.gc b/test/decompiler/reference/jak3/levels/common/enemy/hover/hover-enemy_REF.gc index e027f2575c..3312afdfc9 100644 --- a/test/decompiler/reference/jak3/levels/common/enemy/hover/hover-enemy_REF.gc +++ b/test/decompiler/reference/jak3/levels/common/enemy/hover/hover-enemy_REF.gc @@ -320,54 +320,57 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defmethod hover-enemy-method-169 ((this hover-enemy)) - (local-vars (sv-592 vector) (sv-596 vector) (sv-600 collide-query) (sv-604 vector) (sv-608 float)) (cond ((and (-> this draw shadow) (logtest? (-> this draw status) (draw-control-status on-screen))) (when (= (logand (-> this hover-id) 15) (logand (-> *display* frame-clock integral-frame-counter) 15)) - (set! sv-592 (new 'stack-no-clear 'vector)) - (set! sv-596 (new 'stack-no-clear 'vector)) - (set! sv-600 (new 'stack-no-clear 'collide-query)) - (set! sv-604 (-> this draw shadow-ctrl settings shadow-dir)) - (set! sv-608 (the-as float 61440.0)) - (vector-copy! (-> sv-600 start-pos) (-> this root trans)) - (vector-normalize-copy! (-> sv-600 move-dist) sv-604 sv-608) - (let ((v1-19 sv-600)) - (set! (-> v1-19 radius) 819.2) - (set! (-> v1-19 collide-with) (collide-spec backgnd)) - (set! (-> v1-19 ignore-process0) this) - (set! (-> v1-19 ignore-process1) #f) - (set! (-> v1-19 ignore-pat) - (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) - ) - (set! (-> v1-19 action-mask) (collide-action solid)) + (let ((sv-592 (new 'stack-no-clear 'vector))) ) - (let ((f0-3 (fill-and-probe-using-line-sphere *collide-cache* sv-600))) - (cond - ((>= f0-3 0.0) - (let ((v1-23 (-> this draw shadow-ctrl))) - (logclear! (-> v1-23 settings flags) (shadow-flags disable-draw)) - ) - 0 - (-> sv-600 best-other-tri intersect) - (let ((a1-3 (-> this root trans))) - (-> a1-3 y) - (let ((f0-4 (* f0-3 sv-608))) - (shadow-control-method-14 - (-> this draw shadow-ctrl) - a1-3 - sv-604 - (- (+ 81920.0 sv-608)) - (+ -12288.0 f0-4) - (+ 12288.0 f0-4) + (let ((sv-596 (new 'stack-no-clear 'vector))) + ) + (let ((sv-600 (new 'stack-no-clear 'collide-query)) + (sv-604 (-> this draw shadow-ctrl settings shadow-dir)) + (sv-608 (the-as float 61440.0)) + ) + (vector-copy! (-> sv-600 start-pos) (-> this root trans)) + (vector-normalize-copy! (-> sv-600 move-dist) sv-604 sv-608) + (let ((v1-19 sv-600)) + (set! (-> v1-19 radius) 819.2) + (set! (-> v1-19 collide-with) (collide-spec backgnd)) + (set! (-> v1-19 ignore-process0) this) + (set! (-> v1-19 ignore-process1) #f) + (set! (-> v1-19 ignore-pat) + (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) + ) + (set! (-> v1-19 action-mask) (collide-action solid)) + ) + (let ((f0-3 (fill-and-probe-using-line-sphere *collide-cache* sv-600))) + (cond + ((>= f0-3 0.0) + (let ((v1-23 (-> this draw shadow-ctrl))) + (logclear! (-> v1-23 settings flags) (shadow-flags disable-draw)) + ) + 0 + (-> sv-600 best-other-tri intersect) + (let ((a1-3 (-> this root trans))) + (-> a1-3 y) + (let ((f0-4 (* f0-3 sv-608))) + (shadow-control-method-14 + (-> this draw shadow-ctrl) + a1-3 + sv-604 + (- (+ 81920.0 sv-608)) + (+ -12288.0 f0-4) + (+ 12288.0 f0-4) + ) ) ) ) - ) - (else - (let ((v1-35 (-> this draw shadow-ctrl))) - (logior! (-> v1-35 settings flags) (shadow-flags disable-draw)) + (else + (let ((v1-35 (-> this draw shadow-ctrl))) + (logior! (-> v1-35 settings flags) (shadow-flags disable-draw)) + ) + 0 ) - 0 ) ) ) diff --git a/test/decompiler/reference/jak3/levels/common/enemy/hover/hover-formation_REF.gc b/test/decompiler/reference/jak3/levels/common/enemy/hover/hover-formation_REF.gc index dd1c184f44..2ab1ff3228 100644 --- a/test/decompiler/reference/jak3/levels/common/enemy/hover/hover-formation_REF.gc +++ b/test/decompiler/reference/jak3/levels/common/enemy/hover/hover-formation_REF.gc @@ -251,7 +251,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) @@ -265,16 +264,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) @@ -750,7 +749,6 @@ ;; INFO: Used lq/sq (defmethod init-from-entity! ((this hover-formation) (arg0 entity-actor)) "Set up a newly created process from the entity that created it." - (local-vars (sv-32 vector)) (stack-size-set! (-> this main-thread) 32) (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)) @@ -765,25 +763,29 @@ ) ) (s0-0 (res-lump-float (-> this entity) 'notice-dist :default 225280.0)) + (t9-4 (method-of-type res-lump get-property-struct)) + (a0-6 (-> this entity)) + (a1-5 'trans-offset) + (a2-3 'interp) + (a3-2 -1000000000.0) + (t0-2 (new 'stack-no-clear 'vector)) ) - (let ((t9-4 (method-of-type res-lump get-property-struct)) - (a0-6 (-> this entity)) - (a1-5 '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-4 a0-6 a1-5 a2-3 a3-2 t0-2 (the-as (pointer res-tag) #f) *res-static-buf*)) + (res-lump-float (-> this entity) 'formation-rotinc :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 (the-as vector (t9-4 a0-6 a1-5 a2-3 a3-2 t0-2 (the-as (pointer res-tag) #f) *res-static-buf*))) - ) - (let ((t2-4 (res-lump-float (-> this entity) 'formation-rotinc :default 5461.3335)) - (t3-0 #f) - ) - (set! (-> this formation) (s5-0 s4-0 s3-0 s2-0 s1-0 s0-0 sv-32 t2-4 (the-as handle t3-0))) - ) ) (set-time! (-> this formation-timer)) (logclear! (-> this mask) (process-mask actor-pause)) diff --git a/test/decompiler/reference/jak3/levels/common/enemy/hover/hover-nav-control_REF.gc b/test/decompiler/reference/jak3/levels/common/enemy/hover/hover-nav-control_REF.gc index 330f394716..f2dbab1654 100644 --- a/test/decompiler/reference/jak3/levels/common/enemy/hover/hover-nav-control_REF.gc +++ b/test/decompiler/reference/jak3/levels/common/enemy/hover/hover-nav-control_REF.gc @@ -848,7 +848,6 @@ ;; definition for method 27 of type nav-network (defmethod nav-network-method-27 ((this nav-network) (arg0 vector) (arg1 process) (arg2 vector) (arg3 vector) (arg4 float)) - (local-vars (sv-32 sphere) (sv-36 vector)) (vector-reset! arg0) (let ((s1-0 (process->handle arg1)) (s2-0 0) @@ -857,16 +856,18 @@ (while v1-3 (let ((s0-0 (-> (the-as hover-nav-sphere v1-3) next))) (when (!= (-> (the-as hover-nav-sphere v1-3) handle) s1-0) - (set! sv-32 (-> (the-as hover-nav-sphere v1-3) sphere)) - (set! sv-36 (new 'stack-no-clear 'vector)) - (vector-segment-distance-point! sv-32 arg2 arg3 sv-36) - (when (and (>= (+ arg4 (-> sv-32 r)) (vector-vector-distance sv-32 sv-36)) - (< 0.0 (vector-vector-distance arg2 sv-36)) - ) - (let ((v1-11 (vector-! (new 'stack-no-clear 'vector) (the-as vector sv-32) arg2))) - (vector+! arg0 arg0 v1-11) + (let ((sv-32 (-> (the-as hover-nav-sphere v1-3) sphere)) + (sv-36 (new 'stack-no-clear 'vector)) + ) + (vector-segment-distance-point! sv-32 arg2 arg3 sv-36) + (when (and (>= (+ arg4 (-> sv-32 r)) (vector-vector-distance sv-32 sv-36)) + (< 0.0 (vector-vector-distance arg2 sv-36)) + ) + (let ((v1-11 (vector-! (new 'stack-no-clear 'vector) (the-as vector sv-32) arg2))) + (vector+! arg0 arg0 v1-11) + ) + (+! s2-0 1) ) - (+! s2-0 1) ) ) (set! v1-3 s0-0) @@ -903,7 +904,6 @@ ;; definition for method 33 of type nav-network ;; INFO: Used lq/sq (defmethod nav-network-method-33 ((this nav-network) (arg0 vector) (arg1 vector) (arg2 int)) - (local-vars (sv-32 vector)) (let ((s2-0 (-> this network)) (s1-0 (-> this edge)) (f30-0 0.0) @@ -914,14 +914,13 @@ (let* ((v1-6 (-> s1-0 s0-0)) (a1-1 (-> s2-0 (-> v1-6 start-index) pos)) (a2-1 (-> s2-0 (-> v1-6 end-index) pos)) + (sv-32 (new 'stack-no-clear 'vector)) + (f0-0 (vector-segment-distance-point! arg0 a1-1 a2-1 sv-32)) ) - (set! sv-32 (new 'stack-no-clear 'vector)) - (let ((f0-0 (vector-segment-distance-point! arg0 a1-1 a2-1 sv-32))) - (when (or (= gp-0 -1) (< f0-0 f30-0)) - (set! gp-0 s0-0) - (set! f30-0 f0-0) - (vector-copy! arg1 sv-32) - ) + (when (or (= gp-0 -1) (< f0-0 f30-0)) + (set! gp-0 s0-0) + (set! f30-0 f0-0) + (vector-copy! arg1 sv-32) ) ) ) @@ -933,25 +932,19 @@ ;; definition for method 34 of type nav-network ;; INFO: Used lq/sq (defmethod nav-network-method-34 ((this nav-network) (arg0 vector) (arg1 vector) (arg2 int)) - (local-vars - (sv-16 (array nav-network-info)) - (sv-20 (array nav-network-edge)) - (sv-24 number) - (sv-32 int) - (sv-64 vector) - ) - (set! sv-16 (-> this network)) - (set! sv-20 (-> this edge)) - (set! sv-24 0.0) - (set! sv-32 -1) - (dotimes (s3-0 (-> sv-20 length)) - (when (logtest? arg2 (ash 1 (-> sv-20 s3-0 sub-graph))) - (let* ((s2-0 (-> sv-20 s3-0)) - (a1-2 (-> sv-16 (-> s2-0 start-index) pos)) - (a2-1 (-> sv-16 (-> s2-0 end-index) pos)) - ) - (set! sv-64 (new 'stack-no-clear 'vector)) - (let ((f0-2 (- (vector-segment-distance-point! arg0 a1-2 a2-1 sv-64) (-> s2-0 radius)))) + (let ((sv-16 (-> this network)) + (sv-20 (-> this edge)) + (sv-24 0.0) + (sv-32 -1) + ) + (dotimes (s3-0 (-> sv-20 length)) + (when (logtest? arg2 (ash 1 (-> sv-20 s3-0 sub-graph))) + (let* ((s2-0 (-> sv-20 s3-0)) + (a1-2 (-> sv-16 (-> s2-0 start-index) pos)) + (a2-1 (-> sv-16 (-> s2-0 end-index) pos)) + (sv-64 (new 'stack-no-clear 'vector)) + (f0-2 (- (vector-segment-distance-point! arg0 a1-2 a2-1 sv-64) (-> s2-0 radius))) + ) (when (or (= sv-32 -1) (< f0-2 (the-as float sv-24))) (set! sv-32 s3-0) (set! sv-24 f0-2) @@ -960,8 +953,8 @@ ) ) ) + sv-32 ) - sv-32 ) ;; definition for method 35 of type nav-network @@ -1220,17 +1213,7 @@ ;; WARN: Stack slot offset 56 signed mismatch ;; WARN: Stack slot offset 56 signed mismatch (defmethod hover-nav-control-method-30 ((this hover-nav-control) (arg0 vector) (arg1 vector)) - (local-vars - (s0-0 int) - (sv-48 (array nav-network-info)) - (sv-52 (array nav-network-edge)) - (sv-56 int) - (sv-272 (pointer float)) - (sv-276 (inline-array vector)) - (sv-280 (inline-array vector)) - (sv-288 int) - (sv-304 vector) - ) + (local-vars (s0-0 int)) (rlet ((vf0 :class vf) (vf4 :class vf) (vf5 :class vf) @@ -1241,119 +1224,124 @@ (let ((s2-0 (new 'stack-no-clear 'vector)) (s3-0 (new 'stack-no-clear 'vector)) (s5-0 (-> this path-info)) + (sv-48 (-> this nav network)) ) - (set! sv-48 (-> this nav network)) (cond ((< (vector-vector-distance arg0 arg1) 13107.2) (nav-network-method-23 (-> this nav) s5-0 (-> (hover-nav-control-method-17 this) world-sphere) arg1 -1 -1) (hover-nav-control-method-31 this) ) (else - (set! sv-52 (-> this nav edge)) - (set! sv-56 (hover-nav-control-method-28 this arg0 s2-0)) - (let ((v1-13 - (and (!= sv-56 -1) - (begin (set! s0-0 (hover-nav-control-method-28 this arg1 s3-0)) (!= s0-0 -1)) - (begin - (when (< (-> sv-52 s0-0 radius) (vector-vector-distance arg1 s3-0)) - (set! sv-304 (new 'stack-no-clear 'vector)) - (let ((v1-21 arg1) - (a0-12 s3-0) + (let* ((sv-52 (-> this nav edge)) + (sv-56 (hover-nav-control-method-28 this arg0 s2-0)) + (v1-13 + (and (!= sv-56 -1) + (begin (set! s0-0 (hover-nav-control-method-28 this arg1 s3-0)) (!= s0-0 -1)) + (begin + (when (< (-> sv-52 s0-0 radius) (vector-vector-distance arg1 s3-0)) + (let ((sv-304 (new 'stack-no-clear 'vector))) + (let ((v1-21 arg1) + (a0-12 s3-0) + ) + (.lvf vf4 (&-> v1-21 quad)) + (.lvf vf5 (&-> a0-12 quad)) + ) + (.mov.vf.w vf6 vf0) + (.sub.vf.xyz vf6 vf4 vf5) + (.svf (&-> sv-304 quad) vf6) + (vector-normalize! sv-304 (-> sv-52 s0-0 radius)) + (let ((v1-26 arg1)) + (let ((a0-14 s3-0)) + (.mov.vf.w vf6 vf0) + (.lvf vf4 (&-> a0-14 quad)) + ) + (.lvf vf5 (&-> sv-304 quad)) + (.add.vf.xyz vf6 vf4 vf5) + (.svf (&-> v1-26 quad) vf6) + ) + ) + 0 + ) + (cond + ((= sv-56 s0-0) + (let ((sv-272 (new 'stack-no-clear 'array 'float 16)) + (v1-31 (new 'stack-no-clear 'inline-array 'vector 4)) + ) + (dotimes (a0-16 4) + (set! (-> v1-31 a0-16 quad) (the-as uint128 0)) ) - (.lvf vf4 (&-> v1-21 quad)) - (.lvf vf5 (&-> a0-12 quad)) - ) - (.mov.vf.w vf6 vf0) - (.sub.vf.xyz vf6 vf4 vf5) - (.svf (&-> sv-304 quad) vf6) - (vector-normalize! sv-304 (-> sv-52 s0-0 radius)) - (let ((v1-26 arg1)) - (let ((a0-14 s3-0)) - (.mov.vf.w vf6 vf0) - (.lvf vf4 (&-> a0-14 quad)) - ) - (.lvf vf5 (&-> sv-304 quad)) - (.add.vf.xyz vf6 vf4 vf5) - (.svf (&-> v1-26 quad) vf6) - ) - 0 - ) - (cond - ((= sv-56 s0-0) - (set! sv-272 (new 'stack-no-clear 'array 'float 16)) - (let ((v1-31 (new 'stack-no-clear 'inline-array 'vector 4))) - (dotimes (a0-16 4) - (set! (-> v1-31 a0-16 quad) (the-as uint128 0)) - ) - (set! sv-276 v1-31) - ) - (let ((v1-32 (new 'stack-no-clear 'inline-array 'vector 4))) - (dotimes (a0-19 4) - (set! (-> v1-32 a0-19 quad) (the-as uint128 0)) - ) - (set! sv-280 v1-32) - ) - (set! sv-288 0) - (vector-copy! (-> sv-276 0) arg0) - (vector-copy! (-> sv-276 1) s2-0) - (vector-copy! (-> sv-276 2) s3-0) - (vector-copy! (-> sv-276 3) arg1) - (dotimes (s4-1 4) - (let ((s3-2 (+ s4-1 1))) - (while (< s3-2 4) - (set! (-> (+ (+ (* s4-1 16) (* s3-2 4)) (the-as int sv-272)) 0) - (vector-vector-distance (-> sv-276 s4-1) (-> sv-276 s3-2)) - ) - (+! s3-2 1) - ) - ) - ) - (let ((v1-50 0) - (f0-4 (-> sv-52 sv-56 radius)) - ) - (while (begin (label cfg-30) (< v1-50 4)) - (vector-copy! (-> sv-280 sv-288) (-> sv-276 v1-50)) - (set! sv-288 (+ sv-288 1)) - (+! v1-50 1) - (while (< v1-50 4) - (if (< f0-4 - (-> (the-as (pointer float) (+ (+ (* v1-50 4) (* (+ v1-50 -1) 16)) (the-as int (the-as pointer sv-272))))) + (let ((sv-276 v1-31) + (v1-32 (new 'stack-no-clear 'inline-array 'vector 4)) + ) + (dotimes (a0-19 4) + (set! (-> v1-32 a0-19 quad) (the-as uint128 0)) + ) + (let ((sv-280 v1-32) + (sv-288 0) + ) + (vector-copy! (-> sv-276 0) arg0) + (vector-copy! (-> sv-276 1) s2-0) + (vector-copy! (-> sv-276 2) s3-0) + (vector-copy! (-> sv-276 3) arg1) + (dotimes (s4-1 4) + (let ((s3-2 (+ s4-1 1))) + (while (< s3-2 4) + (set! (-> (+ (+ (* s4-1 16) (* s3-2 4)) (the-as int sv-272)) 0) + (vector-vector-distance (-> sv-276 s4-1) (-> sv-276 s3-2)) + ) + (+! s3-2 1) ) - (goto cfg-30) - ) - (+! v1-50 1) - ) - (goto cfg-32) - ) - ) - (label cfg-32) - (when (< sv-288 4) - (vector-copy! (-> sv-280 sv-288) (-> sv-276 3)) - (set! sv-288 (+ sv-288 1)) - ) - (if (< 1 sv-288) - (nav-network-method-23 (-> this nav) s5-0 (-> sv-280 0) (-> sv-280 1) -1 -1) - ) - #t - ) - ((and (nav-network-method-23 (-> this nav) s5-0 s3-0 arg1 -1 -1) - (nav-network-method-25 (-> this nav) s5-0 sv-56 (the-as int s2-0) s0-0 s3-0) + ) + ) + (let ((v1-50 0) + (f0-4 (-> sv-52 sv-56 radius)) + ) + (while (begin (label cfg-30) (< v1-50 4)) + (vector-copy! (-> sv-280 sv-288) (-> sv-276 v1-50)) + (+! sv-288 1) + (+! v1-50 1) + (while (< v1-50 4) + (if (< f0-4 + (-> (the-as (pointer float) (+ (+ (* v1-50 4) (* (+ v1-50 -1) 16)) (the-as int (the-as pointer sv-272))))) + ) + (goto cfg-30) + ) + (+! v1-50 1) + ) + (goto cfg-32) + ) + ) + (label cfg-32) + (when (< sv-288 4) + (vector-copy! (-> sv-280 sv-288) (-> sv-276 3)) + (+! sv-288 1) + ) + (if (< 1 sv-288) + (nav-network-method-23 (-> this nav) s5-0 (-> sv-280 0) (-> sv-280 1) -1 -1) + ) + ) ) - (nav-network-method-23 - (-> this nav) - s5-0 - (-> (hover-nav-control-method-17 this) world-sphere) - (-> sv-48 (-> s5-0 segment-list pos-index 0) pos) - -1 - (-> s5-0 segment-list pos-index 0) - ) - #t + ) + #t + ) + ((and (nav-network-method-23 (-> this nav) s5-0 s3-0 arg1 -1 -1) + (nav-network-method-25 (-> this nav) s5-0 sv-56 (the-as int s2-0) s0-0 s3-0) + ) + (nav-network-method-23 + (-> this nav) + s5-0 + (-> (hover-nav-control-method-17 this) world-sphere) + (-> sv-48 (-> s5-0 segment-list pos-index 0) pos) + -1 + (-> s5-0 segment-list pos-index 0) + ) + #t + ) ) - ) - ) - ) - ) - ) + ) + ) + ) + ) (if v1-13 (hover-nav-control-method-31 this) 0 @@ -1497,19 +1485,20 @@ ;; definition for method 15 of type hover-nav-control (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-33 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-33 this))) + ) ) ;; 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-34 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-34 this))) + ) ) ;; definition for method 10 of type hover-nav-control @@ -1547,7 +1536,6 @@ ;; WARN: Stack slot offset 16 signed mismatch ;; WARN: Return type mismatch int vs none. (defmethod hover-nav-control-method-12 ((this hover-nav-control) (arg0 vector)) - (local-vars (sv-16 int) (sv-128 collide-prim-core)) (when *debug-hover* (if arg0 (add-debug-sphere #t (bucket-id debug) arg0 (meters 0.9) *color-yellow*) @@ -1559,8 +1547,7 @@ (let* ((s3-0 (-> this fixed-path-info)) (s5-1 (-> s3-0 path)) (s4-0 (hover-nav-control-method-17 this)) - ) - (set! sv-16 (cond + (sv-16 (cond ((>= (-> s3-0 current-index) (+ (-> s3-0 end-index) -2)) (-> s3-0 current-index) ) @@ -1587,20 +1574,17 @@ (-> s3-0 current-index) ) ) - ) + ) + ) (cond ((>= sv-16 (+ (-> s3-0 end-index) -2)) - (let* ((s2-2 (-> this nav)) - (s1-2 (method-of-object s2-2 nav-network-method-23)) - (s0-0 (-> this path-info)) - ) - (set! sv-128 s4-0) - (let ((a3-4 (get-point-in-path! s5-1 (new 'stack-no-clear 'vector) (the float (-> s3-0 end-index)) 'interp)) - (t0-1 -1) - (t1-0 -1) - ) - (s1-2 s2-2 s0-0 (-> sv-128 world-sphere) a3-4 t0-1 t1-0) - ) + (nav-network-method-23 + (-> this nav) + (-> this path-info) + (-> s4-0 world-sphere) + (get-point-in-path! s5-1 (new 'stack-no-clear 'vector) (the float (-> s3-0 end-index)) 'interp) + -1 + -1 ) (let ((s2-3 (new 'stack-no-clear 'vector))) (if (and (< (path-control-method-29 s5-1 (-> s4-0 world-sphere) (+ (-> s3-0 end-index) -1) (the-as float s2-3)) @@ -1720,42 +1704,39 @@ ;; ERROR: Stack slot load at 144 mismatch: defined as size 4, got size 16 ;; WARN: Return type mismatch int vs none. (defmethod hover-nav-control-method-11 ((this hover-nav-control)) - (local-vars (sv-48 vector) (sv-128 float) (sv-144 float)) - (let ((s5-0 (-> this root))) - (let ((s4-0 (hover-nav-control-method-17 this))) - (let ((v1-2 (vector-! (new 'stack-no-clear 'vector) (-> s4-0 world-sphere) (-> s5-0 trans)))) - (set! sv-48 (vector-! (new 'stack-no-clear 'vector) (-> this dest-pos) v1-2)) - ) - (when (not (logtest? (-> this flags) (hover-nav-flags hnf0))) - (let* ((s3-0 (-> this root transv)) - (f30-0 (vector-length s3-0)) - (s2-0 lerp-scale) - (s1-0 0.0) - (s0-0 (hover-nav-control-method-33 this)) - ) - (set! sv-128 (* 2.0 f30-0)) - (set! sv-144 (the-as float 0.0)) - (let* ((t0-0 (hover-nav-control-method-33 this)) - (f0-4 (s2-0 s1-0 s0-0 sv-128 sv-144 t0-0)) - (t0-2 (vector+float*! (new 'stack-no-clear 'vector) (-> s4-0 world-sphere) s3-0 (/ f0-4 f30-0))) - (s4-1 (nav-network-method-27 - (-> this nav) - (new 'stack-no-clear 'vector) - (-> this root process) - (-> s4-0 world-sphere) - t0-2 - (-> s4-0 world-sphere w) - ) - ) - ) - (let ((f0-7 (vector-length s4-1))) - (seek! (-> this nav-collide-impulse-len) f0-7 (* (hover-nav-control-method-34 this) (seconds-per-frame))) - ) - (vector-normalize-copy! (-> this nav-collide-impulse) s4-1 (- (-> this nav-collide-impulse-len))) - ) + (let* ((s5-0 (-> this root)) + (s4-0 (hover-nav-control-method-17 this)) + (v1-2 (vector-! (new 'stack-no-clear 'vector) (-> s4-0 world-sphere) (-> s5-0 trans))) + (sv-48 (vector-! (new 'stack-no-clear 'vector) (-> this dest-pos) v1-2)) + ) + (when (not (logtest? (-> this flags) (hover-nav-flags hnf0))) + (let* ((s3-0 (-> this root transv)) + (f30-0 (vector-length s3-0)) + (f0-4 (lerp-scale + 0.0 + (hover-nav-control-method-33 this) + (* 2.0 f30-0) + (the-as float 0.0) + (hover-nav-control-method-33 this) + ) + ) + (t0-2 (vector+float*! (new 'stack-no-clear 'vector) (-> s4-0 world-sphere) s3-0 (/ f0-4 f30-0))) + (s4-1 (nav-network-method-27 + (-> this nav) + (new 'stack-no-clear 'vector) + (-> this root process) + (-> s4-0 world-sphere) + t0-2 + (-> s4-0 world-sphere w) + ) + ) + ) + (let ((f0-7 (vector-length s4-1))) + (seek! (-> this nav-collide-impulse-len) f0-7 (* (hover-nav-control-method-34 this) (seconds-per-frame))) ) - 0 + (vector-normalize-copy! (-> this nav-collide-impulse) s4-1 (- (-> this nav-collide-impulse-len))) ) + 0 ) (let ((f30-1 (hover-nav-control-method-34 this)) (f28-0 (hover-nav-control-method-33 this)) diff --git a/test/decompiler/reference/jak3/levels/common/enemy/hover/hover-nav-edit_REF.gc b/test/decompiler/reference/jak3/levels/common/enemy/hover/hover-nav-edit_REF.gc index 205bf16246..d691b259c8 100644 --- a/test/decompiler/reference/jak3/levels/common/enemy/hover/hover-nav-edit_REF.gc +++ b/test/decompiler/reference/jak3/levels/common/enemy/hover/hover-nav-edit_REF.gc @@ -125,20 +125,6 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch file-stream vs object. (defun hover-nav-graph-output ((arg0 string)) - (local-vars - (sv-96 vector) - (sv-112 vector) - (sv-128 int) - (sv-144 int) - (sv-160 (function _varargs_ object)) - (sv-176 string) - (sv-192 string) - (sv-208 int) - (sv-224 (function _varargs_ object)) - (sv-240 string) - (sv-256 string) - (sv-272 int) - ) (rlet ((vf0 :class vf) (vf4 :class vf) (vf5 :class vf) @@ -182,44 +168,37 @@ ) (dotimes (s0-0 s2-1) (when (nonzero? (-> s3-2 node-array data s0-0 nav_node_id)) - (set! sv-96 (new 'stack-no-clear 'vector)) - (let ((v1-22 (+ (the-as uint (-> s3-2 node-array data 0 position)) (* 80 s0-0))) - (a0-22 s4-0) - ) - (.mov.vf.w vf6 vf0) - (.lvf vf4 (&-> (the-as (pointer int128) v1-22))) - (.lvf vf5 (&-> a0-22 quad)) - ) - (.add.vf.xyz vf6 vf4 vf5) - (.svf (&-> sv-96 quad) vf6) - (set! sv-112 (new 'stack-no-clear 'vector)) - (format gp-0 " (~d (~m ~m ~m) (" s1-0 (-> sv-96 x) (-> sv-96 y) (-> sv-96 z)) - (set! sv-128 0) - (while (< sv-128 (-> s3-2 edge-array length)) - (let ((v1-32 (-> s3-2 edge-array data sv-128))) - (set! sv-272 (-> v1-32 runtime-node-id-1)) - (set! sv-144 (-> v1-32 runtime-node-id-2)) + (let ((sv-96 (new 'stack-no-clear 'vector))) + (let ((v1-22 (+ (the-as uint (-> s3-2 node-array data 0 position)) (* 80 s0-0))) + (a0-22 s4-0) + ) + (.mov.vf.w vf6 vf0) + (.lvf vf4 (&-> (the-as (pointer int128) v1-22))) + (.lvf vf5 (&-> a0-22 quad)) ) - (when (= s0-0 sv-272) - (vector+! sv-112 (the-as vector (+ (the-as uint (-> s3-2 node-array data 0 position)) (* 80 sv-144))) s4-0) - (set! sv-160 format) - (set! sv-176 gp-0) - (set! sv-192 "(~d ~m) ") - (set! sv-208 sv-144) - (let ((a3-3 (vector-vector-distance sv-96 sv-112))) - (sv-160 sv-176 sv-192 sv-208 a3-3) + (.add.vf.xyz vf6 vf4 vf5) + (.svf (&-> sv-96 quad) vf6) + (let ((sv-112 (new 'stack-no-clear 'vector))) + (format gp-0 " (~d (~m ~m ~m) (" s1-0 (-> sv-96 x) (-> sv-96 y) (-> sv-96 z)) + (let ((sv-128 0)) + (while (< sv-128 (-> s3-2 edge-array length)) + (let* ((v1-32 (-> s3-2 edge-array data sv-128)) + (sv-272 (-> v1-32 runtime-node-id-1)) + (sv-144 (-> v1-32 runtime-node-id-2)) + ) + (when (= s0-0 sv-272) + (vector+! sv-112 (the-as vector (+ (the-as uint (-> s3-2 node-array data 0 position)) (* 80 sv-144))) s4-0) + (format gp-0 "(~d ~m) " sv-144 (vector-vector-distance sv-96 sv-112)) + ) + (when (= s0-0 sv-144) + (vector+! sv-112 (the-as vector (+ (the-as uint (-> s3-2 node-array data 0 position)) (* 80 sv-272))) s4-0) + (format gp-0 "(~d ~m) " sv-272 (vector-vector-distance sv-96 sv-112)) + ) + ) + (+! sv-128 1) + ) ) ) - (when (= s0-0 sv-144) - (vector+! sv-112 (the-as vector (+ (the-as uint (-> s3-2 node-array data 0 position)) (* 80 sv-272))) s4-0) - (set! sv-224 format) - (set! sv-240 gp-0) - (set! sv-256 "(~d ~m) ") - (let ((a3-4 (vector-vector-distance sv-96 sv-112))) - (sv-224 sv-240 sv-256 sv-272 a3-4) - ) - ) - (set! sv-128 (+ sv-128 1)) ) (format gp-0 "))~%") (+! s1-0 1) @@ -679,7 +658,3 @@ (format #t ")~%") (none) ) - - - - diff --git a/test/decompiler/reference/jak3/levels/common/enemy/hover/robo-hover_REF.gc b/test/decompiler/reference/jak3/levels/common/enemy/hover/robo-hover_REF.gc index 5172be4c3d..f73f65eb7b 100644 --- a/test/decompiler/reference/jak3/levels/common/enemy/hover/robo-hover_REF.gc +++ b/test/decompiler/reference/jak3/levels/common/enemy/hover/robo-hover_REF.gc @@ -1263,7 +1263,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))) @@ -1345,78 +1345,72 @@ (s5-0 (-> this main-joint-movement 2)) (gp-0 (lambda ((arg0 robo-hover) (arg1 cspace) (arg2 float) (arg3 float) (arg4 vector) (arg5 vector) (arg6 int)) - (local-vars (sv-192 float) (sv-208 vector) (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 'vector)) - (let ((s2-1 (new 'stack-no-clear 'vector))) - (-> arg0 scale) - (quaternion-rotate-local-z! (the-as quaternion sv-208) a1-3 sv-192) - (quaternion->matrix s5-0 (the-as quaternion sv-208)) - (vector-copy! s2-1 (-> arg0 root scale)) - (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 (* 1146880.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 15564.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 'vector)) + (s2-1 (new 'stack-no-clear 'vector)) + ) + (-> arg0 scale) + (quaternion-rotate-local-z! (the-as quaternion sv-208) a1-3 sv-192) + (quaternion->matrix s5-0 (the-as quaternion sv-208)) + (vector-copy! s2-1 (-> arg0 root scale)) + (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 (* 1146880.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* 2210 init-specs 4 initial-valuef) (* f20-0 f2-6)) - (set! (-> *part-id-table* 2210 init-specs 5 initial-valuef) (* f26-0 f0-14)) - (set! (-> *part-id-table* 2214 init-specs 3 initial-valuef) (* f22-0 f2-6)) - (set! (-> *part-id-table* 2211 init-specs 1 initial-valuef) (* f24-0 f0-14)) - (set! (-> *part-id-table* 2212 init-specs 1 initial-valuef) (* f1-10 f0-14)) - (set! (-> *part-id-table* 2213 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 uvec) (/ 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 15564.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)) ) - (vector-copy! (-> s5-0 trans) s4-0) - (spawn-from-mat (-> 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) - #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* 2210 init-specs 4 initial-valuef) (* f20-0 f2-6)) + (set! (-> *part-id-table* 2210 init-specs 5 initial-valuef) (* f26-0 f0-14)) + (set! (-> *part-id-table* 2214 init-specs 3 initial-valuef) (* f22-0 f2-6)) + (set! (-> *part-id-table* 2211 init-specs 1 initial-valuef) (* f24-0 f0-14)) + (set! (-> *part-id-table* 2212 init-specs 1 initial-valuef) (* f1-10 f0-14)) + (set! (-> *part-id-table* 2213 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 uvec) (/ f0-15 -2)) ) ) ) + (vector-copy! (-> s5-0 trans) s4-0) + (spawn-from-mat (-> 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) + #t + ) + ) ) ) 0 @@ -1713,7 +1707,6 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defun robo-hover-arm-jmod ((arg0 cspace) (arg1 transformq)) - (local-vars (sv-80 vector) (sv-96 quaternion)) (rlet ((vf0 :class vf) (vf4 :class vf) (vf5 :class vf) @@ -1721,37 +1714,34 @@ ) (init-vf0-vector) (cspace<-parented-transformq-joint! arg0 arg1) - (let ((s4-0 (-> arg0 param1)) - (s2-0 (the-as object (-> arg0 param2))) - ) - (set! sv-80 (vector<-cspace! (new 'stack-no-clear 'vector) arg0)) - (let ((s0-0 (-> (the-as robo-hover s4-0) aim-position)) - (s1-0 (new 'stack-no-clear 'vector)) - ) - (set! sv-96 (matrix->quat (-> arg0 bone transform) (new 'stack-no-clear 'quaternion))) - (let ((s3-0 (new 'stack-no-clear 'quaternion))) - (let ((v1-1 s1-0)) - (.lvf vf4 (&-> s0-0 quad)) - (.lvf vf5 (&-> sv-80 quad)) - (.mov.vf.w vf6 vf0) - (.sub.vf.xyz vf6 vf4 vf5) - (.svf (&-> v1-1 quad) vf6) - ) - (vector-normalize! s1-0 1.0) - (vector-inv-orient-by-quat! s1-0 s1-0 sv-96) - (quaternion-from-two-vectors-max-angle-partial! - s3-0 - *y-vector* - s1-0 - 16384.0 - (-> (the-as robo-hover s4-0) gun-blend) - ) - (quaternion-normalize! s3-0) - (quaternion*! s3-0 s3-0 (-> (the-as robo-hover s4-0) wrist-quat (the-as int s2-0))) - (quaternion-normalize! s3-0) - (quaternion*! (-> arg1 quat) (-> arg1 quat) s3-0) - ) + (let* ((s4-0 (-> arg0 param1)) + (s2-0 (the-as object (-> arg0 param2))) + (sv-80 (vector<-cspace! (new 'stack-no-clear 'vector) arg0)) + (s0-0 (-> (the-as robo-hover s4-0) aim-position)) + (s1-0 (new 'stack-no-clear 'vector)) + (sv-96 (matrix->quat (-> arg0 bone transform) (new 'stack-no-clear 'quaternion))) + (s3-0 (new 'stack-no-clear 'quaternion)) + ) + (let ((v1-1 s1-0)) + (.lvf vf4 (&-> s0-0 quad)) + (.lvf vf5 (&-> sv-80 quad)) + (.mov.vf.w vf6 vf0) + (.sub.vf.xyz vf6 vf4 vf5) + (.svf (&-> v1-1 quad) vf6) ) + (vector-normalize! s1-0 1.0) + (vector-inv-orient-by-quat! s1-0 s1-0 sv-96) + (quaternion-from-two-vectors-max-angle-partial! + s3-0 + *y-vector* + s1-0 + 16384.0 + (-> (the-as robo-hover s4-0) gun-blend) + ) + (quaternion-normalize! s3-0) + (quaternion*! s3-0 s3-0 (-> (the-as robo-hover s4-0) wrist-quat (the-as int s2-0))) + (quaternion-normalize! s3-0) + (quaternion*! (-> arg1 quat) (-> arg1 quat) s3-0) ) (quaternion-normalize! (-> arg1 quat)) (cspace<-parented-transformq-joint! arg0 arg1) @@ -1765,7 +1755,6 @@ ;; WARN: Return type mismatch int vs none. (defmethod init-enemy! ((this robo-hover)) "Typical place for shared init code. Runs from entity or process style init." - (local-vars (sv-16 res-tag) (sv-32 res-tag) (sv-48 res-tag) (sv-64 res-tag)) (hover-enemy-method-170 this) (setup-enemy! this (get-enemy-info this)) (hover-enemy-method-176 this) @@ -1790,15 +1779,17 @@ (logior! (-> this mask) (process-mask kg-robot)) (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-31 (res-lump-data (-> this entity) 'actor-groups (pointer actor-group) :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-31 (res-lump-data (-> this entity) 'actor-groups (pointer actor-group) :tag-ptr (& sv-16))) + ) (if (and v1-31 (= (-> sv-16 elt-count) 1)) (set! (-> this entity-group) (-> v1-31 0)) (set! (-> this entity-group) #f) ) ) - (set! sv-32 (new 'static 'res-tag)) - (let ((v1-35 (res-lump-data (-> this entity) 'timeout (pointer float) :tag-ptr (& sv-32)))) + (let* ((sv-32 (new 'static 'res-tag)) + (v1-35 (res-lump-data (-> this entity) 'timeout (pointer float) :tag-ptr (& sv-32))) + ) (cond ((and v1-35 (= (-> sv-32 elt-count) 2)) (set! (-> this attack-wait-min) (-> v1-35 0)) @@ -1811,16 +1802,18 @@ ) ) (set! (-> this knocked-fall-dist) 0.0) - (set! sv-48 (new 'static 'res-tag)) - (let ((v1-41 (res-lump-data (-> this entity) 'min-max pointer :tag-ptr (& sv-48)))) + (let* ((sv-48 (new 'static 'res-tag)) + (v1-41 (res-lump-data (-> this entity) 'min-max pointer :tag-ptr (& sv-48))) + ) (set! (-> this attack-miss-dist-min) (if (and v1-41 (> (the-as int (-> sv-48 elt-count)) 0)) (-> (the-as (pointer float) v1-41)) -14336.0 ) ) ) - (set! sv-64 (new 'static 'res-tag)) - (let ((v1-44 (res-lump-data (-> this entity) 'min-max (pointer float) :tag-ptr (& sv-64)))) + (let* ((sv-64 (new 'static 'res-tag)) + (v1-44 (res-lump-data (-> this entity) 'min-max (pointer float) :tag-ptr (& sv-64))) + ) (set! (-> this attack-miss-dist-max) (if (and v1-44 (< 1 (the-as int (-> sv-64 elt-count)))) (-> v1-44 1) 14336.0 diff --git a/test/decompiler/reference/jak3/levels/common/enemy/kg-grunt_REF.gc b/test/decompiler/reference/jak3/levels/common/enemy/kg-grunt_REF.gc index 49d84c420f..890214e219 100644 --- a/test/decompiler/reference/jak3/levels/common/enemy/kg-grunt_REF.gc +++ b/test/decompiler/reference/jak3/levels/common/enemy/kg-grunt_REF.gc @@ -1135,23 +1135,18 @@ (s4-0 (new 'stack-no-clear 'vector)) ) (vector-! s4-0 v1-3 (-> this root trans)) - (let* ((f30-0 (vector-length-squared s4-0)) - (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 (vector-length-squared s4-0)) + (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)) ) ) @@ -1179,10 +1174,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 "kg-grunt-warn") (set! (-> self next-warn-time) (+ gp-0 (rnd-time-frame self (seconds 1) (seconds 1.2)))) ) diff --git a/test/decompiler/reference/jak3/levels/common/enemy/mantis_REF.gc b/test/decompiler/reference/jak3/levels/common/enemy/mantis_REF.gc index 0726ef33fc..e7584a82cb 100644 --- a/test/decompiler/reference/jak3/levels/common/enemy/mantis_REF.gc +++ b/test/decompiler/reference/jak3/levels/common/enemy/mantis_REF.gc @@ -1495,11 +1495,7 @@ ) ) (zero? (rnd-int this 3)) - (let ((f0-2 (vector-vector-distance-squared (-> this root trans) (target-pos 0))) - (f1-2 32768.0) - ) - (>= f0-2 (* f1-2 f1-2)) - ) + (>= (vector-vector-distance-squared (-> this root trans) (target-pos 0)) (square 32768.0)) ) (go-die this) ) diff --git a/test/decompiler/reference/jak3/levels/common/enemy/roboguard_REF.gc b/test/decompiler/reference/jak3/levels/common/enemy/roboguard_REF.gc index 74b9f8feff..db6faf8ec8 100644 --- a/test/decompiler/reference/jak3/levels/common/enemy/roboguard_REF.gc +++ b/test/decompiler/reference/jak3/levels/common/enemy/roboguard_REF.gc @@ -1428,9 +1428,7 @@ ) (else (if (or (not (closest-point-on-mesh (-> this nav) s5-0 (-> gp-0 trans) (-> s3-0 current-poly))) - (let ((f0-0 8192.0)) - (< (* f0-0 f0-0) (vector-vector-xz-distance-squared s5-0 (-> gp-0 trans))) - ) + (< (square 8192.0) (vector-vector-xz-distance-squared s5-0 (-> gp-0 trans))) (< (- (-> gp-0 trans y) (-> s5-0 y)) -4096.0) ) (return #t) @@ -1712,7 +1710,6 @@ (let ((v1-13 (-> this node-list data 4))) (set! (-> v1-13 param0) (lambda ((arg0 cspace) (arg1 transformq)) - (local-vars (sv-96 vector)) (let ((s3-0 (the-as roboguard (-> arg0 param1))) (gp-0 (new 'stack-no-clear 'quaternion)) ) @@ -1721,23 +1718,24 @@ (vector-copy! s2-0 (-> s3-0 rotation-matrix rvec)) (let ((s0-0 (new 'stack-no-clear 'vector))) (vector-copy! s0-0 (-> s3-0 rotation-matrix fvec)) - (let ((s1-0 (new 'stack-no-clear 'vector))) - (set! sv-96 (-> s3-0 focus-pos)) - (let* ((v0-1 (vector<-cspace! (new 'stack-no-clear 'vector) arg0)) - (s1-1 (vector-! s1-0 sv-96 v0-1)) - ) - (set! (-> s1-1 y) 0.0) - (set! (-> s2-0 y) 0.0) - (set! (-> s0-0 y) 0.0) - (vector-xz-normalize! s1-1 1.0) - (vector-xz-normalize! s2-0 1.0) - (vector-xz-normalize! s0-0 1.0) - (let ((f0-5 (fmin 18204.445 (acos (vector-dot s0-0 s1-1))))) - (if (< (vector-dot s2-0 s1-1) 0.0) - (set! f0-5 (* -1.0 f0-5)) - ) - (seek! (-> s3-0 torso-angle) f0-5 (* (-> s3-0 torso-seek-speed) (seconds-per-frame))) + (let ((s1-1 (vector-! + (new 'stack-no-clear 'vector) + (-> s3-0 focus-pos) + (vector<-cspace! (new 'stack-no-clear 'vector) arg0) + ) + ) ) + (set! (-> s1-1 y) 0.0) + (set! (-> s2-0 y) 0.0) + (set! (-> s0-0 y) 0.0) + (vector-xz-normalize! s1-1 1.0) + (vector-xz-normalize! s2-0 1.0) + (vector-xz-normalize! s0-0 1.0) + (let ((f0-5 (fmin 18204.445 (acos (vector-dot s0-0 s1-1))))) + (if (< (vector-dot s2-0 s1-1) 0.0) + (set! f0-5 (* -1.0 f0-5)) + ) + (seek! (-> s3-0 torso-angle) f0-5 (* (-> s3-0 torso-seek-speed) (seconds-per-frame))) ) ) ) diff --git a/test/decompiler/reference/jak3/levels/common/enemy/spydroid-orig_REF.gc b/test/decompiler/reference/jak3/levels/common/enemy/spydroid-orig_REF.gc index 4a4b5fa291..5823b6d1f2 100644 --- a/test/decompiler/reference/jak3/levels/common/enemy/spydroid-orig_REF.gc +++ b/test/decompiler/reference/jak3/levels/common/enemy/spydroid-orig_REF.gc @@ -854,7 +854,7 @@ ;; INFO: Used lq/sq (defmethod event-handler ((this spydroid-orig) (arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) "Commmon handler for events." - (local-vars (v1-8 structure) (sv-144 vector)) + (local-vars (v1-8 structure)) (rlet ((vf0 :class vf) (vf4 :class vf) (vf5 :class vf) @@ -865,71 +865,77 @@ (('touch 'bonk 'attack) (cond ((logtest? (-> this flags) (spydroid-orig-flag sof0)) - (set! sv-144 (the-as vector (send-event (ppointer->process (-> this parent)) 'widow-get-center))) - (let ((s0-0 (as-type arg0 process-drawable))) - (let ((v1-7 sv-144)) - (b! (not v1-7) cfg-16 :likely-delay (set! v1-8 sv-144)) - ) - (set! v1-8 s0-0) - (label cfg-16) - (cond - (v1-8 - (let ((v1-12 (vector-! (new 'stack-no-clear 'vector) (-> this root trans) sv-144)) - (s1-1 (new 'stack-no-clear 'vector)) - ) - (set! (-> s1-1 x) (- (-> v1-12 z))) - (set! (-> s1-1 y) 0.0) - (set! (-> s1-1 z) (-> v1-12 x)) - (set! (-> s1-1 w) 1.0) - (let ((v1-15 - (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-15 y) 0.0) - (if (< (vector-dot v1-15 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-20 s1-1)) - (let ((a0-19 s1-1)) - (.mov.vf.w vf6 vf0) - (.lvf vf4 (&-> a0-19 quad)) - ) - (.lvf vf5 (&-> sv-144 quad)) - (.add.vf.xyz vf6 vf4 vf5) - (.svf (&-> v1-20 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 :mask (vehicle-impulse-factor) ((id (new-attack-id)) - (damage 2.0) - (vehicle-damage-factor 1.0) - (vehicle-impulse-factor 1.0) - (mode 'shock) - (vector s1-1) - ) - ) - ) + (let ((a1-3 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-3 from) (process->ppointer self)) + (set! (-> a1-3 num-params) 0) + (set! (-> a1-3 message) 'widow-get-center) + (let ((sv-144 (the-as vector (send-event-function (ppointer->process (-> this parent)) a1-3))) + (s0-0 (as-type arg0 process-drawable)) ) + (let ((v1-7 sv-144)) + (b! (not v1-7) cfg-16 :likely-delay (set! v1-8 sv-144)) + ) + (set! v1-8 s0-0) + (label cfg-16) + (cond + (v1-8 + (let ((v1-12 (vector-! (new 'stack-no-clear 'vector) (-> this root trans) sv-144)) + (s1-1 (new 'stack-no-clear 'vector)) + ) + (set! (-> s1-1 x) (- (-> v1-12 z))) + (set! (-> s1-1 y) 0.0) + (set! (-> s1-1 z) (-> v1-12 x)) + (set! (-> s1-1 w) 1.0) + (let ((v1-15 + (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-15 y) 0.0) + (if (< (vector-dot v1-15 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-20 s1-1)) + (let ((a0-19 s1-1)) + (.mov.vf.w vf6 vf0) + (.lvf vf4 (&-> a0-19 quad)) + ) + (.lvf vf5 (&-> sv-144 quad)) + (.add.vf.xyz vf6 vf4 vf5) + (.svf (&-> v1-20 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 :mask (vehicle-impulse-factor) ((id (new-attack-id)) + (damage 2.0) + (vehicle-damage-factor 1.0) + (vehicle-impulse-factor 1.0) + (mode 'shock) + (vector s1-1) + ) + ) + ) + ) + ) + ((and s0-0 (= (-> s0-0 type) target)) + (send-event arg0 'attack #f (static-attack-info :mask (vehicle-impulse-factor) ((id (new-attack-id)) + (damage 2.0) + (vehicle-damage-factor 1.0) + (vehicle-impulse-factor 1.0) + (mode 'shock) + (shove-up (meters 2)) + (shove-back (meters 4)) + ) + ) + ) + ) ) - ((and s0-0 (= (-> s0-0 type) target)) - (send-event arg0 'attack #f (static-attack-info :mask (vehicle-impulse-factor) ((id (new-attack-id)) - (damage 2.0) - (vehicle-damage-factor 1.0) - (vehicle-impulse-factor 1.0) - (mode 'shock) - (shove-up (meters 2)) - (shove-back (meters 4)) - ) - ) - ) - ) ) ) (let ((v1-36 (the-as object (-> arg3 param 1)))) @@ -1326,11 +1332,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/jak3/levels/common/enemy/spydroid_REF.gc b/test/decompiler/reference/jak3/levels/common/enemy/spydroid_REF.gc index 9ae77ac3fc..1e511b85d1 100644 --- a/test/decompiler/reference/jak3/levels/common/enemy/spydroid_REF.gc +++ b/test/decompiler/reference/jak3/levels/common/enemy/spydroid_REF.gc @@ -1016,11 +1016,7 @@ ) :trans (behavior () (if (or (time-elapsed? (-> self state-time) (seconds 15)) - (let ((f0-0 (vector-vector-xz-distance-squared (-> self root trans) (-> self move-dest))) - (f1-0 20480.0) - ) - (< f0-0 (* f1-0 f1-0)) - ) + (< (vector-vector-xz-distance-squared (-> self root trans) (-> self move-dest)) (square 20480.0)) ) (go-virtual scan) ) @@ -1118,9 +1114,8 @@ (when (handle->process (-> self focus handle)) (let* ((a0-9 (the-as process-focusable (handle->process (-> self focus handle)))) (f0-0 (vector-vector-xz-distance-squared (get-trans a0-9 3) (-> self root trans))) - (f1-0 143360.0) ) - (when (< (* f1-0 f1-0) f0-0) + (when (< (square 143360.0) f0-0) (spydroid-method-231 self (the-as uint 3)) (go-virtual hostile) ) @@ -1445,7 +1440,7 @@ (and (< 0.98 (-> arg0 danger-level)) (and (or (= (-> arg0 danger-type) 0) (= (-> arg0 danger-type) 3) (= (-> arg0 danger-type) 5)) (< (fabs (- (-> arg0 sphere y) (-> this root trans y))) 61440.0) - (< (vector-vector-xz-distance-squared (-> this root trans) (-> arg0 sphere)) (* f30-0 f30-0)) + (< (vector-vector-xz-distance-squared (-> this root trans) (-> arg0 sphere)) (square f30-0)) ) ) ) @@ -1524,22 +1519,18 @@ (the-as enemy-aware #f) ) (update-focus this) - (let ((f0-0 (vector-vector-xz-distance-squared (-> this root trans) (-> this focus-pos))) - (f1-0 266240.0) - ) - (cond - ((< f0-0 (* f1-0 f1-0)) - (when (not (logtest? (-> this squad alert-state flags) (squad-alert-flag war))) - (set! v0-6 (logior (-> this flags) (citizen-flag persistent))) - (set! (-> this flags) (the-as citizen-flag v0-6)) - v0-6 - ) + (cond + ((< (vector-vector-xz-distance-squared (-> this root trans) (-> this focus-pos)) (square 266240.0)) + (when (not (logtest? (-> this squad alert-state flags) (squad-alert-flag war))) + (set! v0-6 (logior (-> this flags) (citizen-flag persistent))) + (set! (-> this flags) (the-as citizen-flag v0-6)) + v0-6 ) - (else - (set! v0-6 (logclear (-> this flags) (citizen-flag persistent))) - (set! (-> this flags) (the-as citizen-flag v0-6)) - v0-6 - ) + ) + (else + (set! v0-6 (logclear (-> this flags) (citizen-flag persistent))) + (set! (-> this flags) (the-as citizen-flag v0-6)) + v0-6 ) ) ) diff --git a/test/decompiler/reference/jak3/levels/common/hvehicle/squad-control_REF.gc b/test/decompiler/reference/jak3/levels/common/hvehicle/squad-control_REF.gc index a5574cf564..4e3ac82c07 100644 --- a/test/decompiler/reference/jak3/levels/common/hvehicle/squad-control_REF.gc +++ b/test/decompiler/reference/jak3/levels/common/hvehicle/squad-control_REF.gc @@ -380,10 +380,9 @@ ;; definition for method 33 of type squad-control ;; WARN: Return type mismatch process vs process-focusable. (defmethod get-focus-in-range ((this squad-control) (arg0 process-focusable)) - (let* ((f0-0 4915200.0) - (f30-0 (* f0-0 f0-0)) - (s4-0 (the-as process #f)) - ) + (let ((f30-0 (square 4915200.0)) + (s4-0 (the-as process #f)) + ) (dotimes (s3-0 3) (let ((s2-0 (as-type (handle->process (-> this alert-state target-status-array s3-0 handle)) process-focusable))) (when s2-0 @@ -405,92 +404,92 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch vector vs none. (defmethod squad-control-method-31 ((this squad-control) (arg0 vector) (arg1 process-focusable) (arg2 handle) (arg3 float) (arg4 float)) - (local-vars (sv-672 float) (sv-688 vector) (sv-704 int)) (rlet ((vf0 :class vf) (vf4 :class vf) (vf5 :class vf) (vf6 :class vf) ) (init-vf0-vector) - (set! sv-672 arg4) - (let ((s5-0 (get-handle-pos this arg2 (new 'stack-no-clear 'vector)))) + (let ((sv-672 arg4) + (s5-0 (get-handle-pos this arg2 (new 'stack-no-clear 'vector))) + ) (let ((s3-1 (vector-! (new 'stack-no-clear 'vector) s5-0 (-> arg1 root trans)))) - (set! sv-688 s5-0) - (set! (-> s3-1 y) 0.0) - (vector-normalize! s3-1 1.0) - (let ((s2-0 (new 'stack-no-clear 'squad-control-stack-type0)) - (s1-0 (the-as nav-mesh #f)) - (f30-0 sv-672) - ) - (if (and (nonzero? (-> arg1 nav)) (-> arg1 nav)) - (set! s1-0 (-> arg1 nav state mesh)) - ) - (if (not s1-0) - (set! s1-0 (find-nearest-nav-mesh sv-688 (the-as float #x7f800000))) - ) - (when s1-0 - (nav-mesh-method-10 s1-0 sv-688 sv-688 (the-as nav-poly #f)) - (set! (-> s2-0 float0) 40960.0) - (set! (-> s2-0 byte0) 2) - (vector-! (-> s2-0 vec1) sv-688 (the-as vector (-> s1-0 bounds))) - (nav-mesh-method-46 s1-0 (the-as nav-poly (-> s2-0 vec1))) - (let ((s0-1 (-> s2-0 mesh))) - (when s0-1 - (project-point-into-poly-2d s1-0 (the-as nav-poly s0-1) (-> s2-0 vec1) (-> s2-0 vec1)) - (let ((v1-18 (-> s2-0 vec1)) - (a0-9 (-> s1-0 bounds)) - ) - (.mov.vf.w vf6 vf0) - (.lvf vf4 (&-> v1-18 quad)) - (.lvf vf5 (&-> a0-9 quad)) - ) - (.add.vf.xyz vf6 vf4 vf5) - (.svf (&-> sv-688 quad) vf6) - (set! sv-704 0) - (while (< sv-704 16) - (when #t - (set! (-> s2-0 float1) - (the float (sar (shl (the int (+ f30-0 (* 182.04445 (* 22.5 (the float sv-704))))) 48) 48)) + (let ((sv-688 s5-0)) + (set! (-> s3-1 y) 0.0) + (vector-normalize! s3-1 1.0) + (let ((s2-0 (new 'stack-no-clear 'squad-control-stack-type0)) + (s1-0 (the-as nav-mesh #f)) + (f30-0 sv-672) + ) + (if (and (nonzero? (-> arg1 nav)) (-> arg1 nav)) + (set! s1-0 (-> arg1 nav state mesh)) + ) + (if (not s1-0) + (set! s1-0 (find-nearest-nav-mesh sv-688 (the-as float #x7f800000))) + ) + (when s1-0 + (nav-mesh-method-10 s1-0 sv-688 sv-688 (the-as nav-poly #f)) + (set! (-> s2-0 float0) 40960.0) + (set! (-> s2-0 byte0) 2) + (vector-! (-> s2-0 vec1) sv-688 (the-as vector (-> s1-0 bounds))) + (nav-mesh-method-46 s1-0 (the-as nav-poly (-> s2-0 vec1))) + (let ((s0-1 (-> s2-0 mesh))) + (when s0-1 + (project-point-into-poly-2d s1-0 (the-as nav-poly s0-1) (-> s2-0 vec1) (-> s2-0 vec1)) + (let ((v1-18 (-> s2-0 vec1)) + (a0-9 (-> s1-0 bounds)) + ) + (.mov.vf.w vf6 vf0) + (.lvf vf4 (&-> v1-18 quad)) + (.lvf vf5 (&-> a0-9 quad)) + ) + (.add.vf.xyz vf6 vf4 vf5) + (.svf (&-> sv-688 quad) vf6) + (let ((sv-704 0)) + (while (< sv-704 16) + (when #t + (set! (-> s2-0 float1) + (the float (sar (shl (the int (+ f30-0 (* 182.04445 (* 22.5 (the float sv-704))))) 48) 48)) + ) + (set! (-> s2-0 float2) arg3) + (vector-rotate-around-y! (-> s2-0 vec0) s3-1 (-> s2-0 float1)) + (vector-float*! (-> s2-0 vec0) (-> s2-0 vec0) (-> s2-0 float2)) + (clamp-vector-to-mesh-cross-gaps + s1-0 + (-> s2-0 vec1) + (the-as nav-poly s0-1) + (-> s2-0 vec0) + (-> s2-0 float2) + #f + (the-as clamp-travel-vector-to-mesh-return-info #f) ) - (set! (-> s2-0 float2) arg3) - (vector-rotate-around-y! (-> s2-0 vec0) s3-1 (-> s2-0 float1)) - (vector-float*! (-> s2-0 vec0) (-> s2-0 vec0) (-> s2-0 float2)) - (clamp-vector-to-mesh-cross-gaps - s1-0 - (-> s2-0 vec1) - (the-as nav-poly s0-1) - (-> s2-0 vec0) - (-> s2-0 float2) - #f - (the-as clamp-travel-vector-to-mesh-return-info #f) - ) - (vector-copy! (-> s2-0 cquery start-pos) s5-0) - (vector-copy! (-> s2-0 cquery move-dist) (-> s2-0 vec0)) - (let ((v1-34 (-> s2-0 cquery))) - (set! (-> v1-34 radius) 2048.0) - (set! (-> v1-34 collide-with) (collide-spec backgnd)) - (set! (-> v1-34 ignore-process0) #f) - (set! (-> v1-34 ignore-process1) #f) - (set! (-> v1-34 ignore-pat) - (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) + (vector-copy! (-> s2-0 cquery start-pos) s5-0) + (vector-copy! (-> s2-0 cquery move-dist) (-> s2-0 vec0)) + (let ((v1-34 (-> s2-0 cquery))) + (set! (-> v1-34 radius) 2048.0) + (set! (-> v1-34 collide-with) (collide-spec backgnd)) + (set! (-> v1-34 ignore-process0) #f) + (set! (-> v1-34 ignore-process1) #f) + (set! (-> v1-34 ignore-pat) + (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) + ) + (set! (-> v1-34 action-mask) (collide-action solid)) + ) + (set! (-> s2-0 float3) (fill-and-probe-using-line-sphere *collide-cache* (-> s2-0 cquery))) + (if (< 0.0 (-> s2-0 float3)) + (vector-float*! (-> s2-0 vec0) (-> s2-0 vec0) (-> s2-0 float3)) + ) + (let ((f0-17 (vector-length-squared (-> s2-0 vec0)))) + (when (< (square (/ arg3 2)) f0-17) + (vector+! s5-0 s5-0 (-> s2-0 vec0)) + 0 + (goto cfg-19) ) - (set! (-> v1-34 action-mask) (collide-action solid)) - ) - (set! (-> s2-0 float3) (fill-and-probe-using-line-sphere *collide-cache* (-> s2-0 cquery))) - (if (< 0.0 (-> s2-0 float3)) - (vector-float*! (-> s2-0 vec0) (-> s2-0 vec0) (-> s2-0 float3)) - ) - (let ((f0-17 (vector-length-squared (-> s2-0 vec0))) - (f1-4 (/ arg3 2)) ) - (when (< (* f1-4 f1-4) f0-17) - (vector+! s5-0 s5-0 (-> s2-0 vec0)) - 0 - (goto cfg-19) ) + (+! sv-704 1) ) ) - (set! sv-704 (+ sv-704 1)) ) ) ) diff --git a/test/decompiler/reference/jak3/levels/common/race/pilot-recorder_REF.gc b/test/decompiler/reference/jak3/levels/common/race/pilot-recorder_REF.gc index 5fe63d927f..3d38124c07 100644 --- a/test/decompiler/reference/jak3/levels/common/race/pilot-recorder_REF.gc +++ b/test/decompiler/reference/jak3/levels/common/race/pilot-recorder_REF.gc @@ -232,11 +232,9 @@ (a0-5 (new 'stack-no-clear 'vector)) ) (vector+float*! a0-5 arg0 s4-0 f0-4) - (let ((f0-5 184320.0)) - (if (>= (* f0-5 f0-5) (vector-vector-xz-distance-squared a0-5 (-> this start-record-center))) - #t - ) - ) + (if (>= (square 184320.0) (vector-vector-xz-distance-squared a0-5 (-> this start-record-center))) + #t + ) ) ) ) @@ -253,11 +251,9 @@ (a0-5 (new 'stack-no-clear 'vector)) ) (vector+float*! a0-5 arg0 s4-0 f0-4) - (let ((f0-5 184320.0)) - (if (>= (* f0-5 f0-5) (vector-vector-xz-distance-squared a0-5 (-> this finish-record-center))) - #t - ) - ) + (if (>= (square 184320.0) (vector-vector-xz-distance-squared a0-5 (-> this finish-record-center))) + #t + ) ) ) ) @@ -306,12 +302,10 @@ ) (vector-copy! s3-0 (math-camera-pos)) (while (< s2-0 s4-0) - (let* ((s2-1 (-> this samples s2-0)) - (s1-1 (-> this samples s5-0)) - (f0-0 (vector-vector-distance-squared (-> s2-1 pos) s3-0)) - (f1-0 819200.0) - ) - (if (< f0-0 (* f1-0 f1-0)) + (let ((s2-1 (-> this samples s2-0)) + (s1-1 (-> this samples s5-0)) + ) + (if (< (vector-vector-distance-squared (-> s2-1 pos) s3-0) (square 819200.0)) (add-debug-line #t (bucket-id debug) @@ -422,8 +416,8 @@ (v1-24 (-> this samples (+ s4-0 s1-0))) ) (vector+float*! (-> s0-0 1) (-> s3-0 pos) (-> s2-0 0) f0-8) - (vector+float*! (-> s0-0 1) (-> s0-0 1) (-> s2-0 2) (* f0-8 f0-8)) - (vector+float*! (-> s0-0 1) (-> s0-0 1) (-> s2-0 3) (* f0-8 f0-8 f0-8)) + (vector+float*! (-> s0-0 1) (-> s0-0 1) (-> s2-0 2) (square f0-8)) + (vector+float*! (-> s0-0 1) (-> s0-0 1) (-> s2-0 3) (* (square f0-8) f0-8)) (vector-copy! (-> v1-24 pos) (-> s0-0 1)) (quaternion-slerp! (-> v1-24 quat) (-> s3-0 quat) (-> s5-0 quat) f0-8) ) @@ -437,7 +431,6 @@ ;; definition for method 30 of type pilot-recorder ;; INFO: Used lq/sq (defmethod save-to-db! ((this pilot-recorder)) - (local-vars (sv-16 pilrec-sample-flag)) (let ((gp-0 (clear *temp-string*)) (s4-0 (-> *race-info-array* *select-race* path-group-name)) (s3-0 *select-race-path*) @@ -462,8 +455,9 @@ (format gp-0 "quat_y=~f," (-> s1-0 quat y)) (format gp-0 "quat_z=~f," (-> s1-0 quat z)) (format gp-0 "quat_w=~f," (-> s1-0 quat w)) - (set! sv-16 (-> s1-0 flags)) - (let ((s0-0 #f)) + (let ((sv-16 (-> s1-0 flags)) + (s0-0 #f) + ) (format gp-0 "flags='") (when (logtest? sv-16 (pilrec-sample-flag square)) (set! s0-0 (cond diff --git a/test/decompiler/reference/jak3/levels/common/race/race-hud_REF.gc b/test/decompiler/reference/jak3/levels/common/race/race-hud_REF.gc index f00bec856b..a73f6e51b0 100644 --- a/test/decompiler/reference/jak3/levels/common/race/race-hud_REF.gc +++ b/test/decompiler/reference/jak3/levels/common/race/race-hud_REF.gc @@ -300,7 +300,6 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defmethod draw ((this hud-race-final-stats)) - (local-vars (sv-112 font-context) (sv-128 string) (sv-144 string)) (let* ((s1-0 *race-state*) (s5-0 (-> s1-0 racer-array (-> s1-0 i-player))) ) @@ -310,63 +309,55 @@ (let* ((s4-0 0) (s3-0 (+ s4-0 3)) ) - (set! sv-112 - (new 'stack 'font-context *font-default-matrix* 0 0 0.0 (font-color default) (font-flags shadow kerning)) - ) - (set! (-> this strings 0 scale) 0.0) - (set! (-> sv-112 origin x) 45.0) - (set! (-> sv-112 origin y) 20.0) - (set-width! sv-112 422) - (set-height! sv-112 80) - (let ((a0-6 sv-112)) - (set! (-> a0-6 color) (font-color red)) - ) - (let ((a0-7 sv-112)) - (set! (-> a0-7 flags) (font-flags kerning middle middle-vert large)) - ) - (let ((s0-0 80)) - (set-scale! sv-112 1.6) - (if (= (-> *setting-control* user-default language) (language-enum german)) - (set-scale! sv-112 1.0) - ) - (cond - ((-> s1-0 player-win?) - (let ((s1-1 print-game-text) - (a0-13 (lookup-text! *common-text* (text-id text-0076) #f)) - (a2-2 #f) - (a3-1 44) - (t0-1 579) - ) - (s1-1 a0-13 sv-112 a2-2 a3-1 (the-as bucket-id t0-1)) - ) - ) - (else - (print-game-text - (lookup-text! *common-text* (text-id text-0077) #f) - sv-112 - #f - 44 - (bucket-id hud-draw-hud-alpha) + (let ((sv-112 + (new 'stack 'font-context *font-default-matrix* 0 0 0.0 (font-color default) (font-flags shadow kerning)) ) ) + (set! (-> this strings 0 scale) 0.0) + (set! (-> sv-112 origin x) 45.0) + (set! (-> sv-112 origin y) 20.0) + (set-width! sv-112 422) + (set-height! sv-112 80) + (let ((a0-6 sv-112)) + (set! (-> a0-6 color) (font-color red)) ) - (set! (-> this strings 1 scale) 0.5) - (set! (-> this strings 1 flags) (font-flags shadow kerning large)) - (set-hud-piece-position! - (the-as hud-sprite (-> this strings 1 pos)) - 128 - (the int (+ (- 188.0 (the float s0-0)) (* -100.0 (-> this offset)))) + (let ((a0-7 sv-112)) + (set! (-> a0-7 flags) (font-flags kerning middle middle-vert large)) ) - (let ((s1-3 format)) - (set! sv-128 (clear (-> this strings 1 text))) - (let ((a1-7 (lookup-text! *common-text* (text-id text-0078) #f))) - (s1-3 sv-128 a1-7) + (let ((s0-0 80)) + (set-scale! sv-112 1.6) + (if (= (-> *setting-control* user-default language) (language-enum german)) + (set-scale! sv-112 1.0) + ) + (if (-> s1-0 player-win?) + (print-game-text + (lookup-text! *common-text* (text-id text-0076) #f) + sv-112 + #f + 44 + (bucket-id hud-draw-hud-alpha) + ) + (print-game-text + (lookup-text! *common-text* (text-id text-0077) #f) + sv-112 + #f + 44 + (bucket-id hud-draw-hud-alpha) + ) + ) + (set! (-> this strings 1 scale) 0.5) + (set! (-> this strings 1 flags) (font-flags shadow kerning large)) + (set-hud-piece-position! + (the-as hud-sprite (-> this strings 1 pos)) + 128 + (the int (+ (- 188.0 (the float s0-0)) (* -100.0 (-> this offset)))) + ) + (format (clear (-> this strings 1 text)) (lookup-text! *common-text* (text-id text-0078) #f)) + (set-hud-piece-position! + (the-as hud-sprite (-> this strings 2 pos)) + 384 + (the int (+ (- 188.0 (the float s0-0)) (* -100.0 (-> this offset)))) ) - ) - (set-hud-piece-position! - (the-as hud-sprite (-> this strings 2 pos)) - 384 - (the int (+ (- 188.0 (the float s0-0)) (* -100.0 (-> this offset)))) ) ) (set! (-> this strings 2 scale) 0.5) @@ -383,15 +374,11 @@ 5 (+ (* 28 s4-0) 40) ) - (let ((s1-5 format) - (s0-1 (clear (-> this strings s3-0 text))) - ) - (set! sv-144 "~S ~D") - (let ((a2-10 (lookup-text! *common-text* (text-id text-0079) #f)) - (a3-4 (+ s4-0 1)) - ) - (s1-5 s0-1 sv-144 a2-10 a3-4) - ) + (format + (clear (-> this strings s3-0 text)) + "~S ~D" + (lookup-text! *common-text* (text-id text-0079) #f) + (+ s4-0 1) ) (let ((s3-1 (+ s3-0 1))) (set! (-> this strings s3-1 scale) 0.5) diff --git a/test/decompiler/reference/jak3/levels/common/race/race-manager_REF.gc b/test/decompiler/reference/jak3/levels/common/race/race-manager_REF.gc index 528fef1acc..32389ed6b7 100644 --- a/test/decompiler/reference/jak3/levels/common/race/race-manager_REF.gc +++ b/test/decompiler/reference/jak3/levels/common/race/race-manager_REF.gc @@ -59,14 +59,10 @@ ) ) (vector-normalize! (-> this finish-dir) 1.0) - (let ((f0-16 (vector-vector-xz-distance-squared (-> this start-sphere) (-> this finish-sphere))) - (f1-1 409600.0) - ) - (when (< f0-16 (* f1-1 f1-1)) - (logior! (-> s5-0 flags) (race-mesh-flag rmf0)) - (vector-copy! (-> this finish-dir) (-> this start-dir)) - (set! (-> this finish-sphere quad) (-> this start-sphere quad)) - ) + (when (< (vector-vector-xz-distance-squared (-> this start-sphere) (-> this finish-sphere)) (square 409600.0)) + (logior! (-> s5-0 flags) (race-mesh-flag rmf0)) + (vector-copy! (-> this finish-dir) (-> this start-dir)) + (set! (-> this finish-sphere quad) (-> this start-sphere quad)) ) ) ) @@ -220,13 +216,11 @@ ((logtest? (-> this flags) (racer-state-flags rsf0)) (let ((v1-39 (new 'stack-no-clear 'inline-array 'vector 1))) (vector-! (-> v1-39 0) (-> this position) (the-as vector (-> arg0 info finish-sphere))) - (let ((f0-7 (vector-length-squared (-> v1-39 0))) - (f1-1 (-> arg0 info finish-sphere r)) - ) - (if (and (< f0-7 (* f1-1 f1-1)) (< 0.0 (vector-dot (-> v1-39 0) (-> arg0 info finish-dir)))) - (end-lap this arg0) - ) - ) + (if (and (< (vector-length-squared (-> v1-39 0)) (square (-> arg0 info finish-sphere r))) + (< 0.0 (vector-dot (-> v1-39 0) (-> arg0 info finish-dir))) + ) + (end-lap this arg0) + ) ) ) (else @@ -1017,47 +1011,49 @@ ;; definition for method 26 of type race-manager (defmethod save-score ((this race-manager) (arg0 int)) - (local-vars (sv-16 uint) (sv-20 float) (sv-24 symbol) (sv-32 int)) - (set! sv-16 (-> this race-state info score)) - (set! sv-20 (the float arg0)) - (set! sv-24 (the-as symbol #f)) - (set! sv-32 -1) - (when (nonzero? sv-16) - (let ((gp-0 (game-info-method-29 *game-info* (the-as int sv-16))) - (s5-0 (get-highscore-rank *game-info* (the-as int sv-16) sv-20)) - ) - (let ((s4-0 (* (the-as uint (max 0 (- s5-0 gp-0))) (the-as uint (if (= sv-16 3) - 6 - 3 - ) - ) - ) - ) - ) - (when (> s4-0 0) - (set! (-> this finish-sound-id) (the-as sound-id 1)) - (set! sv-24 #t) - (case s5-0 - ((3) - (talker-spawn-func (-> *talker-speech* 51) *entity-pool* (target-pos 0) (the-as region #f)) - ) - ((2) - (talker-spawn-func (-> *talker-speech* 52) *entity-pool* (target-pos 0) (the-as region #f)) - ) - ((1) - (talker-spawn-func (-> *talker-speech* 53) *entity-pool* (target-pos 0) (the-as region #f)) - ) - ) - ) - (set! sv-32 (game-info-method-27 *game-info* (the-as game-score sv-16) sv-20)) - (give *game-info* 'skill (the float s4-0) (the-as handle #f)) + (let ((sv-16 (-> this race-state info score)) + (sv-20 (the float arg0)) + (sv-24 (the-as symbol #f)) ) - (if (and (= s5-0 3) (= gp-0 3) (zero? sv-32)) - (set! sv-24 #t) + (let ((sv-32 -1)) + (when (nonzero? sv-16) + (let ((gp-0 (game-info-method-29 *game-info* (the-as int sv-16))) + (s5-0 (get-highscore-rank *game-info* (the-as int sv-16) sv-20)) + ) + (let ((s4-0 (* (the-as uint (max 0 (- s5-0 gp-0))) (the-as uint (if (= sv-16 3) + 6 + 3 + ) + ) + ) + ) + ) + (when (> s4-0 0) + (set! (-> this finish-sound-id) (the-as sound-id 1)) + (set! sv-24 #t) + (case s5-0 + ((3) + (talker-spawn-func (-> *talker-speech* 51) *entity-pool* (target-pos 0) (the-as region #f)) + ) + ((2) + (talker-spawn-func (-> *talker-speech* 52) *entity-pool* (target-pos 0) (the-as region #f)) + ) + ((1) + (talker-spawn-func (-> *talker-speech* 53) *entity-pool* (target-pos 0) (the-as region #f)) + ) + ) + ) + (set! sv-32 (game-info-method-27 *game-info* (the-as game-score sv-16) sv-20)) + (give *game-info* 'skill (the float s4-0) (the-as handle #f)) + ) + (if (and (= s5-0 3) (= gp-0 3) (zero? sv-32)) + (set! sv-24 #t) + ) ) + ) ) + sv-24 ) - sv-24 ) ;; definition for method 27 of type race-manager diff --git a/test/decompiler/reference/jak3/levels/common/race/race-mesh_REF.gc b/test/decompiler/reference/jak3/levels/common/race/race-mesh_REF.gc index 553d4850ec..526f1e5af1 100644 --- a/test/decompiler/reference/jak3/levels/common/race/race-mesh_REF.gc +++ b/test/decompiler/reference/jak3/levels/common/race/race-mesh_REF.gc @@ -414,26 +414,19 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defmethod draw-path-debug ((this race-path) (arg0 rgba) (arg1 rgba)) - (local-vars (sv-32 vector) (sv-48 race-path-sample)) (let ((s0-0 0) (s3-0 1) (s2-0 (+ (-> this sample-count) -1)) (s1-0 (new 'stack-no-clear 'vector)) ) - (set! sv-32 s1-0) - (let ((v1-1 (-> (math-camera-pos) quad))) - (set! (-> sv-32 quad) v1-1) - ) + (vector-copy! s1-0 (math-camera-pos)) (while (< s0-0 (the-as int s2-0)) - (let ((s0-1 (-> this samples s0-0))) - (set! sv-48 (-> this samples s3-0)) - (let ((f0-0 (vector-vector-distance-squared (-> s0-1 pos) s1-0)) - (f1-0 819200.0) - ) - (if (< f0-0 (* f1-0 f1-0)) - (add-debug-line #t (bucket-id debug) (-> s0-1 pos) (-> sv-48 pos) arg0 #f arg1) - ) - ) + (let ((s0-1 (-> this samples s0-0)) + (sv-48 (-> this samples s3-0)) + ) + (if (< (vector-vector-distance-squared (-> s0-1 pos) s1-0) (square 819200.0)) + (add-debug-line #t (bucket-id debug) (-> s0-1 pos) (-> sv-48 pos) arg0 #f arg1) + ) ) (set! s0-0 s3-0) (set! s3-0 (min (+ s3-0 1) (the-as int s2-0))) diff --git a/test/decompiler/reference/jak3/levels/desert/artifact-race/artifact-race_REF.gc b/test/decompiler/reference/jak3/levels/desert/artifact-race/artifact-race_REF.gc index 4099932f26..7291a7639b 100644 --- a/test/decompiler/reference/jak3/levels/desert/artifact-race/artifact-race_REF.gc +++ b/test/decompiler/reference/jak3/levels/desert/artifact-race/artifact-race_REF.gc @@ -148,9 +148,8 @@ ) (let ((f0-1 (vector-vector-xz-distance-squared (-> this root trans) s5-0)) (f1-2 (fabs (- (-> s5-0 y) (-> this root trans y)))) - (f2-2 (+ 8192.0 (-> s5-0 w))) ) - (when (and (>= (* f2-2 f2-2) f0-1) (< f1-2 32768.0)) + (when (and (>= (square (+ 8192.0 (-> s5-0 w))) f0-1) (< f1-2 32768.0)) (sound-play "artifact-pickup") (+! (-> *game-info* counter) -1.0) (go (method-of-object this die)) @@ -839,7 +838,6 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch object vs none. (defmethod set-time-limit ((this task-manager-desert-artifact-race)) - (local-vars (sv-16 res-tag)) (let ((t9-0 (method-of-type task-manager set-time-limit))) (t9-0 this) ) @@ -897,8 +895,9 @@ ) (let ((a0-18 (-> this ent))) (when a0-18 - (set! sv-16 (new 'static 'res-tag)) - (let ((s5-0 (res-lump-data a0-18 'actor-groups (pointer actor-group) :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (s5-0 (res-lump-data a0-18 'actor-groups (pointer actor-group) :tag-ptr (& sv-16))) + ) (cond ((and s5-0 (nonzero? (-> sv-16 elt-count))) (set! (-> this max-count) (-> s5-0 0 length)) @@ -979,9 +978,7 @@ ) (until (or v1-40 (and *target* (focus-test? *target* pilot))) (suspend) - (let ((f0-6 143360.0)) - (set! v1-40 (< (* f0-6 f0-6) (vector-vector-distance-squared (-> self begin-pos) (target-pos 0)))) - ) + (set! v1-40 (< (square 143360.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/jak3/levels/desert/boss/deswalk-obs_REF.gc b/test/decompiler/reference/jak3/levels/desert/boss/deswalk-obs_REF.gc index 307bb252cb..3403dbbd71 100644 --- a/test/decompiler/reference/jak3/levels/desert/boss/deswalk-obs_REF.gc +++ b/test/decompiler/reference/jak3/levels/desert/boss/deswalk-obs_REF.gc @@ -764,7 +764,7 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defmethod ragdoll-method-19 ((this dm-tentacle-ragdoll) (arg0 vector) (arg1 int) (arg2 object) (arg3 matrix)) - (local-vars (f30-0 float) (sv-48 vector)) + (local-vars (f30-0 float)) (rlet ((vf0 :class vf)) (init-vf0-vector) (let ((a0-1 (-> this ragdoll-joints arg1))) @@ -809,14 +809,7 @@ (+ (- f0-13 (* (the float (the int (/ f0-13 65536.0))) 65536.0)) (* 3640.889 (the float (-> this chain-pos)))) ) ) - (let ((s1-0 arg0) - (s0-0 arg0) - ) - (set! sv-48 (-> arg3 rvec)) - (let ((f0-16 (* f30-0 (cos f28-0)))) - (vector+float*! s1-0 s0-0 sv-48 f0-16) - ) - ) + (vector+float*! arg0 arg0 (-> arg3 rvec) (* f30-0 (cos f28-0))) (vector+float*! arg0 arg0 (-> arg3 fvec) (* f30-0 (sin f28-0))) ) ) @@ -949,23 +942,17 @@ ) (set! (-> self ragdoll mode) (the-as uint 3)) ) - (else - (let ((f0-0 81920.0)) - (cond - ((< (* f0-0 f0-0) - (vector-vector-xz-distance-squared (target-pos 0) (-> self ragdoll ragdoll-joints 0 position)) - ) - (set! (-> self ragdoll mode) (the-as uint 0)) - 0 - ) - (else - (if (zero? (-> self ragdoll mode)) - (sound-play "snake-twist" :position (-> self ragdoll ragdoll-joints 0 position)) - ) - (set! (-> self ragdoll mode) (the-as uint 1)) - ) - ) + ((< (square 81920.0) + (vector-vector-xz-distance-squared (target-pos 0) (-> self ragdoll ragdoll-joints 0 position)) ) + (set! (-> self ragdoll mode) (the-as uint 0)) + 0 + ) + (else + (if (zero? (-> self ragdoll mode)) + (sound-play "snake-twist" :position (-> self ragdoll ragdoll-joints 0 position)) + ) + (set! (-> self ragdoll mode) (the-as uint 1)) ) ) (cond @@ -2270,50 +2257,25 @@ (remove-setting! 'target-height) ) :trans (behavior () - (local-vars (sv-16 float) (sv-32 meters)) (cond ((desw-snake-stump-should-be-up?) (ja :num! (seek! max 0.5)) (rider-trans) (rider-post) - (cond - ((< (ja-aframe-num 0) 6.0) - (let* ((gp-0 *setting-control*) - (s5-0 (method-of-object gp-0 set-setting)) - (s4-0 self) - (s3-0 'target-height) - (s2-0 'abs) - (s1-0 lerp-scale) - (s0-0 (-> *CAMERA_MASTER-bank* target-height)) - ) - (set! sv-16 (the-as float 14336.0)) - (let ((a2-1 (ja-aframe-num 0)) - (a3-0 2.0) - (t0-0 6.0) - ) - (s5-0 gp-0 s4-0 s3-0 s2-0 (s1-0 s0-0 sv-16 a2-1 a3-0 t0-0) 0) - ) - ) - ) - (else - (let* ((gp-1 *setting-control*) - (s5-1 (method-of-object gp-1 set-setting)) - (s4-1 self) - (s3-1 'target-height) - (s2-1 'abs) - (s1-1 lerp-scale) - (s0-1 14336.0) - ) - (set! sv-32 (-> *CAMERA_MASTER-bank* target-height)) - (let ((a2-3 (ja-aframe-num 0)) - (a3-2 11.0) - (t0-2 15.0) - ) - (s5-1 gp-1 s4-1 s3-1 s2-1 (s1-1 s0-1 sv-32 a2-3 a3-2 t0-2) 0) - ) + (if (< (ja-aframe-num 0) 6.0) + (set-setting! + 'target-height + 'abs + (lerp-scale (-> *CAMERA_MASTER-bank* target-height) (the-as float 14336.0) (ja-aframe-num 0) 2.0 6.0) + 0 + ) + (set-setting! + 'target-height + 'abs + (lerp-scale 14336.0 (-> *CAMERA_MASTER-bank* target-height) (ja-aframe-num 0) 11.0 15.0) + 0 ) ) - ) (if (ja-done? 0) (go-virtual up) ) @@ -2343,7 +2305,6 @@ ;; INFO: Used lq/sq (defmethod init-from-entity! ((this desw-snake-stump) (arg0 entity-actor)) "Set up a newly created process from the entity that created it." - (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) @@ -2374,8 +2335,9 @@ (the-as pair 0) ) (set! (-> this actor-group-count) 0) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-22 (res-lump-data arg0 'actor-groups pointer :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-22 (res-lump-data arg0 'actor-groups pointer :tag-ptr (& sv-16))) + ) (cond ((and v1-22 (nonzero? (-> sv-16 elt-count))) (set! (-> this actor-group-count) (the-as int (-> sv-16 elt-count))) diff --git a/test/decompiler/reference/jak3/levels/desert/boss/terraformer-drone_REF.gc b/test/decompiler/reference/jak3/levels/desert/boss/terraformer-drone_REF.gc index 42f0975678..6d698c35c1 100644 --- a/test/decompiler/reference/jak3/levels/desert/boss/terraformer-drone_REF.gc +++ b/test/decompiler/reference/jak3/levels/desert/boss/terraformer-drone_REF.gc @@ -753,13 +753,11 @@ ) (let ((a0-6 (handle->process (-> this focus handle)))) (when a0-6 - (let ((f0-3 (vector-vector-distance-squared (-> this root trans) (get-trans (the-as process-focusable a0-6) 0))) - (f1-2 (* 18432.0 (-> this root scale x))) - ) - (if (< f0-3 (* f1-2 f1-2)) - (go (method-of-object this explode)) - ) - ) + (if (< (vector-vector-distance-squared (-> this root trans) (get-trans (the-as process-focusable a0-6) 0)) + (square (* 18432.0 (-> this root scale x))) + ) + (go (method-of-object this explode)) + ) ) ) (cond @@ -1145,19 +1143,11 @@ ) 0 ) + ((< (vector-vector-xz-distance-squared (-> self zigzag-target) (-> self root trans)) (square 40960.0)) + (set! (-> self zigzag-timer) 0) + 0 + ) (else - (let ((f0-9 (vector-vector-xz-distance-squared (-> self zigzag-target) (-> self root trans))) - (f1-3 40960.0) - ) - (cond - ((< f0-9 (* f1-3 f1-3)) - (set! (-> self zigzag-timer) 0) - 0 - ) - (else - ) - ) - ) ) ) ) diff --git a/test/decompiler/reference/jak3/levels/desert/boss/terraformer-head_REF.gc b/test/decompiler/reference/jak3/levels/desert/boss/terraformer-head_REF.gc index 65f47ebdb8..000777f022 100644 --- a/test/decompiler/reference/jak3/levels/desert/boss/terraformer-head_REF.gc +++ b/test/decompiler/reference/jak3/levels/desert/boss/terraformer-head_REF.gc @@ -1046,7 +1046,6 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defbehavior terraformer-head-always terraformer-head ((arg0 symbol) (arg1 float)) - (local-vars (sv-320 int)) (if (and *target* (focus-test? *target* hit)) (terraformer-head-play-speech 2 self) (terraformer-head-play-speech 0 self) @@ -1153,17 +1152,10 @@ ) (logior! (-> self flags) (terraformer-head-flag laser)) (when (not (logtest? (-> self flags) (terraformer-head-flag laser-sound-playing laser-warmup-sound-playing))) - (let ((s5-2 sound-play-by-name) - (sname (static-sound-name "laser-charge")) - (s3-2 (-> self warmup-sound-id)) - (s2-0 1024) - (s1-0 0) - (s0-0 0) - ) - (set! sv-320 0) - (let ((t2-1 (vector<-cspace! (new 'stack-no-clear 'vector) (joint-node terraformer-head-lod0-jg gun_main)))) - (s5-2 (the-as sound-name sname) s3-2 s2-0 s1-0 s0-0 (the-as sound-group sv-320) t2-1) - ) + (sound-play + "laser-charge" + :id (-> self warmup-sound-id) + :position (vector<-cspace! (new 'stack-no-clear 'vector) (joint-node terraformer-head-lod0-jg gun_main)) ) (logior! (-> self flags) (terraformer-head-flag laser-warmup-sound-playing)) ) @@ -2832,7 +2824,6 @@ ;; INFO: Used lq/sq (defmethod init-from-entity! ((this terraformer-head) (arg0 entity-actor)) "Set up a newly created process from the entity that created it." - (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 38) 0))) (set! (-> s4-0 total-prims) (the-as uint 39)) @@ -3153,12 +3144,13 @@ (set! (-> this very-vulnerable-timer) 0) (set! (-> this flags) (terraformer-head-flag)) (set! (-> this actor-group-count) 0) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-127 (res-lump-data arg0 'actor-groups pointer :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-127 (res-lump-data arg0 'actor-groups (pointer actor-group) :tag-ptr (& sv-16))) + ) (cond ((and v1-127 (nonzero? (-> sv-16 elt-count))) (set! (-> this actor-group-count) (the-as int (-> sv-16 elt-count))) - (set! (-> this actor-group) (the-as (pointer actor-group) v1-127)) + (set! (-> this actor-group) v1-127) ) (else (format 0 "ERROR: ~S: entity missing actor-group!~%" (-> this name)) @@ -3193,3 +3185,7 @@ (set! (-> this warmup-sound-id) (new-sound-id)) (go (method-of-object this initial-state)) ) + + + + diff --git a/test/decompiler/reference/jak3/levels/desert/boss/terraformer-setup_REF.gc b/test/decompiler/reference/jak3/levels/desert/boss/terraformer-setup_REF.gc index 26641d4122..1af9493673 100644 --- a/test/decompiler/reference/jak3/levels/desert/boss/terraformer-setup_REF.gc +++ b/test/decompiler/reference/jak3/levels/desert/boss/terraformer-setup_REF.gc @@ -134,13 +134,9 @@ (vector-float*! (-> gp-0 move-dist) s3-1 -2.0) (let ((s3-2 (new 'stack-no-clear 'collide-query))) (let ((a1-20 (new 'stack-no-clear 'bounding-box))) - (let* ((f0-21 409.6) - (f1-9 3072.0) - (f1-11 (* f1-9 f1-9)) - (f2-0 10240.0) - (f0-22 (+ f0-21 (sqrtf (+ f1-11 (* f2-0 f2-0))))) - (v1-38 (new 'stack-no-clear 'vector)) - ) + (let ((f0-22 (+ 409.6 (sqrtf (+ (square 3072.0) (square 10240.0))))) + (v1-38 (new 'stack-no-clear 'vector)) + ) (set-vector! v1-38 f0-22 f0-22 f0-22 1.0) (vector+! (-> a1-20 max) (-> s5-0 collision-pt) v1-38) (vector-! (-> a1-20 min) (-> s5-0 collision-pt) v1-38) @@ -1487,17 +1483,16 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch sound-id vs object. (defbehavior foot-impact terraformer-leg () - (local-vars (sv-256 entity-actor) (sv-272 entity-actor)) (set-zero! *camera-smush-control*) - (let* ((gp-0 lerp-scale) - (s5-0 3686.4) - (s4-0 0.0) - (a2-0 (vector-vector-distance-squared (-> self foot-lock old-position) (target-pos 0))) - (f0-0 204800.0) - (a3-0 (* f0-0 f0-0)) - (f0-2 1024000.0) - (f0-4 (gp-0 s5-0 s4-0 a2-0 a3-0 (* f0-2 f0-2))) - ) + (let ((f0-4 (lerp-scale + 3686.4 + 0.0 + (vector-vector-distance-squared (-> self foot-lock old-position) (target-pos 0)) + (square 204800.0) + (square 1024000.0) + ) + ) + ) (activate! *camera-smush-control* f0-4 75 600 1.1 1.07 (-> *display* camera-clock)) ) (let ((gp-1 (new 'stack-no-clear 'vector))) @@ -1581,26 +1576,14 @@ (let ((t9-24 (method-of-type manipy activate))) (t9-24 s3-4 self "manipy" (the-as pointer #x70004000)) ) - (let ((s4-6 run-function-in-process) - (s2-1 s3-4) - (s1-0 manipy-init) - (s0-0 gp-1) - ) - (set! sv-256 (-> self entity)) - (let ((t0-3 (art-group-get-by-name *level* "skel-bomb-blast" (the-as (pointer level) #f))) - (t1-2 #f) - (t2-2 0) - ) - ((the-as (function object object object object object object object none) s4-6) - s2-1 - s1-0 - s0-0 - sv-256 - t0-3 - t1-2 - t2-2 - ) - ) + (run-now-in-process + s3-4 + manipy-init + gp-1 + (-> self entity) + (art-group-get-by-name *level* "skel-bomb-blast" (the-as (pointer level) #f)) + #f + 0 ) (-> s3-4 ppointer) ) @@ -1648,36 +1631,20 @@ ) ) ) - (let* ((s3-5 (get-process *default-dead-pool* manipy #x20000 1)) - (s4-7 (when s3-5 - (let ((t9-32 (method-of-type manipy activate))) - (t9-32 (the-as manipy s3-5) self "manipy" (the-as pointer #x70004000)) - ) - (let ((s4-8 run-function-in-process) - (s2-2 s3-5) - (s1-1 manipy-init) - (s0-1 gp-1) - ) - (set! sv-272 (-> self entity)) - (let ((t0-4 (art-group-get-by-name *level* "skel-generic-blast" (the-as (pointer level) #f))) - (t1-3 #f) - (t2-3 0) - ) - ((the-as (function object object object object object object object none) s4-8) - s2-2 - s1-1 - s0-1 - sv-272 - t0-4 - t1-3 - t2-3 - ) - ) - ) - (-> s3-5 ppointer) - ) - ) - ) + (let ((s4-7 (process-spawn + manipy + :init manipy-init + gp-1 + (-> self entity) + (art-group-get-by-name *level* "skel-generic-blast" (the-as (pointer level) #f)) + #f + 0 + :name "manipy" + :to self + :stack-size #x20000 + ) + ) + ) (when s4-7 (send-event (ppointer->process s4-7) 'rot-quat s5-1) (send-event (ppointer->process s4-7) 'anim-mode 'play1) @@ -1749,7 +1716,6 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs object. (defbehavior terraformer-leg-update-ik terraformer-leg () - (local-vars (sv-720 int)) (let ((gp-0 (new 'stack-no-clear 'vector))) (cond ((nonzero? (-> self joint-ik)) @@ -1779,17 +1745,9 @@ (else (when (< (terraformer-leg-frames-till-down) 12.0) (set! (-> self last-effect) 0) - (let ((s5-2 sound-play-by-name) - (s4-1 (make-u128 (the-as uint #x6e642d6f7672) (the-as uint #x65732d746e696f6a))) - (s3-0 (new-sound-id)) - (s2-0 1024) - (s1-0 0) - (s0-0 0) - ) - (set! sv-720 0) - (let ((t2-1 (vector<-cspace! (new 'stack-no-clear 'vector) (-> self node-list data 6)))) - (s5-2 (the-as sound-name s4-1) s3-0 s2-0 s1-0 s0-0 (the-as sound-group sv-720) t2-1) - ) + (sound-play + "joint-servo-dn" + :position (vector<-cspace! (new 'stack-no-clear 'vector) (-> self node-list data 6)) ) ) ) @@ -1963,13 +1921,9 @@ ) (vector-! s4-0 (-> (the-as process-drawable s5-0) root trans) s4-0) (set! (-> s4-0 y) 0.0) - (let ((f0-1 (vector-length-squared s4-0)) - (f1-0 1.0) - ) - (if (< f0-1 (* f1-0 f1-0)) - (set! (-> s4-0 x) 1.0) - ) - ) + (if (< (vector-length-squared s4-0) (square 1.0)) + (set! (-> s4-0 x) 1.0) + ) (vector-normalize! s4-0 1.0) (set! (-> s4-0 y) 0.3) (vector-float*! s4-0 s4-0 4096.0) @@ -2323,11 +2277,9 @@ (dotimes (s3-0 s5-0) (let ((s2-0 (handle->process (-> self mines s3-0)))) (when (and (the-as terraformer-mine s2-0) - (let ((f0-0 (vector-vector-distance-squared (-> s4-0 root trans) (-> (the-as terraformer-mine s2-0) root trans))) - (f1-0 32768.0) - ) - (< f0-0 (* f1-0 f1-0)) - ) + (< (vector-vector-distance-squared (-> s4-0 root trans) (-> (the-as terraformer-mine s2-0) root trans)) + (square 32768.0) + ) ) (send-event s4-0 'explode) (send-event s2-0 'explode) @@ -2357,11 +2309,9 @@ ) ) ) - (let ((s5-3 (vector<-cspace! (new 'stack-no-clear 'vector) (joint-node terraformer-lod0-jg main))) - (f0-1 1433600.0) - ) + (let ((s5-3 (vector<-cspace! (new 'stack-no-clear 'vector) (joint-node terraformer-lod0-jg main)))) (cond - ((< (* f0-1 f0-1) (vector-vector-distance-squared s5-3 (target-pos 0))) + ((< (square 1433600.0) (vector-vector-distance-squared s5-3 (target-pos 0))) (set! (-> self mines-to-launch) 0) (set! v0-11 (current-time)) (set! (-> self mine-timer) (the-as time-frame v0-11)) @@ -2622,21 +2572,17 @@ (terraformer-update-mine-vars #f) (when (-> self graph) (let ((gp-0 (-> self graph node (-> self current-node)))) - (let ((f0-1 (vector-vector-distance-squared (-> self root trans) (-> gp-0 position))) - (f1-0 2048.0) + (when (< (vector-vector-distance-squared (-> self root trans) (-> gp-0 position)) (square 2048.0)) + (cond + ((> (-> gp-0 edge-count) 0) + (set! (-> self current-node) (-> self graph edge (-> gp-0 edge-index) dest-node-id)) + ) + (else + (set! (-> self current-node) (the-as uint 0)) + 0 ) - (when (< f0-1 (* f1-0 f1-0)) - (cond - ((> (-> gp-0 edge-count) 0) - (set! (-> self current-node) (-> self graph edge (-> gp-0 edge-index) dest-node-id)) - ) - (else - (set! (-> self current-node) (the-as uint 0)) - 0 - ) - ) - (set! gp-0 (-> self graph node (-> self current-node))) ) + (set! gp-0 (-> self graph node (-> self current-node))) ) (vector-seek! (-> self root trans) (-> gp-0 position) 2048.0) (let ((s5-0 (quaternion->matrix (new 'stack-no-clear 'matrix) (-> self root quat))) diff --git a/test/decompiler/reference/jak3/levels/desert/chase/desert-chase_REF.gc b/test/decompiler/reference/jak3/levels/desert/chase/desert-chase_REF.gc index 1ee02bc56d..7fc800a4df 100644 --- a/test/decompiler/reference/jak3/levels/desert/chase/desert-chase_REF.gc +++ b/test/decompiler/reference/jak3/levels/desert/chase/desert-chase_REF.gc @@ -576,9 +576,7 @@ (send-event (handle->process gp-5) 'ai-set-target-speed 122880.0) (send-event (handle->process gp-5) 'ai-set-target-position *stronghold-vehicle-stop-point*) ) - (while (let ((f0-1 81920.0)) - (< (* f0-1 f0-1) (vector-vector-distance-squared (target-pos 0) *stronghold-vehicle-stop-point*)) - ) + (while (< (square 81920.0) (vector-vector-distance-squared (target-pos 0) *stronghold-vehicle-stop-point*)) (suspend) ) (process-spawn @@ -1042,10 +1040,8 @@ (vector-copy! s5-0 (-> a1-4 root root-prim prim-core world-sphere)) ) ) - (let ((f0-1 (vector-vector-distance-squared (-> this root trans) s5-0)) - (f1-1 (+ 12288.0 (-> s5-0 w))) - ) - (when (>= (* f1-1 f1-1) f0-1) + (let ((f0-1 (vector-vector-distance-squared (-> this root trans) s5-0))) + (when (>= (square (+ 12288.0 (-> s5-0 w))) f0-1) (sound-play "artifact-pickup") (deactivate this) ) @@ -1291,11 +1287,8 @@ (defmethod deschase-vehicle-control-method-10 ((this deschase-vehicle-control)) (let ((v1-3 (as-type (handle->process (-> this vehicle)) process-focusable))) (when v1-3 - (let* ((s5-1 (-> this path node (-> this i-node))) - (f0-0 (vector-vector-distance-squared (-> v1-3 root trans) (-> s5-1 position))) - (f1-0 40960.0) - ) - (when (< f0-0 (* f1-0 f1-0)) + (let ((s5-1 (-> this path node (-> this i-node)))) + (when (< (vector-vector-distance-squared (-> v1-3 root trans) (-> s5-1 position)) (square 40960.0)) (let ((v1-7 (-> s5-1 next-node))) (if (!= v1-7 -1) (set! (-> this i-node) v1-7) diff --git a/test/decompiler/reference/jak3/levels/desert/chase/desert-jump_REF.gc b/test/decompiler/reference/jak3/levels/desert/chase/desert-jump_REF.gc index d7129bfb56..cd50618c7e 100644 --- a/test/decompiler/reference/jak3/levels/desert/chase/desert-jump_REF.gc +++ b/test/decompiler/reference/jak3/levels/desert/chase/desert-jump_REF.gc @@ -362,10 +362,8 @@ (vector-copy! s5-0 (-> a1-4 root root-prim prim-core world-sphere)) ) ) - (let ((f0-1 (vector-vector-distance-squared (-> this root trans) s5-0)) - (f1-1 (+ 12288.0 (-> s5-0 w))) - ) - (when (>= (* f1-1 f1-1) f0-1) + (let ((f0-1 (vector-vector-distance-squared (-> this root trans) s5-0))) + (when (>= (square (+ 12288.0 (-> s5-0 w))) f0-1) (talker-spawn-func (-> *talker-speech* 128) *entity-pool* (target-pos 0) (the-as region #f)) (send-event (handle->process (-> this arrow)) 'die) (go (method-of-object this die)) @@ -790,12 +788,7 @@ (('notify) (when (= (-> arg3 param 0) 'attack) (let ((v1-2 (as-type arg0 projectile))) - (if (and v1-2 (let ((f0-0 (vector-vector-distance-squared (-> v1-2 root trans) *desjump-wasdoors-pos*)) - (f1-0 20480.0) - ) - (< f0-0 (* f1-0 f1-0)) - ) - ) + (if (and v1-2 (< (vector-vector-distance-squared (-> v1-2 root trans) *desjump-wasdoors-pos*) (square 20480.0))) (damage-airlock this 1) ) ) @@ -1062,10 +1055,7 @@ (s2-1 (= (+ (length (-> *desjump-vehicle-path* (-> s4-1 path-type))) -1) (-> s4-1 path-pos))) ) (let ((f30-0 (vector-vector-distance-squared (-> s1-0 pos) (-> s3-0 root trans)))) - (when (and (not s2-1) (let ((f0-1 81920.0)) - (< f30-0 (* f0-1 f0-1)) - ) - ) + (when (and (not s2-1) (< f30-0 (square 81920.0))) (+! (-> s4-1 path-pos) 1) (send-event s3-0 @@ -1077,12 +1067,7 @@ (send-event s3-0 'ai-set-target-process *target*) ) ) - (when (and s2-1 - (let ((f0-4 122880.0)) - (< f30-0 (* f0-4 f0-4)) - ) - (not (-> s4-1 ready?)) - ) + (when (and s2-1 (< f30-0 (square 122880.0)) (not (-> s4-1 ready?))) (send-event s3-0 'ai-set-mode 0) (send-event s3-0 'ai-set-target-speed 0) (set-time! (-> s4-1 wait-timer)) @@ -1140,10 +1125,7 @@ ) (cond ((-> s3-1 kamikaze?) - (when (and (not s2-3) (let ((f1-3 81920.0)) - (< f0-9 (* f1-3 f1-3)) - ) - ) + (when (and (not s2-3) (< f0-9 (square 81920.0))) (+! (-> s3-1 path-pos) 1) (send-event s4-3 diff --git a/test/decompiler/reference/jak3/levels/desert/chase/wcar-catapult_REF.gc b/test/decompiler/reference/jak3/levels/desert/chase/wcar-catapult_REF.gc index 6de559337d..03e1a16506 100644 --- a/test/decompiler/reference/jak3/levels/desert/chase/wcar-catapult_REF.gc +++ b/test/decompiler/reference/jak3/levels/desert/chase/wcar-catapult_REF.gc @@ -1576,14 +1576,10 @@ ) ) (((projectile-options po0 po1)) - (let ((f0-0 (vector-vector-distance-squared (-> this self root trans) (-> this desired-target-pos))) - (f1-0 614400.0) - ) - (when (< f0-0 (* f1-0 f1-0)) - (let ((a0-9 (static-sound-spec "incoming" :group 0 :volume 0.0))) - (set! (-> a0-9 volume) 1024) - (sound-play-by-spec a0-9 (-> this sound-id) (-> this root trans)) - ) + (when (< (vector-vector-distance-squared (-> this self root trans) (-> this desired-target-pos)) (square 614400.0)) + (let ((a0-9 (static-sound-spec "incoming" :group 0 :volume 0.0))) + (set! (-> a0-9 volume) 1024) + (sound-play-by-spec a0-9 (-> this sound-id) (-> this root trans)) ) ) ) diff --git a/test/decompiler/reference/jak3/levels/desert/des-bush_REF.gc b/test/decompiler/reference/jak3/levels/desert/des-bush_REF.gc index c9b8a59886..2d77fd048f 100644 --- a/test/decompiler/reference/jak3/levels/desert/des-bush_REF.gc +++ b/test/decompiler/reference/jak3/levels/desert/des-bush_REF.gc @@ -626,7 +626,6 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defmethod set-time-limit ((this task-manager-desert-bbush-ring)) - (local-vars (sv-16 res-tag)) (let ((t9-0 (method-of-type task-manager set-time-limit))) (t9-0 this) ) @@ -638,13 +637,14 @@ (let ((a0-8 (entity-by-name (get-mgr-name this)))) (when a0-8 (set! (-> this entity) (the-as entity-actor a0-8)) - (set! sv-16 (new 'static 'res-tag)) - (let ((s5-2 (res-lump-data a0-8 'actor-groups pointer :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (s5-2 (res-lump-data a0-8 'actor-groups (pointer actor-group) :tag-ptr (& sv-16))) + ) (format 0 "elt-count: ~d" (-> sv-16 elt-count)) (cond ((and s5-2 (nonzero? (-> sv-16 elt-count))) (set! (-> this actor-group-count) (the-as int (-> sv-16 elt-count))) - (set! (-> this actor-group) (the-as (pointer actor-group) s5-2)) + (set! (-> this actor-group) s5-2) ) (else (format 0 "ERROR: ~s: entity missing actor-group!~%" (game-task->string (-> this node-info task))) @@ -1648,7 +1648,6 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch float vs none. (defmethod set-time-limit ((this task-manager-bbush-egg-spider)) - (local-vars (sv-16 res-tag)) (let ((t9-0 (method-of-type task-manager set-time-limit))) (t9-0 this) ) @@ -1670,12 +1669,13 @@ (set! (-> this goal-score) (res-lump-value s5-0 'goal-score uint :default (the-as uint128 80) :time -1000000000.0) ) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-20 (res-lump-data s5-0 'actor-groups pointer :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-20 (res-lump-data s5-0 'actor-groups (pointer actor-group) :tag-ptr (& sv-16))) + ) (cond ((and v1-20 (nonzero? (-> sv-16 elt-count))) (set! (-> this actor-group-count) (the-as int (-> sv-16 elt-count))) - (set! (-> this actor-group) (the-as (pointer actor-group) v1-20)) + (set! (-> this actor-group) v1-20) ) (else (format 0 "ERROR: ~s: entity missing actor-group!~%" (game-task->string (-> this node-info task))) @@ -1924,7 +1924,6 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch object vs none. (defmethod set-time-limit ((this task-manager-bbush-spirit-chase)) - (local-vars (sv-16 res-tag)) (let ((t9-0 (method-of-type task-manager set-time-limit))) (t9-0 this) ) @@ -1942,12 +1941,13 @@ (set! (-> this start-offset-vel) (res-lump-float s5-2 'start-offset-vel :default 20480.0)) (format #t "new-vel: ~f~%" (/ (-> this start-offset-vel) METER_LENGTH)) (set! (-> this entity) (the-as entity-actor s5-2)) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-19 (res-lump-data s5-2 'actor-groups pointer :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-19 (res-lump-data s5-2 'actor-groups (pointer actor-group) :tag-ptr (& sv-16))) + ) (cond ((and v1-19 (nonzero? (-> sv-16 elt-count))) (set! (-> this actor-group-count) (the-as int (-> sv-16 elt-count))) - (set! (-> this actor-group) (the-as (pointer actor-group) v1-19)) + (set! (-> this actor-group) v1-19) ) (else (format 0 "ERROR: ~s: entity missing actor-group!~%" (game-task->string (-> this node-info task))) @@ -1983,7 +1983,6 @@ (set! (-> self current-curve-distance) 0.0) ) :trans (behavior () - (local-vars (sv-240 vector) (sv-256 vector) (sv-272 vector)) (rlet ((vf0 :class vf) (vf1 :class vf) (vf2 :class vf) @@ -2006,8 +2005,8 @@ (let ((s2-0 s4-0) (s1-0 (method-of-type cubic-curve cubic-curve-method-9)) (s0-0 (-> s3-0 trans)) + (sv-240 (new 'stack-no-clear 'vector)) ) - (set! sv-240 (new 'stack-no-clear 'vector)) (let ((v0-1 (vector-z-quaternion! (new 'stack-no-clear 'vector) (-> s3-0 quat))) (f0-3 204800.0) ) @@ -2019,20 +2018,22 @@ (.add.x.vf.w vf1 vf0 vf0) (.mul.x.vf.xyz vf1 vf1 vf2) (.svf (&-> sv-240 quad) vf1) - (set! sv-256 (-> s5-0 trans)) - (set! sv-272 (new 'stack-no-clear 'vector)) - (let ((v0-2 (vector-z-quaternion! (new 'stack-no-clear 'vector) (-> s5-0 quat))) - (f0-4 204800.0) + (let ((sv-256 (-> s5-0 trans)) + (sv-272 (new 'stack-no-clear 'vector)) + ) + (let ((v0-2 (vector-z-quaternion! (new 'stack-no-clear 'vector) (-> s5-0 quat))) + (f0-4 204800.0) + ) + (.lvf vf1 (&-> v0-2 quad)) + (let ((v1-19 f0-4)) + (.mov vf2 v1-19) ) - (.lvf vf1 (&-> v0-2 quad)) - (let ((v1-19 f0-4)) - (.mov vf2 v1-19) ) + (.add.x.vf.w vf1 vf0 vf0) + (.mul.x.vf.xyz vf1 vf1 vf2) + (.svf (&-> sv-272 quad) vf1) + (s1-0 s2-0 s0-0 sv-240 sv-256 sv-272) ) - (.add.x.vf.w vf1 vf0 vf0) - (.mul.x.vf.xyz vf1 vf1 vf2) - (.svf (&-> sv-272 quad) vf1) - (s1-0 s2-0 s0-0 sv-240 sv-256 sv-272) ) (set! (-> self current-curve-length) (vector-vector-distance (-> s3-0 trans) (-> s5-0 trans))) (cubic-curve-method-10 s4-0 (-> self trans) (- (-> self path-pos) (the float gp-0))) @@ -2084,22 +2085,16 @@ (send-event self 'complete) ) ) - (let ((f0-36 (-> self fail-radius))) - (if (< (* f0-36 f0-36) (vector-vector-distance-squared (target-pos 0) (-> self trans))) - (send-event self 'fail) - ) - ) + (if (< (square (-> self fail-radius)) (vector-vector-distance-squared (target-pos 0) (-> self trans))) + (send-event self 'fail) + ) ) (else (set-time! (-> self state-time)) - (let ((f0-39 (vector-vector-distance-squared (target-pos 0) (-> self trans))) - (f1-23 20480.0) - ) - (when (< f0-39 (* f1-23 f1-23)) - (set! (-> self touched) #t) - (sound-play "start-pickup") - (send-event (handle->process (-> self spirit)) 'play-pixie) - ) + (when (< (vector-vector-distance-squared (target-pos 0) (-> self trans)) (square 20480.0)) + (set! (-> self touched) #t) + (sound-play "start-pickup") + (send-event (handle->process (-> self spirit)) 'play-pixie) ) (if (< 409600.0 (vector-vector-distance (target-pos 0) (-> self trans))) (send-event self 'fail) @@ -2715,24 +2710,20 @@ :trans (behavior () (spawn (-> self part) (-> self root trans)) (/ (the float (- (current-time) (-> self state-time))) (-> self traj time)) - (let ((f0-3 (vector-vector-distance-squared (target-pos 0) (-> self root trans))) - (f1-1 (-> self pickup-radius)) - ) - (when (< f0-3 (* f1-1 f1-1)) - (send-event (ppointer->process (-> self parent)) 'score (-> self score)) - (case (-> self bb-score-type) - (((bb-score-type small)) - (sound-play "small-pickup") - ) - (((bb-score-type medium)) - (sound-play "medium-pickup") - ) - (((bb-score-type large)) - (sound-play "large-pickup") - ) - ) - (go-virtual die) + (when (< (vector-vector-distance-squared (target-pos 0) (-> self root trans)) (square (-> self pickup-radius))) + (send-event (ppointer->process (-> self parent)) 'score (-> self score)) + (case (-> self bb-score-type) + (((bb-score-type small)) + (sound-play "small-pickup") + ) + (((bb-score-type medium)) + (sound-play "medium-pickup") + ) + (((bb-score-type large)) + (sound-play "large-pickup") + ) ) + (go-virtual die) ) ) :code (behavior () @@ -2997,7 +2988,6 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch object vs none. (defmethod set-time-limit ((this task-manager-bbush-spirit-drop)) - (local-vars (sv-16 res-tag)) (let ((t9-0 (method-of-type task-manager set-time-limit))) (t9-0 this) ) @@ -3018,12 +3008,13 @@ (set! (-> this min-spirit-vel) (res-lump-float s5-2 'min-spirit-vel :default 163840.0)) (set! (-> this high-spirit-vel) (res-lump-float s5-2 'high-spirit-vel :default 163840.0)) (set! (-> this fail-radius) (res-lump-float s5-2 'fail-radius :default 655360.0)) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-16 (res-lump-data s5-2 'actor-groups pointer :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-16 (res-lump-data s5-2 'actor-groups (pointer actor-group) :tag-ptr (& sv-16))) + ) (cond ((and v1-16 (nonzero? (-> sv-16 elt-count))) (set! (-> this actor-group-count) (the-as int (-> sv-16 elt-count))) - (set! (-> this actor-group) (the-as (pointer actor-group) v1-16)) + (set! (-> this actor-group) v1-16) (spawn-drops this) ) (else @@ -3084,7 +3075,6 @@ ) ) :trans (behavior () - (local-vars (sv-240 vector) (sv-256 vector) (sv-272 vector)) (rlet ((vf0 :class vf) (vf1 :class vf) (vf2 :class vf) @@ -3108,8 +3098,8 @@ (let ((s2-0 s4-0) (s1-0 (method-of-type cubic-curve cubic-curve-method-9)) (s0-0 (-> s3-0 trans)) + (sv-240 (new 'stack-no-clear 'vector)) ) - (set! sv-240 (new 'stack-no-clear 'vector)) (let ((v0-1 (vector-z-quaternion! (new 'stack-no-clear 'vector) (-> s3-0 quat))) (f0-5 204800.0) ) @@ -3121,20 +3111,22 @@ (.add.x.vf.w vf1 vf0 vf0) (.mul.x.vf.xyz vf1 vf1 vf2) (.svf (&-> sv-240 quad) vf1) - (set! sv-256 (-> s5-0 trans)) - (set! sv-272 (new 'stack-no-clear 'vector)) - (let ((v0-2 (vector-z-quaternion! (new 'stack-no-clear 'vector) (-> s5-0 quat))) - (f0-6 204800.0) + (let ((sv-256 (-> s5-0 trans)) + (sv-272 (new 'stack-no-clear 'vector)) + ) + (let ((v0-2 (vector-z-quaternion! (new 'stack-no-clear 'vector) (-> s5-0 quat))) + (f0-6 204800.0) + ) + (.lvf vf1 (&-> v0-2 quad)) + (let ((v1-21 f0-6)) + (.mov vf2 v1-21) ) - (.lvf vf1 (&-> v0-2 quad)) - (let ((v1-21 f0-6)) - (.mov vf2 v1-21) ) + (.add.x.vf.w vf1 vf0 vf0) + (.mul.x.vf.xyz vf1 vf1 vf2) + (.svf (&-> sv-272 quad) vf1) + (s1-0 s2-0 s0-0 sv-240 sv-256 sv-272) ) - (.add.x.vf.w vf1 vf0 vf0) - (.mul.x.vf.xyz vf1 vf1 vf2) - (.svf (&-> sv-272 quad) vf1) - (s1-0 s2-0 s0-0 sv-240 sv-256 sv-272) ) (set! (-> self current-curve-length) (vector-vector-distance (-> s3-0 trans) (-> s5-0 trans))) (cubic-curve-method-10 s4-0 (-> self trans) (- (-> self path-pos) (the float gp-0))) @@ -3183,13 +3175,9 @@ ) ) (else - (let ((f0-32 (vector-vector-distance-squared (target-pos 0) (-> self trans))) - (f1-17 20480.0) - ) - (when (< f0-32 (* f1-17 f1-17)) - (set! (-> self touched) #t) - (sound-play "start-pickup") - ) + (when (< (vector-vector-distance-squared (target-pos 0) (-> self trans)) (square 20480.0)) + (set! (-> self touched) #t) + (sound-play "start-pickup") ) ) ) @@ -3203,3 +3191,7 @@ #f ) ) + + + + diff --git a/test/decompiler/reference/jak3/levels/desert/desert-dust-storm_REF.gc b/test/decompiler/reference/jak3/levels/desert/desert-dust-storm_REF.gc index 113a7183a0..d167eb50b6 100644 --- a/test/decompiler/reference/jak3/levels/desert/desert-dust-storm_REF.gc +++ b/test/decompiler/reference/jak3/levels/desert/desert-dust-storm_REF.gc @@ -374,8 +374,7 @@ (set! f0-13 20.0) ) (let* ((f2-1 (/ f1-2 f2-0)) - (f1-4 (fmax 0.0 (fmin 1.0 f2-1))) - (f1-5 (* f1-4 f1-4)) + (f1-5 (square (fmax 0.0 (fmin 1.0 f2-1)))) (f2-3 *duststorm-intensity*) ) (set! (-> arg2 coneradius) (lerp (* 48.0 f2-3) (* f2-3 f0-13) f1-5)) @@ -527,7 +526,6 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch symbol vs none. (defmethod desert-dust-storm-method-19 ((this desert-dust-storm)) - (local-vars (sv-80 vector) (sv-96 vector) (sv-112 vector)) (set! *duststorm-intensity* (fmax 0.0 (fmin 1.0 (-> this intensity)))) (set! *duststorm-wind-vel* (lerp 8192.0 20480.0 (-> this wind-speed))) (set! *duststorm-wind-vel* (* *duststorm-wind-vel* *duststorm-intensity*)) @@ -541,47 +539,38 @@ ) (dotimes (s2-0 15) (vector-copy! s3-0 (-> this origin)) - (let ((s1-0 s3-0) - (s0-0 s3-0) - ) - (set! sv-80 s5-0) - (let* ((f30-0 4096.0) - (f28-0 1.5) - (f26-0 -6.5) - (v1-11 (/ (the-as int (rand-uint31-gen *random-generator*)) 256)) - (v1-12 (the-as number (logior #x3f800000 v1-11))) - (f0-14 (* f30-0 (+ f28-0 (* f26-0 (+ -1.0 (the-as float v1-12)))))) - ) - (vector+float*! s1-0 s0-0 sv-80 f0-14) - ) + (let* ((s1-0 s3-0) + (s0-0 s3-0) + (sv-80 s5-0) + (f30-0 4096.0) + (f28-0 1.5) + (f26-0 -6.5) + (v1-11 (/ (the-as int (rand-uint31-gen *random-generator*)) 256)) + (v1-12 (the-as number (logior #x3f800000 v1-11))) + ) + (vector+float*! s1-0 s0-0 sv-80 (* f30-0 (+ f28-0 (* f26-0 (+ -1.0 (the-as float v1-12)))))) ) - (let ((s1-2 s3-0) - (s0-1 s3-0) - ) - (set! sv-96 s4-1) - (let* ((f30-1 4096.0) - (f28-1 -8.0) - (f26-1 16.0) - (v1-18 (/ (the-as int (rand-uint31-gen *random-generator*)) 256)) - (v1-19 (the-as number (logior #x3f800000 v1-18))) - (f0-20 (* f30-1 (+ f28-1 (* f26-1 (+ -1.0 (the-as float v1-19)))))) - ) - (vector+float*! s1-2 s0-1 sv-96 f0-20) - ) + (let* ((s1-2 s3-0) + (s0-1 s3-0) + (sv-96 s4-1) + (f30-1 4096.0) + (f28-1 -8.0) + (f26-1 16.0) + (v1-18 (/ (the-as int (rand-uint31-gen *random-generator*)) 256)) + (v1-19 (the-as number (logior #x3f800000 v1-18))) + ) + (vector+float*! s1-2 s0-1 sv-96 (* f30-1 (+ f28-1 (* f26-1 (+ -1.0 (the-as float v1-19)))))) ) - (let ((s1-4 s3-0) - (s0-2 s3-0) - ) - (set! sv-112 *up-vector*) - (let* ((f30-2 4096.0) - (f28-2 -1.0) - (f26-2 61.0) - (v1-26 (/ (the-as int (rand-uint31-gen *random-generator*)) 256)) - (v1-27 (the-as number (logior #x3f800000 v1-26))) - (f0-26 (* f30-2 (+ f28-2 (* f26-2 (+ -1.0 (the-as float v1-27)))))) - ) - (vector+float*! s1-4 s0-2 sv-112 f0-26) - ) + (let* ((s1-4 s3-0) + (s0-2 s3-0) + (sv-112 *up-vector*) + (f30-2 4096.0) + (f28-2 -1.0) + (f26-2 61.0) + (v1-26 (/ (the-as int (rand-uint31-gen *random-generator*)) 256)) + (v1-27 (the-as number (logior #x3f800000 v1-26))) + ) + (vector+float*! s1-4 s0-2 sv-112 (* f30-2 (+ f28-2 (* f26-2 (+ -1.0 (the-as float v1-27)))))) ) (set! (-> *part-id-table* 1421 init-specs 2 initial-valuef) 61440.0) (set! (-> *part-id-table* 1422 init-specs 2 initial-valuef) 61440.0) diff --git a/test/decompiler/reference/jak3/levels/desert/desert-scenes_REF.gc b/test/decompiler/reference/jak3/levels/desert/desert-scenes_REF.gc index a036b7f24d..3893496812 100644 --- a/test/decompiler/reference/jak3/levels/desert/desert-scenes_REF.gc +++ b/test/decompiler/reference/jak3/levels/desert/desert-scenes_REF.gc @@ -1381,19 +1381,10 @@ (let ((s3-0 (new 'stack-no-clear 'vector))) (vector-segment-distance-point! (-> (the-as process-drawable gp-0) root trans) a1-1 s5-0 s3-0) (cond - ((and (= *nest-hunt-res-index* s4-0) (let ((f0-0 (vector-vector-distance-squared s3-0 s5-0)) - (f1-0 20480.0) - ) - (< f0-0 (* f1-0 f1-0)) - ) - ) + ((and (= *nest-hunt-res-index* s4-0) (< (vector-vector-distance-squared s3-0 s5-0) (square 20480.0))) (send-event gp-0 'ai-set-target-speed 40960.0) ) - ((let ((f0-1 (vector-vector-distance-squared s3-0 s5-0)) - (f1-3 20480.0) - ) - (< f0-1 (* f1-3 f1-3)) - ) + ((< (vector-vector-distance-squared s3-0 s5-0) (square 20480.0)) (if (< *nest-hunt-res-index* s4-0) (set! *nest-hunt-res-index* (+ *nest-hunt-res-index* 1)) ) diff --git a/test/decompiler/reference/jak3/levels/desert/hover/des-beast-2_REF.gc b/test/decompiler/reference/jak3/levels/desert/hover/des-beast-2_REF.gc index a702150bd1..74366ff1d0 100644 --- a/test/decompiler/reference/jak3/levels/desert/hover/des-beast-2_REF.gc +++ b/test/decompiler/reference/jak3/levels/desert/hover/des-beast-2_REF.gc @@ -112,23 +112,19 @@ (set! (-> self minimap) #f) ) :trans (behavior () - (let ((f0-0 (vector-vector-xz-distance-squared (target-pos 0) (-> self root trans))) - (f1-0 24576.0) - ) - (when (< f0-0 (* f1-0 f1-0)) - (let* ((v1-5 (-> *game-info* sub-task-list (game-task-node desert-beast-battle-resolution))) - (a0-4 (handle->process (if (-> v1-5 manager) - (-> v1-5 manager manager) - (the-as handle #f) - ) - ) - ) - ) - (when a0-4 - (if (send-event a0-4 'complete) - (go-virtual die) - ) - ) + (when (< (vector-vector-xz-distance-squared (target-pos 0) (-> self root trans)) (square 24576.0)) + (let* ((v1-5 (-> *game-info* sub-task-list (game-task-node desert-beast-battle-resolution))) + (a0-4 (handle->process (if (-> v1-5 manager) + (-> v1-5 manager manager) + (the-as handle #f) + ) + ) + ) + ) + (when a0-4 + (if (send-event a0-4 'complete) + (go-virtual die) + ) ) ) ) @@ -636,14 +632,6 @@ #f ) :post (behavior () - (local-vars - (sv-336 float) - (sv-496 vector) - (sv-500 float) - (sv-504 int) - (sv-512 (inline-array desbeast-node)) - (sv-516 vector) - ) (cond (#f (let ((s3-0 (-> self target-gun-pos)) @@ -674,18 +662,10 @@ (vector-normalize-copy! (new 'stack-no-clear 'vector) (-> s5-1 1) 1.0) ) ) - (let ((f0-6 1.0) - (f1-1 (-> s5-1 2 y)) - ) - (set! (-> s5-1 2 w) (- f0-6 (* f1-1 f1-1))) - ) + (set! (-> s5-1 2 w) (- 1.0 (square (-> s5-1 2 y)))) (set! (-> s5-1 3 x) (* 2.0 (-> s5-1 2 z) (-> s5-1 2 y) (-> s5-1 2 x))) - (let ((f0-12 (-> s5-1 2 x))) - (set! (-> s5-1 3 y) (- (* f0-12 f0-12))) - ) - (let ((f0-16 (-> s5-1 3 x))) - (set! (-> s5-1 3 z) (- (* f0-16 f0-16) (* 4.0 (-> s5-1 3 y) (-> s5-1 2 w)))) - ) + (set! (-> s5-1 3 y) (- (square (-> s5-1 2 x)))) + (set! (-> s5-1 3 z) (- (square (-> s5-1 3 x)) (* 4.0 (-> s5-1 3 y) (-> s5-1 2 w)))) (when (>= (-> s5-1 3 z) 0.0) (let ((f0-22 (- (-> s5-1 3 x))) (f1-12 (sqrtf (-> s5-1 3 z))) @@ -701,7 +681,7 @@ ) (let ((f1-20 (/ (-> s5-1 2 x) (meters 30)))) (set! (-> gp-1 y) - (fmin (+ 327680.0 (-> self root trans y)) (+ 20480.0 (* 9216.0 (* f1-20 f1-20)) (-> gp-1 y))) + (fmin (+ 327680.0 (-> self root trans y)) (+ 20480.0 (* 9216.0 (square f1-20)) (-> gp-1 y))) ) ) ) @@ -714,14 +694,15 @@ (let ((s3-2 (vector-! (new 'stack-no-clear 'vector) (-> self target-gun-pos) s5-2)) (s4-3 (new 'stack-no-clear 'vector)) ) - (let ((f0-34 (vector-length s3-2))) - (set! sv-336 (the-as float 0.0)) + (let ((f0-34 (vector-length s3-2)) + (sv-336 (the-as float 0.0)) + ) (let ((f0-35 (fmin 819200.0 f0-34))) (vector-normalize! s3-2 f0-35) ) + (vector+! s4-3 s5-2 s3-2) + (set! sv-336 (the-as float 122880.0)) ) - (vector+! s4-3 s5-2 s3-2) - (set! sv-336 (the-as float 122880.0)) (setup-from-to-height! gp-2 s5-2 s4-3 32768.0 -36864.0) ) (vector-copy! (-> self shot-velocity) (-> gp-2 initial-velocity)) @@ -757,43 +738,47 @@ ) (let ((gp-7 *target*)) (when gp-7 - (set! sv-496 (new 'stack-no-clear 'vector)) - (set! sv-500 (the-as float 0.0)) - (set! sv-504 -1) - (set! sv-512 (-> self des-path node)) - (let ((s5-5 (new 'stack-no-clear 'vector))) - (vector-copy! s5-5 (get-trans gp-7 0)) - (set! sv-516 s5-5) - ) - (vector+float*! - sv-516 - sv-516 - (vector-z-quaternion! (new 'stack-no-clear 'vector) (get-quat gp-7 0)) - (-> self follow-distance) - ) - (dotimes (gp-8 (the-as int (+ (-> self des-path node-count) -1))) - (let* ((a1-30 (-> sv-512 gp-8)) - (a2-9 (-> sv-512 (+ gp-8 1))) - (s5-8 (new 'stack-no-clear 'vector)) - (f0-47 (vector-segment-distance-point! sv-516 (-> a1-30 position) (-> a2-9 position) s5-8)) - ) - (when (or (= sv-504 -1) (< f0-47 sv-500)) - (set! sv-500 f0-47) - (set! sv-504 gp-8) - (vector-copy! sv-496 s5-8) + (let ((sv-496 (new 'stack-no-clear 'vector)) + (sv-500 (the-as float 0.0)) + (sv-504 -1) + ) + (let ((sv-512 (-> self des-path node)) + (s5-5 (new 'stack-no-clear 'vector)) + ) + (vector-copy! s5-5 (get-trans gp-7 0)) + (let ((sv-516 s5-5)) + (vector+float*! + sv-516 + sv-516 + (vector-z-quaternion! (new 'stack-no-clear 'vector) (get-quat gp-7 0)) + (-> self follow-distance) + ) + (dotimes (gp-8 (the-as int (+ (-> self des-path node-count) -1))) + (let* ((a1-30 (-> sv-512 gp-8)) + (a2-9 (-> sv-512 (+ gp-8 1))) + (s5-8 (new 'stack-no-clear 'vector)) + (f0-47 (vector-segment-distance-point! sv-516 (-> a1-30 position) (-> a2-9 position) s5-8)) + ) + (when (or (= sv-504 -1) (< f0-47 sv-500)) + (set! sv-500 f0-47) + (set! sv-504 gp-8) + (vector-copy! sv-496 s5-8) + ) + ) + ) ) ) - ) - (when (!= sv-504 -1) - (let* ((s4-5 (-> self root trans)) - (s5-9 (new 'stack-no-clear 'inline-array 'vector 2)) - (f30-2 (vector-vector-distance s4-5 sv-496)) - ) - (if (< (vector-dot (vector-! (-> s5-9 0) sv-496 s4-5) (vector-z-quaternion! (-> s5-9 1) (-> self root quat))) 0.0) - (set! f30-2 (* -1.0 f30-2)) + (when (!= sv-504 -1) + (let* ((s4-5 (-> self root trans)) + (s5-9 (new 'stack-no-clear 'inline-array 'vector 2)) + (f30-2 (vector-vector-distance s4-5 sv-496)) + ) + (if (< (vector-dot (vector-! (-> s5-9 0) sv-496 s4-5) (vector-z-quaternion! (-> s5-9 1) (-> self root quat))) 0.0) + (set! f30-2 (* -1.0 f30-2)) + ) + (let ((f0-53 (* (lerp-scale -0.7 0.7 f30-2 -245760.0 245760.0) (lerp-scale 1.0 0.0 sv-500 122880.0 983040.0)))) + (seek! (-> self main-speed-factor-dest) (+ 0.8 f0-53) (* 0.6 (seconds-per-frame))) ) - (let ((f0-53 (* (lerp-scale -0.7 0.7 f30-2 -245760.0 245760.0) (lerp-scale 1.0 0.0 sv-500 122880.0 983040.0)))) - (seek! (-> self main-speed-factor-dest) (+ 0.8 f0-53) (* 0.6 (seconds-per-frame))) ) ) ) diff --git a/test/decompiler/reference/jak3/levels/desert/hover/des-beast_REF.gc b/test/decompiler/reference/jak3/levels/desert/hover/des-beast_REF.gc index 2d4a0ceeae..09de2f9fcb 100644 --- a/test/decompiler/reference/jak3/levels/desert/hover/des-beast_REF.gc +++ b/test/decompiler/reference/jak3/levels/desert/hover/des-beast_REF.gc @@ -2310,7 +2310,6 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defun des-beast-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) @@ -2318,35 +2317,36 @@ ) (init-vf0-vector) (cspace<-parented-transformq-joint! arg0 arg1) - (let ((s3-0 (-> 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 (-> (the-as des-beast s3-0) target-gun-pos)) - (let ((v0-2 (matrix->trans (-> arg0 bone transform) (new 'stack-no-clear 'vector)))) + (let ((s3-0 (-> 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 (-> (the-as des-beast s3-0) target-gun-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 fvec)) - (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! (-> (the-as des-beast s3-0) angle-turret) - (deg-seek (-> (the-as des-beast s3-0) angle-turret) (-> s2-0 y) (* 7281.778 (seconds-per-frame))) - ) - (quaternion-vector-angle! s4-0 *up-vector* (-> (the-as des-beast s3-0) angle-turret)) - (quaternion->matrix (-> arg0 bone transform) s4-0) - (vector-copy! (-> arg0 bone transform trans) s5-0) ) + (rot-zxy-from-vector! s0-0 (-> arg0 bone transform fvec)) + (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! (-> (the-as des-beast s3-0) angle-turret) + (deg-seek (-> (the-as des-beast s3-0) angle-turret) (-> s2-0 y) (* 7281.778 (seconds-per-frame))) + ) + (quaternion-vector-angle! s4-0 *up-vector* (-> (the-as des-beast s3-0) angle-turret)) + (quaternion->matrix (-> arg0 bone transform) s4-0) + (vector-copy! (-> arg0 bone transform trans) s5-0) ) 0 (none) @@ -2357,7 +2357,6 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defun des-beast-gun-callback ((arg0 cspace) (arg1 transformq)) - (local-vars (sv-112 vector) (sv-128 vector)) (rlet ((vf0 :class vf) (vf4 :class vf) (vf5 :class vf) @@ -2372,15 +2371,17 @@ (s1-0 (new 'stack-no-clear 'vector)) (s3-0 (new 'stack-no-clear 'vector)) ) - (set! sv-128 s0-0) - (set! sv-112 (-> (the-as des-beast s4-0) target-gun-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 (-> (the-as des-beast s4-0) target-gun-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 fvec)) (rot-zxy-from-vector! s1-0 s0-0) (set! (-> s3-0 x) (fmax -5461.3335 (fmin -5461.3335 (deg- (-> s1-0 x) (-> s2-0 x))))) diff --git a/test/decompiler/reference/jak3/levels/desert/hover/desert-hover_REF.gc b/test/decompiler/reference/jak3/levels/desert/hover/desert-hover_REF.gc index 5807dd3f8b..fcb57ce71d 100644 --- a/test/decompiler/reference/jak3/levels/desert/hover/desert-hover_REF.gc +++ b/test/decompiler/reference/jak3/levels/desert/hover/desert-hover_REF.gc @@ -110,7 +110,6 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch object vs none. (defmethod set-time-limit ((this task-manager-desert-hover)) - (local-vars (sv-16 res-tag)) (let ((t9-0 (method-of-type task-manager set-time-limit))) (t9-0 this) ) @@ -121,8 +120,9 @@ (let ((a0-9 (entity-by-name "tmanager-2"))) (when a0-9 (set! (-> this entity) (the-as entity-actor a0-9)) - (set! sv-16 (new 'static 'res-tag)) - (let ((v0-6 (res-lump-data a0-9 'actor-groups pointer :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v0-6 (res-lump-data a0-9 'actor-groups pointer :tag-ptr (& sv-16))) + ) (cond ((and v0-6 (nonzero? (-> sv-16 elt-count))) (set! (-> this actor-group-count) (the-as int (-> sv-16 elt-count))) diff --git a/test/decompiler/reference/jak3/levels/desert/hover/mh-flyer_REF.gc b/test/decompiler/reference/jak3/levels/desert/hover/mh-flyer_REF.gc index 33d7f2fa2b..7b90d98beb 100644 --- a/test/decompiler/reference/jak3/levels/desert/hover/mh-flyer_REF.gc +++ b/test/decompiler/reference/jak3/levels/desert/hover/mh-flyer_REF.gc @@ -475,12 +475,6 @@ ;; ERROR: Stack slot load at 128 mismatch: defined as size 4, got size 16 ;; WARN: Return type mismatch int vs none. (defmethod init-proj-settings! ((this mh-flyer-shot)) - (local-vars - (sv-80 (function float float float float float float)) - (sv-96 float) - (sv-112 float) - (sv-128 float) - ) (with-pp (initialize-skeleton this @@ -541,20 +535,11 @@ (f0-9 (vector-dot s5-6 *y-vector*)) (s4-3 (new 'stack-no-clear 'vector)) ) - (let ((s3-1 vector-lerp!) - (s2-0 s4-3) - (s1-0 *y-vector*) - (s0-0 *x-vector*) - ) - (set! sv-80 lerp-scale) - (set! sv-96 (the-as float 0.0)) - (set! sv-112 (the-as float 1.0)) - (set! sv-128 f0-9) - (let ((a3-5 (cos 14563.556)) - (t0-2 0.0) - ) - (s3-1 s2-0 s1-0 s0-0 (sv-80 sv-96 sv-112 sv-128 a3-5 t0-2)) - ) + (vector-lerp! + s4-3 + *y-vector* + *x-vector* + (lerp-scale (the-as float 0.0) (the-as float 1.0) f0-9 (cos 14563.556) 0.0) ) (forward-up->quaternion (-> this root quat) s5-6 s4-3) ) diff --git a/test/decompiler/reference/jak3/levels/desert/hover/scorpion-gun_REF.gc b/test/decompiler/reference/jak3/levels/desert/hover/scorpion-gun_REF.gc index 773acae37f..494cf94422 100644 --- a/test/decompiler/reference/jak3/levels/desert/hover/scorpion-gun_REF.gc +++ b/test/decompiler/reference/jak3/levels/desert/hover/scorpion-gun_REF.gc @@ -1003,7 +1003,6 @@ ;; definition for function scorpion-gun-handler ;; INFO: Used lq/sq (defbehavior scorpion-gun-handler scorpion-gun ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) - (local-vars (sv-32 vector) (sv-128 quaternion)) (case arg2 (('die) (go-virtual die) @@ -1013,32 +1012,34 @@ ) (('get-cam-info) (let ((s5-0 (joint-node scorpion-gun-lod0-jg main))) - (set! sv-32 (vector<-cspace! (new 'stack-no-clear 'vector) s5-0)) - (vector+float*! sv-32 sv-32 (-> s5-0 bone transform uvec) 7372.8) - (vector+float*! sv-32 sv-32 (-> s5-0 bone transform fvec) -24576.0) - (set! (-> sv-32 y) (fmax (-> sv-32 y) (-> s5-0 bone transform trans y))) - (let ((s4-0 (new 'stack-no-clear 'vector))) - (vector-copy! s4-0 (-> self root trans)) - (let ((s3-0 (new 'stack-no-clear 'vector))) - (set! (-> s3-0 x) 0.0) - (set! (-> s3-0 y) 0.0) - (set! (-> s3-0 z) -24576.0) - (set! (-> s3-0 w) 0.0) - (let ((s0-0 (matrix->quaternion (new 'stack-no-clear 'quaternion) (-> s5-0 bone transform)))) - (set! sv-128 (quaternion*! - (new 'stack-no-clear 'quaternion) - s0-0 - (quaternion-conjugate! (new 'stack-no-clear 'quaternion) (-> self scorp-quat)) + (let ((sv-32 (vector<-cspace! (new 'stack-no-clear 'vector) s5-0))) + (vector+float*! sv-32 sv-32 (-> s5-0 bone transform uvec) 7372.8) + (vector+float*! sv-32 sv-32 (-> s5-0 bone transform fvec) -24576.0) + (set! (-> sv-32 y) (fmax (-> sv-32 y) (-> s5-0 bone transform trans y))) + (let ((s4-0 (new 'stack-no-clear 'vector))) + (vector-copy! s4-0 (-> self root trans)) + (let ((s3-0 (new 'stack-no-clear 'vector))) + (set! (-> s3-0 x) 0.0) + (set! (-> s3-0 y) 0.0) + (set! (-> s3-0 z) -24576.0) + (set! (-> s3-0 w) 0.0) + (let* ((s0-0 (matrix->quaternion (new 'stack-no-clear 'quaternion) (-> s5-0 bone transform))) + (sv-128 (quaternion*! + (new 'stack-no-clear 'quaternion) + s0-0 + (quaternion-conjugate! (new 'stack-no-clear 'quaternion) (-> self scorp-quat)) + ) ) - ) + ) + (vector-rotate-around-y! s3-0 s3-0 (quaternion-y-angle sv-128)) + ) + (vector-orient-by-quat! s3-0 s3-0 (-> self scorp-quat)) + (vector+! s4-0 s4-0 s3-0) ) - (vector-rotate-around-y! s3-0 s3-0 (quaternion-y-angle sv-128)) - (vector-orient-by-quat! s3-0 s3-0 (-> self scorp-quat)) - (vector+! s4-0 s4-0 s3-0) + (set! (-> sv-32 y) (fmax (-> sv-32 y) (-> s4-0 y))) ) - (set! (-> sv-32 y) (fmax (-> sv-32 y) (-> s4-0 y))) + (set! (-> (the-as vector (-> arg3 param 0)) quad) (-> sv-32 quad)) ) - (set! (-> (the-as vector (-> arg3 param 0)) quad) (-> sv-32 quad)) (vector-normalize-copy! (the-as vector (-> arg3 param 1)) (-> s5-0 bone transform fvec) 1.0) ) ) @@ -1069,7 +1070,6 @@ ;; ERROR: Stack slot load at 80 mismatch: defined as size 4, got size 16 ;; ERROR: Stack slot load at 80 mismatch: defined as size 4, got size 16 (defbehavior control-post scorpion-gun ((arg0 symbol)) - (local-vars (sv-64 quaternion) (sv-68 vector) (sv-72 vector) (sv-80 float)) (cond (arg0 (set! (-> self rotyvv) (analog-input (the-as int (-> *cpad-list* cpads 0 leftx)) 128.0 64.0 96.0 -163840.0)) @@ -1105,26 +1105,20 @@ (set! (-> self rotxv) 0.0) ) ) - (set! sv-64 (new 'stack-no-clear 'quaternion)) - (set! sv-68 (vector-y-quaternion! (new 'stack-no-clear 'vector) (-> self scorp-quat))) - (set! sv-72 (vector-y-quaternion! (new 'stack-no-clear 'vector) (-> self root quat))) - (let ((gp-0 quaternion-slerp!) - (s5-0 (-> self scorp-smooth-quat)) - (s4-0 (-> self scorp-smooth-quat)) - (s3-0 (-> self scorp-quat)) - (s2-0 lerp-scale) - (s1-0 0.0) - (s0-0 2.0) - ) - (set! sv-80 (vector-dot sv-68 sv-72)) - (let ((a3-2 (cos 45.0)) - (t0-2 0.0) + (let ((sv-64 (new 'stack-no-clear 'quaternion))) + (let ((sv-68 (vector-y-quaternion! (new 'stack-no-clear 'vector) (-> self scorp-quat))) + (sv-72 (vector-y-quaternion! (new 'stack-no-clear 'vector) (-> self root quat))) ) - (gp-0 s5-0 s4-0 s3-0 (* (s2-0 s1-0 s0-0 sv-80 a3-2 t0-2) (seconds-per-frame))) + (quaternion-slerp! + (-> self scorp-smooth-quat) + (-> self scorp-smooth-quat) + (-> self scorp-quat) + (* (lerp-scale 0.0 2.0 (vector-dot sv-68 sv-72) (cos 45.0) 0.0) (seconds-per-frame)) + ) ) + (quaternion-rotate-local-y! sv-64 (-> self scorp-smooth-quat) (-> self roty)) + (quaternion-rotate-local-x! (-> self root quat) sv-64 (-> self rotx)) ) - (quaternion-rotate-local-y! sv-64 (-> self scorp-smooth-quat) (-> self roty)) - (quaternion-rotate-local-x! (-> self root quat) sv-64 (-> self rotx)) (ja-post) (none) ) @@ -1133,20 +1127,12 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defbehavior aim-post scorpion-gun () - (local-vars - (sv-656 vector) - (sv-1296 cspace) - (sv-1300 collide-query) - (sv-1304 vector) - (sv-1308 vector) - (sv-1312 rgba) - ) (send-event (handle->process (-> self manager)) 'reset-arrows) (let ((gp-0 (-> (joint-node scorpion-gun-lod0-jg muzzle) bone transform)) (s4-0 (new 'stack-no-clear 'vector)) (s5-0 (the-as (array collide-shape) (new 'stack 'boxed-array collide-shape 128))) + (sv-656 (new 'stack-no-clear 'vector)) ) - (set! sv-656 (new 'stack-no-clear 'vector)) (vector-normalize-copy! sv-656 (-> gp-0 fvec) 1.0) (vector+float*! s4-0 (-> gp-0 trans) sv-656 512000.0) (set! (-> s4-0 w) 614400.0) @@ -1220,60 +1206,64 @@ ) ) ) - (set! sv-1296 (joint-node scorpion-gun-lod0-jg muzzle)) - (set! sv-1300 (new 'stack-no-clear 'collide-query)) - (set! sv-1304 (-> self aim-dir)) - (set! sv-1308 (new 'stack-no-clear 'vector)) - (set! sv-1312 (the-as rgba (new 'stack-no-clear 'array 'rgba 1))) - (vector-copy! (-> sv-1300 start-pos) (-> sv-1296 bone transform trans)) - (vector-float*! (-> sv-1300 move-dist) sv-1304 1024000.0) - (let ((v1-73 sv-1300)) - (set! (-> v1-73 radius) 819.2) - (set! (-> v1-73 collide-with) (collide-spec enemy obstacle hit-by-others-list)) - (set! (-> v1-73 ignore-process0) self) - (set! (-> v1-73 ignore-process1) #f) - (set! (-> v1-73 ignore-pat) - (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) - ) - (set! (-> v1-73 action-mask) (collide-action solid)) - ) - (fill-using-line-sphere *collide-cache* sv-1300) - (let ((f30-1 (probe-using-line-sphere *collide-cache* sv-1300))) - (cond - ((and (>= f30-1 0.0) - (type? (-> sv-1300 best-other-tri collide-ptr) collide-shape-prim) - (logtest? (process-mask enemy projectile) - (-> (the-as collide-shape-prim (-> sv-1300 best-other-tri collide-ptr)) cshape process mask) - ) + (let ((sv-1296 (joint-node scorpion-gun-lod0-jg muzzle)) + (sv-1300 (new 'stack-no-clear 'collide-query)) + (sv-1304 (-> self aim-dir)) + (sv-1308 (new 'stack-no-clear 'vector)) + (sv-1312 (the-as rgba (new 'stack-no-clear 'array 'rgba 1))) + ) + (vector-copy! (-> sv-1300 start-pos) (-> sv-1296 bone transform trans)) + (vector-float*! (-> sv-1300 move-dist) sv-1304 1024000.0) + (let ((v1-73 sv-1300)) + (set! (-> v1-73 radius) 819.2) + (set! (-> v1-73 collide-with) (collide-spec enemy obstacle hit-by-others-list)) + (set! (-> v1-73 ignore-process0) self) + (set! (-> v1-73 ignore-process1) #f) + (set! (-> v1-73 ignore-pat) + (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) ) - (if (>= (+ (current-time) (seconds -0.5)) (-> self valid-target-time)) - (set! (-> self valid-target-anim-time) (+ (current-time) (seconds 0.4))) - ) - (vector+float*! sv-1308 (-> sv-1300 start-pos) (-> sv-1300 move-dist) f30-1) - (set! sv-1312 - (rgba-lerp - (new 'static 'rgba :r #xf2 :a #x80) - (new 'static 'rgba :r #xff :g #xec :b #x48 :a #x10) - (the-as - rgba - (* 0.016666668 (fmax 0.0 (fmin 1.0 (the float (- (-> self valid-target-anim-time) (current-time)))))) - ) - ) - ) - (set-time! (-> self valid-target-time)) - ) - (else - (vector+float*! sv-1308 (-> sv-1300 start-pos) (-> sv-1300 move-dist) 1.0) - (set! sv-1312 *color-gray*) - (set! sv-1312 (copy-and-set-field sv-1312 a 16)) - ) + (set! (-> v1-73 action-mask) (collide-action solid)) + ) + (fill-using-line-sphere *collide-cache* sv-1300) + (let ((f30-1 (probe-using-line-sphere *collide-cache* sv-1300))) + (set! sv-1312 + (cond + ((and (>= f30-1 0.0) + (type? (-> sv-1300 best-other-tri collide-ptr) collide-shape-prim) + (logtest? (process-mask enemy projectile) + (-> (the-as collide-shape-prim (-> sv-1300 best-other-tri collide-ptr)) cshape process mask) + ) + ) + (if (>= (+ (current-time) (seconds -0.5)) (-> self valid-target-time)) + (set! (-> self valid-target-anim-time) (+ (current-time) (seconds 0.4))) + ) + (vector+float*! sv-1308 (-> sv-1300 start-pos) (-> sv-1300 move-dist) f30-1) + (set! sv-1312 + (rgba-lerp + (new 'static 'rgba :r #xf2 :a #x80) + (new 'static 'rgba :r #xff :g #xec :b #x48 :a #x10) + (the-as + rgba + (* 0.016666668 (fmax 0.0 (fmin 1.0 (the float (- (-> self valid-target-anim-time) (current-time)))))) + ) + ) + ) + (set-time! (-> self valid-target-time)) + sv-1312 + ) + (else + (vector+float*! sv-1308 (-> sv-1300 start-pos) (-> sv-1300 move-dist) 1.0) + (copy-and-set-field *color-gray* a 16) + ) + ) + ) + ) + (set! (-> sv-1308 w) 1.0) + (let ((gp-3 (new 'stack-no-clear 'vector))) + (if (transform-point-vector! gp-3 sv-1308) + (send-event (handle->process (-> self hud-aim)) 'draw gp-3 sv-1312) + ) ) - ) - (set! (-> sv-1308 w) 1.0) - (let ((gp-3 (new 'stack-no-clear 'vector))) - (if (transform-point-vector! gp-3 sv-1308) - (send-event (handle->process (-> self hud-aim)) 'draw gp-3 sv-1312) - ) ) 0 (none) diff --git a/test/decompiler/reference/jak3/levels/desert/lizard/desert-lizard-task_REF.gc b/test/decompiler/reference/jak3/levels/desert/lizard/desert-lizard-task_REF.gc index 27eb17187e..5b55798f4d 100644 --- a/test/decompiler/reference/jak3/levels/desert/lizard/desert-lizard-task_REF.gc +++ b/test/decompiler/reference/jak3/levels/desert/lizard/desert-lizard-task_REF.gc @@ -703,7 +703,6 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch symbol vs none. (defmethod task-manager-method-26 ((this task-manager-desert-catch-lizards)) - (local-vars (sv-192 res-tag)) (with-pp (let ((t9-0 (method-of-type task-manager task-manager-method-26))) (t9-0 this) @@ -752,11 +751,12 @@ ) (when (not (-> this manager-entity)) (set! (-> this manager-entity) (the-as entity-actor (entity-by-name "desert-lizard-manager-1"))) - (set! sv-192 (new 'static 'res-tag)) - (let ((v1-46 (res-lump-data (-> this manager-entity) 'actor-groups pointer :tag-ptr (& sv-192)))) + (let* ((sv-192 (new 'static 'res-tag)) + (v1-46 (res-lump-data (-> this manager-entity) 'actor-groups (pointer actor-group) :tag-ptr (& sv-192))) + ) (cond ((and v1-46 (nonzero? (-> sv-192 elt-count))) - (set! (-> this actor-group) (the-as (pointer actor-group) v1-46)) + (set! (-> this actor-group) v1-46) (set! (-> this actor-group-count) (the-as int (-> sv-192 elt-count))) ) (else @@ -1042,3 +1042,7 @@ ;; failed to figure out what this is: 0 + + + + diff --git a/test/decompiler/reference/jak3/levels/desert/lizard/desert-lizard_REF.gc b/test/decompiler/reference/jak3/levels/desert/lizard/desert-lizard_REF.gc index 8675547ede..e0f00ff5a7 100644 --- a/test/decompiler/reference/jak3/levels/desert/lizard/desert-lizard_REF.gc +++ b/test/decompiler/reference/jak3/levels/desert/lizard/desert-lizard_REF.gc @@ -959,7 +959,6 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defmethod nav-enemy-method-165 ((this desert-lizard) (arg0 vector) (arg1 vector)) - (local-vars (sv-160 vector) (sv-176 int) (sv-192 vector)) (with-pp (let ((s5-0 (new 'stack-no-clear 'vector))) (vector-copy! s5-0 arg1) @@ -971,23 +970,24 @@ (let ((s1-0 -1) (s0-0 (new 'stack-no-clear 'vector)) ) - (set! sv-160 (-> this root trans)) - (set! sv-176 0) - (while (< sv-176 (-> this graph edge-count)) - (let ((v1-8 (-> this graph edge sv-176))) - (set! sv-192 (new 'stack-no-clear 'vector)) - (let ((f0-0 - (vector-segment-xz-distance-point! sv-160 (-> s2-0 (-> v1-8 index 0)) (-> s2-0 (-> v1-8 index 1)) sv-192) - ) - ) + (let ((sv-160 (-> this root trans)) + (sv-176 0) + ) + (while (< sv-176 (-> this graph edge-count)) + (let* ((v1-8 (-> this graph edge sv-176)) + (sv-192 (new 'stack-no-clear 'vector)) + (f0-0 + (vector-segment-xz-distance-point! sv-160 (-> s2-0 (-> v1-8 index 0)) (-> s2-0 (-> v1-8 index 1)) sv-192) + ) + ) (when (or (< f0-0 f30-0) (= s1-0 -1)) (set! f30-0 f0-0) (set! s1-0 sv-176) (vector-copy! s0-0 sv-192) ) ) + (+! sv-176 1) ) - (set! sv-176 (+ sv-176 1)) ) (when (!= s1-0 -1) (cond diff --git a/test/decompiler/reference/jak3/levels/desert/oasis/ash-oasis-course_REF.gc b/test/decompiler/reference/jak3/levels/desert/oasis/ash-oasis-course_REF.gc index 11311d314a..9176f40bf5 100644 --- a/test/decompiler/reference/jak3/levels/desert/oasis/ash-oasis-course_REF.gc +++ b/test/decompiler/reference/jak3/levels/desert/oasis/ash-oasis-course_REF.gc @@ -308,9 +308,7 @@ (local-vars (v0-5 bot-flag)) (set-frontline arg0) (let* ((a1-0 (target-pos 0)) - (f0-0 (vector-vector-xz-distance-squared (-> arg0 root trans) a1-0)) - (f1-0 409600.0) - (s5-0 (< f0-0 (* f1-0 f1-0))) + (s5-0 (< (vector-vector-xz-distance-squared (-> arg0 root trans) a1-0) (square 409600.0))) ) (if s5-0 (set-time! (-> arg0 player-in-bounds-time)) diff --git a/test/decompiler/reference/jak3/levels/desert/oasis/oasis-defense_REF.gc b/test/decompiler/reference/jak3/levels/desert/oasis/oasis-defense_REF.gc index 20305f75ae..16edc8bb5d 100644 --- a/test/decompiler/reference/jak3/levels/desert/oasis/oasis-defense_REF.gc +++ b/test/decompiler/reference/jak3/levels/desert/oasis/oasis-defense_REF.gc @@ -510,31 +510,23 @@ (s1-0 (= (+ (length (-> *oasis-vehicle-path* (-> s4-0 path-type))) -1) (-> s4-0 path-pos))) (f30-0 (vector-vector-distance-squared (-> s2-0 pos) (-> (the-as process-drawable s3-0) root trans))) ) - (when (and (not s1-0) (let ((f0-0 81920.0)) - (< f30-0 (* f0-0 f0-0)) - ) - ) + (when (and (not s1-0) (< f30-0 (square 81920.0))) (+! (-> s4-0 path-pos) 1) (send-event s3-0 'ai-set-target-position (-> *oasis-vehicle-path* (-> s4-0 path-type) (-> s4-0 path-pos) pos)) (send-event s3-0 'ai-set-target-speed 163840.0) (send-event s3-0 'ai-set-target-process *target*) ) - (if (and s1-0 (let ((f0-3 122880.0)) - (< f30-0 (* f0-3 f0-3)) - ) - ) + (if (and s1-0 (< f30-0 (square 122880.0))) (send-event s3-0 'ai-set-target-speed 122880.0) ) (when (-> s4-0 spawned-marauder?) (send-event s3-0 'ai-set-target-speed 81920.0) (send-event s3-0 'ai-set-target-position (-> *oasis-vehicle-path* (-> s4-0 path-type) (-> s4-0 path-pos) pos)) ) - (when (and s1-0 (not (-> s4-0 spawned-marauder?)) (let ((f0-6 40960.0)) - (and (< f30-0 (* f0-6 f0-6)) - (< (-> this marauder-count) (the-as uint 7)) - (< (-> this total-spawned) (the-as uint 57)) - ) - ) + (when (and s1-0 (not (-> s4-0 spawned-marauder?)) (and (< f30-0 (square 40960.0)) + (< (-> this marauder-count) (the-as uint 7)) + (< (-> this total-spawned) (the-as uint 57)) + ) ) (let ((a1-10 (handle->process (spawn-marauder this s2-0 #t)))) (when a1-10 @@ -573,33 +565,29 @@ ) ) ) - (let ((f0-9 102400.0)) - (when (< f30-1 (* f0-9 f0-9)) - (let* ((s2-1 (-> (the-as process-drawable s4-2) root quat)) - (s3-2 (vector-normalize! (vector-x-quaternion! (new 'stack-no-clear 'vector) s2-1) 40960.0)) - (v1-109 (vector-normalize! (vector-y-quaternion! (new 'stack-no-clear 'vector) s2-1) 102400.0)) - ) - (vector+! s3-2 (-> (the-as process-drawable s4-2) root trans) s3-2) - (send-event s4-2 'apply-impulse s3-2 v1-109) - ) + (when (< f30-1 (square 102400.0)) + (let* ((s2-1 (-> (the-as process-drawable s4-2) root quat)) + (s3-2 (vector-normalize! (vector-x-quaternion! (new 'stack-no-clear 'vector) s2-1) 40960.0)) + (v1-109 (vector-normalize! (vector-y-quaternion! (new 'stack-no-clear 'vector) s2-1) 102400.0)) + ) + (vector+! s3-2 (-> (the-as process-drawable s4-2) root trans) s3-2) + (send-event s4-2 'apply-impulse s3-2 v1-109) ) ) - (let ((f0-12 40960.0)) - (when (< f30-1 (* f0-12 f0-12)) - (send-event - s4-2 - 'attack - #f - (static-attack-info :mask (vehicle-impulse-factor) ((id (new-attack-id)) - (damage 2000.0) - (vehicle-damage-factor 1.0) - (vehicle-impulse-factor 0.0) - (attacker-velocity (new 'static 'vector :w 1.0)) - ) - ) - ) - (set! (-> this veh-fx s5-1) (the-as handle #f)) + (when (< f30-1 (square 40960.0)) + (send-event + s4-2 + 'attack + #f + (static-attack-info :mask (vehicle-impulse-factor) ((id (new-attack-id)) + (damage 2000.0) + (vehicle-damage-factor 1.0) + (vehicle-impulse-factor 0.0) + (attacker-velocity (new 'static 'vector :w 1.0)) + ) + ) ) + (set! (-> this veh-fx s5-1) (the-as handle #f)) ) ) ) @@ -719,40 +707,38 @@ ;; definition for method 32 of type task-manager-desert-oasis-defense ;; INFO: Used lq/sq (defmethod spawn-v-marauder ((this task-manager-desert-oasis-defense) (arg0 int) (arg1 int)) - (local-vars (sv-240 mystery-traffic-object-spawn-params0)) (let ((s5-0 (-> this v-free-list)) (s4-0 (>= arg1 0)) ) (when (nonzero? (length s5-0)) - (let ((s3-0 (-> this vehicle (-> s5-0 (+ (length s5-0) -1))))) - (let ((s0-0 (if s4-0 - (-> *oasis-vehicle-start* arg1) - (-> *oasis-vehicle-path* arg0 0) + (let ((s3-0 (-> this vehicle (-> s5-0 (+ (length s5-0) -1)))) + (s0-0 (if s4-0 + (-> *oasis-vehicle-start* arg1) + (-> *oasis-vehicle-path* arg0 0) + ) + ) + (sv-240 (new 'stack-no-clear 'mystery-traffic-object-spawn-params0)) + ) + (vector-z-quaternion! (-> sv-240 vec) (-> s0-0 quat)) + (vector-float*! (-> sv-240 vec) (-> sv-240 vec) (if s4-0 + 0.0 + 204800.0 + ) ) - ) - ) - (set! sv-240 (new 'stack-no-clear 'mystery-traffic-object-spawn-params0)) - (vector-z-quaternion! (-> sv-240 vec) (-> s0-0 quat)) - (vector-float*! (-> sv-240 vec) (-> sv-240 vec) (if s4-0 - 0.0 - 204800.0 - ) - ) - (set! (-> sv-240 params object-type) (traffic-type guard-a)) - (set! (-> sv-240 params behavior) (the-as uint 3)) - (set! (-> sv-240 params id) (the-as uint 0)) - (set! (-> sv-240 params nav-mesh) (-> this nav-mesh)) - (set! (-> sv-240 params nav-branch) #f) - (set! (-> sv-240 params proc) #f) - (set! (-> sv-240 params handle) (the-as handle #f)) - (set! (-> sv-240 params user-data) (the-as uint 0)) - (set! (-> sv-240 params flags) (traffic-spawn-flags)) - (set! (-> sv-240 params guard-type) (the-as uint 11)) - (set! (-> sv-240 params entity) #f) - (vector-copy! (-> sv-240 params velocity) (-> sv-240 vec)) - (vector-copy! (-> sv-240 params position) (-> s0-0 pos)) - (quaternion-copy! (-> sv-240 params rotation) (-> s0-0 quat)) - ) + (set! (-> sv-240 params object-type) (traffic-type guard-a)) + (set! (-> sv-240 params behavior) (the-as uint 3)) + (set! (-> sv-240 params id) (the-as uint 0)) + (set! (-> sv-240 params nav-mesh) (-> this nav-mesh)) + (set! (-> sv-240 params nav-branch) #f) + (set! (-> sv-240 params proc) #f) + (set! (-> sv-240 params handle) (the-as handle #f)) + (set! (-> sv-240 params user-data) (the-as uint 0)) + (set! (-> sv-240 params flags) (traffic-spawn-flags)) + (set! (-> sv-240 params guard-type) (the-as uint 11)) + (set! (-> sv-240 params entity) #f) + (vector-copy! (-> sv-240 params velocity) (-> sv-240 vec)) + (vector-copy! (-> sv-240 params position) (-> s0-0 pos)) + (quaternion-copy! (-> sv-240 params rotation) (-> s0-0 quat)) (let ((s0-1 (vehicle-spawn (vehicle-type v-marauder) (-> sv-240 params)))) (when s0-1 (iterate-prims diff --git a/test/decompiler/reference/jak3/levels/desert/race/turtle-training_REF.gc b/test/decompiler/reference/jak3/levels/desert/race/turtle-training_REF.gc index 7ff6f9c6b0..018c1feaa1 100644 --- a/test/decompiler/reference/jak3/levels/desert/race/turtle-training_REF.gc +++ b/test/decompiler/reference/jak3/levels/desert/race/turtle-training_REF.gc @@ -263,7 +263,6 @@ ;; definition for method 21 of type task-manager-desert-turtle-training ;; INFO: Used lq/sq (defmethod set-time-limit ((this task-manager-desert-turtle-training)) - (local-vars (sv-16 res-tag)) (let ((t9-0 (method-of-type task-manager set-time-limit))) (t9-0 this) ) @@ -275,8 +274,9 @@ (set! (-> this max-count) 0) (let ((a0-8 (entity-by-name "training-1"))) (when a0-8 - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-7 (res-lump-data a0-8 'actor-groups (pointer actor-group) :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-7 (res-lump-data a0-8 'actor-groups (pointer actor-group) :tag-ptr (& sv-16))) + ) (cond ((and v1-7 (nonzero? (-> sv-16 elt-count))) (set! (-> this max-count) (-> v1-7 0 length)) diff --git a/test/decompiler/reference/jak3/levels/desert/rescue/desert-rescue-bbush_REF.gc b/test/decompiler/reference/jak3/levels/desert/rescue/desert-rescue-bbush_REF.gc index 6df10b7d89..0a8e3f0fb4 100644 --- a/test/decompiler/reference/jak3/levels/desert/rescue/desert-rescue-bbush_REF.gc +++ b/test/decompiler/reference/jak3/levels/desert/rescue/desert-rescue-bbush_REF.gc @@ -116,14 +116,14 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch connection vs none. (defmethod set-time-limit ((this task-manager-desert-rescue-bbush)) - (local-vars (sv-16 res-tag)) (set-setting! 'pilot-exit #f 0.0 0) (let ((t1-1 2)) (set-setting! 'vehicles 'set (shr t1-1 32) t1-1) ) (set-setting! 'airlock #f 0.0 0) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-7 (res-lump-data (entity-by-name "desresc-bbush-info-1") 'actor-groups pointer :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-7 (res-lump-data (entity-by-name "desresc-bbush-info-1") 'actor-groups pointer :tag-ptr (& sv-16))) + ) (cond ((and v1-7 (nonzero? (-> sv-16 elt-count))) (set! (-> this actor-group) (the-as (pointer actor-group) v1-7)) diff --git a/test/decompiler/reference/jak3/levels/desert/rescue/desert-rescue_REF.gc b/test/decompiler/reference/jak3/levels/desert/rescue/desert-rescue_REF.gc index 18dda82e1a..505398bea7 100644 --- a/test/decompiler/reference/jak3/levels/desert/rescue/desert-rescue_REF.gc +++ b/test/decompiler/reference/jak3/levels/desert/rescue/desert-rescue_REF.gc @@ -1873,11 +1873,7 @@ (when (< f0-5 81920.0) (when (not (-> self is-braking?)) (set! (-> self is-braking?) #t) - (let ((f1-6 0.5) - (f2-3 (-> self move-speed)) - ) - (set! (-> self seek-speed) (/ (* f1-6 (* f2-3 f2-3)) f0-5)) - ) + (set! (-> self seek-speed) (/ (* 0.5 (square (-> self move-speed))) f0-5)) ) (set! (-> self target-move-speed) 0.0) ) @@ -2648,7 +2644,7 @@ ) ) (if (-> this passenger-pos (-> this current-passenger-index) is-final?) - (set! f2-2 (* f2-2 f2-2)) + (set! f2-2 (square f2-2)) ) (set-setting! 'fog-special-interp-targ #f (lerp f1-1 f0-0 f2-2) 0) ) diff --git a/test/decompiler/reference/jak3/levels/desert/rescue/neo-satellite_REF.gc b/test/decompiler/reference/jak3/levels/desert/rescue/neo-satellite_REF.gc index bd1b81dcae..4a6058478f 100644 --- a/test/decompiler/reference/jak3/levels/desert/rescue/neo-satellite_REF.gc +++ b/test/decompiler/reference/jak3/levels/desert/rescue/neo-satellite_REF.gc @@ -2395,9 +2395,7 @@ (neo-sat-method-230 self) ) (neo-sat-method-201 self) - (let* ((f0-1 (* 0.0033333334 (the float (- (current-time) (-> self state-time))))) - (f30-0 (* f0-1 f0-1)) - ) + (let ((f30-0 (square (* 0.0033333334 (the float (- (current-time) (-> self state-time))))))) (set! (-> self bob-speed-scalar) (lerp 1.0 10.0 f30-0)) (set! (-> self spin-current) (lerp 49152.0 98304.0 f30-0)) ) @@ -2494,9 +2492,7 @@ (zero? (-> this sound-next-play-time s2-1)) ) (set-time! (-> this sound-last-snap-time s2-1)) - (let* ((f0-10 (* 0.000030517578 (fabs (-> this spin-speed)))) - (f0-11 (* f0-10 f0-10)) - ) + (let ((f0-11 (square (* 0.000030517578 (fabs (-> this spin-speed)))))) (set! (-> this sound-next-play-time s2-1) (+ (current-time) (the int (* 300.0 (lerp 0.3 0.0 f0-11))))) ) ) @@ -2513,7 +2509,7 @@ (let* ((f0-23 (acos (vector-dot s2-3 s3-0))) (f0-24 (/ f0-23 (meters 8))) (f22-0 (- 1.0 f0-24)) - (f1-10 (+ (lerp 0.0 0.75 (* f22-0 f22-0)) (lerp -0.25 0.25 f26-1))) + (f1-10 (+ (lerp 0.0 0.75 (square f22-0)) (lerp -0.25 0.25 f26-1))) (f24-1 (fmax 0.0 (fmin 1.0 f1-10))) (f0-29 (+ (lerp -0.5 0.5 f22-0) (lerp 0.0 0.5 f26-1))) (f0-30 (fmin 1.0 f0-29)) @@ -2699,11 +2695,9 @@ ;; definition for method 210 of type neo-sat (defmethod neo-sat-method-210 ((this neo-sat)) - (let ((f0-0 143360.0)) - (if (< (* f0-0 f0-0) (vector-vector-xz-distance-squared (-> this root trans) (-> this focus-pos))) - (go (method-of-object this ground-burst)) - ) - ) + (if (< (square 143360.0) (vector-vector-xz-distance-squared (-> this root trans) (-> this focus-pos))) + (go (method-of-object this ground-burst)) + ) (-> this spin-current) 0.0 (let ((f0-5 1.0) @@ -3976,14 +3970,13 @@ ;; definition for method 218 of type neo-sat (defmethod neo-sat-method-218 ((this neo-sat) (arg0 vector)) - (local-vars (sv-32 int) (sv-40 int) (sv-48 int) (sv-56 int)) (let ((s5-0 (new 'stack-no-clear 'vector))) (neo-sat-method-212 this arg0 s5-0) - (set! sv-32 (neo-sat-method-213 this (-> s5-0 x))) - (set! sv-40 (neo-sat-method-213 this (+ 9216.0 (-> s5-0 x)))) - (set! sv-48 (neo-sat-method-214 this (-> s5-0 y))) - (set! sv-56 (neo-sat-method-214 this (+ 9216.0 (-> s5-0 y)))) - (let* ((f26-0 (-> this hashed-heights (neo-sat-method-217 this sv-32 sv-48))) + (let* ((sv-32 (neo-sat-method-213 this (-> s5-0 x))) + (sv-40 (neo-sat-method-213 this (+ 9216.0 (-> s5-0 x)))) + (sv-48 (neo-sat-method-214 this (-> s5-0 y))) + (sv-56 (neo-sat-method-214 this (+ 9216.0 (-> s5-0 y)))) + (f26-0 (-> this hashed-heights (neo-sat-method-217 this sv-32 sv-48))) (f24-0 (-> this hashed-heights (neo-sat-method-217 this sv-32 sv-56))) (f30-0 (-> this hashed-heights (neo-sat-method-217 this sv-40 sv-48))) (f28-0 (-> this hashed-heights (neo-sat-method-217 this sv-40 sv-56))) @@ -4010,7 +4003,6 @@ ;; ERROR: Stack slot load at 48 mismatch: defined as size 4, got size 16 ;; ERROR: Stack slot load at 64 mismatch: defined as size 4, got size 16 (defmethod neo-sat-method-222 ((this neo-sat) (arg0 object) (arg1 vector)) - (local-vars (sv-16 float) (sv-32 float) (sv-48 float) (sv-64 float)) (let* ((s4-0 (neo-sat-method-213 this (-> arg1 x))) (s3-0 (neo-sat-method-213 this (+ 9216.0 (-> arg1 x)))) (s2-0 (neo-sat-method-214 this (-> arg1 y))) @@ -4019,26 +4011,10 @@ (f24-0 (-> this hashed-heights (neo-sat-method-217 this s4-0 s1-0))) (f30-0 (-> this hashed-heights (neo-sat-method-217 this s3-0 s2-0))) (f28-0 (-> this hashed-heights (neo-sat-method-217 this s3-0 s1-0))) - (s0-0 lerp-scale) + (f26-1 (lerp-scale f26-0 f24-0 (neo-sat-method-216 this (-> arg1 y)) (the float s2-0) (the float s1-0))) + (f0-20 (lerp-scale f30-0 f28-0 (neo-sat-method-216 this (-> arg1 y)) (the float s2-0) (the float s1-0))) ) - (set! sv-16 f26-0) - (set! sv-32 f24-0) - (let* ((a2-5 (neo-sat-method-216 this (-> arg1 y))) - (a3-0 (the float s2-0)) - (t0-0 (the float s1-0)) - (f26-1 (s0-0 sv-16 sv-32 a2-5 a3-0 t0-0)) - (s0-1 lerp-scale) - ) - (set! sv-48 f30-0) - (set! sv-64 f28-0) - (let* ((a2-6 (neo-sat-method-216 this (-> arg1 y))) - (a3-1 (the float s2-0)) - (t0-1 (the float s1-0)) - (f0-20 (s0-1 sv-48 sv-64 a2-6 a3-1 t0-1)) - ) - (lerp-scale f26-1 f0-20 (neo-sat-method-215 this (-> arg1 x)) (the float s4-0) (the float s3-0)) - ) - ) + (lerp-scale f26-1 f0-20 (neo-sat-method-215 this (-> arg1 x)) (the float s4-0) (the float s3-0)) ) ) diff --git a/test/decompiler/reference/jak3/levels/desert/rescue/rope-prim-system_REF.gc b/test/decompiler/reference/jak3/levels/desert/rescue/rope-prim-system_REF.gc index 433f6c3074..c461d60843 100644 --- a/test/decompiler/reference/jak3/levels/desert/rescue/rope-prim-system_REF.gc +++ b/test/decompiler/reference/jak3/levels/desert/rescue/rope-prim-system_REF.gc @@ -24,21 +24,6 @@ ;; definition for method 19 of type rope-prim-system ;; INFO: Used lq/sq (defmethod rope-system-method-19 ((this rope-prim-system)) - (local-vars - (sv-112 vector) - (sv-116 vector) - (sv-120 matrix) - (sv-124 float) - (sv-128 float) - (sv-132 float) - (sv-136 float) - (sv-240 vector) - (sv-244 vector) - (sv-248 vector) - (sv-252 vector) - (sv-256 object) - (sv-260 rgbaf) - ) (let ((f30-0 0.0)) 0.0 (set! (-> this strip1 num-verts) (the-as uint 0)) @@ -52,44 +37,49 @@ (logior! (-> this strip1 flags) (prim-flags fog-enable)) (logior! (-> this strip2 flags) (prim-flags fog-enable)) (dotimes (s5-0 (-> this knots length)) - (set! sv-112 (new 'stack-no-clear 'vector)) - (set! sv-116 (new 'stack-no-clear 'vector)) - (set! sv-120 (new 'stack-no-clear 'matrix)) - (set! sv-124 (-> this width)) - (set! sv-128 (-> this alpha)) - (set! sv-132 (the-as float 0.0)) - (set! sv-136 (the-as float 0.0)) - (vector-copy! sv-112 (-> this knots data s5-0 pos)) - (cond - ((< s5-0 (+ (-> this knots length) -1)) - (vector-! sv-116 (-> this knots data (+ s5-0 1) pos) sv-112) - (set! sv-136 (vector-vector-distance sv-112 (-> this knots data (+ s5-0 1) pos))) - ) - (else - (vector-! sv-116 sv-112 (-> this knots data (+ s5-0 -1) pos)) + (let ((sv-112 (new 'stack-no-clear 'vector)) + (sv-116 (new 'stack-no-clear 'vector)) + (sv-120 (new 'stack-no-clear 'matrix)) + (sv-124 (-> this width)) + (sv-128 (-> this alpha)) + (sv-132 (the-as float 0.0)) + (sv-136 (the-as float 0.0)) + ) + (vector-copy! sv-112 (-> this knots data s5-0 pos)) + (cond + ((< s5-0 (+ (-> this knots length) -1)) + (vector-! sv-116 (-> this knots data (+ s5-0 1) pos) sv-112) + (set! sv-136 (vector-vector-distance sv-112 (-> this knots data (+ s5-0 1) pos))) + ) + (else + (vector-! sv-116 sv-112 (-> this knots data (+ s5-0 -1) pos)) + ) ) + (let ((f0-7 (/ f30-0 (-> this uv-repeat-dist)))) + (set! sv-132 (- f0-7 (* (the float (the int (/ f0-7 6.0))) 6.0))) + ) + (vector-normalize! sv-116 1.0) + (matrix-f-u-compose sv-120 sv-116 *up-vector*) + (let ((sv-240 (vector+float*! (new 'stack-no-clear 'vector) sv-112 (-> sv-120 rvec) (* 0.5 sv-124))) + (sv-244 (vector+float*! (new 'stack-no-clear 'vector) sv-112 (-> sv-120 rvec) (* -0.5 sv-124))) + (sv-248 (vector+float*! (new 'stack-no-clear 'vector) sv-112 (-> sv-120 uvec) (* 0.5 sv-124))) + (sv-252 (vector+float*! (new 'stack-no-clear 'vector) sv-112 (-> sv-120 uvec) (* -0.5 sv-124))) + (sv-256 (new 'stack-no-clear 'rgbaf)) + ) + (let ((sv-260 (new 'stack-no-clear 'rgbaf))) + (set! (-> sv-260 x) 1.0) + (set! (-> sv-260 y) 1.0) + (set! (-> sv-260 z) 1.0) + (set! (-> sv-260 w) sv-128) + (set! sv-256 (rgba<-rgbaf (the-as rgba (the-as rgbaf sv-256)) sv-260)) + ) + (add-prim-vert this (-> this strip1) sv-240 (the-as rgba sv-256) 0.0 sv-132) + (add-prim-vert this (-> this strip1) sv-244 (the-as rgba sv-256) 1.0 sv-132) + (add-prim-vert this (-> this strip2) sv-248 (the-as rgba sv-256) 1.0 sv-132) + (add-prim-vert this (-> this strip2) sv-252 (the-as rgba sv-256) 0.0 sv-132) + ) + (+! f30-0 sv-136) ) - (let ((f0-7 (/ f30-0 (-> this uv-repeat-dist)))) - (set! sv-132 (- f0-7 (* (the float (the int (/ f0-7 6.0))) 6.0))) - ) - (vector-normalize! sv-116 1.0) - (matrix-f-u-compose sv-120 sv-116 *up-vector*) - (set! sv-240 (vector+float*! (new 'stack-no-clear 'vector) sv-112 (-> sv-120 rvec) (* 0.5 sv-124))) - (set! sv-244 (vector+float*! (new 'stack-no-clear 'vector) sv-112 (-> sv-120 rvec) (* -0.5 sv-124))) - (set! sv-248 (vector+float*! (new 'stack-no-clear 'vector) sv-112 (-> sv-120 uvec) (* 0.5 sv-124))) - (set! sv-252 (vector+float*! (new 'stack-no-clear 'vector) sv-112 (-> sv-120 uvec) (* -0.5 sv-124))) - (set! sv-256 (new 'stack-no-clear 'rgbaf)) - (set! sv-260 (new 'stack-no-clear 'rgbaf)) - (set! (-> sv-260 x) 1.0) - (set! (-> sv-260 y) 1.0) - (set! (-> sv-260 z) 1.0) - (set! (-> sv-260 w) sv-128) - (set! sv-256 (rgba<-rgbaf (the-as rgba sv-256) sv-260)) - (add-prim-vert this (-> this strip1) sv-240 sv-256 0.0 sv-132) - (add-prim-vert this (-> this strip1) sv-244 sv-256 1.0 sv-132) - (add-prim-vert this (-> this strip2) sv-248 sv-256 1.0 sv-132) - (add-prim-vert this (-> this strip2) sv-252 sv-256 0.0 sv-132) - (+! f30-0 sv-136) ) ) 1 @@ -226,7 +216,6 @@ ;; definition for method 19 of type rope-joint-system ;; INFO: Used lq/sq (defmethod rope-system-method-19 ((this rope-joint-system)) - (local-vars (sv-288 vector)) (call-parent-method this) (let* ((s5-0 (-> this joint-mods data)) (s4-0 (handle->process (-> this proc))) @@ -282,15 +271,14 @@ (vector-! s2-1 (-> a0-15 pos) (-> v1-18 pos)) (vector-normalize! s2-1 1.0) (let ((s3-1 (-> this joint-mods data s5-2))) - (let ((s1-0 matrix-u-f-compose) - (s0-0 (new 'stack-no-clear 'matrix)) + (let ((a1-28 (matrix-u-f-compose + (new 'stack-no-clear 'matrix) + s2-1 + (vector-z-quaternion! (new 'stack-no-clear 'vector) (-> s3-1 transform quat)) + ) + ) ) - (set! sv-288 s2-1) - (let* ((a2-4 (vector-z-quaternion! (new 'stack-no-clear 'vector) (-> s3-1 transform quat))) - (a1-28 (s1-0 s0-0 sv-288 a2-4)) - ) - (matrix->quaternion (-> s3-1 transform quat) a1-28) - ) + (matrix->quaternion (-> s3-1 transform quat) a1-28) ) (quaternion-normalize! (-> s3-1 transform quat)) (let* ((v1-24 (-> this joint-mods data (+ s5-2 -1))) diff --git a/test/decompiler/reference/jak3/levels/desert/rescue/rope-system_REF.gc b/test/decompiler/reference/jak3/levels/desert/rescue/rope-system_REF.gc index 3fc3dc512c..b4974f2083 100644 --- a/test/decompiler/reference/jak3/levels/desert/rescue/rope-system_REF.gc +++ b/test/decompiler/reference/jak3/levels/desert/rescue/rope-system_REF.gc @@ -148,28 +148,7 @@ ;; definition for method 15 of type rope-system ;; INFO: Used lq/sq (defmethod rope-system-method-15 ((this rope-system)) - (local-vars - (f24-0 float) - (sv-144 symbol) - (sv-160 int) - (sv-176 (function _varargs_ object)) - (sv-192 symbol) - (sv-208 int) - (sv-224 (function _varargs_ object)) - (sv-240 vector) - (sv-256 vector) - (sv-272 symbol) - (sv-288 int) - (sv-304 (function _varargs_ object)) - (sv-320 symbol) - (sv-336 int) - (sv-352 (function _varargs_ object)) - (sv-368 vector) - (sv-384 int) - (sv-400 (function _varargs_ object)) - (sv-416 int) - (sv-432 (function _varargs_ object)) - ) + (local-vars (f24-0 float)) (rlet ((vf0 :class vf) (vf1 :class vf) (vf2 :class vf) @@ -214,173 +193,98 @@ (f1-5 (+ f0-7 f2-3)) (f28-0 (/ f2-3 f1-5)) (f26-0 (/ f0-7 f1-5)) + (s1-1 (new 'stack-no-clear 'vector)) ) - (let ((s1-1 (new 'stack-no-clear 'vector))) - (vector-copy! s1-1 (-> s3-0 pos)) - (set! sv-368 (new 'stack-no-clear 'vector)) - (let ((v1-35 (-> s2-0 pos quad))) - (set! (-> sv-368 quad) v1-35) - ) - (set! sv-240 (new 'stack-no-clear 'vector)) - (let ((v1-38 (-> s4-1 quad))) - (set! (-> sv-240 quad) v1-38) - ) - (set! sv-256 (new 'stack-no-clear 'vector)) - (let ((v1-40 s4-1) - (f0-8 -1.0) + (vector-copy! s1-1 (-> s3-0 pos)) + (let ((sv-368 (new 'stack-no-clear 'vector))) + (vector-copy! sv-368 (-> s2-0 pos)) + (let ((sv-240 (new 'stack-no-clear 'vector))) + (vector-copy! sv-240 s4-1) + (let ((sv-256 (new 'stack-no-clear 'vector))) + (let ((v1-40 s4-1) + (f0-8 -1.0) + ) + (.lvf vf1 (&-> v1-40 quad)) + (let ((v1-41 f0-8)) + (.mov vf2 v1-41) + ) ) - (.lvf vf1 (&-> v1-40 quad)) - (let ((v1-41 f0-8)) - (.mov vf2 v1-41) - ) - ) - (.add.x.vf.w vf1 vf0 vf0) - (.mul.x.vf.xyz vf1 vf1 vf2) - (.svf (&-> sv-256 quad) vf1) - (add-debug-line #f (bucket-id debug) s1-1 sv-368 *color-red* #f (the-as rgba -1)) - (vector-rotate-around-axis! sv-240 sv-240 f24-0 s0-0) - (vector-rotate-around-axis! sv-256 sv-256 f24-0 s0-0) - (vector-normalize! sv-240 1.0) - (vector-normalize! sv-256 1.0) - (add-debug-line - #f - (bucket-id debug) - s1-1 - (vector+float*! (new 'stack-no-clear 'vector) s1-1 sv-240 f30-0) - *color-yellow* - #f - (the-as rgba -1) - ) - (add-debug-line - #f - (bucket-id debug) - sv-368 - (vector+float*! (new 'stack-no-clear 'vector) sv-368 sv-256 f30-0) - *color-white* - #f - (the-as rgba -1) - ) - (let ((s0-1 add-debug-text-3d)) - (set! sv-144 (the-as symbol #f)) - (set! sv-160 583) - (set! sv-176 format) - (let ((a0-37 (clear *temp-string*)) - (a1-13 "p0") - ) - (sv-176 a0-37 a1-13) - ) - (let ((a2-8 *temp-string*) - (a3-7 s1-1) - (t0-5 3) - (t1-3 #f) - ) - (s0-1 sv-144 (the-as bucket-id sv-160) a2-8 a3-7 (the-as font-color t0-5) (the-as vector2h t1-3)) - ) - ) - (let ((s0-2 add-debug-text-3d)) - (set! sv-192 (the-as symbol #f)) - (set! sv-208 583) - (set! sv-224 format) - (let ((a0-40 (clear *temp-string*)) - (a1-15 "p1") - ) - (sv-224 a0-40 a1-15) - ) - (let ((a2-9 *temp-string*) - (a3-8 sv-368) - (t0-6 3) - (t1-4 #f) - ) - (s0-2 sv-192 (the-as bucket-id sv-208) a2-9 a3-8 (the-as font-color t0-6) (the-as vector2h t1-4)) - ) - ) - (let ((v1-49 sv-368) - (a0-42 s3-0) - (f0-11 f30-0) + (.add.x.vf.w vf1 vf0 vf0) + (.mul.x.vf.xyz vf1 vf1 vf2) + (.svf (&-> sv-256 quad) vf1) + (add-debug-line #f (bucket-id debug) s1-1 sv-368 *color-red* #f (the-as rgba -1)) + (vector-rotate-around-axis! sv-240 sv-240 f24-0 s0-0) + (vector-rotate-around-axis! sv-256 sv-256 f24-0 s0-0) + (vector-normalize! sv-240 1.0) + (vector-normalize! sv-256 1.0) + (add-debug-line + #f + (bucket-id debug) + s1-1 + (vector+float*! (new 'stack-no-clear 'vector) s1-1 sv-240 f30-0) + *color-yellow* + #f + (the-as rgba -1) ) - (vector+float*! v1-49 (-> a0-42 pos) sv-240 f0-11) - ) - (vector+float*! s1-1 (-> s2-0 pos) sv-256 f30-0) - (let ((s0-3 add-debug-text-3d)) - (set! sv-272 (the-as symbol #f)) - (set! sv-288 583) - (set! sv-304 format) - (let ((a0-45 (clear *temp-string*)) - (a1-19 "p0new") - ) - (sv-304 a0-45 a1-19) - ) - (let ((a2-10 *temp-string*) - (a3-9 s1-1) - (t0-7 7) - (t1-5 #f) - ) - (s0-3 sv-272 (the-as bucket-id sv-288) a2-10 a3-9 (the-as font-color t0-7) (the-as vector2h t1-5)) + (add-debug-line + #f + (bucket-id debug) + sv-368 + (vector+float*! (new 'stack-no-clear 'vector) sv-368 sv-256 f30-0) + *color-white* + #f + (the-as rgba -1) + ) + (let ((s0-1 add-debug-text-3d) + (sv-144 (the-as symbol #f)) + (sv-160 583) + ) + (format (clear *temp-string*) "p0") + (s0-1 sv-144 (the-as bucket-id sv-160) *temp-string* s1-1 (font-color red) (the-as vector2h #f)) + ) + (let ((s0-2 add-debug-text-3d) + (sv-192 (the-as symbol #f)) + (sv-208 583) + ) + (format (clear *temp-string*) "p1") + (s0-2 sv-192 (the-as bucket-id sv-208) *temp-string* sv-368 (font-color red) (the-as vector2h #f)) + ) + (vector+float*! sv-368 (-> s3-0 pos) sv-240 f30-0) + (vector+float*! s1-1 (-> s2-0 pos) sv-256 f30-0) ) ) - (let ((s0-4 add-debug-text-3d)) - (set! sv-320 (the-as symbol #f)) - (set! sv-336 583) - (set! sv-352 format) - (let ((a0-48 (clear *temp-string*)) - (a1-21 "p1new") - ) - (sv-352 a0-48 a1-21) - ) - (let ((a2-11 *temp-string*) - (a3-10 sv-368) - (t0-8 7) - (t1-6 #f) - ) - (s0-4 sv-320 (the-as bucket-id sv-336) a2-11 a3-10 (the-as font-color t0-8) (the-as vector2h t1-6)) - ) + (let ((s0-3 add-debug-text-3d) + (sv-272 (the-as symbol #f)) + (sv-288 583) + ) + (format (clear *temp-string*) "p0new") + (s0-3 sv-272 (the-as bucket-id sv-288) *temp-string* s1-1 (font-color blue) (the-as vector2h #f)) + ) + (let ((s0-4 add-debug-text-3d) + (sv-320 (the-as symbol #f)) + (sv-336 583) + ) + (format (clear *temp-string*) "p1new") + (s0-4 sv-320 (the-as bucket-id sv-336) *temp-string* sv-368 (font-color blue) (the-as vector2h #f)) ) (vector-lerp! (-> s3-0 pos) (-> s3-0 pos) s1-1 f28-0) - ) - (let ((t9-25 vector-lerp!) - (a0-51 s2-0) - (a1-24 s2-0) - (a3-12 f26-0) - ) - (t9-25 (-> a0-51 pos) (-> a1-24 pos) sv-368 a3-12) + (vector-lerp! (-> s2-0 pos) (-> s2-0 pos) sv-368 f26-0) ) ) ) (let ((s1-2 add-debug-text-3d) (s0-5 #f) + (sv-384 583) ) - (set! sv-384 583) - (set! sv-400 format) - (let ((a0-53 (clear *temp-string*)) - (a1-25 "p0f") - ) - (sv-400 a0-53 a1-25) - ) - (let ((a2-14 *temp-string*) - (a3-13 s3-0) - (t0-9 6) - (t1-7 #f) - ) - (s1-2 s0-5 (the-as bucket-id sv-384) a2-14 (-> a3-13 pos) (the-as font-color t0-9) (the-as vector2h t1-7)) - ) + (format (clear *temp-string*) "p0f") + (s1-2 s0-5 (the-as bucket-id sv-384) *temp-string* (-> s3-0 pos) (font-color green) (the-as vector2h #f)) ) (let ((s1-3 add-debug-text-3d) (s0-6 #f) + (sv-416 583) ) - (set! sv-416 583) - (set! sv-432 format) - (let ((a0-56 (clear *temp-string*)) - (a1-27 "p1f") - ) - (sv-432 a0-56 a1-27) - ) - (let ((a2-15 *temp-string*) - (a3-14 s2-0) - (t0-10 6) - (t1-8 #f) - ) - (s1-3 s0-6 (the-as bucket-id sv-416) a2-15 (-> a3-14 pos) (the-as font-color t0-10) (the-as vector2h t1-8)) - ) + (format (clear *temp-string*) "p1f") + (s1-3 s0-6 (the-as bucket-id sv-416) *temp-string* (-> s2-0 pos) (font-color green) (the-as vector2h #f)) ) (vector-! s4-1 (-> s2-0 pos) (-> s3-0 pos)) (vector-normalize! s4-1 1.0) diff --git a/test/decompiler/reference/jak3/levels/desert/wvehicle/w-parking-spot_REF.gc b/test/decompiler/reference/jak3/levels/desert/wvehicle/w-parking-spot_REF.gc index 6d1ea85ce8..a46b2ba891 100644 --- a/test/decompiler/reference/jak3/levels/desert/wvehicle/w-parking-spot_REF.gc +++ b/test/decompiler/reference/jak3/levels/desert/wvehicle/w-parking-spot_REF.gc @@ -95,9 +95,9 @@ (if v1-1 (or (focus-test? (the-as vehicle v1-1) dead inactive) (not (logtest? (vehicle-flag waiting-for-player) (-> (the-as vehicle v1-1) v-flags))) - (let ((f0-0 (-> this test-sphere r))) - (< (* f0-0 f0-0) (vector-vector-distance-squared (-> (the-as vehicle v1-1) root trans) (-> this test-sphere))) - ) + (< (square (-> this test-sphere r)) + (vector-vector-distance-squared (-> (the-as vehicle v1-1) root trans) (-> this test-sphere)) + ) (let ((v1-5 *target*)) (when v1-5 (if (focus-test? v1-5 pilot-riding) @@ -277,15 +277,11 @@ ) (w-parking-spot-method-21 self) (when (-> self should-spawn?) - (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)) - (if (or (< (* f1-3 f1-3) f0-0) (not (sphere-in-view-frustum? (-> self test-sphere)))) - (w-parking-spot-method-23 self) - ) - ) + (let ((f0-0 (vector-vector-distance-squared (camera-pos) (-> self test-sphere)))) + (when (< (square 327680.0) f0-0) + (if (or (< (square 614400.0) f0-0) (not (sphere-in-view-frustum? (-> self test-sphere)))) + (w-parking-spot-method-23 self) + ) ) ) ) diff --git a/test/decompiler/reference/jak3/levels/desert/wvehicle/was-squad-control_REF.gc b/test/decompiler/reference/jak3/levels/desert/wvehicle/was-squad-control_REF.gc index c8499b41e2..29a94b58f6 100644 --- a/test/decompiler/reference/jak3/levels/desert/wvehicle/was-squad-control_REF.gc +++ b/test/decompiler/reference/jak3/levels/desert/wvehicle/was-squad-control_REF.gc @@ -202,11 +202,8 @@ (vector-copy! (-> s5-1 1 fvec) (-> s5-1 0 trans)) (vector-copy! (-> s5-1 1 trans) (-> (the-as process-focusable s4-0) root transv)) (vector-copy! (-> s5-1 2 uvec) (-> s5-1 1 trans)) - (let* ((v1-8 (-> s5-1 1 trans)) - (f0-3 (+ (* (-> v1-8 x) (-> v1-8 x)) (* (-> v1-8 z) (-> v1-8 z)))) - (f1-3 4096.0) - ) - (if (< f0-3 (* f1-3 f1-3)) + (let ((v1-8 (-> s5-1 1 trans))) + (if (< (+ (* (-> v1-8 x) (-> v1-8 x)) (* (-> v1-8 z) (-> v1-8 z))) (square 4096.0)) (vector-copy! (-> s5-1 2 uvec) (-> (the-as process-focusable s4-0) node-list data 0 bone transform fvec)) ) ) @@ -281,18 +278,16 @@ (vector+float*! (-> s4-5 vec 0) (-> s4-5 cquery start-pos) (-> s4-5 cquery move-dist) f30-0) (set! (-> s5-1 3 rvec quad) (-> s4-5 vec 0 quad)) (set! (-> s5-1 3 rvec w) 20480.0) - (let ((f0-31 1024000.0)) - (when (or (< (* f0-31 f0-31) (vector-vector-distance-squared (-> s5-1 1 fvec) (-> s4-5 vec 0))) - (not (sphere-in-view-frustum? (the-as sphere (-> s5-1 3)))) - ) - (vector-copy! (-> s4-5 vec 1) (-> s4-5 cquery best-other-tri normal)) - (when (< (-> s4-5 vec 1 y) (cos 3640.889)) - (vector-reset! (-> s4-5 vec 1)) - (set! (-> s4-5 vec 1 y) 1.0) - ) - (forward-up-nopitch->quaternion (the-as quaternion (-> s5-1 2)) (-> s4-5 vec 2) (-> s4-5 vec 1)) - (spawn-unit this (-> s4-5 vec 0) (the-as quaternion (-> s5-1 2))) + (when (or (< (square 1024000.0) (vector-vector-distance-squared (-> s5-1 1 fvec) (-> s4-5 vec 0))) + (not (sphere-in-view-frustum? (the-as sphere (-> s5-1 3)))) + ) + (vector-copy! (-> s4-5 vec 1) (-> s4-5 cquery best-other-tri normal)) + (when (< (-> s4-5 vec 1 y) (cos 3640.889)) + (vector-reset! (-> s4-5 vec 1)) + (set! (-> s4-5 vec 1 y) 1.0) ) + (forward-up-nopitch->quaternion (the-as quaternion (-> s5-1 2)) (-> s4-5 vec 2) (-> s4-5 vec 1)) + (spawn-unit this (-> s4-5 vec 0) (the-as quaternion (-> s5-1 2))) ) ) (if (< f30-0 0.0) @@ -343,18 +338,16 @@ ) (set! (-> s5-1 0 rvec quad) (-> (the-as process-focusable s3-0) root trans quad)) (when (not (logtest? (-> (the-as process-focusable s3-0) draw status) (draw-control-status on-screen))) - (let ((f0-8 614400.0)) - (when (or (and (< (* f0-8 f0-8) (vector-vector-distance-squared (-> s5-1 0 uvec) (-> s5-1 0 rvec))) - (or (< (vector4-dot (-> s5-1 1 rvec) (-> s5-1 0 rvec)) 0.0) - (< (vector4-dot (-> s5-1 1 uvec) (-> s5-1 0 rvec)) 0.0) - ) - ) - (zero? (-> this target-count)) - ) - (when (send-event s3-0 'go-die) - (+! (-> this reserve-count) 1) - (set! (-> this units s4-1) (the-as handle #f)) - ) + (when (or (and (< (square 614400.0) (vector-vector-distance-squared (-> s5-1 0 uvec) (-> s5-1 0 rvec))) + (or (< (vector4-dot (-> s5-1 1 rvec) (-> s5-1 0 rvec)) 0.0) + (< (vector4-dot (-> s5-1 1 uvec) (-> s5-1 0 rvec)) 0.0) + ) + ) + (zero? (-> this target-count)) + ) + (when (send-event s3-0 'go-die) + (+! (-> this reserve-count) 1) + (set! (-> this units s4-1) (the-as handle #f)) ) ) ) diff --git a/test/decompiler/reference/jak3/levels/desert/wvehicle/wcar-marauder_REF.gc b/test/decompiler/reference/jak3/levels/desert/wvehicle/wcar-marauder_REF.gc index 238c17b78f..423f36a371 100644 --- a/test/decompiler/reference/jak3/levels/desert/wvehicle/wcar-marauder_REF.gc +++ b/test/decompiler/reference/jak3/levels/desert/wvehicle/wcar-marauder_REF.gc @@ -195,13 +195,9 @@ ((= v1-14 5) (let ((s5-3 (new 'stack-no-clear 'wcar-marauder-stack-var0))) (set! (-> s5-3 time) (the-as uint (current-time))) - (let ((f0-9 1.0) - (f1-7 1.0) - (f2-3 8.0) - (f3-2 (* 0.0033333334 (the float (- (-> s5-3 time) (-> this sub-state-time))))) + (set! (-> s5-3 float1) + (- 1.0 (fmin 1.0 (* 8.0 (square (* 0.0033333334 (the float (- (-> s5-3 time) (-> this sub-state-time)))))))) ) - (set! (-> s5-3 float1) (- f0-9 (fmin f1-7 (* f2-3 (* f3-2 f3-2))))) - ) (set! (-> s5-3 float0) (* 16384.0 (-> s5-3 float1))) (quaternion-axis-angle! (-> this jmod-hatch rotation) 1.0 0.0 0.0 (-> s5-3 float0)) (when (= (-> s5-3 float1) 0.0) diff --git a/test/decompiler/reference/jak3/levels/desert/wvehicle/wcar-toad_REF.gc b/test/decompiler/reference/jak3/levels/desert/wvehicle/wcar-toad_REF.gc index 09977a5452..e4846f2fb7 100644 --- a/test/decompiler/reference/jak3/levels/desert/wvehicle/wcar-toad_REF.gc +++ b/test/decompiler/reference/jak3/levels/desert/wvehicle/wcar-toad_REF.gc @@ -324,11 +324,7 @@ ) ) (set! (-> arg0 sin-susp-ang) (fmax -1.0 (fmin 1.0 (/ (- (-> gp-0 wsphere x)) (-> gp-0 wsphere z))))) - (let ((f0-52 1.0) - (f1-16 (-> arg0 sin-susp-ang)) - ) - (set! (-> arg0 cos-susp-ang) (sqrtf (- f0-52 (* f1-16 f1-16)))) - ) + (set! (-> arg0 cos-susp-ang) (sqrtf (- 1.0 (square (-> arg0 sin-susp-ang))))) (quaternion-identity! (the-as quaternion (-> gp-0 local-pos))) (set! (-> gp-0 local-pos z) (* (sin (-> arg1 camber)) (-> arg0 x-scale))) (set! (-> gp-0 local-pos w) (cos (-> arg1 camber))) diff --git a/test/decompiler/reference/jak3/levels/desert/wvehicle/wcar_REF.gc b/test/decompiler/reference/jak3/levels/desert/wvehicle/wcar_REF.gc index 7daaae5a79..8718c35e8c 100644 --- a/test/decompiler/reference/jak3/levels/desert/wvehicle/wcar_REF.gc +++ b/test/decompiler/reference/jak3/levels/desert/wvehicle/wcar_REF.gc @@ -3906,19 +3906,11 @@ (cond ((< (-> s5-0 vec0 7 w) (-> s5-0 vec0 2 y)) (set! (-> s5-0 vec0 2 y) (-> s5-0 vec0 7 w)) - (let ((f0-16 1.0) - (f1-3 (-> s5-0 vec0 7 w)) - ) - (set! (-> s5-0 vec0 2 z) (sqrtf (- f0-16 (* f1-3 f1-3)))) - ) + (set! (-> s5-0 vec0 2 z) (sqrtf (- 1.0 (square (-> s5-0 vec0 7 w))))) ) ((< (-> s5-0 vec0 2 y) (-> s5-0 vec0 7 z)) (set! (-> s5-0 vec0 2 y) (-> s5-0 vec0 7 z)) - (let ((f0-21 1.0) - (f1-7 (-> s5-0 vec0 7 z)) - ) - (set! (-> s5-0 vec0 2 z) (sqrtf (- f0-21 (* f1-7 f1-7)))) - ) + (set! (-> s5-0 vec0 2 z) (sqrtf (- 1.0 (square (-> s5-0 vec0 7 z))))) ) ) (if (< 0.0 (-> s5-0 vec0 2 z)) diff --git a/test/decompiler/reference/jak3/levels/desert/wvehicle/wvehicle-ai_REF.gc b/test/decompiler/reference/jak3/levels/desert/wvehicle/wvehicle-ai_REF.gc index 1b2c365d2d..3c433a2cec 100644 --- a/test/decompiler/reference/jak3/levels/desert/wvehicle/wvehicle-ai_REF.gc +++ b/test/decompiler/reference/jak3/levels/desert/wvehicle/wvehicle-ai_REF.gc @@ -106,11 +106,9 @@ ) (vector-copy! (-> gp-0 mat fvec) (-> this target-status position)) (vector-copy! (-> gp-0 mat trans) (-> this target-status velocity)) - (let ((f0-11 40960.0)) - (if (< (* f0-11 f0-11) (vector-length-squared (-> gp-0 mat trans))) - (vector-copy! (-> gp-0 force) (-> gp-0 mat trans)) - ) - ) + (if (< (square 40960.0) (vector-length-squared (-> gp-0 mat trans))) + (vector-copy! (-> gp-0 force) (-> gp-0 mat trans)) + ) (set! (-> gp-0 wheel-axis x) (fmax (fmin (+ 20480.0 (vector-length (-> gp-0 mat trans))) (-> this ai-max-speed)) (-> this ai-min-speed)) ) @@ -134,17 +132,13 @@ 1.0 ) ) - (let ((f0-25 (-> gp-0 wsphere z)) - (f1-8 40960.0) - ) - (when (< f0-25 (* f1-8 f1-8)) - (vector+float*! (-> gp-0 p-body) (-> gp-0 ground-normal-sum) (-> gp-0 ground-pos) 0.0) - (vector-! (-> gp-0 world-normal) (-> gp-0 axis) (-> gp-0 p-body)) - (vector-normalize! (-> gp-0 world-normal) 1.0) - (vector+float*! (-> gp-0 velocity) (-> gp-0 mat rvec) (-> gp-0 world-normal) 163840.0) - (set! (-> gp-0 wheel-axis x) (/ (-> gp-0 wheel-axis x) 2)) - 0 - ) + (when (< (-> gp-0 wsphere z) (square 40960.0)) + (vector+float*! (-> gp-0 p-body) (-> gp-0 ground-normal-sum) (-> gp-0 ground-pos) 0.0) + (vector-! (-> gp-0 world-normal) (-> gp-0 axis) (-> gp-0 p-body)) + (vector-normalize! (-> gp-0 world-normal) 1.0) + (vector+float*! (-> gp-0 velocity) (-> gp-0 mat rvec) (-> gp-0 world-normal) 163840.0) + (set! (-> gp-0 wheel-axis x) (/ (-> gp-0 wheel-axis x) 2)) + 0 ) ) 0 diff --git a/test/decompiler/reference/jak3/levels/desert/wvehicle/wvehicle-physics_REF.gc b/test/decompiler/reference/jak3/levels/desert/wvehicle/wvehicle-physics_REF.gc index f1a649d55d..c952da666e 100644 --- a/test/decompiler/reference/jak3/levels/desert/wvehicle/wvehicle-physics_REF.gc +++ b/test/decompiler/reference/jak3/levels/desert/wvehicle/wvehicle-physics_REF.gc @@ -183,311 +183,306 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defmethod vehicle-method-97 ((this wvehicle) (arg0 float) (arg1 vehicle-physics-work)) - (local-vars (sv-16 rigid-body-control)) - (set! sv-16 (-> this rbody)) - (dotimes (s3-0 (-> this info physics-model wheel-count)) - (let* ((s2-0 (-> this wheel s3-0)) - (s1-0 (-> s2-0 info)) - (f30-0 - (fmax - 0.0 - (- 1.0 (-> (the-as wvehicle-physics-work (+ (the-as uint arg1) (* 144 s3-0))) probe-work-array 0 probe-uu)) + (let ((sv-16 (-> this rbody))) + (dotimes (s3-0 (-> this info physics-model wheel-count)) + (let* ((s2-0 (-> this wheel s3-0)) + (s1-0 (-> s2-0 info)) + (f30-0 + (fmax + 0.0 + (- 1.0 (-> (the-as wvehicle-physics-work (+ (the-as uint arg1) (* 144 s3-0))) probe-work-array 0 probe-uu)) + ) ) ) - ) - (if (>= (-> this info handling cos-ground-effect-angle) (vector-dot (-> s2-0 ground-normal) (-> arg1 mat uvec))) - (set! f30-0 0.0) + (if (>= (-> this info handling cos-ground-effect-angle) (vector-dot (-> s2-0 ground-normal) (-> arg1 mat uvec))) + (set! f30-0 0.0) + ) + (set! (-> s2-0 up-force) 0.0) + (when (< 0.0 f30-0) + (rigid-body-control-method-23 sv-16 (-> s2-0 ground-pos) (-> arg1 velocity)) + (let* ((f0-4 0.0) + (f1-9 (* 2.0 + (-> this info info mass) + (-> this info extra gravity) + f30-0 + (-> this susp-spring-control) + (-> s1-0 suspension-spring) + ) + ) + (f2-5 0.25) + (f3-0 arg0) + (f0-5 (fmax f0-4 (+ f1-9 (* f2-5 + (/ 1.0 f3-0) + (-> this info info mass) + (-> s1-0 suspension-damping) + (fmax 0.0 (- (vector-dot (-> arg1 velocity) (-> s2-0 ground-normal)))) + ) + ) + ) + ) + ) + (set! (-> s2-0 up-force) f0-5) + (vector-float*! (-> arg1 force) (-> s2-0 ground-normal) f0-5) + ) + (apply-impact! sv-16 (-> s2-0 ground-pos) (-> arg1 force)) ) - (set! (-> s2-0 up-force) 0.0) - (when (< 0.0 f30-0) - (rigid-body-control-method-23 sv-16 (-> s2-0 ground-pos) (-> arg1 velocity)) - (let* ((f0-4 0.0) - (f1-9 (* 2.0 - (-> this info info mass) - (-> this info extra gravity) - f30-0 - (-> this susp-spring-control) - (-> s1-0 suspension-spring) + ) + ) + (dotimes (s3-1 (-> this info physics-model wheel-count)) + (let* ((s2-1 (-> this wheel s3-1)) + (s1-1 (-> s2-1 info)) + ) + (set! (-> arg1 probe-work-array 0 world-normal y) (* (-> s1-1 scale) (-> s1-1 radius))) + (set! (-> arg1 probe-work-array 0 ground-normal x) 1.0) + (when (< 0.0 (-> s2-1 up-force)) + (rigid-body-control-method-23 sv-16 (-> s2-1 ground-pos) (-> arg1 velocity)) + (if (logtest? (-> s2-1 surface flags) (vehicle-wheel-surface-flag moving)) + (vector-! (-> arg1 velocity) (-> arg1 velocity) (-> this surface-velocity)) + ) + (let ((s0-0 (the-as object (+ (+ (* 144 s3-1) 416) (the-as int arg1))))) + (vector-copy! (-> arg1 probe-work-array 0 local-normal) (-> (the-as wvehicle-physics-work s0-0) force)) + (vector+float*! + (-> (the-as wvehicle-physics-work s0-0) velocity) + (-> arg1 probe-work-array 0 local-normal) + (-> s2-1 ground-normal) + (- (vector-dot (-> arg1 probe-work-array 0 local-normal) (-> s2-1 ground-normal))) + ) + (vector-normalize! (the-as vector (+ (the-as int s0-0) 80)) 1.0) + (vector-cross! + (the-as vector (+ (the-as int s0-0) 96)) + (-> arg1 probe-work-array 0 local-normal) + (-> s2-1 ground-normal) + ) + (vector-normalize! (-> (the-as wvehicle-physics-work s0-0) world-pos) 1.0) + (vector-copy! + (-> (the-as wvehicle-physics-work arg1) forward-dir) + (-> (the-as wvehicle-physics-work s0-0) world-pos) + ) + (vector-copy! + (-> (the-as wvehicle-physics-work arg1) side-dir) + (-> (the-as wvehicle-physics-work s0-0) velocity) + ) + (vector-copy! + (-> (the-as wvehicle-physics-work s0-0) world-normal) + (-> (the-as wvehicle-physics-work arg1) velocity) + ) + ) + (set! (-> s2-1 side-vel) + (vector-dot + (-> (the-as wvehicle-physics-work arg1) velocity) + (-> (the-as wvehicle-physics-work arg1) side-dir) + ) + ) + (set! (-> s2-1 forward-vel) (vector-dot (-> arg1 velocity) (the-as vector (&-> arg1 impulse)))) + (set! (-> s2-1 up-vel) (vector-dot (-> arg1 velocity) (-> s2-1 ground-normal))) + (set! (-> s2-1 forward-slip-vel) + (+ (-> s2-1 forward-vel) (* -1.0 (-> arg1 probe-work-array 0 world-normal y) (-> s2-1 rev))) + ) + (let ((f0-25 (sqrtf (+ (square (-> s2-1 side-vel)) (square (-> s2-1 forward-slip-vel)))))) + (set! (-> s2-1 friction-coef) + (* (smooth-interp + (-> this info handling tire-static-friction) + (-> this info handling tire-dynamic-friction) + f0-25 + (-> this info handling tire-static-friction-speed) + (-> this info handling tire-dynamic-friction-speed) + ) + (-> s2-1 surface friction) + ) + ) + ) + (set! (-> arg1 probe-work-array 0 ground-normal x) (-> s2-1 surface drag)) + ) + (set! (-> arg1 probe-work-array 0 ground-pos y) (-> s2-1 torque)) + (when (< 0.0 (-> s2-1 up-force)) + (let ((f0-36 + (* (-> s2-1 up-force) + (-> s2-1 friction-coef) + (-> s1-1 forward-grip) + (-> arg1 probe-work-array 0 world-normal y) + ) + ) + (f1-29 + (/ (* (/ (-> s2-1 inertia) 2) (-> s2-1 forward-slip-vel)) + (* arg0 (-> arg1 probe-work-array 0 world-normal y)) + ) + ) + ) + (if (logtest? (-> s1-1 flags) (vehicle-wheel-flag vwf0)) + (set! f1-29 (* f1-29 (/ 1.0 (the float (-> this info physics-model drive-wheel-count))))) + ) + (set! (-> arg1 probe-work-array 0 probe-pos w) (fmax (fmin f1-29 f0-36) (- f0-36))) + ) + (+! (-> arg1 probe-work-array 0 ground-pos y) (-> arg1 probe-work-array 0 probe-pos w)) + ) + (set! (-> arg1 probe-work-array 0 ground-pos z) + (- (* -0.25 (/ 1.0 arg0) (-> s2-1 rev) (-> s2-1 inertia)) (-> arg1 probe-work-array 0 ground-pos y)) + ) + (set! (-> arg1 probe-work-array 0 ground-pos w) (fabs (-> s2-1 braking-torque))) + (set! (-> arg1 probe-work-array 0 ground-pos x) + (fmax + (fmin (-> arg1 probe-work-array 0 ground-pos z) (-> arg1 probe-work-array 0 ground-pos w)) + (- (-> arg1 probe-work-array 0 ground-pos w)) + ) + ) + (+! (-> arg1 probe-work-array 0 ground-pos y) (-> arg1 probe-work-array 0 ground-pos x)) + (let ((f0-57 (* -1.0 + (-> s2-1 rev) + (-> s2-1 inertia) + (-> arg1 probe-work-array 0 ground-normal x) + (-> this info handling rolling-resistance) ) ) - (f2-5 0.25) - (f3-0 arg0) - (f0-5 (fmax f0-4 (+ f1-9 (* f2-5 - (/ 1.0 f3-0) - (-> this info info mass) - (-> s1-0 suspension-damping) - (fmax 0.0 (- (vector-dot (-> arg1 velocity) (-> s2-0 ground-normal)))) - ) - ) - ) - ) - ) - (set! (-> s2-0 up-force) f0-5) - (vector-float*! (-> arg1 force) (-> s2-0 ground-normal) f0-5) + ) + (if (logtest? (vehicle-flag turbo-boost) (-> this v-flags)) + (set! f0-57 (/ f0-57 20)) + ) + (+! (-> arg1 probe-work-array 0 ground-pos y) f0-57) ) - (apply-impact! sv-16 (-> s2-0 ground-pos) (-> arg1 force)) + (cond + ((logtest? (-> s1-1 flags) (vehicle-wheel-flag vwf0)) + (+! (-> this wheel-torque) (-> arg1 probe-work-array 0 ground-pos y)) + ) + (else + (let ((f0-61 (-> s2-1 rev)) + (f1-49 (* (-> arg1 probe-work-array 0 ground-pos y) arg0)) + (f2-20 (-> s2-1 inertia)) + ) + (set! (-> s2-1 rev) (+ f0-61 (* f1-49 (/ 1.0 f2-20)))) + ) + (set! (-> s2-1 rev) (fmax -125.6637 (fmin 125.6637 (-> s2-1 rev)))) + ) + ) + ) + 0 + ) + (let ((f0-65 (-> this wheel-rev)) + (f1-54 (* arg0 (-> this wheel-torque))) + (f2-25 (-> this wheel-inertia)) + ) + (set! (-> this wheel-rev) (+ f0-65 (* f1-54 (/ 1.0 f2-25)))) + ) + (set! (-> this wheel-rev) (fmax -125.6637 (fmin 125.6637 (-> this wheel-rev)))) + (dotimes (v1-110 (-> this info physics-model wheel-count)) + (let ((a0-28 (-> this wheel v1-110))) + (if (logtest? (-> a0-28 info flags) (vehicle-wheel-flag vwf0)) + (set! (-> a0-28 rev) (* (-> this wheel-rev) (-> a0-28 drive-diff))) + ) ) ) - ) - (dotimes (s3-1 (-> this info physics-model wheel-count)) - (let* ((s2-1 (-> this wheel s3-1)) - (s1-1 (-> s2-1 info)) + (let* ((f0-71 (-> this info engine inertia)) + (f1-59 (-> this clutch-grab)) + (f2-29 (-> this clutch-inertia)) + (f3-12 (-> this gear-ratio)) + (f3-16 (square (/ 1.0 f3-12))) + (f4-5 (-> this info transmission inertia)) + (f5-0 (-> this final-drive-ratio)) ) - (set! (-> arg1 probe-work-array 0 world-normal y) (* (-> s1-1 scale) (-> s1-1 radius))) - (set! (-> arg1 probe-work-array 0 ground-normal x) 1.0) - (when (< 0.0 (-> s2-1 up-force)) - (rigid-body-control-method-23 sv-16 (-> s2-1 ground-pos) (-> arg1 velocity)) - (if (logtest? (-> s2-1 surface flags) (vehicle-wheel-surface-flag moving)) - (vector-! (-> arg1 velocity) (-> arg1 velocity) (-> this surface-velocity)) + (set! (-> arg1 probe-work-array 0 probe-pos z) + (+ f0-71 (* f1-59 (+ f2-29 (* f3-16 (+ f4-5 (* (square (/ 1.0 f5-0)) (-> this drive-wheel-inertia))))))) + ) + ) + (let* ((f3-18 (- (* (- (fmax 0.0 (* (-> this total-gear-ratio) (-> this wheel-rev))) (-> this engine-rev)) + (-> arg1 probe-work-array 0 probe-pos z) + (/ 1.0 arg0) + ) + (-> this engine-torque) + ) + ) + (f0-78 (-> this engine-rev)) + (f1-69 (* arg0 (+ (-> this engine-torque) (* f3-18 (-> this clutch-grab))))) + (f2-35 (-> arg1 probe-work-array 0 probe-pos z)) + ) + (set! (-> this engine-rev) (+ f0-78 (* f1-69 (/ 1.0 f2-35)))) + ) + (let* ((f0-80 (-> this engine-rev)) + (f1-71 (-> this info engine max-rpm)) + (f0-81 (fmin f0-80 (* 0.10471976 f1-71))) + (f1-74 (-> this info engine min-rpm)) + ) + (set! (-> this engine-rev) (fmax f0-81 (* 0.10471976 f1-74))) + ) + (dotimes (s3-2 (-> this info physics-model wheel-count)) + (let* ((s1-2 (-> this wheel s3-2)) + (s2-2 (-> s1-2 info)) + ) + (when (< 0.0 (-> s1-2 up-force)) + (set! (-> arg1 probe-work-array 0 world-normal y) (* (-> s2-2 scale) (-> s2-2 radius))) + (let ((v1-138 (-> (the-as wvehicle-physics-work arg1) probe-work-array s3-2))) + (vector-copy! (-> (the-as wvehicle-physics-work arg1) forward-dir) (-> v1-138 forward-dir)) + (vector-copy! (-> (the-as wvehicle-physics-work arg1) side-dir) (-> v1-138 side-dir)) + (vector-copy! (-> (the-as wvehicle-physics-work arg1) velocity) (-> v1-138 velocity)) + ) + (vector-copy! (-> (the-as wvehicle-physics-work arg1) ground-pos) (-> s1-2 ground-pos)) + (vector-! + (-> (the-as wvehicle-physics-work arg1) p-body) + (-> (the-as wvehicle-physics-work arg1) ground-pos) + (-> sv-16 position) + ) + (vector-cross! (-> arg1 normal) (-> arg1 tmp) (-> arg1 probe-work-array 0 local-pos)) + (vector-rotate*! (-> arg1 normal) (-> arg1 normal) (-> sv-16 inv-i-world)) + (vector-cross! (-> arg1 normal) (-> arg1 normal) (-> arg1 tmp)) + (set! (-> arg1 probe-work-array 0 world-normal z) + (/ (/ (-> s1-2 side-vel) -2) + (* arg0 (+ (-> sv-16 info inv-mass) (vector-dot (-> arg1 probe-work-array 0 local-pos) (-> arg1 normal)))) + ) + ) + (set! (-> arg1 probe-work-array 0 world-normal w) 0.0) + (set! (-> s1-2 forward-slip-vel) + (+ (-> s1-2 forward-vel) (* -1.0 (-> arg1 probe-work-array 0 world-normal y) (-> s1-2 rev))) + ) + (vector-cross! (-> arg1 normal) (-> arg1 tmp) (the-as vector (&-> arg1 impulse))) + (vector-rotate*! (-> arg1 normal) (-> arg1 normal) (-> sv-16 inv-i-world)) + (vector-cross! (-> arg1 normal) (-> arg1 normal) (-> arg1 tmp)) + (let ((f0-94 + (/ (/ (-> s1-2 forward-slip-vel) -4) + (* arg0 (+ (-> sv-16 info inv-mass) (vector-dot (the-as vector (&-> arg1 impulse)) (-> arg1 normal)))) + ) + ) + ) + (+! (-> arg1 probe-work-array 0 world-normal w) f0-94) + ) + (set! (-> arg1 probe-work-array 0 probe-pos y) + (* (-> s1-2 friction-coef) (-> s1-2 up-force) (-> s2-2 side-grip)) + ) + (set! (-> arg1 probe-work-array 0 probe-pos x) + (* (-> s1-2 friction-coef) (-> s1-2 up-force) (-> s2-2 forward-grip)) + ) + (let ((f0-106 + (+ (square (/ (-> arg1 probe-work-array 0 world-normal z) (-> arg1 probe-work-array 0 probe-pos y))) + (square (/ (-> arg1 probe-work-array 0 world-normal w) (-> arg1 probe-work-array 0 probe-pos x))) + ) + ) + ) + (when (< 1.0 f0-106) + (let ((f0-108 (/ 1.0 (sqrtf f0-106)))) + (set! (-> arg1 probe-work-array 0 world-normal z) (* (-> arg1 probe-work-array 0 world-normal z) f0-108)) + (set! (-> arg1 probe-work-array 0 world-normal w) (* (-> arg1 probe-work-array 0 world-normal w) f0-108)) + ) + ) + ) + (vector-float*! + (-> arg1 force) + (-> arg1 probe-work-array 0 local-pos) + (-> arg1 probe-work-array 0 world-normal z) ) - (let ((s0-0 (the-as object (+ (+ (* 144 s3-1) 416) (the-as int arg1))))) - (vector-copy! (-> arg1 probe-work-array 0 local-normal) (-> (the-as wvehicle-physics-work s0-0) force)) (vector+float*! - (-> (the-as wvehicle-physics-work s0-0) velocity) - (-> arg1 probe-work-array 0 local-normal) - (-> s2-1 ground-normal) - (- (vector-dot (-> arg1 probe-work-array 0 local-normal) (-> s2-1 ground-normal))) + (-> arg1 force) + (-> arg1 force) + (the-as vector (&-> arg1 impulse)) + (-> arg1 probe-work-array 0 world-normal w) ) - (vector-normalize! (the-as vector (+ (the-as int s0-0) 80)) 1.0) - (vector-cross! - (the-as vector (+ (the-as int s0-0) 96)) - (-> arg1 probe-work-array 0 local-normal) - (-> s2-1 ground-normal) - ) - (vector-normalize! (-> (the-as wvehicle-physics-work s0-0) world-pos) 1.0) - (vector-copy! - (-> (the-as wvehicle-physics-work arg1) forward-dir) - (-> (the-as wvehicle-physics-work s0-0) world-pos) - ) - (vector-copy! - (-> (the-as wvehicle-physics-work arg1) side-dir) - (-> (the-as wvehicle-physics-work s0-0) velocity) - ) - (vector-copy! - (-> (the-as wvehicle-physics-work s0-0) world-normal) - (-> (the-as wvehicle-physics-work arg1) velocity) - ) - ) - (set! (-> s2-1 side-vel) - (vector-dot - (-> (the-as wvehicle-physics-work arg1) velocity) - (-> (the-as wvehicle-physics-work arg1) side-dir) + (let ((f0-114 + (* (vector-dot (-> arg1 tmp) (-> arg1 mat uvec)) (+ -1.0 (-> this info handling ground-torque-scale))) + ) ) - ) - (set! (-> s2-1 forward-vel) (vector-dot (-> arg1 velocity) (the-as vector (&-> arg1 impulse)))) - (set! (-> s2-1 up-vel) (vector-dot (-> arg1 velocity) (-> s2-1 ground-normal))) - (set! (-> s2-1 forward-slip-vel) - (+ (-> s2-1 forward-vel) (* -1.0 (-> arg1 probe-work-array 0 world-normal y) (-> s2-1 rev))) - ) - (let* ((f0-21 (-> s2-1 side-vel)) - (f0-23 (* f0-21 f0-21)) - (f1-16 (-> s2-1 forward-slip-vel)) - (f0-25 (sqrtf (+ f0-23 (* f1-16 f1-16)))) - ) - (set! (-> s2-1 friction-coef) - (* (smooth-interp - (-> this info handling tire-static-friction) - (-> this info handling tire-dynamic-friction) - f0-25 - (-> this info handling tire-static-friction-speed) - (-> this info handling tire-dynamic-friction-speed) - ) - (-> s2-1 surface friction) - ) - ) - ) - (set! (-> arg1 probe-work-array 0 ground-normal x) (-> s2-1 surface drag)) - ) - (set! (-> arg1 probe-work-array 0 ground-pos y) (-> s2-1 torque)) - (when (< 0.0 (-> s2-1 up-force)) - (let ((f0-36 - (* (-> s2-1 up-force) - (-> s2-1 friction-coef) - (-> s1-1 forward-grip) - (-> arg1 probe-work-array 0 world-normal y) - ) - ) - (f1-29 - (/ (* (/ (-> s2-1 inertia) 2) (-> s2-1 forward-slip-vel)) - (* arg0 (-> arg1 probe-work-array 0 world-normal y)) - ) - ) - ) - (if (logtest? (-> s1-1 flags) (vehicle-wheel-flag vwf0)) - (set! f1-29 (* f1-29 (/ 1.0 (the float (-> this info physics-model drive-wheel-count))))) - ) - (set! (-> arg1 probe-work-array 0 probe-pos w) (fmax (fmin f1-29 f0-36) (- f0-36))) - ) - (+! (-> arg1 probe-work-array 0 ground-pos y) (-> arg1 probe-work-array 0 probe-pos w)) - ) - (set! (-> arg1 probe-work-array 0 ground-pos z) - (- (* -0.25 (/ 1.0 arg0) (-> s2-1 rev) (-> s2-1 inertia)) (-> arg1 probe-work-array 0 ground-pos y)) + (vector+float*! (-> arg1 ground-normal) (-> arg1 ground-normal) (-> arg1 mat uvec) f0-114) ) - (set! (-> arg1 probe-work-array 0 ground-pos w) (fabs (-> s2-1 braking-torque))) - (set! (-> arg1 probe-work-array 0 ground-pos x) - (fmax - (fmin (-> arg1 probe-work-array 0 ground-pos z) (-> arg1 probe-work-array 0 ground-pos w)) - (- (-> arg1 probe-work-array 0 ground-pos w)) - ) - ) - (+! (-> arg1 probe-work-array 0 ground-pos y) (-> arg1 probe-work-array 0 ground-pos x)) - (let ((f0-57 (* -1.0 - (-> s2-1 rev) - (-> s2-1 inertia) - (-> arg1 probe-work-array 0 ground-normal x) - (-> this info handling rolling-resistance) - ) - ) - ) - (if (logtest? (vehicle-flag turbo-boost) (-> this v-flags)) - (set! f0-57 (/ f0-57 20)) - ) - (+! (-> arg1 probe-work-array 0 ground-pos y) f0-57) - ) - (cond - ((logtest? (-> s1-1 flags) (vehicle-wheel-flag vwf0)) - (+! (-> this wheel-torque) (-> arg1 probe-work-array 0 ground-pos y)) - ) - (else - (let ((f0-61 (-> s2-1 rev)) - (f1-49 (* (-> arg1 probe-work-array 0 ground-pos y) arg0)) - (f2-20 (-> s2-1 inertia)) - ) - (set! (-> s2-1 rev) (+ f0-61 (* f1-49 (/ 1.0 f2-20)))) - ) - (set! (-> s2-1 rev) (fmax -125.6637 (fmin 125.6637 (-> s2-1 rev)))) + (apply-impact! sv-16 (-> arg1 ground-normal) (-> arg1 force)) + 0 ) ) ) - 0 - ) - (let ((f0-65 (-> this wheel-rev)) - (f1-54 (* arg0 (-> this wheel-torque))) - (f2-25 (-> this wheel-inertia)) - ) - (set! (-> this wheel-rev) (+ f0-65 (* f1-54 (/ 1.0 f2-25)))) - ) - (set! (-> this wheel-rev) (fmax -125.6637 (fmin 125.6637 (-> this wheel-rev)))) - (dotimes (v1-110 (-> this info physics-model wheel-count)) - (let ((a0-28 (-> this wheel v1-110))) - (if (logtest? (-> a0-28 info flags) (vehicle-wheel-flag vwf0)) - (set! (-> a0-28 rev) (* (-> this wheel-rev) (-> a0-28 drive-diff))) - ) - ) - ) - (let* ((f0-71 (-> this info engine inertia)) - (f1-59 (-> this clutch-grab)) - (f2-29 (-> this clutch-inertia)) - (f3-12 (-> this gear-ratio)) - (f3-14 (/ 1.0 f3-12)) - (f3-16 (* f3-14 f3-14)) - (f4-5 (-> this info transmission inertia)) - (f5-0 (-> this final-drive-ratio)) - (f5-2 (/ 1.0 f5-0)) - ) - (set! (-> arg1 probe-work-array 0 probe-pos z) - (+ f0-71 (* f1-59 (+ f2-29 (* f3-16 (+ f4-5 (* f5-2 f5-2 (-> this drive-wheel-inertia))))))) - ) - ) - (let* ((f3-18 (- (* (- (fmax 0.0 (* (-> this total-gear-ratio) (-> this wheel-rev))) (-> this engine-rev)) - (-> arg1 probe-work-array 0 probe-pos z) - (/ 1.0 arg0) - ) - (-> this engine-torque) - ) - ) - (f0-78 (-> this engine-rev)) - (f1-69 (* arg0 (+ (-> this engine-torque) (* f3-18 (-> this clutch-grab))))) - (f2-35 (-> arg1 probe-work-array 0 probe-pos z)) - ) - (set! (-> this engine-rev) (+ f0-78 (* f1-69 (/ 1.0 f2-35)))) - ) - (let* ((f0-80 (-> this engine-rev)) - (f1-71 (-> this info engine max-rpm)) - (f0-81 (fmin f0-80 (* 0.10471976 f1-71))) - (f1-74 (-> this info engine min-rpm)) - ) - (set! (-> this engine-rev) (fmax f0-81 (* 0.10471976 f1-74))) - ) - (dotimes (s3-2 (-> this info physics-model wheel-count)) - (let* ((s1-2 (-> this wheel s3-2)) - (s2-2 (-> s1-2 info)) - ) - (when (< 0.0 (-> s1-2 up-force)) - (set! (-> arg1 probe-work-array 0 world-normal y) (* (-> s2-2 scale) (-> s2-2 radius))) - (let ((v1-138 (-> (the-as wvehicle-physics-work arg1) probe-work-array s3-2))) - (vector-copy! (-> (the-as wvehicle-physics-work arg1) forward-dir) (-> v1-138 forward-dir)) - (vector-copy! (-> (the-as wvehicle-physics-work arg1) side-dir) (-> v1-138 side-dir)) - (vector-copy! (-> (the-as wvehicle-physics-work arg1) velocity) (-> v1-138 velocity)) - ) - (vector-copy! (-> (the-as wvehicle-physics-work arg1) ground-pos) (-> s1-2 ground-pos)) - (vector-! - (-> (the-as wvehicle-physics-work arg1) p-body) - (-> (the-as wvehicle-physics-work arg1) ground-pos) - (-> sv-16 position) - ) - (vector-cross! (-> arg1 normal) (-> arg1 tmp) (-> arg1 probe-work-array 0 local-pos)) - (vector-rotate*! (-> arg1 normal) (-> arg1 normal) (-> sv-16 inv-i-world)) - (vector-cross! (-> arg1 normal) (-> arg1 normal) (-> arg1 tmp)) - (set! (-> arg1 probe-work-array 0 world-normal z) - (/ (/ (-> s1-2 side-vel) -2) - (* arg0 (+ (-> sv-16 info inv-mass) (vector-dot (-> arg1 probe-work-array 0 local-pos) (-> arg1 normal)))) - ) - ) - (set! (-> arg1 probe-work-array 0 world-normal w) 0.0) - (set! (-> s1-2 forward-slip-vel) - (+ (-> s1-2 forward-vel) (* -1.0 (-> arg1 probe-work-array 0 world-normal y) (-> s1-2 rev))) - ) - (vector-cross! (-> arg1 normal) (-> arg1 tmp) (the-as vector (&-> arg1 impulse))) - (vector-rotate*! (-> arg1 normal) (-> arg1 normal) (-> sv-16 inv-i-world)) - (vector-cross! (-> arg1 normal) (-> arg1 normal) (-> arg1 tmp)) - (let ((f0-94 - (/ (/ (-> s1-2 forward-slip-vel) -4) - (* arg0 (+ (-> sv-16 info inv-mass) (vector-dot (the-as vector (&-> arg1 impulse)) (-> arg1 normal)))) - ) - ) - ) - (+! (-> arg1 probe-work-array 0 world-normal w) f0-94) - ) - (set! (-> arg1 probe-work-array 0 probe-pos y) - (* (-> s1-2 friction-coef) (-> s1-2 up-force) (-> s2-2 side-grip)) - ) - (set! (-> arg1 probe-work-array 0 probe-pos x) - (* (-> s1-2 friction-coef) (-> s1-2 up-force) (-> s2-2 forward-grip)) - ) - (let* ((f0-103 (/ (-> arg1 probe-work-array 0 world-normal z) (-> arg1 probe-work-array 0 probe-pos y))) - (f0-105 (* f0-103 f0-103)) - (f1-95 (/ (-> arg1 probe-work-array 0 world-normal w) (-> arg1 probe-work-array 0 probe-pos x))) - (f0-106 (+ f0-105 (* f1-95 f1-95))) - ) - (when (< 1.0 f0-106) - (let ((f0-108 (/ 1.0 (sqrtf f0-106)))) - (set! (-> arg1 probe-work-array 0 world-normal z) (* (-> arg1 probe-work-array 0 world-normal z) f0-108)) - (set! (-> arg1 probe-work-array 0 world-normal w) (* (-> arg1 probe-work-array 0 world-normal w) f0-108)) - ) - ) - ) - (vector-float*! - (-> arg1 force) - (-> arg1 probe-work-array 0 local-pos) - (-> arg1 probe-work-array 0 world-normal z) - ) - (vector+float*! - (-> arg1 force) - (-> arg1 force) - (the-as vector (&-> arg1 impulse)) - (-> arg1 probe-work-array 0 world-normal w) - ) - (let ((f0-114 - (* (vector-dot (-> arg1 tmp) (-> arg1 mat uvec)) (+ -1.0 (-> this info handling ground-torque-scale))) - ) - ) - (vector+float*! (-> arg1 ground-normal) (-> arg1 ground-normal) (-> arg1 mat uvec) f0-114) - ) - (apply-impact! sv-16 (-> arg1 ground-normal) (-> arg1 force)) - 0 - ) - ) ) 0 (none) @@ -534,12 +529,9 @@ ) (vector-float*! v1-29 a0-10 (fmax f0-7 (+ f1-5 (* f2-1 (/ 1.0 f3-3))))) ) - (let* ((v1-31 (-> s5-0 lin-velocity)) - (f0-13 (+ (* (-> v1-31 x) (-> v1-31 x)) (* (-> v1-31 z) (-> v1-31 z)))) - (f1-10 40960.0) - ) + (let ((v1-31 (-> s5-0 lin-velocity))) (cond - ((< f0-13 (* f1-10 f1-10)) + ((< (+ (* (-> v1-31 x) (-> v1-31 x)) (* (-> v1-31 z) (-> v1-31 z))) (square 40960.0)) (vector-copy! (-> gp-0 local-pos) (-> s4-0 info cm-offset-joint)) (+! (-> gp-0 local-pos z) 4096.0) (vector-matrix*! (-> gp-0 world-pos) (-> gp-0 local-pos) (-> gp-0 mat)) diff --git a/test/decompiler/reference/jak3/levels/desert/wvehicle/wvehicle-race_REF.gc b/test/decompiler/reference/jak3/levels/desert/wvehicle/wvehicle-race_REF.gc index ada5298fb3..04870a377f 100644 --- a/test/decompiler/reference/jak3/levels/desert/wvehicle/wvehicle-race_REF.gc +++ b/test/decompiler/reference/jak3/levels/desert/wvehicle/wvehicle-race_REF.gc @@ -56,19 +56,12 @@ (quaternion-copy! (the-as quaternion (-> s3-0 force)) (-> s5-0 path-sample quat)) (vector-float*! (-> s3-0 mat fvec) (-> s5-0 lin-velocity) f28-0) (vector-! (-> s3-0 mat trans) (-> s5-0 path-sample pos) (-> s4-0 position)) - (let ((f0-6 (vector-length-squared (-> s3-0 mat trans))) - (f1-5 1.0) - (f2-2 40960.0) - ) - (set! (-> this path-deviation) (* f0-6 (/ f1-5 (* f2-2 f2-2)))) - ) + (set! (-> this path-deviation) (* (vector-length-squared (-> s3-0 mat trans)) (/ 1.0 (square 40960.0)))) (vector+*! (-> s3-0 mat fvec) (-> s3-0 mat fvec) (-> s3-0 mat trans) 1.0) (vector-! (-> s3-0 mat rvec) (-> s3-0 mat fvec) (-> s4-0 lin-velocity)) (vector-float*! (-> s3-0 mat rvec) (-> s3-0 mat rvec) 16.0) - (let ((v1-31 (-> s3-0 mat)) - (f0-10 (-> s3-0 velocity x)) - ) - (if (< (* f0-10 f0-10) (vector-length-squared (-> v1-31 rvec))) + (let ((v1-31 (-> s3-0 mat))) + (if (< (square (-> s3-0 velocity x)) (vector-length-squared (-> v1-31 rvec))) (vector-normalize! (-> s3-0 mat rvec) (-> s3-0 velocity x)) ) ) @@ -158,9 +151,7 @@ (if (logtest? (vehicle-flag in-air turbo-boost) (-> this v-flags)) (set! (-> gp-0 vec13 w) (* 2.0 (-> gp-0 vec13 w))) ) - (let ((f0-18 (* 2.0 (-> this root root-prim local-sphere w)))) - (set! (-> gp-0 float7) (* f0-18 f0-18)) - ) + (set! (-> gp-0 float7) (square (* 2.0 (-> this root root-prim local-sphere w)))) (let ((s3-0 (-> this race state))) (dotimes (s2-0 (-> s3-0 racer-count)) (let ((v1-60 (handle->process (-> s3-0 racer-array s2-0 racer)))) @@ -207,20 +198,10 @@ (race-path-method-11 (-> s4-0 path) (-> gp-0 sample) (-> gp-0 vec12) f0-35) ) (vector-! (-> gp-0 vec6) (-> s4-0 path-sample pos) (-> gp-0 vec0)) - (let ((f0-36 (-> gp-0 float5)) - (f1-24 1.0) - (f2-8 40960.0) - ) - (set! (-> gp-0 float5) (+ f0-36 (* (/ f1-24 (* f2-8 f2-8)) (vector-length-squared (-> gp-0 vec6))))) - ) - (let ((f30-0 (-> gp-0 float5)) - (f0-38 1.0) - (f1-27 40960.0) - ) - (set! (-> gp-0 float5) - (+ f30-0 (* (/ f0-38 (* f1-27 f1-27)) (vector-vector-distance-squared (-> s4-0 lin-velocity) (-> gp-0 vec1)))) - ) - ) + (+! (-> gp-0 float5) (* (/ 1.0 (square 40960.0)) (vector-length-squared (-> gp-0 vec6)))) + (+! (-> gp-0 float5) + (* (/ 1.0 (square 40960.0)) (vector-vector-distance-squared (-> s4-0 lin-velocity) (-> gp-0 vec1))) + ) (set! (-> this path-deviation) (-> gp-0 float5)) (vector+*! (-> gp-0 vec5) (-> gp-0 vec12) (-> gp-0 vec6) 1.0) (vector-! (-> gp-0 vec7) (-> gp-0 vec5) (-> gp-0 vec1)) @@ -281,35 +262,24 @@ ((logtest? (-> this rbody flags) (rigid-body-flag enable-physics)) (if (and (logtest? (-> this v-flags) (vehicle-flag on-ground)) (not (logtest? (vehicle-flag turbo-boost) (-> this v-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))) + ) + ) ) (disable-physics! 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? (vehicle-flag turbo-boost) (-> this v-flags)) - ) - ) - ) - (apply-momentum! 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? (vehicle-flag turbo-boost) (-> this v-flags)) + ) + ) + (apply-momentum! this) + ) ) ) 0 diff --git a/test/decompiler/reference/jak3/levels/desert/wvehicle/wvehicle-util_REF.gc b/test/decompiler/reference/jak3/levels/desert/wvehicle/wvehicle-util_REF.gc index f3ca33fff2..a0a0e79a77 100644 --- a/test/decompiler/reference/jak3/levels/desert/wvehicle/wvehicle-util_REF.gc +++ b/test/decompiler/reference/jak3/levels/desert/wvehicle/wvehicle-util_REF.gc @@ -4,13 +4,19 @@ ;; definition for method 167 of type wvehicle ;; WARN: Return type mismatch int vs none. (defmethod wvehicle-method-167 ((this wvehicle)) - (let* ((v1-0 (-> this info)) - (f0-1 (* (-> v1-0 engine drag) (-> v1-0 engine idle-rpm))) - (f1-2 (* (-> v1-0 engine peak-torque-rpm) (+ 1.0 (-> v1-0 engine drag)))) - (f2-2 1.0) - (f3-3 (/ (- (-> v1-0 engine idle-rpm) (-> v1-0 engine peak-torque-rpm)) (-> v1-0 engine powerband-width-rpm))) - ) - (set! (-> this idle-throttle) (/ f0-1 (* f1-2 (- f2-2 (* f3-3 f3-3))))) + (let ((v1-0 (-> this info))) + (set! (-> this idle-throttle) + (/ (* (-> v1-0 engine drag) (-> v1-0 engine idle-rpm)) + (* (-> v1-0 engine peak-torque-rpm) + (+ 1.0 (-> v1-0 engine drag)) + (- 1.0 + (square + (/ (- (-> v1-0 engine idle-rpm) (-> v1-0 engine peak-torque-rpm)) (-> v1-0 engine powerband-width-rpm)) + ) + ) + ) + ) + ) ) (set! (-> this idle-throttle) (fmax 0.0 (fmin 1.0 (-> this idle-throttle)))) 0 @@ -518,16 +524,9 @@ ;; WARN: Return type mismatch int vs none. (defmethod vehicle-method-103 ((this wvehicle)) (when (time-elapsed? (-> this disturbed-time) (seconds 2)) - (let* ((f0-0 (-> this camera-dist2)) - (f1-0 0.000024414063) - (f0-1 (* f0-0 (* f1-0 f1-0))) - ) + (let ((f0-1 (* (-> this camera-dist2) (square 0.000024414063)))) (when (and (< (vector-length-squared (-> this rbody ang-velocity)) f0-1) - (let ((f1-4 (vector-length-squared (-> this rbody lin-velocity))) - (f2-0 614.4) - ) - (< f1-4 (* f0-1 (* f2-0 f2-0))) - ) + (< (vector-length-squared (-> this rbody lin-velocity)) (* f0-1 (square 614.4))) ) (logclear! (-> this v-flags) (vehicle-flag disturbed)) (vehicle-method-142 this) @@ -542,7 +541,6 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defmethod spawn-wheels! ((this wvehicle) (arg0 skeleton-group) (arg1 skeleton-group) (arg2 skeleton-group) (arg3 skeleton-group)) - (local-vars (sv-96 vehicle-wheel-state)) (let ((s1-0 (new 'stack-no-clear 'vehicle-wheel-init-params))) (vector-copy! (-> s1-0 position) (-> this root trans)) (quaternion-identity! (-> s1-0 rotation)) @@ -564,23 +562,24 @@ (set! (-> s1-0 skel-blur) arg1) ) ) - (set! sv-96 (-> this wheel s0-0)) - (set! (-> s1-0 radius) (* 1.3 (-> sv-96 info scale) (-> sv-96 info radius))) - (vector-identity! (-> s1-0 scale)) - (set! (-> s1-0 scale x) (-> sv-96 x-scale)) - (vector-float*! (-> s1-0 scale) (-> s1-0 scale) (-> sv-96 info scale)) - (if (logtest? (-> this info flags) #x4000) - (set! (-> s1-0 collision-mesh-index) (if (>= (-> sv-96 x-scale) 0.0) - 0 - 1 - ) - ) - ) - (set! (-> sv-96 handle) - (process->handle (vehicle-wheel-spawn this (the-as vehicle-wheel-init-params (&-> s1-0 skel)))) + (let ((sv-96 (-> this wheel s0-0))) + (set! (-> s1-0 radius) (* 1.3 (-> sv-96 info scale) (-> sv-96 info radius))) + (vector-identity! (-> s1-0 scale)) + (set! (-> s1-0 scale x) (-> sv-96 x-scale)) + (vector-float*! (-> s1-0 scale) (-> s1-0 scale) (-> sv-96 info scale)) + (if (logtest? (-> this info flags) #x4000) + (set! (-> s1-0 collision-mesh-index) (if (>= (-> sv-96 x-scale) 0.0) + 0 + 1 + ) + ) ) - (set! (-> sv-96 pos) (-> sv-96 info settle-pos)) - (set! (-> sv-96 pos2) (-> sv-96 pos)) + (set! (-> sv-96 handle) + (process->handle (vehicle-wheel-spawn this (the-as vehicle-wheel-init-params (&-> s1-0 skel)))) + ) + (set! (-> sv-96 pos) (-> sv-96 info settle-pos)) + (set! (-> sv-96 pos2) (-> sv-96 pos)) + ) ) ) (wvehicle-method-165 this) diff --git a/test/decompiler/reference/jak3/levels/desert/wvehicle/wvehicle_REF.gc b/test/decompiler/reference/jak3/levels/desert/wvehicle/wvehicle_REF.gc index 8630a4960b..c3dd31fae8 100644 --- a/test/decompiler/reference/jak3/levels/desert/wvehicle/wvehicle_REF.gc +++ b/test/decompiler/reference/jak3/levels/desert/wvehicle/wvehicle_REF.gc @@ -3,23 +3,18 @@ ;; definition for method 166 of type wvehicle (defmethod wvehicle-method-166 ((this wvehicle) (arg0 float) (arg1 float)) - (let* ((v1-0 (-> this info)) - (f0-0 (-> this engine-max-torque)) - (f1-3 (* (+ 1.0 (-> v1-0 engine drag)) - (if (< arg0 (-> v1-0 engine max-rpm)) - 1.0 - 0.0 - ) - (fmax (-> this idle-throttle) arg1) - ) - ) - (f2-5 0.2) - (f3-2 1.0) - (f4-2 (/ (- arg0 (-> v1-0 engine peak-torque-rpm)) (-> v1-0 engine powerband-width-rpm))) - ) - (* f0-0 (+ (* f1-3 (fmax f2-5 (- f3-2 (* f4-2 f4-2)))) - (* -1.0 (/ arg0 (-> v1-0 engine peak-torque-rpm)) (-> v1-0 engine drag)) - ) + (let ((v1-0 (-> this info))) + (* (-> this engine-max-torque) + (+ (* (+ 1.0 (-> v1-0 engine drag)) + (if (< arg0 (-> v1-0 engine max-rpm)) + 1.0 + 0.0 + ) + (fmax (-> this idle-throttle) arg1) + (fmax 0.2 (- 1.0 (square (/ (- arg0 (-> v1-0 engine peak-torque-rpm)) (-> v1-0 engine powerband-width-rpm))))) + ) + (* -1.0 (/ arg0 (-> v1-0 engine peak-torque-rpm)) (-> v1-0 engine drag)) + ) ) ) ) @@ -47,11 +42,7 @@ (+ (-> arg1 probe-y-offset) (* (-> arg1 radius) (-> arg1 scale)) (* -1.0 (-> arg0 pos2) (-> arg1 travel))) ) (set! (-> arg0 sin-susp-ang) (fmax -1.0 (fmin 1.0 (/ (-> gp-0 float0) (-> arg1 susp-arm-length))))) - (let ((f0-21 1.0) - (f1-11 (-> arg0 sin-susp-ang)) - ) - (set! (-> arg0 cos-susp-ang) (sqrtf (- f0-21 (* f1-11 f1-11)))) - ) + (set! (-> arg0 cos-susp-ang) (sqrtf (- 1.0 (square (-> arg0 sin-susp-ang))))) (quaternion-identity! (-> gp-0 quat4)) (set! (-> gp-0 quat4 z) (* (sin (-> arg1 camber)) (-> arg0 x-scale))) (set! (-> gp-0 quat4 w) (cos (-> arg1 camber))) @@ -98,21 +89,17 @@ (let* ((a1-0 (-> this wheel s4-0)) (a2-0 (-> a1-0 info)) ) - (let* ((f0-1 (-> a1-0 pos2)) - (f1-1 (- (-> a1-0 pos) (-> a1-0 pos2))) - (f2-1 1.0) - (f3-0 (-> s5-0 steering)) - (f4-0 (-> a1-0 forward-vel)) - (f4-2 (* f4-0 f4-0)) - (f5-0 (-> a1-0 up-vel)) - (f4-3 (+ f4-2 (* f5-0 f5-0))) - (f5-3 8192.0) - (f3-1 (* f3-0 (fmin f4-3 (* f5-3 f5-3)))) - (f4-5 15.0) - (f5-6 8192.0) + (+! (-> a1-0 pos2) + (* (- (-> a1-0 pos) (-> a1-0 pos2)) + (fmin + 1.0 + (* (-> s5-0 steering) + (fmin (+ (square (-> a1-0 forward-vel)) (square (-> a1-0 up-vel))) (square 8192.0)) + (/ 15.0 (square 8192.0)) + ) + ) ) - (set! (-> a1-0 pos2) (+ f0-1 (* f1-1 (fmin f2-1 (* f3-1 (/ f4-5 (* f5-6 f5-6))))))) - ) + ) (set! (-> a1-0 angle) (the float (sar (shl (the int (+ (-> a1-0 angle) (* 10430.379 (-> a1-0 rev) (-> s5-0 steering)))) 48) 48)) ) @@ -235,12 +222,12 @@ (let ((a0-18 (-> v1-16 lin-velocity)) (f1-2 16384.0) ) - (< (vector-length-squared a0-18) (* f1-2 f1-2)) + (< (vector-length-squared a0-18) (square f1-2)) ) (let ((a0-22 (-> v1-16 ang-velocity)) (f1-5 4.0) ) - (< (vector-length-squared a0-22) (* f1-5 f1-5)) + (< (vector-length-squared a0-22) (square f1-5)) ) ) (set! (-> this v-flags) (the-as vehicle-flag (logior (vehicle-flag overturned) (-> this v-flags)))) @@ -288,13 +275,9 @@ ;; WARN: Return type mismatch symbol vs object. (defmethod rigid-body-object-method-30 ((this wvehicle)) (set! (-> this v-flags) (the-as vehicle-flag (logclear (-> this v-flags) (vehicle-flag sounds)))) - (let ((f0-0 (-> this player-dist2)) - (f1-0 245760.0) - ) - (if (< f0-0 (* f1-0 f1-0)) - (set! (-> this v-flags) (the-as vehicle-flag (logior (vehicle-flag sounds) (-> this v-flags)))) - ) - ) + (if (< (-> this player-dist2) (square 245760.0)) + (set! (-> this v-flags) (the-as vehicle-flag (logior (vehicle-flag sounds) (-> this v-flags)))) + ) (let ((v1-8 (new 'stack-no-clear 'matrix))) (set! (-> v1-8 fvec x) (seconds-per-frame)) (vector-copy! (-> v1-8 uvec) (-> this draw color-emissive)) @@ -464,19 +447,16 @@ ) ) (set! (-> this drive-wheel-inertia) f0-13) - (let* ((f1-6 (-> this final-drive-ratio)) - (f1-8 (* f1-6 f1-6)) - (f2-1 (-> s5-0 transmission inertia)) - (f3-0 (-> this gear-ratio)) - ) - (set! (-> this wheel-inertia) - (+ f0-13 - (* f1-8 - (+ f2-1 (* f3-0 f3-0 (+ (-> this clutch-inertia) (* (-> s5-0 engine inertia) (-> this clutch-grab))))) - ) - ) - ) - ) + (set! (-> this wheel-inertia) + (+ f0-13 (* (square (-> this final-drive-ratio)) + (+ (-> s5-0 transmission inertia) + (* (square (-> this gear-ratio)) + (+ (-> this clutch-inertia) (* (-> s5-0 engine inertia) (-> this clutch-grab))) + ) + ) + ) + ) + ) ) (set! (-> s4-0 rvec x) (* (/ 1.0 (the float (-> s5-0 physics-model drive-wheel-count))) (-> this engine-torque) @@ -667,14 +647,10 @@ (remove-setting! 'butt-handle) ) ) - (let ((f0-2 (vector-vector-distance-squared (-> this draw origin) (math-camera-pos))) - (f1-1 (-> this draw origin w)) - ) - (if (< f0-2 (* f1-1 f1-1)) - (logclear! (-> this draw status) (draw-control-status force-vu1)) - (logior! (-> this draw status) (draw-control-status force-vu1)) - ) - ) + (if (< (vector-vector-distance-squared (-> this draw origin) (math-camera-pos)) (square (-> this draw origin w))) + (logclear! (-> this draw status) (draw-control-status force-vu1)) + (logior! (-> this draw status) (draw-control-status force-vu1)) + ) 0 (none) ) @@ -723,9 +699,8 @@ (* 2.0 (+ (-> s4-0 physics-model rear-wheel local-pos x) (-> s4-0 physics-model rear-wheel susp-arm-length))) ) ) - (f1-22 (/ (-> s5-0 1 uvec z) 2)) ) - (set! (-> s5-0 1 rvec z) (sqrtf (+ (* f1-22 f1-22) (* f0-32 f0-32)))) + (set! (-> s5-0 1 rvec z) (sqrtf (+ (square (/ (-> s5-0 1 uvec z) 2)) (square f0-32)))) ) (+! (-> s5-0 1 rvec w) (-> s4-0 physics-model rear-wheel steer-arm-length)) (set! (-> s5-0 1 rvec z) (- (-> s5-0 1 rvec z) (-> s4-0 physics-model rear-wheel steer-arm-length))) diff --git a/test/decompiler/reference/jak3/levels/factory/car/hvehicle-physics_REF.gc b/test/decompiler/reference/jak3/levels/factory/car/hvehicle-physics_REF.gc index 09e9abc91f..336292007b 100644 --- a/test/decompiler/reference/jak3/levels/factory/car/hvehicle-physics_REF.gc +++ b/test/decompiler/reference/jak3/levels/factory/car/hvehicle-physics_REF.gc @@ -29,14 +29,7 @@ ) (when (logtest? (-> this info flags) 1) (vector-float*! (-> arg1 tmp) (-> arg1 mat uvec) -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)) @@ -290,7 +283,6 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defmethod apply-gravity! ((this hvehicle) (arg0 float)) - (local-vars (sv-944 float) (sv-1040 float) (sv-1044 float)) (let ((gp-0 (new 'stack-no-clear 'vehicle-physics-work)) (s5-0 (-> this rbody)) (s4-0 (-> this info)) @@ -299,36 +291,37 @@ (when (not (logtest? (vehicle-flag dead gun-dark-2-zero-g) (-> this v-flags))) (vehicle-method-97 this arg0 gp-0) (when (>= 1 (-> this force-level)) - (set! sv-944 (* (-> s4-0 info mass) (-> s4-0 extra gravity))) - (when (!= (-> s4-0 handling pitch-control-factor) 0.0) - (vector-copy! (-> gp-0 axis) (-> gp-0 mat rvec)) - (set! (-> gp-0 axis y) 0.0) - (let ((f30-0 (vector-dot (-> gp-0 axis) (-> s5-0 ang-velocity)))) - (dotimes (s1-0 (-> s4-0 physics-model lift-thruster-count)) - (let ((s0-0 (-> s4-0 physics-model lift-thruster-array s1-0))) - (vector-matrix*! (-> gp-0 world-pos) (-> s0-0 local-pos) (-> gp-0 mat)) - (vector-rotate*! (-> gp-0 world-normal) (-> s0-0 rot) (-> gp-0 mat)) - (let* ((f0-5 -1.0) - (f1-2 1.0) - (f2-0 0.2) - (a0-10 (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 int a0-10) a1-5) v1-16)) - (-> s4-0 handling pitch-control-factor) - f30-0 - ) - ) - ) - sv-944 - ) - ) - ) - (vector-float*! (-> gp-0 force) (-> gp-0 world-normal) (* -1.0 f0-7)) + (let ((sv-944 (* (-> s4-0 info mass) (-> s4-0 extra gravity)))) + (when (!= (-> s4-0 handling pitch-control-factor) 0.0) + (vector-copy! (-> gp-0 axis) (-> gp-0 mat rvec)) + (set! (-> gp-0 axis y) 0.0) + (let ((f30-0 (vector-dot (-> gp-0 axis) (-> s5-0 ang-velocity)))) + (dotimes (s1-0 (-> s4-0 physics-model lift-thruster-count)) + (let ((s0-0 (-> s4-0 physics-model lift-thruster-array s1-0))) + (vector-matrix*! (-> gp-0 world-pos) (-> s0-0 local-pos) (-> gp-0 mat)) + (vector-rotate*! (-> gp-0 world-normal) (-> s0-0 rot) (-> gp-0 mat)) + (let* ((f0-5 -1.0) + (f1-2 1.0) + (f2-0 0.2) + (a0-10 (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 int a0-10) a1-5) v1-16)) + (-> s4-0 handling pitch-control-factor) + f30-0 + ) + ) + ) + sv-944 + ) + ) + ) + (vector-float*! (-> gp-0 force) (-> gp-0 world-normal) (* -1.0 f0-7)) + ) ) + (apply-impact! s5-0 (-> gp-0 world-pos) (-> gp-0 force)) ) - (apply-impact! s5-0 (-> gp-0 world-pos) (-> gp-0 force)) ) ) ) @@ -342,39 +335,38 @@ (quaternion->matrix (the-as matrix (-> s1-1 1)) (the-as quaternion (-> s1-1 0))) (vector-copy! (-> gp-0 dir) (-> s1-1 2)) ) - (let ((f0-14 (vector-dot (-> gp-0 mat rvec) (-> gp-0 dir)))) - (set! sv-1040 (* (-> s4-0 info mass) (-> s4-0 extra gravity))) - (let ((f1-11 f0-14)) - (set! sv-1044 (+ (* f1-11 f1-11 f0-14) (* 0.075 (vector-dot (-> gp-0 mat fvec) (-> s5-0 ang-velocity))))) - ) - ) - (dotimes (s1-2 (-> s4-0 physics-model roll-thruster-count)) - (let* ((s0-1 (-> s4-0 physics-model roll-thruster-array s1-2)) - (f0-17 0.0) - (f1-16 1.0) - (f2-7 -1.0) - (a0-20 (the-as number (-> s0-1 local-pos x))) - (a1-10 #xffffffff80000000) - (v1-42 #x3f800000) - (f30-1 - (fmax f0-17 (fmin f1-16 (* f2-7 (the-as float (logior (logand (the-as int a0-20) a1-10) v1-42)) sv-1044))) + (let* ((f0-14 (vector-dot (-> gp-0 mat rvec) (-> gp-0 dir))) + (sv-1040 (* (-> s4-0 info mass) (-> s4-0 extra gravity))) + (sv-1044 (+ (* (square f0-14) f0-14) (* 0.075 (vector-dot (-> gp-0 mat fvec) (-> s5-0 ang-velocity))))) + ) + (dotimes (s1-2 (-> s4-0 physics-model roll-thruster-count)) + (let* ((s0-1 (-> s4-0 physics-model roll-thruster-array s1-2)) + (f0-17 0.0) + (f1-16 1.0) + (f2-7 -1.0) + (a0-20 (the-as number (-> s0-1 local-pos x))) + (a1-10 #xffffffff80000000) + (v1-42 #x3f800000) + (f30-1 + (fmax f0-17 (fmin f1-16 (* f2-7 (the-as float (logior (logand (the-as int a0-20) a1-10) v1-42)) sv-1044))) + ) ) - ) - (when (< 0.0 f30-1) - (let ((f30-2 - (* (+ f30-1 (+ (- (-> this power-fluctuation-factor)) (* 2.0 (rand-vu) (-> this power-fluctuation-factor)))) - (-> s4-0 handling roll-control-factor) - sv-1040 - ) + (when (< 0.0 f30-1) + (let ((f30-2 + (* (+ f30-1 (+ (- (-> this power-fluctuation-factor)) (* 2.0 (rand-vu) (-> this power-fluctuation-factor)))) + (-> s4-0 handling roll-control-factor) + sv-1040 + ) + ) ) - ) - (+! (-> this roll-thrust s1-2) (fmax 0.0 f30-2)) - (vector-matrix*! (-> gp-0 world-pos) (-> s0-1 local-pos) (-> gp-0 mat)) - (vector-rotate*! (-> gp-0 world-normal) (-> s0-1 rot) (-> gp-0 mat)) - (vector-float*! (-> gp-0 force) (-> gp-0 world-normal) (* -1.0 f30-2)) + (+! (-> this roll-thrust s1-2) (fmax 0.0 f30-2)) + (vector-matrix*! (-> gp-0 world-pos) (-> s0-1 local-pos) (-> gp-0 mat)) + (vector-rotate*! (-> gp-0 world-normal) (-> s0-1 rot) (-> gp-0 mat)) + (vector-float*! (-> gp-0 force) (-> gp-0 world-normal) (* -1.0 f30-2)) + ) + (apply-impact! s5-0 (-> gp-0 world-pos) (-> gp-0 force)) + 0 ) - (apply-impact! s5-0 (-> gp-0 world-pos) (-> gp-0 force)) - 0 ) ) ) @@ -536,22 +528,26 @@ (set! (-> gp-0 world-normal y) 0.0) (vector-normalize! (-> gp-0 world-normal) 1.0) (let* ((v1-161 (-> s5-0 lin-velocity)) - (f0-90 (/ (sqrtf (+ (* (-> v1-161 x) (-> v1-161 x)) (* (-> v1-161 z) (-> v1-161 z)))) - (-> s4-0 handling max-xz-speed) - ) - ) - (v1-163 (-> gp-0 force)) - (a0-76 (-> gp-0 world-normal)) - (f1-73 -1.0) - (f2-35 (* (-> s4-0 handling speed-limiting-drag) (vector-dot (-> s5-0 force) (-> gp-0 world-normal)))) - (f3-20 (* (fabs (-> this engine-thrust)) - (-> s4-0 handling speed-scrubbing-drag) - (vector-length (-> s5-0 lin-momentum)) - ) - ) - (f4-6 (- 1.0 (fabs (vector-dot (-> s5-0 matrix fvec) (-> gp-0 world-normal))))) + (f0-90 + (/ (sqrtf (+ (* (-> v1-161 x) (-> v1-161 x)) (* (-> v1-161 z) (-> v1-161 z)))) + (-> s4-0 handling max-xz-speed) + ) + ) ) - (vector-float*! v1-163 a0-76 (* f1-73 (+ f2-35 (* f3-20 (* f4-6 f4-6))) (sqrtf f0-90))) + (vector-float*! + (-> gp-0 force) + (-> gp-0 world-normal) + (* -1.0 + (+ (* (-> s4-0 handling speed-limiting-drag) (vector-dot (-> s5-0 force) (-> gp-0 world-normal))) + (* (fabs (-> this engine-thrust)) + (-> s4-0 handling speed-scrubbing-drag) + (vector-length (-> s5-0 lin-momentum)) + (square (- 1.0 (fabs (vector-dot (-> s5-0 matrix fvec) (-> gp-0 world-normal))))) + ) + ) + (sqrtf f0-90) + ) + ) ) (add-force! s5-0 (-> gp-0 force)) ) diff --git a/test/decompiler/reference/jak3/levels/factory/car/hvehicle-util_REF.gc b/test/decompiler/reference/jak3/levels/factory/car/hvehicle-util_REF.gc index 4cd6b8bb0b..f945b23abb 100644 --- a/test/decompiler/reference/jak3/levels/factory/car/hvehicle-util_REF.gc +++ b/test/decompiler/reference/jak3/levels/factory/car/hvehicle-util_REF.gc @@ -5,7 +5,7 @@ ;; INFO: Used lq/sq ;; 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 (a0-95 int) (a0-97 int) (sv-16 vector) (sv-20 float) (sv-24 float)) + (local-vars (a0-95 int) (a0-97 int)) (let* ((v1-1 (-> *perf-stats* data 21)) (a0-1 (-> v1-1 ctrl)) ) @@ -24,10 +24,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 'vehicle-physics-work))) + (let ((sv-16 arg0) + (sv-20 arg3) + (sv-24 (-> arg2 info info inv-mass)) + (gp-0 (new 'stack-no-clear 'vehicle-physics-work)) + ) (set! (-> gp-0 dir x) (+ (-> this target-speed) (-> this target-speed-offset))) (vector-copy! (-> gp-0 mat uvec) arg1) (set! (-> gp-0 mat rvec quad) (-> arg2 root trans quad)) @@ -43,14 +44,11 @@ (logclear! (-> this flags) (vehicle-controller-flag on-straightaway)) ) (when (not (logtest? (-> this flags) (vehicle-controller-flag no-slowing-for-turns))) - (let ((f1-4 (* 0.5 (/ 1.0 (-> this turn-accel)))) - (f2-2 (vector-length-squared arg1)) - (f3-1 (-> this max-turn-speed)) - ) - (if (>= (* f1-4 (- f2-2 (* f3-1 f3-1))) f0-5) - (set! (-> gp-0 dir x) (fmin (-> gp-0 dir x) (-> this max-turn-speed))) - ) - ) + (if (>= (* 0.5 (/ 1.0 (-> this turn-accel)) (- (vector-length-squared arg1) (square (-> this max-turn-speed)))) + f0-5 + ) + (set! (-> gp-0 dir x) (fmin (-> gp-0 dir x) (-> this max-turn-speed))) + ) ) ) ) @@ -83,11 +81,7 @@ (set! (-> gp-0 force y) (-> gp-0 mat rvec 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 10)) (f30-1 (-> arg2 root root-prim prim-core world-sphere w)) @@ -110,9 +104,7 @@ (let ((f1-12 (vector-length-squared (-> gp-0 tmp)))) (vector-float*! (-> gp-0 axis) (-> gp-0 tmp) (/ 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? (vehicle-flag player-driving) (-> v1-70 v-flags))) (when (and (< 0.0 sv-20) (< f1-12 f28-0)) @@ -160,18 +152,10 @@ (vector-! (-> gp-0 world-pos) (-> gp-0 force) (-> gp-0 mat rvec)) (let ((f0-39 (vector-length-squared (-> gp-0 world-pos)))) (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-68 (-> gp-0 world-pos)) - (f1-26 12288.0) - (f2-12 4096.0) - ) - (t9-8 a0-68 (fmin f1-26 (- f0-39 (* f2-12 f2-12)))) - ) - (vector+! (-> gp-0 mat fvec) (-> gp-0 mat fvec) (-> gp-0 world-pos)) - ) + (when (< (square 4096.0) f0-39) + (logior! (-> this flags) (vehicle-controller-flag off-path)) + (vector-normalize! (-> gp-0 world-pos) (fmin 12288.0 (- f0-39 (square 4096.0)))) + (vector+! (-> gp-0 mat fvec) (-> gp-0 mat fvec) (-> gp-0 world-pos)) ) ) (vector+float*! diff --git a/test/decompiler/reference/jak3/levels/factory/car/hvehicle_REF.gc b/test/decompiler/reference/jak3/levels/factory/car/hvehicle_REF.gc index 102b9801d8..c4d1c4b47d 100644 --- a/test/decompiler/reference/jak3/levels/factory/car/hvehicle_REF.gc +++ b/test/decompiler/reference/jak3/levels/factory/car/hvehicle_REF.gc @@ -135,27 +135,16 @@ (when (and (not (logtest? (-> this controller flags) (vehicle-controller-flag off-path))) (>= (-> this rbody matrix uvec y) (cos 910.2222)) ) - (let ((f0-1 (vector-length-squared (-> this rbody ang-velocity))) - (f1-0 0.5) - ) - (if (< f0-1 (* f1-0 f1-0)) - (logclear! (-> this v-flags) (vehicle-flag disturbed)) - ) - ) + (if (< (vector-length-squared (-> this rbody ang-velocity)) (square 0.5)) + (logclear! (-> this v-flags) (vehicle-flag disturbed)) + ) ) ) (else (when (>= (-> this rbody matrix uvec 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)))) (when (and (< (vector-length-squared (-> this rbody ang-velocity)) f0-4) - (let ((f1-7 (vector-length-squared (-> this rbody lin-velocity))) - (f2-0 614.4) - ) - (< f1-7 (* f0-4 (* f2-0 f2-0))) - ) + (< (vector-length-squared (-> this rbody lin-velocity)) (* f0-4 (square 614.4))) ) (logclear! (-> this v-flags) (vehicle-flag disturbed)) (vehicle-method-142 this) @@ -208,57 +197,55 @@ (when (!= *vehicle-shadow-control-disabled* s5-0) (let ((s4-0 (new 'stack-no-clear 'inline-array 'vector 2))) (set! (-> s4-0 0 y) (vector-vector-xz-distance-squared (camera-pos) (-> this root trans))) - (let ((f0-1 245760.0)) - (cond - ((< (* f0-1 f0-1) (-> s4-0 0 y)) - (logior! (-> s5-0 settings flags) (shadow-flags disable-draw)) - 0 - (set! (-> this draw bounds w) (-> this bound-radius)) - ) - (else - (-> this root) - (if (or (logtest? (-> s5-0 settings flags) (shadow-flags disable-draw)) - (let ((a1-1 (-> this clock)) - (a0-2 (-> this traffic-priority-id)) - ) - (not (logtest? (logxor a0-2 (-> a1-1 integral-frame-counter)) 7)) - ) + (cond + ((< (square 245760.0) (-> s4-0 0 y)) + (logior! (-> s5-0 settings flags) (shadow-flags disable-draw)) + 0 + (set! (-> this draw bounds w) (-> this bound-radius)) + ) + (else + (-> this root) + (if (or (logtest? (-> s5-0 settings flags) (shadow-flags disable-draw)) + (let ((a1-1 (-> this clock)) + (a0-2 (-> this traffic-priority-id)) + ) + (not (logtest? (logxor a0-2 (-> a1-1 integral-frame-counter)) 7)) ) - (vehicle-method-101 this) + ) + (vehicle-method-101 this) + ) + (set! (-> s4-0 0 x) (sqrtf (-> s4-0 0 y))) + (when (not (logtest? #x40000 (-> this info flags))) + (set! (-> this draw bounds w) + (lerp-scale + (- (-> s5-0 settings center y) (-> this root gspot-pos y)) + (-> this bound-radius) + (-> s4-0 0 x) + 81920.0 + 122880.0 + ) + ) + (if (< (-> this draw bounds w) (-> this bound-radius)) + (set! (-> this draw bounds w) (-> this bound-radius)) ) - (set! (-> s4-0 0 x) (sqrtf (-> s4-0 0 y))) - (when (not (logtest? #x40000 (-> this info flags))) - (set! (-> this draw bounds w) - (lerp-scale - (- (-> s5-0 settings center y) (-> this root gspot-pos y)) - (-> this bound-radius) - (-> s4-0 0 x) - 81920.0 - 122880.0 - ) - ) - (if (< (-> this draw bounds w) (-> this bound-radius)) - (set! (-> this draw bounds w) (-> this bound-radius)) - ) - ) - (set! (-> s4-0 0 z) (lerp-scale 0.0 1.0 (-> s4-0 0 x) 245760.0 40960.0)) - (set! (-> s4-0 0 z) - (fmax 0.01 (+ (* -2.0 (-> s4-0 0 z) (-> s4-0 0 z) (-> s4-0 0 z)) (* 3.0 (-> s4-0 0 z) (-> s4-0 0 z)))) - ) - (set! (-> s4-0 0 w) (* 4096.0 (+ 5.0 (* 5.0 (- 1.0 (-> this root gspot-normal y)))))) - (set! (-> s4-0 1 x) (- (-> s5-0 settings center y) (-> this root gspot-pos y))) - (set! (-> s5-0 settings shadow-dir w) (+ 20480.0 (* 409600.0 (-> s4-0 0 z)) (-> s4-0 1 x))) - (+! (-> s4-0 0 z) 0.5) - (seek! - (-> s5-0 settings top-plane w) - (+ (-> s4-0 1 x) (* (-> s4-0 0 z) (- (-> s4-0 0 w)))) - (* 81920.0 (seconds-per-frame)) - ) - (seek! - (-> s5-0 settings bot-plane w) - (+ (-> s4-0 1 x) (* (-> s4-0 0 z) (-> s4-0 0 w))) - (* 81920.0 (seconds-per-frame)) - ) + ) + (set! (-> s4-0 0 z) (lerp-scale 0.0 1.0 (-> s4-0 0 x) 245760.0 40960.0)) + (set! (-> s4-0 0 z) + (fmax 0.01 (+ (* -2.0 (-> s4-0 0 z) (-> s4-0 0 z) (-> s4-0 0 z)) (* 3.0 (-> s4-0 0 z) (-> s4-0 0 z)))) + ) + (set! (-> s4-0 0 w) (* 4096.0 (+ 5.0 (* 5.0 (- 1.0 (-> this root gspot-normal y)))))) + (set! (-> s4-0 1 x) (- (-> s5-0 settings center y) (-> this root gspot-pos y))) + (set! (-> s5-0 settings shadow-dir w) (+ 20480.0 (* 409600.0 (-> s4-0 0 z)) (-> s4-0 1 x))) + (+! (-> s4-0 0 z) 0.5) + (seek! + (-> s5-0 settings top-plane w) + (+ (-> s4-0 1 x) (* (-> s4-0 0 z) (- (-> s4-0 0 w)))) + (* 81920.0 (seconds-per-frame)) + ) + (seek! + (-> s5-0 settings bot-plane w) + (+ (-> s4-0 1 x) (* (-> s4-0 0 z) (-> s4-0 0 w))) + (* 81920.0 (seconds-per-frame)) ) ) ) @@ -410,11 +397,8 @@ 0.0 ) (else - (let* ((v1-22 (-> this rbody lin-velocity)) - (f1-10 (+ (* (-> v1-22 x) (-> v1-22 x)) (* (-> v1-22 z) (-> v1-22 z)))) - (f2-8 8192.0) - ) - (if (< f1-10 (* f2-8 f2-8)) + (let ((v1-22 (-> this rbody lin-velocity))) + (if (< (+ (* (-> v1-22 x) (-> v1-22 x)) (* (-> v1-22 z) (-> v1-22 z))) (square 8192.0)) (logior! (-> this v-flags) (vehicle-flag reverse-gear)) ) ) @@ -542,20 +526,14 @@ ) (cond ((logtest? (vehicle-flag camera-rapid-tracking-mode) (-> this v-flags)) - (let ((f0-1 (vector-length-squared (-> this root transv))) - (f1-2 122880.0) - ) - (if (< f0-1 (* f1-2 f1-2)) - (vehicle-method-87 this) - ) - ) + (if (< (vector-length-squared (-> this root transv)) (square 122880.0)) + (vehicle-method-87 this) + ) ) (else - (let ((f0-2 143360.0)) - (if (< (* f0-2 f0-2) (vector-length-squared (-> this root transv))) - (vehicle-method-86 this) - ) - ) + (if (< (square 143360.0) (vector-length-squared (-> this root transv))) + (vehicle-method-86 this) + ) ) ) (let ((t9-3 (method-of-type vehicle vehicle-method-94))) @@ -771,22 +749,14 @@ (set! (-> this v-flags) (the-as vehicle-flag (logclear (-> this v-flags) (vehicle-flag sounds particles joints))) ) - (let ((f0-0 (-> this player-dist2)) - (f1-0 245760.0) - ) - (if (< f0-0 (* f1-0 f1-0)) - (set! (-> this v-flags) (the-as vehicle-flag (logior (vehicle-flag sounds) (-> this v-flags)))) - ) - ) + (if (< (-> this player-dist2) (square 245760.0)) + (set! (-> this v-flags) (the-as vehicle-flag (logior (vehicle-flag sounds) (-> this v-flags)))) + ) (when (logtest? (-> this draw status) (draw-control-status on-screen)) (set! (-> this v-flags) (the-as vehicle-flag (logior (vehicle-flag particles) (-> this v-flags)))) - (let ((f0-1 (-> this camera-dist2)) - (f1-3 245760.0) - ) - (if (< f0-1 (* f1-3 f1-3)) - (set! (-> this v-flags) (the-as vehicle-flag (logior (vehicle-flag joints) (-> this v-flags)))) - ) - ) + (if (< (-> this camera-dist2) (square 245760.0)) + (set! (-> this v-flags) (the-as vehicle-flag (logior (vehicle-flag joints) (-> this v-flags)))) + ) ) (let ((a1-0 (-> this rbody position))) (set! (-> this flight-level) (get-height-at-point *traffic-height-map* a1-0)) @@ -873,22 +843,18 @@ (set! (-> this v-flags) (the-as vehicle-flag (logclear (-> this v-flags) (vehicle-flag sounds particles joints))) ) - (let ((f0-9 (-> this player-dist2)) - (f1-8 245760.0) - ) - (cond - ((< 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))) - ) - (set! (-> this v-flags) (the-as vehicle-flag (logior (vehicle-flag sounds) (-> this v-flags)))) - (rigid-body-object-method-38 this) + (cond + ((< (-> 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))) ) - (else - (if (logtest? (vehicle-flag sounds) (-> this unknown-flags)) - (vehicle-method-106 this) - ) - ) + (set! (-> this v-flags) (the-as vehicle-flag (logior (vehicle-flag sounds) (-> this v-flags)))) + (rigid-body-object-method-38 this) + ) + (else + (if (logtest? (vehicle-flag sounds) (-> this unknown-flags)) + (vehicle-method-106 this) + ) ) ) (when (logtest? (-> this draw status) (draw-control-status on-screen)) diff --git a/test/decompiler/reference/jak3/levels/factory/conveyor_REF.gc b/test/decompiler/reference/jak3/levels/factory/conveyor_REF.gc index 918f7d158d..fd62429c37 100644 --- a/test/decompiler/reference/jak3/levels/factory/conveyor_REF.gc +++ b/test/decompiler/reference/jak3/levels/factory/conveyor_REF.gc @@ -119,19 +119,18 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defmethod init-fields! ((this conveyor)) - (local-vars (sv-16 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) (the-as (pointer float) #f)) (set! (-> this speed-mult-array-len) 0) - (let ((a0-1 (-> this entity))) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-4 (res-lump-data a0-1 'scale-factor (pointer float) :tag-ptr (& sv-16)))) - (when v1-4 - (set! (-> this speed-mult-array) v1-4) - (set! (-> this speed-mult-array-len) (the-as int (-> sv-16 elt-count))) - ) + (let* ((a0-1 (-> this entity)) + (sv-16 (new 'static 'res-tag)) + (v1-4 (res-lump-data a0-1 'scale-factor (pointer float) :tag-ptr (& sv-16))) + ) + (when v1-4 + (set! (-> this speed-mult-array) v1-4) + (set! (-> this speed-mult-array-len) (the-as int (-> sv-16 elt-count))) ) ) 0 @@ -238,14 +237,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)) ) ) ) @@ -281,14 +276,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) (-> this collide-bounds r))) - ) - (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) (-> this collide-bounds 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)) ) ) ) @@ -342,7 +333,6 @@ ;; definition for method 21 of type conveyor ;; INFO: Used lq/sq (defmethod conveyor-method-21 ((this conveyor)) - (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)) @@ -352,30 +342,32 @@ (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)) - (vector-copy! (-> sv-48 start) s3-0) - (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 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 conveyor-section #f)) + ) + (dotimes (s0-0 s1-0) + (let ((sv-48 (-> s2-0 data s0-0))) + (vector-copy! (-> sv-48 start) s3-0) + (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 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/jak3/levels/factory/fac-robotank-turret_REF.gc b/test/decompiler/reference/jak3/levels/factory/fac-robotank-turret_REF.gc index 4655777e67..6b75afbb13 100644 --- a/test/decompiler/reference/jak3/levels/factory/fac-robotank-turret_REF.gc +++ b/test/decompiler/reference/jak3/levels/factory/fac-robotank-turret_REF.gc @@ -501,7 +501,6 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch (pointer ftank-shot) vs none. (defmethod fac-robotank-turret-method-33 ((this fac-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 2)) ) @@ -517,13 +516,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 fvec) 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)))) (vector-copy! (-> s5-0 0) (-> s3-0 0)) (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/jak3/levels/factory/factory-boss-setup_REF.gc b/test/decompiler/reference/jak3/levels/factory/factory-boss-setup_REF.gc index 3f4862f5d5..0ac117c0fb 100644 --- a/test/decompiler/reference/jak3/levels/factory/factory-boss-setup_REF.gc +++ b/test/decompiler/reference/jak3/levels/factory/factory-boss-setup_REF.gc @@ -344,9 +344,8 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defmethod factory-boss-reticle-info-method-10 ((this factory-boss-reticle-info) (arg0 vector) (arg1 vector) (arg2 int) (arg3 int)) - (local-vars (sv-160 vector)) - (set! sv-160 arg0) - (let ((s4-0 arg1) + (let ((sv-160 arg0) + (s4-0 arg1) (s2-0 arg2) (s1-0 arg3) ) @@ -894,7 +893,6 @@ (defstate impact (factory-boss-shockwave-bomb) :virtual #t :enter (behavior () - (local-vars (sv-272 entity-actor)) (stop-reticle-sound self) (sound-play "erol-proj-expls" :position (-> self root trans)) (let ((v1-4 (-> self root root-prim))) @@ -929,36 +927,20 @@ (matrix-identity! s4-0) (vector-copy! (-> s4-0 trans) s5-1) ) - (let* ((s3-0 (get-process *default-dead-pool* manipy #x20000 1)) - (s4-1 (when s3-0 - (let ((t9-9 (method-of-type manipy activate))) - (t9-9 (the-as manipy s3-0) self "manipy" (the-as pointer #x70004000)) - ) - (let ((s4-2 run-function-in-process) - (s2-0 s3-0) - (s1-0 manipy-init) - (s0-0 s5-1) - ) - (set! sv-272 (-> self entity)) - (let ((t0-2 (art-group-get-by-name *level* "skel-bomb-blast" (the-as (pointer level) #f))) - (t1-1 #f) - (t2-1 0) - ) - ((the-as (function object object object object object object object none) s4-2) - s2-0 - s1-0 - s0-0 - sv-272 - t0-2 - t1-1 - t2-1 - ) - ) - ) - (-> s3-0 ppointer) - ) - ) - ) + (let ((s4-1 (process-spawn + manipy + :init manipy-init + s5-1 + (-> self entity) + (art-group-get-by-name *level* "skel-bomb-blast" (the-as (pointer level) #f)) + #f + 0 + :name "manipy" + :to self + :stack-size #x20000 + ) + ) + ) (when s4-1 (send-event (ppointer->process s4-1) 'rot-quat gp-2) (send-event (ppointer->process s4-1) 'anim-mode 'play1) @@ -1299,28 +1281,21 @@ ;; ERROR: Stack slot load at 64 mismatch: defined as size 4, got size 16 ;; WARN: Return type mismatch quaternion vs object. (defbehavior fac-drop-plat-rot-once fac-drop-plat ((arg0 degrees)) - (local-vars (sv-48 float) (sv-64 float)) (let ((gp-0 (new 'stack-no-clear 'quaternion))) (let ((s5-0 (new 'stack-no-clear 'quaternion))) - (let ((s3-0 quaternion-set!) - (s2-0 gp-0) - (s1-0 (sin (* arg0 (-> self x-rotation-speed)))) - (s0-0 0.0) - ) - (set! sv-48 (the-as float 0.0)) - (let ((t0-0 (cos (* arg0 (-> self x-rotation-speed))))) - (s3-0 s2-0 s1-0 s0-0 sv-48 t0-0) - ) + (quaternion-set! + gp-0 + (sin (* arg0 (-> self x-rotation-speed))) + 0.0 + (the-as float 0.0) + (cos (* arg0 (-> self x-rotation-speed))) ) - (let ((s3-1 quaternion-set!) - (s2-1 s5-0) - (s1-1 0.0) - (s0-1 (sin (* arg0 (-> self y-rotation-speed)))) - ) - (set! sv-64 (the-as float 0.0)) - (let ((t0-1 (cos (* arg0 (-> self y-rotation-speed))))) - (s3-1 s2-1 s1-1 s0-1 sv-64 t0-1) - ) + (quaternion-set! + s5-0 + 0.0 + (sin (* arg0 (-> self y-rotation-speed))) + (the-as float 0.0) + (cos (* arg0 (-> self y-rotation-speed))) ) (quaternion-normalize! (quaternion*! gp-0 gp-0 s5-0)) ) @@ -1391,7 +1366,6 @@ ;; INFO: Used lq/sq (defmethod init-from-entity! ((this fac-drop-plat) (arg0 entity-actor)) "Set up a newly created process from the entity that created it." - (local-vars (sv-16 res-tag)) (with-pp (stack-size-set! (-> this main-thread) 32) (let ((s4-0 (new 'process 'collide-shape this (collide-list-enum usually-hit-by-player)))) @@ -1419,8 +1393,9 @@ (the-as pair 0) ) (set! (-> this draw light-index) (the-as uint 17)) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-16 (res-lump-data arg0 'actor-groups (pointer actor-group) :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-16 (res-lump-data arg0 'actor-groups (pointer actor-group) :tag-ptr (& sv-16))) + ) (cond ((and v1-16 (nonzero? (-> sv-16 elt-count)) (nonzero? (-> v1-16 0 length))) (set! (-> this boss) (-> v1-16 0 data 0 actor)) @@ -1979,7 +1954,6 @@ ;; INFO: Used lq/sq (defmethod init-from-entity! ((this factory-boss) (arg0 entity-actor)) "Set up a newly created process from the entity that created it." - (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-sphere s4-0 (the-as uint 0)))) (set! (-> v1-2 prim-core collide-as) (collide-spec enemy)) @@ -2182,8 +2156,9 @@ (set! (-> this root-angle) (+ 32768.0 (-> this catwalk-angle))) (set! (-> this hits-taken) 0) (set! (-> this camera-timer) 0) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-76 (res-lump-data arg0 'actor-groups pointer :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-76 (res-lump-data arg0 'actor-groups pointer :tag-ptr (& sv-16))) + ) (cond ((and v1-76 (nonzero? (-> sv-16 elt-count))) (set! (-> this actor-group-count) (the-as int (-> sv-16 elt-count))) diff --git a/test/decompiler/reference/jak3/levels/factory/factory-boss-states_REF.gc b/test/decompiler/reference/jak3/levels/factory/factory-boss-states_REF.gc index 6975d7cc88..5e1b86545f 100644 --- a/test/decompiler/reference/jak3/levels/factory/factory-boss-states_REF.gc +++ b/test/decompiler/reference/jak3/levels/factory/factory-boss-states_REF.gc @@ -538,18 +538,6 @@ ;; ERROR: Stack slot load at 336 mismatch: defined as size 4, got size 16 ;; WARN: Return type mismatch symbol vs none. (defbehavior factory-boss-always factory-boss () - (local-vars - (sv-256 (function float float float float float float)) - (sv-272 float) - (sv-288 float) - (sv-304 (function float float float float float float)) - (sv-320 float) - (sv-336 float) - (sv-352 float) - (sv-368 float) - (sv-384 float) - (sv-400 float) - ) (factory-boss-play-speech 0 self) (if (and (nonzero? (-> self camera-timer)) (time-elapsed? (-> self camera-timer) (seconds 3))) (factory-boss-end-cutscene) @@ -665,38 +653,32 @@ ((< (- (current-time) (-> s5-0 ring-timer)) 0) ) ((logtest? (-> s5-0 flags) (facboss-machine-state-flag fms1)) - (let ((s0-1 (current-time)) - (f30-0 300.0) - ) - (set! sv-256 lerp-scale) - (set! sv-272 (the-as float 0.05)) - (set! sv-288 (the-as float 0.15)) - (let* ((v1-73 (/ (the-as int (rand-uint31-gen *random-generator*)) 256)) - (v1-74 (the-as number (logior #x3f800000 v1-73))) - (a2-6 (+ -1.0 (the-as float v1-74))) - (a3-5 0.0) - (t0-0 1.0) - ) - (set! (-> s5-0 ring-timer) (+ s0-1 (the int (* f30-0 (sv-256 sv-272 sv-288 a2-6 a3-5 t0-0))))) - ) + (let* ((s0-1 (current-time)) + (f30-0 300.0) + (sv-256 lerp-scale) + (sv-272 (the-as float 0.05)) + (sv-288 (the-as float 0.15)) + (v1-73 (/ (the-as int (rand-uint31-gen *random-generator*)) 256)) + (v1-74 (the-as number (logior #x3f800000 v1-73))) + ) + (set! (-> s5-0 ring-timer) + (+ s0-1 (the int (* f30-0 (sv-256 sv-272 sv-288 (+ -1.0 (the-as float v1-74)) 0.0 1.0)))) + ) ) (logclear! (-> s5-0 flags) (facboss-machine-state-flag fms1)) ) (else - (let ((s0-2 (current-time)) - (f30-1 300.0) - ) - (set! sv-304 lerp-scale) - (set! sv-320 (the-as float 0.01)) - (set! sv-336 (the-as float 0.2)) - (let* ((v1-84 (/ (the-as int (rand-uint31-gen *random-generator*)) 256)) - (v1-85 (the-as number (logior #x3f800000 v1-84))) - (a2-7 (+ -1.0 (the-as float v1-85))) - (a3-6 0.0) - (t0-1 1.0) - ) - (set! (-> s5-0 ring-timer) (+ s0-2 (the int (* f30-1 (sv-304 sv-320 sv-336 a2-7 a3-6 t0-1))))) - ) + (let* ((s0-2 (current-time)) + (f30-1 300.0) + (sv-304 lerp-scale) + (sv-320 (the-as float 0.01)) + (sv-336 (the-as float 0.2)) + (v1-84 (/ (the-as int (rand-uint31-gen *random-generator*)) 256)) + (v1-85 (the-as number (logior #x3f800000 v1-84))) + ) + (set! (-> s5-0 ring-timer) + (+ s0-2 (the int (* f30-1 (sv-304 sv-320 sv-336 (+ -1.0 (the-as float v1-85)) 0.0 1.0)))) + ) ) (logior! (-> s5-0 flags) (facboss-machine-state-flag fms1)) ) @@ -706,39 +688,33 @@ (vector-copy! (-> s2-0 trans) s1-0) (spawn-from-mat (-> s5-0 damaged-left-spark-part) s2-0) (when (>= (- (current-time) (-> s5-0 left-spark-timer)) 0) - (let ((s1-1 (current-time)) - (f30-2 300.0) - (s0-3 lerp-scale) - ) - (set! sv-352 (the-as float 0.3)) - (set! sv-368 (the-as float 0.7)) - (let* ((v1-103 (/ (the-as int (rand-uint31-gen *random-generator*)) 256)) - (v1-104 (the-as number (logior #x3f800000 v1-103))) - (a2-8 (+ -1.0 (the-as float v1-104))) - (a3-7 0.0) - (t0-2 1.0) - ) - (set! (-> s5-0 left-spark-timer) (+ s1-1 (the int (* f30-2 (s0-3 sv-352 sv-368 a2-8 a3-7 t0-2))))) - ) + (let* ((s1-1 (current-time)) + (f30-2 300.0) + (s0-3 lerp-scale) + (sv-352 (the-as float 0.3)) + (sv-368 (the-as float 0.7)) + (v1-103 (/ (the-as int (rand-uint31-gen *random-generator*)) 256)) + (v1-104 (the-as number (logior #x3f800000 v1-103))) + ) + (set! (-> s5-0 left-spark-timer) + (+ s1-1 (the int (* f30-2 (s0-3 sv-352 sv-368 (+ -1.0 (the-as float v1-104)) 0.0 1.0)))) + ) ) (logclear! (-> s5-0 flags) (facboss-machine-state-flag fms2)) ) ) ((>= (- (current-time) (-> s5-0 left-spark-timer)) 0) - (let ((s1-2 (current-time)) - (f30-3 300.0) - (s0-4 lerp-scale) - ) - (set! sv-384 (the-as float 0.2)) - (set! sv-400 (the-as float 0.4)) - (let* ((v1-117 (/ (the-as int (rand-uint31-gen *random-generator*)) 256)) - (v1-118 (the-as number (logior #x3f800000 v1-117))) - (a2-9 (+ -1.0 (the-as float v1-118))) - (a3-8 0.0) - (t0-3 1.0) - ) - (set! (-> s5-0 left-spark-timer) (+ s1-2 (the int (* f30-3 (s0-4 sv-384 sv-400 a2-9 a3-8 t0-3))))) - ) + (let* ((s1-2 (current-time)) + (f30-3 300.0) + (s0-4 lerp-scale) + (sv-384 (the-as float 0.2)) + (sv-400 (the-as float 0.4)) + (v1-117 (/ (the-as int (rand-uint31-gen *random-generator*)) 256)) + (v1-118 (the-as number (logior #x3f800000 v1-117))) + ) + (set! (-> s5-0 left-spark-timer) + (+ s1-2 (the int (* f30-3 (s0-4 sv-384 sv-400 (+ -1.0 (the-as float v1-118)) 0.0 1.0)))) + ) ) (logior! (-> s5-0 flags) (facboss-machine-state-flag fms2)) ) diff --git a/test/decompiler/reference/jak3/levels/factory/factory-manager_REF.gc b/test/decompiler/reference/jak3/levels/factory/factory-manager_REF.gc index 6a2e74706a..aaef3cce72 100644 --- a/test/decompiler/reference/jak3/levels/factory/factory-manager_REF.gc +++ b/test/decompiler/reference/jak3/levels/factory/factory-manager_REF.gc @@ -193,28 +193,6 @@ ;; ERROR: Stack slot load at 448 mismatch: defined as size 4, got size 16 ;; ERROR: Stack slot load at 448 mismatch: defined as size 4, got size 16 (defmethod init-paths-for-list! ((this factory-manager) (arg0 factory-pathlist) (arg1 string)) - (local-vars - (sv-144 entity) - (sv-160 int) - (sv-176 int) - (sv-192 int) - (sv-208 (function _varargs_ object)) - (sv-224 int) - (sv-240 string) - (sv-256 int) - (sv-272 (function _varargs_ object)) - (sv-288 int) - (sv-304 string) - (sv-320 int) - (sv-336 vector) - (sv-352 vector) - (sv-368 vector) - (sv-384 int) - (sv-400 (function _varargs_ object)) - (sv-416 int) - (sv-432 string) - (sv-448 float) - ) (set! (-> arg0 npath) 0) (set! (-> arg0 nloop) 0) (let ((s3-0 (new 'stack 'curve))) @@ -230,59 +208,53 @@ (if #f (format 0 "String: ~A~%" *fac-tmp-str*) ) - (set! sv-144 (entity-by-name *fac-tmp-str*)) - (+! s2-0 1) - (if (not sv-144) - (set! s1-0 #t) - ) - (set! sv-160 0) - (when sv-144 - (set! (-> this entity) (the-as entity-actor sv-144)) - (set! sv-160 (fac-count-curves (the-as entity-actor sv-144))) - (set! sv-176 0) - (while (< sv-176 sv-160) - (set! sv-192 (+ sv-176 (-> arg0 npath))) - (while (not (get-curve-data! sv-144 s3-0 'path 'path-k (the float s0-0))) - (+! s0-0 1) + (let ((sv-144 (entity-by-name *fac-tmp-str*))) + (+! s2-0 1) + (if (not sv-144) + (set! s1-0 #t) ) - (set! (-> arg0 path sv-192) (new 'process 'curve-control this 'path (the float s0-0))) - (+! s0-0 1) - (logior! (-> arg0 path sv-192 flags) (path-control-flag display draw-line draw-point draw-text)) - (when #f - (set! sv-208 format) - (set! sv-224 0) - (set! sv-240 "Path ~d length ~M~%") - (set! sv-256 sv-192) - (let ((a3-3 (total-distance (-> arg0 path sv-192)))) - (sv-208 sv-224 sv-240 sv-256 a3-3) - ) - ) - (set! sv-336 (new 'stack-no-clear 'vector)) - (set! sv-352 (new 'stack-no-clear 'vector)) - (get-point-at-percent-along-path! (-> arg0 path sv-192) sv-336 0.0 'interp) - (get-point-at-percent-along-path! (-> arg0 path sv-192) sv-352 1.0 'interp) - (when #f - (set! sv-272 format) - (set! sv-288 0) - (set! sv-304 "Begin to end of path ~d is ~M~%") - (set! sv-320 sv-192) - (let ((a3-6 (vector-vector-distance sv-336 sv-352))) - (sv-272 sv-288 sv-304 sv-320 a3-6) - ) - ) - (when (>= 4.096 (vector-vector-distance-squared sv-336 sv-352)) - (if #f - (format 0 "Path idx ~d is a loop~%" sv-192) + (let ((sv-160 0)) + (when sv-144 + (set! (-> this entity) (the-as entity-actor sv-144)) + (set! sv-160 (fac-count-curves (the-as entity-actor sv-144))) + (let ((sv-176 0)) + (while (< sv-176 sv-160) + (let ((sv-192 (+ sv-176 (-> arg0 npath)))) + (while (not (get-curve-data! sv-144 s3-0 'path 'path-k (the float s0-0))) + (+! s0-0 1) + ) + (set! (-> arg0 path sv-192) (new 'process 'curve-control this 'path (the float s0-0))) + (+! s0-0 1) + (logior! (-> arg0 path sv-192 flags) (path-control-flag display draw-line draw-point draw-text)) + (if #f + (format 0 "Path ~d length ~M~%" sv-192 (total-distance (-> arg0 path sv-192))) + ) + (let ((sv-336 (new 'stack-no-clear 'vector)) + (sv-352 (new 'stack-no-clear 'vector)) + ) + (get-point-at-percent-along-path! (-> arg0 path sv-192) sv-336 0.0 'interp) + (get-point-at-percent-along-path! (-> arg0 path sv-192) sv-352 1.0 'interp) + (if #f + (format 0 "Begin to end of path ~d is ~M~%" sv-192 (vector-vector-distance sv-336 sv-352)) + ) + (when (>= 4.096 (vector-vector-distance-squared sv-336 sv-352)) + (if #f + (format 0 "Path idx ~d is a loop~%" sv-192) + ) + (logior! (-> arg0 inout sv-192 flags) (factory-inout-flag fi0)) + (set! (-> arg0 loops (-> arg0 nloop)) sv-192) + (+! (-> arg0 nloop) 1) + ) + ) + ) + (+! sv-176 1) ) - (logior! (-> arg0 inout sv-192 flags) (factory-inout-flag fi0)) - (set! (-> arg0 loops (-> arg0 nloop)) sv-192) - (+! (-> arg0 nloop) 1) + ) ) - (set! sv-176 (+ sv-176 1)) + (+! (-> arg0 npath) sv-160) ) ) ) - (+! (-> arg0 npath) sv-160) ) ) ) @@ -304,9 +276,9 @@ (let ((s2-1 (new 'stack-no-clear 'vector)) (s1-1 (new 'stack-no-clear 'vector)) (s0-1 (new 'stack-no-clear 'vector)) + (sv-368 (new 'stack-no-clear 'vector)) + (sv-384 0) ) - (set! sv-368 (new 'stack-no-clear 'vector)) - (set! sv-384 0) (while (< sv-384 (-> arg0 npath)) (when (logtest? (-> arg0 inout sv-384 flags) (factory-inout-flag fi0)) (get-point-at-percent-along-path! (-> arg0 path s5-1) s2-1 0.0 'interp) @@ -322,15 +294,9 @@ ) (get-point-at-percent-along-path! (-> arg0 path sv-384) s0-1 f26-0 'interp) (get-point-at-percent-along-path! (-> arg0 path sv-384) sv-368 f24-0 'interp) - (when #f - (set! sv-400 format) - (set! sv-416 0) - (set! sv-432 "Dist1: ~M Dist2: ~M~%") - (set! sv-448 (vector-vector-distance s2-1 s0-1)) - (let ((a3-12 (vector-vector-distance s1-1 sv-368))) - (sv-400 sv-416 sv-432 sv-448 a3-12) + (if #f + (format 0 "Dist1: ~M Dist2: ~M~%" (vector-vector-distance s2-1 s0-1) (vector-vector-distance s1-1 sv-368)) ) - ) (when (< (vector-vector-distance s2-1 s0-1) f28-0) (set! s4-1 1) (set! f28-0 (vector-vector-distance s2-1 s0-1)) @@ -345,7 +311,7 @@ ) ) ) - (set! sv-384 (+ sv-384 1)) + (+! sv-384 1) ) ) (if #f @@ -1676,12 +1642,12 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defmethod task-manager-factory-sky-battle-method-32 ((this task-manager-factory-sky-battle)) - (local-vars (sv-16 res-tag)) (let ((a0-2 (entity-by-name "factory-sky-battle-manager-1"))) (when a0-2 (set! (-> this factory-sky-battle-entity) (the-as entity-actor a0-2)) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-1 (res-lump-data a0-2 'actor-groups pointer :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-1 (res-lump-data a0-2 'actor-groups pointer :tag-ptr (& sv-16))) + ) (cond ((and v1-1 (nonzero? (-> sv-16 elt-count))) (set! (-> this actor-group-count) (the-as int (-> sv-16 elt-count))) diff --git a/test/decompiler/reference/jak3/levels/factory/factoryc-obs2_REF.gc b/test/decompiler/reference/jak3/levels/factory/factoryc-obs2_REF.gc index 7baeb7ef02..964eaf189a 100644 --- a/test/decompiler/reference/jak3/levels/factory/factoryc-obs2_REF.gc +++ b/test/decompiler/reference/jak3/levels/factory/factoryc-obs2_REF.gc @@ -973,7 +973,6 @@ ;; INFO: Used lq/sq (defmethod init-from-entity! ((this fac-switch) (arg0 entity-actor)) "Set up a newly created process from the entity that created it." - (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) @@ -1019,8 +1018,9 @@ (the-as skeleton-group (art-group-get-by-name *level* "skel-fac-switch" (the-as (pointer level) #f))) (the-as pair 0) ) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-26 (res-lump-data arg0 'actor-groups pointer :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-26 (res-lump-data arg0 'actor-groups pointer :tag-ptr (& sv-16))) + ) (cond ((and v1-26 (nonzero? (-> sv-16 elt-count))) (set! (-> this actor-group-count) (the-as int (-> sv-16 elt-count))) @@ -1881,18 +1881,17 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defmethod init-fields! ((this factory-conveyor)) - (local-vars (sv-16 res-tag)) (set! (-> this speed) 22528.0) (set! (-> this pull-y-threshold) 10240.0) (set! (-> this speed-mult-array) (the-as (pointer float) #f)) (set! (-> this speed-mult-array-len) 0) - (let ((a0-1 (-> this entity))) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-3 (res-lump-data a0-1 'scale-factor pointer :tag-ptr (& sv-16)))) - (when v1-3 - (set! (-> this speed-mult-array) (the-as (pointer float) v1-3)) - (set! (-> this speed-mult-array-len) (the-as int (-> sv-16 elt-count))) - ) + (let* ((a0-1 (-> this entity)) + (sv-16 (new 'static 'res-tag)) + (v1-3 (res-lump-data a0-1 'scale-factor (pointer float) :tag-ptr (& sv-16))) + ) + (when v1-3 + (set! (-> this speed-mult-array) v1-3) + (set! (-> this speed-mult-array-len) (the-as int (-> sv-16 elt-count))) ) ) (set! (-> this belt-radius) (* 4096.0 (the-as float ((method-of-type res-lump get-property-struct) @@ -2102,3 +2101,7 @@ (go perish-immediately) ) ) + + + + diff --git a/test/decompiler/reference/jak3/levels/factory/factoryc-obs_REF.gc b/test/decompiler/reference/jak3/levels/factory/factoryc-obs_REF.gc index 8e00c5a954..1cf74690ed 100644 --- a/test/decompiler/reference/jak3/levels/factory/factoryc-obs_REF.gc +++ b/test/decompiler/reference/jak3/levels/factory/factoryc-obs_REF.gc @@ -1298,7 +1298,6 @@ ;; INFO: Used lq/sq (defmethod init-from-entity! ((this factory-elec-gate) (arg0 entity-actor)) "Set up a newly created process from the entity that created it." - (local-vars (sv-16 res-tag)) (when (task-node-closed? (game-task-node factory-assault-get-vehicle)) (process-entity-status! this (entity-perm-status dead) #t) (deactivate this) @@ -1318,8 +1317,9 @@ (+! s4-0 1) ) ) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-20 (res-lump-data arg0 'actor-groups (pointer actor-group) :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-20 (res-lump-data arg0 'actor-groups (pointer actor-group) :tag-ptr (& sv-16))) + ) (cond ((and v1-20 (nonzero? (-> sv-16 elt-count))) (set! (-> this actor-group-count) (the-as int (-> sv-16 elt-count))) diff --git a/test/decompiler/reference/jak3/levels/factory/h-warf_REF.gc b/test/decompiler/reference/jak3/levels/factory/h-warf_REF.gc index 30cbd199df..5ac42979eb 100644 --- a/test/decompiler/reference/jak3/levels/factory/h-warf_REF.gc +++ b/test/decompiler/reference/jak3/levels/factory/h-warf_REF.gc @@ -499,9 +499,7 @@ ;; definition for function steer-attenuation (defun steer-attenuation ((arg0 int)) 0.0 - (let ((f0-2 (- 1.0 (fmax 0.0 (fmin 1.0 (* 0.0033333334 (the float (+ (- -90 arg0) (current-time))))))))) - (* f0-2 f0-2) - ) + (square (- 1.0 (fmax 0.0 (fmin 1.0 (* 0.0033333334 (the float (+ (- -90 arg0) (current-time)))))))) ) ;; definition of type warf-asc @@ -653,7 +651,6 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defmethod control-hook-player ((this h-warf)) - (local-vars (sv-1040 vector)) (b! (focus-test? *target* dead grabbed) cfg-39 :delay (nop!)) (let ((s5-0 (new 'stack-no-clear 'matrix))) (matrix-rotate-y! s5-0 (* 182.04445 (seconds-per-frame) (* 180.0 (-> this controls steering)))) @@ -692,24 +689,25 @@ (let ((s1-1 (new 'stack 'boxed-array collide-shape 128)) (s0-1 (new 'stack-no-clear 'vector)) ) - (set! sv-1040 (new 'stack-no-clear 'vector)) - 0 - (set-vector! s2-0 0.0 0.0 204800.0 1.0) - (vector-matrix*! s0-1 s2-0 s3-0) - (set-vector! s2-0 0.0 0.0 1658880.0 1.0) - (vector-rotate*! sv-1040 s2-0 s3-0) - (set! (-> s0-1 w) 32768.0) - (set! (-> sv-1040 w) 32768.0) - (set! (-> s1-1 length) (fill-actor-list-for-sphere - *actor-hash* - s0-1 - sv-1040 - (-> sv-1040 w) - (the-as (pointer collide-shape) (-> s1-1 data)) - (-> s1-1 allocated-length) - -1 - ) - ) + (let ((sv-1040 (new 'stack-no-clear 'vector))) + 0 + (set-vector! s2-0 0.0 0.0 204800.0 1.0) + (vector-matrix*! s0-1 s2-0 s3-0) + (set-vector! s2-0 0.0 0.0 1658880.0 1.0) + (vector-rotate*! sv-1040 s2-0 s3-0) + (set! (-> s0-1 w) 32768.0) + (set! (-> sv-1040 w) 32768.0) + (set! (-> s1-1 length) (fill-actor-list-for-sphere + *actor-hash* + s0-1 + sv-1040 + (-> sv-1040 w) + (the-as (pointer collide-shape) (-> s1-1 data)) + (-> s1-1 allocated-length) + -1 + ) + ) + ) (let ((a0-41 (find-nearest-focusable (the-as (array collide-shape) s1-1) s0-1 @@ -1024,14 +1022,7 @@ ) (when (logtest? (-> this info flags) 1) (vector-float*! (-> arg1 tmp) (-> arg1 mat uvec) -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)) diff --git a/test/decompiler/reference/jak3/levels/factory/lfaccity-mood_REF.gc b/test/decompiler/reference/jak3/levels/factory/lfaccity-mood_REF.gc index 9ec0a3c055..288616e5b8 100644 --- a/test/decompiler/reference/jak3/levels/factory/lfaccity-mood_REF.gc +++ b/test/decompiler/reference/jak3/levels/factory/lfaccity-mood_REF.gc @@ -174,9 +174,9 @@ ;; INFO: Used lq/sq (defmethod init-from-entity! ((this lfaccity-pparticle-mover) (arg0 entity-actor)) "Set up a newly created process from the entity that created it." - (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/jak3/levels/factory/missile-bot_REF.gc b/test/decompiler/reference/jak3/levels/factory/missile-bot_REF.gc index c987b974f1..18c798ef92 100644 --- a/test/decompiler/reference/jak3/levels/factory/missile-bot_REF.gc +++ b/test/decompiler/reference/jak3/levels/factory/missile-bot_REF.gc @@ -359,13 +359,7 @@ (set! (-> s0-0 y) 0.0) (vector-float*! s2-1 s5-1 (vector-dot s5-1 s0-0)) (vector-! s1-0 s2-1 s0-0) - (let ((v1-10 arg0) - (a0-11 s2-1) - (a1-7 s5-1) - (f0-4 110592.0) - ) - (vector+float*! v1-10 a0-11 a1-7 (sqrtf (- (* f0-4 f0-4) (vector-length-squared s1-0)))) - ) + (vector+float*! arg0 s2-1 s5-1 (sqrtf (- (square 110592.0) (vector-length-squared s1-0)))) (if (< (vector-dot s5-1 arg0) 0.0) (vector-reset! arg0) ) @@ -375,10 +369,8 @@ 0.0 (let ((f0-13 (* -0.5 (vector-vector-distance arg0 s4-0)))) (set! (-> s2-3 y) 0.0) - (let ((f1-3 (vector-length-squared s2-3)) - (f2-0 20480.0) - ) - (if (< (* f2-0 f2-0) f1-3) + (let ((f1-3 (vector-length-squared s2-3))) + (if (< (square 20480.0) f1-3) (vector-float*! s2-3 s2-3 (/ 20480.0 (sqrtf f1-3))) ) ) @@ -509,34 +501,24 @@ ) ) (let ((f30-0 (vector-vector-xz-distance-squared (-> self root trans) (target-pos 0)))) - (let* ((gp-2 (-> self nav)) - (t9-11 lerp-scale) - (a0-13 0.0) - (a1-2 (-> self enemy-info run-travel-speed)) - (a2-0 f30-0) - (f0-1 12288.0) - (a3-0 (* f0-1 f0-1)) - (f0-3 16384.0) - ) - (set! (-> gp-2 target-speed) (t9-11 a0-13 a1-2 a2-0 a3-0 (* f0-3 f0-3))) + (let ((gp-2 (-> self nav))) + (set! (-> gp-2 target-speed) + (lerp-scale 0.0 (-> self enemy-info run-travel-speed) f30-0 (square 12288.0) (square 16384.0)) + ) ) 0 - (let ((f0-6 16384.0)) - (cond - ((< f30-0 (* f0-6 f0-6)) - (when (zero? (-> self lightning-timer)) - (set! (-> self lightning-mode) (the-as uint 1)) - (set-time! (-> self lightning-timer)) - ) + (cond + ((< f30-0 (square 16384.0)) + (when (zero? (-> self lightning-timer)) + (set! (-> self lightning-mode) (the-as uint 1)) + (set-time! (-> self lightning-timer)) ) - ((let ((f0-9 24576.0)) - (and (< (* f0-9 f0-9) f30-0) (>= (+ (current-time) (seconds -1)) (-> self lightning-timer))) - ) - (set! (-> self lightning-mode) (the-as uint 0)) - (set! (-> self lightning-timer) 0) - 0 - ) - ) + ) + ((and (< (square 24576.0) f30-0) (>= (+ (current-time) (seconds -1)) (-> self lightning-timer))) + (set! (-> self lightning-mode) (the-as uint 0)) + (set! (-> self lightning-timer) 0) + 0 + ) ) ) ) @@ -721,13 +703,11 @@ (set! (-> self explosion-sound-index) 0) (set! (-> self will-hit-errol) #f) (let ((v1-3 (as-type (ppointer->process (-> self parent)) factory-boss))) - (when v1-3 - (let ((f0-2 (vector-vector-xz-distance-squared (-> self root trans) (-> v1-3 root trans))) - (f1-0 20480.0) - ) - (set! (-> self will-hit-errol) (< f0-2 (* f1-0 f1-0))) + (if v1-3 + (set! (-> self will-hit-errol) + (< (vector-vector-xz-distance-squared (-> self root trans) (-> v1-3 root trans)) (square 20480.0)) + ) ) - ) ) ) :trans (behavior () @@ -833,7 +813,6 @@ ;; WARN: Return type mismatch symbol vs none. (defmethod enemy-common-post ((this missile-bot)) "Common implementation of post. Runs ja-post." - (local-vars (sv-272 vector) (sv-288 vector) (sv-304 vector)) (with-pp (cond ((stunned?) @@ -929,22 +908,13 @@ (let ((v0-33 (vector-normalize-copy! (new 'stack-no-clear 'vector) (-> this lightning-wobble 0 value) 819.2))) (vector+! s5-1 s5-1 v0-33) ) - (set! sv-304 s4-0) - (let ((v1-90 (-> s2-0 quad))) - (set! (-> sv-304 quad) v1-90) - ) + (vector-copy! s4-0 s2-0) ) ((= v1-85 1) - (set! sv-304 s4-0) - (let ((v1-92 (-> s1-0 quad))) - (set! (-> sv-304 quad) v1-92) - ) + (vector-copy! s4-0 s1-0) ) ((= v1-85 2) - (set! sv-272 s3-0) - (let ((v1-93 (-> (target-pos 8) quad))) - (set! (-> sv-272 quad) v1-93) - ) + (vector-copy! s3-0 (target-pos 8)) (vector-! s5-1 s3-0 s2-0) (set! (-> s5-1 y) 0.0) (vector-normalize! s5-1 4096.0) @@ -953,22 +923,13 @@ (let ((v0-36 (vector-normalize-copy! (new 'stack-no-clear 'vector) (-> this lightning-wobble 1 value) 819.2))) (vector+! s5-1 s5-1 v0-36) ) - (set! sv-304 s4-0) - (let ((v1-99 (-> s2-0 quad))) - (set! (-> sv-304 quad) v1-99) - ) + (vector-copy! s4-0 s2-0) ) ((= v1-85 3) - (set! sv-304 s4-0) - (let ((v1-101 (-> s3-0 quad))) - (set! (-> sv-304 quad) v1-101) - ) + (vector-copy! s4-0 s3-0) ) ((= v1-85 4) - (set! sv-288 s3-0) - (let ((v1-102 (-> (target-pos 8) quad))) - (set! (-> sv-288 quad) v1-102) - ) + (vector-copy! s3-0 (target-pos 8)) (vector-! s5-1 s3-0 s1-0) (set! (-> s5-1 y) 0.0) (vector-normalize! s5-1 4096.0) @@ -977,16 +938,10 @@ (let ((v0-39 (vector-normalize-copy! (new 'stack-no-clear 'vector) (-> this lightning-wobble 2 value) 819.2))) (vector+! s5-1 s5-1 v0-39) ) - (set! sv-304 s4-0) - (let ((v1-108 (-> s1-0 quad))) - (set! (-> sv-304 quad) v1-108) - ) + (vector-copy! s4-0 s1-0) ) (else - (set! sv-304 s4-0) - (let ((v1-109 (-> (target-pos 6) quad))) - (set! (-> sv-304 quad) v1-109) - ) + (vector-copy! s4-0 (target-pos 6)) ) ) ) diff --git a/test/decompiler/reference/jak3/levels/factory/warf-projectile_REF.gc b/test/decompiler/reference/jak3/levels/factory/warf-projectile_REF.gc index 4ec43baa30..e8eb61435a 100644 --- a/test/decompiler/reference/jak3/levels/factory/warf-projectile_REF.gc +++ b/test/decompiler/reference/jak3/levels/factory/warf-projectile_REF.gc @@ -655,23 +655,11 @@ (defstate impact (warf-projectile) :virtual #t :enter (behavior () - (local-vars (sv-32 int)) (set! (-> self hit-pos w) 0.0) (kill-particles (-> self part)) (let ((gp-0 (new 'stack-no-clear 'warf-explosion-sphere-init-params))) (vector-copy! (-> gp-0 pos) (-> self hit-pos)) - (let ((s5-0 sound-play-by-name) - (sname (static-sound-name "impact-trigger2")) - (s3-0 (new-sound-id)) - (s2-0 1024) - (s1-0 0) - (s0-0 0) - ) - (set! sv-32 0) - (let ((t2-0 (target-pos 0))) - (s5-0 (the-as sound-name sname) s3-0 s2-0 s1-0 s0-0 (the-as sound-group sv-32) t2-0) - ) - ) + (sound-play "impact-trigger2" :position (target-pos 0)) (process-spawn warf-explosion-sphere gp-0 :name "warf-explosion-sphere" :to self) ) (call-parent-state-handler enter) diff --git a/test/decompiler/reference/jak3/levels/forest/for-turret_REF.gc b/test/decompiler/reference/jak3/levels/forest/for-turret_REF.gc index cc3639ca5d..f1751ae7ec 100644 --- a/test/decompiler/reference/jak3/levels/forest/for-turret_REF.gc +++ b/test/decompiler/reference/jak3/levels/forest/for-turret_REF.gc @@ -74,27 +74,6 @@ ;; ERROR: Stack slot load at 368 mismatch: defined as size 4, got size 16 ;; WARN: Return type mismatch int vs none. (defmethod draw ((this hud-for-turret-health)) - (local-vars - (sv-80 float) - (sv-84 vector) - (sv-88 vector) - (sv-92 vector) - (sv-96 vector) - (sv-100 process-focusable) - (sv-128 vector) - (sv-132 vector) - (sv-136 vector) - (sv-140 vector) - (sv-240 float) - (sv-304 vector) - (sv-308 vector) - (sv-312 vector) - (sv-320 vector) - (sv-336 (function float float float float float float)) - (sv-352 float) - (sv-368 float) - (sv-384 int) - ) (with-pp (seek! (-> this fade-interp) @@ -110,34 +89,39 @@ (set-as-offset-from! (-> this sprites 1) (-> this sprites 0 pos) 44 0) (set-as-offset-from! (-> this sprites 2) (-> this sprites 0 pos) 0 44) (set-as-offset-from! (-> this sprites 3) (-> this sprites 0 pos) 44 44) - (set! sv-80 (* 0.5 (- 1.0 (-> this offset)) (-> this fade-interp))) - (let ((v1-8 (new 'stack-no-clear 'vector))) + (let ((sv-80 (* 0.5 (- 1.0 (-> this offset)) (-> this fade-interp))) + (v1-8 (new 'stack-no-clear 'vector)) + ) (set! (-> v1-8 x) 255.0) (set! (-> v1-8 y) 32.0) (set! (-> v1-8 z) 0.0) (set! (-> v1-8 w) 0.0) - (set! sv-84 v1-8) - ) - (let ((v1-9 (new 'stack-no-clear 'vector))) - (set! (-> v1-9 x) 32.0) - (set! (-> v1-9 y) 230.0) - (set! (-> v1-9 z) 32.0) - (set! (-> v1-9 w) 0.0) - (set! sv-88 v1-9) - ) - (set! sv-92 (new 'stack-no-clear 'vector)) - (set! sv-96 (new 'stack-no-clear 'vector)) - (vector-lerp! sv-96 sv-84 sv-88 (lerp-scale 0.0 1.0 (the float (-> this values 0 current)) 2.0 12.0)) - (set! (-> sv-96 w) (lerp 96.0 sv-80 (lerp-scale 0.0 1.0 (the float (-> this values 0 current)) 4.0 8.0))) - (vector-cvt.w.s! sv-92 sv-96) - (dotimes (v1-15 16) - (let ((a0-23 (-> this sprites (- 19 v1-15)))) - (set! (-> a0-23 scale-x) (if (< v1-15 (-> this values 0 current)) - 0.7 - 0.0 - ) + (let ((sv-84 v1-8) + (v1-9 (new 'stack-no-clear 'vector)) + ) + (set! (-> v1-9 x) 32.0) + (set! (-> v1-9 y) 230.0) + (set! (-> v1-9 z) 32.0) + (set! (-> v1-9 w) 0.0) + (let ((sv-88 v1-9) + (sv-92 (new 'stack-no-clear 'vector)) ) - (set! (-> a0-23 color quad) (-> sv-92 quad)) + (let ((sv-96 (new 'stack-no-clear 'vector))) + (vector-lerp! sv-96 sv-84 sv-88 (lerp-scale 0.0 1.0 (the float (-> this values 0 current)) 2.0 12.0)) + (set! (-> sv-96 w) (lerp 96.0 sv-80 (lerp-scale 0.0 1.0 (the float (-> this values 0 current)) 4.0 8.0))) + (vector-cvt.w.s! sv-92 sv-96) + ) + (dotimes (v1-15 16) + (let ((a0-23 (-> this sprites (- 19 v1-15)))) + (set! (-> a0-23 scale-x) (if (< v1-15 (-> this values 0 current)) + 0.7 + 0.0 + ) + ) + (set! (-> a0-23 color quad) (-> sv-92 quad)) + ) + ) + ) ) ) (set-as-offset-from! (-> this sprites 4) (-> this sprites 0 pos) 13 6) @@ -233,84 +217,77 @@ ) (let ((s3-2 (-> *minimap* engine alive-list))) (while s3-2 - (set! sv-100 (as-type (handle->process (-> s3-2 handle)) process-focusable)) - (when (and sv-100 - (logtest? (process-mask enemy) (-> sv-100 mask)) - (not (focus-test? sv-100 disable dead ignore inactive turret)) - (!= sv-100 *target*) - ) - (set! sv-128 (get-trans sv-100 3)) - (set! sv-132 (new 'stack-no-clear 'vector)) - (set! sv-136 (-> this aim-vector-source)) - (set! sv-140 (-> this aim-vector)) - (vector-line-distance-point! - sv-128 - sv-136 - (vector+float*! (new 'stack-no-clear 'vector) sv-136 sv-140 4096.0) - sv-132 - ) - (let* ((s2-3 (vector-! (new 'stack-no-clear 'vector) sv-128 sv-132)) - (a1-46 - (vector-flatten! - (new 'stack-no-clear 'vector) - s2-3 - (vector-normalize-copy! (new 'stack-no-clear 'vector) sv-140 1.0) + (let ((sv-100 (as-type (handle->process (-> s3-2 handle)) process-focusable))) + (when (and sv-100 + (logtest? (process-mask enemy) (-> sv-100 mask)) + (not (focus-test? sv-100 disable dead ignore inactive turret)) + (!= sv-100 *target*) ) - ) - (s2-4 (vector-rotate*! (new 'stack-no-clear 'vector) a1-46 (-> *math-camera* camera-rot))) - (f30-0 (vector-vector-angle-safe sv-140 (vector-! (new 'stack-no-clear 'vector) sv-128 sv-136))) - ) - (set! sv-240 (atan (-> s2-4 x) (-> s2-4 y))) - (if (logtest? (-> *game-info* secrets) (game-secrets hflip-screen)) - (set! sv-240 (* -1.0 sv-240)) - ) - (let ((v1-105 (new 'stack-no-clear 'vector))) - (set! (-> v1-105 x) 128.0) - (set! (-> v1-105 y) 128.0) - (set! (-> v1-105 z) 128.0) - (set! (-> v1-105 w) 0.0) - (set! sv-304 v1-105) - ) - (let ((v1-106 (new 'stack-no-clear 'vector))) - (set! (-> v1-106 x) 255.0) - (set! (-> v1-106 y) 24.0) - (set! (-> v1-106 z) 32.0) - (set! (-> v1-106 w) 0.0) - (set! sv-308 v1-106) - ) - (set! sv-312 (new 'stack-no-clear 'vector)) - (let ((s2-5 vector-lerp!) - (s1-1 sv-312) - (s0-1 sv-304) + (let ((sv-128 (get-trans sv-100 3)) + (sv-132 (new 'stack-no-clear 'vector)) + (sv-136 (-> this aim-vector-source)) + (sv-140 (-> this aim-vector)) ) - (set! sv-320 sv-308) - (set! sv-336 lerp-scale) - (set! sv-352 (the-as float 1.0)) - (set! sv-368 (the-as float 0.0)) - (let* ((a2-39 (vector-vector-distance sv-128 sv-136)) - (a3-33 20480.0) - (t0-3 122880.0) - (a3-34 (sv-336 sv-352 sv-368 a2-39 a3-33 t0-3)) + (vector-line-distance-point! + sv-128 + sv-136 + (vector+float*! (new 'stack-no-clear 'vector) sv-136 sv-140 4096.0) + sv-132 + ) + (let* ((s2-3 (vector-! (new 'stack-no-clear 'vector) sv-128 sv-132)) + (a1-46 + (vector-flatten! + (new 'stack-no-clear 'vector) + s2-3 + (vector-normalize-copy! (new 'stack-no-clear 'vector) sv-140 1.0) + ) + ) + (s2-4 (vector-rotate*! (new 'stack-no-clear 'vector) a1-46 (-> *math-camera* camera-rot))) + (f30-0 (vector-vector-angle-safe sv-140 (vector-! (new 'stack-no-clear 'vector) sv-128 sv-136))) + (sv-240 (atan (-> s2-4 x) (-> s2-4 y))) ) - (s2-5 s1-1 s0-1 sv-320 a3-34) - ) - ) - (vector-cvt.w.s! (the-as vector (-> this sprites 28 color-ptr)) sv-312) - (set! (-> this sprites 28 color w) - (the int (* (/ (-> this fade-interp) 128) (lerp-scale 0.0 128.0 f30-0 1820.4445 3640.889))) + (if (logtest? (-> *game-info* secrets) (game-secrets hflip-screen)) + (set! sv-240 (* -1.0 sv-240)) + ) + (let ((v1-105 (new 'stack-no-clear 'vector))) + (set! (-> v1-105 x) 128.0) + (set! (-> v1-105 y) 128.0) + (set! (-> v1-105 z) 128.0) + (set! (-> v1-105 w) 0.0) + (let ((sv-304 v1-105) + (v1-106 (new 'stack-no-clear 'vector)) + ) + (set! (-> v1-106 x) 255.0) + (set! (-> v1-106 y) 24.0) + (set! (-> v1-106 z) 32.0) + (set! (-> v1-106 w) 0.0) + (let ((sv-308 v1-106) + (sv-312 (new 'stack-no-clear 'vector)) + ) + (vector-lerp! + sv-312 + sv-304 + sv-308 + (lerp-scale (the-as float 1.0) (the-as float 0.0) (vector-vector-distance sv-128 sv-136) 20480.0 122880.0) + ) + (vector-cvt.w.s! (the-as vector (-> this sprites 28 color-ptr)) sv-312) + ) + ) ) - ) - (let ((s2-6 set-as-offset-from!) - (s1-2 (-> this sprites 28)) - (s0-2 (-> this sprites)) + (set! (-> this sprites 28 color w) + (the int (* (/ (-> this fade-interp) 128) (lerp-scale 0.0 128.0 f30-0 1820.4445 3640.889))) + ) + (set-as-offset-from! + (-> this sprites 28) + (-> this sprites 0 pos) + (the int (* -70.0 (sin sv-240))) + (+ (the int (* -70.0 (cos sv-240))) 44) + ) + (set! (-> this sprites 28 angle) (+ -8192.0 sv-240)) ) - (set! sv-384 (the int (* -70.0 (sin sv-240)))) - (let ((a3-36 (+ (the int (* -70.0 (cos sv-240))) 44))) - (s2-6 s1-2 (-> s0-2 0 pos) sv-384 a3-36) ) + (draw (-> this sprites 28) s4-2 (-> this level) #f) ) - (set! (-> this sprites 28 angle) (+ -8192.0 sv-240)) - (draw (-> this sprites 28) s4-2 (-> this level) #f) ) (set! s3-2 (-> s3-2 next)) ) @@ -1090,61 +1067,62 @@ ;; definition for method 57 of type for-turret ;; INFO: Used lq/sq (defmethod explode-turret ((this for-turret)) - (local-vars (sv-112 matrix) (sv-116 vector) (sv-120 vector)) (sound-play "cannon-explode") - (set! sv-112 (new 'stack-no-clear 'matrix)) - (set! sv-116 (vector-z-quaternion! (new 'stack-no-clear 'vector) (-> this root quat))) - (set! sv-120 (new 'stack-no-clear 'vector)) - (set! (-> sv-116 y) 0.0) - (vector-normalize! sv-116 1.0) - (let ((f30-0 0.0)) - (dotimes (s5-1 8) - (let ((s4-1 (vector-rotate-y! (new 'stack-no-clear 'vector) sv-116 f30-0))) - (+! f30-0 (* 182.04445 (rand-vu-float-range 40.0 50.0))) - (vector-normalize! s4-1 1.0) - (vector+float*! sv-120 (-> this root trans) s4-1 (* 4096.0 (rand-vu-float-range 1.5 2.5))) + (let ((sv-112 (new 'stack-no-clear 'matrix)) + (sv-116 (vector-z-quaternion! (new 'stack-no-clear 'vector) (-> this root quat))) + (sv-120 (new 'stack-no-clear 'vector)) ) - (let ((s4-2 (new 'stack-no-clear 'vector))) - (vector-copy! s4-2 *y-vector*) - (let ((s3-2 (new 'stack-no-clear 'collide-query))) - (vector-copy! (-> s3-2 start-pos) sv-120) - (+! (-> s3-2 start-pos y) 12288.0) - (set-vector! (-> s3-2 move-dist) 0.0 -12288.0 0.0 0.0) - (let ((v1-13 s3-2)) - (set! (-> v1-13 radius) 819.2) - (set! (-> v1-13 collide-with) (collide-spec backgnd)) - (set! (-> v1-13 ignore-process0) #f) - (set! (-> v1-13 ignore-process1) #f) - (set! (-> v1-13 ignore-pat) - (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) - ) - (set! (-> v1-13 action-mask) (collide-action solid)) - ) - (let ((f0-12 (fill-and-probe-using-line-sphere *collide-cache* s3-2))) - (when (>= f0-12 0.0) - (vector+float*! sv-120 (-> s3-2 start-pos) (-> s3-2 move-dist) f0-12) - (vector-! s4-2 sv-120 (-> s3-2 best-other-tri intersect)) - (vector-normalize! s4-2 1.0) - ) - ) + (set! (-> sv-116 y) 0.0) + (vector-normalize! sv-116 1.0) + (let ((f30-0 0.0)) + (dotimes (s5-1 8) + (let ((s4-1 (vector-rotate-y! (new 'stack-no-clear 'vector) sv-116 f30-0))) + (+! f30-0 (* 182.04445 (rand-vu-float-range 40.0 50.0))) + (vector-normalize! s4-1 1.0) + (vector+float*! sv-120 (-> this root trans) s4-1 (* 4096.0 (rand-vu-float-range 1.5 2.5))) ) - (matrix-u-f-compose sv-112 s4-2 sv-116) - ) - (+! (-> sv-120 y) 819.2) - (vector-copy! (-> sv-112 trans) sv-120) - (let ((v1-32 - (if (logtest? (-> group-for-turret-scorched-earth flags) (sp-group-flag sp13)) - (part-tracker-spawn - part-tracker-subsampler - :to *entity-pool* - :group group-for-turret-scorched-earth - :mat-joint sv-112 + (let ((s4-2 (new 'stack-no-clear 'vector))) + (vector-copy! s4-2 *y-vector*) + (let ((s3-2 (new 'stack-no-clear 'collide-query))) + (vector-copy! (-> s3-2 start-pos) sv-120) + (+! (-> s3-2 start-pos y) 12288.0) + (set-vector! (-> s3-2 move-dist) 0.0 -12288.0 0.0 0.0) + (let ((v1-13 s3-2)) + (set! (-> v1-13 radius) 819.2) + (set! (-> v1-13 collide-with) (collide-spec backgnd)) + (set! (-> v1-13 ignore-process0) #f) + (set! (-> v1-13 ignore-process1) #f) + (set! (-> v1-13 ignore-pat) + (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) ) - (part-tracker-spawn part-tracker :to *entity-pool* :group group-for-turret-scorched-earth :mat-joint sv-112) - ) + (set! (-> v1-13 action-mask) (collide-action solid)) + ) + (let ((f0-12 (fill-and-probe-using-line-sphere *collide-cache* s3-2))) + (when (>= f0-12 0.0) + (vector+float*! sv-120 (-> s3-2 start-pos) (-> s3-2 move-dist) f0-12) + (vector-! s4-2 sv-120 (-> s3-2 best-other-tri intersect)) + (vector-normalize! s4-2 1.0) + ) ) ) - (send-event (ppointer->process v1-32) 'clock this) + (matrix-u-f-compose sv-112 s4-2 sv-116) + ) + (+! (-> sv-120 y) 819.2) + (vector-copy! (-> sv-112 trans) sv-120) + (let ((v1-32 + (if (logtest? (-> group-for-turret-scorched-earth flags) (sp-group-flag sp13)) + (part-tracker-spawn + part-tracker-subsampler + :to *entity-pool* + :group group-for-turret-scorched-earth + :mat-joint sv-112 + ) + (part-tracker-spawn part-tracker :to *entity-pool* :group group-for-turret-scorched-earth :mat-joint sv-112) + ) + ) + ) + (send-event (ppointer->process v1-32) 'clock this) + ) ) ) ) @@ -1546,16 +1524,16 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defmethod init-fields! ((this for-turret)) - (local-vars (sv-16 res-tag)) (set! (-> this focus-handle) (the-as handle #f)) (set! (-> this current-barrel) 0) (set! (-> this barrel-recoil-offset 0) 0.0) (set! (-> this barrel-recoil-offset 1) 0.0) - (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 actor-group) :tag-ptr (& sv-16))) + ) (cond ((and v1-1 (nonzero? (-> sv-16 elt-count))) - (set! (-> this actor-group) (the-as (pointer actor-group) v1-1)) + (set! (-> this actor-group) v1-1) (set! (-> this actor-group-count) (the-as int (-> sv-16 elt-count))) ) (else @@ -1701,3 +1679,7 @@ 0 (none) ) + + + + diff --git a/test/decompiler/reference/jak3/levels/forest/forest-kill-plants_REF.gc b/test/decompiler/reference/jak3/levels/forest/forest-kill-plants_REF.gc index 4cea8a309f..e2b4d97695 100644 --- a/test/decompiler/reference/jak3/levels/forest/forest-kill-plants_REF.gc +++ b/test/decompiler/reference/jak3/levels/forest/forest-kill-plants_REF.gc @@ -596,12 +596,12 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defmethod init-actor-group! ((this task-manager-forest-plants)) - (local-vars (sv-16 res-tag)) (let ((a0-2 (entity-by-name "for-plant-manager-1"))) (when a0-2 (set! (-> this plant-manager-entity) a0-2) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-1 (res-lump-data a0-2 'actor-groups pointer :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-1 (res-lump-data a0-2 'actor-groups pointer :tag-ptr (& sv-16))) + ) (cond ((and v1-1 (>= (-> sv-16 elt-count) (the-as uint 2))) (set! (-> this actor-group-count) (the-as int (-> sv-16 elt-count))) diff --git a/test/decompiler/reference/jak3/levels/forest/forest-part_REF.gc b/test/decompiler/reference/jak3/levels/forest/forest-part_REF.gc index 9fca66b34a..adf70f7549 100644 --- a/test/decompiler/reference/jak3/levels/forest/forest-part_REF.gc +++ b/test/decompiler/reference/jak3/levels/forest/forest-part_REF.gc @@ -516,7 +516,7 @@ (set! (-> v1-9 x) f0-2) (set! (-> v1-9 y) f1-3) (set! (-> v1-9 z) f2-0) - (set! (-> v1-9 w) (sqrtf (- (- (- 1.0 (* f2-0 f2-0)) (* f1-3 f1-3)) (* f0-2 f0-2)))) + (set! (-> v1-9 w) (sqrtf (- (- (- 1.0 (square f2-0)) (square f1-3)) (square f0-2)))) ) (matrix-u-f-compose s3-0 *y-vector* (vector-z-quaternion! (new 'stack-no-clear 'vector) s4-0)) (matrix->quaternion s4-0 s3-0) @@ -557,7 +557,7 @@ (set! (-> v1-14 x) f0-8) (set! (-> v1-14 y) f1-7) (set! (-> v1-14 z) f2-3) - (set! (-> v1-14 w) (sqrtf (- (- (- 1.0 (* f2-3 f2-3)) (* f1-7 f1-7)) (* f0-8 f0-8)))) + (set! (-> v1-14 w) (sqrtf (- (- (- 1.0 (square f2-3)) (square f1-7)) (square f0-8)))) ) (matrix-u-f-compose s3-1 *y-vector* (vector-z-quaternion! (new 'stack-no-clear 'vector) s5-1)) (matrix->quaternion s4-1 s3-1) @@ -703,7 +703,7 @@ (set! (-> v1-9 x) f0-2) (set! (-> v1-9 y) f1-3) (set! (-> v1-9 z) f2-0) - (set! (-> v1-9 w) (sqrtf (- (- (- 1.0 (* f2-0 f2-0)) (* f1-3 f1-3)) (* f0-2 f0-2)))) + (set! (-> v1-9 w) (sqrtf (- (- (- 1.0 (square f2-0)) (square f1-3)) (square f0-2)))) ) (matrix-u-f-compose s3-0 *y-vector* (vector-z-quaternion! (new 'stack-no-clear 'vector) s4-0)) (matrix->quaternion s4-0 s3-0) @@ -770,7 +770,7 @@ (set! (-> v1-46 x) f0-17) (set! (-> v1-46 y) f1-7) (set! (-> v1-46 z) f2-3) - (set! (-> v1-46 w) (sqrtf (- (- (- 1.0 (* f2-3 f2-3)) (* f1-7 f1-7)) (* f0-17 f0-17)))) + (set! (-> v1-46 w) (sqrtf (- (- (- 1.0 (square f2-3)) (square f1-7)) (square f0-17)))) ) (matrix-u-f-compose s3-1 *y-vector* (vector-z-quaternion! (new 'stack-no-clear 'vector) s5-1)) (matrix->quaternion s4-3 s3-1) diff --git a/test/decompiler/reference/jak3/levels/forest/forest-ring-chase_REF.gc b/test/decompiler/reference/jak3/levels/forest/forest-ring-chase_REF.gc index 1210a41d6a..3faa03cf3c 100644 --- a/test/decompiler/reference/jak3/levels/forest/forest-ring-chase_REF.gc +++ b/test/decompiler/reference/jak3/levels/forest/forest-ring-chase_REF.gc @@ -433,10 +433,7 @@ (set! (-> this path-pos) (path-control-method-26 s5-0 (-> this path-pos) (* f30-1 (seconds-per-frame)))) (let ((s5-1 (get-point-at-percent-along-path! s5-0 (new 'stack-no-clear 'vector) (-> this path-pos) 'interp))) (let ((f0-11 (vector-vector-distance-squared s5-1 (-> this root trans)))) - (when (and (= (-> this path-pos) 1.0) (let ((f1-4 4096.0)) - (< f0-11 (* f1-4 f1-4)) - ) - ) + (when (and (= (-> this path-pos) 1.0) (< f0-11 (square 4096.0))) (send-event (ppointer->process (-> this parent)) 'found-ring) (let ((a1-5 (new 'stack-no-clear 'event-message-block))) (set! (-> a1-5 from) (process->ppointer pp)) @@ -2510,16 +2507,16 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defmethod init-actor-group! ((this task-manager-forest-ring-chase)) - (local-vars (sv-16 res-tag)) (let ((a0-2 (entity-by-name "for-ring-chase-manager-1"))) (when a0-2 (set! (-> this ring-manager-entity) a0-2) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-1 (res-lump-data a0-2 'actor-groups pointer :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-1 (res-lump-data a0-2 'actor-groups (pointer actor-group) :tag-ptr (& sv-16))) + ) (cond ((and v1-1 (>= (-> sv-16 elt-count) 0)) (set! (-> this actor-group-count) (the-as int (-> sv-16 elt-count))) - (set! (-> this actor-group) (the-as (pointer actor-group) v1-1)) + (set! (-> this actor-group) v1-1) ) (else (format 0 "ERROR: ~s: entity missing actor-group!~%" (game-task->string (-> this node-info task))) @@ -2668,3 +2665,7 @@ ) (none) ) + + + + diff --git a/test/decompiler/reference/jak3/levels/forest/forest-tasks_REF.gc b/test/decompiler/reference/jak3/levels/forest/forest-tasks_REF.gc index 4b1296dd4e..792c7fff43 100644 --- a/test/decompiler/reference/jak3/levels/forest/forest-tasks_REF.gc +++ b/test/decompiler/reference/jak3/levels/forest/forest-tasks_REF.gc @@ -190,16 +190,16 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch object vs none. (defmethod init-actor-group! ((this task-manager-forest-machine)) - (local-vars (sv-16 res-tag)) (let ((a0-2 (entity-by-name "neo-spawner-manager-1"))) (when a0-2 (set! (-> this manager-entity) a0-2) - (set! sv-16 (new 'static 'res-tag)) - (let ((v0-2 (res-lump-data a0-2 'actor-groups pointer :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v0-2 (res-lump-data a0-2 'actor-groups (pointer actor-group) :tag-ptr (& sv-16))) + ) (cond ((and v0-2 (nonzero? (-> sv-16 elt-count))) (set! (-> this actor-group-count) (the-as int (-> sv-16 elt-count))) - (set! (-> this actor-group) (the-as (pointer actor-group) v0-2)) + (set! (-> this actor-group) v0-2) ) (else (format 0 "ERROR: ~s: entity missing actor-group!~%" (game-task->string (-> this node-info task))) @@ -309,7 +309,6 @@ (defstate active (task-manager-forest-machine-resolution) :virtual #t :code (behavior () - (local-vars (sv-16 res-tag)) (set-setting! 'pilot #f 0.0 0) (while *scene-player* (suspend) @@ -339,11 +338,12 @@ ) (suspend-for (seconds 1) ) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-33 (res-lump-data (-> self manager-entity) 'actor-groups pointer :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-33 (res-lump-data (-> self manager-entity) 'actor-groups (pointer actor-group) :tag-ptr (& sv-16))) + ) (cond ((and v1-33 (nonzero? (-> sv-16 elt-count))) - (set! (-> self actor-group) (the-as (pointer actor-group) v1-33)) + (set! (-> self actor-group) v1-33) (set! (-> self actor-group-count) (the-as int (-> sv-16 elt-count))) ) (else @@ -1555,3 +1555,7 @@ (defpart 2309 :init-specs ((:fade-a -2.56)) ) + + + + diff --git a/test/decompiler/reference/jak3/levels/forest/neo-spawner_REF.gc b/test/decompiler/reference/jak3/levels/forest/neo-spawner_REF.gc index 3b997fa5e1..8f09ef8b0b 100644 --- a/test/decompiler/reference/jak3/levels/forest/neo-spawner_REF.gc +++ b/test/decompiler/reference/jak3/levels/forest/neo-spawner_REF.gc @@ -208,15 +208,15 @@ ;; INFO: Used lq/sq (defmethod init-from-entity! ((this neo-spawner-manager) (arg0 entity-actor)) "Set up a newly created process from the entity that created it." - (local-vars (sv-16 res-tag)) (set! (-> this total-spawned) 0) (set! (-> this max-spawned) 0) (set! (-> this suppress-spawn) #f) - (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 actor-group) :tag-ptr (& sv-16))) + ) (cond ((and v1-1 (nonzero? (-> sv-16 elt-count))) - (set! (-> this actor-group) (the-as (pointer actor-group) v1-1)) + (set! (-> this actor-group) v1-1) (set! (-> this actor-group-count) (the-as int (-> sv-16 elt-count))) ) (else @@ -864,7 +864,6 @@ ;; INFO: Used lq/sq (defmethod init-from-entity! ((this neo-spawner) (arg0 entity-actor)) "Set up a newly created process from the entity that created it." - (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) @@ -902,11 +901,12 @@ (the-as skeleton-group (art-group-get-by-name *level* "skel-neo-spawner" (the-as (pointer level) #f))) (the-as pair 0) ) - (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 actor-group) :tag-ptr (& sv-16))) + ) (cond ((and v1-22 (nonzero? (-> sv-16 elt-count))) - (set! (-> this actor-group) (the-as (pointer actor-group) v1-22)) + (set! (-> this actor-group) v1-22) (set! (-> this actor-group-count) (the-as int (-> sv-16 elt-count))) ) (else @@ -941,3 +941,7 @@ ) ) ) + + + + diff --git a/test/decompiler/reference/jak3/levels/glider/glider-manager_REF.gc b/test/decompiler/reference/jak3/levels/glider/glider-manager_REF.gc index 6c18bd868e..505ea80b00 100644 --- a/test/decompiler/reference/jak3/levels/glider/glider-manager_REF.gc +++ b/test/decompiler/reference/jak3/levels/glider/glider-manager_REF.gc @@ -968,9 +968,7 @@ (vector-copy! s5-0 (target-pos 0)) (while (< (-> this count) (-> this max-count)) (let ((s3-1 (-> s4-0 (-> this count)))) - (let ((f0-0 8192000.0)) - (b! (< (* f0-0 f0-0) (vector-vector-distance-squared s5-0 (-> s3-1 pos))) cfg-8) - ) + (b! (< (square 8192000.0) (vector-vector-distance-squared s5-0 (-> s3-1 pos))) cfg-8) (if (glider-ring-spawn this s3-1 (-> this count) #f) (+! (-> this count) 1) ) @@ -1213,9 +1211,7 @@ (when (and *target* (focus-test? *target* pilot)) (let ((v1-8 (as-type (handle->process (-> *target* pilot vehicle)) hvehicle))) 0.0 - (let* ((f0-1 81920000.0) - (f30-0 (* f0-1 f0-1)) - ) + (let ((f30-0 (square 81920000.0))) (let ((s4-1 (-> arg0 root trans))) (b! (not v1-8) cfg-46 :delay (nop!)) (let ((s2-0 0)) @@ -1384,13 +1380,9 @@ (when (and *target* (focus-test? *target* pilot)) (let ((s5-1 (as-type (handle->process (-> *target* pilot vehicle)) hvehicle))) (when (and s5-1 - (let ((f0-0 - (vector-vector-distance-squared (-> (the-as hvehicle s5-1) rbody matrix trans) *desert-glide-finish-sphere*) - ) - (f1-0 (-> *desert-glide-finish-sphere* r)) - ) - (< f0-0 (* f1-0 f1-0)) - ) + (< (vector-vector-distance-squared (-> (the-as hvehicle s5-1) rbody matrix trans) *desert-glide-finish-sphere*) + (square (-> *desert-glide-finish-sphere* r)) + ) ) (if (not (-> this editing?)) (send-event this 'complete) @@ -1410,13 +1402,9 @@ ) (when (and s5-1 (not (-> this did-want-load?)) - (let ((f0-1 - (vector-vector-distance-squared (-> (the-as hvehicle s5-1) rbody matrix trans) *desert-glide-finish-sphere*) - ) - (f1-4 (+ 1228800.0 (-> *desert-glide-finish-sphere* r))) - ) - (< f0-1 (* f1-4 f1-4)) - ) + (< (vector-vector-distance-squared (-> (the-as hvehicle s5-1) rbody matrix trans) *desert-glide-finish-sphere*) + (square (+ 1228800.0 (-> *desert-glide-finish-sphere* r))) + ) ) (let ((a1-13 (new 'stack-no-clear 'array 'symbol 10))) (set! (-> a1-13 9) #f) @@ -1488,16 +1476,16 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defmethod task-manager-desert-glide-method-33 ((this task-manager-desert-glide)) - (local-vars (sv-16 res-tag)) (let ((a0-2 (entity-by-name "desert-glide-manager-1"))) (when a0-2 (set! (-> this desert-glide-entity) a0-2) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-2 (res-lump-data a0-2 'actor-groups pointer :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-2 (res-lump-data a0-2 'actor-groups (pointer actor-group) :tag-ptr (& sv-16))) + ) (cond ((and v1-2 (nonzero? (-> sv-16 elt-count))) (set! (-> this actor-group-count) (the-as int (-> sv-16 elt-count))) - (set! (-> this actor-group) (the-as (pointer actor-group) v1-2)) + (set! (-> this actor-group) v1-2) ) (else ) @@ -1647,3 +1635,7 @@ (go (method-of-object this idle)) ) ) + + + + diff --git a/test/decompiler/reference/jak3/levels/glider/glider-ring_REF.gc b/test/decompiler/reference/jak3/levels/glider/glider-ring_REF.gc index dc39063686..af468d4117 100644 --- a/test/decompiler/reference/jak3/levels/glider/glider-ring_REF.gc +++ b/test/decompiler/reference/jak3/levels/glider/glider-ring_REF.gc @@ -392,14 +392,15 @@ (set! (-> s4-1 1 w) 1.0) (let ((f30-0 (vector4-dot (-> self plane) (-> s4-1 0))) (f28-0 (vector4-dot (-> self plane) (-> s4-1 1))) - (f0-6 (fmax - (vector-vector-distance-squared (-> self root trans) (-> s4-1 0)) - (vector-vector-distance-squared (-> self root trans) (-> s4-1 1)) - ) - ) - (f1-0 61440.0) ) - (when (and (< f0-6 (* f1-0 f1-0)) (or (not (-> self shootable)) (-> self shot))) + (when (and (< (fmax + (vector-vector-distance-squared (-> self root trans) (-> s4-1 0)) + (vector-vector-distance-squared (-> self root trans) (-> s4-1 1)) + ) + (square 61440.0) + ) + (or (not (-> self shootable)) (-> self shot)) + ) (when (or (and (< f30-0 0.0) (>= f28-0 0.0)) (and (< f28-0 0.0) (>= f30-0 0.0))) (if (-> self lastring) (sound-play "ring-final") @@ -791,16 +792,14 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch process vs glider-ring. (defun glider-ring-spawn ((arg0 process) (arg1 glider-ring-info) (arg2 int) (arg3 symbol)) - (local-vars (sv-16 type) (sv-32 int)) (let ((gp-0 (the-as process #f))) (let* ((s1-0 *default-dead-pool*) (s0-0 (method-of-object s1-0 get-process)) + (sv-16 glider-ring) ) - (set! sv-16 glider-ring) - (set! sv-32 5) - (let* ((a2-1 (+ (* 0 (estimate-light-trail-mem-usage (the-as uint 12) (the-as uint #f))) #x4000)) - (a3-1 1) - (s1-1 (s0-0 s1-0 sv-16 a2-1 a3-1)) + (let ((sv-32 5)) + ) + (let* ((s1-1 (s0-0 s1-0 sv-16 (+ (* 0 (estimate-light-trail-mem-usage (the-as uint 12) (the-as uint #f))) #x4000) 1)) (v1-4 (when s1-1 (let ((t9-2 (method-of-type glider-ring activate))) (t9-2 (the-as glider-ring s1-1) arg0 "glider-ring" (the-as pointer #x70004000)) diff --git a/test/decompiler/reference/jak3/levels/glider/h-glider_REF.gc b/test/decompiler/reference/jak3/levels/glider/h-glider_REF.gc index bb7d44f1a0..f3a05f257a 100644 --- a/test/decompiler/reference/jak3/levels/glider/h-glider_REF.gc +++ b/test/decompiler/reference/jak3/levels/glider/h-glider_REF.gc @@ -662,14 +662,7 @@ ) (when (logtest? (-> this info flags) 1) (vector-float*! (-> arg1 tmp) (-> arg1 mat uvec) -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)) @@ -1283,20 +1276,14 @@ (defmethod vehicle-method-94 ((this h-glider)) (cond (#f - (let ((f0-0 (vector-length-squared (-> this root transv))) - (f1-0 122880.0) - ) - (if (< f0-0 (* f1-0 f1-0)) - (vehicle-method-87 this) - ) - ) + (if (< (vector-length-squared (-> this root transv)) (square 122880.0)) + (vehicle-method-87 this) + ) ) (else - (let ((f0-1 143360.0)) - (if (< (* f0-1 f0-1) (vector-length-squared (-> this root transv))) - (vehicle-method-86 this) - ) - ) + (if (< (square 143360.0) (vector-length-squared (-> this root transv))) + (vehicle-method-86 this) + ) ) ) ((method-of-type vehicle vehicle-method-94) this) diff --git a/test/decompiler/reference/jak3/levels/gungame/gun-dummy_REF.gc b/test/decompiler/reference/jak3/levels/gungame/gun-dummy_REF.gc index e2a4af2d1b..86b78921bf 100644 --- a/test/decompiler/reference/jak3/levels/gungame/gun-dummy_REF.gc +++ b/test/decompiler/reference/jak3/levels/gungame/gun-dummy_REF.gc @@ -433,7 +433,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/jak3/levels/gungame/gungame-manager_REF.gc b/test/decompiler/reference/jak3/levels/gungame/gungame-manager_REF.gc index cbd237f6c6..0a8b1718bf 100644 --- a/test/decompiler/reference/jak3/levels/gungame/gungame-manager_REF.gc +++ b/test/decompiler/reference/jak3/levels/gungame/gungame-manager_REF.gc @@ -304,12 +304,12 @@ ;; definition for method 21 of type gungame-manager ;; INFO: Used lq/sq (defmethod init-actor-group ((this gungame-manager) (arg0 entity)) - (local-vars (sv-16 res-tag)) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-1 (res-lump-data arg0 'actor-groups pointer :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-1 (res-lump-data arg0 'actor-groups (pointer actor-group) :tag-ptr (& sv-16))) + ) (cond ((and v1-1 (nonzero? (-> sv-16 elt-count))) - (set! (-> this actor-group) (the-as (pointer actor-group) v1-1)) + (set! (-> this actor-group) v1-1) (let ((v0-1 (the-as object (-> sv-16 elt-count)))) (set! (-> this actor-group-count) (the-as int v0-1)) v0-1 @@ -327,12 +327,12 @@ ;; definition for method 35 of type gungame-task-manager ;; INFO: Used lq/sq (defmethod init-actor-group ((this gungame-task-manager) (arg0 entity)) - (local-vars (sv-16 res-tag)) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-1 (res-lump-data arg0 'actor-groups pointer :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-1 (res-lump-data arg0 'actor-groups (pointer actor-group) :tag-ptr (& sv-16))) + ) (cond ((and v1-1 (nonzero? (-> sv-16 elt-count))) - (set! (-> this actor-group) (the-as (pointer actor-group) v1-1)) + (set! (-> this actor-group) v1-1) (let ((v0-1 (the-as object (-> sv-16 elt-count)))) (set! (-> this actor-group-count) (the-as int v0-1)) v0-1 @@ -1978,3 +1978,7 @@ (call-parent-method this) (none) ) + + + + diff --git a/test/decompiler/reference/jak3/levels/hiphog/hiphog-part_REF.gc b/test/decompiler/reference/jak3/levels/hiphog/hiphog-part_REF.gc index b1dfaeea94..1de3ff38fb 100644 --- a/test/decompiler/reference/jak3/levels/hiphog/hiphog-part_REF.gc +++ b/test/decompiler/reference/jak3/levels/hiphog/hiphog-part_REF.gc @@ -667,7 +667,7 @@ (let ((v1-1 (-> arg4 sprite key))) (when (nonzero? v1-1) (let ((f0-2 (+ (- 5120.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/jak3/levels/mhcity/destroy-dark-eco_REF.gc b/test/decompiler/reference/jak3/levels/mhcity/destroy-dark-eco_REF.gc index abc747a2d1..c420c5b96c 100644 --- a/test/decompiler/reference/jak3/levels/mhcity/destroy-dark-eco_REF.gc +++ b/test/decompiler/reference/jak3/levels/mhcity/destroy-dark-eco_REF.gc @@ -390,83 +390,79 @@ (arg5 time-frame) (arg6 float) ) - (local-vars - (sv-640 (pointer lightning-tracker)) - (sv-656 float) - (sv-672 matrix) - (sv-688 collide-query) - (sv-704 symbol) - (sv-720 vector) - (sv-736 int) - (sv-752 process) - (sv-768 vector) - ) - (set! sv-656 arg6) - (let ((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)) - (set! sv-768 (new 'stack-no-clear 'vector)) - (vector-copy! (-> sv-688 start-pos) arg1) - (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-656) - (let ((v1-19 sv-688)) - (set! (-> v1-19 radius) 409.6) - (set! (-> v1-19 collide-with) (collide-spec backgnd crate obstacle hit-by-others-list pusher)) - (set! (-> v1-19 ignore-process0) arg0) - (set! (-> v1-19 ignore-process1) #f) - (set! (-> v1-19 ignore-pat) - (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) - ) - (set! (-> v1-19 action-mask) (collide-action solid)) + (let ((sv-656 arg6) + (s5-0 *lightning-probe-vars*) + (sv-672 (new 'stack-no-clear 'matrix)) + (sv-688 (new 'stack-no-clear 'collide-query)) + (sv-704 (the-as symbol #f)) + (sv-768 (new 'stack-no-clear 'vector)) ) - (when (>= (fill-and-probe-using-line-sphere *collide-cache* sv-688) 0.0) - (set-time! (-> s5-0 last-valid-time)) - (vector-copy! sv-768 (-> sv-688 best-other-tri intersect)) - (when (< 16384.0 (vector-vector-distance sv-768 (-> sv-688 start-pos))) - (set! sv-704 #t) - (goto cfg-7) + (vector-copy! (-> sv-688 start-pos) arg1) + (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-656) + (let ((v1-19 sv-688)) + (set! (-> v1-19 radius) 409.6) + (set! (-> v1-19 collide-with) (collide-spec backgnd crate obstacle hit-by-others-list pusher)) + (set! (-> v1-19 ignore-process0) arg0) + (set! (-> v1-19 ignore-process1) #f) + (set! (-> v1-19 ignore-pat) + (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) + ) + (set! (-> v1-19 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)) + (vector-copy! sv-768 (-> sv-688 best-other-tri intersect)) + (when (< 16384.0 (vector-vector-distance sv-768 (-> sv-688 start-pos))) + (set! sv-704 #t) + (goto cfg-7) + ) ) ) ) (label cfg-7) (when sv-704 - (set! sv-752 (get-process *default-dead-pool* lightning-tracker #x4000 0)) - (set! sv-640 - (the-as - (pointer lightning-tracker) - (when sv-752 - (let ((t9-9 (method-of-type lightning-tracker activate))) - (t9-9 (the-as lightning-tracker sv-752) arg0 "lightning-tracker" (the-as pointer #x70004000)) + (let* ((sv-752 (get-process *default-dead-pool* lightning-tracker #x4000 0)) + (sv-640 (the-as + (pointer lightning-tracker) + (when sv-752 + ((method-of-type lightning-tracker activate) + (the-as lightning-tracker sv-752) + arg0 + "lightning-tracker" + (the-as pointer #x70004000) + ) + (run-now-in-process sv-752 lightning-tracker-init arg2 arg5 arg3 arg0 arg1 sv-768) + (-> sv-752 ppointer) + ) + ) + ) + ) + (when sv-640 + (set! (-> sv-640 0 user-time 0) 0) + (when arg4 + (let ((v1-47 (get-field-spec-by-id arg4 (sp-field-id spt-timer)))) + (if v1-47 + (set! (-> v1-47 initial-valuef) (the-as float (-> sv-640 0 duration))) ) - (run-now-in-process sv-752 lightning-tracker-init arg2 arg5 arg3 arg0 arg1 sv-768) - (-> sv-752 ppointer) - ) ) - ) - (when sv-640 - (set! (-> sv-640 0 user-time 0) 0) - (when arg4 - (let ((v1-47 (get-field-spec-by-id arg4 (sp-field-id spt-timer)))) - (if v1-47 - (set! (-> v1-47 initial-valuef) (the-as float (-> sv-640 0 duration))) - ) - ) - (let ((t9-12 sp-launch-particles-var) - (a0-26 *sp-particle-system-2d*) - (a2-5 *launch-matrix*) - ) - (vector-copy! (-> a2-5 trans) (-> s5-0 end-pos)) - (t9-12 a0-26 arg4 a2-5 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0) + (let ((t9-12 sp-launch-particles-var) + (a0-26 *sp-particle-system-2d*) + (a2-5 *launch-matrix*) + ) + (vector-copy! (-> a2-5 trans) (-> s5-0 end-pos)) + (t9-12 a0-26 arg4 a2-5 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0) + ) ) ) ) @@ -1182,12 +1178,12 @@ ;; definition for method 21 of type task-manager-destroy-darkeco ;; INFO: Used lq/sq (defmethod set-time-limit ((this task-manager-destroy-darkeco)) - (local-vars (sv-16 res-tag)) (let ((a0-2 (entity-by-name "tmanager-7"))) (when a0-2 (set! (-> this entity) (the-as entity-actor a0-2)) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-2 (res-lump-data a0-2 'actor-groups pointer :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-2 (res-lump-data a0-2 'actor-groups pointer :tag-ptr (& sv-16))) + ) (cond ((and v1-2 (nonzero? (-> sv-16 elt-count))) (set! (-> this actor-group-count) (the-as int (-> sv-16 elt-count))) @@ -1462,7 +1458,6 @@ (defstate idle (grind-electricity) :virtual #t :trans (behavior () - (local-vars (sv-48 (pointer lightning-tracker)) (sv-52 sparticle-launcher)) (let ((s5-0 (new 'stack-no-clear 'vector)) (gp-0 (new 'stack-no-clear 'vector)) ) @@ -1474,44 +1469,53 @@ (vector+*! gp-0 gp-0 *x-vector* (rand-vu-float-range -4096.0 4096.0)) (vector+*! gp-0 gp-0 *y-vector* (rand-vu-float-range -4096.0 4096.0)) (vector+*! gp-0 gp-0 *z-vector* (rand-vu-float-range -4096.0 4096.0)) - (set! sv-48 (process-spawn - lightning-tracker - :init lightning-tracker-init - (-> *lightning-spec-id-table* 48) - 0 - lightning-probe-callback - self - s5-0 - gp-0 - :name "lightning-tracker" - :to self - :unk 0 + (let* ((s4-6 (get-process *default-dead-pool* lightning-tracker #x4000 0)) + (sv-48 (the-as + (pointer lightning-tracker) + (when s4-6 + (let ((t9-7 (method-of-type lightning-tracker activate))) + (t9-7 (the-as lightning-tracker s4-6) self "lightning-tracker" (the-as pointer #x70004000)) + ) + (run-now-in-process + s4-6 + lightning-tracker-init + (-> *lightning-spec-id-table* 48) + 0 + lightning-probe-callback + self + s5-0 + gp-0 + ) + (-> s4-6 ppointer) + ) + ) ) - ) - (set! sv-52 (-> *part-id-table* 160)) - (when sv-48 - (set! (-> sv-48 0 user-time 0) 0) - (when sv-52 - (let ((v1-13 (get-field-spec-by-id sv-52 (sp-field-id spt-timer)))) - (if v1-13 - (set! (-> v1-13 initial-valuef) (the-as float (-> sv-48 0 duration))) - ) - ) - (let ((t9-10 sp-launch-particles-var) - (a0-20 *sp-particle-system-2d*) - (a1-10 sv-52) - (a2-3 *launch-matrix*) - ) - (vector-copy! (-> a2-3 trans) s5-0) - (t9-10 a0-20 a1-10 a2-3 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0) - ) - (let ((t9-11 sp-launch-particles-var) - (a0-21 *sp-particle-system-2d*) - (a1-11 sv-52) - (a2-4 *launch-matrix*) - ) - (vector-copy! (-> a2-4 trans) gp-0) - (t9-11 a0-21 a1-11 a2-4 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0) + (sv-52 (-> *part-id-table* 160)) + ) + (when sv-48 + (set! (-> sv-48 0 user-time 0) 0) + (when sv-52 + (let ((v1-13 (get-field-spec-by-id sv-52 (sp-field-id spt-timer)))) + (if v1-13 + (set! (-> v1-13 initial-valuef) (the-as float (-> sv-48 0 duration))) + ) + ) + (let ((t9-10 sp-launch-particles-var) + (a0-20 *sp-particle-system-2d*) + (a1-10 sv-52) + (a2-3 *launch-matrix*) + ) + (vector-copy! (-> a2-3 trans) s5-0) + (t9-10 a0-20 a1-10 a2-3 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0) + ) + (let ((t9-11 sp-launch-particles-var) + (a0-21 *sp-particle-system-2d*) + (a1-11 sv-52) + (a2-4 *launch-matrix*) + ) + (vector-copy! (-> a2-4 trans) gp-0) + (t9-11 a0-21 a1-11 a2-4 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0) + ) ) ) ) @@ -1527,3 +1531,7 @@ (process-drawable-from-entity! this arg0) (go (method-of-object this idle)) ) + + + + diff --git a/test/decompiler/reference/jak3/levels/mhcity/mhcity-obs2_REF.gc b/test/decompiler/reference/jak3/levels/mhcity/mhcity-obs2_REF.gc index dff3dd3e54..59be8fcf47 100644 --- a/test/decompiler/reference/jak3/levels/mhcity/mhcity-obs2_REF.gc +++ b/test/decompiler/reference/jak3/levels/mhcity/mhcity-obs2_REF.gc @@ -219,11 +219,9 @@ 0.0 0.0 (let ((f0-7 (vector-dot s5-2 v1-19))) - (when (and (< f0-7 32768.0) (>= f0-7 0.0)) - (let ((f1-4 (vector-length s5-2))) - (< (sqrtf (- (* f1-4 f1-4) (* f0-7 f0-7))) 8192.0) + (if (and (< f0-7 32768.0) (>= f0-7 0.0)) + (< (sqrtf (- (square (vector-length s5-2)) (square f0-7))) 8192.0) ) - ) ) ) ) diff --git a/test/decompiler/reference/jak3/levels/mine/gekko_REF.gc b/test/decompiler/reference/jak3/levels/mine/gekko_REF.gc index 0801b4e9ea..9201666228 100644 --- a/test/decompiler/reference/jak3/levels/mine/gekko_REF.gc +++ b/test/decompiler/reference/jak3/levels/mine/gekko_REF.gc @@ -1372,12 +1372,8 @@ (until (or (>= gp-0 3) (and (logtest? (-> s4-0 status) (collide-status on-ground)) (>= 16384.0 (-> s4-0 transv y))) (and (>= s5-0 3) - (let ((f0-7 40.96)) - (>= (* f0-7 f0-7) (vector-vector-distance-squared (-> s4-0 trans-old) (-> s4-0 trans-old-old))) - ) - (let ((f0-10 40.96)) - (>= (* f0-10 f0-10) (vector-vector-distance-squared (-> s4-0 trans-old-old) (-> s4-0 trans-old-old-old))) - ) + (>= (square 40.96) (vector-vector-distance-squared (-> s4-0 trans-old) (-> s4-0 trans-old-old))) + (>= (square 40.96) (vector-vector-distance-squared (-> s4-0 trans-old-old) (-> s4-0 trans-old-old-old))) ) ) (if (time-elapsed? (-> self state-time) (seconds 2)) @@ -2085,24 +2081,6 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defun gekko-postbind ((arg0 draw-control) (arg1 cspace-array)) - (local-vars - (sv-560 float) - (sv-640 vector) - (sv-688 float) - (sv-692 vector) - (sv-696 vector) - (sv-976 cspace) - (sv-980 gekko-foot-info) - (sv-984 vector) - (sv-988 vector) - (sv-992 (function vector vector vector vector float)) - (sv-1008 vector) - (sv-1024 vector) - (sv-1040 vector) - (sv-1056 joint-mod-ik) - (sv-1072 vector) - (sv-1088 vector) - ) (rlet ((acc :class vf) (vf0 :class vf) (vf1 :class vf) @@ -2117,8 +2095,8 @@ (let ((s3-0 (-> gp-0 root))) (let ((s2-0 (new 'stack-no-clear 'collide-query)) (f30-0 (-> gp-0 probe-len)) + (sv-560 (the-as float 2048.0)) ) - (set! sv-560 (the-as float 2048.0)) (quaternion->matrix (-> gp-0 rot-matrix) (-> gp-0 root quat)) (let ((v1-2 1) (a0-2 (new 'stack-no-clear 'inline-array 'vector 1)) @@ -2140,106 +2118,107 @@ ) (fill-using-spheres *collide-cache* s2-0) (dotimes (s1-0 4) - (let ((s0-0 (-> gp-0 foot s1-0))) - (set! sv-1056 (-> s0-0 leg-ik)) - (set! sv-1008 - (vector<-cspace! (new 'stack-no-clear 'vector) (-> arg1 data (-> *gekko-ik-setup* s1-0 hand-index))) - ) - (let ((v0-3 - (vector<-cspace! (new 'stack-no-clear 'vector) (-> arg1 data (-> *gekko-ik-setup* s1-0 effector-index))) - ) - ) - (set! sv-640 (vector-! (new 'stack-no-clear 'vector) v0-3 sv-1008)) - ) - (let ((v1-28 (if (logtest? (-> gp-0 flags) (gekko-flag on-wall?)) - (-> gp-0 rot-matrix uvec) - *y-vector* - ) - ) - ) - (vector+float*! (-> s2-0 start-pos) sv-1008 v1-28 (/ f30-0 2)) - (vector-float*! (-> s2-0 move-dist) v1-28 (- f30-0)) - ) - (let ((v1-29 s2-0)) - (set! (-> v1-29 radius) sv-560) - (set! (-> v1-29 collide-with) (collide-spec backgnd)) - (set! (-> v1-29 ignore-process0) #f) - (set! (-> v1-29 ignore-process1) #f) - (set! (-> v1-29 ignore-pat) (-> gp-0 root pat-ignore-mask)) - (set! (-> v1-29 action-mask) (collide-action solid)) - ) - (set! sv-688 (probe-using-line-sphere *collide-cache* s2-0)) - (set! sv-692 (new 'stack-no-clear 'vector)) - (set! sv-696 (new 'stack-no-clear 'vector)) - (cond - ((>= sv-688 0.0) - (let ((v0-5 (vector-normalize-copy! (new 'stack-no-clear 'vector) (-> s2-0 move-dist) 1.0))) - (vector+float*! sv-692 (-> s2-0 start-pos) (-> s2-0 move-dist) sv-688) - (vector-! sv-696 sv-692 (-> s2-0 best-other-tri intersect)) - (vector+float*! sv-692 sv-692 v0-5 (-> s2-0 radius)) + (let* ((s0-0 (-> gp-0 foot s1-0)) + (sv-1056 (-> s0-0 leg-ik)) ) - (vector-normalize! sv-696 1.0) - ) - (else - (vector-copy! sv-692 sv-1008) - (set! (-> sv-692 y) (-> gp-0 root gspot-pos y)) - (vector-copy! sv-696 (-> gp-0 rot-matrix uvec)) - ) - ) - (if (logtest? (-> gp-0 flags) (gekko-flag on-wall?)) - (vector-copy! (-> s0-0 ground-normal) sv-696) - (vector-copy! (-> s0-0 ground-normal) *y-vector*) - ) - (when (logtest? (-> gp-0 flags) (gekko-flag update-foot-position?)) - (set! sv-992 intersect-ray-plane) - (let* ((a1-22 (vector-negate! (new 'stack-no-clear 'vector) (-> gp-0 rot-matrix uvec))) - (a2-4 (-> gp-0 root trans)) - (a3-1 (-> gp-0 rot-matrix uvec)) - (f0-13 (sv-992 sv-1008 a1-22 a2-4 a3-1)) + (let* ((sv-1008 (vector<-cspace! (new 'stack-no-clear 'vector) (-> arg1 data (-> *gekko-ik-setup* s1-0 hand-index)))) + (v0-3 + (vector<-cspace! (new 'stack-no-clear 'vector) (-> arg1 data (-> *gekko-ik-setup* s1-0 effector-index))) ) - (vector+float*! sv-692 sv-692 (-> s0-0 ground-normal) f0-13) - ) - (vector+! sv-692 sv-692 sv-640) - ) - 0.0 - (let ((f28-0 (* 2457.6 (-> gp-0 scale))) - (v0-9 (vector<-cspace! (new 'stack-no-clear 'vector) (-> gp-0 node-list data 3))) - ) - (set! sv-1024 (new 'stack-no-clear 'vector)) - (set! sv-1040 (new 'stack-no-clear 'vector)) - (vector+float*! v0-9 v0-9 (-> gp-0 rot-matrix uvec) 3072.0) - (let ((f28-1 (+ 3072.0 f28-0))) - (when (< (vector-line-distance-point! - sv-692 - v0-9 - (vector+! (new 'stack-no-clear 'vector) v0-9 (-> gp-0 rot-matrix fvec)) - sv-1024 + (sv-640 (vector-! (new 'stack-no-clear 'vector) v0-3 sv-1008)) + ) + (let ((v1-28 (if (logtest? (-> gp-0 flags) (gekko-flag on-wall?)) + (-> gp-0 rot-matrix uvec) + *y-vector* + ) ) - f28-1 - ) - (vector-! sv-1040 sv-692 sv-1024) - (vector-normalize! sv-1040 f28-1) - (let ((v1-64 sv-692)) - (.mov.vf.w vf6 vf0) - (.lvf vf4 (&-> sv-1024 quad)) - (.lvf vf5 (&-> sv-1040 quad)) - (.add.vf.xyz vf6 vf4 vf5) - (.svf (&-> v1-64 quad) vf6) ) - 0 + (vector+float*! (-> s2-0 start-pos) sv-1008 v1-28 (/ f30-0 2)) + (vector-float*! (-> s2-0 move-dist) v1-28 (- f30-0)) + ) + (let ((v1-29 s2-0)) + (set! (-> v1-29 radius) sv-560) + (set! (-> v1-29 collide-with) (collide-spec backgnd)) + (set! (-> v1-29 ignore-process0) #f) + (set! (-> v1-29 ignore-process1) #f) + (set! (-> v1-29 ignore-pat) (-> gp-0 root pat-ignore-mask)) + (set! (-> v1-29 action-mask) (collide-action solid)) + ) + (let ((sv-688 (probe-using-line-sphere *collide-cache* s2-0)) + (sv-692 (new 'stack-no-clear 'vector)) + ) + (let ((sv-696 (new 'stack-no-clear 'vector))) + (cond + ((>= sv-688 0.0) + (let ((v0-5 (vector-normalize-copy! (new 'stack-no-clear 'vector) (-> s2-0 move-dist) 1.0))) + (vector+float*! sv-692 (-> s2-0 start-pos) (-> s2-0 move-dist) sv-688) + (vector-! sv-696 sv-692 (-> s2-0 best-other-tri intersect)) + (vector+float*! sv-692 sv-692 v0-5 (-> s2-0 radius)) + ) + (vector-normalize! sv-696 1.0) + ) + (else + (vector-copy! sv-692 sv-1008) + (set! (-> sv-692 y) (-> gp-0 root gspot-pos y)) + (vector-copy! sv-696 (-> gp-0 rot-matrix uvec)) + ) + ) + (if (logtest? (-> gp-0 flags) (gekko-flag on-wall?)) + (vector-copy! (-> s0-0 ground-normal) sv-696) + (vector-copy! (-> s0-0 ground-normal) *y-vector*) + ) + ) + (when (logtest? (-> gp-0 flags) (gekko-flag update-foot-position?)) + (let ((f0-13 + (intersect-ray-plane + sv-1008 + (vector-negate! (new 'stack-no-clear 'vector) (-> gp-0 rot-matrix uvec)) + (-> gp-0 root trans) + (-> gp-0 rot-matrix uvec) + ) + ) + ) + (vector+float*! sv-692 sv-692 (-> s0-0 ground-normal) f0-13) + ) + (vector+! sv-692 sv-692 sv-640) + ) + 0.0 + (let ((f28-0 (* 2457.6 (-> gp-0 scale))) + (v0-9 (vector<-cspace! (new 'stack-no-clear 'vector) (-> gp-0 node-list data 3))) + (sv-1024 (new 'stack-no-clear 'vector)) + (sv-1040 (new 'stack-no-clear 'vector)) + ) + (vector+float*! v0-9 v0-9 (-> gp-0 rot-matrix uvec) 3072.0) + (let ((f28-1 (+ 3072.0 f28-0))) + (when (< (vector-line-distance-point! + sv-692 + v0-9 + (vector+! (new 'stack-no-clear 'vector) v0-9 (-> gp-0 rot-matrix fvec)) + sv-1024 + ) + f28-1 + ) + (vector-! sv-1040 sv-692 sv-1024) + (vector-normalize! sv-1040 f28-1) + (let ((v1-64 sv-692)) + (.mov.vf.w vf6 vf0) + (.lvf vf4 (&-> sv-1024 quad)) + (.lvf vf5 (&-> sv-1040 quad)) + (.add.vf.xyz vf6 vf4 vf5) + (.svf (&-> v1-64 quad) vf6) + ) + 0 + ) + ) + ) + (vector-seek! + (-> s0-0 ground-pos) + sv-692 + (* (fmax 61440.0 (* 1.2 (vector-length (-> s3-0 transv)))) (seconds-per-frame)) ) ) ) - (vector-seek! - (-> s0-0 ground-pos) - sv-692 - (* (fmax 61440.0 (* 1.2 (vector-length (-> s3-0 transv)))) (seconds-per-frame)) - ) - (let ((t9-13 (method-of-object sv-1056 set-ik-target!)) - (a1-33 (-> s0-0 ground-pos)) - ) - (t9-13 sv-1056 a1-33) - ) + (set-ik-target! sv-1056 (-> s0-0 ground-pos)) ) ) ) @@ -2250,33 +2229,33 @@ (dotimes (s0-1 4) (vector+! s2-1 s2-1 (-> gp-0 foot s0-1 ground-pos)) (when (> s0-1 0) - (set! sv-1072 - (vector-normalize! - (vector-! (new 'stack-no-clear 'vector) (-> gp-0 foot s0-1 ground-pos) (-> gp-0 foot 0 ground-pos)) - 1.0 + (let ((sv-1072 + (vector-normalize! + (vector-! (new 'stack-no-clear 'vector) (-> gp-0 foot s0-1 ground-pos) (-> gp-0 foot 0 ground-pos)) + 1.0 + ) ) + (sv-1088 (new 'stack-no-clear 'vector)) ) - (set! sv-1088 (new 'stack-no-clear 'vector)) - (let ((v1-83 (-> gp-0 rot-matrix uvec)) - (a0-46 sv-1072) - ) - (.lvf vf1 (&-> v1-83 quad)) - (.lvf vf2 (&-> a0-46 quad)) - ) - (.outer.product.a.vf acc vf1 vf2) - (.outer.product.b.vf vf3 vf2 vf1 acc) - (.svf (&-> sv-1088 quad) vf3) - (vector-normalize! sv-1088 1.0) - (let ((a1-41 s1-1) - (v1-85 s1-1) - (a0-48 (new 'stack-no-clear 'vector)) - ) - (.lvf vf1 (&-> sv-1072 quad)) - (.lvf vf2 (&-> sv-1088 quad)) + (let ((a0-46 sv-1072)) + (.lvf vf1 (&-> (-> gp-0 rot-matrix uvec) quad)) + (.lvf vf2 (&-> a0-46 quad)) + ) (.outer.product.a.vf acc vf1 vf2) (.outer.product.b.vf vf3 vf2 vf1 acc) - (.svf (&-> a0-48 quad) vf3) - (vector+! a1-41 v1-85 a0-48) + (.svf (&-> sv-1088 quad) vf3) + (vector-normalize! sv-1088 1.0) + (let ((a1-41 s1-1) + (v1-85 s1-1) + (a0-48 (new 'stack-no-clear 'vector)) + ) + (.lvf vf1 (&-> sv-1072 quad)) + (.lvf vf2 (&-> sv-1088 quad)) + (.outer.product.a.vf acc vf1 vf2) + (.outer.product.b.vf vf3 vf2 vf1 acc) + (.svf (&-> a0-48 quad) vf3) + (vector+! a1-41 v1-85 a0-48) + ) ) ) ) @@ -2314,21 +2293,23 @@ ) ) (dotimes (s3-1 4) - (set! sv-976 (-> arg1 data (-> *gekko-ik-setup* s3-1 effector-index))) - (set! sv-980 (the-as gekko-foot-info (+ (the-as uint (-> gp-0 foot 0 foot-transform)) (* 96 s3-1)))) - (set! sv-984 (new 'stack-no-clear 'vector)) - (set! sv-988 (new 'stack-no-clear 'vector)) - (quaternion-from-two-vectors! - (the-as quaternion sv-988) - (-> gp-0 rot-matrix uvec) - (the-as vector (+ (the-as uint (-> gp-0 foot 0 ground-normal)) (* 96 s3-1))) - ) - (vector<-cspace! (-> sv-980 ground-pos) sv-976) - (matrix->quaternion (the-as quaternion sv-984) (-> sv-976 bone transform)) - (quaternion*! - (the-as quaternion (-> sv-980 ground-normal)) - (the-as quaternion sv-988) - (the-as quaternion sv-984) + (let ((sv-976 (-> arg1 data (-> *gekko-ik-setup* s3-1 effector-index))) + (sv-980 (the-as gekko-foot-info (+ (the-as uint (-> gp-0 foot 0 foot-transform)) (* 96 s3-1)))) + (sv-984 (new 'stack-no-clear 'vector)) + (sv-988 (new 'stack-no-clear 'vector)) + ) + (quaternion-from-two-vectors! + (the-as quaternion sv-988) + (-> gp-0 rot-matrix uvec) + (the-as vector (+ (the-as uint (-> gp-0 foot 0 ground-normal)) (* 96 s3-1))) + ) + (vector<-cspace! (-> sv-980 ground-pos) sv-976) + (matrix->quaternion (the-as quaternion sv-984) (-> sv-976 bone transform)) + (quaternion*! + (the-as quaternion (-> sv-980 ground-normal)) + (the-as quaternion sv-988) + (the-as quaternion sv-984) + ) ) ) (logclear! (-> gp-0 skel status) (joint-control-status no-joint-callbacks)) @@ -2416,14 +2397,13 @@ (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 (if (logtest? (-> this flags) (gekko-flag on-wall?)) - (-> this enemy-info notice-nav-radius) - 8192.0 - ) - ) - (f0-2 f30-0) - ) - (or (>= (* f0-2 f0-2) (vector-vector-xz-distance-squared (-> v1-4 trans) arg1)) + (let ((f30-0 (if (logtest? (-> this flags) (gekko-flag on-wall?)) + (-> this enemy-info notice-nav-radius) + 8192.0 + ) + ) + ) + (or (>= (square f30-0) (vector-vector-xz-distance-squared (-> v1-4 trans) arg1)) (is-in-mesh? (-> this nav) arg1 f30-0) ) ) @@ -2448,9 +2428,7 @@ ) (else (if (or (not (closest-point-on-mesh (-> this nav) s5-0 (-> gp-0 trans) (-> s3-0 current-poly))) - (let ((f0-0 16384.0)) - (< (* f0-0 f0-0) (vector-vector-xz-distance-squared s5-0 (-> gp-0 trans))) - ) + (< (square 16384.0) (vector-vector-xz-distance-squared s5-0 (-> gp-0 trans))) (and (and (-> this next-state) (= (-> this next-state name) 'knocked-recover)) (< (-> gp-0 trans y) (+ -8192.0 (-> s5-0 y))) (< (+ 12288.0 (-> s5-0 y)) (-> gp-0 trans y)) @@ -2672,84 +2650,77 @@ (f30-0 0.0) ) (let ((v1-2 (-> this incoming knocked-type))) - (set! f30-0 (cond - ((= v1-2 (knocked-type explode-or-darkjak)) - (let ((f30-1 (rnd-float-range this 0.0 1.0))) - (set! f28-0 (lerp (-> s4-0 knocked-hard-vxz-lo) (-> s4-0 knocked-hard-vxz-hi) f30-1)) - (lerp (-> s4-0 knocked-hard-vy-lo) (-> s4-0 knocked-hard-vy-hi) f30-1) - ) + (set! f30-0 + (cond + ((= v1-2 (knocked-type explode-or-darkjak)) + (let ((f30-1 (rnd-float-range this 0.0 1.0))) + (set! f28-0 (lerp (-> s4-0 knocked-hard-vxz-lo) (-> s4-0 knocked-hard-vxz-hi) f30-1)) + (lerp (-> s4-0 knocked-hard-vy-lo) (-> s4-0 knocked-hard-vy-hi) f30-1) + ) + ) + ((= v1-2 (knocked-type mech-punch)) + (let ((f30-2 (rnd-float-range this 0.0 1.0))) + (set! f28-0 (lerp (-> s4-0 knocked-medium-vxz-lo) (-> s4-0 knocked-medium-vxz-hi) f30-2)) + (lerp (-> s4-0 knocked-medium-vy-lo) (-> s4-0 knocked-medium-vy-hi) f30-2) + ) + ) + ((= v1-2 (knocked-type dark-shot)) + (let ((f30-3 (rnd-float-range this 0.0 1.0))) + (set! f28-0 (lerp (-> s4-0 knocked-huge-vxz-lo) (-> s4-0 knocked-huge-vxz-hi) f30-3)) + (lerp (-> s4-0 knocked-huge-vy-lo) (-> s4-0 knocked-huge-vy-hi) f30-3) + ) + ) + ((= v1-2 (knocked-type yellow-shot)) + (vector-rotate90-around-y! arg0 arg0) + (let ((v1-12 (new 'stack-no-clear 'vector))) + (vector-! v1-12 (-> this incoming attacker-pos) (-> this root trans)) + (set! (-> v1-12 y) 0.0) + (if (< 0.0 (vector-dot v1-12 arg0)) + (vector-negate! arg0 arg0) ) - ((= v1-2 (knocked-type mech-punch)) - (let ((f30-2 (rnd-float-range this 0.0 1.0))) - (set! f28-0 (lerp (-> s4-0 knocked-medium-vxz-lo) (-> s4-0 knocked-medium-vxz-hi) f30-2)) - (lerp (-> s4-0 knocked-medium-vy-lo) (-> s4-0 knocked-medium-vy-hi) f30-2) - ) - ) - ((= v1-2 (knocked-type dark-shot)) - (let ((f30-3 (rnd-float-range this 0.0 1.0))) - (set! f28-0 (lerp (-> s4-0 knocked-huge-vxz-lo) (-> s4-0 knocked-huge-vxz-hi) f30-3)) - (lerp (-> s4-0 knocked-huge-vy-lo) (-> s4-0 knocked-huge-vy-hi) f30-3) - ) - ) - ((= v1-2 (knocked-type yellow-shot)) - (vector-rotate90-around-y! arg0 arg0) - (let ((v1-12 (new 'stack-no-clear 'vector))) - (vector-! v1-12 (-> this incoming attacker-pos) (-> this root trans)) - (set! (-> v1-12 y) 0.0) - (if (< 0.0 (vector-dot v1-12 arg0)) - (vector-negate! arg0 arg0) - ) - ) - (let ((f30-4 (rnd-float-range this 0.0 1.0))) - (set! f28-0 (lerp (-> s4-0 knocked-yellow-vxz-lo) (-> s4-0 knocked-yellow-vxz-hi) f30-4)) - (lerp (-> s4-0 knocked-yellow-vy-lo) (-> s4-0 knocked-yellow-vy-hi) f30-4) - ) - ) - ((= v1-2 (knocked-type red-shot)) - (let* ((f1-2 (vector-vector-xz-distance-squared (target-pos 0) (-> this root trans))) - (f0-18 1.0) - (f2-0 61440.0) - (f1-3 (fmin f1-2 (* f2-0 f2-0))) - (f2-3 61440.0) - (f30-6 (* (- f0-18 (/ f1-3 (* f2-3 f2-3))) (rnd-float-range this 0.8 1.0))) - ) - (set! f28-0 (lerp (-> s4-0 knocked-red-vxz-lo) (-> s4-0 knocked-red-vxz-hi) f30-6)) - (lerp (-> s4-0 knocked-red-vy-lo) (-> s4-0 knocked-red-vy-hi) f30-6) - ) - ) - ((= v1-2 (knocked-type blue-shot)) - (let* ((f1-5 (vector-vector-xz-distance-squared (target-pos 0) (-> this root trans))) - (f0-24 1.0) - (f2-6 122880.0) - (f1-6 (fmin f1-5 (* f2-6 f2-6))) - (f2-9 122880.0) - (f26-0 (* (- f0-24 (/ f1-6 (* f2-9 f2-9))) (rnd-float-range this 0.8 1.0))) - ) - (set! f28-0 (lerp (-> s4-0 knocked-blue-vxz-lo) (-> s4-0 knocked-blue-vxz-hi) f26-0)) - (cond - ((>= (the-as uint 4) (-> this incoming blue-juggle-count)) - (lerp (-> s4-0 knocked-blue-vy-lo) (-> s4-0 knocked-blue-vy-hi) f26-0) - ) - (else - (if (zero? (rnd-int this 3)) - (set! f30-0 40960.0) - ) - f30-0 - ) + ) + (let ((f30-4 (rnd-float-range this 0.0 1.0))) + (set! f28-0 (lerp (-> s4-0 knocked-yellow-vxz-lo) (-> s4-0 knocked-yellow-vxz-hi) f30-4)) + (lerp (-> s4-0 knocked-yellow-vy-lo) (-> s4-0 knocked-yellow-vy-hi) f30-4) + ) + ) + ((= v1-2 (knocked-type red-shot)) + (let* ((f1-2 (vector-vector-xz-distance-squared (target-pos 0) (-> this root trans))) + (f30-6 (* (- 1.0 (/ (fmin f1-2 (square 61440.0)) (square 61440.0))) (rnd-float-range this 0.8 1.0))) + ) + (set! f28-0 (lerp (-> s4-0 knocked-red-vxz-lo) (-> s4-0 knocked-red-vxz-hi) f30-6)) + (lerp (-> s4-0 knocked-red-vy-lo) (-> s4-0 knocked-red-vy-hi) f30-6) + ) + ) + ((= v1-2 (knocked-type blue-shot)) + (let* ((f1-5 (vector-vector-xz-distance-squared (target-pos 0) (-> this root trans))) + (f26-0 (* (- 1.0 (/ (fmin f1-5 (square 122880.0)) (square 122880.0))) (rnd-float-range this 0.8 1.0))) + ) + (set! f28-0 (lerp (-> s4-0 knocked-blue-vxz-lo) (-> s4-0 knocked-blue-vxz-hi) f26-0)) + (cond + ((>= (the-as uint 4) (-> this incoming blue-juggle-count)) + (lerp (-> s4-0 knocked-blue-vy-lo) (-> s4-0 knocked-blue-vy-hi) f26-0) + ) + (else + (if (zero? (rnd-int this 3)) + (set! f30-0 40960.0) ) - ) - ) - ((= v1-2 (knocked-type vehicle)) - (vector-copy! arg0 (-> this incoming attack-direction)) f30-0 ) - (else - (let ((f30-7 (rnd-float-range this 0.0 1.0))) - (set! f28-0 (lerp (-> s4-0 knocked-soft-vxz-lo) (-> s4-0 knocked-soft-vxz-hi) f30-7)) - (lerp (-> s4-0 knocked-soft-vy-lo) (-> s4-0 knocked-soft-vy-hi) f30-7) - ) - ) - ) + ) + ) + ) + ((= v1-2 (knocked-type vehicle)) + (vector-copy! arg0 (-> this incoming attack-direction)) + f30-0 + ) + (else + (let ((f30-7 (rnd-float-range this 0.0 1.0))) + (set! f28-0 (lerp (-> s4-0 knocked-soft-vxz-lo) (-> s4-0 knocked-soft-vxz-hi) f30-7)) + (lerp (-> s4-0 knocked-soft-vy-lo) (-> s4-0 knocked-soft-vy-hi) f30-7) + ) + ) + ) ) ) (vector-float*! arg0 arg0 f28-0) diff --git a/test/decompiler/reference/jak3/levels/mine/manta_REF.gc b/test/decompiler/reference/jak3/levels/mine/manta_REF.gc index 2116441fef..75440ead96 100644 --- a/test/decompiler/reference/jak3/levels/mine/manta_REF.gc +++ b/test/decompiler/reference/jak3/levels/mine/manta_REF.gc @@ -417,7 +417,7 @@ (set! (-> s5-0 y) 0.0) (set! (-> s5-0 z) 4096.0) (set! (-> s5-0 w) 1.0) - (set-vector! a1-0 (* f0-2 f0-2 f0-2) (* f0-2 f0-2) f0-2 1.0) + (set-vector! a1-0 (* (square f0-2) f0-2) (square f0-2) f0-2 1.0) (set-vector! s3-0 (* 3.0 f0-2 f0-2) (* 2.0 f0-2) 1.0 0.0) (vector-matrix*! a0-4 a1-0 s2-0) (vector-matrix*! s4-0 s3-0 s2-0) @@ -1411,14 +1411,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) (-> s3-0 w))) - ) - (when (< f0-1 (* f1-1 f1-1)) - (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-2 world-sphere w) (-> s3-0 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)) ) ) ) @@ -1452,14 +1448,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) (-> s3-0 w))) - ) - (when (< f0-2 (* f1-5 f1-5)) - (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-14 world-sphere w) (-> s3-0 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)) ) ) ) @@ -2030,7 +2022,6 @@ ;; WARN: Return type mismatch int vs none. (defmethod init-enemy! ((this manta)) "Typical place for shared init code. Runs from entity or process style init." - (local-vars (sv-16 res-tag)) (initialize-skeleton this (the-as skeleton-group (art-group-get-by-name *level* "skel-manta" (the-as (pointer level) #f))) @@ -2050,11 +2041,12 @@ (set-vector! (-> v1-13 twist-max) 11832.889 11832.889 0.0 1.0) (set! (-> v1-13 ignore-angle) 30947.555) ) - (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 actor-group) :tag-ptr (& sv-16))) + ) (cond ((and v1-16 (nonzero? (-> sv-16 elt-count))) - (set! (-> this actor-group) (the-as (pointer actor-group) v1-16)) + (set! (-> this actor-group) v1-16) (set! (-> this actor-group-count) (the-as int (-> sv-16 elt-count))) ) (else @@ -2080,3 +2072,7 @@ 0 (none) ) + + + + diff --git a/test/decompiler/reference/jak3/levels/mine/mine-obs_REF.gc b/test/decompiler/reference/jak3/levels/mine/mine-obs_REF.gc index 01f65bc7e0..b7a1c9380e 100644 --- a/test/decompiler/reference/jak3/levels/mine/mine-obs_REF.gc +++ b/test/decompiler/reference/jak3/levels/mine/mine-obs_REF.gc @@ -5,14 +5,14 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defun mineb-activate () - (local-vars (sv-16 res-tag)) (let ((a0-1 (entity-by-name "minb-part-1"))) (when a0-1 (let ((gp-0 (the-as (pointer actor-group) #f)) (s5-0 0) ) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-2 (res-lump-data a0-1 'actor-groups (pointer actor-group) :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-2 (res-lump-data a0-1 'actor-groups (pointer actor-group) :tag-ptr (& sv-16))) + ) (when (and v1-2 (nonzero? (-> sv-16 elt-count))) (set! gp-0 v1-2) (set! s5-0 (the-as int (-> sv-16 elt-count))) @@ -164,12 +164,12 @@ ;; INFO: Used lq/sq (defmethod init-from-entity! ((this rat-light-manager) (arg0 entity-actor)) "Set up a newly created process from the entity that created it." - (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 actor-group) :tag-ptr (& sv-16))) + ) (cond ((and v1-1 (nonzero? (-> sv-16 elt-count))) - (set! (-> this actor-group) (the-as (pointer actor-group) v1-1)) + (set! (-> this actor-group) v1-1) (set! (-> this actor-group-count) (the-as int (-> sv-16 elt-count))) ) (else @@ -751,7 +751,6 @@ ;; INFO: Used lq/sq (defmethod init-from-entity! ((this min-rat-engine) (arg0 entity-actor)) "Set up a newly created process from the entity that created it." - (local-vars (sv-16 res-tag)) (min-rat-engine-method-24 this) (process-drawable-from-entity! this arg0) (initialize-skeleton @@ -766,11 +765,12 @@ ) (transform-post) (set! (-> this notify-actor) (entity-actor-lookup (-> this entity) 'alt-actor 0)) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-14 (res-lump-data (-> this entity) 'actor-groups pointer :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-14 (res-lump-data (-> this entity) 'actor-groups (pointer actor-group) :tag-ptr (& sv-16))) + ) (cond ((and v1-14 (nonzero? (-> sv-16 elt-count))) - (set! (-> this actor-group) (the-as (pointer actor-group) v1-14)) + (set! (-> this actor-group) v1-14) (set! (-> this actor-group-count) (the-as int (-> sv-16 elt-count))) ) (else @@ -2409,3 +2409,7 @@ (set-setting! 'music 'minexplr 0.0 0) (none) ) + + + + diff --git a/test/decompiler/reference/jak3/levels/mine/mine-platforms_REF.gc b/test/decompiler/reference/jak3/levels/mine/mine-platforms_REF.gc index 5dc728cac1..36e5bc4d80 100644 --- a/test/decompiler/reference/jak3/levels/mine/mine-platforms_REF.gc +++ b/test/decompiler/reference/jak3/levels/mine/mine-platforms_REF.gc @@ -1232,16 +1232,16 @@ ;; INFO: Used lq/sq (defmethod init-from-entity! ((this min-falling-step) (arg0 entity-actor)) "Set up a newly created process from the entity that created it." - (local-vars (sv-16 res-tag)) (let ((t9-0 (method-of-type mine-platform-base init-from-entity!))) (t9-0 this arg0) ) (set! (-> this bounce-scale) 204.8) - (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 actor-group) :tag-ptr (& sv-16))) + ) (cond ((and v1-3 (nonzero? (-> sv-16 elt-count))) - (set! (-> this actor-group) (the-as (pointer actor-group) v1-3)) + (set! (-> this actor-group) v1-3) (set! (-> this actor-group-count) (the-as int (-> sv-16 elt-count))) ) (else @@ -2276,3 +2276,7 @@ (set! (-> this draw light-index) (the-as uint 2)) (none) ) + + + + diff --git a/test/decompiler/reference/jak3/levels/mine/mine-train_REF.gc b/test/decompiler/reference/jak3/levels/mine/mine-train_REF.gc index 145fa1dceb..2816d574f8 100644 --- a/test/decompiler/reference/jak3/levels/mine/mine-train_REF.gc +++ b/test/decompiler/reference/jak3/levels/mine/mine-train_REF.gc @@ -425,7 +425,7 @@ (set! f0-10 (-> self suck-level)) (set! f1-1 (* f1-1 f0-10)) ) - (let ((f0-14 (seek (-> self speed) f1-1 (* 7168.0 (seconds-per-frame) (* f0-10 f0-10))))) + (let ((f0-14 (seek (-> self speed) f1-1 (* 7168.0 (seconds-per-frame) (square f0-10))))) (set! (-> self speed) f0-14) (set! (-> self speed) f0-14) ) @@ -857,7 +857,6 @@ ;; INFO: Used lq/sq (defmethod init-from-entity! ((this min-bomb-train) (arg0 entity-actor)) "Set up a newly created process from the entity that created it." - (local-vars (sv-16 res-tag)) (when (task-node-closed? (game-task-node mine-blow-resolution)) (cleanup-for-death this) (return #f) @@ -913,11 +912,12 @@ (if (nonzero? (-> this path)) (set! (-> this path-length) (total-distance (-> this path))) ) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-44 (res-lump-data (-> this entity) 'actor-groups pointer :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-44 (res-lump-data (-> this entity) 'actor-groups (pointer actor-group) :tag-ptr (& sv-16))) + ) (cond ((and v1-44 (nonzero? (-> sv-16 elt-count))) - (set! (-> this actor-group) (the-as (pointer actor-group) v1-44)) + (set! (-> this actor-group) v1-44) (set! (-> this actor-group-count) (the-as int (-> sv-16 elt-count))) (when (>= (-> this actor-group-count) 3) (let ((s5-1 (-> this actor-group 3 length))) @@ -973,3 +973,7 @@ ) (go (method-of-object this active)) ) + + + + diff --git a/test/decompiler/reference/jak3/levels/mine/prebot-extras_REF.gc b/test/decompiler/reference/jak3/levels/mine/prebot-extras_REF.gc index a48bccd3b6..a35fe753ca 100644 --- a/test/decompiler/reference/jak3/levels/mine/prebot-extras_REF.gc +++ b/test/decompiler/reference/jak3/levels/mine/prebot-extras_REF.gc @@ -294,7 +294,6 @@ ;; INFO: Used lq/sq (defmethod init-from-entity! ((this cav-railblocker) (arg0 entity-actor)) "Set up a newly created process from the entity that created it." - (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-sphere s4-0 (the-as uint 0)))) (set! (-> v1-2 prim-core collide-as) (collide-spec enemy)) @@ -325,8 +324,9 @@ (set! (-> this trackable) #t) (set! (-> this notify-on-die) #f) (set! (-> this notify-on-die-2) #f) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-17 (res-lump-data arg0 'actor-groups (pointer actor-group) :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-17 (res-lump-data arg0 'actor-groups (pointer actor-group) :tag-ptr (& sv-16))) + ) (when (and v1-17 (nonzero? (-> sv-16 elt-count))) (let ((v1-18 (-> v1-17 0))) (if (> (-> v1-18 length) 0) @@ -1347,13 +1347,9 @@ (transform-post) ) :trans (behavior () - (let ((f0-0 (vector-vector-distance-squared (-> self root trans) (target-pos 0))) - (f1-0 16384.0) - ) - (if (< f0-0 (* f1-0 f1-0)) - (go-virtual rise) - ) - ) + (if (< (vector-vector-distance-squared (-> self root trans) (target-pos 0)) (square 16384.0)) + (go-virtual rise) + ) ) :code sleep-code ) diff --git a/test/decompiler/reference/jak3/levels/mine/prebot-states_REF.gc b/test/decompiler/reference/jak3/levels/mine/prebot-states_REF.gc index fb087f7c65..d0a6b74b10 100644 --- a/test/decompiler/reference/jak3/levels/mine/prebot-states_REF.gc +++ b/test/decompiler/reference/jak3/levels/mine/prebot-states_REF.gc @@ -195,7 +195,7 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs object. (defbehavior prebot-go-next-stage prebot () - (local-vars (v1-4 (pointer actor-group)) (sv-16 res-tag)) + (local-vars (v1-4 (pointer actor-group))) (cond ((not (task-node-closed? (game-task-node mine-boss-introduction))) (set! (-> self stage) 0) @@ -206,9 +206,10 @@ ) ((begin (set! (-> self stage) 1) - (set! sv-16 (new 'static 'res-tag)) - (set! v1-4 (res-lump-data (-> self entity) 'actor-groups (pointer actor-group) :tag-ptr (& sv-16))) - (and v1-4 (nonzero? (-> sv-16 elt-count))) + (let ((sv-16 (new 'static 'res-tag))) + (set! v1-4 (res-lump-data (-> self entity) 'actor-groups (pointer actor-group) :tag-ptr (& sv-16))) + (and v1-4 (nonzero? (-> sv-16 elt-count))) + ) ) (let ((v1-5 (-> v1-4 0))) (dotimes (a0-5 (-> v1-5 length)) @@ -1423,13 +1424,9 @@ ) ) (else - (let ((f0-14 (vector-vector-distance-squared (-> self position target) (-> self position value))) - (f1-0 1024.0) - ) - (if (< f0-14 (* f1-0 f1-0)) - (go-virtual launch-critters) - ) - ) + (if (< (vector-vector-distance-squared (-> self position target) (-> self position value)) (square 1024.0)) + (go-virtual launch-critters) + ) (ja :num! (loop!)) ) ) @@ -1600,58 +1597,54 @@ (dotimes (gp-12 2) (send-event (handle->process (-> self swords gp-12)) 'scale #x3ff33333) ) - (let ((f0-46 (vector-vector-distance-squared (-> self position target) (-> self position value))) - (f1-15 1024.0) + (when (< (vector-vector-distance-squared (-> self position target) (-> self position value)) (square 1024.0)) + (dotimes (gp-13 2) + (send-event (handle->process (-> self swords gp-13)) 'scale #x3f800000) + ) + (+! (-> self num-attacks) -1) + (if (<= (-> self num-attacks) 0) + (go-virtual sweep-done) ) - (when (< f0-46 (* f1-15 f1-15)) - (dotimes (gp-13 2) - (send-event (handle->process (-> self swords gp-13)) 'scale #x3f800000) - ) - (+! (-> self num-attacks) -1) - (if (<= (-> self num-attacks) 0) - (go-virtual sweep-done) - ) - (let ((v1-258 (ja-group))) - (cond - ((and v1-258 (= v1-258 prebot-swords-horizontal-R2L-hold-ja)) - (ja-channel-push! 1 (seconds 0.2)) - (ja :group! prebot-swords-horizontal-R2L-return-ja :num! min) - (set! (-> self position target y) (+ -34816.0 (-> self original-position y))) + (let ((v1-258 (ja-group))) + (cond + ((and v1-258 (= v1-258 prebot-swords-horizontal-R2L-hold-ja)) + (ja-channel-push! 1 (seconds 0.2)) + (ja :group! prebot-swords-horizontal-R2L-return-ja :num! min) + (set! (-> self position target y) (+ -34816.0 (-> self original-position y))) + ) + ((let ((v1-270 (ja-group))) + (and v1-270 (= v1-270 prebot-swords-horizontal-L2R-hold-ja)) ) - ((let ((v1-270 (ja-group))) - (and v1-270 (= v1-270 prebot-swords-horizontal-L2R-hold-ja)) - ) - (ja-channel-push! 1 (seconds 0.2)) - (ja :group! prebot-swords-horizontal-L2R-return-ja :num! min) - (set! (-> self position target y) (+ -34816.0 (-> self original-position y))) + (ja-channel-push! 1 (seconds 0.2)) + (ja :group! prebot-swords-horizontal-L2R-return-ja :num! min) + (set! (-> self position target y) (+ -34816.0 (-> self original-position y))) + ) + ((let ((v1-282 (ja-group))) + (and v1-282 (= v1-282 prebot-sword-R-horizontal-R2L-hold-ja)) ) - ((let ((v1-282 (ja-group))) - (and v1-282 (= v1-282 prebot-sword-R-horizontal-R2L-hold-ja)) - ) - (ja-channel-push! 1 (seconds 0.2)) - (ja :group! prebot-sword-R-horizontal-R2L-return-ja :num! min) - (set! (-> self position target y) (+ -36864.0 (-> self original-position y))) + (ja-channel-push! 1 (seconds 0.2)) + (ja :group! prebot-sword-R-horizontal-R2L-return-ja :num! min) + (set! (-> self position target y) (+ -36864.0 (-> self original-position y))) + ) + ((let ((v1-294 (ja-group))) + (and v1-294 (= v1-294 prebot-sword-R-horizontal-L2R-hold-ja)) ) - ((let ((v1-294 (ja-group))) - (and v1-294 (= v1-294 prebot-sword-R-horizontal-L2R-hold-ja)) - ) - (ja-channel-push! 1 (seconds 0.2)) - (ja :group! prebot-sword-R-horizontal-L2R-return-ja :num! min) - (set! (-> self position target y) (+ -36864.0 (-> self original-position y))) - ) - (else - (let ((v1-306 (ja-group))) - (cond - ((and v1-306 (= v1-306 prebot-sword-L-horizontal-R2L-hold-ja)) - (ja-channel-push! 1 (seconds 0.2)) - (ja :group! prebot-sword-L-horizontal-R2L-return-ja :num! min) - (set! (-> self position target y) (+ -36864.0 (-> self original-position y))) - ) - (else - (ja-channel-push! 1 (seconds 0.2)) - (ja :group! prebot-sword-L-horizontal-L2R-return-ja :num! min) - (set! (-> self position target y) (+ -36864.0 (-> self original-position y))) - ) + (ja-channel-push! 1 (seconds 0.2)) + (ja :group! prebot-sword-R-horizontal-L2R-return-ja :num! min) + (set! (-> self position target y) (+ -36864.0 (-> self original-position y))) + ) + (else + (let ((v1-306 (ja-group))) + (cond + ((and v1-306 (= v1-306 prebot-sword-L-horizontal-R2L-hold-ja)) + (ja-channel-push! 1 (seconds 0.2)) + (ja :group! prebot-sword-L-horizontal-R2L-return-ja :num! min) + (set! (-> self position target y) (+ -36864.0 (-> self original-position y))) + ) + (else + (ja-channel-push! 1 (seconds 0.2)) + (ja :group! prebot-sword-L-horizontal-L2R-return-ja :num! min) + (set! (-> self position target y) (+ -36864.0 (-> self original-position y))) ) ) ) @@ -2070,51 +2063,47 @@ ) (ja :num! (seek!)) (when (ja-done? 0) - (let ((f0-18 (vector-vector-distance-squared (-> self position target) (-> self position value))) - (f1-0 1024.0) - ) - (cond - ((< f0-18 (* f1-0 f1-0)) - (let ((v1-124 (ja-group))) - (cond - ((and v1-124 (= v1-124 prebot-swords-vertical-pre-ja)) - (ja-channel-push! 1 (seconds 0.02)) - (ja :group! prebot-swords-R-vertical-strike-ja :num! min) - ) - (else - (let ((v1-134 (ja-group))) - (cond - ((and v1-134 (= v1-134 prebot-sword-R-vertical-pre-ja)) - (ja-channel-push! 1 (seconds 0.02)) - (ja :group! prebot-sword-R-vertical-strike-ja :num! min) - ) - (else - (ja-channel-push! 1 (seconds 0.02)) - (ja :group! prebot-sword-L-vertical-strike-ja :num! min) - ) + (cond + ((< (vector-vector-distance-squared (-> self position target) (-> self position value)) (square 1024.0)) + (let ((v1-124 (ja-group))) + (cond + ((and v1-124 (= v1-124 prebot-swords-vertical-pre-ja)) + (ja-channel-push! 1 (seconds 0.02)) + (ja :group! prebot-swords-R-vertical-strike-ja :num! min) + ) + (else + (let ((v1-134 (ja-group))) + (cond + ((and v1-134 (= v1-134 prebot-sword-R-vertical-pre-ja)) + (ja-channel-push! 1 (seconds 0.02)) + (ja :group! prebot-sword-R-vertical-strike-ja :num! min) + ) + (else + (ja-channel-push! 1 (seconds 0.02)) + (ja :group! prebot-sword-L-vertical-strike-ja :num! min) ) ) ) ) ) ) - ((let ((v1-149 (ja-group))) - (and v1-149 (= v1-149 prebot-swords-vertical-pre-ja)) - ) - (ja-channel-push! 1 (seconds 0.02)) - (ja :group! prebot-swords-vertical-hold-ja :num! min) + ) + ((let ((v1-149 (ja-group))) + (and v1-149 (= v1-149 prebot-swords-vertical-pre-ja)) ) - (else - (let ((v1-159 (ja-group))) - (cond - ((and v1-159 (= v1-159 prebot-sword-R-vertical-pre-ja)) - (ja-channel-push! 1 (seconds 0.02)) - (ja :group! prebot-sword-R-vertical-hold-ja :num! min) - ) - (else - (ja-channel-push! 1 (seconds 0.02)) - (ja :group! prebot-sword-R-vertical-hold-ja :num! min) - ) + (ja-channel-push! 1 (seconds 0.02)) + (ja :group! prebot-swords-vertical-hold-ja :num! min) + ) + (else + (let ((v1-159 (ja-group))) + (cond + ((and v1-159 (= v1-159 prebot-sword-R-vertical-pre-ja)) + (ja-channel-push! 1 (seconds 0.02)) + (ja :group! prebot-sword-R-vertical-hold-ja :num! min) + ) + (else + (ja-channel-push! 1 (seconds 0.02)) + (ja :group! prebot-sword-R-vertical-hold-ja :num! min) ) ) ) @@ -2128,11 +2117,7 @@ (= v1-174 prebot-swords-vertical-hold-ja) ) ) - (let ((f0-25 (vector-vector-distance-squared (-> self position target) (-> self position value))) - (f1-3 1024.0) - ) - (< f0-25 (* f1-3 f1-3)) - ) + (< (vector-vector-distance-squared (-> self position target) (-> self position value)) (square 1024.0)) ) ) (let ((v1-182 (ja-group))) diff --git a/test/decompiler/reference/jak3/levels/mine/rat_REF.gc b/test/decompiler/reference/jak3/levels/mine/rat_REF.gc index 1f578bcd22..b2352fdbf6 100644 --- a/test/decompiler/reference/jak3/levels/mine/rat_REF.gc +++ b/test/decompiler/reference/jak3/levels/mine/rat_REF.gc @@ -2113,17 +2113,17 @@ ;; INFO: Used lq/sq (defmethod init-from-entity! ((this rat-spawner) (arg0 entity-actor)) "Set up a newly created process from the entity that created it." - (local-vars (sv-16 res-tag)) (set! (-> this wheel-entity) (entity-actor-lookup (-> this entity) 'alt-actor 0)) (set! (-> this rats-spawned) (the-as uint 0)) (set! (-> this rats-to-spawn) (res-lump-value (-> this entity) 'extra-id uint :default (the-as uint128 1) :time -1000000000.0) ) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-2 (res-lump-data (-> this entity) 'actor-groups pointer :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-2 (res-lump-data (-> this entity) 'actor-groups (pointer actor-group) :tag-ptr (& sv-16))) + ) (cond ((and v1-2 (nonzero? (-> sv-16 elt-count))) - (set! (-> this actor-group) (the-as (pointer actor-group) v1-2)) + (set! (-> this actor-group) v1-2) (set! (-> this actor-group-count) (the-as int (-> sv-16 elt-count))) ) (else @@ -2138,3 +2138,7 @@ (go (method-of-object this idle)) ) ) + + + + diff --git a/test/decompiler/reference/jak3/levels/nest/egg-spider_REF.gc b/test/decompiler/reference/jak3/levels/nest/egg-spider_REF.gc index 1655cdcb92..4e81559f6c 100644 --- a/test/decompiler/reference/jak3/levels/nest/egg-spider_REF.gc +++ b/test/decompiler/reference/jak3/levels/nest/egg-spider_REF.gc @@ -736,7 +736,6 @@ ;; ERROR: Stack slot load at 32 mismatch: defined as size 4, got size 16 (defmethod event-handler ((this egg-spider) (arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) "Commmon handler for events." - (local-vars (sv-16 float) (sv-32 float)) (case arg2 (('attack) (let ((s1-0 (the-as attack-info (-> arg3 param 1)))) @@ -744,13 +743,7 @@ (when (= (-> s1-0 mode) 'vehicle) (set! (-> this vehicle-attack?) #t) (vector-float*! (-> s1-0 vector) (-> s1-0 vector) 1.0) - (let ((s0-0 lerp)) - (set! sv-16 (the-as float 40960.0)) - (set! sv-32 (the-as float 81920.0)) - (let ((a2-2 (rnd-float-range this 0.0 1.0))) - (set! (-> s1-0 vector y) (s0-0 sv-16 sv-32 a2-2)) - ) - ) + (set! (-> s1-0 vector y) (lerp (the-as float 40960.0) (the-as float 81920.0) (rnd-float-range this 0.0 1.0))) ) ) ((method-of-type nav-enemy event-handler) this arg0 arg1 arg2 arg3) @@ -1581,7 +1574,6 @@ ;; definition for method 23 of type spider-manager (defmethod check-can-rid ((this spider-manager)) - (local-vars (sv-16 process-tree)) (let ((s2-0 (the-as (pointer process-tree) (-> this child))) (s5-0 0) ) @@ -1590,18 +1582,19 @@ ) (set! (-> this can-rid) (the-as handle #f)) (while s2-0 - (set! sv-16 (as-type (-> s2-0 0) egg-spider)) - (when sv-16 - (when (not (logtest? (-> (the-as egg-spider sv-16) draw status) (draw-control-status on-screen))) - (let ((f0-0 (vector-vector-xz-distance (-> (the-as egg-spider sv-16) root trans) (target-pos 0)))) - (when (< (the float dist) f0-0) - (set! dist f0-0) - (set! (-> this can-rid) (process->handle (the-as process sv-16))) + (let ((sv-16 (as-type (-> s2-0 0) egg-spider))) + (when sv-16 + (when (not (logtest? (-> (the-as egg-spider sv-16) draw status) (draw-control-status on-screen))) + (let ((f0-0 (vector-vector-xz-distance (-> (the-as egg-spider sv-16) root trans) (target-pos 0)))) + (when (< (the float dist) f0-0) + (set! dist f0-0) + (set! (-> this can-rid) (process->handle (the-as process sv-16))) + ) ) + (+! s4-0 1) ) - (+! s4-0 1) + (+! s5-0 1) ) - (+! s5-0 1) ) (set! s2-0 (-> s2-0 0 brother)) ) @@ -1823,7 +1816,6 @@ ;; INFO: Used lq/sq (defmethod init-from-entity! ((this spider-manager) (arg0 entity-actor)) "Set up a newly created process from the entity that created it." - (local-vars (sv-16 res-tag) (sv-32 res-tag)) (logior! (-> this mask) (process-mask enemy)) (let ((s4-0 (new 'process 'trsqv))) (set! (-> this root) s4-0) @@ -1835,14 +1827,16 @@ (set! (-> this max-spawn-delay) 60) (set! (-> this min-spot-delay) 150) (set! (-> this max-spot-delay) 300) - (set! sv-16 (new 'static 'res-tag)) - (res-lump-data (-> this entity) 'nav-mesh-actor pointer :tag-ptr (& sv-16)) - (set! (-> this num-nav-mesh) (the-as int (-> sv-16 elt-count))) - (set! sv-32 (new 'static 'res-tag)) - (let ((v1-16 (res-lump-data (-> this entity) 'actor-groups pointer :tag-ptr (& sv-32)))) + (let ((sv-16 (new 'static 'res-tag))) + (res-lump-data (-> this entity) 'nav-mesh-actor pointer :tag-ptr (& sv-16)) + (set! (-> this num-nav-mesh) (the-as int (-> sv-16 elt-count))) + ) + (let* ((sv-32 (new 'static 'res-tag)) + (v1-16 (res-lump-data (-> this entity) 'actor-groups (pointer actor-group) :tag-ptr (& sv-32))) + ) (cond ((and v1-16 (nonzero? (-> sv-32 elt-count))) - (set! (-> this actor-group) (the-as (pointer actor-group) v1-16)) + (set! (-> this actor-group) v1-16) (set! (-> this actor-group-count) (the-as int (-> sv-32 elt-count))) ) (else @@ -1866,3 +1860,7 @@ (spider-manager-method-21 this) (go-idle this) ) + + + + diff --git a/test/decompiler/reference/jak3/levels/nest/mh-centipede_REF.gc b/test/decompiler/reference/jak3/levels/nest/mh-centipede_REF.gc index 9487fe18a2..5dcf207330 100644 --- a/test/decompiler/reference/jak3/levels/nest/mh-centipede_REF.gc +++ b/test/decompiler/reference/jak3/levels/nest/mh-centipede_REF.gc @@ -721,24 +721,20 @@ (set! (-> self minimap) #f) ) :trans (behavior () - (let ((f0-0 (vector-vector-xz-distance-squared (target-pos 0) (-> self root trans))) - (f1-0 28672.0) - ) - (when (< f0-0 (* f1-0 f1-0)) - (let* ((v1-6 (-> *game-info* sub-task-list (game-task-node nest-hunt-get-crystal))) - (a0-4 (handle->process (if (-> v1-6 manager) - (-> v1-6 manager manager) - (the-as handle #f) - ) - ) - ) - ) - (when a0-4 - (when (send-event a0-4 'complete) - (talker-spawn-func (-> *talker-speech* 133) *entity-pool* (target-pos 0) (the-as region #f)) - (cleanup-for-death self) - (go-virtual wait-for-children) - ) + (when (< (vector-vector-xz-distance-squared (target-pos 0) (-> self root trans)) (square 28672.0)) + (let* ((v1-6 (-> *game-info* sub-task-list (game-task-node nest-hunt-get-crystal))) + (a0-4 (handle->process (if (-> v1-6 manager) + (-> v1-6 manager manager) + (the-as handle #f) + ) + ) + ) + ) + (when a0-4 + (when (send-event a0-4 'complete) + (talker-spawn-func (-> *talker-speech* 133) *entity-pool* (target-pos 0) (the-as region #f)) + (cleanup-for-death self) + (go-virtual wait-for-children) ) ) ) @@ -1127,13 +1123,9 @@ (vector-float*! (-> gp-0 move-dist) s3-1 -2.0) (let ((s3-2 (new 'stack-no-clear 'collide-query))) (let ((a1-20 (new 'stack-no-clear 'bounding-box))) - (let* ((f0-21 409.6) - (f1-9 3072.0) - (f1-11 (* f1-9 f1-9)) - (f2-0 10240.0) - (f0-22 (+ f0-21 (sqrtf (+ f1-11 (* f2-0 f2-0))))) - (v1-38 (new 'stack-no-clear 'vector)) - ) + (let ((f0-22 (+ 409.6 (sqrtf (+ (square 3072.0) (square 10240.0))))) + (v1-38 (new 'stack-no-clear 'vector)) + ) (set-vector! v1-38 f0-22 f0-22 f0-22 1.0) (vector+! (-> a1-20 max) (-> s5-0 collision-pt) v1-38) (vector-! (-> a1-20 min) (-> s5-0 collision-pt) v1-38) @@ -1512,7 +1504,6 @@ ;; definition for method 38 of type mh-centipede ;; INFO: Used lq/sq (defmethod mh-centipede-method-38 ((this mh-centipede) (arg0 symbol)) - (local-vars (sv-288 nav-control) (sv-304 vector) (sv-320 vector) (sv-336 nav-control)) (rlet ((acc :class vf) (vf0 :class vf) (vf1 :class vf) @@ -1545,13 +1536,11 @@ (s1-0 (new 'stack-no-clear 'vector)) (s2-2 (new 'stack-no-clear 'vector)) ) - (let ((f0-6 10240.0)) - (if (< (* f0-6 f0-6) (vector-vector-xz-distance-squared (-> s4-0 fvec) (-> this landing-position))) - (return #f) - ) - ) - (set! sv-288 (-> this nav)) - (let ((a1-7 s3-3) + (if (< (square 10240.0) (vector-vector-xz-distance-squared (-> s4-0 fvec) (-> this landing-position))) + (return #f) + ) + (let ((sv-288 (-> this nav)) + (a1-7 s3-3) (s0-0 s1-0) ) (let ((a3-1 s2-2) @@ -1572,9 +1561,9 @@ (when (or (probe-ground this (-> this landing-position)) (not arg0)) (dotimes (s1-1 10) (let ((s0-1 (-> s4-0 fvec))) - (set! sv-304 (-> s4-0 rvec)) - (set! sv-320 (-> s4-0 uvec)) - (let* ((f30-2 (- (tan 0.0))) + (let* ((sv-304 (-> s4-0 rvec)) + (sv-320 (-> s4-0 uvec)) + (f30-2 (- (tan 0.0))) (v1-39 (/ (the-as int (rand-uint31-gen *random-generator*)) 256)) (v1-40 (the-as number (logior #x3f800000 v1-39))) (f0-16 (+ f30-2 (* (+ -1.0 (the-as float v1-40)) (+ (tan 0.0) (tan 0.0))))) @@ -1597,8 +1586,8 @@ (clamp-vector-to-mesh-no-gaps (-> this nav) (-> this landing-position) (-> s0-2 poly) (-> s4-0 fvec) s0-2) (when (not (-> s0-2 found-boundary)) (vector+! (-> s4-0 fvec) (-> this landing-position) (-> s4-0 fvec)) - (set! sv-336 (-> this nav)) - (let ((a1-13 (-> s0-2 poly)) + (let ((sv-336 (-> this nav)) + (a1-13 (-> s0-2 poly)) (s0-3 (-> this launch-position)) ) (let ((a3-3 s2-2) @@ -1636,7 +1625,6 @@ ;; definition for method 39 of type mh-centipede ;; INFO: Used lq/sq (defmethod mh-centipede-method-39 ((this mh-centipede)) - (local-vars (sv-288 vector)) (logclear! (-> this flags) (mh-centipede-flag mc8)) (when (nonzero? (-> this nav)) (let ((s5-0 (new 'stack-no-clear 'matrix))) @@ -1663,19 +1651,11 @@ (s2-1 (new 'stack-no-clear 'vector)) (s3-3 (new 'stack-no-clear 'vector)) ) - (let ((f0-12 (vector-vector-xz-distance-squared (camera-pos) (-> this landing-position))) - (f1-1 245760.0) - ) - (if (or (< f0-12 (* f1-1 f1-1)) - (let ((f0-13 (vector-vector-xz-distance-squared (target-pos 0) (-> this landing-position))) - (f1-4 245760.0) - ) - (< f0-13 (* f1-4 f1-4)) - ) - ) - (return #f) - ) - ) + (if (or (< (vector-vector-xz-distance-squared (camera-pos) (-> this landing-position)) (square 245760.0)) + (< (vector-vector-xz-distance-squared (target-pos 0) (-> this landing-position)) (square 245760.0)) + ) + (return #f) + ) (let ((s0-0 (-> this nav)) (a1-7 s4-5) (s1-2 s2-1) @@ -1706,18 +1686,15 @@ ) (vector-float*! s1-3 s0-1 (+ f30-2 (* f28-1 (+ -1.0 (the-as float v1-36))))) ) - (let ((s1-5 (-> s5-0 fvec)) - (s0-2 (-> s5-0 fvec)) - ) - (set! sv-288 (-> s5-0 rvec)) - (let* ((f30-3 -1.0) - (f28-2 2.0) - (v1-41 (/ (the-as int (rand-uint31-gen *random-generator*)) 256)) - (v1-42 (the-as number (logior #x3f800000 v1-41))) - (f0-24 (+ f30-3 (* f28-2 (+ -1.0 (the-as float v1-42))))) - ) - (vector+float*! s1-5 s0-2 sv-288 f0-24) - ) + (let* ((s1-5 (-> s5-0 fvec)) + (s0-2 (-> s5-0 fvec)) + (sv-288 (-> s5-0 rvec)) + (f30-3 -1.0) + (f28-2 2.0) + (v1-41 (/ (the-as int (rand-uint31-gen *random-generator*)) 256)) + (v1-42 (the-as number (logior #x3f800000 v1-41))) + ) + (vector+float*! s1-5 s0-2 sv-288 (+ f30-3 (* f28-2 (+ -1.0 (the-as float v1-42))))) ) (vector-normalize! (-> s5-0 fvec) (* 3.0 (-> this current-anim radius))) (let ((s1-7 (new 'stack-no-clear 'clamp-travel-vector-to-mesh-return-info))) @@ -1760,12 +1737,6 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defmethod death-explosion ((this mh-centipede) (arg0 int)) - (local-vars - (sv-848 process) - (sv-864 - (function skeleton-group int joint-exploder-tuning joint-exploder-static-params object :behavior joint-exploder) - ) - ) (let ((s4-0 (get-field-spec-by-id (-> *part-id-table* 2512) (sp-field-id spt-omega))) (s5-0 (new 'stack-no-clear 'matrix)) ) @@ -1836,23 +1807,15 @@ (vector-copy! s3-2 (-> this root scale)) (vector-copy! (-> this root trans) (-> s5-0 trans)) (set-vector! (-> this root scale) 2.0 2.0 2.0 1.0) - (let ((s5-1 (get-process *default-dead-pool* joint-exploder #x4000 0))) - (when s5-1 - (let ((t9-16 (method-of-type joint-exploder activate))) - (t9-16 (the-as joint-exploder s5-1) this "joint-exploder" (the-as pointer #x70004000)) - ) - (let ((s0-0 run-function-in-process)) - (set! sv-848 s5-1) - (set! sv-864 joint-exploder-init-by-other) - (let ((a2-16 (art-group-get-by-name *level* "skel-mh-centipede-explode" (the-as (pointer level) #f))) - (a3-10 10) - (t1-0 *mh-centipede-exploder-params*) - ) - ((the-as (function object object object object object object none) s0-0) sv-848 sv-864 a2-16 a3-10 s2-0 t1-0) - ) - ) - (-> s5-1 ppointer) - ) + (process-spawn + joint-exploder + (art-group-get-by-name *level* "skel-mh-centipede-explode" (the-as (pointer level) #f)) + 10 + s2-0 + *mh-centipede-exploder-params* + :name "joint-exploder" + :to this + :unk 0 ) (quaternion-copy! (-> this root quat) s1-0) (vector-copy! (-> this root trans) s4-3) @@ -1885,13 +1848,9 @@ (get-intersect-point s5-1 s2-0 (-> self root) s4-0) (vector-! s5-1 s5-1 (-> s3-0 prim-core world-sphere)) (set! (-> s5-1 y) 0.0) - (let ((f0-1 (vector-length-squared s5-1)) - (f1-0 1.0) - ) - (if (< f0-1 (* f1-0 f1-0)) - (set! (-> s5-1 x) 1.0) - ) - ) + (if (< (vector-length-squared s5-1) (square 1.0)) + (set! (-> s5-1 x) 1.0) + ) (vector-normalize! s5-1 1.0) (set! (-> s5-1 y) 0.1) (when (send-event arg0 'attack #f (static-attack-info @@ -1994,7 +1953,6 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defmethod fire-shot ((this mh-centipede)) - (local-vars (sv-192 sound-id)) (with-pp (let ((gp-0 (new 'stack-no-clear 'projectile-init-by-other-params))) (let ((s3-0 (new 'stack-no-clear 'vector)) @@ -2003,18 +1961,14 @@ (let ((s2-0 (new 'stack-no-clear 'vector))) (vector-copy! s2-0 (target-pos 0)) (vector<-cspace! s3-0 (-> this node-list data 77)) - (let ((s1-0 sound-play-by-name) - (sname (static-sound-name "cent-fire-spit")) - ) - (set! sv-192 (new-sound-id)) - (let ((a2-0 (the int (* 1024.0 (nest-hunt-volume (-> this effect-sphere))))) - (a3-0 0) - (t0-0 0) - (t1-0 0) - (t2-0 s3-0) - ) - (s1-0 (the-as sound-name sname) sv-192 a2-0 a3-0 t0-0 (the-as sound-group t1-0) t2-0) - ) + (sound-play-by-name + (static-sound-name "cent-fire-spit") + (new-sound-id) + (the int (* 1024.0 (nest-hunt-volume (-> this effect-sphere)))) + 0 + 0 + (sound-group) + s3-0 ) (vector-! s4-0 (-> this current-target-position) (-> this prev-target-position)) (set! (-> s4-0 y) 0.0) @@ -2185,15 +2139,17 @@ (set! (-> v1-6 prim-core collide-with) (collide-spec)) ) 0 - (let* ((gp-0 lerp-scale) - (s5-0 819.2) - (s4-0 0.0) - (a2-0 (vector-vector-distance-squared (-> self launch-position) (target-pos 0))) - (f0-0 204800.0) - (a3-0 (* f0-0 f0-0)) - (f0-2 2048000.0) - (f0-5 (* (gp-0 s5-0 s4-0 a2-0 a3-0 (* f0-2 f0-2)) (nest-hunt-shake-amp (-> self effect-sphere)))) - ) + (let ((f0-5 (* (lerp-scale + 819.2 + 0.0 + (vector-vector-distance-squared (-> self launch-position) (target-pos 0)) + (square 204800.0) + (square 2048000.0) + ) + (nest-hunt-shake-amp (-> self effect-sphere)) + ) + ) + ) (activate! *camera-smush-control* f0-5 37 600 1.0 1.1 (-> *display* camera-clock)) ) (init! (-> self out-of-ground-crater) (-> self launch-position) 32768.0) @@ -2229,7 +2185,7 @@ (-> self launch-position) ) (set! (-> self rumble-sound-playing) #t) - (let ((f30-1 (* f30-0 f30-0))) + (let ((f30-1 (square f30-0))) (sound-play-by-name (static-sound-name "cent-ground") (-> self ground-sound) @@ -2267,15 +2223,18 @@ (quaternion-set! (-> self root quat) 0.0 (-> gp-1 x) 0.0 (+ 1.0 (-> gp-1 z))) ) (quaternion-normalize! (-> self root quat)) - (let* ((gp-2 lerp-scale) - (s5-0 1638.4) - (s4-0 0.0) - (a2-1 (vector-vector-distance-squared (-> self launch-position) (target-pos 0))) - (f0-4 204800.0) - (a3-1 (* f0-4 f0-4)) - (f0-6 2048000.0) - (f30-1 (* (gp-2 s5-0 s4-0 a2-1 a3-1 (* f0-6 f0-6)) (nest-hunt-shake-amp (-> self effect-sphere)))) - ) + (let ((f30-1 + (* (lerp-scale + 1638.4 + 0.0 + (vector-vector-distance-squared (-> self launch-position) (target-pos 0)) + (square 204800.0) + (square 2048000.0) + ) + (nest-hunt-shake-amp (-> self effect-sphere)) + ) + ) + ) (set-zero! *camera-smush-control*) (activate! *camera-smush-control* f30-1 75 900 1.1 1.07 (-> *display* camera-clock)) ) @@ -2431,15 +2390,17 @@ (-> self landing-position) ) (set! (-> self ground-sound-playing) #t) - (let* ((gp-5 lerp-scale) - (s5-6 1638.4) - (s4-6 0.0) - (a2-9 (vector-vector-distance-squared (-> self landing-position) (target-pos 0))) - (f0-33 204800.0) - (a3-7 (* f0-33 f0-33)) - (f0-35 2048000.0) - (f30-8 (* (gp-5 s5-6 s4-6 a2-9 a3-7 (* f0-35 f0-35)) (nest-hunt-shake-amp (-> self effect-sphere)))) - ) + (let ((f30-8 (* (lerp-scale + 1638.4 + 0.0 + (vector-vector-distance-squared (-> self landing-position) (target-pos 0)) + (square 204800.0) + (square 2048000.0) + ) + (nest-hunt-shake-amp (-> self effect-sphere)) + ) + ) + ) (set-zero! *camera-smush-control*) (activate! *camera-smush-control* f30-8 60 600 0.995 1.07 (-> *display* camera-clock)) ) @@ -2538,15 +2499,18 @@ (nest-hunt-play-speech 0 (-> self effect-sphere)) (set-time! (-> self state-time)) (vector-copy! (-> self root trans) (-> self launch-position)) - (let* ((gp-0 lerp-scale) - (s5-0 1638.4) - (s4-0 0.0) - (a2-0 (vector-vector-distance-squared (-> self launch-position) (target-pos 0))) - (f0-0 204800.0) - (a3-0 (* f0-0 f0-0)) - (f0-2 2048000.0) - (f30-1 (* (gp-0 s5-0 s4-0 a2-0 a3-0 (* f0-2 f0-2)) (nest-hunt-shake-amp (-> self effect-sphere)))) - ) + (let ((f30-1 + (* (lerp-scale + 1638.4 + 0.0 + (vector-vector-distance-squared (-> self launch-position) (target-pos 0)) + (square 204800.0) + (square 2048000.0) + ) + (nest-hunt-shake-amp (-> self effect-sphere)) + ) + ) + ) (set-zero! *camera-smush-control*) (activate! *camera-smush-control* f30-1 75 900 1.1 1.07 (-> *display* camera-clock)) ) @@ -2716,15 +2680,17 @@ (-> self landing-position) ) (set! (-> self ground-sound-playing) #t) - (let* ((gp-7 lerp-scale) - (s5-6 1638.4) - (s4-6 0.0) - (a2-10 (vector-vector-distance-squared (-> self landing-position) (target-pos 0))) - (f0-43 204800.0) - (a3-8 (* f0-43 f0-43)) - (f0-45 2048000.0) - (f30-9 (* (gp-7 s5-6 s4-6 a2-10 a3-8 (* f0-45 f0-45)) (nest-hunt-shake-amp (-> self effect-sphere)))) - ) + (let ((f30-9 (* (lerp-scale + 1638.4 + 0.0 + (vector-vector-distance-squared (-> self landing-position) (target-pos 0)) + (square 204800.0) + (square 2048000.0) + ) + (nest-hunt-shake-amp (-> self effect-sphere)) + ) + ) + ) (set-zero! *camera-smush-control*) (activate! *camera-smush-control* f30-9 60 600 0.995 1.07 (-> *display* camera-clock)) ) @@ -2832,15 +2798,18 @@ ) ) (set-time! (-> self state-time)) - (let* ((gp-0 lerp-scale) - (s5-0 1638.4) - (s4-0 0.0) - (a2-1 (vector-vector-distance-squared (-> self launch-position) (target-pos 0))) - (f0-0 204800.0) - (a3-0 (* f0-0 f0-0)) - (f0-2 2048000.0) - (f30-1 (* (gp-0 s5-0 s4-0 a2-1 a3-0 (* f0-2 f0-2)) (nest-hunt-shake-amp (-> self effect-sphere)))) - ) + (let ((f30-1 + (* (lerp-scale + 1638.4 + 0.0 + (vector-vector-distance-squared (-> self launch-position) (target-pos 0)) + (square 204800.0) + (square 2048000.0) + ) + (nest-hunt-shake-amp (-> self effect-sphere)) + ) + ) + ) (set-zero! *camera-smush-control*) (activate! *camera-smush-control* f30-1 75 900 1.1 1.07 (-> *display* camera-clock)) ) @@ -3012,7 +2981,6 @@ ;; WARN: Return type mismatch int vs object. (defmethod init-from-entity! ((this mh-centipede) (arg0 entity-actor)) "Set up a newly created process from the entity that created it." - (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) @@ -3167,8 +3135,9 @@ ) (set! (-> this current-anim) (-> this breach-anims 0)) (set! (-> this appearance-order) 0) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-74 (res-lump-data arg0 'actor-groups (pointer actor-group) :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-74 (res-lump-data arg0 'actor-groups (pointer actor-group) :tag-ptr (& sv-16))) + ) (cond ((and v1-74 (nonzero? (-> sv-16 elt-count))) (let ((v1-75 (-> v1-74 0))) @@ -3452,19 +3421,19 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defmethod init-actor-group! ((this task-manager-mh-centipede)) - (local-vars (sv-16 res-tag)) (let* ((s5-0 "mh-centipede-7") (a0-2 (entity-by-name s5-0)) ) (cond (a0-2 (set! (-> this manager-entity) (the-as entity-actor a0-2)) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-1 (res-lump-data a0-2 'actor-groups pointer :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-1 (res-lump-data a0-2 'actor-groups (pointer actor-group) :tag-ptr (& sv-16))) + ) (cond ((and v1-1 (nonzero? (-> sv-16 elt-count))) (set! (-> this actor-group-count) (the-as int (-> sv-16 elt-count))) - (set! (-> this actor-group) (the-as (pointer actor-group) v1-1)) + (set! (-> this actor-group) v1-1) ) (else (format 0 "ERROR: ~S: ~S entity missing actor-group!~%" (game-task->string (-> this node-info task)) s5-0) @@ -3597,3 +3566,7 @@ (set-setting! 'goggles 'abs 1.0 0) (none) ) + + + + diff --git a/test/decompiler/reference/jak3/levels/nest/nst-obs_REF.gc b/test/decompiler/reference/jak3/levels/nest/nst-obs_REF.gc index dc216771d3..dc25aa8650 100644 --- a/test/decompiler/reference/jak3/levels/nest/nst-obs_REF.gc +++ b/test/decompiler/reference/jak3/levels/nest/nst-obs_REF.gc @@ -198,14 +198,14 @@ ;; INFO: Used lq/sq (defmethod init-from-entity! ((this nst-metalhead-eggs) (arg0 entity-actor)) "Set up a newly created process from the entity that created it." - (local-vars (sv-16 res-tag)) (init-collision! this) (process-drawable-from-entity! this arg0) (init-skel-and-jcontrol! this) (set! (-> this notify-actor) (entity-actor-lookup arg0 'alt-actor 0)) (set! (-> this root pause-adjust-distance) 204800.0) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-7 (res-lump-data (-> this entity) 'actor-groups pointer :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-7 (res-lump-data (-> this entity) 'actor-groups pointer :tag-ptr (& sv-16))) + ) (if (and v1-7 (= (-> sv-16 elt-count) 1)) (set! (-> this actor-group) (the-as actor-group (-> (the-as (pointer uint32) v1-7)))) (set! (-> this actor-group) #f) @@ -1106,7 +1106,6 @@ ;; INFO: Used lq/sq (defmethod init-from-entity! ((this nst-falling-stone-bridge) (arg0 entity-actor)) "Set up a newly created process from the entity that created it." - (local-vars (sv-16 res-tag)) (stack-size-set! (-> this main-thread) 512) (let ((t9-1 (method-of-type nst-bridge-base init-from-entity!))) (t9-1 this arg0) @@ -1135,8 +1134,9 @@ (set! (-> this fall-anim) 3) ) ) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-10 (res-lump-data (-> this entity) 'actor-groups pointer :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-10 (res-lump-data (-> this entity) 'actor-groups pointer :tag-ptr (& sv-16))) + ) (if (and v1-10 (= (-> sv-16 elt-count) 1)) (set! (-> this actor-group) (the-as actor-group (-> (the-as (pointer uint32) v1-10)))) (set! (-> this actor-group) #f) @@ -1377,7 +1377,6 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defmethod init-collision! ((this nst-collapsing-stone-bridge)) - (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) @@ -1439,29 +1438,29 @@ (s2-0 (-> 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 (-> s3-0 car)) @@ -2170,7 +2169,6 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch sound-id vs none. (defmethod fire-shot! ((this nst-cocoon-a) (arg0 symbol)) - (local-vars (sv-192 int) (sv-208 int) (sv-224 (function vector vector float))) (let ((s3-0 (new 'stack-no-clear 'traj2d-params)) (s5-0 (new 'stack-no-clear 'vector)) ) @@ -2182,21 +2180,18 @@ (s1-0 -1) (s2-0 (new 'stack-no-clear 'projectile-init-by-other-params)) ) - (let ((s0-0 (-> *nst-cocoon-a-goop-joints* length))) - (set! sv-192 0) - (set! sv-208 (-> *nst-cocoon-a-goop-joints* sv-192)) + (let* ((s0-0 (-> *nst-cocoon-a-goop-joints* length)) + (sv-192 0) + (sv-208 (-> *nst-cocoon-a-goop-joints* sv-192)) + ) (while (< sv-192 s0-0) - (set! sv-224 vector-vector-xz-distance) - (let* ((a0-8 (target-pos 0)) - (a1-3 (-> this node-list data sv-208 bone transform trans)) - (f0-4 (sv-224 a0-8 a1-3)) - ) + (let ((f0-4 (vector-vector-xz-distance (target-pos 0) (-> this node-list data sv-208 bone transform trans)))) (when (< f0-4 f30-0) (set! f30-0 f0-4) (set! s1-0 sv-208) ) ) - (set! sv-192 (+ sv-192 1)) + (+! sv-192 1) (set! sv-208 (-> *nst-cocoon-a-goop-joints* sv-192)) ) ) diff --git a/test/decompiler/reference/jak3/levels/precursor/precura-obs2_REF.gc b/test/decompiler/reference/jak3/levels/precursor/precura-obs2_REF.gc index 765e29822c..6f73352d34 100644 --- a/test/decompiler/reference/jak3/levels/precursor/precura-obs2_REF.gc +++ b/test/decompiler/reference/jak3/levels/precursor/precura-obs2_REF.gc @@ -586,8 +586,7 @@ 0.0 (let ((f30-0 (vector-length arg3))) 0.0 - (let* ((f0-5 (fabs (vector-dot (-> arg0 surface-normal) *up-vector*))) - (f0-6 (* f0-5 f0-5)) + (let* ((f0-6 (square (fabs (vector-dot (-> arg0 surface-normal) *up-vector*)))) (f0-7 (- 1.0 f0-6)) ) (vector-copy! s3-0 (-> arg0 surface-normal)) @@ -1608,72 +1607,73 @@ ;; definition for method 24 of type precur-laser-beam ;; INFO: Used lq/sq (defmethod fire-beam ((this precur-laser-beam) (arg0 vector) (arg1 vector)) - (local-vars (sv-560 collide-query) (sv-564 float)) - (set! sv-560 (new 'stack-no-clear 'collide-query)) - (set! sv-564 83968.0) - (vector-copy! (-> sv-560 start-pos) arg0) - (vector-normalize-copy! arg1 arg1 sv-564) - (vector-normalize-copy! (-> sv-560 move-dist) arg1 sv-564) - (let ((v1-5 sv-560)) - (set! (-> v1-5 radius) 40.96) - (set! (-> v1-5 collide-with) (collide-spec backgnd)) - (set! (-> v1-5 ignore-process0) #f) - (set! (-> v1-5 ignore-process1) #f) - (set! (-> v1-5 ignore-pat) - (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) + (let ((sv-560 (new 'stack-no-clear 'collide-query))) + (let ((sv-564 83968.0)) + (vector-copy! (-> sv-560 start-pos) arg0) + (vector-normalize-copy! arg1 arg1 sv-564) + (vector-normalize-copy! (-> sv-560 move-dist) arg1 sv-564) + (let ((v1-5 sv-560)) + (set! (-> v1-5 radius) 40.96) + (set! (-> v1-5 collide-with) (collide-spec backgnd)) + (set! (-> v1-5 ignore-process0) #f) + (set! (-> v1-5 ignore-process1) #f) + (set! (-> v1-5 ignore-pat) + (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) + ) + (set! (-> v1-5 action-mask) (collide-action solid)) + ) + (let ((f0-4 (fill-and-probe-using-line-sphere *collide-cache* sv-560))) + (cond + ((>= f0-4 0.0) + (vector-float*! (-> sv-560 move-dist) (-> sv-560 move-dist) f0-4) + (set! sv-564 (* sv-564 f0-4)) + ) + (else + (set! (-> sv-560 best-other-tri collide-ptr) #f) + ) ) - (set! (-> v1-5 action-mask) (collide-action solid)) - ) - (let ((f0-4 (fill-and-probe-using-line-sphere *collide-cache* sv-560))) - (cond - ((>= f0-4 0.0) - (vector-float*! (-> sv-560 move-dist) (-> sv-560 move-dist) f0-4) - (set! sv-564 (* sv-564 f0-4)) - ) - (else - (set! (-> sv-560 best-other-tri collide-ptr) #f) ) - ) - ) - (set! (-> *part-id-table* 4452 init-specs 4 initial-valuef) sv-564) - (draw-beam (-> *part-id-table* 4452) arg0 arg1 #t) - (let ((v1-19 sv-560)) - (set! (-> v1-19 radius) 40.96) - (set! (-> v1-19 collide-with) (collide-spec jak enemy player-list)) - (set! (-> v1-19 ignore-process0) #f) - (set! (-> v1-19 ignore-process1) #f) - (set! (-> v1-19 ignore-pat) - (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) + (set! (-> *part-id-table* 4452 init-specs 4 initial-valuef) sv-564) + (draw-beam (-> *part-id-table* 4452) arg0 arg1 #t) + (let ((v1-19 sv-560)) + (set! (-> v1-19 radius) 40.96) + (set! (-> v1-19 collide-with) (collide-spec jak enemy player-list)) + (set! (-> v1-19 ignore-process0) #f) + (set! (-> v1-19 ignore-process1) #f) + (set! (-> v1-19 ignore-pat) + (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) + ) + (set! (-> v1-19 action-mask) (collide-action solid)) + ) + (let ((f30-0 (fill-and-probe-using-line-sphere *collide-cache* sv-560)) + (s3-0 (new 'stack-no-clear 'vector)) + ) + (vector-! s3-0 (target-pos 0) arg0) + (set! (-> s3-0 y) 0.0) + (vector-normalize! s3-0 1.0) + (when (and (>= f30-0 0.0) + (>= (the-as uint (- (current-time) (the-as int (-> this last-attack-time)))) (the-as uint 600)) + ) + (elec-mech s3-0 (-> this attack-id)) + (set! (-> this last-attack-time) (the-as uint (current-time))) ) - (set! (-> v1-19 action-mask) (collide-action solid)) - ) - (let ((f30-0 (fill-and-probe-using-line-sphere *collide-cache* sv-560)) - (s3-0 (new 'stack-no-clear 'vector)) ) - (vector-! s3-0 (target-pos 0) arg0) - (set! (-> s3-0 y) 0.0) - (vector-normalize! s3-0 1.0) - (when (and (>= f30-0 0.0) - (>= (the-as uint (- (current-time) (the-as int (-> this last-attack-time)))) (the-as uint 600)) - ) - (elec-mech s3-0 (-> this attack-id)) - (set! (-> this last-attack-time) (the-as uint (current-time))) + (vector-float*! arg1 arg1 -1.0) + (vector-normalize-copy! (-> sv-560 move-dist) arg1 sv-564) ) - ) - (vector-float*! arg1 arg1 -1.0) - (vector-normalize-copy! (-> sv-560 move-dist) arg1 sv-564) - (let ((f30-1 (fill-and-probe-using-line-sphere *collide-cache* sv-560)) - (s3-1 (new 'stack-no-clear 'vector)) + (let ((f30-1 (fill-and-probe-using-line-sphere *collide-cache* sv-560)) + (s3-1 (new 'stack-no-clear 'vector)) + ) + (vector-! s3-1 (target-pos 0) arg0) + (set! (-> s3-1 y) 0.0) + (vector-normalize! s3-1 1.0) + (when (and (>= f30-1 0.0) + (>= (the-as uint (- (current-time) (the-as int (-> this last-attack-time)))) (the-as uint 600)) + ) + (format 0 "attack-time: ~d~%" (-> this last-attack-time)) + (elec-mech s3-1 (-> this attack-id)) + (set! (-> this last-attack-time) (the-as uint (current-time))) ) - (vector-! s3-1 (target-pos 0) arg0) - (set! (-> s3-1 y) 0.0) - (vector-normalize! s3-1 1.0) - (when (and (>= f30-1 0.0) - (>= (the-as uint (- (current-time) (the-as int (-> this last-attack-time)))) (the-as uint 600)) - ) - (format 0 "attack-time: ~d~%" (-> this last-attack-time)) - (elec-mech s3-1 (-> this attack-id)) - (set! (-> this last-attack-time) (the-as uint (current-time))) ) ) (draw-beam (-> *part-id-table* 4452) arg0 arg1 #t) @@ -1685,60 +1685,61 @@ ;; WARN: Return type mismatch (pointer process) vs none. (defmethod fire-beam0 ((this precur-laser-beam) (arg0 vector) (arg1 vector)) "Unused." - (local-vars (sv-560 collide-query) (sv-564 float)) - (set! sv-560 (new 'stack-no-clear 'collide-query)) - (set! sv-564 83968.0) - (vector-copy! (-> sv-560 start-pos) arg0) - (vector-float*! (-> sv-560 move-dist) arg1 sv-564) - (let ((v1-7 sv-560)) - (set! (-> v1-7 radius) 40.96) - (set! (-> v1-7 collide-with) (collide-spec backgnd)) - (set! (-> v1-7 ignore-process0) #f) - (set! (-> v1-7 ignore-process1) #f) - (set! (-> v1-7 ignore-pat) - (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) + (let ((sv-560 (new 'stack-no-clear 'collide-query)) + (sv-564 83968.0) + ) + (vector-copy! (-> sv-560 start-pos) arg0) + (vector-float*! (-> sv-560 move-dist) arg1 sv-564) + (let ((v1-7 sv-560)) + (set! (-> v1-7 radius) 40.96) + (set! (-> v1-7 collide-with) (collide-spec backgnd)) + (set! (-> v1-7 ignore-process0) #f) + (set! (-> v1-7 ignore-process1) #f) + (set! (-> v1-7 ignore-pat) + (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) + ) + (set! (-> v1-7 action-mask) (collide-action solid)) + ) + (let ((f0-3 (fill-and-probe-using-line-sphere *collide-cache* sv-560))) + (cond + ((>= f0-3 0.0) + (vector-float*! (-> sv-560 move-dist) (-> sv-560 move-dist) f0-3) + (set! sv-564 (* sv-564 f0-3)) + ) + (else + (set! (-> sv-560 best-other-tri collide-ptr) #f) ) - (set! (-> v1-7 action-mask) (collide-action solid)) - ) - (let ((f0-3 (fill-and-probe-using-line-sphere *collide-cache* sv-560))) - (cond - ((>= f0-3 0.0) - (vector-float*! (-> sv-560 move-dist) (-> sv-560 move-dist) f0-3) - (set! sv-564 (* sv-564 f0-3)) - ) - (else - (set! (-> sv-560 best-other-tri collide-ptr) #f) ) ) - ) - (set! (-> *part-id-table* 4452 init-specs 4 initial-valuef) sv-564) - (let ((s3-0 (new 'stack-no-clear 'vector)) - (s4-0 (new 'stack-no-clear 'matrix)) - ) - (vector+float*! s3-0 arg0 arg1 sv-564) - (matrix-f-compose s4-0 arg1) - (vector-copy! (-> s4-0 trans) s3-0) - (if (logtest? (-> group-placeholder-single-laser flags) (sp-group-flag sp13)) - (part-tracker-spawn - part-tracker-subsampler - :to *entity-pool* - :group group-placeholder-single-laser - :mat-joint s4-0 + (set! (-> *part-id-table* 4452 init-specs 4 initial-valuef) sv-564) + (let ((s3-0 (new 'stack-no-clear 'vector)) + (s4-0 (new 'stack-no-clear 'matrix)) ) - (part-tracker-spawn part-tracker :to *entity-pool* :group group-placeholder-single-laser :mat-joint s4-0) - ) - (vector+float*! s3-0 arg0 arg1 (- sv-564)) - (matrix-f-compose s4-0 (vector-float*! (new 'stack-no-clear 'vector) arg1 -1.0)) - (vector-copy! (-> s4-0 trans) s3-0) - (if (logtest? (-> group-placeholder-single-laser flags) (sp-group-flag sp13)) - (part-tracker-spawn - part-tracker-subsampler - :to *entity-pool* - :group group-placeholder-single-laser - :mat-joint s4-0 + (vector+float*! s3-0 arg0 arg1 sv-564) + (matrix-f-compose s4-0 arg1) + (vector-copy! (-> s4-0 trans) s3-0) + (if (logtest? (-> group-placeholder-single-laser flags) (sp-group-flag sp13)) + (part-tracker-spawn + part-tracker-subsampler + :to *entity-pool* + :group group-placeholder-single-laser + :mat-joint s4-0 + ) + (part-tracker-spawn part-tracker :to *entity-pool* :group group-placeholder-single-laser :mat-joint s4-0) ) - (part-tracker-spawn part-tracker :to *entity-pool* :group group-placeholder-single-laser :mat-joint s4-0) - ) + (vector+float*! s3-0 arg0 arg1 (- sv-564)) + (matrix-f-compose s4-0 (vector-float*! (new 'stack-no-clear 'vector) arg1 -1.0)) + (vector-copy! (-> s4-0 trans) s3-0) + (if (logtest? (-> group-placeholder-single-laser flags) (sp-group-flag sp13)) + (part-tracker-spawn + part-tracker-subsampler + :to *entity-pool* + :group group-placeholder-single-laser + :mat-joint s4-0 + ) + (part-tracker-spawn part-tracker :to *entity-pool* :group group-placeholder-single-laser :mat-joint s4-0) + ) + ) ) (none) ) @@ -1781,9 +1782,9 @@ ) ) :code (behavior () - (local-vars (sv-16 res-tag)) - (set! sv-16 (new 'static 'res-tag)) - (let ((gp-0 (res-lump-data (-> self entity) 'actor-groups pointer :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (gp-0 (res-lump-data (-> self entity) 'actor-groups pointer :tag-ptr (& sv-16))) + ) (cond ((and gp-0 (nonzero? (-> sv-16 elt-count))) (suspend-for (seconds 1) @@ -2052,20 +2053,18 @@ (if (and (movie?) (not (-> this movie-played?))) (set! (-> this movie-played?) #t) ) - (let ((f0-14 (vector-vector-distance-squared (target-pos 0) *precura-continue2-sphere*)) - (f1-5 (-> *precura-continue2-sphere* r)) - ) - (if (and (< f0-14 (* f1-5 f1-5)) (not (task-node-closed? (game-task-node precursor-destroy-ship-escape)))) - (task-node-close! (game-task-node precursor-destroy-ship-escape) 'event) - ) - ) + (if (and (< (vector-vector-distance-squared (target-pos 0) *precura-continue2-sphere*) + (square (-> *precura-continue2-sphere* r)) + ) + (not (task-node-closed? (game-task-node precursor-destroy-ship-escape))) + ) + (task-node-close! (game-task-node precursor-destroy-ship-escape) 'event) + ) (when (and (not (time-elapsed? (-> this start-time) (seconds 1))) (< (seconds 150) (-> this time-limit)) - (let ((f0-15 (vector-vector-distance-squared (target-pos 0) *precura-continue-sphere*)) - (f1-8 (-> *precura-continue-sphere* r)) - ) - (< f0-15 (* f1-8 f1-8)) - ) + (< (vector-vector-distance-squared (target-pos 0) *precura-continue-sphere*) + (square (-> *precura-continue-sphere* r)) + ) ) (set! (-> this time-limit) (seconds 150)) (send-event (process-by-name "dp-bipedal-104" *active-pool*) 'die-fast) @@ -2156,81 +2155,78 @@ (arg5 int) (arg6 float) ) - (local-vars - (sv-624 (pointer lightning-tracker)) - (sv-640 float) - (sv-656 matrix) - (sv-672 collide-query) - (sv-688 symbol) - (sv-704 vector) - (sv-720 int) - (sv-736 process) - ) - (set! sv-640 arg6) - (let ((s5-0 *lightning-probe-vars*)) - (set! sv-656 (new 'stack-no-clear 'matrix)) - (set! sv-672 (new 'stack-no-clear 'collide-query)) - (set! sv-688 (the-as symbol #f)) - (vector-copy! (-> sv-672 start-pos) arg4) - (set! sv-704 (-> sv-672 move-dist)) - (set! (-> sv-704 x) (rand-vu-float-range 0.0 65536.0)) - (set! (-> sv-704 y) (rand-vu-float-range 0.0 65536.0)) - (set! (-> sv-704 z) (rand-vu-float-range 0.0 65536.0)) - (set! (-> sv-704 w) 1.0) - (matrix-rotate-zyx! sv-656 (-> sv-672 move-dist)) - (set! sv-720 6) - (while (nonzero? sv-720) - (set! sv-720 (+ sv-720 -1)) - (vector-rotate*! (-> sv-672 move-dist) (-> s5-0 probe-dirs sv-720) sv-656) - (vector-normalize! (-> sv-672 move-dist) sv-640) - (let ((v1-18 sv-672)) - (set! (-> v1-18 radius) 409.6) - (set! (-> v1-18 collide-with) (collide-spec backgnd crate obstacle hit-by-others-list pusher)) - (set! (-> v1-18 ignore-process0) arg0) - (set! (-> v1-18 ignore-process1) #f) - (set! (-> v1-18 ignore-pat) - (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) - ) - (set! (-> v1-18 action-mask) (collide-action solid)) + (let ((sv-640 arg6) + (s5-0 *lightning-probe-vars*) + (sv-656 (new 'stack-no-clear 'matrix)) + (sv-672 (new 'stack-no-clear 'collide-query)) + (sv-688 (the-as symbol #f)) ) - (when (>= (fill-and-probe-using-line-sphere *collide-cache* sv-672) 0.0) - (set-time! (-> s5-0 last-valid-time)) - (vector-copy! (-> s5-0 end-pos) (-> sv-672 best-other-tri intersect)) - (when (< 8192.0 (vector-vector-distance (-> s5-0 end-pos) (-> sv-672 start-pos))) - (set! sv-688 #t) - (goto cfg-7) + (vector-copy! (-> sv-672 start-pos) arg4) + (let ((sv-704 (-> sv-672 move-dist))) + (set! (-> sv-704 x) (rand-vu-float-range 0.0 65536.0)) + (set! (-> sv-704 y) (rand-vu-float-range 0.0 65536.0)) + (set! (-> sv-704 z) (rand-vu-float-range 0.0 65536.0)) + (set! (-> sv-704 w) 1.0) + ) + (matrix-rotate-zyx! sv-656 (-> sv-672 move-dist)) + (let ((sv-720 6)) + (while (nonzero? sv-720) + (+! sv-720 -1) + (vector-rotate*! (-> sv-672 move-dist) (-> s5-0 probe-dirs sv-720) sv-656) + (vector-normalize! (-> sv-672 move-dist) sv-640) + (let ((v1-18 sv-672)) + (set! (-> v1-18 radius) 409.6) + (set! (-> v1-18 collide-with) (collide-spec backgnd crate obstacle hit-by-others-list pusher)) + (set! (-> v1-18 ignore-process0) arg0) + (set! (-> v1-18 ignore-process1) #f) + (set! (-> v1-18 ignore-pat) + (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) + ) + (set! (-> v1-18 action-mask) (collide-action solid)) + ) + (when (>= (fill-and-probe-using-line-sphere *collide-cache* sv-672) 0.0) + (set-time! (-> s5-0 last-valid-time)) + (vector-copy! (-> s5-0 end-pos) (-> sv-672 best-other-tri intersect)) + (when (< 8192.0 (vector-vector-distance (-> s5-0 end-pos) (-> sv-672 start-pos))) + (set! sv-688 #t) + (goto cfg-7) + ) ) ) ) (label cfg-7) (when sv-688 - (set! sv-736 (get-process *default-dead-pool* lightning-tracker #x4000 0)) - (set! sv-624 - (the-as - (pointer lightning-tracker) - (when sv-736 - (let ((t9-9 (method-of-type lightning-tracker activate))) - (t9-9 (the-as lightning-tracker sv-736) arg0 "lightning-tracker" (the-as pointer #x70004000)) + (let* ((sv-736 (get-process *default-dead-pool* lightning-tracker #x4000 0)) + (sv-624 (the-as + (pointer lightning-tracker) + (when sv-736 + ((method-of-type lightning-tracker activate) + (the-as lightning-tracker sv-736) + arg0 + "lightning-tracker" + (the-as pointer #x70004000) + ) + (run-now-in-process sv-736 lightning-tracker-init arg1 arg5 arg2 arg0 arg4 (-> s5-0 end-pos)) + (-> sv-736 ppointer) + ) + ) + ) + ) + (when sv-624 + (set! (-> sv-624 0 user-time 0) 0) + (when arg3 + (let ((v1-46 (get-field-spec-by-id arg3 (sp-field-id spt-timer)))) + (if v1-46 + (set! (-> v1-46 initial-valuef) (the-as float (-> sv-624 0 duration))) ) - (run-now-in-process sv-736 lightning-tracker-init arg1 arg5 arg2 arg0 arg4 (-> s5-0 end-pos)) - (-> sv-736 ppointer) - ) ) - ) - (when sv-624 - (set! (-> sv-624 0 user-time 0) 0) - (when arg3 - (let ((v1-46 (get-field-spec-by-id arg3 (sp-field-id spt-timer)))) - (if v1-46 - (set! (-> v1-46 initial-valuef) (the-as float (-> sv-624 0 duration))) - ) - ) - (let ((t9-12 sp-launch-particles-var) - (a0-26 *sp-particle-system-2d*) - (a2-5 *launch-matrix*) - ) - (vector-copy! (-> a2-5 trans) (-> s5-0 end-pos)) - (t9-12 a0-26 arg3 a2-5 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0) + (let ((t9-12 sp-launch-particles-var) + (a0-26 *sp-particle-system-2d*) + (a2-5 *launch-matrix*) + ) + (vector-copy! (-> a2-5 trans) (-> s5-0 end-pos)) + (t9-12 a0-26 arg3 a2-5 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0) + ) ) ) ) @@ -2484,32 +2480,34 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch time-frame vs none. (defmethod probe-for-player-collision ((this precur-path) (arg0 vector) (arg1 vector)) - (local-vars (sv-576 collide-query) (sv-580 vector) (sv-584 float)) - (set! sv-576 (new 'stack-no-clear 'collide-query)) - (set! sv-580 (vector-! (new 'stack-no-clear 'vector) arg1 arg0)) - (set! sv-584 (vector-vector-distance arg0 arg1)) - (vector-copy! (-> sv-576 start-pos) arg0) - (vector-normalize-copy! (-> sv-576 move-dist) sv-580 sv-584) - (let ((v1-5 sv-576)) - (set! (-> v1-5 radius) 40.96) - (set! (-> v1-5 collide-with) (collide-spec jak enemy player-list)) - (set! (-> v1-5 ignore-process0) #f) - (set! (-> v1-5 ignore-process1) #f) - (set! (-> v1-5 ignore-pat) - (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) + (let ((sv-576 (new 'stack-no-clear 'collide-query))) + (let ((sv-580 (vector-! (new 'stack-no-clear 'vector) arg1 arg0)) + (sv-584 (vector-vector-distance arg0 arg1)) ) - (set! (-> v1-5 action-mask) (collide-action solid)) - ) - (let ((f30-0 (fill-and-probe-using-line-sphere *collide-cache* sv-576)) - (s5-1 (new 'stack-no-clear 'vector)) + (vector-copy! (-> sv-576 start-pos) arg0) + (vector-normalize-copy! (-> sv-576 move-dist) sv-580 sv-584) + ) + (let ((v1-5 sv-576)) + (set! (-> v1-5 radius) 40.96) + (set! (-> v1-5 collide-with) (collide-spec jak enemy player-list)) + (set! (-> v1-5 ignore-process0) #f) + (set! (-> v1-5 ignore-process1) #f) + (set! (-> v1-5 ignore-pat) + (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) + ) + (set! (-> v1-5 action-mask) (collide-action solid)) + ) + (let ((f30-0 (fill-and-probe-using-line-sphere *collide-cache* sv-576)) + (s5-1 (new 'stack-no-clear 'vector)) + ) + (set! (-> s5-1 y) 0.0) + (vector-normalize! s5-1 1.0) + (when (and (>= f30-0 0.0) + (>= (the-as uint (- (current-time) (the-as int (-> this last-attack-time)))) (the-as uint 600)) + ) + (elec-mech s5-1 (-> this attack-id)) + (set! (-> this last-attack-time) (the-as uint (current-time))) ) - (set! (-> s5-1 y) 0.0) - (vector-normalize! s5-1 1.0) - (when (and (>= f30-0 0.0) - (>= (the-as uint (- (current-time) (the-as int (-> this last-attack-time)))) (the-as uint 600)) - ) - (elec-mech s5-1 (-> this attack-id)) - (set! (-> this last-attack-time) (the-as uint (current-time))) ) ) (none) diff --git a/test/decompiler/reference/jak3/levels/precursor/precura-obs_REF.gc b/test/decompiler/reference/jak3/levels/precursor/precura-obs_REF.gc index 7a89d5e226..723d518e30 100644 --- a/test/decompiler/reference/jak3/levels/precursor/precura-obs_REF.gc +++ b/test/decompiler/reference/jak3/levels/precursor/precura-obs_REF.gc @@ -497,7 +497,6 @@ ) ) :trans (behavior () - (local-vars (sv-128 symbol) (sv-144 vector)) (sound-play "prec-generator" :id (-> self sound-id) :position (-> self root trans)) (when (< (the-as time-frame (-> self next-lightning-time)) (current-time)) (process-drawable-shock-effect @@ -553,9 +552,9 @@ (s2-0 (-> *lightning-spec-id-table* 37)) (s1-0 90) (s0-0 #f) + (sv-128 (the-as symbol #f)) + (sv-144 (new 'stack-no-clear 'vector)) ) - (set! sv-128 (the-as symbol #f)) - (set! sv-144 (new 'stack-no-clear 'vector)) (set! (-> sv-144 x) (-> (target-pos 0) x)) (let* ((f30-0 (-> (target-pos 0) y)) (f28-0 4096.0) @@ -568,18 +567,16 @@ ) (set! (-> sv-144 z) (-> (target-pos 0) z)) (set! (-> sv-144 w) 1.0) - (let ((t3-0 (-> self root trans))) - ((the-as (function object object object object object object object object none) s5-2) - s4-0 - s3-0 - s2-0 - s1-0 - s0-0 - sv-128 - sv-144 - t3-0 - ) - ) + ((the-as (function object object object object object object object object none) s5-2) + s4-0 + s3-0 + s2-0 + s1-0 + s0-0 + sv-128 + sv-144 + (-> self root trans) + ) ) (-> gp-2 ppointer) ) @@ -1192,7 +1189,6 @@ ;; INFO: Used lq/sq (defmethod init-from-entity! ((this precur-generator-c) (arg0 entity-actor)) "Set up a newly created process from the entity that created it." - (local-vars (sv-16 res-tag)) (stack-size-set! (-> this main-thread) 512) (let ((s4-0 (new 'process 'collide-shape this (collide-list-enum usually-hit-by-player)))) (set! (-> s4-0 penetrated-by) (penetrate)) @@ -1227,12 +1223,13 @@ ) (set! (-> this next-lightning-time) (the-as uint 0)) (set! (-> this entity) arg0) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-19 (res-lump-data arg0 'actor-groups pointer :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-19 (res-lump-data arg0 'actor-groups (pointer actor-group) :tag-ptr (& sv-16))) + ) (cond ((and v1-19 (nonzero? (-> sv-16 elt-count))) (set! (-> this actor-group-count) (the-as int (-> sv-16 elt-count))) - (set! (-> this actor-group) (the-as (pointer actor-group) v1-19)) + (set! (-> this actor-group) v1-19) ) (else (format 0 "ERROR: entity missing actor-group!~%") @@ -1804,7 +1801,6 @@ ;; INFO: Used lq/sq (defmethod init-from-entity! ((this precur-generator-d) (arg0 entity-actor)) "Set up a newly created process from the entity that created it." - (local-vars (sv-16 res-tag)) (let ((s4-0 (new 'process 'collide-shape this (collide-list-enum usually-hit-by-player)))) (set! (-> s4-0 penetrated-by) (penetrate)) (let ((s3-0 (new 'process 'collide-shape-prim-group s4-0 (the-as uint 1) 0))) @@ -1839,12 +1835,13 @@ (set! (-> this entity) arg0) (set! (-> this sound-id) (new-sound-id)) (set! (-> this animation-speed) 0.5) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-18 (res-lump-data arg0 'actor-groups pointer :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-18 (res-lump-data arg0 'actor-groups (pointer actor-group) :tag-ptr (& sv-16))) + ) (cond ((and v1-18 (nonzero? (-> sv-16 elt-count))) (set! (-> this actor-group-count) (the-as int (-> sv-16 elt-count))) - (set! (-> this actor-group) (the-as (pointer actor-group) v1-18)) + (set! (-> this actor-group) v1-18) ) (else (format 0 "ERROR: entity missing actor-group!~%") @@ -2824,3 +2821,7 @@ (transform-post) ) ) + + + + diff --git a/test/decompiler/reference/jak3/levels/precursor/precurd-obs_REF.gc b/test/decompiler/reference/jak3/levels/precursor/precurd-obs_REF.gc index b46d81d36c..859965afb9 100644 --- a/test/decompiler/reference/jak3/levels/precursor/precurd-obs_REF.gc +++ b/test/decompiler/reference/jak3/levels/precursor/precurd-obs_REF.gc @@ -1377,7 +1377,6 @@ ;; INFO: Used lq/sq (defmethod init-from-entity! ((this precur-bridge-path-break) (arg0 entity-actor)) "Set up a newly created process from the entity that created it." - (local-vars (sv-16 res-tag)) (set-idx-by-name this) (init-collision! this) (process-drawable-from-entity! this arg0) @@ -1388,12 +1387,13 @@ ) (set! (-> this debris-handle) (the-as handle #f)) (precur-bridge-reset) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-13 (res-lump-data arg0 'actor-groups pointer :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-13 (res-lump-data arg0 'actor-groups (pointer actor-group) :tag-ptr (& sv-16))) + ) (cond ((and v1-13 (nonzero? (-> sv-16 elt-count))) (set! (-> this actor-group-count) (the-as int (-> sv-16 elt-count))) - (set! (-> this actor-group) (the-as (pointer actor-group) v1-13)) + (set! (-> this actor-group) v1-13) ) (else (format 0 "ERROR: ~S: entity missing actor-group!~%" (-> this name)) @@ -2523,3 +2523,7 @@ ) (go (method-of-object this idle)) ) + + + + diff --git a/test/decompiler/reference/jak3/levels/sewer/flyingsaw_REF.gc b/test/decompiler/reference/jak3/levels/sewer/flyingsaw_REF.gc index 3ce35943fd..c5df672492 100644 --- a/test/decompiler/reference/jak3/levels/sewer/flyingsaw_REF.gc +++ b/test/decompiler/reference/jak3/levels/sewer/flyingsaw_REF.gc @@ -309,26 +309,22 @@ (ja :num! (loop!)) (when (-> self graph) (let ((gp-0 (-> self graph node (-> self current-node)))) - (let ((f0-1 (vector-vector-distance-squared (-> self root trans) (-> gp-0 position))) - (f1-0 512.0) + (when (< (vector-vector-distance-squared (-> self root trans) (-> gp-0 position)) (square 512.0)) + (when (-> gp-0 make-spark) + (let ((s5-1 (vector-! (new 'stack-no-clear 'vector) (-> gp-0 spark) (-> gp-0 position)))) + (vector-normalize! s5-1 1.0) + (forward-down->inv-matrix (-> self spark-mat) s5-1 (new 'static 'vector :y -1.0)) ) - (when (< f0-1 (* f1-0 f1-0)) - (when (-> gp-0 make-spark) - (let ((s5-1 (vector-! (new 'stack-no-clear 'vector) (-> gp-0 spark) (-> gp-0 position)))) - (vector-normalize! s5-1 1.0) - (forward-down->inv-matrix (-> self spark-mat) s5-1 (new 'static 'vector :y -1.0)) - ) - (vector-copy! (-> self spark-mat trans) (-> gp-0 spark)) - (set-time! (-> self spark-timer)) - (sound-play "flysaw-hit-wall" :position (-> self root trans)) - ) - (+! (-> self current-node) 1) - (when (>= (-> self current-node) (-> self graph node-count)) - (set! (-> self current-node) (the-as uint 0)) - 0 - ) - (set! gp-0 (-> self graph node (-> self current-node))) + (vector-copy! (-> self spark-mat trans) (-> gp-0 spark)) + (set-time! (-> self spark-timer)) + (sound-play "flysaw-hit-wall" :position (-> self root trans)) ) + (+! (-> self current-node) 1) + (when (>= (-> self current-node) (-> self graph node-count)) + (set! (-> self current-node) (the-as uint 0)) + 0 + ) + (set! gp-0 (-> self graph node (-> self current-node))) ) (if (not (time-elapsed? (-> self spark-timer) (seconds 0.3))) (spawn-from-mat (-> self part) (-> self spark-mat)) diff --git a/test/decompiler/reference/jak3/levels/sewer/kg-hopper_REF.gc b/test/decompiler/reference/jak3/levels/sewer/kg-hopper_REF.gc index 2e8cf47e0d..dca5751c1d 100644 --- a/test/decompiler/reference/jak3/levels/sewer/kg-hopper_REF.gc +++ b/test/decompiler/reference/jak3/levels/sewer/kg-hopper_REF.gc @@ -661,7 +661,6 @@ ;; definition for method 191 of type kg-hopper ;; INFO: Used lq/sq (defmethod kg-hopper-method-191 ((this kg-hopper)) - (local-vars (sv-752 collide-query)) (+! (-> this step-num) -1) (cond ((>= (-> this step-num) 0) @@ -691,28 +690,29 @@ (when (not (check-sphere-blocked! (-> this nav) a1-4 #x10006c)) (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 'collide-query)) - (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-4 s1-0) - (t0-1 (vector-! (new 'stack-no-clear 'vector) v1-21 (the-as vector (-> s0-0 state mesh bounds)))) - ) - (t9-4 a0-10 s4-0 a2-4 (the-as vector sv-752) t0-1) - ) - (vector+! s1-0 s1-0 (the-as vector (-> s0-0 state mesh bounds))) + (let ((s2-0 (new 'stack-no-clear 'vector)) + (sv-752 (new 'stack-no-clear 'collide-query)) + (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 + (the-as vector sv-752) + (vector-! (new 'stack-no-clear 'vector) v1-21 (the-as vector (-> s0-0 state mesh bounds))) + ) + ) + (vector+! s1-0 s1-0 (the-as vector (-> 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)) + ) ) (vector-copy! (-> this best-point) s5-0) ) diff --git a/test/decompiler/reference/jak3/levels/sewer/mh-wasp_REF.gc b/test/decompiler/reference/jak3/levels/sewer/mh-wasp_REF.gc index 650b24a284..7d2a470124 100644 --- a/test/decompiler/reference/jak3/levels/sewer/mh-wasp_REF.gc +++ b/test/decompiler/reference/jak3/levels/sewer/mh-wasp_REF.gc @@ -1051,79 +1051,73 @@ (s5-0 (-> this main-joint-movement 2)) (gp-0 (lambda ((arg0 mh-wasp) (arg1 cspace) (arg2 float) (arg3 float) (arg4 vector) (arg5 vector) (arg6 int)) - (local-vars (sv-192 float) (sv-208 vector) (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 'vector)) - (let ((s2-1 (new 'stack-no-clear 'vector))) - (-> arg0 scale) - (quaternion-rotate-local-z! (the-as quaternion sv-208) a1-3 sv-192) - (quaternion->matrix s5-0 (the-as quaternion sv-208)) - (vector-copy! s2-1 (-> arg0 root scale)) - (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 (* 1638400.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 'vector)) + (s2-1 (new 'stack-no-clear 'vector)) + ) + (-> arg0 scale) + (quaternion-rotate-local-z! (the-as quaternion sv-208) a1-3 sv-192) + (quaternion->matrix s5-0 (the-as quaternion sv-208)) + (vector-copy! s2-1 (-> arg0 root scale)) + (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 (* 1638400.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* 5029 init-specs 4 initial-valuef) (* f20-0 f2-6)) - (set! (-> *part-id-table* 5029 init-specs 5 initial-valuef) (* f26-0 f0-15)) - (set! (-> *part-id-table* 5033 init-specs 3 initial-valuef) (* f22-0 f2-6)) - (set! (-> *part-id-table* 5030 init-specs 1 initial-valuef) (* f24-0 f0-15)) - (set! (-> *part-id-table* 5031 init-specs 1 initial-valuef) (* f1-10 f0-15)) - (set! (-> *part-id-table* 5032 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 uvec) (/ 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* 5029 init-specs 4 initial-valuef) (* f20-0 f2-6)) + (set! (-> *part-id-table* 5029 init-specs 5 initial-valuef) (* f26-0 f0-15)) + (set! (-> *part-id-table* 5033 init-specs 3 initial-valuef) (* f22-0 f2-6)) + (set! (-> *part-id-table* 5030 init-specs 1 initial-valuef) (* f24-0 f0-15)) + (set! (-> *part-id-table* 5031 init-specs 1 initial-valuef) (* f1-10 f0-15)) + (set! (-> *part-id-table* 5032 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 uvec) (/ f0-16 -2)) ) ) - (vector-copy! (-> s5-0 trans) s4-0) - (spawn-from-mat (-> 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) - (-> arg0 root trans) - ) - ) + ) + ) + (vector-copy! (-> s5-0 trans) s4-0) + (spawn-from-mat (-> 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) + (-> arg0 root trans) ) ) ) @@ -1348,7 +1342,6 @@ ;; WARN: Return type mismatch int vs none. (defmethod init-enemy! ((this mh-wasp)) "Typical place for shared init code. Runs from entity or process style init." - (local-vars (sv-16 res-tag) (sv-32 res-tag) (sv-48 res-tag) (sv-64 res-tag)) (hover-enemy-method-170 this) (setup-enemy! this (get-enemy-info this)) (hover-enemy-method-176 this) @@ -1365,15 +1358,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-29 (res-lump-data (-> this entity) 'actor-groups pointer :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-29 (res-lump-data (-> this entity) 'actor-groups pointer :tag-ptr (& sv-16))) + ) (if (and v1-29 (= (-> sv-16 elt-count) 1)) (set! (-> this entity-group) (the-as actor-group (-> (the-as (pointer uint32) v1-29)))) (set! (-> this entity-group) #f) ) ) - (set! sv-32 (new 'static 'res-tag)) - (let ((v1-33 (res-lump-data (-> this entity) 'timeout (pointer float) :tag-ptr (& sv-32)))) + (let* ((sv-32 (new 'static 'res-tag)) + (v1-33 (res-lump-data (-> this entity) 'timeout (pointer float) :tag-ptr (& sv-32))) + ) (cond ((and v1-33 (= (-> sv-32 elt-count) 2)) (set! (-> this attack-wait-min) (-> v1-33 0)) @@ -1385,27 +1380,27 @@ ) ) ) - (let ((f30-0 4096.0)) - (set! sv-48 (new 'static 'res-tag)) - (let ((v1-40 (res-lump-data (-> this entity) 'min-max pointer :tag-ptr (& sv-48)))) - (set! (-> this attack-miss-dist-min) (* f30-0 (if (and v1-40 (> (the-as int (-> sv-48 elt-count)) 0)) - (-> (the-as (pointer float) v1-40)) - -1.0 - ) - ) - ) - ) + (let* ((f30-0 4096.0) + (sv-48 (new 'static 'res-tag)) + (v1-40 (res-lump-data (-> this entity) 'min-max pointer :tag-ptr (& sv-48))) + ) + (set! (-> this attack-miss-dist-min) (* f30-0 (if (and v1-40 (> (the-as int (-> sv-48 elt-count)) 0)) + (-> (the-as (pointer float) v1-40)) + -1.0 + ) + ) + ) ) - (let ((f30-1 4096.0)) - (set! sv-64 (new 'static 'res-tag)) - (let ((v1-44 (res-lump-data (-> this entity) 'min-max (pointer float) :tag-ptr (& sv-64)))) - (set! (-> this attack-miss-dist-max) (* f30-1 (if (and v1-44 (< 1 (the-as int (-> sv-64 elt-count)))) - (-> v1-44 1) - 1.0 - ) - ) - ) - ) + (let* ((f30-1 4096.0) + (sv-64 (new 'static 'res-tag)) + (v1-44 (res-lump-data (-> this entity) 'min-max (pointer float) :tag-ptr (& sv-64))) + ) + (set! (-> this attack-miss-dist-max) (* f30-1 (if (and v1-44 (< 1 (the-as int (-> sv-64 elt-count)))) + (-> v1-44 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/jak3/levels/sewer/neo-juicer_REF.gc b/test/decompiler/reference/jak3/levels/sewer/neo-juicer_REF.gc index c221c5e0a8..d416df1bb5 100644 --- a/test/decompiler/reference/jak3/levels/sewer/neo-juicer_REF.gc +++ b/test/decompiler/reference/jak3/levels/sewer/neo-juicer_REF.gc @@ -806,11 +806,7 @@ ) ) (zero? (rnd-int 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)) ) (go-die this) (go (method-of-object this knocked)) diff --git a/test/decompiler/reference/jak3/levels/sewer/saberfish-spawner_REF.gc b/test/decompiler/reference/jak3/levels/sewer/saberfish-spawner_REF.gc index 9ecc694c83..742419f6fc 100644 --- a/test/decompiler/reference/jak3/levels/sewer/saberfish-spawner_REF.gc +++ b/test/decompiler/reference/jak3/levels/sewer/saberfish-spawner_REF.gc @@ -158,7 +158,6 @@ ;; INFO: Used lq/sq (defmethod init-from-entity! ((this saberfish-spawner) (arg0 entity-actor)) "Set up a newly created process from the entity that created it." - (local-vars (sv-16 res-tag)) (process-entity-set! this arg0) (set! (-> this root) (new 'process 'trsqv)) (process-drawable-from-entity! this arg0) @@ -192,15 +191,16 @@ (logior! (-> this jump-paths s5-2 flags) (path-control-flag display draw-line draw-point draw-text)) ) 0 - (set! sv-16 (new 'static 'res-tag)) - (res-lump-struct (-> this entity) 'nav-mesh-actor structure :tag-ptr (& sv-16)) - (let ((s5-3 (-> sv-16 elt-count))) - (set! (-> this nav-mesh-jumps) (new 'process 'nav-mesh-jump-array (the-as int s5-3))) - (dotimes (s4-1 (the-as int s5-3)) - (let ((v1-38 (nav-mesh-from-res-tag (-> this entity) 'nav-mesh-actor s4-1))) - (if v1-38 - (set! (-> this nav-mesh-jumps data s4-1 mesh) v1-38) - ) + (let ((sv-16 (new 'static 'res-tag))) + (res-lump-struct (-> this entity) 'nav-mesh-actor structure :tag-ptr (& sv-16)) + (let ((s5-3 (-> sv-16 elt-count))) + (set! (-> this nav-mesh-jumps) (new 'process 'nav-mesh-jump-array (the-as int s5-3))) + (dotimes (s4-1 (the-as int s5-3)) + (let ((v1-38 (nav-mesh-from-res-tag (-> this entity) 'nav-mesh-actor s4-1))) + (if v1-38 + (set! (-> this nav-mesh-jumps data s4-1 mesh) v1-38) + ) + ) ) ) ) @@ -426,35 +426,34 @@ ;; definition for method 22 of type saberfish-spawner (defmethod saberfish-spawner-method-22 ((this saberfish-spawner) (arg0 vector) (arg1 saberfish-find-behavior)) - (local-vars (sv-64 nav-poly) (sv-72 int) (sv-80 number) (sv-84 vector) (sv-88 symbol)) - (set! sv-64 (new 'stack-no-clear 'nav-poly)) - (set! sv-72 -1) - (set! sv-80 24576.0) - (set! sv-84 arg0) - (set! sv-88 (in-water<-find-behavior arg1)) - (set! (-> sv-64 data 20) (the-as uint 7)) - (dotimes (s4-0 (-> this nav-mesh-jumps length)) - (let ((a0-4 (-> this nav-mesh-jumps data s4-0 mesh))) - (when a0-4 - (when (or (= arg1 (saberfish-find-behavior none)) (= (-> this nav-mesh-jumps data s4-0 in-water?) sv-88)) - (vector-! (-> sv-64 vertex 0) sv-84 (the-as vector (-> a0-4 bounds))) - (let ((f0-1 (vector-length-squared (-> sv-64 vertex 0))) - (f1-0 (-> a0-4 bounds r)) - ) - (when (< f0-1 (* f1-0 f1-0)) - (set! (-> sv-64 vertex1 x) 409600.0) - (nav-mesh-method-46 a0-4 sv-64) - (when (>= (the-as float sv-80) (-> sv-64 vertex1 w)) - (set! sv-80 (-> sv-64 vertex1 w)) - (set! sv-72 s4-0) + (let ((sv-64 (new 'stack-no-clear 'nav-poly)) + (sv-72 -1) + ) + (let ((sv-80 24576.0) + (sv-84 arg0) + (sv-88 (in-water<-find-behavior arg1)) + ) + (set! (-> sv-64 data 20) (the-as uint 7)) + (dotimes (s4-0 (-> this nav-mesh-jumps length)) + (let ((a0-4 (-> this nav-mesh-jumps data s4-0 mesh))) + (when a0-4 + (when (or (= arg1 (saberfish-find-behavior none)) (= (-> this nav-mesh-jumps data s4-0 in-water?) sv-88)) + (vector-! (-> sv-64 vertex 0) sv-84 (the-as vector (-> a0-4 bounds))) + (when (< (vector-length-squared (-> sv-64 vertex 0)) (square (-> a0-4 bounds r))) + (set! (-> sv-64 vertex1 x) 409600.0) + (nav-mesh-method-46 a0-4 sv-64) + (when (>= (the-as float sv-80) (-> sv-64 vertex1 w)) + (set! sv-80 (-> sv-64 vertex1 w)) + (set! sv-72 s4-0) + ) ) ) ) ) ) ) + sv-72 ) - sv-72 ) ;; definition for method 7 of type saberfish-spawner @@ -494,143 +493,133 @@ ;; definition for method 24 of type saberfish-spawner ;; INFO: Used lq/sq (defmethod saberfish-spawner-method-24 ((this saberfish-spawner) (arg0 saberfish)) - (local-vars - (sv-48 float) - (sv-56 int) - (sv-64 number) - (sv-68 vector) - (sv-72 vector) - (sv-160 (function path-control vector vector symbol float)) - (sv-176 vector) - (sv-192 vector) - (sv-208 vector) - ) (set! (-> arg0 dest-nav-mesh-index) (-> arg0 desired-dest-mesh-index)) - (set! sv-48 (the-as float -1.0)) - (set! sv-56 -1) - (set! sv-64 40960000000.0) - (let ((v1-4 (new 'stack-no-clear 'vector))) + (let ((sv-48 (the-as float -1.0)) + (sv-56 -1) + (sv-64 40960000000.0) + (v1-4 (new 'stack-no-clear 'vector)) + ) (vector-copy! v1-4 (-> arg0 root trans)) - (set! sv-68 v1-4) - ) - (set! sv-72 (new 'stack-no-clear 'vector)) - (cond - ((saberfish-method-243 arg0) - (vector-! sv-72 (-> arg0 desired-dest-nav-point) (-> arg0 root trans)) - (set! (-> sv-72 y) 0.0) - ) - (else - (vector-z-quaternion! sv-72 (-> arg0 root quat)) - (set! (-> sv-72 y) 0.0) - (vector-normalize! sv-72 61440.0) - ) - ) - (set! sv-56 -1) - (when (>= (-> arg0 current-nav-mesh-index) 0) - (let ((s4-0 (-> this nav-mesh-jumps data (-> arg0 current-nav-mesh-index)))) - (dotimes (s3-0 (-> s4-0 paths length)) - (let* ((s2-0 (-> s4-0 paths data s3-0)) - (s1-0 (-> this jump-paths s2-0)) - ) - 0.0 - 0.0 - (let* ((f0-6 (cond - (#f - (path-control-method-23 s1-0 sv-68) - ) - (else - (let ((s0-0 s1-0)) - (set! sv-160 (method-of-object s0-0 path-control-method-28)) - (set! sv-176 sv-68) - (set! sv-192 sv-72) - (let ((a3-0 (not (saberfish-method-243 arg0)))) - (sv-160 s0-0 sv-176 sv-192 a3-0) + (let ((sv-68 v1-4) + (sv-72 (new 'stack-no-clear 'vector)) + ) + (cond + ((saberfish-method-243 arg0) + (vector-! sv-72 (-> arg0 desired-dest-nav-point) (-> arg0 root trans)) + (set! (-> sv-72 y) 0.0) + ) + (else + (vector-z-quaternion! sv-72 (-> arg0 root quat)) + (set! (-> sv-72 y) 0.0) + (vector-normalize! sv-72 61440.0) + ) + ) + (set! sv-56 -1) + (when (>= (-> arg0 current-nav-mesh-index) 0) + (let ((s4-0 (-> this nav-mesh-jumps data (-> arg0 current-nav-mesh-index)))) + (dotimes (s3-0 (-> s4-0 paths length)) + (let* ((s2-0 (-> s4-0 paths data s3-0)) + (s1-0 (-> this jump-paths s2-0)) + ) + 0.0 + 0.0 + (let* ((f0-6 (cond + (#f + (path-control-method-23 s1-0 sv-68) + ) + (else + (let* ((s0-0 s1-0) + (sv-160 (method-of-object s0-0 path-control-method-28)) + (sv-176 sv-68) + (sv-192 sv-72) + ) + (sv-160 s0-0 sv-176 sv-192 (not (saberfish-method-243 arg0))) + ) ) ) ) - ) - ) - (f30-0 (fmax 0.0 (fmin 1.0 f0-6))) - (s0-1 vector-vector-xz-distance) - ) - (set! sv-208 sv-68) - (let* ((a1-8 (get-point-at-percent-along-path! s1-0 (new 'stack-no-clear 'vector) f30-0 'interp)) - (f0-8 (s0-1 sv-208 a1-8)) - ) - (when (< f0-8 (the-as float sv-64)) - (set! sv-64 f0-8) - (set! sv-56 s2-0) - (set! sv-48 f30-0) + (f30-0 (fmax 0.0 (fmin 1.0 f0-6))) + (f0-8 (vector-vector-xz-distance + sv-68 + (get-point-at-percent-along-path! s1-0 (new 'stack-no-clear 'vector) f30-0 'interp) + ) + ) + ) + (when (< f0-8 (the-as float sv-64)) + (set! sv-64 f0-8) + (set! sv-56 s2-0) + (set! sv-48 f30-0) + ) ) ) ) ) ) - ) - ) - (cond - ((>= sv-56 0) - (let* ((v1-41 (if (saberfish-method-243 arg0) - -1 - 1 + (cond + ((>= sv-56 0) + (let* ((v1-41 (if (saberfish-method-243 arg0) + -1 + 1 + ) ) + (s3-1 (-> this jump-paths sv-56)) + (s4-1 (-> this jump-paths (+ sv-56 v1-41))) + ) + (if (or (< (+ sv-56 v1-41) 0) (>= (+ sv-56 v1-41) (-> this jump-paths length))) + (return 0) + ) + (let ((s2-1 (new 'stack-no-clear 'vector)) + (s5-1 (new 'stack-no-clear 'vector)) + ) + (let ((s0-2 (new 'stack-no-clear 'vector)) + (s1-1 (new 'stack-no-clear 'vector)) + (f30-1 0.4) ) - (s3-1 (-> this jump-paths sv-56)) - (s4-1 (-> this jump-paths (+ sv-56 v1-41))) - ) - (if (or (< (+ sv-56 v1-41) 0) (>= (+ sv-56 v1-41) (-> this jump-paths length))) - (return 0) - ) - (let ((s2-1 (new 'stack-no-clear 'vector)) - (s5-1 (new 'stack-no-clear 'vector)) - ) - (let ((s0-2 (new 'stack-no-clear 'vector)) - (s1-1 (new 'stack-no-clear 'vector)) - (f30-1 0.4) + (get-point-at-percent-along-path! s3-1 (-> arg0 jump-point-start) sv-48 'interp) + (if (saberfish-method-243 arg0) + (set! f30-1 0.24) + ) + (vector-! s5-1 (-> arg0 jump-point-start) (-> arg0 root trans)) + (get-point-at-percent-along-path! s3-1 s0-2 (+ -0.05 sv-48) 'interp) + (get-point-at-percent-along-path! s3-1 s1-1 (+ 0.05 sv-48) 'interp) + (vector-! s2-1 s1-1 s0-2) + (vector-normalize! s2-1 1.0) + (set! (-> s5-1 y) 0.0) + (vector-normalize! s5-1 1.0) + (when (< f30-1 (fabs (vector-dot s5-1 s2-1))) + (set! sv-48 (path-control-method-23 s3-1 sv-68)) + (get-point-at-percent-along-path! s3-1 (-> arg0 jump-point-start) sv-48 'interp) + ) ) - (get-point-at-percent-along-path! s3-1 (-> arg0 jump-point-start) sv-48 'interp) - (if (saberfish-method-243 arg0) - (set! f30-1 0.24) + (cond + ((saberfish-method-243 arg0) + (let ((f0-20 (path-control-method-28 s4-1 (-> arg0 jump-point-start) sv-72 #f))) + (get-point-at-percent-along-path! s4-1 (-> arg0 jump-point-end) f0-20 'interp) + ) + ) + (else + (let ((f0-21 (path-control-method-23 s4-1 (-> arg0 jump-point-start)))) + (get-point-at-percent-along-path! s4-1 (-> arg0 jump-point-end) f0-21 'interp) + ) + ) ) - (vector-! s5-1 (-> arg0 jump-point-start) (-> arg0 root trans)) - (get-point-at-percent-along-path! s3-1 s0-2 (+ -0.05 sv-48) 'interp) - (get-point-at-percent-along-path! s3-1 s1-1 (+ 0.05 sv-48) 'interp) - (vector-! s2-1 s1-1 s0-2) - (vector-normalize! s2-1 1.0) - (set! (-> s5-1 y) 0.0) - (vector-normalize! s5-1 1.0) - (when (< f30-1 (fabs (vector-dot s5-1 s2-1))) - (set! sv-48 (path-control-method-23 s3-1 sv-68)) - (get-point-at-percent-along-path! s3-1 (-> arg0 jump-point-start) sv-48 'interp) + (vector-! s5-1 (-> arg0 jump-point-end) (-> arg0 jump-point-start)) + (set! (-> s5-1 y) 0.0) + (vector-normalize! s5-1 1.0) ) ) - (cond - ((saberfish-method-243 arg0) - (let ((f0-20 (path-control-method-28 s4-1 (-> arg0 jump-point-start) sv-72 #f))) - (get-point-at-percent-along-path! s4-1 (-> arg0 jump-point-end) f0-20 'interp) - ) - ) - (else - (let ((f0-21 (path-control-method-23 s4-1 (-> arg0 jump-point-start)))) - (get-point-at-percent-along-path! s4-1 (-> arg0 jump-point-end) f0-21 'interp) + (let ((v1-74 (-> arg0 nav state)) + (a0-46 (-> arg0 jump-point-start)) ) - ) + (logclear! (-> v1-74 flags) (nav-state-flag directional-mode)) + (logior! (-> v1-74 flags) (nav-state-flag target-poly-dirty)) + (vector-copy! (-> v1-74 target-pos) a0-46) ) - (vector-! s5-1 (-> arg0 jump-point-end) (-> arg0 jump-point-start)) - (set! (-> s5-1 y) 0.0) - (vector-normalize! s5-1 1.0) + 0 ) - ) - (let ((v1-74 (-> arg0 nav state)) - (a0-46 (-> arg0 jump-point-start)) - ) - (logclear! (-> v1-74 flags) (nav-state-flag directional-mode)) - (logior! (-> v1-74 flags) (nav-state-flag target-poly-dirty)) - (vector-copy! (-> v1-74 target-pos) a0-46) - ) - 0 - ) - (else + (else + ) + ) ) ) 0 @@ -809,13 +798,13 @@ ;; INFO: Used lq/sq (defmethod init-from-entity! ((this saberfish-spawn-manager-base) (arg0 entity-actor)) "Set up a newly created process from the entity that created it." - (local-vars (sv-16 res-tag)) (set-setting! 'gem-pool-index #f 0.0 2) - (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 actor-group) :tag-ptr (& sv-16))) + ) (cond ((and v1-3 (nonzero? (-> sv-16 elt-count))) - (set! (-> this actor-group) (the-as (pointer actor-group) v1-3)) + (set! (-> this actor-group) v1-3) (set! (-> this actor-group-count) (the-as int (-> sv-16 elt-count))) ) (else @@ -1678,3 +1667,7 @@ (sleep-code) ) ) + + + + diff --git a/test/decompiler/reference/jak3/levels/sewer/saberfish_REF.gc b/test/decompiler/reference/jak3/levels/sewer/saberfish_REF.gc index db03336506..c7277d765d 100644 --- a/test/decompiler/reference/jak3/levels/sewer/saberfish_REF.gc +++ b/test/decompiler/reference/jak3/levels/sewer/saberfish_REF.gc @@ -1540,7 +1540,6 @@ (set! (-> self saberfish-y-rotate) 0.0) ) :code (behavior () - (local-vars (sv-144 vector)) (ja-channel-push! 1 (seconds 0.2)) (ja :group! saberfish-swim-180-turn-ja) (set! (-> self doing-180-spin?) #t) @@ -1590,13 +1589,11 @@ (vector-normalize! s0-0 1.0) (vector-lerp! s1-0 s0-0 s2-0 f30-5) ) - (let ((s1-1 (-> self root trans)) - (s0-1 (-> self root trans)) - ) - (set! sv-144 s2-0) - (let ((f0-13 (* (lerp 0.0 57344.0 f30-5) (seconds-per-frame)))) - (vector+float*! s1-1 s0-1 sv-144 f0-13) - ) + (vector+float*! + (-> self root trans) + (-> self root trans) + s2-0 + (* (lerp 0.0 57344.0 f30-5) (seconds-per-frame)) ) ) ) @@ -2495,28 +2492,7 @@ ;; ERROR: Unsupported inline assembly instruction kind - [madda.s f2, f5] ;; ERROR: Unsupported inline assembly instruction kind - [madd.s f1, f3, f6] (defmethod saberfish-method-238 ((this saberfish) (arg0 symbol) (arg1 float) (arg2 float)) - (local-vars - (f1-5 float) - (sv-192 vector) - (sv-196 float) - (sv-200 vector) - (sv-204 vector) - (sv-240 vector) - (sv-244 vector) - (sv-248 vector) - (sv-252 float) - (sv-256 float) - (sv-512 vector) - (sv-516 vector) - (sv-520 vector) - (sv-524 vector) - (sv-528 float) - (sv-532 float) - (sv-536 vector) - (sv-540 vector) - (sv-592 vector) - (sv-608 vector) - ) + (local-vars (f1-5 float) (sv-516 vector) (sv-524 vector) (sv-532 float) (sv-536 vector) (sv-540 vector)) (rlet ((vf0 :class vf) (vf4 :class vf) (vf5 :class vf) @@ -2538,175 +2514,162 @@ ) (arg0 (set! s3-1 #t) - (set! sv-192 (new 'stack-no-clear 'vector)) - (set! sv-196 (the-as float 30720.0)) - (set! sv-200 (vector-z-quaternion! (new 'stack-no-clear 'vector) (-> this root quat))) - (set! sv-204 (vector-x-quaternion! (new 'stack-no-clear 'vector) (-> this root quat))) - (set! (-> sv-204 y) 0.0) - (vector-normalize! sv-204 1.0) - (set! sv-240 (vector-! (new 'stack-no-clear 'vector) (-> this jump-point-start) (-> this root trans))) - (set! sv-244 sv-204) - (set! sv-248 (vector-float*! (new 'stack-no-clear 'vector) sv-204 -1.0)) - (set! sv-252 (the-as float 0.0)) - (set! sv-256 (the-as float 0.0)) - (set! (-> sv-240 y) 0.0) - (vector-normalize! sv-240 1.0) - (set! sv-252 (vector-dot sv-244 sv-240)) - (set! sv-256 (vector-dot sv-248 sv-240)) - (cond - ((< sv-256 sv-252) - (vector+float*! sv-192 (-> this root trans) sv-244 sv-196) - (vector-copy! sv-204 sv-244) - ) - (else - (vector+float*! sv-192 (-> this root trans) sv-248 sv-196) - (vector-copy! sv-204 sv-248) - ) - ) - (when (< (* sv-196 sv-196) (vector-vector-xz-distance-squared sv-192 (-> this jump-point-start))) - (set! sv-592 (new 'stack-no-clear 'vector)) - (let ((v1-33 (-> this jump-point-start)) - (a0-22 sv-192) - ) - (.lvf vf4 (&-> v1-33 quad)) - (.lvf vf5 (&-> a0-22 quad)) - ) - (.mov.vf.w vf6 vf0) - (.sub.vf.xyz vf6 vf4 vf5) - (.svf (&-> sv-592 quad) vf6) - (set! sv-608 (new 'stack-no-clear 'vector)) - (let ((s0-1 (new 'stack-no-clear 'vector)) - (s2-1 (new 'stack-no-clear 'vector)) - ) - (let ((s3-2 (new 'stack-no-clear 'vector)) - (s1-1 (new 'stack-no-clear 'vector)) - ) - 0.0 - 0.0 - (set! (-> sv-592 y) 0.0) - (let* ((f0-19 (vector-length sv-592)) - (f30-1 (sqrtf (- (* f0-19 f0-19) (* sv-196 sv-196)))) - ) - (let ((f28-0 (atan sv-196 f30-1))) - (vector-normalize! sv-592 -1.0) - (vector-rotate-y! sv-608 sv-592 f28-0) - (let ((t9-10 vector-rotate-y!) - (a0-26 s0-1) - (a2-2 (- f28-0)) - ) - (t9-10 a0-26 sv-592 a2-2) - ) - ) - (vector-normalize! sv-608 f30-1) - (vector-normalize! s0-1 f30-1) - ) - (vector+float*! s3-2 (-> this jump-point-start) sv-608 1.0) - (vector+float*! s1-1 (-> this jump-point-start) s0-1 1.0) - (vector-! sv-608 s3-2 (-> this root trans)) - (vector-! s0-1 s1-1 (-> this root trans)) - (set! (-> sv-608 y) 0.0) - (set! (-> s0-1 y) 0.0) - (let ((f30-2 (vector-normalize-ret-len! sv-608 1.0)) - (f0-28 (vector-normalize-ret-len! s0-1 1.0)) - ) - (let* ((v1-47 sv-200) - (f1-4 (-> sv-608 x)) - (f2-1 (-> sv-608 y)) - (f3-0 (-> sv-608 z)) - (f4-0 (-> v1-47 x)) - (f5-0 (-> v1-47 y)) - (f6-0 (-> v1-47 z)) - ) - (.mula.s f1-4 f4-0) - (.madda.s f2-1 f5-0) - (.madd.s f1-5 f3-0 f6-0) - ) - (set! sv-252 f1-5) - (set! sv-256 (vector-dot s0-1 sv-200)) - (cond - ((< f30-2 40.96) - (vector-copy! s2-1 s3-2) - ) - ((< f0-28 40.96) - (vector-copy! s2-1 s1-1) - ) - ((< sv-256 sv-252) - (vector-copy! s2-1 s3-2) - ) - (else - (vector-copy! s2-1 s1-1) - ) - ) - ) + (let ((sv-192 (new 'stack-no-clear 'vector)) + (sv-196 (the-as float 30720.0)) + (sv-200 (vector-z-quaternion! (new 'stack-no-clear 'vector) (-> this root quat))) + (sv-204 (vector-x-quaternion! (new 'stack-no-clear 'vector) (-> this root quat))) ) - (set! (-> s2-1 y) (-> this root trans y)) + (set! (-> sv-204 y) 0.0) + (vector-normalize! sv-204 1.0) + (let ((sv-240 (vector-! (new 'stack-no-clear 'vector) (-> this jump-point-start) (-> this root trans))) + (sv-244 sv-204) + (sv-248 (vector-float*! (new 'stack-no-clear 'vector) sv-204 -1.0)) + (sv-252 (the-as float 0.0)) + (sv-256 (the-as float 0.0)) + ) + (set! (-> sv-240 y) 0.0) + (vector-normalize! sv-240 1.0) + (set! sv-252 (vector-dot sv-244 sv-240)) (cond - ((< (vector-vector-xz-distance-squared (-> this jump-point-start) s2-1) 822083600.0) - (if (< 8192.0 arg1) - (set! s3-1 #t) - (set! s3-1 #f) - ) - ) - ((begin - (let ((s3-4 (vector-! (new 'stack-no-clear 'vector) (-> this jump-point-start) (-> this jump-point-end))) - (s0-2 (new 'stack-no-clear 'vector)) - (s1-2 (new 'stack-no-clear 'vector)) - ) - (set! (-> s3-4 y) 0.0) - (vector-normalize! s3-4 1.0) - (vector-rotate-y! s0-2 s3-4 -8192.0) - (vector-rotate-y! s1-2 s3-4 8192.0) - (vector-normalize! s0-2 arg2) - (vector-normalize! s1-2 arg2) - (set! s3-1 #f) - (set! sv-512 (vector+! (new 'stack-no-clear 'vector) (-> this jump-point-start) s0-2)) - (set! sv-516 (vector+! (new 'stack-no-clear 'vector) (-> this jump-point-start) s1-2)) - (set! sv-520 (new 'stack-no-clear 'vector)) - (set! sv-524 (new 'stack-no-clear 'vector)) - (set! sv-528 (the-as float 0.0)) - (set! sv-532 (the-as float 0.0)) - (set! sv-536 (new 'stack-no-clear 'vector)) - (set! sv-540 (new 'stack-no-clear 'vector)) - (vector-copy! sv-536 (-> this root trans)) - (vector-copy! sv-540 s2-1) - (set! (-> sv-536 y) (-> sv-512 y)) - (set! (-> sv-540 y) (-> sv-512 y)) - (let ((a1-37 (vector-! (new 'stack-no-clear 'vector) sv-516 sv-512)) - (a0-60 (new 'stack-no-clear 'vector)) - (v1-76 (new 'stack-no-clear 'vector)) - ) - (set-vector! a0-60 (-> s0-2 z) 0.0 (- (-> s0-2 x)) 1.0) - (set-vector! v1-76 (- (-> s0-2 z)) 0.0 (-> s0-2 x) 1.0) - (set! sv-252 (vector-dot a0-60 a1-37)) - (if (< 0.0 sv-252) - (vector-copy! sv-520 a0-60) - (vector-copy! sv-520 v1-76) - ) - (set-vector! a0-60 (-> s1-2 z) 0.0 (- (-> s1-2 x)) 1.0) - (set-vector! v1-76 (- (-> s1-2 z)) 0.0 (-> s1-2 x) 1.0) - (set! sv-252 (vector-dot a0-60 a1-37)) - (if (< 0.0 sv-252) - (vector-copy! sv-524 v1-76) - (vector-copy! sv-524 a0-60) - ) - ) - ) - (vector-normalize! sv-520 1.0) - (vector-normalize! sv-524 1.0) - (set! sv-528 (vector-dot sv-520 sv-512)) - (set! sv-252 (vector-dot sv-520 sv-536)) - (set! sv-256 (vector-dot sv-520 sv-540)) - (or (< sv-252 sv-528) (< sv-256 sv-528)) - ) - (set! s3-1 #t) + ((< (vector-dot sv-248 sv-240) sv-252) + (vector+float*! sv-192 (-> this root trans) sv-244 sv-196) + (vector-copy! sv-204 sv-244) ) (else - (set! sv-532 (vector-dot sv-524 sv-516)) - (set! sv-252 (vector-dot sv-524 sv-536)) - (set! sv-256 (vector-dot sv-524 sv-540)) - (if (or (< sv-252 sv-532) (< sv-256 sv-532)) - (set! s3-1 #t) + (vector+float*! sv-192 (-> this root trans) sv-248 sv-196) + (vector-copy! sv-204 sv-248) + ) + ) + (when (< (* sv-196 sv-196) (vector-vector-xz-distance-squared sv-192 (-> this jump-point-start))) + (let ((sv-592 (new 'stack-no-clear 'vector))) + (let ((a0-22 sv-192)) + (.lvf vf4 (&-> (-> this jump-point-start) quad)) + (.lvf vf5 (&-> a0-22 quad)) + ) + (.mov.vf.w vf6 vf0) + (.sub.vf.xyz vf6 vf4 vf5) + (.svf (&-> sv-592 quad) vf6) + (let ((sv-608 (new 'stack-no-clear 'vector)) + (s0-1 (new 'stack-no-clear 'vector)) + (s2-1 (new 'stack-no-clear 'vector)) + ) + (let ((s3-2 (new 'stack-no-clear 'vector)) + (s1-1 (new 'stack-no-clear 'vector)) + ) + 0.0 + 0.0 + (set! (-> sv-592 y) 0.0) + (let ((f30-1 (sqrtf (- (square (vector-length sv-592)) (* sv-196 sv-196))))) + (let ((f28-0 (atan sv-196 f30-1))) + (vector-normalize! sv-592 -1.0) + (vector-rotate-y! sv-608 sv-592 f28-0) + (vector-rotate-y! s0-1 sv-592 (- f28-0)) + ) + (vector-normalize! sv-608 f30-1) + (vector-normalize! s0-1 f30-1) + ) + (vector+float*! s3-2 (-> this jump-point-start) sv-608 1.0) + (vector+float*! s1-1 (-> this jump-point-start) s0-1 1.0) + (vector-! sv-608 s3-2 (-> this root trans)) + (vector-! s0-1 s1-1 (-> this root trans)) + (set! (-> sv-608 y) 0.0) + (set! (-> s0-1 y) 0.0) + (let ((f30-2 (vector-normalize-ret-len! sv-608 1.0)) + (f0-28 (vector-normalize-ret-len! s0-1 1.0)) + ) + (let* ((v1-47 sv-200)) + (set! f1-5 (vector-dot sv-608 v1-47)) + ) + (set! sv-252 f1-5) + (set! sv-256 (vector-dot s0-1 sv-200)) + (cond + ((< f30-2 40.96) + (vector-copy! s2-1 s3-2) + ) + ((< f0-28 40.96) + (vector-copy! s2-1 s1-1) + ) + ((< sv-256 sv-252) + (vector-copy! s2-1 s3-2) + ) + (else + (vector-copy! s2-1 s1-1) + ) + ) + ) ) + (set! (-> s2-1 y) (-> this root trans y)) + (cond + ((< (vector-vector-xz-distance-squared (-> this jump-point-start) s2-1) 822083600.0) + (if (< 8192.0 arg1) + (set! s3-1 #t) + (set! s3-1 #f) + ) + ) + ((let ((s3-4 (vector-! (new 'stack-no-clear 'vector) (-> this jump-point-start) (-> this jump-point-end))) + (s0-2 (new 'stack-no-clear 'vector)) + (s1-2 (new 'stack-no-clear 'vector)) + ) + (set! (-> s3-4 y) 0.0) + (vector-normalize! s3-4 1.0) + (vector-rotate-y! s0-2 s3-4 -8192.0) + (vector-rotate-y! s1-2 s3-4 8192.0) + (vector-normalize! s0-2 arg2) + (vector-normalize! s1-2 arg2) + (set! s3-1 #f) + (let ((sv-512 (vector+! (new 'stack-no-clear 'vector) (-> this jump-point-start) s0-2))) + (set! sv-516 (vector+! (new 'stack-no-clear 'vector) (-> this jump-point-start) s1-2)) + (let ((sv-520 (new 'stack-no-clear 'vector))) + (set! sv-524 (new 'stack-no-clear 'vector)) + (let ((sv-528 (the-as float 0.0))) + (set! sv-532 (the-as float 0.0)) + (set! sv-536 (new 'stack-no-clear 'vector)) + (set! sv-540 (new 'stack-no-clear 'vector)) + (vector-copy! sv-536 (-> this root trans)) + (vector-copy! sv-540 s2-1) + (set! (-> sv-536 y) (-> sv-512 y)) + (set! (-> sv-540 y) (-> sv-512 y)) + (let ((a1-37 (vector-! (new 'stack-no-clear 'vector) sv-516 sv-512)) + (a0-60 (new 'stack-no-clear 'vector)) + (v1-76 (new 'stack-no-clear 'vector)) + ) + (set-vector! a0-60 (-> s0-2 z) 0.0 (- (-> s0-2 x)) 1.0) + (set-vector! v1-76 (- (-> s0-2 z)) 0.0 (-> s0-2 x) 1.0) + (set! sv-252 (vector-dot a0-60 a1-37)) + (if (< 0.0 sv-252) + (vector-copy! sv-520 a0-60) + (vector-copy! sv-520 v1-76) + ) + (set-vector! a0-60 (-> s1-2 z) 0.0 (- (-> s1-2 x)) 1.0) + (set-vector! v1-76 (- (-> s1-2 z)) 0.0 (-> s1-2 x) 1.0) + (set! sv-252 (vector-dot a0-60 a1-37)) + (if (< 0.0 sv-252) + (vector-copy! sv-524 v1-76) + (vector-copy! sv-524 a0-60) + ) + ) + (vector-normalize! sv-520 1.0) + (vector-normalize! sv-524 1.0) + (set! sv-528 (vector-dot sv-520 sv-512)) + (set! sv-252 (vector-dot sv-520 sv-536)) + (set! sv-256 (vector-dot sv-520 sv-540)) + (or (< sv-252 sv-528) (< sv-256 sv-528)) + ) + ) + ) + ) + (set! s3-1 #t) + ) + (else + (set! sv-532 (vector-dot sv-524 sv-516)) + (set! sv-252 (vector-dot sv-524 sv-536)) + (set! sv-256 (vector-dot sv-524 sv-540)) + (if (or (< sv-252 sv-532) (< sv-256 sv-532)) + (set! s3-1 #t) + ) + ) + ) + ) ) ) ) @@ -2798,50 +2761,57 @@ ;; definition for method 231 of type saberfish ;; INFO: Used lq/sq (defmethod saberfish-method-231 ((this saberfish) (arg0 vector) (arg1 float) (arg2 symbol) (arg3 vector)) - (local-vars (sv-64 vector) (sv-68 vector) (sv-72 float) (sv-76 float) (sv-80 vector) (sv-84 float)) - (set! sv-64 (new 'stack-no-clear 'vector)) - (set! sv-68 (new 'stack-no-clear 'vector)) - (set! sv-72 (the-as float 0.0)) - (set! sv-76 (the-as float 0.0)) - (set! sv-80 (new 'stack-no-clear 'vector)) - (set! sv-84 (the-as float -1.0)) - (if arg2 - (vector-copy! sv-64 arg3) - (vector-! sv-64 (-> this jump-point-start) (-> this jump-point-end)) - ) - (set! (-> sv-64 y) 0.0) - (set! sv-76 arg1) - (vector-normalize-copy! sv-68 sv-64 1.0) - (let ((s3-0 (saberfish-method-236 this (-> this current-nav-mesh-index))) - (s2-0 (new 'stack-no-clear 'clamp-travel-vector-to-mesh-return-info)) - (s1-0 (saberfish-method-233 this)) + (let ((sv-64 (new 'stack-no-clear 'vector)) + (sv-68 (new 'stack-no-clear 'vector)) + (sv-72 (the-as float 0.0)) + (sv-76 (the-as float 0.0)) + (sv-80 (new 'stack-no-clear 'vector)) + (sv-84 (the-as float -1.0)) ) - 0.0 - (when s1-0 - (dotimes (s0-0 13) - (vector-rotate-y! sv-64 sv-68 sv-72) - (vector-normalize! sv-64 94208.0) - (clamp-vector-to-mesh-no-gaps s3-0 (-> this root trans) s1-0 sv-64 s2-0) - (vector+! arg0 (-> this root trans) sv-64) - (let ((f0-7 (vector-length sv-64))) - (when (< 84787.195 f0-7) - (set! (-> arg0 y) (-> this water surface-height)) - (return #t) - ) - (when (< sv-84 f0-7) - (set! sv-84 f0-7) - (vector-copy! sv-80 arg0) - ) + (if arg2 + (vector-copy! sv-64 arg3) + (vector-! sv-64 (-> this jump-point-start) (-> this jump-point-end)) + ) + (set! (-> sv-64 y) 0.0) + (set! sv-76 arg1) + (vector-normalize-copy! sv-68 sv-64 1.0) + (let ((s3-0 (saberfish-method-236 this (-> this current-nav-mesh-index))) + (s2-0 (new 'stack-no-clear 'clamp-travel-vector-to-mesh-return-info)) + (s1-0 (saberfish-method-233 this)) ) - (if (= (logand s0-0 1) 1) - (set! sv-72 (+ sv-72 sv-76)) - (set! sv-72 (- sv-72 sv-76)) + 0.0 + (when s1-0 + (dotimes (s0-0 13) + (vector-rotate-y! sv-64 sv-68 sv-72) + (vector-normalize! sv-64 94208.0) + (clamp-vector-to-mesh-no-gaps s3-0 (-> this root trans) s1-0 sv-64 s2-0) + (vector+! arg0 (-> this root trans) sv-64) + (let ((f0-7 (vector-length sv-64))) + (when (< 84787.195 f0-7) + (set! (-> arg0 y) (-> this water surface-height)) + (return #t) + ) + (when (< sv-84 f0-7) + (set! sv-84 f0-7) + (vector-copy! sv-80 arg0) + ) ) - (set! sv-76 (+ sv-76 arg1)) + (set! sv-72 (cond + ((= (logand s0-0 1) 1) + (+! sv-72 sv-76) + sv-72 + ) + (else + (- sv-72 sv-76) + ) + ) + ) + (+! sv-76 arg1) + ) + (vector-copy! arg0 sv-80) + (set! (-> arg0 y) (-> this water surface-height)) + (return #t) ) - (vector-copy! arg0 sv-80) - (set! (-> arg0 y) (-> this water surface-height)) - (return #t) ) ) #f @@ -3158,13 +3128,11 @@ (f1-0 (-> v1-4 trans y)) (a0-2 (-> this fact)) ) - (when (and (< f0-0 (+ f1-0 (-> a0-2 notice-top))) (< (- f1-0 (-> a0-2 notice-bottom)) f0-0)) - (let ((f0-1 (-> this enemy-info notice-nav-radius))) - (or (>= (* f0-1 f0-1) (vector-vector-xz-distance-squared (-> v1-4 trans) arg1)) + (if (and (< f0-0 (+ f1-0 (-> a0-2 notice-top))) (< (- f1-0 (-> a0-2 notice-bottom)) f0-0)) + (or (>= (square (-> this enemy-info notice-nav-radius)) (vector-vector-xz-distance-squared (-> v1-4 trans) arg1)) (>= (get-nav-mesh-idx this arg1 (saberfish-find-behavior none)) 0) ) ) - ) ) ) ) diff --git a/test/decompiler/reference/jak3/levels/sewer/sewer-obs2_REF.gc b/test/decompiler/reference/jak3/levels/sewer/sewer-obs2_REF.gc index d0c0ccaacd..34b3fcbe07 100644 --- a/test/decompiler/reference/jak3/levels/sewer/sewer-obs2_REF.gc +++ b/test/decompiler/reference/jak3/levels/sewer/sewer-obs2_REF.gc @@ -293,7 +293,6 @@ ;; INFO: Used lq/sq (defmethod init-from-entity! ((this sew-m-gate) (arg0 entity-actor)) "Set up a newly created process from the entity that created it." - (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)) @@ -318,11 +317,12 @@ (the-as pair 0) ) (logclear! (-> this mask) (process-mask actor-pause)) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-13 (res-lump-data (-> this entity) 'actor-groups pointer :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-13 (res-lump-data (-> this entity) 'actor-groups (pointer actor-group) :tag-ptr (& sv-16))) + ) (cond ((and v1-13 (nonzero? (-> sv-16 elt-count))) - (set! (-> this actor-group) (the-as (pointer actor-group) v1-13)) + (set! (-> this actor-group) v1-13) (set! (-> this actor-group-count) (the-as int (-> sv-16 elt-count))) ) (else @@ -465,7 +465,6 @@ ;; INFO: Used lq/sq (defmethod init-from-entity! ((this sew-pipe) (arg0 entity-actor)) "Set up a newly created process from the entity that created it." - (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)) @@ -490,11 +489,12 @@ (the-as pair 0) ) (logclear! (-> this mask) (process-mask actor-pause)) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-13 (res-lump-data (-> this entity) 'actor-groups pointer :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-13 (res-lump-data (-> this entity) 'actor-groups (pointer actor-group) :tag-ptr (& sv-16))) + ) (cond ((and v1-13 (nonzero? (-> sv-16 elt-count))) - (set! (-> this actor-group) (the-as (pointer actor-group) v1-13)) + (set! (-> this actor-group) v1-13) (set! (-> this actor-group-count) (the-as int (-> sv-16 elt-count))) ) (else @@ -643,3 +643,7 @@ (set! (-> this opened-x) (+ -32768.0 (-> this root trans x))) (go (method-of-object this closed)) ) + + + + diff --git a/test/decompiler/reference/jak3/levels/sewer/sewer-obs_REF.gc b/test/decompiler/reference/jak3/levels/sewer/sewer-obs_REF.gc index 5ee5bcbc18..f5e816dfcb 100644 --- a/test/decompiler/reference/jak3/levels/sewer/sewer-obs_REF.gc +++ b/test/decompiler/reference/jak3/levels/sewer/sewer-obs_REF.gc @@ -1609,7 +1609,6 @@ ;; INFO: Used lq/sq (defmethod init-from-entity! ((this sew-wall-switch) (arg0 entity-actor)) "Set up a newly created process from the entity that created it." - (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-sphere s4-0 (the-as uint 0)))) (set! (-> v1-2 prim-core collide-as) (collide-spec obstacle)) @@ -1633,11 +1632,12 @@ (the-as skeleton-group (art-group-get-by-name *level* "skel-sew-wall-switch" (the-as (pointer level) #f))) (the-as pair 0) ) - (set! sv-16 (new 'static 'res-tag)) - (set! (-> this actor-group) - (res-lump-data (-> this entity) 'actor-groups (pointer actor-group) :tag-ptr (& sv-16)) - ) - (set! (-> this actor-group-count) (the-as int (-> sv-16 elt-count))) + (let ((sv-16 (new 'static 'res-tag))) + (set! (-> this actor-group) + (res-lump-data (-> this entity) 'actor-groups (pointer actor-group) :tag-ptr (& sv-16)) + ) + (set! (-> this actor-group-count) (the-as int (-> sv-16 elt-count))) + ) (cond ((and (-> this entity) (logtest? (-> this entity extra perm status) (entity-perm-status subtask-complete))) (go (method-of-object this opened)) @@ -2192,27 +2192,23 @@ (-> self part) (vector<-cspace! (new 'stack-no-clear 'vector) (joint-node sew-gas-step-lod0-jg poison_gas)) ) - (let ((f0-7 (vector-vector-xz-distance-squared (target-pos 0) (-> self root trans))) - (f1-0 14336.0) - ) - (when (< f0-7 (* f1-0 f1-0)) - (let ((a0-9 (the-as target (as-type *target* process-focusable)))) - (if a0-9 - (send-event - a0-9 - 'attack - #f - (static-attack-info :mask (vehicle-impulse-factor) ((id (the-as uint (-> self attack-id))) - (damage 2.0) - (vehicle-damage-factor 1.0) - (vehicle-impulse-factor 1.0) - (shove-back (meters 3)) - (shove-up (meters 3)) - ) - ) - ) + (when (< (vector-vector-xz-distance-squared (target-pos 0) (-> self root trans)) (square 14336.0)) + (let ((a0-9 (the-as target (as-type *target* process-focusable)))) + (if a0-9 + (send-event + a0-9 + 'attack + #f + (static-attack-info :mask (vehicle-impulse-factor) ((id (the-as uint (-> self attack-id))) + (damage 2.0) + (vehicle-damage-factor 1.0) + (vehicle-impulse-factor 1.0) + (shove-back (meters 3)) + (shove-up (meters 3)) + ) + ) ) - ) + ) ) ) (suspend) diff --git a/test/decompiler/reference/jak3/levels/stadium/dm-mine-spider_REF.gc b/test/decompiler/reference/jak3/levels/stadium/dm-mine-spider_REF.gc index 6f68481e52..d49432355d 100644 --- a/test/decompiler/reference/jak3/levels/stadium/dm-mine-spider_REF.gc +++ b/test/decompiler/reference/jak3/levels/stadium/dm-mine-spider_REF.gc @@ -1298,7 +1298,6 @@ ;; definition for method 31 of type dm-mine-spider-spawner ;; WARN: Return type mismatch int vs none. (defmethod dm-mine-spider-spawner-method-31 ((this dm-mine-spider-spawner)) - (local-vars (sv-16 process-tree)) (let ((s2-0 (-> this child)) (s5-0 0) ) @@ -1306,17 +1305,18 @@ (s3-0 0.0) ) (while s2-0 - (set! sv-16 (as-type (-> s2-0 0) dm-mine-spider)) - (when sv-16 - (when (not (logtest? (-> (the-as dm-mine-spider sv-16) draw status) (draw-control-status on-screen))) - (let ((f0-0 (vector-vector-xz-distance (-> (the-as dm-mine-spider sv-16) root trans) (target-pos 0)))) - (if (< (the float s3-0) f0-0) - (set! s3-0 f0-0) - ) + (let ((sv-16 (as-type (-> s2-0 0) dm-mine-spider))) + (when sv-16 + (when (not (logtest? (-> (the-as dm-mine-spider sv-16) draw status) (draw-control-status on-screen))) + (let ((f0-0 (vector-vector-xz-distance (-> (the-as dm-mine-spider sv-16) root trans) (target-pos 0)))) + (if (< (the float s3-0) f0-0) + (set! s3-0 f0-0) + ) + ) + (+! s4-0 1) ) - (+! s4-0 1) + (+! s5-0 1) ) - (+! s5-0 1) ) (set! s2-0 (-> s2-0 0 brother)) ) @@ -1471,7 +1471,6 @@ ) ) :trans (behavior () - (local-vars (sv-112 vector)) (dm-mine-spider-spawner-method-31 self) (when (and (< (-> self count-alive) (-> self count-max)) *target* @@ -1491,16 +1490,11 @@ (when (dm-mine-spider-spawner-method-33 self s5-1) (let ((gp-1 (new 'stack-no-clear 'enemy-init-by-other-params))) (vector-copy! (-> gp-1 trans) s5-1) - (let ((s5-2 quaternion-copy!) - (s4-0 (-> gp-1 quat)) - (s3-0 quaternion<-rotate-y-vector) - (s2-0 (new 'stack-no-clear 'quaternion)) - (s1-0 vector-normalize!) - (s0-0 (new 'stack-no-clear 'vector)) - ) - (set! sv-112 (-> self root trans)) - (let ((v0-7 (target-pos 0))) - (s5-2 s4-0 (s3-0 s2-0 (s1-0 (vector-! s0-0 sv-112 v0-7) 1.0))) + (quaternion-copy! + (-> gp-1 quat) + (quaternion<-rotate-y-vector + (new 'stack-no-clear 'quaternion) + (vector-normalize! (vector-! (new 'stack-no-clear 'vector) (-> self root trans) (target-pos 0)) 1.0) ) ) (set! (-> gp-1 entity) (-> self alt-actor)) @@ -1617,7 +1611,6 @@ ;; WARN: Return type mismatch none vs object. (defmethod init-from-entity! ((this dm-mine-spider-spawner) (arg0 entity-actor)) "Set up a newly created process from the entity that created it." - (local-vars (sv-16 res-tag) (sv-32 vector)) (logior! (-> this mask) (process-mask enemy)) (let ((s4-0 (new 'process 'collide-shape this (collide-list-enum usually-hit-by-player)))) (let ((v0-1 (new 'process 'collide-shape-prim-sphere s4-0 (the-as uint 0)))) @@ -1645,35 +1638,25 @@ ) (the-as pair 0) ) - (set! sv-16 (new 'static 'res-tag)) - (res-lump-data (-> this entity) 'nav-mesh-actor pointer :tag-ptr (& sv-16)) - (set! (-> this num-nav-mesh) (the-as int (-> sv-16 elt-count))) - (when (> (-> this num-nav-mesh) 0) - (let ((s4-2 (get-process *default-dead-pool* simple-nav-sphere #x4000 1))) + (let ((sv-16 (new 'static 'res-tag))) + (res-lump-data (-> this entity) 'nav-mesh-actor pointer :tag-ptr (& sv-16)) + (set! (-> this num-nav-mesh) (the-as int (-> sv-16 elt-count))) + ) + (if (> (-> this num-nav-mesh) 0) (set! (-> this nav-sphere) (ppointer->handle - (when s4-2 - (let ((t9-7 (method-of-type simple-nav-sphere activate))) - (t9-7 (the-as simple-nav-sphere s4-2) this "simple-nav-sphere" (the-as pointer #x70004000)) - ) - (let ((s3-1 run-function-in-process) - (s2-0 s4-2) - (s1-0 simple-nav-sphere-init-by-other) - (s0-0 #x46800000) - ) - (set! sv-32 (-> this root trans)) - (let ((t0-1 (nav-mesh-from-res-tag (-> this entity) 'nav-mesh-actor 0)) - (t1-1 -1) - ) - ((the-as (function object object object object object object none) s3-1) s2-0 s1-0 s0-0 sv-32 t0-1 t1-1) - ) - ) - (-> s4-2 ppointer) + (process-spawn + simple-nav-sphere + #x46800000 + (-> this root trans) + (nav-mesh-from-res-tag (-> this entity) 'nav-mesh-actor 0) + -1 + :name "simple-nav-sphere" + :to this ) ) ) ) - ) (set! (-> this alt-actor) (entity-actor-lookup arg0 'alt-actor 0)) (set! (-> this count-max) (res-lump-value (-> this entity) 'max-count int :default (the-as uint128 5) :time -1000000000.0) diff --git a/test/decompiler/reference/jak3/levels/stadium/king-rider_REF.gc b/test/decompiler/reference/jak3/levels/stadium/king-rider_REF.gc index 5f2d4b27ee..413094b00c 100644 --- a/test/decompiler/reference/jak3/levels/stadium/king-rider_REF.gc +++ b/test/decompiler/reference/jak3/levels/stadium/king-rider_REF.gc @@ -142,10 +142,9 @@ ) (let ((v1-14 (-> *target* pilot))) (when (time-elapsed? (-> self complain-time) (seconds 3)) - (let* ((f0-0 1228800.0) - (f0-2 (* f0-0 f0-0)) - (a0-7 (-> v1-14 accel-array)) - ) + (let ((f0-2 (square 1228800.0)) + (a0-7 (-> v1-14 accel-array)) + ) (when (or (< f0-2 (+ (* (-> a0-7 0 x) (-> a0-7 0 x)) (* (-> a0-7 0 z) (-> a0-7 0 z)))) (< 4915200.0 (fabs (-> v1-14 accel-array 0 y))) ) @@ -155,11 +154,9 @@ ) ) ) - (let ((f0-4 20480.0)) - (if (< (* f0-4 f0-4) (vector-length-squared (-> *target* control transv))) - (set-time! (-> self last-moved-time)) - ) - ) + (if (< (square 20480.0) (vector-length-squared (-> *target* control transv))) + (set-time! (-> self last-moved-time)) + ) (if (time-elapsed? (-> self last-moved-time) (seconds 8)) (set! (-> self last-moved-time) (+ (current-time) (seconds 24))) ) diff --git a/test/decompiler/reference/jak3/levels/stadium/rubble-attack_REF.gc b/test/decompiler/reference/jak3/levels/stadium/rubble-attack_REF.gc index 52e2582af1..2c93a27eab 100644 --- a/test/decompiler/reference/jak3/levels/stadium/rubble-attack_REF.gc +++ b/test/decompiler/reference/jak3/levels/stadium/rubble-attack_REF.gc @@ -73,14 +73,10 @@ (sound-play "firebomb") ) (((projectile-options po0 po1)) - (let ((f0-0 (vector-vector-distance-squared (-> this root trans) (-> this desired-target-pos))) - (f1-0 614400.0) - ) - (when (< f0-0 (* f1-0 f1-0)) - (let ((a0-6 (static-sound-spec "incoming" :group 0 :volume 0.0))) - (set! (-> a0-6 volume) 1024) - (sound-play-by-spec a0-6 (-> this sound-id) (-> this root trans)) - ) + (when (< (vector-vector-distance-squared (-> this root trans) (-> this desired-target-pos)) (square 614400.0)) + (let ((a0-6 (static-sound-spec "incoming" :group 0 :volume 0.0))) + (set! (-> a0-6 volume) 1024) + (sound-play-by-spec a0-6 (-> this sound-id) (-> this root trans)) ) ) ) @@ -174,20 +170,16 @@ ) (set-vector! (-> self root scale) f0-2 1.0 f0-2 1.0) ) - (let ((f0-4 (vector-vector-distance-squared (-> self root trans) (the-as vector gp-0))) - (f1-2 409600.0) + (when (< (vector-vector-distance-squared (-> self root trans) (the-as vector gp-0)) (square 409600.0)) + (if (not (and (-> self next-state) (= (-> self next-state name) 'lock))) + (go-virtual lock) ) - (when (< f0-4 (* f1-2 f1-2)) - (if (not (and (-> self next-state) (= (-> self next-state name) 'lock))) - (go-virtual lock) + (when (time-elapsed? (-> self blink-timer) (seconds 0.05)) + (if (logtest? (-> self draw status) (draw-control-status no-draw)) + (send-event self 'on) + (send-event self 'off) ) - (when (time-elapsed? (-> self blink-timer) (seconds 0.05)) - (if (logtest? (-> self draw status) (draw-control-status no-draw)) - (send-event self 'on) - (send-event self 'off) - ) - (set-time! (-> self blink-timer)) - ) + (set-time! (-> self blink-timer)) ) ) ) @@ -523,7 +515,6 @@ ;; WARN: Return type mismatch int vs none. ;; WARN: Function (method 32 rubble-attack-manager) has a return type of none, but the expression builder found a return statement. (defmethod spawn-missile ((this rubble-attack-manager)) - (local-vars (sv-816 vector) (sv-832 (function vector quaternion vector)) (sv-848 vector)) (when *target* (let ((s5-0 (new 'stack-no-clear 'vector)) (s3-0 (target-pos 0)) @@ -532,17 +523,12 @@ (when (-> this missile-spawners) (let ((f30-0 0.0)) (dotimes (s4-0 (length (-> this missile-spawners))) - (let ((s1-0 (-> this missile-spawners s4-0)) - (s0-0 vector-vector-xz-distance) - ) - (set! sv-816 s1-0) - (let* ((a1-0 (target-pos 0)) - (f28-0 (s0-0 sv-816 a1-0)) - ) - (when (and (sphere-in-view-frustum? (sphere<-vector+r! (new 'stack-no-clear 'sphere) s1-0 81920.0)) (< f30-0 f28-0)) - (set! f30-0 f28-0) - (set! s2-0 s1-0) - ) + (let* ((s1-0 (-> this missile-spawners s4-0)) + (f28-0 (vector-vector-xz-distance s1-0 (target-pos 0))) + ) + (when (and (sphere-in-view-frustum? (sphere<-vector+r! (new 'stack-no-clear 'sphere) s1-0 81920.0)) (< f30-0 f28-0)) + (set! f30-0 f28-0) + (set! s2-0 s1-0) ) ) ) @@ -581,15 +567,7 @@ (vector-copy! s1-1 s2-0) ) (else - (let ((s0-2 s1-1) - (s2-1 vector-normalize!) - ) - (set! sv-832 vector-z-quaternion!) - (set! sv-848 s1-1) - (let ((a1-8 (target-rot))) - (vector+! s0-2 s3-0 (s2-1 (sv-832 sv-848 a1-8) 409600.0)) - ) - ) + (vector+! s1-1 s3-0 (vector-normalize! (vector-z-quaternion! s1-1 (target-rot)) 409600.0)) (+! (-> s1-1 y) 1228800.0) ) ) diff --git a/test/decompiler/reference/jak3/levels/stadium/rubble-obs_REF.gc b/test/decompiler/reference/jak3/levels/stadium/rubble-obs_REF.gc index a4a51e203d..8d2b3f85a4 100644 --- a/test/decompiler/reference/jak3/levels/stadium/rubble-obs_REF.gc +++ b/test/decompiler/reference/jak3/levels/stadium/rubble-obs_REF.gc @@ -817,7 +817,6 @@ ;; INFO: Used lq/sq (defmethod init-from-entity! ((this rub-elec-gate) (arg0 entity-actor)) "Set up a newly created process from the entity that created it." - (local-vars (sv-16 res-tag)) (set! (-> this root) (new 'process 'trsqv)) (process-drawable-from-entity! this arg0) (logclear! (-> this mask) (process-mask actor-pause)) @@ -851,12 +850,13 @@ (set! (-> this sound) (new 'process 'ambient-sound "ruins-gate-hum" (-> this root trans) 0.0)) (set! (-> this hit-sound-id) (new-sound-id)) (set! (-> this entity) arg0) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-31 (res-lump-data arg0 'actor-groups pointer :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-31 (res-lump-data arg0 'actor-groups (pointer actor-group) :tag-ptr (& sv-16))) + ) (cond ((and v1-31 (nonzero? (-> sv-16 elt-count))) (set! (-> this actor-group-count) (the-as int (-> sv-16 elt-count))) - (set! (-> this actor-group) (the-as (pointer actor-group) v1-31)) + (set! (-> this actor-group) v1-31) ) (else (format 0 "ERROR: entity missing actor-group!~%") @@ -1159,3 +1159,7 @@ (defmethod get-skel ((this rub-electric-gate-panel-d)) (art-group-get-by-name *level* "skel-rub-electric-gate-panel-d" (the-as (pointer level) #f)) ) + + + + diff --git a/test/decompiler/reference/jak3/levels/temple/hover-training_REF.gc b/test/decompiler/reference/jak3/levels/temple/hover-training_REF.gc index c51f5af155..ff5acdaa53 100644 --- a/test/decompiler/reference/jak3/levels/temple/hover-training_REF.gc +++ b/test/decompiler/reference/jak3/levels/temple/hover-training_REF.gc @@ -471,12 +471,6 @@ (sound-stop (-> self sound-id)) ) :trans (behavior () - (local-vars - (sv-752 (function cubic-curve vector vector vector vector none)) - (sv-768 vector) - (sv-784 vector) - (sv-800 vector) - ) (let ((s3-0 (res-lump-value (-> self entity) 'extra-id uint128 :default (the-as uint128 -1) :time -1000000000.0))) (if (>= (the-as int s3-0) 0) (sound-play-by-name @@ -568,14 +562,12 @@ ) (dotimes (s1-2 (+ s3-1 -1)) (when (and (>= (-> self path-pos) (the float s1-2)) (>= (the float (+ s1-2 1)) (-> self path-pos))) - (let ((s0-0 s2-2)) - (set! sv-752 (method-of-type cubic-curve cubic-curve-method-9)) - (set! sv-768 (-> gp-4 s1-2)) - (set! sv-784 (vector-normalize-copy! (new 'stack-no-clear 'vector) (-> s5-4 s1-2) 40960.0)) - (set! sv-800 (-> gp-4 (+ s1-2 1))) - (let ((t0-7 (vector-normalize-copy! (new 'stack-no-clear 'vector) (-> s5-4 (+ s1-2 1)) 40960.0))) - (sv-752 s0-0 sv-768 sv-784 sv-800 t0-7) - ) + (cubic-curve-method-9 + s2-2 + (-> gp-4 s1-2) + (vector-normalize-copy! (new 'stack-no-clear 'vector) (-> s5-4 s1-2) 40960.0) + (-> gp-4 (+ s1-2 1)) + (vector-normalize-copy! (new 'stack-no-clear 'vector) (-> s5-4 (+ s1-2 1)) 40960.0) ) (vector-lerp! (-> self dest) (-> gp-4 s1-2) (-> gp-4 (+ s1-2 1)) (- (-> self path-pos) (the float s1-2))) (+! (-> self path-pos) (/ (* f30-2 (seconds-per-frame)) @@ -637,7 +629,6 @@ ;; INFO: Used lq/sq (defmethod init-from-entity! ((this tpl-token) (arg0 entity-actor)) "Set up a newly created process from the entity that created it." - (local-vars (sv-16 res-tag)) (with-pp (let ((s4-0 (new 'process 'collide-shape-moving this (collide-list-enum usually-hit-by-player)))) (set! (-> s4-0 dynam) (copy *standard-dynamics* 'process)) @@ -670,12 +661,13 @@ ) (set! (-> this path-pos) 0.0) (transform-post) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-23 (res-lump-data arg0 'actor-groups pointer :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-23 (res-lump-data arg0 'actor-groups (pointer actor-group) :tag-ptr (& sv-16))) + ) (cond ((and v1-23 (nonzero? (-> sv-16 elt-count))) (set! (-> this actor-group-count) (the-as int (-> sv-16 elt-count))) - (set! (-> this actor-group) (the-as (pointer actor-group) v1-23)) + (set! (-> this actor-group) v1-23) ) (else (set! (-> this actor-group-count) 0) @@ -987,16 +979,16 @@ ;; INFO: Used lq/sq (defmethod init-from-entity! ((this hover-training-manager) (arg0 entity-actor)) "Set up a newly created process from the entity that created it." - (local-vars (sv-16 res-tag)) (process-entity-set! this arg0) (logclear! (-> this mask) (process-mask actor-pause)) (set! (-> this gui-id) (new 'static 'sound-id)) (set! (-> this hud-counter) (the-as handle #f)) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-3 (res-lump-data arg0 'actor-groups pointer :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-3 (res-lump-data arg0 'actor-groups (pointer actor-group) :tag-ptr (& sv-16))) + ) (when (and v1-3 (nonzero? (-> sv-16 elt-count))) (set! (-> this actor-group-count) (the-as int (-> sv-16 elt-count))) - (set! (-> this actor-group) (the-as (pointer actor-group) v1-3)) + (set! (-> this actor-group) v1-3) ) ) (if (task-node-closed? (game-task-node temple-tests-hover-training)) @@ -1328,3 +1320,7 @@ (logclear! (-> this mask) (process-mask actor-pause)) (go (method-of-object this idle)) ) + + + + diff --git a/test/decompiler/reference/jak3/levels/temple/temple-obs2_REF.gc b/test/decompiler/reference/jak3/levels/temple/temple-obs2_REF.gc index 9c617b66b0..b02111acdf 100644 --- a/test/decompiler/reference/jak3/levels/temple/temple-obs2_REF.gc +++ b/test/decompiler/reference/jak3/levels/temple/temple-obs2_REF.gc @@ -560,18 +560,18 @@ ;; INFO: Used lq/sq (defmethod init-from-entity! ((this tpl-watcher-manager) (arg0 entity-actor)) "Set up a newly created process from the entity that created it." - (local-vars (sv-16 res-tag)) (set! (-> this within-outer-ring) #f) (set! (-> this within-inner-ring) #f) (set! (-> this ouched) #f) (vector-copy! (-> this trans) (-> arg0 trans)) (logclear! (-> this mask) (process-mask actor-pause)) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-4 (res-lump-data arg0 'actor-groups pointer :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-4 (res-lump-data arg0 'actor-groups (pointer actor-group) :tag-ptr (& sv-16))) + ) (cond ((and v1-4 (nonzero? (-> sv-16 elt-count))) (set! (-> this actor-group-count) (the-as int (-> sv-16 elt-count))) - (set! (-> this actor-group) (the-as (pointer actor-group) v1-4)) + (set! (-> this actor-group) v1-4) ) (else (set! (-> this actor-group-count) 0) @@ -945,36 +945,18 @@ ) ((lambda :behavior tpl-watcher () - (local-vars (sv-96 symbol) (sv-112 vector)) - (let ((gp-0 (get-process *default-dead-pool* lightning-tracker #x4000 0))) - (when gp-0 - (let ((t9-1 (method-of-type lightning-tracker activate))) - (t9-1 (the-as lightning-tracker gp-0) *entity-pool* "lightning-tracker" (the-as pointer #x70004000)) - ) - (let ((s5-0 run-function-in-process) - (s4-0 gp-0) - (s3-0 lightning-tracker-init) - (s2-0 (-> *lightning-spec-id-table* 26)) - (s1-0 150) - (s0-0 #f) - ) - (set! sv-96 (the-as symbol #f)) - (set! sv-112 (-> self node-list data 4 bone transform trans)) - (let ((t3-0 (get-trans *target* 3))) - ((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-96 - sv-112 - t3-0 - ) - ) - ) - (-> gp-0 ppointer) - ) + (process-spawn + lightning-tracker + :init lightning-tracker-init + (-> *lightning-spec-id-table* 26) + 150 + #f + (the-as symbol #f) + (-> self node-list data 4 bone transform trans) + (get-trans *target* 3) + :name "lightning-tracker" + :to *entity-pool* + :unk 0 ) (send-event *target* @@ -1170,7 +1152,6 @@ ;; INFO: Used lq/sq (defmethod init-from-entity! ((this tpl-watcher) (arg0 entity-actor)) "Set up a newly created process from the entity that created it." - (local-vars (sv-16 res-tag)) (stack-size-set! (-> this main-thread) 384) (init-collision! this) (process-drawable-from-entity! this arg0) @@ -1181,8 +1162,9 @@ (the-as pair 0) ) (logclear! (-> this mask) (process-mask actor-pause)) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-12 (res-lump-data arg0 'actor-groups (pointer actor-group) :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-12 (res-lump-data arg0 'actor-groups (pointer actor-group) :tag-ptr (& sv-16))) + ) (if (and v1-12 (> (-> sv-16 elt-count) 0)) (set! (-> this manager) (the-as tpl-watcher-manager (-> v1-12 0 data 0 actor))) (set! (-> this manager) #f) @@ -1279,7 +1261,6 @@ (setup-masks (-> self draw) 0 2) ) :code (behavior () - (local-vars (sv-96 res-tag)) (sound-play "stone-lower") (ja-no-eval :group! tpl-door-switch-press-ja :num! (seek!) :frame-num 0.0) (until (ja-done? 0) @@ -1288,8 +1269,9 @@ ) (process-entity-status! self (entity-perm-status subtask-complete) #t) (send-event *target* 'change-mode 'normal self) - (set! sv-96 (new 'static 'res-tag)) - (let ((gp-1 (res-lump-data (-> self entity) 'actor-groups (pointer actor-group) :tag-ptr (& sv-96)))) + (let* ((sv-96 (new 'static 'res-tag)) + (gp-1 (res-lump-data (-> self entity) 'actor-groups (pointer actor-group) :tag-ptr (& sv-96))) + ) (cond ((and gp-1 (< (the-as uint 1) (-> sv-96 elt-count))) (let ((s5-1 (new 'stack-no-clear 'event-message-block))) @@ -2230,3 +2212,7 @@ ((method-of-type process-focusable deactivate) (the-as process-focusable this)) (none) ) + + + + diff --git a/test/decompiler/reference/jak3/levels/temple/temple-obs_REF.gc b/test/decompiler/reference/jak3/levels/temple/temple-obs_REF.gc index fba0dbd0e4..6e5c55aa13 100644 --- a/test/decompiler/reference/jak3/levels/temple/temple-obs_REF.gc +++ b/test/decompiler/reference/jak3/levels/temple/temple-obs_REF.gc @@ -1111,11 +1111,9 @@ ) (vector-copy! (-> self other-eyeball-jmod transform scale) (-> self root scale)) (vector-copy! (-> self eyeball-jmod transform scale) (-> self root scale)) - (let* ((f0-9 (lerp-scale 1.0 0.0 (the float (- (current-time) (-> self state-time))) 0.0 60.0)) - (f0-11 (* f0-9 f0-9)) - ) - (set! (-> self root scale x) (* f0-11 f0-11)) - ) + (set! (-> self root scale x) + (square (square (lerp-scale 1.0 0.0 (the float (- (current-time) (-> self state-time))) 0.0 60.0))) + ) (set! (-> self root scale y) (+ 1.0 (/ (-> self root scale x) 2))) (set! (-> self root scale z) (-> self root scale x)) (when (= (-> self root scale x) 0.0) @@ -1174,10 +1172,10 @@ ;; definition for method 11 of type tpl-holo-eye ;; INFO: Used lq/sq +;; INFO: Process stack size was changed from 320 to 384 (defmethod init-from-entity! ((this tpl-holo-eye) (arg0 entity-actor)) "Set up a newly created process from the entity that created it." - (local-vars (sv-16 res-tag)) - (stack-size-set! (-> this main-thread) 320) + (stack-size-set! (-> this main-thread) 384) (set! (-> this root) (new 'process 'trsqv)) (process-drawable-from-entity! this arg0) (initialize-skeleton @@ -1186,12 +1184,13 @@ (the-as pair 0) ) (set! (-> this trigger-radius) (res-lump-float (-> this entity) 'holo-eye-activate-radius :default 77824.0)) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-8 (res-lump-data arg0 'actor-groups pointer :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-8 (res-lump-data arg0 'actor-groups (pointer actor-group) :tag-ptr (& sv-16))) + ) (cond ((and v1-8 (nonzero? (-> sv-16 elt-count))) (set! (-> this actor-group-count) (the-as int (-> sv-16 elt-count))) - (set! (-> this actor-group) (the-as (pointer actor-group) v1-8)) + (set! (-> this actor-group) v1-8) ) (else (format 0 "ERROR: ~s: entity missing actor-group!~%" (-> this name)) @@ -1965,7 +1964,6 @@ ;; INFO: Used lq/sq (defmethod init-from-entity! ((this tpl-spindle) (arg0 entity-actor)) "Set up a newly created process from the entity that created it." - (local-vars (sv-16 int)) (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)) @@ -2009,8 +2007,9 @@ (let ((f28-0 0.4) (f30-0 0.0) ) - (set! sv-16 0) - (let ((v1-30 (res-lump-data arg0 'cycle-speed (pointer float) :tag-ptr (the-as (pointer res-tag) (& sv-16))))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-30 (res-lump-data arg0 'cycle-speed (pointer float) :tag-ptr (& sv-16))) + ) (when v1-30 (set! f28-0 (-> v1-30 0)) (set! f30-0 (-> v1-30 1)) @@ -2126,7 +2125,6 @@ ;; INFO: Used lq/sq (defmethod init-from-entity! ((this tpl-fan-two) (arg0 entity-actor)) "Set up a newly created process from the entity that created it." - (local-vars (sv-16 int)) (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)) @@ -2156,8 +2154,9 @@ (let ((f28-0 720.0) (f30-0 0.0) ) - (set! sv-16 0) - (let ((v1-22 (res-lump-data arg0 'cycle-speed (pointer float) :tag-ptr (the-as (pointer res-tag) (& sv-16))))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-22 (res-lump-data arg0 'cycle-speed (pointer float) :tag-ptr (& sv-16))) + ) (when v1-22 (set! f28-0 (-> v1-22 0)) (set! f30-0 (-> v1-22 1)) @@ -2273,7 +2272,6 @@ ;; INFO: Used lq/sq (defmethod init-from-entity! ((this tpl-fan-three) (arg0 entity-actor)) "Set up a newly created process from the entity that created it." - (local-vars (sv-16 int)) (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)) @@ -2303,8 +2301,9 @@ (let ((f28-0 720.0) (f30-0 0.0) ) - (set! sv-16 0) - (let ((v1-22 (res-lump-data arg0 'cycle-speed (pointer float) :tag-ptr (the-as (pointer res-tag) (& sv-16))))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-22 (res-lump-data arg0 'cycle-speed (pointer float) :tag-ptr (& sv-16))) + ) (when v1-22 (set! f28-0 (-> v1-22 0)) (set! f30-0 (-> v1-22 1)) @@ -2693,3 +2692,7 @@ (set! (-> this spawn-part) #f) (go (method-of-object this closed)) ) + + + + diff --git a/test/decompiler/reference/jak3/levels/temple/templed-obs_REF.gc b/test/decompiler/reference/jak3/levels/temple/templed-obs_REF.gc index 3d91f0cdc6..595ecf9c35 100644 --- a/test/decompiler/reference/jak3/levels/temple/templed-obs_REF.gc +++ b/test/decompiler/reference/jak3/levels/temple/templed-obs_REF.gc @@ -727,30 +727,32 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defmethod tpl-break-bridge-method-25 ((this tpl-break-bridge) (arg0 int)) - (local-vars (sv-16 tpl-break-bridge) (sv-24 int) (sv-32 vector)) - (set! sv-16 this) - (set! sv-24 arg0) - (set! sv-32 (-> this node-list data (tpl-bbridge-panel arg0) bone transform trans)) - (cond - ((logtest? (-> group-temple-bridge-break-kaboom flags) (sp-group-flag sp13)) - (vector-copy! (-> *launch-matrix* trans) sv-32) - (part-tracker-spawn part-tracker-subsampler :to *entity-pool* :group group-temple-bridge-break-kaboom) - ) - (else - (vector-copy! (-> *launch-matrix* trans) sv-32) - (part-tracker-spawn part-tracker :to *entity-pool* :group group-temple-bridge-break-kaboom) + (let ((sv-16 this) + (sv-24 arg0) + ) + (let ((sv-32 (-> this node-list data (tpl-bbridge-panel arg0) bone transform trans))) + (cond + ((logtest? (-> group-temple-bridge-break-kaboom flags) (sp-group-flag sp13)) + (vector-copy! (-> *launch-matrix* trans) sv-32) + (part-tracker-spawn part-tracker-subsampler :to *entity-pool* :group group-temple-bridge-break-kaboom) + ) + (else + (vector-copy! (-> *launch-matrix* trans) sv-32) + (part-tracker-spawn part-tracker :to *entity-pool* :group group-temple-bridge-break-kaboom) + ) + ) ) + (set-vector! (-> sv-16 panel-jmods sv-24 transform scale) 0.0 0.0 0.0 1.0) + (let ((a1-8 (new 'stack 'debris-tuning (the-as uint 0)))) + (set! (-> a1-8 duration) (seconds 8)) + (set-vector! (-> a1-8 fountain-rand-transv-lo) -98304.0 32768.0 -98304.0 1.0) + (set-vector! (-> a1-8 fountain-rand-transv-hi) 98304.0 163840.0 98304.0 1.0) + (set! (-> a1-8 hit-xz-reaction) 0.95) + (set! (-> a1-8 hit-y-reaction) 0.6) + (debris-spawn sv-16 a1-8 (-> *tpl-bridge-debris-params-arr* sv-24) (the-as process-drawable #f)) + ) + (set! (-> sv-16 panel-quashed sv-24) #t) ) - (set-vector! (-> sv-16 panel-jmods sv-24 transform scale) 0.0 0.0 0.0 1.0) - (let ((a1-8 (new 'stack 'debris-tuning (the-as uint 0)))) - (set! (-> a1-8 duration) (seconds 8)) - (set-vector! (-> a1-8 fountain-rand-transv-lo) -98304.0 32768.0 -98304.0 1.0) - (set-vector! (-> a1-8 fountain-rand-transv-hi) 98304.0 163840.0 98304.0 1.0) - (set! (-> a1-8 hit-xz-reaction) 0.95) - (set! (-> a1-8 hit-y-reaction) 0.6) - (debris-spawn sv-16 a1-8 (-> *tpl-bridge-debris-params-arr* sv-24) (the-as process-drawable #f)) - ) - (set! (-> sv-16 panel-quashed sv-24) #t) 0 (none) ) diff --git a/test/decompiler/reference/jak3/levels/title/title-obs_REF.gc b/test/decompiler/reference/jak3/levels/title/title-obs_REF.gc index 362b4b63ce..8beb0de500 100644 --- a/test/decompiler/reference/jak3/levels/title/title-obs_REF.gc +++ b/test/decompiler/reference/jak3/levels/title/title-obs_REF.gc @@ -207,7 +207,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 text-id (text-id progress-start-button))) (s5-1 (current-time)) @@ -242,20 +241,22 @@ ) ) (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 (s4-2 (-> gp-1 length)) - (if (= (-> self selected) s4-2) - (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 s4-2) #f) sv-112 #f 44 (bucket-id hud-draw-hud-alpha)) - (+! (-> 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 (s4-2 (-> gp-1 length)) + (if (= (-> self selected) s4-2) + (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 s4-2) #f) sv-112 #f 44 (bucket-id hud-draw-hud-alpha)) + (+! (-> sv-112 origin y) 22.0) + ) ) ) ) diff --git a/test/decompiler/reference/jak3/levels/tower/tower-obs_REF.gc b/test/decompiler/reference/jak3/levels/tower/tower-obs_REF.gc index 21209eb23f..652c5264cb 100644 --- a/test/decompiler/reference/jak3/levels/tower/tower-obs_REF.gc +++ b/test/decompiler/reference/jak3/levels/tower/tower-obs_REF.gc @@ -114,12 +114,12 @@ ;; INFO: Used lq/sq (defmethod init-from-entity! ((this actor-group-watcher) (arg0 entity-actor)) "Set up a newly created process from the entity that created it." - (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 actor-group) :tag-ptr (& sv-16))) + ) (cond ((and v1-1 (nonzero? (-> sv-16 elt-count))) - (set! (-> this actor-group) (the-as (pointer actor-group) v1-1)) + (set! (-> this actor-group) v1-1) (set! (-> this actor-group-count) (the-as int (-> sv-16 elt-count))) ) (else @@ -436,7 +436,6 @@ ;; INFO: Used lq/sq (defmethod init-from-entity! ((this tow-large-plat) (arg0 entity-actor)) "Set up a newly created process from the entity that created it." - (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) @@ -483,11 +482,12 @@ ) (set! (-> this final-y) (- f30-0 v1-17)) ) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-19 (res-lump-data (-> this entity) 'actor-groups pointer :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))) + ) (cond ((and v1-19 (nonzero? (-> sv-16 elt-count))) - (set! (-> this actor-group) (the-as (pointer actor-group) v1-19)) + (set! (-> this actor-group) v1-19) (set! (-> this actor-group-count) (the-as int (-> sv-16 elt-count))) ) (else @@ -1030,7 +1030,6 @@ ;; INFO: Used lq/sq (defmethod init-from-entity! ((this tow-tentacle) (arg0 entity-actor)) "Set up a newly created process from the entity that created it." - (local-vars (sv-16 collide-shape-prim-sphere) (sv-32 collide-shape-prim-sphere) (sv-48 vector)) (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) @@ -1052,19 +1051,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-32 sv-16) - (set! (-> sv-32 prim-core collide-as) (-> s3-0 prim-core collide-as)) - (set! (-> sv-32 prim-core collide-with) (-> s3-0 prim-core collide-with)) - (set! (-> sv-32 prim-core action) (-> s3-0 prim-core action)) - (set! (-> sv-32 transform-index) (command-get-int (car s0-0) 0)) - (set! (-> sv-32 prim-id) (the-as uint s2-0)) - (+! s2-0 1) - (set! sv-48 (-> sv-16 local-sphere)) - (set! (-> sv-48 x) 0.0) - (set! (-> sv-48 y) 0.0) - (set! (-> sv-48 z) 0.0) - (set! (-> sv-48 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-32 sv-16)) + (set! (-> sv-32 prim-core collide-as) (-> s3-0 prim-core collide-as)) + (set! (-> sv-32 prim-core collide-with) (-> s3-0 prim-core collide-with)) + (set! (-> sv-32 prim-core action) (-> s3-0 prim-core action)) + (set! (-> sv-32 transform-index) (command-get-int (car s0-0) 0)) + (set! (-> sv-32 prim-id) (the-as uint s2-0)) + ) + (+! s2-0 1) + (let ((sv-48 (-> sv-16 local-sphere))) + (set! (-> sv-48 x) 0.0) + (set! (-> sv-48 y) 0.0) + (set! (-> sv-48 z) 0.0) + (set! (-> sv-48 w) (command-get-float (car (cdr s0-0)) 0.0)) + ) + ) (set! s1-0 (cdr s1-0)) (set! s0-0 (car s1-0)) ) @@ -1147,3 +1149,7 @@ 0 (none) ) + + + + diff --git a/test/decompiler/reference/jak3/levels/volcano/volcano-obs_REF.gc b/test/decompiler/reference/jak3/levels/volcano/volcano-obs_REF.gc index 99a2587004..03128c0d96 100644 --- a/test/decompiler/reference/jak3/levels/volcano/volcano-obs_REF.gc +++ b/test/decompiler/reference/jak3/levels/volcano/volcano-obs_REF.gc @@ -83,15 +83,14 @@ ) (set! (-> self root trans y) (- (- (-> self init-y) f1-1) (* f0-0 f1-1))) ) - (let* ((gp-1 sound-play-by-name) - (s5-0 (make-u128 101 (the-as uint #x766f6d2d74616c70))) - (s4-0 (-> self sound-id)) - (f30-0 1024.0) - (f28-0 1.0) - (f0-6 (fabs (* 2.0 (- 0.5 (get-norm! (-> self sync) 0))))) - (f0-8 (* f0-6 f0-6)) - ) - (gp-1 (the-as sound-name s5-0) s4-0 (the int (* f30-0 (- f28-0 (* f0-8 f0-8)))) 0 0 (sound-group) #t) + (sound-play-by-name + (static-sound-name "plat-move") + (-> self sound-id) + (the int (* 1024.0 (- 1.0 (square (square (fabs (* 2.0 (- 0.5 (get-norm! (-> self sync) 0))))))))) + 0 + 0 + (sound-group) + #t ) (rider-post) ) diff --git a/test/decompiler/reference/jak3/levels/volcano/volcano-part_REF.gc b/test/decompiler/reference/jak3/levels/volcano/volcano-part_REF.gc index ae45dd55cf..dc03904b0d 100644 --- a/test/decompiler/reference/jak3/levels/volcano/volcano-part_REF.gc +++ b/test/decompiler/reference/jak3/levels/volcano/volcano-part_REF.gc @@ -593,7 +593,7 @@ (set! (-> v1-7 x) f0-2) (set! (-> v1-7 y) f1-3) (set! (-> v1-7 z) f2-0) - (set! (-> v1-7 w) (sqrtf (- (- (- 1.0 (* f2-0 f2-0)) (* f1-3 f1-3)) (* f0-2 f0-2)))) + (set! (-> v1-7 w) (sqrtf (- (- (- 1.0 (square f2-0)) (square f1-3)) (square f0-2)))) ) (matrix-u-f-compose s3-0 *y-vector* (vector-z-quaternion! (new 'stack-no-clear 'vector) s4-0)) (matrix->quaternion s4-0 s3-0) @@ -634,7 +634,7 @@ (set! (-> v1-12 x) f0-8) (set! (-> v1-12 y) f1-7) (set! (-> v1-12 z) f2-3) - (set! (-> v1-12 w) (sqrtf (- (- (- 1.0 (* f2-3 f2-3)) (* f1-7 f1-7)) (* f0-8 f0-8)))) + (set! (-> v1-12 w) (sqrtf (- (- (- 1.0 (square f2-3)) (square f1-7)) (square f0-8)))) ) (matrix-u-f-compose s3-1 *y-vector* (vector-z-quaternion! (new 'stack-no-clear 'vector) s5-1)) (matrix->quaternion s4-1 s3-1) diff --git a/test/decompiler/reference/jak3/levels/volcano/volcanox-obs_REF.gc b/test/decompiler/reference/jak3/levels/volcano/volcanox-obs_REF.gc index 8bf4ff42c2..b4da746208 100644 --- a/test/decompiler/reference/jak3/levels/volcano/volcanox-obs_REF.gc +++ b/test/decompiler/reference/jak3/levels/volcano/volcanox-obs_REF.gc @@ -410,11 +410,9 @@ ) (vector-copy! (-> self other-eyeball-jmod transform scale) (-> self root scale)) (vector-copy! (-> self eyeball-jmod transform scale) (-> self root scale)) - (let* ((f0-9 (lerp-scale 1.0 0.0 (the float (- (current-time) (-> self state-time))) 0.0 60.0)) - (f0-11 (* f0-9 f0-9)) - ) - (set! (-> self root scale x) (* f0-11 f0-11)) - ) + (set! (-> self root scale x) + (square (square (lerp-scale 1.0 0.0 (the float (- (current-time) (-> self state-time))) 0.0 60.0))) + ) (set! (-> self root scale y) (+ 1.0 (/ (-> self root scale x) 2))) (set! (-> self root scale z) (-> self root scale x)) (when (= (-> self root scale x) 0.0) @@ -470,7 +468,6 @@ ;; INFO: Used lq/sq (defmethod init-from-entity! ((this vol-holo-eye) (arg0 entity-actor)) "Set up a newly created process from the entity that created it." - (local-vars (sv-16 res-tag)) (set! (-> this root) (new 'process 'trsqv)) (process-drawable-from-entity! this arg0) (initialize-skeleton @@ -479,12 +476,13 @@ (the-as pair 0) ) (set! (-> this trigger-radius) 110592.0) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-6 (res-lump-data arg0 'actor-groups pointer :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-6 (res-lump-data arg0 'actor-groups (pointer actor-group) :tag-ptr (& sv-16))) + ) (cond ((and v1-6 (nonzero? (-> sv-16 elt-count))) (set! (-> this actor-group-count) (the-as int (-> sv-16 elt-count))) - (set! (-> this actor-group) (the-as (pointer actor-group) v1-6)) + (set! (-> this actor-group) v1-6) ) (else (format 0 "ERROR: ~s: entity missing actor-group!~%" (-> this name)) @@ -728,3 +726,7 @@ ) (go (method-of-object this open)) ) + + + + diff --git a/test/decompiler/reference/jak3/levels/wascity/bbush/des-bush-time-chase_REF.gc b/test/decompiler/reference/jak3/levels/wascity/bbush/des-bush-time-chase_REF.gc index f2d1296f6f..3977aa41b4 100644 --- a/test/decompiler/reference/jak3/levels/wascity/bbush/des-bush-time-chase_REF.gc +++ b/test/decompiler/reference/jak3/levels/wascity/bbush/des-bush-time-chase_REF.gc @@ -594,23 +594,19 @@ (add-process *gui-control* self (gui-channel bbush) (gui-action queue) "miss001" -99.0 0) ) ) - (let ((f0-1 (vector-vector-distance-squared (target-pos 0) (-> self root trans))) - (f1-1 (-> self activate-radius)) - ) - (when (< f0-1 (* f1-1 f1-1)) - (send-event (ppointer->process (-> self parent)) 'goal) - (set-action! - *gui-control* - (gui-action play) - (-> self sound-id) - (gui-channel none) - (gui-action none) - (the-as string #f) - (the-as (function gui-connection symbol) #f) - (the-as process #f) - ) - (go-virtual die) + (when (< (vector-vector-distance-squared (target-pos 0) (-> self root trans)) (square (-> self activate-radius))) + (send-event (ppointer->process (-> self parent)) 'goal) + (set-action! + *gui-control* + (gui-action play) + (-> self sound-id) + (gui-channel none) + (gui-action none) + (the-as string #f) + (the-as (function gui-connection symbol) #f) + (the-as process #f) ) + (go-virtual die) ) ) :code sleep-code @@ -1360,13 +1356,9 @@ (defstate dormant (bb-freeze) :virtual #t :trans (behavior () - (let ((f0-0 (vector-vector-distance-squared (target-pos 0) (-> self root trans))) - (f1-0 (-> self activate-radius)) - ) - (if (< f0-0 (* f1-0 f1-0)) - (go-virtual idle) - ) - ) + (if (< (vector-vector-distance-squared (target-pos 0) (-> self root trans)) (square (-> self activate-radius))) + (go-virtual idle) + ) ) :code sleep-code ) @@ -1383,30 +1375,26 @@ ) ) :trans (behavior () - (let ((f0-0 (-> self activate-radius))) - (if (< (* f0-0 f0-0) (vector-vector-distance-squared (target-pos 0) (-> self root trans))) - (go-virtual dormant) - ) - ) - (spawn (-> self part) (-> self root trans)) - (let ((f0-3 (vector-vector-distance-squared (target-pos 0) (-> self root trans))) - (f1-0 (-> self freeze-pickup-radius)) - ) - (when (< f0-3 (* f1-0 f1-0)) - (send-event (ppointer->process (-> self parent)) 'freeze (-> self freeze-time)) - (case (-> self bb-pickup-type) - (((bb-pickup-type small)) - (sound-play "small-pickup") - ) - (((bb-pickup-type medium)) - (sound-play "medium-pickup") - ) - (((bb-pickup-type large)) - (sound-play "large-pickup") - ) - ) - (go-virtual die) + (if (< (square (-> self activate-radius)) (vector-vector-distance-squared (target-pos 0) (-> self root trans))) + (go-virtual dormant) ) + (spawn (-> self part) (-> self root trans)) + (when (< (vector-vector-distance-squared (target-pos 0) (-> self root trans)) + (square (-> self freeze-pickup-radius)) + ) + (send-event (ppointer->process (-> self parent)) 'freeze (-> self freeze-time)) + (case (-> self bb-pickup-type) + (((bb-pickup-type small)) + (sound-play "small-pickup") + ) + (((bb-pickup-type medium)) + (sound-play "medium-pickup") + ) + (((bb-pickup-type large)) + (sound-play "large-pickup") + ) + ) + (go-virtual die) ) ) :code sleep-code @@ -1774,7 +1762,7 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch object vs none. (defmethod set-time-limit ((this task-manager-bbush-timer-chase)) - (local-vars (s4-0 object) (sv-96 res-tag)) + (local-vars (s4-0 object)) (let ((t9-0 (method-of-type task-manager set-time-limit))) (t9-0 this) ) @@ -1805,18 +1793,19 @@ (set! (-> this freeze-time-1) (res-lump-float s5-3 'freeze-time :default 10.0)) (set! (-> this freeze-time-2) (res-lump-float s5-3 'a-freeze-time :default 10.0)) (set! (-> this freeze-time-3) (res-lump-float s5-3 'b-freeze-time :default 10.0)) - (set! sv-96 (new 'static 'res-tag)) - (set! s4-0 (res-lump-data s5-3 'actor-groups pointer :tag-ptr (& sv-96))) - (cond - ((and (the-as pointer s4-0) (nonzero? (-> sv-96 elt-count))) - (format 0 "elt: ~d~%" (the-as pointer s4-0)) - (format 0 "elt2: ~d~%" (-> sv-96 elt-count)) - (set! (-> this actor-group-count) (the-as int (-> sv-96 elt-count))) - (set! (-> this actor-group) (the-as (pointer actor-group) s4-0)) - s4-0 - ) - (else - (format 0 "ERROR: ~s: entity missing actor-group!~%" (game-task->string (-> this node-info task))) + (let ((sv-96 (new 'static 'res-tag))) + (set! s4-0 (res-lump-data s5-3 'actor-groups (pointer actor-group) :tag-ptr (& sv-96))) + (cond + ((and (the-as (pointer actor-group) s4-0) (nonzero? (-> sv-96 elt-count))) + (format 0 "elt: ~d~%" (the-as (pointer actor-group) s4-0)) + (format 0 "elt2: ~d~%" (-> sv-96 elt-count)) + (set! (-> this actor-group-count) (the-as int (-> sv-96 elt-count))) + (set! (-> this actor-group) (the-as (pointer actor-group) s4-0)) + s4-0 + ) + (else + (format 0 "ERROR: ~s: entity missing actor-group!~%" (game-task->string (-> this node-info task))) + ) ) ) ) @@ -1964,7 +1953,6 @@ '() ) :trans (behavior () - (local-vars (sv-208 (function vector float vector)) (sv-224 vector) (sv-240 (function vector float vector))) (seek! (-> self freeze-time) 0.0 (seconds-per-frame)) (when (time-elapsed? (-> self color-flash-time) (seconds 1)) (set! (-> (the-as freeze-time-hud (handle->process (-> self freeze-time-hud))) strings 0 color) @@ -1996,24 +1984,12 @@ ) (new 'stack-no-clear 'vector) (when (and s3-0 s4-0) - (let ((s2-0 s5-0) - (s1-0 (method-of-type cubic-curve cubic-curve-method-9)) - (s0-0 (-> s3-0 trans)) - ) - (set! sv-208 vector-normalize!) - (let* ((a0-26 (vector-z-quaternion! (new 'stack-no-clear 'vector) (-> s3-0 quat))) - (a1-26 204800.0) - (s3-1 (sv-208 a0-26 a1-26)) - ) - (set! sv-224 (-> s4-0 trans)) - (set! sv-240 vector-normalize!) - (let* ((a0-28 (vector-z-quaternion! (new 'stack-no-clear 'vector) (-> s4-0 quat))) - (a1-28 204800.0) - (t0-0 (sv-240 a0-28 a1-28)) - ) - (s1-0 s2-0 s0-0 s3-1 sv-224 t0-0) - ) - ) + (cubic-curve-method-9 + s5-0 + (-> s3-0 trans) + (vector-normalize! (vector-z-quaternion! (new 'stack-no-clear 'vector) (-> s3-0 quat)) 204800.0) + (-> s4-0 trans) + (vector-normalize! (vector-z-quaternion! (new 'stack-no-clear 'vector) (-> s4-0 quat)) 204800.0) ) (cubic-curve-method-10 s5-0 (-> self trans) (- (-> self path-pos) (the float gp-0))) ) @@ -2112,3 +2088,7 @@ 0 (none) ) + + + + diff --git a/test/decompiler/reference/jak3/levels/wascity/chase/kanga-lizard_REF.gc b/test/decompiler/reference/jak3/levels/wascity/chase/kanga-lizard_REF.gc index 935409cbae..2a28c55879 100644 --- a/test/decompiler/reference/jak3/levels/wascity/chase/kanga-lizard_REF.gc +++ b/test/decompiler/reference/jak3/levels/wascity/chase/kanga-lizard_REF.gc @@ -1236,11 +1236,7 @@ (set! (-> self being-attacked) #f) ) ((and (focus-test? *target* dangerous) - (let ((f0-4 (vector-vector-distance-squared (-> self root trans) (target-pos 0))) - (f1-1 61440.0) - ) - (< f0-4 (* f1-1 f1-1)) - ) + (< (vector-vector-distance-squared (-> self root trans) (target-pos 0)) (square 61440.0)) ) (set! (-> self being-attacked) #t) ) @@ -1610,18 +1606,18 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch object vs none. (defmethod init-actor-group! ((this task-manager-kanga-lizard)) - (local-vars (sv-16 res-tag)) (when (not (-> this manager-entity)) (let ((a0-2 (entity-by-name "flut-1"))) (cond (a0-2 (set! (-> this manager-entity) a0-2) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-2 (res-lump-data a0-2 'actor-groups pointer :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-2 (res-lump-data a0-2 'actor-groups (pointer actor-group) :tag-ptr (& sv-16))) + ) (cond ((and v1-2 (nonzero? (-> sv-16 elt-count))) (set! (-> this actor-group-count) (the-as int (-> sv-16 elt-count))) - (set! (-> this actor-group) (the-as (pointer actor-group) v1-2)) + (set! (-> this actor-group) v1-2) ) (else (format 0 "ERROR: ~S: entity missing actor-group!~%" (game-task->string (-> this node-info task))) @@ -1663,3 +1659,7 @@ (reset-waschase-speeches) (none) ) + + + + diff --git a/test/decompiler/reference/jak3/levels/wascity/cty-faction_REF.gc b/test/decompiler/reference/jak3/levels/wascity/cty-faction_REF.gc index 075650522d..f73105baa4 100644 --- a/test/decompiler/reference/jak3/levels/wascity/cty-faction_REF.gc +++ b/test/decompiler/reference/jak3/levels/wascity/cty-faction_REF.gc @@ -494,7 +494,6 @@ ;; definition for method 20 of type cty-faction-manager (defmethod cty-faction-manager-method-20 ((this cty-faction-manager) (arg0 uint)) - (local-vars (sv-16 int) (sv-17 int) (sv-18 int)) (if (= arg0 (-> this last-active-territories)) (return 0) ) @@ -508,38 +507,40 @@ (dotimes (s1-0 30) (let ((s0-0 s1-0)) (when (and (logtest? (-> this territory-flags s0-0) 2) (logtest? arg0 (ash 1 s0-0))) - (set! sv-16 (cty-faction-manager-method-14 this (the-as nav-territory-type s0-0) 0 0)) - (set! sv-17 (cty-faction-manager-method-14 this (the-as nav-territory-type s0-0) 2 1)) - (set! sv-18 (cty-faction-manager-method-14 this (the-as nav-territory-type s0-0) 4 2)) - (when (and (logtest? sv-17 2) (not (logtest? s2-0 2))) - (when (!= (car s4-0) #f) - (set! (cdr s4-0) (-> *territory-list* s3-0)) - (+! s3-0 1) - (set! s4-0 (cdr s4-0)) + (let ((sv-16 (cty-faction-manager-method-14 this (the-as nav-territory-type s0-0) 0 0)) + (sv-17 (cty-faction-manager-method-14 this (the-as nav-territory-type s0-0) 2 1)) + (sv-18 (cty-faction-manager-method-14 this (the-as nav-territory-type s0-0) 4 2)) + ) + (when (and (logtest? sv-17 2) (not (logtest? s2-0 2))) + (when (!= (car s4-0) #f) + (set! (cdr s4-0) (-> *territory-list* s3-0)) + (+! s3-0 1) + (set! s4-0 (cdr s4-0)) + ) + (set! s2-0 (logior s2-0 2)) + (set! (car s4-0) (cty-faction-manager-method-21 this 1)) + (set! (cdr s4-0) '()) ) - (set! s2-0 (logior s2-0 2)) - (set! (car s4-0) (cty-faction-manager-method-21 this 1)) - (set! (cdr s4-0) '()) - ) - (when (and (logtest? sv-16 2) (not (logtest? s2-0 1))) - (when (!= (car s4-0) #f) - (set! (cdr s4-0) (-> *territory-list* s3-0)) - (+! s3-0 1) - (set! s4-0 (cdr s4-0)) + (when (and (logtest? sv-16 2) (not (logtest? s2-0 1))) + (when (!= (car s4-0) #f) + (set! (cdr s4-0) (-> *territory-list* s3-0)) + (+! s3-0 1) + (set! s4-0 (cdr s4-0)) + ) + (set! s2-0 (logior s2-0 1)) + (set! (car s4-0) (cty-faction-manager-method-21 this 0)) + (set! (cdr s4-0) '()) ) - (set! s2-0 (logior s2-0 1)) - (set! (car s4-0) (cty-faction-manager-method-21 this 0)) - (set! (cdr s4-0) '()) - ) - (when (and (logtest? sv-18 2) (not (logtest? s2-0 4))) - (when (!= (car s4-0) #f) - (set! (cdr s4-0) (-> *territory-list* s3-0)) - (+! s3-0 1) - (set! s4-0 (cdr s4-0)) + (when (and (logtest? sv-18 2) (not (logtest? s2-0 4))) + (when (!= (car s4-0) #f) + (set! (cdr s4-0) (-> *territory-list* s3-0)) + (+! s3-0 1) + (set! s4-0 (cdr s4-0)) + ) + (set! s2-0 (logior s2-0 4)) + (set! (car s4-0) (cty-faction-manager-method-21 this 2)) + (set! (cdr s4-0) '()) ) - (set! s2-0 (logior s2-0 4)) - (set! (car s4-0) (cty-faction-manager-method-21 this 2)) - (set! (cdr s4-0) '()) ) (logior! (-> this update-flags) (cty-faction-update-flag cfu0)) ) diff --git a/test/decompiler/reference/jak3/levels/wascity/defend/was-pre-game_REF.gc b/test/decompiler/reference/jak3/levels/wascity/defend/was-pre-game_REF.gc index ae0995bb9c..65b6d7ea41 100644 --- a/test/decompiler/reference/jak3/levels/wascity/defend/was-pre-game_REF.gc +++ b/test/decompiler/reference/jak3/levels/wascity/defend/was-pre-game_REF.gc @@ -2465,13 +2465,6 @@ ;; definition for method 27 of type was-pre-game ;; INFO: Used lq/sq (defmethod update-game-state ((this was-pre-game)) - (local-vars - (sv-32 function) - (sv-48 process) - (sv-64 (function entity-actor vector int time-frame float object :behavior pre-game-bubble)) - (sv-80 entity-actor) - (sv-96 int) - ) (+! (-> this beam-clock) (* 300.0 (seconds-per-frame))) (dotimes (s5-0 4) (set! (-> this beam s5-0 min) (+ 0.4 (* 0.2 (sin (* 36.40889 (-> this beam-clock)))))) @@ -2539,29 +2532,16 @@ ) ) ) - (let ((s0-0 (get-process *default-dead-pool* pre-game-bubble #x4000 1))) - (when s0-0 - (let ((t9-8 (method-of-type pre-game-bubble activate))) - (t9-8 (the-as pre-game-bubble s0-0) this "pre-game-bubble" (the-as pointer #x70004000)) - ) - (set! sv-32 run-function-in-process) - (set! sv-48 s0-0) - (set! sv-64 pre-game-bubble-init) - (set! sv-80 (-> this entity)) - (set! sv-96 0) - (let ((t2-1 (rand-vu-float-range (-> s5-2 gravity-min) (-> s5-2 gravity-max)))) - ((the-as (function object object object object object object object none) sv-32) - sv-48 - sv-64 - sv-80 - s2-0 - s1-0 - sv-96 - t2-1 - ) - ) - (-> s0-0 ppointer) - ) + (process-spawn + pre-game-bubble + :init pre-game-bubble-init + (-> this entity) + s2-0 + s1-0 + 0 + (rand-vu-float-range (-> s5-2 gravity-min) (-> s5-2 gravity-max)) + :name "pre-game-bubble" + :to this ) ) ) diff --git a/test/decompiler/reference/jak3/levels/wascity/dm-flyer_REF.gc b/test/decompiler/reference/jak3/levels/wascity/dm-flyer_REF.gc index 4cff65e994..066214cec5 100644 --- a/test/decompiler/reference/jak3/levels/wascity/dm-flyer_REF.gc +++ b/test/decompiler/reference/jak3/levels/wascity/dm-flyer_REF.gc @@ -235,41 +235,39 @@ (set! (-> s5-0 ignore-proc) (process->handle #f)) (explosion-spawn s5-0 (the-as process-drawable *default-pool*)) ) - (let ((f0-6 81920.0)) - (cond - ((< (* f0-6 f0-6) (vector-vector-distance-squared (-> self root trans) (target-pos 0))) - (forward-up->inv-matrix gp-0 (-> self pre-move-transv) *up-vector*) - (vector-copy! (-> gp-0 trans) (-> self root trans)) - (if (logtest? (-> group-maker-grenade-explosion flags) (sp-group-flag sp13)) - (part-tracker-spawn - part-tracker-subsampler - :to *entity-pool* - :group group-maker-grenade-explosion - :mat-joint gp-0 - ) - (part-tracker-spawn part-tracker :to *entity-pool* :group group-maker-grenade-explosion :mat-joint gp-0) + (cond + ((< (square 81920.0) (vector-vector-distance-squared (-> self root trans) (target-pos 0))) + (forward-up->inv-matrix gp-0 (-> self pre-move-transv) *up-vector*) + (vector-copy! (-> gp-0 trans) (-> self root trans)) + (if (logtest? (-> group-maker-grenade-explosion flags) (sp-group-flag sp13)) + (part-tracker-spawn + part-tracker-subsampler + :to *entity-pool* + :group group-maker-grenade-explosion + :mat-joint gp-0 ) - (sound-play "ball-explode") - ) - (else - (quaternion->matrix gp-0 (-> *target* control quat)) - (vector-copy! (-> gp-0 trans) (-> *target* control trans)) - (if (logtest? (-> group-maker-grenade-explosion-bottom flags) (sp-group-flag sp13)) - (part-tracker-spawn - part-tracker-subsampler - :to *entity-pool* - :group group-maker-grenade-explosion-bottom - :mat-joint gp-0 - ) - (part-tracker-spawn - part-tracker - :to *entity-pool* - :group group-maker-grenade-explosion-bottom - :mat-joint gp-0 - ) + (part-tracker-spawn part-tracker :to *entity-pool* :group group-maker-grenade-explosion :mat-joint gp-0) + ) + (sound-play "ball-explode") + ) + (else + (quaternion->matrix gp-0 (-> *target* control quat)) + (vector-copy! (-> gp-0 trans) (-> *target* control trans)) + (if (logtest? (-> group-maker-grenade-explosion-bottom flags) (sp-group-flag sp13)) + (part-tracker-spawn + part-tracker-subsampler + :to *entity-pool* + :group group-maker-grenade-explosion-bottom + :mat-joint gp-0 ) - (sound-play "ball-hit-turret") - ) + (part-tracker-spawn + part-tracker + :to *entity-pool* + :group group-maker-grenade-explosion-bottom + :mat-joint gp-0 + ) + ) + (sound-play "ball-hit-turret") ) ) ) @@ -569,12 +567,6 @@ ;; ERROR: Stack slot load at 128 mismatch: defined as size 4, got size 16 ;; WARN: Return type mismatch int vs none. (defmethod init-proj-settings! ((this dm-flyer-shot)) - (local-vars - (sv-80 (function float float float float float float)) - (sv-96 float) - (sv-112 float) - (sv-128 float) - ) (with-pp (initialize-skeleton this @@ -645,20 +637,11 @@ (f0-12 (vector-dot s5-6 *y-vector*)) (s4-3 (new 'stack-no-clear 'vector)) ) - (let ((s3-1 vector-lerp!) - (s2-0 s4-3) - (s1-0 *y-vector*) - (s0-0 *x-vector*) - ) - (set! sv-80 lerp-scale) - (set! sv-96 (the-as float 0.0)) - (set! sv-112 (the-as float 1.0)) - (set! sv-128 f0-12) - (let ((a3-5 (cos 14563.556)) - (t0-2 0.0) - ) - (s3-1 s2-0 s1-0 s0-0 (sv-80 sv-96 sv-112 sv-128 a3-5 t0-2)) - ) + (vector-lerp! + s4-3 + *y-vector* + *x-vector* + (lerp-scale (the-as float 0.0) (the-as float 1.0) f0-12 (cos 14563.556) 0.0) ) (forward-up->quaternion (-> this root quat) s5-6 s4-3) ) diff --git a/test/decompiler/reference/jak3/levels/wascity/flee-info_REF.gc b/test/decompiler/reference/jak3/levels/wascity/flee-info_REF.gc index 3232b2a5f8..a9202afdfd 100644 --- a/test/decompiler/reference/jak3/levels/wascity/flee-info_REF.gc +++ b/test/decompiler/reference/jak3/levels/wascity/flee-info_REF.gc @@ -29,7 +29,6 @@ ;; definition for method 9 of type flee-info ;; INFO: Used lq/sq (defmethod flee-info-method-9 ((this flee-info) (arg0 citizen) (arg1 nav-branch) (arg2 int) (arg3 vector) (arg4 float)) - (local-vars (sv-32 int)) (when (nonzero? arg2) (-> arg1 src-node) (let* ((s2-0 (-> arg1 dest-node)) @@ -44,10 +43,11 @@ (s1-0 (-> s2-0 branch-count)) (f30-0 0.0) ) - (set! sv-32 0) - (while (< sv-32 s1-0) - (+! f30-0 (flee-info-method-9 this arg0 (-> s2-0 branch-array sv-32) (+ arg2 -1) arg3 s0-0)) - (set! sv-32 (+ sv-32 1)) + (let ((sv-32 0)) + (while (< sv-32 s1-0) + (+! f30-0 (flee-info-method-9 this arg0 (-> s2-0 branch-array sv-32) (+ arg2 -1) arg3 s0-0)) + (+! sv-32 1) + ) ) (set! arg4 (+ s0-0 (the float (/ (the int f30-0) s1-0)))) ) @@ -91,7 +91,6 @@ ;; definition for method 13 of type flee-info ;; INFO: Used lq/sq (defmethod flee-info-method-13 ((this flee-info) (arg0 citizen)) - (local-vars (sv-80 nav-branch)) (let* ((s5-0 (-> arg0 controller)) (s2-0 (-> s5-0 branch dest-node)) (s4-0 (the-as nav-branch #f)) @@ -112,8 +111,9 @@ (f30-0 0.0) ) (dotimes (s0-2 s1-2) - (set! sv-80 (-> s2-0 branch-array s0-2)) - (let ((f0-5 (flee-info-method-9 this arg0 sv-80 4 (-> arg0 danger-pos) 0.0))) + (let* ((sv-80 (-> s2-0 branch-array s0-2)) + (f0-5 (flee-info-method-9 this arg0 sv-80 4 (-> arg0 danger-pos) 0.0)) + ) (when (< f30-0 f0-5) (set! f30-0 f0-5) (set! s4-0 sv-80) diff --git a/test/decompiler/reference/jak3/levels/wascity/formation-object_REF.gc b/test/decompiler/reference/jak3/levels/wascity/formation-object_REF.gc index 433d8aa0a6..d2f0e028c7 100644 --- a/test/decompiler/reference/jak3/levels/wascity/formation-object_REF.gc +++ b/test/decompiler/reference/jak3/levels/wascity/formation-object_REF.gc @@ -383,7 +383,7 @@ (formation-object-method-34 self) (let ((f30-0 (formation-object-method-33 self))) (when (and (nonzero? (-> self controller branch)) - (< (vector-vector-xz-distance-squared (-> self root trans) (-> self dest-position)) (* f30-0 f30-0)) + (< (vector-vector-xz-distance-squared (-> self root trans) (-> self dest-position)) (square f30-0)) ) (let ((s5-0 (new 'stack-no-clear 'vector)) (gp-0 (new 'stack-no-clear 'vector)) diff --git a/test/decompiler/reference/jak3/levels/wascity/leaper/was-leaper-race_REF.gc b/test/decompiler/reference/jak3/levels/wascity/leaper/was-leaper-race_REF.gc index 101e6c0a66..5655c33795 100644 --- a/test/decompiler/reference/jak3/levels/wascity/leaper/was-leaper-race_REF.gc +++ b/test/decompiler/reference/jak3/levels/wascity/leaper/was-leaper-race_REF.gc @@ -1279,16 +1279,16 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defmethod init-actor-group! ((this task-manager-wascity-leaper-race)) - (local-vars (sv-16 res-tag)) (let ((a0-2 (entity-by-name "wascity-leaper-race-manager-1"))) (when a0-2 (set! (-> this ring-manager-entity) a0-2) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-1 (res-lump-data a0-2 'actor-groups pointer :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-1 (res-lump-data a0-2 'actor-groups (pointer actor-group) :tag-ptr (& sv-16))) + ) (cond ((and v1-1 (>= (-> sv-16 elt-count) 0)) (set! (-> this actor-group-count) (the-as int (-> sv-16 elt-count))) - (set! (-> this actor-group) (the-as (pointer actor-group) v1-1)) + (set! (-> this actor-group) v1-1) (when (> (-> this actor-group-count) 0) (let* ((s5-0 (-> this actor-group 0 length)) (s4-0 0) @@ -1350,3 +1350,7 @@ (set-setting! 'airlock #f 0.0 0) (none) ) + + + + diff --git a/test/decompiler/reference/jak3/levels/wascity/maker-projectile_REF.gc b/test/decompiler/reference/jak3/levels/wascity/maker-projectile_REF.gc index ed0587b41d..f502c5c77a 100644 --- a/test/decompiler/reference/jak3/levels/wascity/maker-projectile_REF.gc +++ b/test/decompiler/reference/jak3/levels/wascity/maker-projectile_REF.gc @@ -790,41 +790,39 @@ (set! (-> s5-0 ignore-proc) (process->handle #f)) (explosion-spawn s5-0 (the-as process-drawable *default-pool*)) ) - (let ((f0-6 81920.0)) - (cond - ((< (* f0-6 f0-6) (vector-vector-distance-squared (-> self root trans) (target-pos 0))) - (forward-up->inv-matrix gp-0 (-> self pre-move-transv) *up-vector*) - (vector-copy! (-> gp-0 trans) (-> self root trans)) - (if (logtest? (-> group-maker-grenade-explosion flags) (sp-group-flag sp13)) - (part-tracker-spawn - part-tracker-subsampler - :to *entity-pool* - :group group-maker-grenade-explosion - :mat-joint gp-0 - ) - (part-tracker-spawn part-tracker :to *entity-pool* :group group-maker-grenade-explosion :mat-joint gp-0) + (cond + ((< (square 81920.0) (vector-vector-distance-squared (-> self root trans) (target-pos 0))) + (forward-up->inv-matrix gp-0 (-> self pre-move-transv) *up-vector*) + (vector-copy! (-> gp-0 trans) (-> self root trans)) + (if (logtest? (-> group-maker-grenade-explosion flags) (sp-group-flag sp13)) + (part-tracker-spawn + part-tracker-subsampler + :to *entity-pool* + :group group-maker-grenade-explosion + :mat-joint gp-0 ) - (sound-play "ball-explode") - ) - (else - (quaternion->matrix gp-0 (-> *target* control quat)) - (vector-copy! (-> gp-0 trans) (-> *target* control trans)) - (if (logtest? (-> group-maker-grenade-explosion-bottom flags) (sp-group-flag sp13)) - (part-tracker-spawn - part-tracker-subsampler - :to *entity-pool* - :group group-maker-grenade-explosion-bottom - :mat-joint gp-0 - ) - (part-tracker-spawn - part-tracker - :to *entity-pool* - :group group-maker-grenade-explosion-bottom - :mat-joint gp-0 - ) + (part-tracker-spawn part-tracker :to *entity-pool* :group group-maker-grenade-explosion :mat-joint gp-0) + ) + (sound-play "ball-explode") + ) + (else + (quaternion->matrix gp-0 (-> *target* control quat)) + (vector-copy! (-> gp-0 trans) (-> *target* control trans)) + (if (logtest? (-> group-maker-grenade-explosion-bottom flags) (sp-group-flag sp13)) + (part-tracker-spawn + part-tracker-subsampler + :to *entity-pool* + :group group-maker-grenade-explosion-bottom + :mat-joint gp-0 ) - (sound-play "ball-hit-turret") - ) + (part-tracker-spawn + part-tracker + :to *entity-pool* + :group group-maker-grenade-explosion-bottom + :mat-joint gp-0 + ) + ) + (sound-play "ball-hit-turret") ) ) ) diff --git a/test/decompiler/reference/jak3/levels/wascity/squad-control-city_REF.gc b/test/decompiler/reference/jak3/levels/wascity/squad-control-city_REF.gc index c5166874cb..56156d04bf 100644 --- a/test/decompiler/reference/jak3/levels/wascity/squad-control-city_REF.gc +++ b/test/decompiler/reference/jak3/levels/wascity/squad-control-city_REF.gc @@ -66,11 +66,10 @@ ;; definition for method 38 of type squad-control-city (defmethod squad-control-city-method-38 ((this squad-control-city) (arg0 process-focusable) (arg1 process-focusable)) - (let* ((s5-0 (get-trans arg1 0)) - (f0-0 (vector-vector-xz-distance-squared (-> arg0 root trans) s5-0)) - (f1-0 245760.0) - ) - (or (< f0-0 (* f1-0 f1-0)) (< (fabs (- (-> s5-0 y) (-> arg0 root trans y))) 61440.0)) + (let ((s5-0 (get-trans arg1 0))) + (or (< (vector-vector-xz-distance-squared (-> arg0 root trans) s5-0) (square 245760.0)) + (< (fabs (- (-> s5-0 y) (-> arg0 root trans y))) 61440.0) + ) ) ) @@ -105,7 +104,6 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch process-drawable vs process-focusable. (defmethod squad-control-city-method-35 ((this squad-control-city) (arg0 citizen) (arg1 handle)) - (local-vars (sv-16 vector) (sv-32 vector) (sv-48 vector)) (let ((s2-0 (as-type (handle->process arg1) process-focusable)) (s1-0 #f) (s4-1 arg0) @@ -131,10 +129,9 @@ (set! s3-0 (get-focus-in-range this s4-1)) (goto cfg-121) ) - (let* ((f30-0 0.0) - (f0-0 40960000.0) - (f28-0 (* f0-0 f0-0)) - ) + (let ((f30-0 0.0) + (f28-0 (square 40960000.0)) + ) (when #t (let ((v1-22 (-> *collide-player-list* alive-list next0))) *collide-player-list* @@ -169,15 +166,15 @@ (set! s3-0 s1-1) ) ((= f26-0 f30-0) - (let ((s0-2 vector-vector-xz-distance-squared)) - (set! sv-16 (-> arg0 root trans)) - (let* ((a1-25 (get-trans (the-as process-focusable s1-1) 3)) - (f0-4 (* (s0-2 sv-16 a1-25) (squad-control-city-method-42 this))) - ) - (when (< f0-4 f28-0) - (set! f28-0 f0-4) - (set! s3-0 s1-1) + (let ((f0-4 + (* (vector-vector-xz-distance-squared (-> arg0 root trans) (get-trans (the-as process-focusable s1-1) 3)) + (squad-control-city-method-42 this) + ) + ) ) + (when (< f0-4 f28-0) + (set! f28-0 f0-4) + (set! s3-0 s1-1) ) ) ) @@ -230,15 +227,15 @@ (set! s3-0 s1-2) ) ((= f26-2 f30-0) - (let ((s0-5 vector-vector-xz-distance-squared)) - (set! sv-32 (-> arg0 root trans)) - (let* ((a1-41 (get-trans (the-as process-focusable s1-2) 3)) - (f0-7 (* (s0-5 sv-32 a1-41) (squad-control-city-method-42 this))) - ) - (when (< f0-7 f28-0) - (set! f28-0 f0-7) - (set! s3-0 s1-2) + (let ((f0-7 + (* (vector-vector-xz-distance-squared (-> arg0 root trans) (get-trans (the-as process-focusable s1-2) 3)) + (squad-control-city-method-42 this) + ) + ) ) + (when (< f0-7 f28-0) + (set! f28-0 f0-7) + (set! s3-0 s1-2) ) ) ) @@ -290,15 +287,15 @@ (set! s3-0 s1-3) ) ((= f26-4 f30-0) - (let ((s0-8 vector-vector-xz-distance-squared)) - (set! sv-48 (-> arg0 root trans)) - (let* ((a1-57 (get-trans (the-as process-focusable s1-3) 3)) - (f0-10 (* (s0-8 sv-48 a1-57) (squad-control-city-method-42 this))) - ) - (when (< f0-10 f28-0) - (set! f28-0 f0-10) - (set! s3-0 s1-3) + (let ((f0-10 + (* (vector-vector-xz-distance-squared (-> arg0 root trans) (get-trans (the-as process-focusable s1-3) 3)) + (squad-control-city-method-42 this) + ) + ) ) + (when (< f0-10 f28-0) + (set! f28-0 f0-10) + (set! s3-0 s1-3) ) ) ) diff --git a/test/decompiler/reference/jak3/levels/wascity/tizard_REF.gc b/test/decompiler/reference/jak3/levels/wascity/tizard_REF.gc index 27370f499b..7e933e39d9 100644 --- a/test/decompiler/reference/jak3/levels/wascity/tizard_REF.gc +++ b/test/decompiler/reference/jak3/levels/wascity/tizard_REF.gc @@ -303,80 +303,76 @@ ;; definition for method 34 of type tizard ;; WARN: Return type mismatch int vs none. (defmethod tizard-method-34 ((this tizard)) - (local-vars - (sv-592 collide-query) - (sv-596 (inline-array sphere)) - (sv-600 vector) - (sv-604 matrix) - (sv-608 pat-surface) - ) - (set! sv-592 (new 'stack-no-clear 'collide-query)) - (let ((s5-0 (new 'stack-no-clear 'inline-array 'sphere 2))) + (let ((sv-592 (new 'stack-no-clear 'collide-query)) + (s5-0 (new 'stack-no-clear 'inline-array 'sphere 2)) + ) (dotimes (s4-0 2) ((method-of-type sphere new) (the-as symbol (-> s5-0 s4-0)) sphere) ) - (set! sv-596 s5-0) - ) - (set! sv-600 (-> this root trans)) - (set! sv-604 (-> this rotation-matrix)) - (set! sv-608 (new 'static 'pat-surface :noentity #x1 :probe #x1 :noendlessfall #x1)) - (vector+float*! (the-as vector (-> sv-596 0)) sv-600 (-> sv-604 fvec) 4096.0) - (set! (-> sv-596 0 r) 10240.0) - (vector+float*! (the-as vector (-> sv-596 1)) sv-600 (-> sv-604 fvec) -4096.0) - (set! (-> sv-596 1 r) 10240.0) - (let ((v1-19 sv-592)) - (set! (-> v1-19 best-dist) (the-as float sv-596)) - (set! (-> v1-19 best-other-prim) (the-as collide-shape-prim 2)) - (set! (-> v1-19 collide-with) (collide-spec backgnd obstacle)) - (set! (-> v1-19 ignore-process0) this) - (set! (-> v1-19 ignore-process1) #f) - (set! (-> v1-19 ignore-pat) sv-608) - (set! (-> v1-19 best-my-prim) (the-as collide-shape-prim #t)) - (set! (-> v1-19 action-mask) (collide-action solid)) - ) - (fill-using-spheres *collide-cache* sv-592) - (vector-reset! (-> this path-dir)) - (dotimes (s5-1 2) - (let ((f0-4 819.2)) - (let ((v1-26 (-> this ground-normal s5-1))) - (vector+float*! (-> sv-592 start-pos) (the-as vector (-> sv-596 s5-1)) (-> this ground-normal s5-1) 8192.0) - (vector-float*! (-> sv-592 move-dist) v1-26 -16384.0) + (let ((sv-596 s5-0) + (sv-600 (-> this root trans)) + (sv-604 (-> this rotation-matrix)) + (sv-608 (new 'static 'pat-surface :noentity #x1 :probe #x1 :noendlessfall #x1)) + ) + (vector+float*! (the-as vector (-> sv-596 0)) sv-600 (-> sv-604 fvec) 4096.0) + (set! (-> sv-596 0 r) 10240.0) + (vector+float*! (the-as vector (-> sv-596 1)) sv-600 (-> sv-604 fvec) -4096.0) + (set! (-> sv-596 1 r) 10240.0) + (let ((v1-19 sv-592)) + (set! (-> v1-19 best-dist) (the-as float sv-596)) + (set! (-> v1-19 best-other-prim) (the-as collide-shape-prim 2)) + (set! (-> v1-19 collide-with) (collide-spec backgnd obstacle)) + (set! (-> v1-19 ignore-process0) this) + (set! (-> v1-19 ignore-process1) #f) + (set! (-> v1-19 ignore-pat) sv-608) + (set! (-> v1-19 best-my-prim) (the-as collide-shape-prim #t)) + (set! (-> v1-19 action-mask) (collide-action solid)) ) - (let ((v1-27 sv-592)) - (set! (-> v1-27 radius) f0-4) - (set! (-> v1-27 collide-with) (collide-spec backgnd obstacle)) - (set! (-> v1-27 ignore-process0) #f) - (set! (-> v1-27 ignore-process1) #f) - (set! (-> v1-27 ignore-pat) sv-608) - (set! (-> v1-27 action-mask) (collide-action solid)) - ) - ) - (let ((f0-5 (probe-using-line-sphere *collide-cache* sv-592))) - (when (>= f0-5 0.0) - (let ((v1-31 (new 'stack-no-clear 'vector)) - (s4-1 (new 'stack-no-clear 'vector)) - ) - (vector+float*! v1-31 (-> sv-592 start-pos) (-> sv-592 move-dist) f0-5) - (vector-! s4-1 v1-31 (-> sv-592 best-other-tri intersect)) - (vector-normalize! s4-1 1.0) - (let ((s3-0 (new 'stack-no-clear 'quaternion))) - (quaternion-from-two-vectors-partial! s3-0 (-> this ground-normal s5-1) s4-1 (* 4.0 (seconds-per-frame))) - (vector-orient-by-quat! (-> this ground-normal s5-1) (-> this ground-normal s5-1) s3-0) + (fill-using-spheres *collide-cache* sv-592) + (vector-reset! (-> this path-dir)) + (dotimes (s5-1 2) + (let ((f0-4 819.2)) + (let ((v1-26 (-> this ground-normal s5-1))) + (vector+float*! (-> sv-592 start-pos) (the-as vector (-> sv-596 s5-1)) (-> this ground-normal s5-1) 8192.0) + (vector-float*! (-> sv-592 move-dist) v1-26 -16384.0) + ) + (let ((v1-27 sv-592)) + (set! (-> v1-27 radius) f0-4) + (set! (-> v1-27 collide-with) (collide-spec backgnd obstacle)) + (set! (-> v1-27 ignore-process0) #f) + (set! (-> v1-27 ignore-process1) #f) + (set! (-> v1-27 ignore-pat) sv-608) + (set! (-> v1-27 action-mask) (collide-action solid)) ) ) - 0 + (let ((f0-5 (probe-using-line-sphere *collide-cache* sv-592))) + (when (>= f0-5 0.0) + (let ((v1-31 (new 'stack-no-clear 'vector)) + (s4-1 (new 'stack-no-clear 'vector)) + ) + (vector+float*! v1-31 (-> sv-592 start-pos) (-> sv-592 move-dist) f0-5) + (vector-! s4-1 v1-31 (-> sv-592 best-other-tri intersect)) + (vector-normalize! s4-1 1.0) + (let ((s3-0 (new 'stack-no-clear 'quaternion))) + (quaternion-from-two-vectors-partial! s3-0 (-> this ground-normal s5-1) s4-1 (* 4.0 (seconds-per-frame))) + (vector-orient-by-quat! (-> this ground-normal s5-1) (-> this ground-normal s5-1) s3-0) + ) + ) + 0 + ) + ) + (let ((s4-2 (new 'stack-no-clear 'quaternion))) + (quaternion-from-two-vectors-partial! + s4-2 + (-> this ground-normal s5-1) + (-> sv-604 uvec) + (* 3.0 (seconds-per-frame)) + ) + (vector-orient-by-quat! (-> this ground-normal s5-1) (-> this ground-normal s5-1) s4-2) + ) + (vector+! (-> this path-dir) (-> this path-dir) (-> this ground-normal s5-1)) ) ) - (let ((s4-2 (new 'stack-no-clear 'quaternion))) - (quaternion-from-two-vectors-partial! - s4-2 - (-> this ground-normal s5-1) - (-> sv-604 uvec) - (* 3.0 (seconds-per-frame)) - ) - (vector-orient-by-quat! (-> this ground-normal s5-1) (-> this ground-normal s5-1) s4-2) - ) - (vector+! (-> this path-dir) (-> this path-dir) (-> this ground-normal s5-1)) ) (vector-normalize! (-> this path-dir) 1.0) 0 @@ -416,21 +412,22 @@ ;; definition for function tizard-tilt-jmod-func ;; WARN: Return type mismatch int vs none. (defun tizard-tilt-jmod-func ((arg0 cspace) (arg1 transformq)) - (local-vars (sv-32 tizard) (sv-36 int) (sv-40 quaternion)) - (set! sv-32 (the-as tizard (-> arg0 param1))) - (set! sv-36 (the-as int (-> arg0 param2))) - (set! sv-40 (new 'stack-no-clear 'quaternion)) - (let ((s4-0 (new 'stack-no-clear 'vector)) - (s3-0 (new 'stack-no-clear 'vector)) + (let ((sv-32 (the-as tizard (-> arg0 param1))) + (sv-36 (the-as int (-> arg0 param2))) + (sv-40 (new 'stack-no-clear 'quaternion)) ) - (let ((s2-0 (-> (the-as tizard sv-32) root quat))) - (vector-inv-orient-by-quat! s4-0 (-> (the-as tizard sv-32) rotation-matrix uvec) s2-0) - (vector-inv-orient-by-quat! s3-0 (-> (the-as tizard sv-32) ground-normal sv-36) s2-0) + (let ((s4-0 (new 'stack-no-clear 'vector)) + (s3-0 (new 'stack-no-clear 'vector)) + ) + (let ((s2-0 (-> (the-as tizard sv-32) root quat))) + (vector-inv-orient-by-quat! s4-0 (-> (the-as tizard sv-32) rotation-matrix uvec) s2-0) + (vector-inv-orient-by-quat! s3-0 (-> (the-as tizard sv-32) ground-normal sv-36) s2-0) + ) + (quaternion-from-two-vectors! sv-40 s4-0 s3-0) ) - (quaternion-from-two-vectors! sv-40 s4-0 s3-0) + (quaternion-normalize! sv-40) + (quaternion*! (-> arg1 quat) (-> arg1 quat) sv-40) ) - (quaternion-normalize! sv-40) - (quaternion*! (-> arg1 quat) (-> arg1 quat) sv-40) (quaternion-normalize! (-> arg1 quat)) (cspace<-parented-transformq-joint! arg0 arg1) 0 diff --git a/test/decompiler/reference/jak3/levels/wascity/traffic-util_REF.gc b/test/decompiler/reference/jak3/levels/wascity/traffic-util_REF.gc index f528a58b79..8af5531923 100644 --- a/test/decompiler/reference/jak3/levels/wascity/traffic-util_REF.gc +++ b/test/decompiler/reference/jak3/levels/wascity/traffic-util_REF.gc @@ -12,7 +12,6 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defmethod debug-draw ((this vis-cell)) - (local-vars (sv-48 (function _varargs_ object))) (dotimes (s5-0 (-> this segment-count)) (let ((s4-0 (-> this segment-array s5-0))) (add-debug-line #t (bucket-id debug) (-> s4-0 vertex 0) (-> s4-0 vertex 1) *color-white* #f *color-black*) @@ -26,13 +25,7 @@ (s1-0 #t) (s0-0 583) ) - (set! sv-48 format) - (let ((a0-7 (clear *temp-string*)) - (a1-2 "~d") - (a2-1 (-> s4-0 branch clock-type)) - ) - (sv-48 a0-7 a1-2 a2-1) - ) + (format (clear *temp-string*) "~d" (-> s4-0 branch clock-type)) (s2-0 s1-0 (the-as bucket-id s0-0) *temp-string* s3-1 (font-color red) (the-as vector2h #f)) ) (add-debug-x #t (bucket-id debug) (-> s4-0 vertex 1) *color-red*) @@ -406,54 +399,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) @@ -668,13 +654,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))) (vector-copy! arg2 arg0) (vector+*! arg2 arg2 (-> s5-0 0) f1-15) ) @@ -697,11 +680,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)) @@ -758,25 +740,6 @@ ;; WARN: Stack slot offset 100 signed mismatch ;; WARN: Stack slot offset 100 signed mismatch (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) @@ -791,173 +754,180 @@ (format 0 "segments not generates~%") (return #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) - ) - (vector-copy! v1-26 (-> a1-1 position)) - (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) - ) - (vector-copy! v1-29 (-> a1-4 position)) - (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) - ) - (vector-copy! v1-72 (-> a1-16 position)) - (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) ) - (vector-copy! v1-76 (-> a1-19 position)) - (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) + ) + (vector-copy! v1-26 (-> a1-1 position)) + (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) + ) + (vector-copy! v1-29 (-> a1-4 position)) + (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)) - (vector-copy! sv-248 (-> sv-104 pos)) - (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 #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)) - (vector-copy! (-> s2-1 vertex 1) (-> sv-104 pos)) - (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) + ) + (vector-copy! v1-72 (-> a1-16 position)) + (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) + ) + (vector-copy! v1-76 (-> a1-19 position)) + (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)) + (vector-copy! sv-248 (-> sv-104 pos)) + (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 #f) + ) + (let ((s2-1 (-> sv-260 segment-array a2-14))) + (set! (-> s2-1 vertex 0 quad) (-> sv-248 quad)) + (vector-copy! (-> s2-1 vertex 1) (-> sv-104 pos)) + (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)) ) ) ) @@ -1032,19 +1002,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))) ) @@ -1109,7 +1074,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))) @@ -1128,50 +1092,55 @@ (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) - ) - (vector-copy! v1-35 (-> a1-7 position)) - (set! (-> v1-35 w) 1.0) - ) - (let ((a1-10 sv-80) - (v1-36 sv-92) - ) - (vector-copy! v1-36 (-> a1-10 position)) - (set! (-> v1-36 w) 1.0) - ) - (vector-! sv-84 sv-92 sv-88) - (vector+float*! sv-84 sv-88 sv-84 0.5) - (let ((s4-1 add-debug-text-3d) - (s3-0 #t) - (s2-0 583) - ) - (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) + ) + (vector-copy! v1-35 (-> a1-7 position)) + (set! (-> v1-35 w) 1.0) + ) + (let ((a1-10 sv-80) + (v1-36 sv-92) + ) + (vector-copy! v1-36 (-> a1-10 position)) + (set! (-> v1-36 w) 1.0) + ) + (vector-! sv-84 sv-92 sv-88) ) - (the-as vector2h #f) + (vector+float*! sv-84 sv-88 sv-84 0.5) + ) + (let ((s4-1 add-debug-text-3d) + (s3-0 #t) + (s2-0 583) + ) + (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)) ) ) ) diff --git a/test/decompiler/reference/jak3/levels/wascity/wascity-turret_REF.gc b/test/decompiler/reference/jak3/levels/wascity/wascity-turret_REF.gc index fceedfcee7..60f8941c82 100644 --- a/test/decompiler/reference/jak3/levels/wascity/wascity-turret_REF.gc +++ b/test/decompiler/reference/jak3/levels/wascity/wascity-turret_REF.gc @@ -1066,19 +1066,7 @@ ;; ERROR: Unsupported inline assembly instruction kind - [madda.s f1, f4] ;; ERROR: Unsupported inline assembly instruction kind - [madd.s f0, f2, f5] (defmethod wascity-turret-method-62 ((this wascity-turret)) - (local-vars - (f0-30 float) - (sv-896 collide-prim-core) - (sv-912 vector) - (sv-928 vector) - (sv-944 int) - (sv-960 process) - (sv-976 collide-shape-prim) - (sv-992 int) - (sv-1008 vector) - (sv-1024 vector) - (sv-1040 vector) - ) + (local-vars (f0-30 float)) (with-pp (rlet ((vf0 :class vf) (vf4 :class vf) @@ -1106,9 +1094,10 @@ (set! (-> s4-0 length) s2-1) (let ((s3-1 (the-as process #f))) (dotimes (s1-0 s2-1) - (set! sv-896 (-> s4-0 s1-0 root-prim prim-core)) - (let ((s0-0 (-> s4-0 s1-0 root-prim cshape process))) - (set! sv-912 (new 'stack-no-clear 'vector)) + (let ((sv-896 (-> s4-0 s1-0 root-prim prim-core)) + (s0-0 (-> s4-0 s1-0 root-prim cshape process)) + (sv-912 (new 'stack-no-clear 'vector)) + ) (let ((v1-21 sv-896) (a0-8 (-> s5-0 trans)) ) @@ -1141,12 +1130,9 @@ (if #f (add-debug-sphere #t (bucket-id debug) (-> sv-896 world-sphere) (-> sv-896 world-sphere w) *color-red*) ) - (let* ((t9-8 vector-normalize-copy!) - (a0-22 (new 'stack-no-clear 'vector)) - (a2-7 1.0) - (f22-0 (vector-dot (t9-8 a0-22 sv-912 a2-7) (-> s5-0 fvec))) - ) - (set! sv-928 (new 'stack-no-clear 'vector)) + (let ((f22-0 (vector-dot (vector-normalize-copy! (new 'stack-no-clear 'vector) sv-912 1.0) (-> s5-0 fvec))) + (sv-928 (new 'stack-no-clear 'vector)) + ) (set-vector! sv-928 f24-0 0.0 (-> sv-896 world-sphere w) 1.0) (vector-normalize! sv-928 1.0) (let ((f0-17 (/ f22-0 (-> sv-928 x)))) @@ -1173,69 +1159,70 @@ (when (and s2-2 (as-type (-> (the-as process-drawable s2-2) root) collide-shape)) (let ((s0-1 (new 'stack-no-clear 'vector)) (s1-1 (new 'stack-no-clear 'vector)) + (sv-1024 (new 'stack-no-clear 'vector)) + (s3-2 (new 'stack-no-clear 'vector)) + (s4-3 (new 'stack-no-clear 'vector)) + (sv-1040 (new 'stack-no-clear 'vector)) + (sv-976 (-> (the-as collide-shape (-> (the-as process-drawable s2-2) root)) root-prim)) + (sv-944 -1) ) - (set! sv-1024 (new 'stack-no-clear 'vector)) - (let ((s3-2 (new 'stack-no-clear 'vector)) - (s4-3 (new 'stack-no-clear 'vector)) - ) - (set! sv-1040 (new 'stack-no-clear 'vector)) - (set! sv-976 (-> (the-as collide-shape (-> (the-as process-drawable s2-2) root)) root-prim)) - (set! sv-944 -1) - (vector-copy! s1-1 (-> sv-976 prim-core world-sphere)) - (vector-copy! sv-1024 s1-1) - (vector-copy! s0-1 s1-1) - (when (= (-> s2-2 type) skeet) - (set! sv-960 s2-2) - (let ((f28-1 (/ f28-0 (meters 1800)))) - (if #f - (add-debug-sphere #t (bucket-id debug) s1-1 (meters 12) *color-red*) - ) - (vector+*! s0-1 s1-1 (-> (the-as skeet sv-960) pvel) f28-1) - ) - (if #f - (add-debug-sphere #t (bucket-id debug) s0-1 (meters 12) *color-green*) + (vector-copy! s1-1 (-> sv-976 prim-core world-sphere)) + (vector-copy! sv-1024 s1-1) + (vector-copy! s0-1 s1-1) + (when (= (-> s2-2 type) skeet) + (let ((sv-960 s2-2) + (f28-1 (/ f28-0 (meters 1800))) ) + (if #f + (add-debug-sphere #t (bucket-id debug) s1-1 (meters 12) *color-red*) + ) + (vector+*! s0-1 s1-1 (-> (the-as skeet sv-960) pvel) f28-1) ) - (when (and (= (-> s2-2 type) maker) (= (-> sv-976 type) collide-shape-prim-group)) - (if #f - (add-debug-sphere #t (bucket-id debug) s1-1 (-> s1-1 w) *color-red*) + (if #f + (add-debug-sphere #t (bucket-id debug) s0-1 (meters 12) *color-green*) + ) + ) + (when (and (= (-> s2-2 type) maker) (= (-> sv-976 type) collide-shape-prim-group)) + (if #f + (add-debug-sphere #t (bucket-id debug) s1-1 (-> s1-1 w) *color-red*) + ) + (let ((f28-2 1.0) + (sv-992 0) ) - (let ((f28-2 1.0)) - (set! sv-992 0) - (while (< sv-992 (the-as int (-> sv-976 specific 0))) - (let* ((a1-19 - (vector-! - (new 'stack-no-clear 'vector) - (-> (the-as collide-shape-prim-group sv-976) child sv-992 prim-core world-sphere) - (-> s5-0 trans) - ) + (while (< sv-992 (the-as int (-> sv-976 specific 0))) + (let* ((a1-19 + (vector-! + (new 'stack-no-clear 'vector) + (-> (the-as collide-shape-prim-group sv-976) child sv-992 prim-core world-sphere) + (-> s5-0 trans) ) - (f26-2 - (- 1.0 (vector-dot (vector-normalize-copy! (new 'stack-no-clear 'vector) a1-19 1.0) (-> this aim-dir))) - ) - (a1-20 (new 'stack-no-clear 'event-message-block)) ) - (set! (-> a1-20 from) (process->ppointer pp)) - (set! (-> a1-20 num-params) 1) - (set! (-> a1-20 message) 'is-section-shot) - (set! (-> a1-20 param 0) (-> (the-as collide-shape-prim-group sv-976) child sv-992 prim-id)) - (when (and (not (send-event-function s2-2 a1-20)) (< f26-2 f28-2)) - (vector-copy! s0-1 (-> (the-as collide-shape-prim-group sv-976) child sv-992 prim-core world-sphere)) - (vector-copy! sv-1024 s0-1) - (vector-copy! s1-1 s0-1) - (if #f - (add-debug-sphere #t (bucket-id debug) s0-1 (-> s0-1 w) *color-blue*) - ) - (set! f28-2 f26-2) - (set! sv-944 (the-as int (-> (the-as collide-shape-prim-group sv-976) child sv-992 prim-id))) - (the-as uint sv-944) - ) + (f26-2 + (- 1.0 (vector-dot (vector-normalize-copy! (new 'stack-no-clear 'vector) a1-19 1.0) (-> this aim-dir))) + ) + (a1-20 (new 'stack-no-clear 'event-message-block)) + ) + (set! (-> a1-20 from) (process->ppointer pp)) + (set! (-> a1-20 num-params) 1) + (set! (-> a1-20 message) 'is-section-shot) + (set! (-> a1-20 param 0) (-> (the-as collide-shape-prim-group sv-976) child sv-992 prim-id)) + (when (and (not (send-event-function s2-2 a1-20)) (< f26-2 f28-2)) + (vector-copy! s0-1 (-> (the-as collide-shape-prim-group sv-976) child sv-992 prim-core world-sphere)) + (vector-copy! sv-1024 s0-1) + (vector-copy! s1-1 s0-1) + (if #f + (add-debug-sphere #t (bucket-id debug) s0-1 (-> s0-1 w) *color-blue*) + ) + (set! f28-2 f26-2) + (set! sv-944 (the-as int (-> (the-as collide-shape-prim-group sv-976) child sv-992 prim-id))) + (the-as uint (the-as uint sv-944)) ) - (set! sv-992 (+ sv-992 1)) ) + (+! sv-992 1) ) ) - (set! sv-1008 (new 'stack-no-clear 'vector)) + ) + (let ((sv-1008 (new 'stack-no-clear 'vector))) (let ((f0-23 (vector-vector-distance s1-1 (-> s5-0 trans)))) (set! (-> sv-1008 x) (-> s1-1 w)) (set! (-> sv-1008 y) 0.0) @@ -1248,11 +1235,7 @@ ) (vector-! s3-2 s0-1 (-> s5-0 trans)) (vector-! s4-3 s1-1 (-> s5-0 trans)) - (let ((a1-32 sv-1040) - (v1-138 (-> s5-0 trans)) - ) - (vector-! a1-32 sv-1024 v1-138) - ) + (vector-! sv-1040 sv-1024 (-> s5-0 trans)) (vector-normalize! s3-2 1.0) (vector-normalize! s4-3 1.0) (vector-normalize! sv-1040 1.0) @@ -1260,17 +1243,8 @@ (f26-3 (acos (vector-dot s4-3 (-> s5-0 fvec)))) (t9-27 acos) ) - (let* ((v1-141 (-> s5-0 fvec)) - (f0-29 (-> sv-1040 x)) - (f1-3 (-> sv-1040 y)) - (f2-0 (-> sv-1040 z)) - (f3-0 (-> v1-141 x)) - (f4-0 (-> v1-141 y)) - (f5-0 (-> v1-141 z)) - ) - (.mula.s f0-29 f3-0) - (.madda.s f1-3 f4-0) - (.madd.s f0-30 f2-0 f5-0) + (let* ((v1-141 (-> s5-0 fvec))) + (set! f0-30 (vector-dot sv-1040 v1-141)) ) (let ((f24-1 (t9-27 f0-30)) (f0-31 (get-base-height *ocean-map*)) diff --git a/test/decompiler/reference/jak3/levels/wascity/wasdef-manager_REF.gc b/test/decompiler/reference/jak3/levels/wascity/wasdef-manager_REF.gc index e7e6edc0a4..ac017c6292 100644 --- a/test/decompiler/reference/jak3/levels/wascity/wasdef-manager_REF.gc +++ b/test/decompiler/reference/jak3/levels/wascity/wasdef-manager_REF.gc @@ -2612,10 +2612,8 @@ (let ((s5-0 (new 'stack-no-clear 'vector))) 0.0 (set-vector! s5-0 6585594.5 263189.94 -1938929.1 1.0) - (let ((f0-5 (vector-vector-distance-squared s5-0 (target-pos 0))) - (f1-0 409600.0) - ) - (if (and (< (* f1-0 f1-0) f0-5) (!= (-> this info index) 1)) + (let ((f0-5 (vector-vector-distance-squared s5-0 (target-pos 0)))) + (if (and (< (square 409600.0) f0-5) (!= (-> this info index) 1)) (send-event this 'fail) ) ) @@ -2796,7 +2794,3 @@ 0 (none) ) - - - - diff --git a/test/decompiler/reference/jak3/levels/wascity/wasgun-manager_REF.gc b/test/decompiler/reference/jak3/levels/wascity/wasgun-manager_REF.gc index d92c9871f2..90e9ce1652 100644 --- a/test/decompiler/reference/jak3/levels/wascity/wasgun-manager_REF.gc +++ b/test/decompiler/reference/jak3/levels/wascity/wasgun-manager_REF.gc @@ -1882,7 +1882,7 @@ ;; WARN: disable def twice: 88. This may happen when a cond (no else) is nested inside of another conditional, but it should be rare. ;; WARN: Function (method 26 task-manager-wascity-gungame) has a return type of none, but the expression builder found a return statement. (defmethod task-manager-method-26 ((this task-manager-wascity-gungame)) - (local-vars (a0-16 symbol) (sv-160 int)) + (local-vars (a0-16 symbol)) (if (not (handle->process (-> this wct))) (set! (-> this wct) (process->handle (process-by-name "wascity-turret-1" *active-pool*))) ) @@ -1894,34 +1894,30 @@ (set! (-> a1-3 y) 262144.0) (set! (-> a1-3 z) -1955430.4) (set! (-> a1-3 w) 1.0) - (set! a0-16 (cond - ((and (< 184320.0 (-> s5-0 y)) (let ((f0-5 (vector-vector-xz-distance-squared s5-0 a1-3)) - (f1-1 163840.0) - ) - (< f0-5 (* f1-1 f1-1)) - ) - ) - (when (not (-> this halfway-up?)) - (set! (-> this halfway-up?) #t) - (if (or (task-node-open? (game-task-node wascity-defend-get-to)) - (task-node-open? (game-task-node wascity-defend-introduction)) - ) - (set-setting! 'extra-bank '((wascity1 wasdef1)) 0.0 0) - (set-setting! 'extra-bank '((wascity3 wasgun2)) 0.0 0) - ) - (set! a0-16 #t) - (set! (-> *sky-work* disable-day-star) (the-as basic a0-16)) - a0-16 - ) + (set! a0-16 + (cond + ((and (< 184320.0 (-> s5-0 y)) (< (vector-vector-xz-distance-squared s5-0 a1-3) (square 163840.0))) + (when (not (-> this halfway-up?)) + (set! (-> this halfway-up?) #t) + (if (or (task-node-open? (game-task-node wascity-defend-get-to)) + (task-node-open? (game-task-node wascity-defend-introduction)) + ) + (set-setting! 'extra-bank '((wascity1 wasdef1)) 0.0 0) + (set-setting! 'extra-bank '((wascity3 wasgun2)) 0.0 0) ) - (else - (when (-> this halfway-up?) - (set! (-> this halfway-up?) #f) - (set! (-> *sky-work* disable-day-star) #f) - #f - ) - ) - ) + (set! a0-16 #t) + (set! (-> *sky-work* disable-day-star) (the-as basic a0-16)) + a0-16 + ) + ) + (else + (when (-> this halfway-up?) + (set! (-> this halfway-up?) #f) + (set! (-> *sky-work* disable-day-star) #f) + #f + ) + ) + ) ) ) ) @@ -1962,10 +1958,8 @@ (let ((s5-1 (new 'stack-no-clear 'vector))) 0.0 (set-vector! s5-1 6585594.5 263189.94 -1938929.1 1.0) - (let ((f0-11 (vector-vector-distance-squared s5-1 (target-pos 0))) - (f1-4 409600.0) - ) - (if (and (< (* f1-4 f1-4) f0-11) (!= (-> this info index) 1)) + (let ((f0-11 (vector-vector-distance-squared s5-1 (target-pos 0)))) + (if (and (< (square 409600.0) f0-11) (!= (-> this info index) 1)) (send-event this 'fail) ) ) @@ -1976,18 +1970,7 @@ (> (-> this point-queue) 0) ) (set! (-> this last-miss-count) (-> this miss-count)) - (let ((s5-2 sound-play-by-name) - (sname (static-sound-name "point-gained")) - (s3-0 (new-sound-id)) - (s2-0 1024) - (s1-0 0) - (s0-0 0) - ) - (set! sv-160 0) - (let ((t2-0 (wascity-turret-gun-pos))) - (s5-2 (the-as sound-name sname) s3-0 s2-0 s1-0 s0-0 (the-as sound-group sv-160) t2-0) - ) - ) + (sound-play "point-gained" :position (wascity-turret-gun-pos)) (set-time! (-> this added-points-time)) (cond ((< 33 (-> this point-queue)) @@ -2459,17 +2442,17 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defmethod task-manager-wascity-gungame-method-33 ((this task-manager-wascity-gungame)) - (local-vars (sv-16 res-tag)) (let ((s5-0 (entity-by-name "wascity-gungame-manager-1"))) (when #f (format 0 "***** Found entity for wascity-gungame~%") (set! (-> this wascity-gungame-entity) s5-0) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-1 (res-lump-data s5-0 'actor-groups pointer :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-1 (res-lump-data s5-0 'actor-groups (pointer actor-group) :tag-ptr (& sv-16))) + ) (cond ((and v1-1 (nonzero? (-> sv-16 elt-count))) (set! (-> this actor-group-count) (the-as int (-> sv-16 elt-count))) - (set! (-> this actor-group) (the-as (pointer actor-group) v1-1)) + (set! (-> this actor-group) v1-1) ) (else (format 0 "ERROR: task-manager-glider glider-manager entity missing actor-group!~%") @@ -2679,3 +2662,7 @@ ) (none) ) + + + + diff --git a/test/decompiler/reference/jak3/levels/wascity/wasstadium/nst-gas_REF.gc b/test/decompiler/reference/jak3/levels/wascity/wasstadium/nst-gas_REF.gc index 7b5a115349..ab1e796373 100644 --- a/test/decompiler/reference/jak3/levels/wascity/wasstadium/nst-gas_REF.gc +++ b/test/decompiler/reference/jak3/levels/wascity/wasstadium/nst-gas_REF.gc @@ -385,7 +385,7 @@ ) (when v1-5 (let ((f0-0 (-> (the-as task-manager-nest-cocoon-gas v1-5) poison-level))) - (set! (-> arg1 fade w) (* 0.006666667 (lerp 4.0 12.0 (* f0-0 f0-0)))) + (set! (-> arg1 fade w) (* 0.006666667 (lerp 4.0 12.0 (square f0-0)))) ) ) ) diff --git a/test/decompiler/reference/jak3/levels/wascity/wasstadium/nst-tasks_REF.gc b/test/decompiler/reference/jak3/levels/wascity/wasstadium/nst-tasks_REF.gc index ed2d558bb7..c9a2efe01c 100644 --- a/test/decompiler/reference/jak3/levels/wascity/wasstadium/nst-tasks_REF.gc +++ b/test/decompiler/reference/jak3/levels/wascity/wasstadium/nst-tasks_REF.gc @@ -432,16 +432,16 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch object vs none. (defmethod init-actor-group! ((this task-manager-nest-cocoons)) - (local-vars (sv-16 res-tag)) (let ((a0-2 (entity-by-name "nst-cocoon-manager-1"))) (when a0-2 (set! (-> this cocoon-manager-entity) (the-as entity-actor a0-2)) - (set! sv-16 (new 'static 'res-tag)) - (let ((v0-2 (res-lump-data a0-2 'actor-groups pointer :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v0-2 (res-lump-data a0-2 'actor-groups (pointer actor-group) :tag-ptr (& sv-16))) + ) (cond ((and v0-2 (nonzero? (-> sv-16 elt-count))) (set! (-> this actor-group-count) (the-as int (-> sv-16 elt-count))) - (set! (-> this actor-group) (the-as (pointer actor-group) v0-2)) + (set! (-> this actor-group) v0-2) ) (else (format 0 "ERROR: ~s: entity missing actor-group!~%" (game-task->string (-> this node-info task))) @@ -485,3 +485,7 @@ (spawn-dust-storm-randomizer this) (none) ) + + + + diff --git a/test/decompiler/reference/jak3/levels/wascity/wasstadium/sig-rider_REF.gc b/test/decompiler/reference/jak3/levels/wascity/wasstadium/sig-rider_REF.gc index 57593a09fa..fff6b015e0 100644 --- a/test/decompiler/reference/jak3/levels/wascity/wasstadium/sig-rider_REF.gc +++ b/test/decompiler/reference/jak3/levels/wascity/wasstadium/sig-rider_REF.gc @@ -143,10 +143,9 @@ ) (let ((v1-14 (-> *target* pilot))) (when (time-elapsed? (-> self complain-time) (seconds 3)) - (let* ((f0-0 1228800.0) - (f0-2 (* f0-0 f0-0)) - (a0-7 (-> v1-14 accel-array)) - ) + (let ((f0-2 (square 1228800.0)) + (a0-7 (-> v1-14 accel-array)) + ) (when (or (< f0-2 (+ (* (-> a0-7 0 x) (-> a0-7 0 x)) (* (-> a0-7 0 z) (-> a0-7 0 z)))) (< 4915200.0 (fabs (-> v1-14 accel-array 0 y))) ) @@ -190,11 +189,9 @@ ) ) ) - (let ((f0-4 20480.0)) - (if (< (* f0-4 f0-4) (vector-length-squared (-> *target* control transv))) - (set-time! (-> self last-moved-time)) - ) - ) + (if (< (square 20480.0) (vector-length-squared (-> *target* control transv))) + (set-time! (-> self last-moved-time)) + ) (when (time-elapsed? (-> self last-moved-time) (seconds 8)) (talker-spawn-func (-> *nest-eggs-speech-list* 20) *entity-pool* (target-pos 0) (the-as region #f)) (set! (-> self last-moved-time) (+ (current-time) (seconds 24))) diff --git a/test/decompiler/reference/jak3/levels/wascity/wasstadium/wasstadb-obs_REF.gc b/test/decompiler/reference/jak3/levels/wascity/wasstadium/wasstadb-obs_REF.gc index 4e77e4bf3a..6b6873cb87 100644 --- a/test/decompiler/reference/jak3/levels/wascity/wasstadium/wasstadb-obs_REF.gc +++ b/test/decompiler/reference/jak3/levels/wascity/wasstadium/wasstadb-obs_REF.gc @@ -1274,7 +1274,6 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch object vs none. (defmethod set-time-limit ((this task-manager-arena-training)) - (local-vars (sv-16 res-tag)) (when (not *arena-trainer-checkpoint-valid*) (set! *arena-trainer-checkpoint-time* 0.0) (set! (-> *arena-trainer-checkpoint-tokens* 0) (the-as uint -1)) @@ -1288,12 +1287,13 @@ (let ((a0-6 (entity-by-name "arena-trainer-1"))) (when a0-6 (set! (-> this entity) (the-as entity-actor a0-6)) - (set! sv-16 (new 'static 'res-tag)) - (let ((v0-5 (res-lump-data a0-6 'actor-groups pointer :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v0-5 (res-lump-data a0-6 'actor-groups (pointer actor-group) :tag-ptr (& sv-16))) + ) (cond ((and v0-5 (nonzero? (-> sv-16 elt-count))) (set! (-> this actor-group-count) (the-as int (-> sv-16 elt-count))) - (set! (-> this actor-group) (the-as (pointer actor-group) v0-5)) + (set! (-> this actor-group) v0-5) ) (else (format 0 "ERROR: ~s: entity missing actor-group!~%" (game-task->string (-> this node-info task))) @@ -1544,3 +1544,7 @@ (logclear! (-> this mask) (process-mask actor-pause)) (go (method-of-object this idle)) ) + + + + diff --git a/test/decompiler/reference/jak3/levels/wascity/wasstadium/wasstadc-obs_REF.gc b/test/decompiler/reference/jak3/levels/wascity/wasstadium/wasstadc-obs_REF.gc index a524a9cfe4..2b41b9e1f8 100644 --- a/test/decompiler/reference/jak3/levels/wascity/wasstadium/wasstadc-obs_REF.gc +++ b/test/decompiler/reference/jak3/levels/wascity/wasstadium/wasstadc-obs_REF.gc @@ -163,12 +163,6 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defmethod wstd-fight-plat-box-method-40 ((this wstd-fight-plat-box)) - (local-vars - (sv-144 (function sparticle-launch-control vector object)) - (sv-160 vector) - (sv-176 vector) - (sv-192 vector) - ) (rlet ((acc :class vf) (vf0 :class vf) (vf4 :class vf) @@ -203,16 +197,19 @@ (vector-normalize! s0-0 1.0) (when (< (vector-dot s0-0 (vector-! (new 'stack-no-clear 'vector) (camera-pos) (-> s5-0 s4-0))) 16384.0) (dotimes (s1-2 5) - (let ((s0-1 (-> this part))) - (set! sv-144 (method-of-object s0-1 spawn)) - (set! sv-192 (new 'stack-no-clear 'vector)) - (set! sv-160 (-> s5-0 s4-0)) - (set! sv-176 s2-1) - (let ((v1-39 (rand-vu))) - (.mov vf7 v1-39) + (let* ((s0-1 (-> this part)) + (sv-144 (method-of-object s0-1 spawn)) + (sv-192 (new 'stack-no-clear 'vector)) + ) + (let ((sv-160 (-> s5-0 s4-0))) + (let ((sv-176 s2-1)) + (let ((v1-39 (rand-vu))) + (.mov vf7 v1-39) + ) + (.lvf vf5 (&-> sv-176 quad)) + ) + (.lvf vf4 (&-> sv-160 quad)) ) - (.lvf vf5 (&-> sv-176 quad)) - (.lvf vf4 (&-> sv-160 quad)) (.add.x.vf.w vf6 vf0 vf0) (.mul.x.vf.xyz acc vf5 vf7) (.add.mul.w.vf.xyz vf6 vf4 vf0 acc) @@ -2631,19 +2628,19 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch object vs none. (defmethod set-time-limit ((this task-manager-arena-fight)) - (local-vars (sv-16 res-tag)) (let ((t9-0 (method-of-type task-manager set-time-limit))) (t9-0 this) ) (let ((a0-3 (entity-by-name "arena-fight-1"))) (when a0-3 (set! (-> this entity) (the-as entity-actor a0-3)) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-3 (res-lump-data a0-3 'actor-groups pointer :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-3 (res-lump-data a0-3 'actor-groups (pointer actor-group) :tag-ptr (& sv-16))) + ) (cond ((and v1-3 (nonzero? (-> sv-16 elt-count))) (set! (-> this actor-group-count) (the-as int (-> sv-16 elt-count))) - (set! (-> this actor-group) (the-as (pointer actor-group) v1-3)) + (set! (-> this actor-group) v1-3) ) (else (format 0 "ERROR: ~s: entity missing actor-group!~%" (game-task->string (-> this node-info task))) @@ -3125,7 +3122,6 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch object vs none. (defmethod set-time-limit ((this task-manager-arena-fight-2)) - (local-vars (sv-16 res-tag)) (let ((t9-0 (method-of-type task-manager set-time-limit))) (t9-0 this) ) @@ -3144,12 +3140,13 @@ (let ((a0-8 (entity-by-name "arena-fight-1"))) (when a0-8 (set! (-> this entity) (the-as entity-actor a0-8)) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-10 (res-lump-data a0-8 'actor-groups pointer :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-10 (res-lump-data a0-8 'actor-groups (pointer actor-group) :tag-ptr (& sv-16))) + ) (cond ((and v1-10 (nonzero? (-> sv-16 elt-count))) (set! (-> this actor-group-count) (the-as int (-> sv-16 elt-count))) - (set! (-> this actor-group) (the-as (pointer actor-group) v1-10)) + (set! (-> this actor-group) v1-10) ) (else (format 0 "ERROR: ~s: entity missing actor-group!~%" (game-task->string (-> this node-info task))) @@ -3412,7 +3409,6 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch object vs none. (defmethod set-time-limit ((this task-manager-arena-fight-3)) - (local-vars (sv-16 res-tag)) (let ((t9-0 (method-of-type task-manager set-time-limit))) (t9-0 this) ) @@ -3428,12 +3424,13 @@ (let ((a0-8 (entity-by-name "arena-fight-1"))) (when a0-8 (set! (-> this entity) (the-as entity-actor a0-8)) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-10 (res-lump-data a0-8 'actor-groups pointer :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-10 (res-lump-data a0-8 'actor-groups (pointer actor-group) :tag-ptr (& sv-16))) + ) (cond ((and v1-10 (nonzero? (-> sv-16 elt-count))) (set! (-> this actor-group-count) (the-as int (-> sv-16 elt-count))) - (set! (-> this actor-group) (the-as (pointer actor-group) v1-10)) + (set! (-> this actor-group) v1-10) ) (else (format 0 "ERROR: ~s: entity missing actor-group!~%" (game-task->string (-> this node-info task))) diff --git a/test/decompiler/test_DisasmVifDecompile.cpp b/test/decompiler/test_DisasmVifDecompile.cpp index 93f6e7be9c..9d2742ae55 100644 --- a/test/decompiler/test_DisasmVifDecompile.cpp +++ b/test/decompiler/test_DisasmVifDecompile.cpp @@ -515,172 +515,143 @@ TEST_F(FormRegressionTestJak1, ExprDisasmVif) { " daddiu sp, sp, 192"; std::string type = "(function (pointer vif-tag) int symbol symbol int)"; std::string expected = - "(let ((gp-0 0))\n" - " (while (< gp-0 (* arg1 4))\n" - " (let ((s0-0 4))\n" - " (let ((s1-0 (-> arg0 0)))\n" - " (format arg2 \" #x~X:\" arg0)\n" - " (dotimes (v1-0 (-> *vif-disasm-table* length))\n" - " (set! sv-16 (-> s1-0 cmd))\n" - " (when\n" - " (=\n" - " (logand sv-16 (-> *vif-disasm-table* v1-0 mask))\n" - " (-> *vif-disasm-table* v1-0 tag)\n" - " )\n" - " (let ((a0-12 (-> *vif-disasm-table* v1-0 print)))\n" - " (cond\n" - " ((zero? a0-12)\n" - " (format\n" - " arg2\n" - " \" (~s :irq ~D)~%\"\n" - " (-> *vif-disasm-table* v1-0 string1)\n" - " (-> s1-0 irq)\n" - " )\n" - " )\n" - " ((= a0-12 1)\n" - " (format\n" - " arg2\n" - " \" (~s :irq ~D :~s #x~X)~%\"\n" - " (-> *vif-disasm-table* v1-0 string1)\n" - " (-> s1-0 irq)\n" - " (-> *vif-disasm-table* v1-0 string2)\n" - " (-> s1-0 imm)\n" - " )\n" - " )\n" - " ((= a0-12 2)\n" - " (let ((t1-1 (-> s1-0 imm)))\n" - " (format\n" - " arg2\n" - " \" (~s :irq ~D :wl ~D :cl ~D)~%\"\n" - " (-> *vif-disasm-table* v1-0 string1)\n" - " (-> s1-0 irq)\n" - " (shr (shl t1-1 48) 56)\n" - " (shr (shl t1-1 56) 56)\n" - " )\n" - " )\n" - " )\n" - " ((= a0-12 3)\n" - " (set! s0-0 8)\n" - " (format\n" - " arg2\n" - " \" (~s :irq ~D :~s #x~X)~%\"\n" - " (-> *vif-disasm-table* v1-0 string1)\n" - " (-> s1-0 irq)\n" - " (-> *vif-disasm-table* v1-0 string2)\n" - " (-> arg0 1)\n" - " )\n" - " )\n" - " ((= a0-12 4)\n" - " (set! s0-0 20)\n" - " (format\n" - " arg2\n" - " \" (~s :irq ~D :~s \"\n" - " (-> *vif-disasm-table* v1-0 string1)\n" - " (-> s1-0 irq)\n" - " (-> *vif-disasm-table* v1-0 string2)\n" - " )\n" - " (format\n" - " arg2\n" - " \"#x~X #x~X #x~X #x~X)~%\"\n" - " (-> arg0 1)\n" - " (-> arg0 2)\n" - " (-> arg0 3)\n" - " (-> arg0 4)\n" - " )\n" - " )\n" - " ((= a0-12 5)\n" - " (format\n" - " arg2\n" - " \" (~s :irq ~D :instructions #x~D :addr #x~X)~%\"\n" - " (-> *vif-disasm-table* v1-0 string1)\n" - " (-> s1-0 irq)\n" - " (-> s1-0 num)\n" - " (-> s1-0 imm)\n" - " )\n" - " )\n" - " ((= a0-12 6)\n" - " (if (-> s1-0 imm)\n" - " (set! s0-0 #x100000)\n" - " (set! s0-0 (the-as int (* (-> s1-0 imm) 16)))\n" - " )\n" - " (format\n" - " arg2\n" - " \" (~s :irq ~D :qwc #x~D)~%\"\n" - " (-> *vif-disasm-table* v1-0 string1)\n" - " (-> s1-0 irq)\n" - " (-> s1-0 imm)\n" - " )\n" - " (set! sv-32 (&-> arg0 1))\n" - " (set! sv-48 0)\n" - " (while (< sv-48 (the-as int (-> s1-0 imm)))\n" - " (format\n" - " arg2\n" - " \" #x~X: #x~8x #x~8x #x~8x #x~8x~%\"\n" - " (+ (+ (* sv-48 16) 4) (the-as int arg0))\n" - " (-> sv-32 (* sv-48 4))\n" - " (-> sv-32 (+ (* sv-48 4) 1))\n" - " (-> sv-32 (+ (* sv-48 4) 2))\n" - " (-> sv-32 (+ (* sv-48 4) 3))\n" - " )\n" - " (set! sv-48 (+ sv-48 1))\n" - " )\n" - " #f\n" - " )\n" - " ((= a0-12 7)\n" - " (set!\n" - " s0-0\n" - " (the-as\n" - " int\n" - " (+\n" - " (logand\n" - " -4\n" - " (+ (* (-> *vif-disasm-table* v1-0 val) (-> s1-0 num)) 3)\n" - " )\n" - " 4\n" - " )\n" - " )\n" - " )\n" - " (set! sv-64 (-> s1-0 imm))\n" - " (format\n" - " arg2\n" - " \" (~s :irq ~D :num ~D :addr #x~X \"\n" - " (-> *vif-disasm-table* v1-0 string1)\n" - " (-> s1-0 irq)\n" - " (-> s1-0 num)\n" - " (shr (shl sv-64 54) 54)\n" - " )\n" - " (format\n" - " arg2\n" - " \":msk ~D :flg ~D :usn ~D [skip ~d])~%\"\n" - " (-> s1-0 msk)\n" - " (shr (shl sv-64 48) 63)\n" - " (shr (shl sv-64 49) 63)\n" - " (the-as uint s0-0)\n" - " )\n" - " (if arg3\n" - " (disasm-vif-details\n" - " arg2\n" - " (the-as (pointer uint8) arg0)\n" - " (logand sv-16 (vif-cmd cmd-mask))\n" - " (the-as int (-> s1-0 num))\n" - " )\n" - " )\n" - " )\n" - " ((= a0-12 8)\n" - " (format arg2 \" (*unknown* vif-tag #x~X)~%\" (-> s1-0 cmd))\n" - " )\n" - " )\n" - " )\n" - " (set! v1-0 (-> *vif-disasm-table* length))\n" - " )\n" - " )\n" - " )\n" - " (+! gp-0 s0-0)\n" - " (&+! arg0 s0-0)\n" - " )\n" - " )\n" - " (- gp-0 (* arg1 4))\n" - " )"; + R"((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)) + (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 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) + ) + ) + ((= a0-12 2) + (let ((t1-1 (-> s1-0 imm))) + (format + arg2 + " (~s :irq ~D :wl ~D :cl ~D)~%" + (-> *vif-disasm-table* v1-0 string1) + (-> s1-0 irq) + (shr (shl t1-1 48) 56) + (shr (shl t1-1 56) 56) + ) + ) + ) + ((= 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 (-> 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) + (shr (shl sv-64 54) 54) + ) + (format + arg2 + ":msk ~D :flg ~D :usn ~D [skip ~d])~%" + (-> s1-0 msk) + (shr (shl sv-64 48) 63) + (shr (shl sv-64 49) 63) + (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)) + ) + ) + ) + ) + (+! gp-0 s0-0) + (&+! arg0 s0-0) + ) + ) + (- gp-0 (* arg1 4)) + ) +)"; test_with_expr(func, type, expected, false, "", {{"L139", " #x~X:"}, {"L138", " (~s :irq ~D)~%"}, diff --git a/test/decompiler/test_FormExpressionBuild.cpp b/test/decompiler/test_FormExpressionBuild.cpp index d8b2890cf7..ea513371b1 100644 --- a/test/decompiler/test_FormExpressionBuild.cpp +++ b/test/decompiler/test_FormExpressionBuild.cpp @@ -2545,7 +2545,7 @@ TEST_F(FormRegressionTestJak1, ExprTerminal2) { std::string expected = "(let\n" " ((f0-4 (sqrtf (/ (- (* 0.0 arg0) arg1) arg2))))\n" - " (- f0-4 (+ arg1 (* arg2 (* f0-4 f0-4))))\n" + " (- f0-4 (+ arg1 (* arg2 (square f0-4))))\n" " )"; test_with_expr(func, type, expected, false, "", {{"L17", "A ~A"}}); }